summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile23
-rw-r--r--SConstruct20
-rwxr-xr-xbin/mklib11
-rw-r--r--common.py3
-rw-r--r--configs/autoconf.in5
-rw-r--r--configs/default10
-rw-r--r--configs/freebsd-dri1
-rw-r--r--configs/linux-cell4
-rw-r--r--configs/linux-dri7
-rw-r--r--configs/linux-dri-xcb2
-rw-r--r--configs/linux-egl6
-rw-r--r--configs/linux-i9651
-rw-r--r--configs/linux-indirect1
-rw-r--r--configs/linux-llvm4
-rw-r--r--configs/linux-opengl-es8
-rw-r--r--configure.ac85
-rw-r--r--docs/GL3.txt3
-rw-r--r--docs/egl.html4
-rw-r--r--docs/install.html2
-rw-r--r--docs/relnotes-7.9.html50
-rw-r--r--include/GL/glut_h.dja340
-rw-r--r--include/GL/internal/dri_interface.h20
-rw-r--r--include/GL/mglmesa.h79
-rw-r--r--progs/SConscript1
-rw-r--r--progs/demos/dissolve.c137
-rw-r--r--progs/demos/stex3d.c15
-rw-r--r--progs/egl/Makefile70
-rw-r--r--progs/egl/egltri.c264
-rw-r--r--progs/egl/eglut/Makefile35
-rw-r--r--progs/egl/eglut/eglut.c326
-rw-r--r--progs/egl/eglut/eglut.h67
-rw-r--r--progs/egl/eglut/eglut_screen.c154
-rw-r--r--progs/egl/eglut/eglut_x11.c220
-rw-r--r--progs/egl/eglut/eglutint.h78
-rw-r--r--progs/egl/opengl/.gitignore (renamed from progs/egl/.gitignore)7
-rw-r--r--progs/egl/opengl/Makefile83
-rw-r--r--progs/egl/opengl/demo1.c (renamed from progs/egl/demo1.c)0
-rw-r--r--progs/egl/opengl/demo2.c (renamed from progs/egl/demo2.c)0
-rw-r--r--progs/egl/opengl/demo3.c (renamed from progs/egl/demo3.c)0
-rw-r--r--progs/egl/opengl/eglgears.c (renamed from progs/egl/eglgears.c)241
-rw-r--r--progs/egl/opengl/eglinfo.c (renamed from progs/egl/eglinfo.c)0
-rw-r--r--progs/egl/opengl/eglscreen.c (renamed from progs/egl/eglscreen.c)0
-rw-r--r--progs/egl/opengl/egltri.c (renamed from progs/es1/screen/tri.c)138
-rw-r--r--progs/egl/opengl/peglgears.c (renamed from progs/egl/peglgears.c)0
-rw-r--r--progs/egl/opengl/xeglgears.c (renamed from progs/egl/xeglgears.c)0
-rw-r--r--progs/egl/opengl/xeglthreads.c (renamed from progs/egl/xeglthreads.c)0
-rw-r--r--progs/egl/opengles1/.gitignore12
-rw-r--r--progs/egl/opengles1/Makefile106
-rw-r--r--progs/egl/opengles1/bindtex.c (renamed from progs/es1/xegl/bindtex.c)0
-rw-r--r--progs/egl/opengles1/drawtex.c (renamed from progs/es1/xegl/drawtex.c)0
-rw-r--r--progs/egl/opengles1/es1_info.c (renamed from progs/es1/xegl/es1_info.c)0
-rw-r--r--progs/egl/opengles1/gears.c (renamed from progs/es1/screen/gears.c)43
-rw-r--r--progs/egl/opengles1/msaa.c (renamed from progs/es1/xegl/msaa.c)0
-rw-r--r--progs/egl/opengles1/pbuffer.c (renamed from progs/es1/xegl/pbuffer.c)0
-rw-r--r--progs/egl/opengles1/render_tex.c (renamed from progs/es1/xegl/render_tex.c)0
-rw-r--r--progs/egl/opengles1/texture_from_pixmap.c579
-rw-r--r--progs/egl/opengles1/torus.c (renamed from progs/es1/xegl/torus.c)0
-rw-r--r--progs/egl/opengles1/tri.c211
-rw-r--r--progs/egl/opengles1/two_win.c (renamed from progs/es1/xegl/two_win.c)0
-rw-r--r--progs/egl/opengles2/.gitignore3
-rw-r--r--progs/egl/opengles2/Makefile (renamed from progs/es2/xegl/Makefile)4
-rw-r--r--progs/egl/opengles2/tri.c (renamed from progs/es2/xegl/tri.c)0
-rw-r--r--progs/egl/openvg/.gitignore (renamed from progs/openvg/.gitignore)6
-rw-r--r--progs/egl/openvg/Makefile55
-rw-r--r--progs/egl/openvg/lion-render.c (renamed from progs/openvg/demos/lion-render.c)0
-rw-r--r--progs/egl/openvg/lion-render.h (renamed from progs/openvg/demos/lion-render.h)0
-rw-r--r--progs/egl/openvg/lion.c65
-rw-r--r--progs/egl/openvg/sp.c (renamed from progs/openvg/demos/sp.c)47
-rw-r--r--progs/egl/openvg/trivial/Makefile (renamed from progs/openvg/trivial/Makefile)3
-rw-r--r--progs/egl/openvg/trivial/arc.c (renamed from progs/openvg/trivial/arc.c)0
-rw-r--r--progs/egl/openvg/trivial/cap.c (renamed from progs/openvg/trivial/cap.c)0
-rw-r--r--progs/egl/openvg/trivial/clear.c (renamed from progs/openvg/trivial/clear.c)0
-rw-r--r--progs/egl/openvg/trivial/coord.c (renamed from progs/openvg/trivial/coord.c)0
-rw-r--r--progs/egl/openvg/trivial/dash.c (renamed from progs/openvg/trivial/dash.c)0
-rw-r--r--progs/egl/openvg/trivial/eglcommon.c (renamed from progs/openvg/demos/eglcommon.c)0
-rw-r--r--progs/egl/openvg/trivial/eglcommon.h (renamed from progs/openvg/demos/eglcommon.h)0
-rw-r--r--progs/egl/openvg/trivial/ellipse.c (renamed from progs/openvg/trivial/ellipse.c)0
-rw-r--r--progs/egl/openvg/trivial/filter.c (renamed from progs/openvg/trivial/filter.c)0
-rw-r--r--progs/egl/openvg/trivial/gradorigin.c (renamed from progs/openvg/trivial/gradorigin.c)0
-rw-r--r--progs/egl/openvg/trivial/lineto.c (renamed from progs/openvg/trivial/lineto.c)0
-rw-r--r--progs/egl/openvg/trivial/lingrad.c (renamed from progs/openvg/trivial/lingrad.c)0
-rw-r--r--progs/egl/openvg/trivial/lookup.c (renamed from progs/openvg/trivial/lookup.c)0
-rw-r--r--progs/egl/openvg/trivial/mask.c (renamed from progs/openvg/trivial/mask.c)0
-rw-r--r--progs/egl/openvg/trivial/mask4.c (renamed from progs/openvg/trivial/mask4.c)0
-rw-r--r--progs/egl/openvg/trivial/path3.c (renamed from progs/openvg/trivial/path3.c)0
-rw-r--r--progs/egl/openvg/trivial/radialgrad.c (renamed from progs/openvg/trivial/radialgrad.c)0
-rw-r--r--progs/egl/openvg/trivial/readpixels.c (renamed from progs/openvg/trivial/readpixels.c)0
-rw-r--r--progs/egl/openvg/trivial/roundedrect.c (renamed from progs/openvg/trivial/roundedrect.c)0
-rw-r--r--progs/egl/openvg/trivial/star-nonzero.c (renamed from progs/openvg/trivial/star-nonzero.c)0
-rw-r--r--progs/egl/openvg/trivial/star-oddeven.c (renamed from progs/openvg/trivial/star-oddeven.c)0
-rw-r--r--progs/egl/openvg/trivial/stroke.c (renamed from progs/openvg/trivial/stroke.c)0
-rw-r--r--progs/egl/openvg/trivial/stroke2.c (renamed from progs/openvg/trivial/stroke2.c)0
-rw-r--r--progs/egl/openvg/trivial/vguarc.c (renamed from progs/openvg/trivial/vguarc.c)0
-rw-r--r--progs/egl/xegl_tri.c361
-rw-r--r--progs/es1/.gitignore11
-rw-r--r--progs/es1/screen/Makefile32
-rw-r--r--progs/es1/screen/winsys.c272
-rw-r--r--progs/es1/xegl/Makefile82
-rw-r--r--progs/es1/xegl/tri.c470
-rw-r--r--progs/es2/.gitignore3
-rw-r--r--progs/fpglsl/dowhile.glsl8
-rw-r--r--progs/fpglsl/dowhile2.glsl10
-rw-r--r--progs/fpglsl/for.glsl11
-rw-r--r--progs/fpglsl/forbreak.glsl13
-rw-r--r--progs/fpglsl/fp-tri.c5
-rw-r--r--progs/fpglsl/simpleif.glsl6
-rw-r--r--progs/fpglsl/while.glsl7
-rw-r--r--progs/fpglsl/while2.glsl9
-rwxr-xr-xprogs/gallium/python/retrace/interpreter.py1
-rw-r--r--progs/gallium/python/samples/tri.py21
-rwxr-xr-xprogs/gallium/python/tests/base.py91
-rwxr-xr-xprogs/gallium/python/tests/surface_copy.py130
-rwxr-xr-xprogs/gallium/python/tests/texture_blit.py (renamed from progs/gallium/python/tests/texture_sample.py)203
-rwxr-xr-xprogs/gallium/python/tests/texture_render.py4
-rwxr-xr-xprogs/gallium/python/tests/texture_transfer.py115
-rw-r--r--progs/gallium/raw/SConscript17
-rw-r--r--progs/gallium/raw/clear.c95
-rw-r--r--progs/gallium/trivial/.gitignore3
-rw-r--r--progs/gallium/trivial/Makefile44
-rw-r--r--progs/gallium/trivial/quad-tex.c346
-rw-r--r--progs/gallium/trivial/tri.c278
-rw-r--r--progs/gallium/unit/Makefile44
-rw-r--r--progs/gallium/unit/SConscript5
-rw-r--r--progs/gallium/unit/u_format_test.c838
-rw-r--r--progs/gallium/unit/u_half_test.c32
-rw-r--r--progs/glsl/Makefile4
-rw-r--r--progs/glsl/SConscript2
-rw-r--r--progs/glsl/fsraytrace.c412
-rw-r--r--progs/glsl/vsraytrace.c401
-rw-r--r--progs/objviewer/skybox.c4
-rw-r--r--progs/openvg/demos/Makefile39
-rw-r--r--progs/openvg/demos/lion.c289
-rw-r--r--progs/openvg/trivial/eglcommon.c289
-rw-r--r--progs/openvg/trivial/eglcommon.h20
-rw-r--r--progs/samples/copy.c27
-rw-r--r--progs/samples/loadppm.c6
-rw-r--r--progs/tests/fbotest1.c6
-rw-r--r--progs/tests/fbotest2.c52
-rw-r--r--progs/tests/fbotest3.c6
-rw-r--r--progs/tests/stencil_twoside.c85
-rw-r--r--progs/trivial/Makefile1
-rw-r--r--progs/trivial/SConscript3
-rw-r--r--progs/trivial/clear-fbo-scissor.c234
-rw-r--r--progs/trivial/tri-stencil.c3
-rw-r--r--progs/xdemos/Makefile4
-rw-r--r--progs/xdemos/omlsync.c10
-rw-r--r--scons/llvm.py133
-rw-r--r--scons/x11.py52
-rw-r--r--src/SConscript9
-rw-r--r--src/egl/main/eglcontext.c53
-rw-r--r--src/gallium/Makefile.template7
-rw-r--r--src/gallium/SConscript7
-rw-r--r--src/gallium/auxiliary/Makefile34
-rw-r--r--src/gallium/auxiliary/SConscript41
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_cache.c21
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_cache.h16
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.c335
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.h52
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_aaline.c66
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_pstipple.c72
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_vbuf.c37
-rw-r--r--src/gallium/auxiliary/draw/draw_pt.c5
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_decompose.h40
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_emit.c37
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch_emit.c39
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c29
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h38
-rw-r--r--src/gallium/auxiliary/draw/draw_vertex.c37
-rw-r--r--src/gallium/auxiliary/draw/draw_vertex.h35
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_aos_io.c12
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld.h47
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_alpha.h2
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_arit.c275
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_arit.h6
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_blend.h2
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_const.c28
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_const.h10
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_conv.c34
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_conv.h2
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_debug.h2
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_depth.c608
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_depth.h19
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_flow.c28
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_flow.h6
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_format.h2
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_format_aos.c383
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_format_query.c72
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_format_soa.c123
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_interp.c6
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_interp.h2
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_intr.h2
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_logic.c163
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_logic.h7
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_pack.c19
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_pack.h2
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_printf.c121
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_printf.h (renamed from src/gallium/drivers/cell/ppu/cell_winsys.h)34
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_sample.c53
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_sample.h11
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c1337
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_struct.h2
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_swizzle.c4
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_swizzle.h2
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_tgsi.h2
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c195
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_type.c13
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_type.h54
-rw-r--r--src/gallium/auxiliary/os/os_thread.h12
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c9
-rw-r--r--src/gallium/auxiliary/rtasm/rtasm_x86sse.c2
-rw-r--r--src/gallium/auxiliary/rtasm/rtasm_x86sse.h6
-rw-r--r--src/gallium/auxiliary/target-helpers/wrap_screen.c65
-rw-r--r--src/gallium/auxiliary/target-helpers/wrap_screen.h16
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_text.c4
-rw-r--r--src/gallium/auxiliary/translate/translate_generic.c8
-rw-r--r--src/gallium/auxiliary/translate/translate_sse.c4
-rw-r--r--src/gallium/auxiliary/util/.gitignore2
-rw-r--r--src/gallium/auxiliary/util/u_blit.c76
-rw-r--r--src/gallium/auxiliary/util/u_blit.h4
-rw-r--r--src/gallium/auxiliary/util/u_blitter.c67
-rw-r--r--src/gallium/auxiliary/util/u_blitter.h32
-rw-r--r--src/gallium/auxiliary/util/u_debug.c51
-rw-r--r--src/gallium/auxiliary/util/u_debug.h17
-rw-r--r--src/gallium/auxiliary/util/u_draw_quad.c12
-rw-r--r--src/gallium/auxiliary/util/u_dump_state.c1
-rw-r--r--src/gallium/auxiliary/util/u_format.c118
-rw-r--r--src/gallium/auxiliary/util/u_format.csv79
-rw-r--r--src/gallium/auxiliary/util/u_format.h141
-rw-r--r--src/gallium/auxiliary/util/u_format_access.py341
-rw-r--r--src/gallium/auxiliary/util/u_format_pack.py531
-rwxr-xr-xsrc/gallium/auxiliary/util/u_format_parse.py12
-rw-r--r--src/gallium/auxiliary/util/u_format_s3tc.c745
-rw-r--r--src/gallium/auxiliary/util/u_format_s3tc.h218
-rwxr-xr-xsrc/gallium/auxiliary/util/u_format_table.py31
-rw-r--r--src/gallium/auxiliary/util/u_format_tests.c718
-rw-r--r--src/gallium/auxiliary/util/u_format_tests.h71
-rw-r--r--src/gallium/auxiliary/util/u_gen_mipmap.c77
-rw-r--r--src/gallium/auxiliary/util/u_gen_mipmap.h2
-rw-r--r--src/gallium/auxiliary/util/u_half.h63
-rw-r--r--src/gallium/auxiliary/util/u_half.py179
-rw-r--r--src/gallium/auxiliary/util/u_init.h52
-rw-r--r--src/gallium/auxiliary/util/u_inlines.h28
-rw-r--r--src/gallium/auxiliary/util/u_memory.h2
-rw-r--r--src/gallium/auxiliary/util/u_pack_color.h31
-rw-r--r--src/gallium/auxiliary/util/u_rect.c26
-rw-r--r--src/gallium/auxiliary/util/u_sampler.c100
-rw-r--r--src/gallium/auxiliary/util/u_sampler.h (renamed from src/gallium/drivers/softpipe/sp_winsys.h)62
-rw-r--r--src/gallium/auxiliary/util/u_simple_screen.c16
-rw-r--r--src/gallium/auxiliary/util/u_tile.c853
-rw-r--r--src/gallium/auxiliary/util/u_tile.h32
-rw-r--r--src/gallium/auxiliary/vl/vl_compositor.c31
-rw-r--r--src/gallium/auxiliary/vl/vl_compositor.h2
-rw-r--r--src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c136
-rw-r--r--src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h4
-rw-r--r--src/gallium/docs/d3d11ddi.txt492
-rw-r--r--src/gallium/docs/source/context.rst41
-rw-r--r--src/gallium/docs/source/cso/blend.rst2
-rw-r--r--src/gallium/docs/source/cso/rasterizer.rst76
-rw-r--r--src/gallium/docs/source/cso/velems.rst24
-rw-r--r--src/gallium/drivers/cell/ppu/Makefile1
-rw-r--r--src/gallium/drivers/cell/ppu/cell_buffer.c118
-rw-r--r--src/gallium/drivers/cell/ppu/cell_buffer.h55
-rw-r--r--src/gallium/drivers/cell/ppu/cell_context.c4
-rw-r--r--src/gallium/drivers/cell/ppu/cell_context.h11
-rw-r--r--src/gallium/drivers/cell/ppu/cell_draw_arrays.c66
-rw-r--r--src/gallium/drivers/cell/ppu/cell_fence.c8
-rw-r--r--src/gallium/drivers/cell/ppu/cell_gen_fragment.c12
-rw-r--r--src/gallium/drivers/cell/ppu/cell_pipe_state.c69
-rw-r--r--src/gallium/drivers/cell/ppu/cell_public.h10
-rw-r--r--src/gallium/drivers/cell/ppu/cell_screen.c44
-rw-r--r--src/gallium/drivers/cell/ppu/cell_screen.h22
-rw-r--r--src/gallium/drivers/cell/ppu/cell_state_emit.c5
-rw-r--r--src/gallium/drivers/cell/ppu/cell_state_shader.c18
-rw-r--r--src/gallium/drivers/cell/ppu/cell_state_vertex.c42
-rw-r--r--src/gallium/drivers/cell/ppu/cell_texture.c148
-rw-r--r--src/gallium/drivers/cell/ppu/cell_texture.h19
-rw-r--r--src/gallium/drivers/cell/ppu/cell_vertex_shader.c1
-rw-r--r--src/gallium/drivers/cell/spu/spu_command.c4
-rw-r--r--src/gallium/drivers/cell/spu/spu_per_fragment_op.c4
-rw-r--r--src/gallium/drivers/failover/fo_context.c1
-rw-r--r--src/gallium/drivers/failover/fo_context.h21
-rw-r--r--src/gallium/drivers/failover/fo_state.c171
-rw-r--r--src/gallium/drivers/failover/fo_state_emit.c34
-rw-r--r--src/gallium/drivers/i915/i915_batch.h10
-rw-r--r--src/gallium/drivers/i915/i915_batchbuffer.h (renamed from src/gallium/drivers/i915/intel_batchbuffer.h)50
-rw-r--r--src/gallium/drivers/i915/i915_blit.c12
-rw-r--r--src/gallium/drivers/i915/i915_blit.h6
-rw-r--r--src/gallium/drivers/i915/i915_buffer.c4
-rw-r--r--src/gallium/drivers/i915/i915_context.c1
-rw-r--r--src/gallium/drivers/i915/i915_context.h41
-rw-r--r--src/gallium/drivers/i915/i915_debug.c2
-rw-r--r--src/gallium/drivers/i915/i915_debug.h4
-rw-r--r--src/gallium/drivers/i915/i915_debug_fp.c1
-rw-r--r--src/gallium/drivers/i915/i915_prim_emit.c7
-rw-r--r--src/gallium/drivers/i915/i915_prim_vbuf.c16
-rw-r--r--src/gallium/drivers/i915/i915_screen.c20
-rw-r--r--src/gallium/drivers/i915/i915_screen.h4
-rw-r--r--src/gallium/drivers/i915/i915_state.c93
-rw-r--r--src/gallium/drivers/i915/i915_state_derived.c8
-rw-r--r--src/gallium/drivers/i915/i915_state_emit.c13
-rw-r--r--src/gallium/drivers/i915/i915_state_immediate.c6
-rw-r--r--src/gallium/drivers/i915/i915_state_sampler.c28
-rw-r--r--src/gallium/drivers/i915/i915_texture.c161
-rw-r--r--src/gallium/drivers/i915/i915_winsys.h (renamed from src/gallium/drivers/i915/intel_winsys.h)136
-rw-r--r--src/gallium/drivers/i965/brw_context.c1
-rw-r--r--src/gallium/drivers/i965/brw_context.h9
-rw-r--r--src/gallium/drivers/i965/brw_draw_upload.c208
-rw-r--r--src/gallium/drivers/i965/brw_misc_state.c2
-rw-r--r--src/gallium/drivers/i965/brw_pipe_clear.c4
-rw-r--r--src/gallium/drivers/i965/brw_pipe_sampler.c54
-rw-r--r--src/gallium/drivers/i965/brw_pipe_vertex.c247
-rw-r--r--src/gallium/drivers/i965/brw_screen.c10
-rw-r--r--src/gallium/drivers/i965/brw_screen.h13
-rw-r--r--src/gallium/drivers/i965/brw_screen_texture.c265
-rw-r--r--src/gallium/drivers/i965/brw_structs.h4
-rw-r--r--src/gallium/drivers/i965/brw_winsys.h32
-rw-r--r--src/gallium/drivers/i965/brw_wm.c4
-rw-r--r--src/gallium/drivers/i965/brw_wm_sampler_state.c8
-rw-r--r--src/gallium/drivers/i965/brw_wm_surface_state.c6
-rw-r--r--src/gallium/drivers/identity/id_context.c221
-rw-r--r--src/gallium/drivers/identity/id_drm.c61
-rw-r--r--src/gallium/drivers/identity/id_objects.c18
-rw-r--r--src/gallium/drivers/identity/id_objects.h34
-rw-r--r--src/gallium/drivers/identity/id_screen.c137
-rw-r--r--src/gallium/drivers/llvmpipe/Makefile17
-rw-r--r--src/gallium/drivers/llvmpipe/README19
-rw-r--r--src/gallium/drivers/llvmpipe/SConscript2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_buffer.c1
-rw-r--r--src/gallium/drivers/llvmpipe/lp_context.c16
-rw-r--r--src/gallium/drivers/llvmpipe/lp_context.h16
-rw-r--r--src/gallium/drivers/llvmpipe/lp_fence.c16
-rw-r--r--src/gallium/drivers/llvmpipe/lp_fence.h4
-rw-r--r--src/gallium/drivers/llvmpipe/lp_flush.c68
-rw-r--r--src/gallium/drivers/llvmpipe/lp_flush.h12
-rw-r--r--src/gallium/drivers/llvmpipe/lp_jit.c60
-rw-r--r--src/gallium/drivers/llvmpipe/lp_jit.h58
-rw-r--r--src/gallium/drivers/llvmpipe/lp_public.h10
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast.c73
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast.h4
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast_priv.h1
-rw-r--r--src/gallium/drivers/llvmpipe/lp_scene.c73
-rw-r--r--src/gallium/drivers/llvmpipe/lp_scene.h2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_screen.c60
-rw-r--r--src/gallium/drivers/llvmpipe/lp_screen.h9
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.c134
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.h42
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_context.h24
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_line.c4
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_point.c4
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_tri.c75
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_vbuf.c153
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state.h42
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_derived.c17
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_fs.c167
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_rasterizer.c3
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_sampler.c65
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_surface.c4
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_vertex.c35
-rw-r--r--src/gallium/drivers/llvmpipe/lp_surface.c15
-rw-r--r--src/gallium/drivers/llvmpipe/lp_test.h2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_test_format.c314
-rw-r--r--src/gallium/drivers/llvmpipe/lp_test_printf.c162
-rw-r--r--src/gallium/drivers/llvmpipe/lp_tex_sample.h2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_tex_sample_llvm.c53
-rw-r--r--src/gallium/drivers/llvmpipe/lp_texture.c281
-rw-r--r--src/gallium/drivers/llvmpipe/lp_texture.h37
-rw-r--r--src/gallium/drivers/llvmpipe/lp_tile_soa.py49
-rw-r--r--src/gallium/drivers/nouveau/Makefile3
-rw-r--r--src/gallium/drivers/nouveau/nouveau_screen.c75
-rw-r--r--src/gallium/drivers/nouveau/nouveau_screen.h12
-rw-r--r--src/gallium/drivers/nouveau/nouveau_util.h102
-rw-r--r--src/gallium/drivers/nouveau/nouveau_winsys.h5
-rw-r--r--src/gallium/drivers/nv30/Makefile29
-rw-r--r--src/gallium/drivers/nv30/nv30_context.c87
-rw-r--r--src/gallium/drivers/nv30/nv30_context.h218
-rw-r--r--src/gallium/drivers/nv30/nv30_draw.c61
-rw-r--r--src/gallium/drivers/nv30/nv30_fragprog.c905
-rw-r--r--src/gallium/drivers/nv30/nv30_miptree.c239
-rw-r--r--src/gallium/drivers/nv30/nv30_query.c127
-rw-r--r--src/gallium/drivers/nv30/nv30_screen.c362
-rw-r--r--src/gallium/drivers/nv30/nv30_screen.h41
-rw-r--r--src/gallium/drivers/nv30/nv30_shader.h490
-rw-r--r--src/gallium/drivers/nv30/nv30_state.c728
-rw-r--r--src/gallium/drivers/nv30/nv30_state.h86
-rw-r--r--src/gallium/drivers/nv30/nv30_state_blend.c41
-rw-r--r--src/gallium/drivers/nv30/nv30_state_emit.c122
-rw-r--r--src/gallium/drivers/nv30/nv30_state_fb.c173
-rw-r--r--src/gallium/drivers/nv30/nv30_state_rasterizer.c17
-rw-r--r--src/gallium/drivers/nv30/nv30_state_scissor.c36
-rw-r--r--src/gallium/drivers/nv30/nv30_state_stipple.c40
-rw-r--r--src/gallium/drivers/nv30/nv30_state_viewport.c42
-rw-r--r--src/gallium/drivers/nv30/nv30_state_zsa.c41
-rw-r--r--src/gallium/drivers/nv30/nv30_transfer.c178
-rw-r--r--src/gallium/drivers/nv30/nv30_vertprog.c842
-rw-r--r--src/gallium/drivers/nv40/Makefile29
-rw-r--r--src/gallium/drivers/nv40/nv40_clear.c14
-rw-r--r--src/gallium/drivers/nv40/nv40_context.c87
-rw-r--r--src/gallium/drivers/nv40/nv40_context.h239
-rw-r--r--src/gallium/drivers/nv40/nv40_draw.c360
-rw-r--r--src/gallium/drivers/nv40/nv40_query.c127
-rw-r--r--src/gallium/drivers/nv40/nv40_screen.c320
-rw-r--r--src/gallium/drivers/nv40/nv40_shader.h556
-rw-r--r--src/gallium/drivers/nv40/nv40_state.c743
-rw-r--r--src/gallium/drivers/nv40/nv40_state_blend.c41
-rw-r--r--src/gallium/drivers/nv40/nv40_state_emit.c189
-rw-r--r--src/gallium/drivers/nv40/nv40_state_fb.c175
-rw-r--r--src/gallium/drivers/nv40/nv40_state_rasterizer.c17
-rw-r--r--src/gallium/drivers/nv40/nv40_state_scissor.c36
-rw-r--r--src/gallium/drivers/nv40/nv40_state_stipple.c39
-rw-r--r--src/gallium/drivers/nv40/nv40_state_viewport.c38
-rw-r--r--src/gallium/drivers/nv40/nv40_state_zsa.c41
-rw-r--r--src/gallium/drivers/nv40/nv40_surface.c64
-rw-r--r--src/gallium/drivers/nv40/nv40_vbo.c565
-rw-r--r--src/gallium/drivers/nv50/Makefile3
-rw-r--r--src/gallium/drivers/nv50/nv50_clear.c6
-rw-r--r--src/gallium/drivers/nv50/nv50_context.c44
-rw-r--r--src/gallium/drivers/nv50/nv50_context.h122
-rw-r--r--src/gallium/drivers/nv50/nv50_miptree.c9
-rw-r--r--src/gallium/drivers/nv50/nv50_program.c42
-rw-r--r--src/gallium/drivers/nv50/nv50_push.c326
-rw-r--r--src/gallium/drivers/nv50/nv50_screen.c313
-rw-r--r--src/gallium/drivers/nv50/nv50_screen.h4
-rw-r--r--src/gallium/drivers/nv50/nv50_state.c110
-rw-r--r--src/gallium/drivers/nv50/nv50_state_validate.c440
-rw-r--r--src/gallium/drivers/nv50/nv50_surface.c31
-rw-r--r--src/gallium/drivers/nv50/nv50_tex.c229
-rw-r--r--src/gallium/drivers/nv50/nv50_texture.h32
-rw-r--r--src/gallium/drivers/nv50/nv50_transfer.c21
-rw-r--r--src/gallium/drivers/nv50/nv50_vbo.c1112
-rw-r--r--src/gallium/drivers/nvfx/Makefile32
-rw-r--r--src/gallium/drivers/nvfx/nv04_surface_2d.c (renamed from src/gallium/drivers/nouveau/nv04_surface_2d.c)6
-rw-r--r--src/gallium/drivers/nvfx/nv04_surface_2d.h (renamed from src/gallium/drivers/nouveau/nv04_surface_2d.h)0
-rw-r--r--src/gallium/drivers/nvfx/nv30_fragtex.c (renamed from src/gallium/drivers/nv30/nv30_fragtex.c)88
-rw-r--r--src/gallium/drivers/nvfx/nv30_vertprog.h169
-rw-r--r--src/gallium/drivers/nvfx/nv40_fragtex.c (renamed from src/gallium/drivers/nv40/nv40_fragtex.c)131
-rw-r--r--src/gallium/drivers/nvfx/nv40_vertprog.h177
-rw-r--r--src/gallium/drivers/nvfx/nvfx_clear.c (renamed from src/gallium/drivers/nv30/nv30_clear.c)6
-rw-r--r--src/gallium/drivers/nvfx/nvfx_context.c90
-rw-r--r--src/gallium/drivers/nvfx/nvfx_context.h264
-rw-r--r--src/gallium/drivers/nvfx/nvfx_draw.c356
-rw-r--r--src/gallium/drivers/nvfx/nvfx_fragprog.c (renamed from src/gallium/drivers/nv40/nv40_fragprog.c)451
-rw-r--r--src/gallium/drivers/nvfx/nvfx_fragtex.c49
-rw-r--r--src/gallium/drivers/nvfx/nvfx_miptree.c (renamed from src/gallium/drivers/nv40/nv40_miptree.c)71
-rw-r--r--src/gallium/drivers/nvfx/nvfx_query.c127
-rw-r--r--src/gallium/drivers/nvfx/nvfx_screen.c462
-rw-r--r--src/gallium/drivers/nvfx/nvfx_screen.h (renamed from src/gallium/drivers/nv40/nv40_screen.h)26
-rw-r--r--src/gallium/drivers/nvfx/nvfx_shader.h429
-rw-r--r--src/gallium/drivers/nvfx/nvfx_state.c650
-rw-r--r--src/gallium/drivers/nvfx/nvfx_state.h (renamed from src/gallium/drivers/nv40/nv40_state.h)34
-rw-r--r--src/gallium/drivers/nvfx/nvfx_state_blend.c41
-rw-r--r--src/gallium/drivers/nvfx/nvfx_state_emit.c179
-rw-r--r--src/gallium/drivers/nvfx/nvfx_state_fb.c234
-rw-r--r--src/gallium/drivers/nvfx/nvfx_state_rasterizer.c17
-rw-r--r--src/gallium/drivers/nvfx/nvfx_state_scissor.c36
-rw-r--r--src/gallium/drivers/nvfx/nvfx_state_stipple.c40
-rw-r--r--src/gallium/drivers/nvfx/nvfx_state_viewport.c52
-rw-r--r--src/gallium/drivers/nvfx/nvfx_state_zsa.c41
-rw-r--r--src/gallium/drivers/nvfx/nvfx_surface.c (renamed from src/gallium/drivers/nv30/nv30_surface.c)30
-rw-r--r--src/gallium/drivers/nvfx/nvfx_tex.h133
-rw-r--r--src/gallium/drivers/nvfx/nvfx_transfer.c (renamed from src/gallium/drivers/nv40/nv40_transfer.c)64
-rw-r--r--src/gallium/drivers/nvfx/nvfx_vbo.c (renamed from src/gallium/drivers/nv30/nv30_vbo.c)222
-rw-r--r--src/gallium/drivers/nvfx/nvfx_vertprog.c (renamed from src/gallium/drivers/nv40/nv40_vertprog.c)641
-rw-r--r--src/gallium/drivers/r300/Makefile4
-rw-r--r--src/gallium/drivers/r300/SConscript2
-rw-r--r--src/gallium/drivers/r300/r300_blit.c8
-rw-r--r--src/gallium/drivers/r300/r300_chipset.c7
-rw-r--r--src/gallium/drivers/r300/r300_context.c63
-rw-r--r--src/gallium/drivers/r300/r300_context.h64
-rw-r--r--src/gallium/drivers/r300/r300_cs.h25
-rw-r--r--src/gallium/drivers/r300/r300_debug.c13
-rw-r--r--src/gallium/drivers/r300/r300_defines.h47
-rw-r--r--src/gallium/drivers/r300/r300_emit.c168
-rw-r--r--src/gallium/drivers/r300/r300_emit.h3
-rw-r--r--src/gallium/drivers/r300/r300_flush.c6
-rw-r--r--src/gallium/drivers/r300/r300_fs.c6
-rw-r--r--src/gallium/drivers/r300/r300_query.c31
-rw-r--r--src/gallium/drivers/r300/r300_reg.h72
-rw-r--r--src/gallium/drivers/r300/r300_render.c156
-rw-r--r--src/gallium/drivers/r300/r300_screen.c126
-rw-r--r--src/gallium/drivers/r300/r300_screen.h22
-rw-r--r--src/gallium/drivers/r300/r300_screen_buffer.c314
-rw-r--r--src/gallium/drivers/r300/r300_screen_buffer.h99
-rw-r--r--src/gallium/drivers/r300/r300_state.c412
-rw-r--r--src/gallium/drivers/r300/r300_state_derived.c121
-rw-r--r--src/gallium/drivers/r300/r300_state_inlines.h90
-rw-r--r--src/gallium/drivers/r300/r300_state_invariant.c2
-rw-r--r--src/gallium/drivers/r300/r300_texture.c301
-rw-r--r--src/gallium/drivers/r300/r300_texture.h10
-rw-r--r--src/gallium/drivers/r300/r300_tgsi_to_rc.c19
-rw-r--r--src/gallium/drivers/r300/r300_transfer.c280
-rw-r--r--src/gallium/drivers/r300/r300_transfer.h33
-rw-r--r--src/gallium/drivers/r300/r300_vs.c167
-rw-r--r--src/gallium/drivers/r300/r300_vs.h13
-rw-r--r--src/gallium/drivers/r300/r300_winsys.h151
-rw-r--r--src/gallium/drivers/softpipe/Makefile5
-rw-r--r--src/gallium/drivers/softpipe/SConscript5
-rw-r--r--src/gallium/drivers/softpipe/sp_buffer.c118
-rw-r--r--src/gallium/drivers/softpipe/sp_buffer.h55
-rw-r--r--src/gallium/drivers/softpipe/sp_context.c27
-rw-r--r--src/gallium/drivers/softpipe/sp_context.h14
-rw-r--r--src/gallium/drivers/softpipe/sp_draw_arrays.c97
-rw-r--r--src/gallium/drivers/softpipe/sp_fence.c70
-rw-r--r--src/gallium/drivers/softpipe/sp_fence.h40
-rw-r--r--src/gallium/drivers/softpipe/sp_flush.c8
-rw-r--r--src/gallium/drivers/softpipe/sp_fs_exec.c7
-rw-r--r--src/gallium/drivers/softpipe/sp_fs_sse.c7
-rw-r--r--src/gallium/drivers/softpipe/sp_prim_vbuf.c80
-rw-r--r--src/gallium/drivers/softpipe/sp_public.h10
-rw-r--r--src/gallium/drivers/softpipe/sp_quad_depth_test.c12
-rw-r--r--src/gallium/drivers/softpipe/sp_screen.c69
-rw-r--r--src/gallium/drivers/softpipe/sp_screen.h4
-rw-r--r--src/gallium/drivers/softpipe/sp_state.h38
-rw-r--r--src/gallium/drivers/softpipe/sp_state_fs.c17
-rw-r--r--src/gallium/drivers/softpipe/sp_state_sampler.c89
-rw-r--r--src/gallium/drivers/softpipe/sp_state_vertex.c36
-rw-r--r--src/gallium/drivers/softpipe/sp_tex_sample.c94
-rw-r--r--src/gallium/drivers/softpipe/sp_tex_tile_cache.c62
-rw-r--r--src/gallium/drivers/softpipe/sp_tex_tile_cache.h14
-rw-r--r--src/gallium/drivers/softpipe/sp_texture.c180
-rw-r--r--src/gallium/drivers/softpipe/sp_texture.h22
-rw-r--r--src/gallium/drivers/softpipe/sp_tile_cache.c47
-rw-r--r--src/gallium/drivers/softpipe/sp_tile_cache.h4
-rw-r--r--src/gallium/drivers/softpipe/sp_winsys.c245
-rw-r--r--src/gallium/drivers/svga/svga_context.c2
-rw-r--r--src/gallium/drivers/svga/svga_context.h12
-rw-r--r--src/gallium/drivers/svga/svga_pipe_clear.c2
-rw-r--r--src/gallium/drivers/svga/svga_pipe_misc.c4
-rw-r--r--src/gallium/drivers/svga/svga_pipe_sampler.c61
-rw-r--r--src/gallium/drivers/svga/svga_pipe_vertex.c38
-rw-r--r--src/gallium/drivers/svga/svga_screen.c2
-rw-r--r--src/gallium/drivers/svga/svga_screen_texture.c193
-rw-r--r--src/gallium/drivers/svga/svga_screen_texture.h5
-rw-r--r--src/gallium/drivers/svga/svga_state_constants.c2
-rw-r--r--src/gallium/drivers/svga/svga_state_framebuffer.c2
-rw-r--r--src/gallium/drivers/svga/svga_state_fs.c9
-rw-r--r--src/gallium/drivers/svga/svga_state_need_swtnl.c9
-rw-r--r--src/gallium/drivers/svga/svga_state_rss.c13
-rw-r--r--src/gallium/drivers/svga/svga_state_tss.c22
-rw-r--r--src/gallium/drivers/svga/svga_state_vdecl.c8
-rw-r--r--src/gallium/drivers/svga/svga_state_vs.c4
-rw-r--r--src/gallium/drivers/svga/svga_swtnl_state.c4
-rw-r--r--src/gallium/drivers/svga/svga_winsys.h33
-rw-r--r--src/gallium/drivers/svga/svgadump/svga_shader_dump.c4
-rw-r--r--src/gallium/drivers/sw/Makefile10
-rw-r--r--src/gallium/drivers/sw/SConscript42
-rw-r--r--src/gallium/drivers/sw/sw.c59
-rw-r--r--src/gallium/drivers/sw/sw_public.h13
-rw-r--r--src/gallium/drivers/trace/tr_context.c363
-rw-r--r--src/gallium/drivers/trace/tr_context.h10
-rw-r--r--src/gallium/drivers/trace/tr_drm.c70
-rw-r--r--src/gallium/drivers/trace/tr_dump_state.c1
-rw-r--r--src/gallium/drivers/trace/tr_public.h45
-rw-r--r--src/gallium/drivers/trace/tr_rbug.c24
-rw-r--r--src/gallium/drivers/trace/tr_screen.c221
-rw-r--r--src/gallium/drivers/trace/tr_screen.h4
-rw-r--r--src/gallium/drivers/trace/tr_texture.c21
-rw-r--r--src/gallium/drivers/trace/tr_texture.h27
-rw-r--r--src/gallium/include/pipe/p_compiler.h6
-rw-r--r--src/gallium/include/pipe/p_context.h59
-rw-r--r--src/gallium/include/pipe/p_defines.h16
-rw-r--r--src/gallium/include/pipe/p_format.h235
-rw-r--r--src/gallium/include/pipe/p_screen.h66
-rw-r--r--src/gallium/include/pipe/p_state.h29
-rw-r--r--src/gallium/include/state_tracker/dri1_api.h8
-rw-r--r--src/gallium/include/state_tracker/drisw_api.h35
-rw-r--r--src/gallium/include/state_tracker/drm_api.h58
-rw-r--r--src/gallium/include/state_tracker/graw.h36
-rw-r--r--src/gallium/include/state_tracker/st_api.h407
-rw-r--r--src/gallium/include/state_tracker/sw_winsys.h (renamed from src/gallium/drivers/llvmpipe/lp_winsys.h)68
-rw-r--r--src/gallium/include/state_tracker/xlib_sw_winsys.h29
-rw-r--r--src/gallium/state_trackers/dri/Makefile32
-rw-r--r--src/gallium/state_trackers/dri/SConscript25
-rw-r--r--src/gallium/state_trackers/dri/common/dri1_helper.c129
-rw-r--r--src/gallium/state_trackers/dri/common/dri1_helper.h61
-rw-r--r--src/gallium/state_trackers/dri/common/dri_context.c (renamed from src/gallium/state_trackers/dri/dri_context.c)123
-rw-r--r--src/gallium/state_trackers/dri/common/dri_context.h (renamed from src/gallium/state_trackers/dri/dri_context.h)41
-rw-r--r--src/gallium/state_trackers/dri/common/dri_drawable.c93
-rw-r--r--src/gallium/state_trackers/dri/common/dri_drawable.h (renamed from src/gallium/state_trackers/dri/dri_drawable.h)45
-rw-r--r--src/gallium/state_trackers/dri/common/dri_screen.c (renamed from src/gallium/state_trackers/dri/dri_screen.c)308
-rw-r--r--src/gallium/state_trackers/dri/common/dri_screen.h (renamed from src/gallium/state_trackers/dri/dri_screen.h)49
-rw-r--r--src/gallium/state_trackers/dri/common/dri_st_api.c262
-rw-r--r--src/gallium/state_trackers/dri/common/dri_st_api.h55
-rw-r--r--src/gallium/state_trackers/dri/common/dri_wrapper.h10
-rw-r--r--src/gallium/state_trackers/dri/dri_drawable.c761
-rw-r--r--src/gallium/state_trackers/dri/dri_extensions.c142
-rw-r--r--src/gallium/state_trackers/dri/drm/Makefile32
-rw-r--r--src/gallium/state_trackers/dri/drm/SConscript27
-rw-r--r--src/gallium/state_trackers/dri/drm/dri1.c522
-rw-r--r--src/gallium/state_trackers/dri/drm/dri1.h59
l---------src/gallium/state_trackers/dri/drm/dri1_helper.c1
-rw-r--r--src/gallium/state_trackers/dri/drm/dri2.c416
-rw-r--r--src/gallium/state_trackers/dri/drm/dri2.h46
l---------src/gallium/state_trackers/dri/drm/dri_context.c1
l---------src/gallium/state_trackers/dri/drm/dri_drawable.c1
l---------src/gallium/state_trackers/dri/drm/dri_screen.c1
l---------src/gallium/state_trackers/dri/drm/dri_st_api.c1
-rw-r--r--src/gallium/state_trackers/dri/sw/Makefile26
-rw-r--r--src/gallium/state_trackers/dri/sw/SConscript28
l---------src/gallium/state_trackers/dri/sw/dri1_helper.c1
l---------src/gallium/state_trackers/dri/sw/dri_context.c1
l---------src/gallium/state_trackers/dri/sw/dri_drawable.c1
l---------src/gallium/state_trackers/dri/sw/dri_screen.c1
l---------src/gallium/state_trackers/dri/sw/dri_st_api.c1
-rw-r--r--src/gallium/state_trackers/dri/sw/drisw.c298
-rw-r--r--src/gallium/state_trackers/dri/sw/drisw.h54
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d.c596
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d.h25
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d_st.c260
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d_st.h (renamed from src/gallium/state_trackers/egl/common/egl_st.h)86
-rw-r--r--src/gallium/state_trackers/egl/common/egl_st.c131
-rw-r--r--src/gallium/state_trackers/egl/common/native.h3
-rw-r--r--src/gallium/state_trackers/egl/common/st_public_tmp.h20
-rw-r--r--src/gallium/state_trackers/egl/kms/native_kms.c18
-rw-r--r--src/gallium/state_trackers/egl/x11/native_dri2.c13
-rw-r--r--src/gallium/state_trackers/egl/x11/native_x11.c13
-rw-r--r--src/gallium/state_trackers/egl/x11/native_x11.h3
-rw-r--r--src/gallium/state_trackers/egl/x11/native_ximage.c282
-rw-r--r--src/gallium/state_trackers/egl/x11/sw_winsys.c231
-rw-r--r--src/gallium/state_trackers/es/Makefile2
-rw-r--r--src/gallium/state_trackers/es/st_es1.c7
-rw-r--r--src/gallium/state_trackers/es/st_es2.c7
-rw-r--r--src/gallium/state_trackers/glx/xlib/Makefile6
-rw-r--r--src/gallium/state_trackers/glx/xlib/SConscript3
-rw-r--r--src/gallium/state_trackers/glx/xlib/glx_api.c11
-rw-r--r--src/gallium/state_trackers/glx/xlib/xm_api.c423
-rw-r--r--src/gallium/state_trackers/glx/xlib/xm_api.h73
-rw-r--r--src/gallium/state_trackers/glx/xlib/xm_public.h (renamed from src/gallium/state_trackers/glx/xlib/xm_winsys.h)24
-rw-r--r--src/gallium/state_trackers/glx/xlib/xm_st.c332
-rw-r--r--src/gallium/state_trackers/glx/xlib/xm_st.h51
-rw-r--r--src/gallium/state_trackers/python/SConscript31
-rw-r--r--src/gallium/state_trackers/python/gallium.i4
-rw-r--r--src/gallium/state_trackers/python/p_context.i329
-rw-r--r--src/gallium/state_trackers/python/p_texture.i228
-rw-r--r--src/gallium/state_trackers/python/st_device.c106
-rw-r--r--src/gallium/state_trackers/python/st_device.h13
-rw-r--r--src/gallium/state_trackers/python/st_hardpipe_winsys.c16
-rw-r--r--src/gallium/state_trackers/python/st_llvmpipe_winsys.c141
-rw-r--r--src/gallium/state_trackers/python/st_sample.c85
-rw-r--r--src/gallium/state_trackers/python/st_sample.h11
-rw-r--r--src/gallium/state_trackers/python/st_softpipe_winsys.c61
-rw-r--r--src/gallium/state_trackers/python/st_winsys.h14
-rw-r--r--src/gallium/state_trackers/python/u_format.i88
-rw-r--r--src/gallium/state_trackers/vega/Makefile3
-rw-r--r--src/gallium/state_trackers/vega/api_context.c3
-rw-r--r--src/gallium/state_trackers/vega/api_filters.c87
-rw-r--r--src/gallium/state_trackers/vega/api_images.c7
-rw-r--r--src/gallium/state_trackers/vega/api_masks.c6
-rw-r--r--src/gallium/state_trackers/vega/image.c54
-rw-r--r--src/gallium/state_trackers/vega/image.h4
-rw-r--r--src/gallium/state_trackers/vega/mask.c66
-rw-r--r--src/gallium/state_trackers/vega/mask.h2
-rw-r--r--src/gallium/state_trackers/vega/paint.c68
-rw-r--r--src/gallium/state_trackers/vega/paint.h2
-rw-r--r--src/gallium/state_trackers/vega/polygon.c4
-rw-r--r--src/gallium/state_trackers/vega/renderer.c42
-rw-r--r--src/gallium/state_trackers/vega/renderer.h3
-rw-r--r--src/gallium/state_trackers/vega/shader.c34
-rw-r--r--src/gallium/state_trackers/vega/st_inlines.h9
-rw-r--r--src/gallium/state_trackers/vega/vg_context.c27
-rw-r--r--src/gallium/state_trackers/vega/vg_context.h13
-rw-r--r--src/gallium/state_trackers/vega/vg_manager.c373
-rw-r--r--src/gallium/state_trackers/vega/vg_manager.h (renamed from progs/es1/screen/winsys.h)28
-rw-r--r--src/gallium/state_trackers/vega/vg_tracker.c66
-rw-r--r--src/gallium/state_trackers/vega/vg_tracker.h3
-rw-r--r--src/gallium/state_trackers/wgl/stw_context.c8
-rw-r--r--src/gallium/state_trackers/wgl/stw_device.c14
-rw-r--r--src/gallium/state_trackers/wgl/stw_device.h4
-rw-r--r--src/gallium/state_trackers/wgl/stw_ext_gallium.c5
-rw-r--r--src/gallium/state_trackers/wgl/stw_framebuffer.c19
-rw-r--r--src/gallium/state_trackers/wgl/stw_pixelformat.c4
-rw-r--r--src/gallium/state_trackers/xorg/xorg_composite.c37
-rw-r--r--src/gallium/state_trackers/xorg/xorg_crtc.c29
-rw-r--r--src/gallium/state_trackers/xorg/xorg_dri2.c18
-rw-r--r--src/gallium/state_trackers/xorg/xorg_driver.c15
-rw-r--r--src/gallium/state_trackers/xorg/xorg_exa.c50
-rw-r--r--src/gallium/state_trackers/xorg/xorg_exa.h2
-rw-r--r--src/gallium/state_trackers/xorg/xorg_renderer.c34
-rw-r--r--src/gallium/state_trackers/xorg/xorg_renderer.h5
-rw-r--r--src/gallium/state_trackers/xorg/xorg_xv.c88
-rw-r--r--src/gallium/state_trackers/xorg/xvmc/surface.c2
-rw-r--r--src/gallium/targets/Makefile (renamed from src/gallium/winsys/drm/Makefile)4
-rw-r--r--src/gallium/targets/Makefile.dri (renamed from src/gallium/winsys/drm/Makefile.template)7
-rw-r--r--src/gallium/targets/Makefile.egl (renamed from src/gallium/winsys/drm/Makefile.egl)15
-rw-r--r--src/gallium/targets/SConscript27
-rw-r--r--src/gallium/targets/SConscript.dri96
-rw-r--r--src/gallium/targets/dri-i915/Makefile (renamed from src/gallium/winsys/drm/intel/dri/Makefile)14
-rw-r--r--src/gallium/targets/dri-i915/SConscript26
-rw-r--r--src/gallium/targets/dri-i915/dummy.c0
-rw-r--r--src/gallium/targets/dri-i965/Makefile (renamed from src/gallium/winsys/drm/i965/dri/Makefile)16
-rw-r--r--src/gallium/targets/dri-i965/SConscript26
-rw-r--r--src/gallium/targets/dri-i965/dummy.c0
-rw-r--r--src/gallium/targets/dri-nouveau/Makefile (renamed from src/gallium/winsys/drm/nouveau/dri/Makefile)13
-rw-r--r--src/gallium/targets/dri-radeong/Makefile (renamed from src/gallium/winsys/drm/radeon/dri/Makefile)11
-rw-r--r--src/gallium/targets/dri-radeong/SConscript26
-rw-r--r--src/gallium/targets/dri-radeong/dummy.c0
-rw-r--r--src/gallium/targets/dri-swrast/Makefile30
-rw-r--r--src/gallium/targets/dri-swrast/SConscript42
-rw-r--r--src/gallium/targets/dri-swrast/swrast_drm_api.c147
-rw-r--r--src/gallium/targets/dri-vmwgfx/Makefile (renamed from src/gallium/winsys/drm/vmware/dri/Makefile)9
-rw-r--r--src/gallium/targets/dri-vmwgfx/SConscript24
-rw-r--r--src/gallium/targets/dri-vmwgfx/dummy.c0
-rw-r--r--src/gallium/targets/egl-i915/Makefile (renamed from src/gallium/winsys/drm/intel/egl/Makefile)7
-rw-r--r--src/gallium/targets/egl-i915/dummy.c (renamed from src/gallium/winsys/drm/i965/egl/dummy.c)0
-rw-r--r--src/gallium/targets/egl-i965/Makefile16
-rw-r--r--src/gallium/targets/egl-i965/dummy.c (renamed from src/gallium/winsys/drm/intel/egl/dummy.c)0
-rw-r--r--src/gallium/targets/egl-nouveau/Makefile14
-rw-r--r--src/gallium/targets/egl-nouveau/dummy.c (renamed from src/gallium/winsys/drm/nouveau/egl/dummy.c)0
-rw-r--r--src/gallium/targets/egl-radeon/Makefile (renamed from src/gallium/winsys/drm/radeon/egl/Makefile)7
-rw-r--r--src/gallium/targets/egl-radeon/dummy.c (renamed from src/gallium/winsys/drm/radeon/egl/dummy.c)0
-rw-r--r--src/gallium/targets/egl-swrast/Makefile12
-rw-r--r--src/gallium/targets/egl-swrast/swrast_glue.c (renamed from src/gallium/winsys/drm/swrast/core/swrast_drm_api.c)4
-rw-r--r--src/gallium/targets/egl-vmwgfx/Makefile (renamed from src/gallium/winsys/drm/vmware/egl/Makefile)7
-rw-r--r--src/gallium/targets/egl-vmwgfx/dummy.c (renamed from src/gallium/winsys/drm/swrast/egl/dummy.c)0
-rw-r--r--src/gallium/targets/graw-xlib/SConscript57
-rw-r--r--src/gallium/targets/graw-xlib/graw.h36
-rw-r--r--src/gallium/targets/graw-xlib/graw_xlib.c181
-rw-r--r--src/gallium/targets/libgl-gdi/SConscript (renamed from src/gallium/winsys/gdi/SConscript)3
-rw-r--r--src/gallium/targets/libgl-gdi/gdi_llvmpipe_winsys.c124
-rw-r--r--src/gallium/targets/libgl-gdi/gdi_softpipe_winsys.c124
-rw-r--r--src/gallium/targets/libgl-xlib/Makefile (renamed from src/gallium/winsys/xlib/Makefile)22
-rw-r--r--src/gallium/targets/libgl-xlib/SConscript (renamed from src/gallium/winsys/xlib/SConscript)25
-rw-r--r--src/gallium/targets/libgl-xlib/xlib.c211
-rw-r--r--src/gallium/targets/xorg-i915/Makefile (renamed from src/gallium/winsys/drm/intel/xorg/Makefile)10
-rw-r--r--src/gallium/targets/xorg-i915/intel_xorg.c (renamed from src/gallium/winsys/drm/intel/xorg/intel_xorg.c)2
-rw-r--r--src/gallium/targets/xorg-i965/Makefile (renamed from src/gallium/winsys/drm/i965/xorg/Makefile)22
-rw-r--r--src/gallium/targets/xorg-i965/intel_xorg.c (renamed from src/gallium/winsys/drm/i965/xorg/intel_xorg.c)2
-rw-r--r--src/gallium/targets/xorg-nouveau/Makefile (renamed from src/gallium/winsys/drm/nouveau/xorg/Makefile)12
-rw-r--r--src/gallium/targets/xorg-nouveau/nouveau_xorg.c (renamed from src/gallium/winsys/drm/nouveau/xorg/nouveau_xorg.c)2
-rw-r--r--src/gallium/targets/xorg-radeon/Makefile (renamed from src/gallium/winsys/drm/radeon/xorg/Makefile)22
-rw-r--r--src/gallium/targets/xorg-radeon/radeon_xorg.c (renamed from src/gallium/winsys/drm/radeon/xorg/radeon_xorg.c)2
-rw-r--r--src/gallium/targets/xorg-vmwgfx/Makefile (renamed from src/gallium/winsys/drm/vmware/xorg/Makefile)5
-rw-r--r--src/gallium/targets/xorg-vmwgfx/SConscript (renamed from src/gallium/winsys/drm/vmware/xorg/SConscript)4
-rw-r--r--src/gallium/targets/xorg-vmwgfx/vmw_driver.h (renamed from src/gallium/winsys/drm/vmware/xorg/vmw_driver.h)0
-rw-r--r--src/gallium/targets/xorg-vmwgfx/vmw_hook.h (renamed from src/gallium/winsys/drm/vmware/xorg/vmw_hook.h)0
-rw-r--r--src/gallium/targets/xorg-vmwgfx/vmw_ioctl.c (renamed from src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c)2
-rw-r--r--src/gallium/targets/xorg-vmwgfx/vmw_screen.c (renamed from src/gallium/winsys/drm/vmware/xorg/vmw_screen.c)0
-rw-r--r--src/gallium/targets/xorg-vmwgfx/vmw_video.c (renamed from src/gallium/winsys/drm/vmware/xorg/vmw_video.c)2
-rw-r--r--src/gallium/targets/xorg-vmwgfx/vmw_xorg.c (renamed from src/gallium/winsys/drm/vmware/xorg/vmw_xorg.c)0
-rw-r--r--src/gallium/winsys/SConscript34
-rw-r--r--src/gallium/winsys/drm/SConscript69
-rw-r--r--src/gallium/winsys/drm/i965/SConscript7
-rw-r--r--src/gallium/winsys/drm/i965/dri/SConscript19
-rw-r--r--src/gallium/winsys/drm/i965/egl/Makefile14
-rw-r--r--src/gallium/winsys/drm/i965/gem/i965_drm_api.c238
-rw-r--r--src/gallium/winsys/drm/intel/Makefile12
-rw-r--r--src/gallium/winsys/drm/intel/SConscript7
-rw-r--r--src/gallium/winsys/drm/intel/dri/SConscript21
-rw-r--r--src/gallium/winsys/drm/intel/gem/SConscript17
-rw-r--r--src/gallium/winsys/drm/intel/gem/intel_drm_api.c205
-rw-r--r--src/gallium/winsys/drm/intel/gem/intel_drm_buffer.c154
-rw-r--r--src/gallium/winsys/drm/intel/gem/intel_drm_winsys.h77
-rw-r--r--src/gallium/winsys/drm/nouveau/Makefile12
-rw-r--r--src/gallium/winsys/drm/nouveau/egl/Makefile16
-rw-r--r--src/gallium/winsys/drm/radeon/Makefile12
-rw-r--r--src/gallium/winsys/drm/radeon/SConscript7
-rw-r--r--src/gallium/winsys/drm/radeon/core/radeon_buffer.c303
-rw-r--r--src/gallium/winsys/drm/radeon/core/radeon_r300.c162
-rw-r--r--src/gallium/winsys/drm/radeon/core/radeon_winsys.h111
-rw-r--r--src/gallium/winsys/drm/radeon/dri/SConscript17
-rw-r--r--src/gallium/winsys/drm/radeon/python/README15
-rw-r--r--src/gallium/winsys/drm/radeon/python/SConscript33
-rw-r--r--src/gallium/winsys/drm/radeon/python/radeon_hardpipe_winsys.c132
-rw-r--r--src/gallium/winsys/drm/radeon/python/xf86dri.c605
-rw-r--r--src/gallium/winsys/drm/radeon/python/xf86dri.h123
-rw-r--r--src/gallium/winsys/drm/radeon/python/xf86dristr.h389
-rw-r--r--src/gallium/winsys/drm/swrast/Makefile12
-rw-r--r--src/gallium/winsys/drm/swrast/core/Makefile10
-rw-r--r--src/gallium/winsys/drm/swrast/egl/Makefile12
-rw-r--r--src/gallium/winsys/drm/vmware/Makefile12
-rw-r--r--src/gallium/winsys/drm/vmware/SConscript11
-rw-r--r--src/gallium/winsys/drm/vmware/dri/SConscript63
-rw-r--r--src/gallium/winsys/drm/vmware/egl/dummy.c3
-rw-r--r--src/gallium/winsys/gdi/gdi_softpipe_winsys.c318
-rw-r--r--src/gallium/winsys/i915/drm/Makefile (renamed from src/gallium/winsys/drm/intel/gem/Makefile)14
-rw-r--r--src/gallium/winsys/i915/drm/SConscript17
-rw-r--r--src/gallium/winsys/i915/drm/i915_drm_api.c109
-rw-r--r--src/gallium/winsys/i915/drm/i915_drm_batchbuffer.c (renamed from src/gallium/winsys/drm/intel/gem/intel_drm_batchbuffer.c)78
-rw-r--r--src/gallium/winsys/i915/drm/i915_drm_buffer.c217
-rw-r--r--src/gallium/winsys/i915/drm/i915_drm_fence.c (renamed from src/gallium/winsys/drm/intel/gem/intel_drm_fence.c)30
-rw-r--r--src/gallium/winsys/i915/drm/i915_drm_winsys.h77
-rw-r--r--src/gallium/winsys/i965/drm/Makefile (renamed from src/gallium/winsys/drm/i965/gem/Makefile)4
-rw-r--r--src/gallium/winsys/i965/drm/SConscript (renamed from src/gallium/winsys/drm/i965/gem/SConscript)2
-rw-r--r--src/gallium/winsys/i965/drm/i965_drm_api.c122
-rw-r--r--src/gallium/winsys/i965/drm/i965_drm_buffer.c (renamed from src/gallium/winsys/drm/i965/gem/i965_drm_buffer.c)75
-rw-r--r--src/gallium/winsys/i965/drm/i965_drm_winsys.h (renamed from src/gallium/winsys/drm/i965/gem/i965_drm_winsys.h)0
-rw-r--r--src/gallium/winsys/i965/xlib/Makefile (renamed from src/gallium/winsys/drm/i965/xlib/Makefile)4
-rw-r--r--src/gallium/winsys/i965/xlib/xlib_i965.c (renamed from src/gallium/winsys/drm/i965/xlib/xlib_i965.c)2
-rw-r--r--src/gallium/winsys/nouveau/drm/Makefile (renamed from src/gallium/winsys/drm/nouveau/drm/Makefile)4
-rw-r--r--src/gallium/winsys/nouveau/drm/nouveau_dri.h (renamed from src/gallium/winsys/drm/nouveau/drm/nouveau_dri.h)0
-rw-r--r--src/gallium/winsys/nouveau/drm/nouveau_drm_api.c (renamed from src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c)78
-rw-r--r--src/gallium/winsys/nouveau/drm/nouveau_drm_api.h (renamed from src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.h)0
-rw-r--r--src/gallium/winsys/radeon/drm/Makefile (renamed from src/gallium/winsys/drm/radeon/core/Makefile)6
-rw-r--r--src/gallium/winsys/radeon/drm/SConscript (renamed from src/gallium/winsys/drm/radeon/core/SConscript)4
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_buffer.h90
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_drm.c (renamed from src/gallium/winsys/drm/radeon/core/radeon_drm.c)167
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_drm.h (renamed from src/gallium/winsys/drm/radeon/core/radeon_drm.h)6
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_drm_buffer.c402
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_r300.c358
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_r300.h (renamed from src/gallium/winsys/drm/radeon/core/radeon_r300.h)2
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_winsys.h (renamed from src/gallium/winsys/drm/radeon/core/radeon_buffer.h)67
-rw-r--r--src/gallium/winsys/svga/drm/Makefile (renamed from src/gallium/winsys/drm/vmware/core/Makefile)12
-rw-r--r--src/gallium/winsys/svga/drm/SConscript (renamed from src/gallium/winsys/drm/vmware/core/SConscript)0
-rw-r--r--src/gallium/winsys/svga/drm/vmw_buffer.c (renamed from src/gallium/winsys/drm/vmware/core/vmw_buffer.c)0
-rw-r--r--src/gallium/winsys/svga/drm/vmw_buffer.h (renamed from src/gallium/winsys/drm/vmware/core/vmw_buffer.h)0
-rw-r--r--src/gallium/winsys/svga/drm/vmw_context.c (renamed from src/gallium/winsys/drm/vmware/core/vmw_context.c)0
-rw-r--r--src/gallium/winsys/svga/drm/vmw_context.h (renamed from src/gallium/winsys/drm/vmware/core/vmw_context.h)0
-rw-r--r--src/gallium/winsys/svga/drm/vmw_fence.c (renamed from src/gallium/winsys/drm/vmware/core/vmw_fence.c)0
-rw-r--r--src/gallium/winsys/svga/drm/vmw_fence.h (renamed from src/gallium/winsys/drm/vmware/core/vmw_fence.h)0
-rw-r--r--src/gallium/winsys/svga/drm/vmw_screen.c (renamed from src/gallium/winsys/drm/vmware/core/vmw_screen.c)0
-rw-r--r--src/gallium/winsys/svga/drm/vmw_screen.h (renamed from src/gallium/winsys/drm/vmware/core/vmw_screen.h)0
-rw-r--r--src/gallium/winsys/svga/drm/vmw_screen_dri.c (renamed from src/gallium/winsys/drm/vmware/core/vmw_screen_dri.c)81
-rw-r--r--src/gallium/winsys/svga/drm/vmw_screen_ioctl.c (renamed from src/gallium/winsys/drm/vmware/core/vmw_screen_ioctl.c)0
-rw-r--r--src/gallium/winsys/svga/drm/vmw_screen_pools.c (renamed from src/gallium/winsys/drm/vmware/core/vmw_screen_pools.c)0
-rw-r--r--src/gallium/winsys/svga/drm/vmw_screen_svga.c (renamed from src/gallium/winsys/drm/vmware/core/vmw_screen_svga.c)0
-rw-r--r--src/gallium/winsys/svga/drm/vmw_surface.c (renamed from src/gallium/winsys/drm/vmware/core/vmw_surface.c)0
-rw-r--r--src/gallium/winsys/svga/drm/vmw_surface.h (renamed from src/gallium/winsys/drm/vmware/core/vmw_surface.h)0
-rw-r--r--src/gallium/winsys/svga/drm/vmwgfx_drm.h (renamed from src/gallium/winsys/drm/vmware/core/vmwgfx_drm.h)0
-rw-r--r--src/gallium/winsys/sw/Makefile (renamed from src/gallium/winsys/drm/i965/Makefile)6
-rw-r--r--src/gallium/winsys/sw/dri/Makefile13
-rw-r--r--src/gallium/winsys/sw/dri/SConscript23
-rw-r--r--src/gallium/winsys/sw/dri/dri_sw_winsys.c225
-rw-r--r--src/gallium/winsys/sw/dri/dri_sw_winsys.h (renamed from src/gallium/state_trackers/egl/x11/sw_winsys.h)30
-rw-r--r--src/gallium/winsys/sw/drm/Makefile12
-rw-r--r--src/gallium/winsys/sw/drm/sw_drm_api.c97
-rw-r--r--src/gallium/winsys/sw/drm/sw_drm_api.h34
-rw-r--r--src/gallium/winsys/sw/gdi/SConscript23
-rw-r--r--src/gallium/winsys/sw/gdi/gdi_sw_winsys.c (renamed from src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c)177
-rw-r--r--src/gallium/winsys/sw/gdi/gdi_sw_winsys.h16
-rw-r--r--src/gallium/winsys/sw/null/Makefile16
-rw-r--r--src/gallium/winsys/sw/null/SConscript21
-rw-r--r--src/gallium/winsys/sw/null/null_sw_winsys.c148
-rw-r--r--src/gallium/winsys/sw/null/null_sw_winsys.h40
-rw-r--r--src/gallium/winsys/sw/wrapper/Makefile12
-rw-r--r--src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c282
-rw-r--r--src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.h35
-rw-r--r--src/gallium/winsys/sw/xlib/Makefile17
-rw-r--r--src/gallium/winsys/sw/xlib/SConscript23
-rw-r--r--src/gallium/winsys/sw/xlib/xlib_sw_winsys.c (renamed from src/gallium/winsys/xlib/xlib_llvmpipe.c)288
-rw-r--r--src/gallium/winsys/xlib/xlib.c138
-rw-r--r--src/gallium/winsys/xlib/xlib.h13
-rw-r--r--src/gallium/winsys/xlib/xlib_brw_context.c209
-rw-r--r--src/gallium/winsys/xlib/xlib_cell.c401
-rw-r--r--src/gallium/winsys/xlib/xlib_softpipe.c508
-rw-r--r--src/gallium/winsys/xlib/xmesa.h424
-rw-r--r--src/gallium/winsys/xlib/xmesa_x.h86
-rw-r--r--src/glx/drisw_glx.c110
-rw-r--r--src/glx/glxcmds.c3
-rw-r--r--src/glx/single2.c3
-rw-r--r--src/mesa/SConscript5
-rw-r--r--src/mesa/drivers/common/meta.c13
-rw-r--r--src/mesa/drivers/dri/Makefile.template7
-rw-r--r--src/mesa/drivers/dri/common/dri_test.c89
-rw-r--r--src/mesa/drivers/dri/common/dri_util.c46
-rw-r--r--src/mesa/drivers/dri/common/dri_util.h26
-rw-r--r--src/mesa/drivers/dri/common/drisw_util.c272
-rw-r--r--src/mesa/drivers/dri/common/drisw_util.h132
-rw-r--r--src/mesa/drivers/dri/common/utils.c28
-rw-r--r--src/mesa/drivers/dri/common/utils.h3
-rw-r--r--src/mesa/drivers/dri/common/xmlconfig.c2
-rw-r--r--src/mesa/drivers/dri/i810/Makefile3
-rw-r--r--src/mesa/drivers/dri/i810/server/i810_dri.c975
-rw-r--r--src/mesa/drivers/dri/i915/Makefile2
-rw-r--r--src/mesa/drivers/dri/i915/i830_texstate.c6
-rw-r--r--src/mesa/drivers/dri/i915/i915_state.c2
-rw-r--r--src/mesa/drivers/dri/i915/i915_tex_layout.c27
-rw-r--r--src/mesa/drivers/dri/i915/i915_texstate.c2
-rw-r--r--src/mesa/drivers/dri/i915/intel_tris.c12
l---------src/mesa/drivers/dri/i915/server/intel_dri.c1
-rw-r--r--src/mesa/drivers/dri/i965/Makefile2
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c1
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h1
-rw-r--r--src/mesa/drivers/dri/i965/brw_defines.h5
-rw-r--r--src/mesa/drivers/dri/i965/brw_disasm.c14
-rw-r--r--src/mesa/drivers/dri/i965/brw_eu.h6
-rw-r--r--src/mesa/drivers/dri/i965/brw_eu_emit.c5
-rw-r--r--src/mesa/drivers/dri/i965/brw_optimize.c115
-rw-r--r--src/mesa/drivers/dri/i965/brw_tex_layout.c23
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs_emit.c43
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm.h2
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_emit.c171
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_glsl.c81
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_surface_state.c2
-rw-r--r--src/mesa/drivers/dri/i965/gen6_clip_state.c2
-rw-r--r--src/mesa/drivers/dri/i965/gen6_gs_state.c3
-rw-r--r--src/mesa/drivers/dri/i965/gen6_vs_state.c3
l---------src/mesa/drivers/dri/i965/server/intel_dri.c1
-rw-r--r--src/mesa/drivers/dri/intel/intel_blit.c49
-rw-r--r--src/mesa/drivers/dri/intel/intel_context.c29
-rw-r--r--src/mesa/drivers/dri/intel/intel_context.h4
-rw-r--r--src/mesa/drivers/dri/intel/intel_fbo.c2
-rw-r--r--src/mesa/drivers/dri/intel/intel_mipmap_tree.c89
-rw-r--r--src/mesa/drivers/dri/intel/intel_mipmap_tree.h16
-rw-r--r--src/mesa/drivers/dri/intel/intel_screen.c19
-rw-r--r--src/mesa/drivers/dri/intel/intel_span.c4
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_copy.c16
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_image.c4
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_layout.c14
-rw-r--r--src/mesa/drivers/dri/intel/server/intel_dri.c1306
-rw-r--r--src/mesa/drivers/dri/mach64/Makefile3
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_context.c1
-rw-r--r--src/mesa/drivers/dri/mga/Makefile2
-rw-r--r--src/mesa/drivers/dri/mga/server/mga_dri.c1088
-rw-r--r--src/mesa/drivers/dri/nouveau/Makefile2
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_context.c20
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_context.h2
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_driver.c4
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_fbo.c6
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_gldefs.h19
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_render.h4
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_render_t.c2
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_span.c30
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_state.c27
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_state.h4
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_texture.c100
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_texture.h2
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_util.h18
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c60
-rw-r--r--src/mesa/drivers/dri/nouveau/nv04_context.c26
-rw-r--r--src/mesa/drivers/dri/nouveau/nv04_state_fb.c2
-rw-r--r--src/mesa/drivers/dri/nouveau/nv04_state_raster.c8
-rw-r--r--src/mesa/drivers/dri/nouveau/nv10_context.c6
-rw-r--r--src/mesa/drivers/dri/nouveau/nv10_driver.h3
-rw-r--r--src/mesa/drivers/dri/nouveau/nv10_state_fb.c7
-rw-r--r--src/mesa/drivers/dri/nouveau/nv10_state_tex.c55
-rw-r--r--src/mesa/drivers/dri/nouveau/nv10_state_tnl.c63
-rw-r--r--src/mesa/drivers/dri/nouveau/nv20_context.c18
-rw-r--r--src/mesa/drivers/dri/nouveau/nv20_driver.h6
-rw-r--r--src/mesa/drivers/dri/nouveau/nv20_state_fb.c6
-rw-r--r--src/mesa/drivers/dri/nouveau/nv20_state_tex.c56
-rw-r--r--src/mesa/drivers/dri/nouveau/nv20_state_tnl.c59
-rw-r--r--src/mesa/drivers/dri/r128/Makefile2
-rw-r--r--src/mesa/drivers/dri/r128/server/r128_dri.c1112
-rw-r--r--src/mesa/drivers/dri/r200/Makefile8
-rw-r--r--src/mesa/drivers/dri/r200/r200_blit.c169
-rw-r--r--src/mesa/drivers/dri/r200/r200_context.c5
-rw-r--r--src/mesa/drivers/dri/r200/r200_pixel.c494
-rw-r--r--src/mesa/drivers/dri/r200/r200_pixel.h39
-rw-r--r--src/mesa/drivers/dri/r200/r200_reg.h4
-rw-r--r--src/mesa/drivers/dri/r200/r200_state.c8
-rw-r--r--src/mesa/drivers/dri/r200/r200_state.h2
l---------src/mesa/drivers/dri/r200/radeon_pixel_read.c1
l---------src/mesa/drivers/dri/r200/radeon_tex_getimage.c1
l---------src/mesa/drivers/dri/r200/radeon_tile.c1
l---------src/mesa/drivers/dri/r200/radeon_tile.h1
l---------src/mesa/drivers/dri/r200/server/radeon_dri.c1
-rw-r--r--src/mesa/drivers/dri/r300/Makefile9
-rw-r--r--src/mesa/drivers/dri/r300/compiler/r500_fragprog.c7
-rw-r--r--src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c23
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_opcodes.c4
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c5
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c41
-rw-r--r--src/mesa/drivers/dri/r300/r300_blit.c6
-rw-r--r--src/mesa/drivers/dri/r300/r300_cmdbuf.c35
-rw-r--r--src/mesa/drivers/dri/r300/r300_context.c8
-rw-r--r--src/mesa/drivers/dri/r300/r300_state.c80
-rw-r--r--src/mesa/drivers/dri/r300/r300_state.h2
-rw-r--r--src/mesa/drivers/dri/r300/r300_tex.c39
-rw-r--r--src/mesa/drivers/dri/r300/r300_tex.h3
l---------src/mesa/drivers/dri/r300/radeon_pixel_read.c1
l---------src/mesa/drivers/dri/r300/radeon_tex_getimage.c1
l---------src/mesa/drivers/dri/r300/radeon_tile.c1
l---------src/mesa/drivers/dri/r300/radeon_tile.h1
l---------src/mesa/drivers/dri/r300/server/radeon_dri.c1
-rw-r--r--src/mesa/drivers/dri/r600/Makefile9
-rw-r--r--src/mesa/drivers/dri/r600/r600_context.c3
-rw-r--r--src/mesa/drivers/dri/r600/r700_state.c11
-rw-r--r--src/mesa/drivers/dri/r600/r700_state.h2
l---------src/mesa/drivers/dri/r600/radeon_pixel_read.c1
l---------src/mesa/drivers/dri/r600/radeon_tex_getimage.c1
l---------src/mesa/drivers/dri/r600/radeon_tile.c1
l---------src/mesa/drivers/dri/r600/radeon_tile.h1
l---------src/mesa/drivers/dri/r600/server/radeon_dri.c1
-rw-r--r--src/mesa/drivers/dri/radeon/Makefile7
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_blit.c14
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_common.h6
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_common_context.h1
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_context.c1
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_fbo.c126
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c74
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h9
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_pixel_read.c199
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_state.c5
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_tex_copy.c28
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_tex_getimage.c95
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_texture.c79
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_texture.h2
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_tile.c512
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_tile.h38
-rw-r--r--src/mesa/drivers/dri/radeon/server/radeon_dri.c1337
-rw-r--r--src/mesa/drivers/dri/savage/Makefile3
-rw-r--r--src/mesa/drivers/dri/sis/Makefile4
-rw-r--r--src/mesa/drivers/dri/swrast/Makefile5
-rw-r--r--src/mesa/drivers/dri/swrast/swrast.c296
-rw-r--r--src/mesa/drivers/dri/swrast/swrast_priv.h75
-rw-r--r--src/mesa/drivers/dri/swrast/swrast_span.c6
-rw-r--r--src/mesa/drivers/dri/swrast/swrast_spantemp.h16
-rw-r--r--src/mesa/drivers/dri/tdfx/Makefile3
-rw-r--r--src/mesa/drivers/dri/tdfx/server/tdfx_dri.c471
-rw-r--r--src/mesa/drivers/dri/unichrome/Makefile2
-rw-r--r--src/mesa/drivers/dri/unichrome/server/via_dri.c1251
-rw-r--r--src/mesa/drivers/glslcompiler/glslcompiler.c49
-rw-r--r--src/mesa/es/Makefile5
-rw-r--r--src/mesa/es/main/mfeatures_es1.h118
-rw-r--r--src/mesa/es/main/mfeatures_es2.h118
-rw-r--r--src/mesa/es/main/stubs.c7
-rw-r--r--src/mesa/es/state_tracker/st_cb_drawtex.c13
-rw-r--r--src/mesa/glapi/gen/EXT_transform_feedback.xml123
-rw-r--r--src/mesa/glapi/gen/Makefile3
-rw-r--r--src/mesa/glapi/gen/gl_API.xml2
-rw-r--r--src/mesa/glapi/glapi.c44
-rw-r--r--src/mesa/glapi/glapi.h21
-rw-r--r--src/mesa/glapi/glapi_entrypoint.c352
-rw-r--r--src/mesa/glapi/glapi_execmem.c128
-rw-r--r--src/mesa/glapi/glapi_getproc.c641
-rw-r--r--src/mesa/glapi/glapi_priv.h99
-rw-r--r--src/mesa/glapi/glapidispatch.h77
-rw-r--r--src/mesa/glapi/glapioffsets.h42
-rw-r--r--src/mesa/glapi/glapitable.h33
-rw-r--r--src/mesa/glapi/glapitemp.h120
-rw-r--r--src/mesa/glapi/glprocs.h680
-rw-r--r--src/mesa/main/api_exec.c13
-rw-r--r--src/mesa/main/bufferobj.c78
-rw-r--r--src/mesa/main/config.h5
-rw-r--r--src/mesa/main/context.c10
-rw-r--r--src/mesa/main/debug.c3
-rw-r--r--src/mesa/main/dlist.c49
-rw-r--r--src/mesa/main/enable.c16
-rw-r--r--src/mesa/main/enums.c4345
-rw-r--r--src/mesa/main/extensions.c6
-rw-r--r--src/mesa/main/fbobject.c14
-rw-r--r--src/mesa/main/framebuffer.c8
-rw-r--r--src/mesa/main/get.c295
-rw-r--r--src/mesa/main/get_gen.py1055
-rw-r--r--src/mesa/main/mfeatures.h124
-rw-r--r--src/mesa/main/mtypes.h46
-rw-r--r--src/mesa/main/queryobj.c130
-rw-r--r--src/mesa/main/remap_helper.h2707
-rw-r--r--src/mesa/main/texcompress_s3tc.c2
-rw-r--r--src/mesa/main/texparam.c20
-rw-r--r--src/mesa/main/transformfeedback.c435
-rw-r--r--src/mesa/main/transformfeedback.h71
-rw-r--r--src/mesa/main/version.h6
-rw-r--r--src/mesa/shader/prog_parameter.c5
-rw-r--r--src/mesa/shader/prog_parameter.h3
-rw-r--r--src/mesa/shader/shader_api.c83
-rw-r--r--src/mesa/shader/shader_api.h9
-rw-r--r--src/mesa/shader/slang/library/slang_common_builtin.gc20
-rw-r--r--src/mesa/shader/slang/slang_builtin.c68
-rw-r--r--src/mesa/shader/slang/slang_builtin.h10
-rw-r--r--src/mesa/shader/slang/slang_codegen.c2
-rw-r--r--src/mesa/shader/slang/slang_link.c109
-rw-r--r--src/mesa/sources.mak5
-rw-r--r--src/mesa/sparc/glapi_sparc.S41
-rw-r--r--src/mesa/state_tracker/st_atom.c7
-rw-r--r--src/mesa/state_tracker/st_atom_framebuffer.c16
-rw-r--r--src/mesa/state_tracker/st_atom_pixeltransfer.c9
-rw-r--r--src/mesa/state_tracker/st_atom_texture.c20
-rw-r--r--src/mesa/state_tracker/st_cb_accum.c17
-rw-r--r--src/mesa/state_tracker/st_cb_bitmap.c75
-rw-r--r--src/mesa/state_tracker/st_cb_blit.c15
-rw-r--r--src/mesa/state_tracker/st_cb_clear.c80
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c221
-rw-r--r--src/mesa/state_tracker/st_cb_eglimage.c160
-rw-r--r--src/mesa/state_tracker/st_cb_eglimage.h48
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.c57
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.h6
-rw-r--r--src/mesa/state_tracker/st_cb_flush.c6
-rw-r--r--src/mesa/state_tracker/st_cb_readpixels.c54
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c69
-rw-r--r--src/mesa/state_tracker/st_context.c43
-rw-r--r--src/mesa/state_tracker/st_context.h15
-rw-r--r--src/mesa/state_tracker/st_draw.c20
-rw-r--r--src/mesa/state_tracker/st_draw_feedback.c1
-rw-r--r--src/mesa/state_tracker/st_extensions.c21
-rw-r--r--src/mesa/state_tracker/st_format.c46
-rw-r--r--src/mesa/state_tracker/st_framebuffer.c1
-rw-r--r--src/mesa/state_tracker/st_gen_mipmap.c25
-rw-r--r--src/mesa/state_tracker/st_inlines.h10
-rw-r--r--src/mesa/state_tracker/st_manager.c830
-rw-r--r--src/mesa/state_tracker/st_manager.h51
-rw-r--r--src/mesa/state_tracker/st_public.h3
-rw-r--r--src/mesa/state_tracker/st_texture.c47
-rw-r--r--src/mesa/state_tracker/st_texture.h39
-rw-r--r--src/mesa/swrast/s_clear.c1
-rw-r--r--src/mesa/swrast/s_texfilter.c41
-rw-r--r--src/mesa/x86-64/glapi_x86-64.S447
-rw-r--r--src/mesa/x86/glapi_x86.S41
-rw-r--r--windows/VC8/mesa/mesa/mesa.vcproj4
1088 files changed, 47660 insertions, 46842 deletions
diff --git a/Makefile b/Makefile
index 6e64134112..4e85f1f262 100644
--- a/Makefile
+++ b/Makefile
@@ -180,7 +180,7 @@ ultrix-gcc:
# Rules for making release tarballs
-VERSION=7.8
+VERSION=7.9-devel
DIRECTORY = Mesa-$(VERSION)
LIB_NAME = MesaLib-$(VERSION)
DEMO_NAME = MesaDemos-$(VERSION)
@@ -215,7 +215,6 @@ MAIN_FILES = \
$(DIRECTORY)/include/GL/glx_mangle.h \
$(DIRECTORY)/include/GL/glfbdev.h \
$(DIRECTORY)/include/GL/mesa_wgl.h \
- $(DIRECTORY)/include/GL/mglmesa.h \
$(DIRECTORY)/include/GL/osmesa.h \
$(DIRECTORY)/include/GL/vms_x_fix.h \
$(DIRECTORY)/include/GL/wglext.h \
@@ -408,14 +407,18 @@ DEMO_FILES = \
$(DIRECTORY)/progs/demos/*.cxx \
$(DIRECTORY)/progs/demos/*.dat \
$(DIRECTORY)/progs/demos/README \
- $(DIRECTORY)/progs/egl/Makefile \
- $(DIRECTORY)/progs/egl/*.[ch] \
- $(DIRECTORY)/progs/es1/*/Makefile \
- $(DIRECTORY)/progs/es1/*/*.[ch] \
- $(DIRECTORY)/progs/es2/*/Makefile \
- $(DIRECTORY)/progs/es2/*/*.[ch] \
- $(DIRECTORY)/progs/openvg/*/Makefile \
- $(DIRECTORY)/progs/openvg/*/*.[ch] \
+ $(DIRECTORY)/progs/egl/eglut/Makefile \
+ $(DIRECTORY)/progs/egl/eglut/*.[ch] \
+ $(DIRECTORY)/progs/egl/opengl/Makefile \
+ $(DIRECTORY)/progs/egl/opengl/*.[ch] \
+ $(DIRECTORY)/progs/egl/opengles1/Makefile \
+ $(DIRECTORY)/progs/egl/opengles1/*.[ch] \
+ $(DIRECTORY)/progs/egl/opengles2/Makefile \
+ $(DIRECTORY)/progs/egl/opengles2/*.[ch] \
+ $(DIRECTORY)/progs/egl/openvg/Makefile \
+ $(DIRECTORY)/progs/egl/openvg/*.[ch] \
+ $(DIRECTORY)/progs/egl/openvg/*/Makefile \
+ $(DIRECTORY)/progs/egl/openvg/*/*.[ch] \
$(DIRECTORY)/progs/fbdev/Makefile \
$(DIRECTORY)/progs/fbdev/glfbdevtest.c \
$(DIRECTORY)/progs/objviewer/*.[ch] \
diff --git a/SConstruct b/SConstruct
index e1c4a1898c..d9230bd904 100644
--- a/SConstruct
+++ b/SConstruct
@@ -52,7 +52,7 @@ opts.Add(ListVariable('statetrackers', 'state trackers to build', default_statet
opts.Add(ListVariable('drivers', 'pipe drivers to build', default_drivers,
['softpipe', 'failover', 'svga', 'i915', 'i965', 'trace', 'r300', 'identity', 'llvmpipe']))
opts.Add(ListVariable('winsys', 'winsys drivers to build', default_winsys,
- ['xlib', 'vmware', 'intel', 'i965', 'gdi', 'radeon']))
+ ['xlib', 'vmware', 'i915', 'i965', 'gdi', 'radeon', 'graw-xlib']))
opts.Add(EnumVariable('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0')))
@@ -110,9 +110,11 @@ Export([
#######################################################################
# Environment setup
-# Always build trace driver
+# Always build trace and identity drivers
if 'trace' not in env['drivers']:
env['drivers'].append('trace')
+if 'identity' not in env['drivers']:
+ env['drivers'].append('identity')
# Includes
env.Append(CPPPATH = [
@@ -120,6 +122,7 @@ env.Append(CPPPATH = [
'#/src/gallium/include',
'#/src/gallium/auxiliary',
'#/src/gallium/drivers',
+ '#/src/gallium/winsys',
])
if env['msvc']:
@@ -156,12 +159,9 @@ if platform in ('posix', 'linux', 'freebsd', 'darwin'):
])
if platform == 'darwin':
env.Append(CPPDEFINES = ['_DARWIN_C_SOURCE'])
- env.Append(CPPPATH = ['/usr/X11R6/include'])
- env.Append(LIBPATH = ['/usr/X11R6/lib'])
env.Append(LIBS = [
'm',
'pthread',
- 'expat',
'dl',
])
@@ -179,16 +179,6 @@ if dri:
if drawllvm:
env.Append(CPPDEFINES = ['DRAW_LLVM'])
-# libGL
-if platform in ('linux', 'freebsd', 'darwin'):
- env.Append(LIBS = [
- 'X11',
- 'Xext',
- 'Xxf86vm',
- 'Xdamage',
- 'Xfixes',
- ])
-
# for debugging
#print env.Dump()
diff --git a/bin/mklib b/bin/mklib
index 08ef99ec10..c2760e5d89 100755
--- a/bin/mklib
+++ b/bin/mklib
@@ -494,13 +494,16 @@ case $ARCH in
OPTS="${OPTS} -Wl,-Mmapfile.scope"
fi
- # Check if objects are SPARC v9
+ # Check if objects are 64-bit
# file says: ELF 64-bit MSB relocatable SPARCV9 Version 1
set ${OBJECTS}
if [ ${LINK} = "cc" -o ${LINK} = "CC" ] ; then
- SPARCV9=`file $1 | grep SPARCV9`
- if [ "${SPARCV9}" ] ; then
- OPTS="${OPTS} -xarch=v9"
+ ABI64=`file $1 | grep "ELF 64-bit"`
+ if [ "${ABI64}" ] ; then
+ case `uname -p` in
+ sparc) OPTS="${OPTS} -xarch=v9" ;;
+ i386) OPTS="${OPTS} -xarch=amd64" ;;
+ esac
fi
fi
if [ "${ALTOPTS}" ] ; then
diff --git a/common.py b/common.py
index 928a4496f7..97389ed500 100644
--- a/common.py
+++ b/common.py
@@ -60,7 +60,6 @@ def AddOptions(opts):
allowed_values=('generic', 'ppc', 'x86', 'x86_64')))
opts.Add(EnumOption('platform', 'target platform', default_platform,
allowed_values=('linux', 'cell', 'windows', 'winddk', 'wince', 'darwin', 'embedded')))
- opts.Add(EnumOption('toolchain', 'compiler toolchain', 'default',
- allowed_values=('default', 'crossmingw', 'winsdk', 'winddk')))
+ opts.Add('toolchain', 'compiler toolchain', 'default')
opts.Add(BoolOption('llvm', 'use LLVM', 'no'))
opts.Add(BoolOption('dri', 'build DRI drivers', default_dri))
diff --git a/configs/autoconf.in b/configs/autoconf.in
index 30637877f3..b6cc9b3b73 100644
--- a/configs/autoconf.in
+++ b/configs/autoconf.in
@@ -24,6 +24,8 @@ RADEON_CFLAGS = @RADEON_CFLAGS@
RADEON_LDFLAGS = @RADEON_LDFLAGS@
INTEL_LIBS = @INTEL_LIBS@
INTEL_CFLAGS = @INTEL_CFLAGS@
+X11_LIBS = @X11_LIBS@
+X11_CFLAGS = @X11_CFLAGS@
# Assembler
MESA_ASM_SOURCES = @MESA_ASM_SOURCES@
@@ -73,7 +75,7 @@ EGL_DRIVERS_DIRS = @EGL_DRIVERS_DIRS@
GALLIUM_DIRS = @GALLIUM_DIRS@
GALLIUM_DRIVERS_DIRS = @GALLIUM_DRIVERS_DIRS@
GALLIUM_WINSYS_DIRS = @GALLIUM_WINSYS_DIRS@
-GALLIUM_WINSYS_DRM_DIRS = @GALLIUM_WINSYS_DRM_DIRS@
+GALLIUM_TARGET_DIRS = @GALLIUM_TARGET_DIRS@
GALLIUM_STATE_TRACKERS_DIRS = @GALLIUM_STATE_TRACKERS_DIRS@
GALLIUM_AUXILIARIES = $(TOP)/src/gallium/auxiliary/libgallium.a
GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVERS_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a)
@@ -83,7 +85,6 @@ PROGRAM_DIRS = @PROGRAM_DIRS@
# Driver specific build vars
DRI_DIRS = @DRI_DIRS@
-WINDOW_SYSTEM = @WINDOW_SYSTEM@
EGL_DISPLAYS = @EGL_DISPLAYS@
# Dependencies
diff --git a/configs/default b/configs/default
index ad6d93c92f..593fc32b7d 100644
--- a/configs/default
+++ b/configs/default
@@ -9,7 +9,7 @@ CONFIG_NAME = default
# Version info
MESA_MAJOR=7
-MESA_MINOR=8
+MESA_MINOR=9
MESA_TINY=0
MESA_VERSION = $(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY)
@@ -86,7 +86,7 @@ MOTIF_CFLAGS = -I/usr/include/Motif1.2
# Directories to build
LIB_DIR = lib
-SRC_DIRS = glsl mesa gallium egl gallium/winsys glu glut/glx glew glw
+SRC_DIRS = glsl mesa gallium egl gallium/winsys gallium/targets glu glut/glx glew glw
GLU_DIRS = sgi
DRIVER_DIRS = x11 osmesa
# Which subdirs under $(TOP)/progs/ to enter:
@@ -100,8 +100,8 @@ GALLIUM_DIRS = auxiliary drivers state_trackers
GALLIUM_AUXILIARIES = $(TOP)/src/gallium/auxiliary/libgallium.a
GALLIUM_DRIVERS_DIRS = softpipe failover svga i915 i965 r300 trace identity
GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVERS_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a)
-GALLIUM_WINSYS_DIRS = drm xlib
-GALLIUM_WINSYS_DRM_DIRS = swrast
+GALLIUM_WINSYS_DIRS = sw sw/xlib
+GALLIUM_TARGET_DIRS = libgl-xlib
GALLIUM_STATE_TRACKERS_DIRS = glx vega
# native displays EGL should support
@@ -119,7 +119,7 @@ APP_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LI
# Program dependencies - specific GL/glut libraries added in Makefiles
APP_LIB_DEPS = -lm
-
+X11_LIBS = -lX11
# Installation directories (for make install)
INSTALL_DIR = /usr/local
diff --git a/configs/freebsd-dri b/configs/freebsd-dri
index 0b91cfc37e..2c697e1c6e 100644
--- a/configs/freebsd-dri
+++ b/configs/freebsd-dri
@@ -44,7 +44,6 @@ GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/local/lib -lGL -lXt -lX11
SRC_DIRS = glx gallium mesa glu glut/glx glew glw
DRIVER_DIRS = dri
PROGRAM_DIRS =
-WINDOW_SYSTEM=dri
DRM_SOURCE_PATH=$(TOP)/../drm
diff --git a/configs/linux-cell b/configs/linux-cell
index e89a08cd93..0908dba9e0 100644
--- a/configs/linux-cell
+++ b/configs/linux-cell
@@ -6,7 +6,7 @@ CONFIG_NAME = linux-cell
# Omiting other gallium drivers:
-GALLIUM_DRIVERS_DIRS = cell softpipe trace
+GALLIUM_DRIVERS_DIRS = cell softpipe trace identity
# Compiler and flags
@@ -37,7 +37,7 @@ CXXFLAGS = $(COMMON_C_CPP_FLAGS)
# Omitting glw here:
-SRC_DIRS = glsl mesa gallium gallium/winsys glu glut/glx glew
+SRC_DIRS = glsl mesa gallium gallium/winsys gallium/targets glu glut/glx glew
# Build no traditional Mesa drivers:
DRIVER_DIRS =
diff --git a/configs/linux-dri b/configs/linux-dri
index e8e8ccfcf9..9017becdaf 100644
--- a/configs/linux-dri
+++ b/configs/linux-dri
@@ -52,15 +52,14 @@ GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \
# Directories
SRC_DIRS := glx egl $(SRC_DIRS)
-PROGRAM_DIRS := egl $(PROGRAM_DIRS)
+PROGRAM_DIRS := egl/opengl $(PROGRAM_DIRS)
# EGL directories
EGL_DRIVERS_DIRS = glx
DRIVER_DIRS = dri
-WINDOW_SYSTEM = dri
-GALLIUM_WINSYS_DIRS = drm
-GALLIUM_WINSYS_DRM_DIRS = vmware intel i965
+GALLIUM_WINSYS_DIRS = sw sw/xlib drm/vmware drm/intel drm/i965
+GALLIUM_TARGET_DIRS = egl-swrast
GALLIUM_STATE_TRACKERS_DIRS = egl
DRI_DIRS = i810 i915 i965 mach64 mga r128 r200 r300 radeon \
diff --git a/configs/linux-dri-xcb b/configs/linux-dri-xcb
index c5ed89c4b3..1ed980aa36 100644
--- a/configs/linux-dri-xcb
+++ b/configs/linux-dri-xcb
@@ -51,7 +51,5 @@ SRC_DIRS = glx gallium mesa glu glut/glx glew glw
PROGRAM_DIRS = xdemos
DRIVER_DIRS = dri
-WINDOW_SYSTEM=dri
-
DRI_DIRS = i810 i915 mach64 mga r128 r200 r300 radeon \
savage sis tdfx unichrome
diff --git a/configs/linux-egl b/configs/linux-egl
index 2c2834b81d..cd664b4171 100644
--- a/configs/linux-egl
+++ b/configs/linux-egl
@@ -47,11 +47,11 @@ GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \
# Directories
-SRC_DIRS = gallium mesa gallium/winsys glu egl
-PROGRAM_DIRS = egl
+SRC_DIRS = gallium mesa gallium/winsys gallium/targets glu egl
+PROGRAM_DIRS = egl/opengl
DRIVER_DIRS = dri
-WINDOW_SYSTEM = dri
GALLIUM_WINSYS_DIRS = egl_drm
+GALLIUM_TARGET_DIRS =
DRI_DIRS = intel
diff --git a/configs/linux-i965 b/configs/linux-i965
index e66abc347b..7656a2adc5 100644
--- a/configs/linux-i965
+++ b/configs/linux-i965
@@ -6,3 +6,4 @@ CONFIG_NAME = linux-i965
GALLIUM_DRIVER_DIRS = i965
GALLIUM_WINSYS_DIRS = drm/i965/xlib
+GALLIUM_TARGET_DIRS =
diff --git a/configs/linux-indirect b/configs/linux-indirect
index 0914fba19b..1c7dd857db 100644
--- a/configs/linux-indirect
+++ b/configs/linux-indirect
@@ -50,4 +50,3 @@ GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lm -lpthread -ldl
SRC_DIRS = glx glu glut/glx glew glw
DRIVER_DIRS =
PROGRAM_DIRS =
-WINDOW_SYSTEM=dri
diff --git a/configs/linux-llvm b/configs/linux-llvm
index 27e082ebf7..3a15f1d6d8 100644
--- a/configs/linux-llvm
+++ b/configs/linux-llvm
@@ -10,7 +10,7 @@ CONFIG_NAME = linux-llvm
GALLIUM_DRIVERS_DIRS += llvmpipe
OPT_FLAGS = -O3 -ansi -pedantic
-ARCH_FLAGS = -m32 -mmmx -msse -msse2 -mstackrealign
+ARCH_FLAGS = -mmmx -msse -msse2 -mstackrealign
DEFINES += -DNDEBUG -DGALLIUM_LLVMPIPE -DDRAW_LLVM -DHAVE_UDIS86
@@ -24,6 +24,8 @@ ifeq ($(LLVM_VERSION),)
MESA_LLVM=0
else
MESA_LLVM=1
+ HAVE_LLVM := 0x0$(subst .,0,$(LLVM_VERSION:svn=))
+ DEFINES += -DHAVE_LLVM=$(HAVE_LLVM)
# $(info Using LLVM version: $(LLVM_VERSION))
endif
diff --git a/configs/linux-opengl-es b/configs/linux-opengl-es
index 259c26a931..ead47136f4 100644
--- a/configs/linux-opengl-es
+++ b/configs/linux-opengl-es
@@ -6,8 +6,8 @@ CONFIG_NAME = linux-opengl-es
# Directories to build
LIB_DIR = lib
-SRC_DIRS = egl glsl mesa/es gallium gallium/winsys
-PROGRAM_DIRS = es1/screen es1/xegl es2/xegl
+SRC_DIRS = egl glsl mesa/es gallium gallium/winsys gallium/targets
+PROGRAM_DIRS = egl/opengles1 egl/opengles2
# egl st needs this
DEFINES += -DGLX_DIRECT_RENDERING
@@ -24,5 +24,5 @@ GALLIUM_STATE_TRACKERS_DIRS = es
# build egl_x11_{swrast,i915}.so
GALLIUM_DRIVERS_DIRS += trace i915
GALLIUM_STATE_TRACKERS_DIRS += egl
-GALLIUM_WINSYS_DIRS += drm
-GALLIUM_WINSYS_DRM_DIRS += intel swrast
+GALLIUM_WINSYS_DIRS += drm/intel
+GALLIUM_TARGET_DIRS += egl-swrast egl-i915
diff --git a/configure.ac b/configure.ac
index 61487c3905..5647442ea1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -459,23 +459,22 @@ CORE_DIRS="glsl mesa"
SRC_DIRS="glew"
GLU_DIRS="sgi"
-WINDOW_SYSTEM=""
GALLIUM_DIRS="auxiliary drivers state_trackers"
-GALLIUM_WINSYS_DIRS=""
-GALLIUM_WINSYS_DRM_DIRS=""
+GALLIUM_TARGET_DIRS=""
+GALLIUM_WINSYS_DIRS="sw"
GALLIUM_DRIVERS_DIRS="softpipe failover trace identity"
GALLIUM_STATE_TRACKERS_DIRS=""
case "$mesa_driver" in
xlib)
DRIVER_DIRS="x11"
- GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS xlib"
+ GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib"
+ GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS libgl-xlib"
;;
dri)
SRC_DIRS="$SRC_DIRS glx"
DRIVER_DIRS="dri"
- WINDOW_SYSTEM="dri"
- GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS drm"
+ GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib sw/dri sw/drm"
;;
osmesa)
DRIVER_DIRS="osmesa"
@@ -484,10 +483,9 @@ esac
AC_SUBST([SRC_DIRS])
AC_SUBST([GLU_DIRS])
AC_SUBST([DRIVER_DIRS])
-AC_SUBST([WINDOW_SYSTEM])
AC_SUBST([GALLIUM_DIRS])
+AC_SUBST([GALLIUM_TARGET_DIRS])
AC_SUBST([GALLIUM_WINSYS_DIRS])
-AC_SUBST([GALLIUM_WINSYS_DRM_DIRS])
AC_SUBST([GALLIUM_DRIVERS_DIRS])
AC_SUBST([GALLIUM_STATE_TRACKERS_DIRS])
@@ -547,8 +545,14 @@ else
x11_pkgconfig=no
fi
dnl Use the autoconf macro if no pkg-config files
-if test "$x11_pkgconfig" = no; then
+if test "$x11_pkgconfig" = yes; then
+ PKG_CHECK_MODULES([X11], [x11])
+else
AC_PATH_XTRA
+ test -z "$X11_CFLAGS" && X11_CFLAGS="$X_CFLAGS"
+ test -z "$X11_LIBS" && X11_LIBS="$X_LIBS -lX11"
+ AC_SUBST([X11_CFLAGS])
+ AC_SUBST([X11_LIBS])
fi
dnl Try to tell the user that the --x-* options are only used when
@@ -950,7 +954,7 @@ if test "x$enable_egl" = xyes; then
fi
if test "$with_demos" = yes; then
- PROGRAM_DIRS="$PROGRAM_DIRS egl"
+ PROGRAM_DIRS="$PROGRAM_DIRS egl/opengl"
fi
fi
AC_SUBST([EGL_LIB_DEPS])
@@ -1176,7 +1180,7 @@ AC_ARG_ENABLE([gallium],
[enable_gallium="$enableval"],
[enable_gallium=yes])
if test "x$enable_gallium" = xyes; then
- SRC_DIRS="$SRC_DIRS gallium gallium/winsys"
+ SRC_DIRS="$SRC_DIRS gallium gallium/winsys gallium/targets"
fi
dnl
@@ -1201,13 +1205,15 @@ yes)
;;
dri)
GALLIUM_STATE_TRACKERS_DIRS="dri"
+ HAVE_ST_DRI="yes"
if test "x$enable_egl" = xyes; then
GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS egl"
+ HAVE_ST_EGL="yes"
fi
# Have only tested st/xorg on 1.6.0 servers
PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6.0 libdrm >= $LIBDRM_XORG_REQUIRED libkms >= $LIBKMS_XORG_REQUIRED],
- HAVE_XORG="yes"; GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xorg",
- HAVE_XORG="no")
+ HAVE_ST_XORG="yes"; GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xorg",
+ HAVE_ST_XORG="no")
;;
esac
;;
@@ -1219,15 +1225,22 @@ yes)
AC_MSG_ERROR([state tracker '$tracker' doesn't exist])
case "$tracker" in
+ dri)
+ if test "x$mesa_driver" != xdri; then
+ AC_MSG_ERROR([cannot build dri state tracker without mesa driver set to dri])
+ fi
+ HAVE_ST_DRI="yes"
+ ;;
egl)
if test "x$enable_egl" != xyes; then
AC_MSG_ERROR([cannot build egl state tracker without EGL library])
fi
+ HAVE_ST_EGL="yes"
;;
xorg)
PKG_CHECK_MODULES([LIBDRM_XORG], [libdrm >= $LIBDRM_XORG_REQUIRED])
PKG_CHECK_MODULES([LIBKMS_XORG], [libkms >= $LIBKMS_XORG_REQUIRED])
- HAVE_XORG="yes"
+ HAVE_ST_XORG="yes"
;;
es)
# mesa/es is required to build es state tracker
@@ -1239,7 +1252,7 @@ yes)
;;
esac
-if test "x$HAVE_XORG" = xyes; then
+if test "x$HAVE_ST_XORG" = xyes; then
PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71",
HAVE_XEXTPROTO_71="no")
@@ -1304,6 +1317,25 @@ AC_ARG_WITH([max-height],
)
dnl
+dnl Gallium helper functions
+dnl
+gallium_check_st() {
+ if test "x$HAVE_ST_DRI" = xyes || test "x$HAVE_ST_EGL" = xyes || test "x$HAVE_ST_XORG" = xyes; then
+ GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS $1"
+ fi
+ if test "x$HAVE_ST_DRI" = xyes && test "x$2" != x; then
+ GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $2"
+ fi
+ if test "x$HAVE_ST_EGL" = xyes && test "x$3" != x; then
+ GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $3"
+ fi
+ if test "x$HAVE_ST_XORG" = xyes && test "x$4" != x; then
+ GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $4"
+ fi
+}
+
+
+dnl
dnl Gallium SVGA configuration
dnl
AC_ARG_ENABLE([gallium-svga],
@@ -1312,8 +1344,8 @@ AC_ARG_ENABLE([gallium-svga],
[enable_gallium_svga="$enableval"],
[enable_gallium_svga=auto])
if test "x$enable_gallium_svga" = xyes; then
- GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS vmware"
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
+ gallium_check_st "svga/drm" "dri-vmwgfx" "egl-vmwgfx" "xorg-vmwgfx"
elif test "x$enable_gallium_svga" = xauto; then
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
fi
@@ -1327,8 +1359,8 @@ AC_ARG_ENABLE([gallium-intel],
[enable_gallium_intel="$enableval"],
[enable_gallium_intel=auto])
if test "x$enable_gallium_intel" = xyes; then
- GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS intel i965"
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915 i965"
+ gallium_check_st "i915/drm i965/drm" "dri-i915 dri-i965" "egl-i915 egl-i965" "xorg-i915 xorg-i965"
elif test "x$enable_gallium_intel" = xauto; then
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915 i965"
fi
@@ -1342,8 +1374,8 @@ AC_ARG_ENABLE([gallium-radeon],
[enable_gallium_radeon="$enableval"],
[enable_gallium_radeon=auto])
if test "x$enable_gallium_radeon" = xyes; then
- GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS radeon"
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
+ gallium_check_st "radeon/drm" "dri-radeong" "egl-radeon" "xorg-radeon"
elif test "x$enable_gallium_radeon" = xauto; then
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
fi
@@ -1357,8 +1389,8 @@ AC_ARG_ENABLE([gallium-nouveau],
[enable_gallium_nouveau="$enableval"],
[enable_gallium_nouveau=no])
if test "x$enable_gallium_nouveau" = xyes; then
- GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS nouveau"
- GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nv30 nv40 nv50"
+ GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nvfx nv50"
+ gallium_check_st "nouveau/drm" "dri-nouveau" "egl-nouveau" "xorg-nouveau"
fi
dnl
@@ -1366,11 +1398,16 @@ dnl Gallium swrast configuration
dnl
AC_ARG_ENABLE([gallium-swrast],
[AS_HELP_STRING([--enable-gallium-swrast],
- [build gallium swrast @<:@default=disabled@:>@])],
+ [build gallium swrast @<:@default=auto@:>@])],
[enable_gallium_swrast="$enableval"],
[enable_gallium_swrast=auto])
-if test "x$enable_gallium_swrast" = xyes; then
- GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS swrast"
+if test "x$enable_gallium_swrast" = xyes || test "x$enable_gallium_swrast" = xauto; then
+ if test "x$HAVE_ST_DRI" = xyes; then
+ GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS dri-swrast"
+ fi
+ if test "x$HAVE_ST_EGL" = xyes; then
+ GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS egl-swrast"
+ fi
fi
dnl prepend CORE_DIRS to SRC_DIRS
@@ -1426,8 +1463,8 @@ echo ""
if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then
echo " Gallium: yes"
echo " Gallium dirs: $GALLIUM_DIRS"
+ echo " Target dirs: $GALLIUM_TARGET_DIRS"
echo " Winsys dirs: $GALLIUM_WINSYS_DIRS"
- echo " Winsys drm dirs:$GALLIUM_WINSYS_DRM_DIRS"
echo " Driver dirs: $GALLIUM_DRIVERS_DIRS"
echo " Trackers dirs: $GALLIUM_STATE_TRACKERS_DIRS"
else
diff --git a/docs/GL3.txt b/docs/GL3.txt
index 889edefbce..565ce2b234 100644
--- a/docs/GL3.txt
+++ b/docs/GL3.txt
@@ -16,6 +16,7 @@ GLSL changes (GL_EXT_gpu_shader4, etc) not started
Conditional rendering (GL_NV_conditional_render) DONE (swrast & softpipe)
Map buffer subranges (GL_APPLE_flush_buffer_range) not started
Float textures, renderbuffers some infrastructure done
+ (incl. GL_EXT_packed_float, GL_EXT_shared_exponent)
Framebuffer objects (GL_EXT_framebuffer_object) DONE
Half-float some infrastructure done
Multisample blit DONE
@@ -56,7 +57,7 @@ GLSL 1.50 not started
Geometry shaders (GL_ARB_geometry_shader4) partially done (Zack)
BGRA vertex order (GL_ARB_vertex_array_bgra) DONE
Base vertex offset(GL_ARB_draw_elements_base_vertex) DONE
-Frag shader coord (GL_ARB_fragment_coord_conventions) not started
+Frag shader coord (GL_ARB_fragment_coord_conventions) DONE (swrast, gallium)
Provoking vertex (GL_ARB_provoking_vertex) DONE
Seamless cubemaps (GL_ARB_seamless_cube_map) DONE, mostly?
Multisample textures (GL_ARB_texture_multisample) not started
diff --git a/docs/egl.html b/docs/egl.html
index 55907f6cfa..e960309fc4 100644
--- a/docs/egl.html
+++ b/docs/egl.html
@@ -106,11 +106,11 @@ noted that the classic <code>libGL</code> is not a state tracker and cannot be
used with EGL (unless the EGL driver in use is <code>egl_glx</code>). To build
the OpenGL state tracker, one may append <code>glx</code> to
<code>--with-state-trackers</code> and manually build
-<code>src/gallium/winsys/xlib/</code>.</p>
+<code>src/gallium/targets/libgl-xlib/</code>.</p>
<h2>Use EGL</h2>
-<p> The demos for OpenGL ES and OpenVG can be found in <code>progs/es1/</code>,
+<p>The demos for OpenGL ES and OpenVG can be found in <code>progs/es1/</code>,
<code>progs/es2/</code> and <code>progs/openvg/</code>. You can use them to
test your build. For example,</p>
diff --git a/docs/install.html b/docs/install.html
index 5aea92e0b5..3962ea5c91 100644
--- a/docs/install.html
+++ b/docs/install.html
@@ -361,7 +361,7 @@ To build Mesa with SCons for Windows on Linux using the MinGW crosscompiler tool
This will create:
</p>
<ul>
-<li>build/windows-x86-debug/gallium/winsys/gdi/opengl32.dll &mdash; Mesa + Gallium + softpipe, binary compatible with Windows's opengl32.dll
+<li>build/windows-x86-debug/gallium/targets/libgl-gdi/opengl32.dll &mdash; Mesa + Gallium + softpipe, binary compatible with Windows's opengl32.dll
<li>build/windows-x86-debug/glut/glx/glut32.dll
<li>progs/build/windows-x86-debug/wgl/wglinfo.exe
<li>progs/build/windows-x86-debug/trivial/tri.exe
diff --git a/docs/relnotes-7.9.html b/docs/relnotes-7.9.html
new file mode 100644
index 0000000000..f7d5016dc6
--- /dev/null
+++ b/docs/relnotes-7.9.html
@@ -0,0 +1,50 @@
+<HTML>
+
+<TITLE>Mesa Release Notes</TITLE>
+
+<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
+
+<BODY>
+
+<body bgcolor="#eeeeee">
+
+<H1>Mesa 7.9 Release Notes / date TBD</H1>
+
+<p>
+Mesa 7.9 is a new development release.
+People who are concerned with stability and reliability should stick
+with a previous release or wait for Mesa 7.9.1.
+</p>
+<p>
+Mesa 7.9 implements the OpenGL 2.1 API, but the version reported by
+glGetString(GL_VERSION) depends on the particular driver being used.
+Some drivers don't support all the features required in OpenGL 2.1.
+</p>
+<p>
+See the <a href="install.html">Compiling/Installing page</a> for prerequisites
+for DRI hardware acceleration.
+</p>
+
+
+<h2>MD5 checksums</h2>
+<pre>
+tbd
+</pre>
+
+
+<h2>New features</h2>
+<ul>
+</ul>
+
+
+<h2>Bug fixes</h2>
+<ul>
+</ul>
+
+
+<h2>Changes</h2>
+<ul>
+</ul>
+
+</body>
+</html>
diff --git a/include/GL/glut_h.dja b/include/GL/glut_h.dja
deleted file mode 100644
index e76dcb985e..0000000000
--- a/include/GL/glut_h.dja
+++ /dev/null
@@ -1,340 +0,0 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 3.1
- * Copyright (C) 1995-1998 Brian Paul
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-/*
- * This header file is based on the REAL glut.h by Mark J. Kilgard.
- *
- * The DJGPP/ALLEGRO (DJA) GLUT implementation was written by
- * Bernhard Tschirren (bernie-t@geocities.com) for the sole purpose
- * of compiling all the sample programs (which use GLUT). Therefore,
- * is NOT AT ALL a complete version of GLUT!
- */
-
-
-#ifndef __AGLUT_H__
-#define __AGLUT_H__
-
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-#define GLUTCALLBACK
-#define APIENTRY
-#define GLUTAPI extern
-
-#define GLUT_RGB 0
-#define GLUT_RGBA GLUT_RGB
-#define GLUT_INDEX 1
-#define GLUT_SINGLE 0
-#define GLUT_DOUBLE 2
-#define GLUT_ACCUM 4
-#define GLUT_ALPHA 8
-#define GLUT_DEPTH 16
-#define GLUT_STENCIL 32
-
-/* Mouse buttons. */
-#define GLUT_LEFT_BUTTON 0
-#define GLUT_MIDDLE_BUTTON 1
-#define GLUT_RIGHT_BUTTON 2
-
-/* Mouse button state. */
-#define GLUT_DOWN 0
-#define GLUT_UP 1
-
-/* function keys */
-#define GLUT_KEY_F1 1
-#define GLUT_KEY_F2 2
-#define GLUT_KEY_F3 3
-#define GLUT_KEY_F4 4
-#define GLUT_KEY_F5 5
-#define GLUT_KEY_F6 6
-#define GLUT_KEY_F7 7
-#define GLUT_KEY_F8 8
-#define GLUT_KEY_F9 9
-#define GLUT_KEY_F10 10
-#define GLUT_KEY_F11 11
-#define GLUT_KEY_F12 12
-
-/* directional keys */
-#define GLUT_KEY_LEFT 100
-#define GLUT_KEY_UP 101
-#define GLUT_KEY_RIGHT 102
-#define GLUT_KEY_DOWN 103
-#define GLUT_KEY_PAGE_UP 104
-#define GLUT_KEY_PAGE_DOWN 105
-#define GLUT_KEY_HOME 106
-#define GLUT_KEY_END 107
-#define GLUT_KEY_INSERT 108
-
-/* Entry/exit state. */
-#define GLUT_LEFT 0
-#define GLUT_ENTERED 1
-
-/* Visibility state. */
-#define GLUT_NOT_VISIBLE 0
-#define GLUT_VISIBLE 1
-
-/* Color index component selection values. */
-#define GLUT_RED 0
-#define GLUT_GREEN 1
-#define GLUT_BLUE 2
-
-/* Layers for use. */
-#define GLUT_NORMAL 0
-#define GLUT_OVERLAY 1
-
-/* Stroke font constants (use these in GLUT program). */
-#define GLUT_STROKE_ROMAN ((void*)0)
-#define GLUT_STROKE_MONO_ROMAN ((void*)1)
-
-/* Bitmap font constants (use these in GLUT program). */
-#define GLUT_BITMAP_9_BY_15 ((void*)2)
-#define GLUT_BITMAP_8_BY_13 ((void*)3)
-#define GLUT_BITMAP_TIMES_ROMAN_10 ((void*)4)
-#define GLUT_BITMAP_TIMES_ROMAN_24 ((void*)5)
-#define GLUT_BITMAP_HELVETICA_10 ((void*)6)
-#define GLUT_BITMAP_HELVETICA_12 ((void*)7)
-#define GLUT_BITMAP_HELVETICA_18 ((void*)8)
-
-/* glutGet parameters. */
-#define GLUT_WINDOW_X 100
-#define GLUT_WINDOW_Y 101
-#define GLUT_WINDOW_WIDTH 102
-#define GLUT_WINDOW_HEIGHT 103
-#define GLUT_WINDOW_BUFFER_SIZE 104
-#define GLUT_WINDOW_STENCIL_SIZE 105
-#define GLUT_WINDOW_DEPTH_SIZE 106
-#define GLUT_WINDOW_RED_SIZE 107
-#define GLUT_WINDOW_GREEN_SIZE 108
-#define GLUT_WINDOW_BLUE_SIZE 109
-#define GLUT_WINDOW_ALPHA_SIZE 110
-#define GLUT_WINDOW_ACCUM_RED_SIZE 111
-#define GLUT_WINDOW_ACCUM_GREEN_SIZE 112
-#define GLUT_WINDOW_ACCUM_BLUE_SIZE 113
-#define GLUT_WINDOW_ACCUM_ALPHA_SIZE 114
-#define GLUT_WINDOW_DOUBLEBUFFER 115
-#define GLUT_WINDOW_RGBA 116
-#define GLUT_WINDOW_PARENT 117
-#define GLUT_WINDOW_NUM_CHILDREN 118
-#define GLUT_WINDOW_COLORMAP_SIZE 119
-#define GLUT_WINDOW_NUM_SAMPLES 120
-#define GLUT_WINDOW_STEREO 121
-#define GLUT_WINDOW_CURSOR 122
-#define GLUT_SCREEN_WIDTH 200
-#define GLUT_SCREEN_HEIGHT 201
-#define GLUT_SCREEN_WIDTH_MM 202
-#define GLUT_SCREEN_HEIGHT_MM 203
-#define GLUT_MENU_NUM_ITEMS 300
-#define GLUT_DISPLAY_MODE_POSSIBLE 400
-#define GLUT_INIT_WINDOW_X 500
-#define GLUT_INIT_WINDOW_Y 501
-#define GLUT_INIT_WINDOW_WIDTH 502
-#define GLUT_INIT_WINDOW_HEIGHT 503
-#define GLUT_INIT_DISPLAY_MODE 504
-#define GLUT_ELAPSED_TIME 700
-#define GLUT_WINDOW_FORMAT_ID 123
-
-/* glutDeviceGet parameters. */
-#define GLUT_HAS_KEYBOARD 600
-#define GLUT_HAS_MOUSE 601
-#define GLUT_HAS_SPACEBALL 602
-#define GLUT_HAS_DIAL_AND_BUTTON_BOX 603
-#define GLUT_HAS_TABLET 604
-#define GLUT_NUM_MOUSE_BUTTONS 605
-#define GLUT_NUM_SPACEBALL_BUTTONS 606
-#define GLUT_NUM_BUTTON_BOX_BUTTONS 607
-#define GLUT_NUM_DIALS 608
-#define GLUT_NUM_TABLET_BUTTONS 609
-#define GLUT_DEVICE_IGNORE_KEY_REPEAT 610
-#define GLUT_DEVICE_KEY_REPEAT 611
-#define GLUT_HAS_JOYSTICK 612
-#define GLUT_OWNS_JOYSTICK 613
-#define GLUT_JOYSTICK_BUTTONS 614
-#define GLUT_JOYSTICK_AXES 615
-#define GLUT_JOYSTICK_POLL_RATE 616
-
-/* glutLayerGet parameters. */
-#define GLUT_OVERLAY_POSSIBLE 800
-#define GLUT_LAYER_IN_USE 801
-#define GLUT_HAS_OVERLAY 802
-#define GLUT_TRANSPARENT_INDEX 803
-#define GLUT_NORMAL_DAMAGED 804
-#define GLUT_OVERLAY_DAMAGED 805
-
-/* glutVideoResizeGet parameters. */
-#define GLUT_VIDEO_RESIZE_POSSIBLE 900
-#define GLUT_VIDEO_RESIZE_IN_USE 901
-#define GLUT_VIDEO_RESIZE_X_DELTA 902
-#define GLUT_VIDEO_RESIZE_Y_DELTA 903
-#define GLUT_VIDEO_RESIZE_WIDTH_DELTA 904
-#define GLUT_VIDEO_RESIZE_HEIGHT_DELTA 905
-#define GLUT_VIDEO_RESIZE_X 906
-#define GLUT_VIDEO_RESIZE_Y 907
-#define GLUT_VIDEO_RESIZE_WIDTH 908
-#define GLUT_VIDEO_RESIZE_HEIGHT 909
-
-/* glutUseLayer parameters. */
-#define GLUT_NORMAL 0
-#define GLUT_OVERLAY 1
-
-/* glutGetModifiers return mask. */
-#define GLUT_ACTIVE_SHIFT 1
-#define GLUT_ACTIVE_CTRL 2
-#define GLUT_ACTIVE_ALT 4
-
-/* glutSetCursor parameters. */
-/* Basic arrows. */
-#define GLUT_CURSOR_RIGHT_ARROW 0
-#define GLUT_CURSOR_LEFT_ARROW 1
-/* Symbolic cursor shapes. */
-#define GLUT_CURSOR_INFO 2
-#define GLUT_CURSOR_DESTROY 3
-#define GLUT_CURSOR_HELP 4
-#define GLUT_CURSOR_CYCLE 5
-#define GLUT_CURSOR_SPRAY 6
-#define GLUT_CURSOR_WAIT 7
-#define GLUT_CURSOR_TEXT 8
-#define GLUT_CURSOR_CROSSHAIR 9
-/* Directional cursors. */
-#define GLUT_CURSOR_UP_DOWN 10
-#define GLUT_CURSOR_LEFT_RIGHT 11
-/* Sizing cursors. */
-#define GLUT_CURSOR_TOP_SIDE 12
-#define GLUT_CURSOR_BOTTOM_SIDE 13
-#define GLUT_CURSOR_LEFT_SIDE 14
-#define GLUT_CURSOR_RIGHT_SIDE 15
-#define GLUT_CURSOR_TOP_LEFT_CORNER 16
-#define GLUT_CURSOR_TOP_RIGHT_CORNER 17
-#define GLUT_CURSOR_BOTTOM_RIGHT_CORNER 18
-#define GLUT_CURSOR_BOTTOM_LEFT_CORNER 19
-/* Inherit from parent window. */
-#define GLUT_CURSOR_INHERIT 100
-/* Blank cursor. */
-#define GLUT_CURSOR_NONE 101
-/* Fullscreen crosshair (if available). */
-#define GLUT_CURSOR_FULL_CROSSHAIR 102
-
-/* GLUT initialization sub-API. */
-GLUTAPI void APIENTRY glutInit(int *argcp, char **argv);
-GLUTAPI void APIENTRY glutInitDisplayMode(unsigned int mode);
-GLUTAPI void APIENTRY glutInitWindowPosition(int x, int y);
-GLUTAPI void APIENTRY glutInitWindowSize(int width, int height);
-GLUTAPI void APIENTRY glutMainLoop(void);
-
-/* GLUT window sub-API. */
-GLUTAPI int APIENTRY glutCreateWindow(const char *title);
-GLUTAPI int APIENTRY glutCreateSubWindow(int win, int x, int y, int width, int height);
-GLUTAPI void APIENTRY glutDestroyWindow(int win);
-GLUTAPI void APIENTRY glutPostRedisplay(void);
-GLUTAPI void APIENTRY glutSwapBuffers(void);
-GLUTAPI int APIENTRY glutGetWindow(void);
-GLUTAPI void APIENTRY glutSetWindow(int win);
-GLUTAPI void APIENTRY glutSetWindowTitle(const char *title);
-GLUTAPI void APIENTRY glutSetIconTitle(const char *title);
-GLUTAPI void APIENTRY glutPositionWindow(int x, int y);
-GLUTAPI void APIENTRY glutReshapeWindow(int width, int height);
-GLUTAPI void APIENTRY glutPopWindow(void);
-GLUTAPI void APIENTRY glutPushWindow(void);
-GLUTAPI void APIENTRY glutIconifyWindow(void);
-GLUTAPI void APIENTRY glutShowWindow(void);
-GLUTAPI void APIENTRY glutHideWindow(void);
-
-/* GLUT overlay sub-API. */
-GLUTAPI void APIENTRY glutEstablishOverlay(void);
-GLUTAPI void APIENTRY glutRemoveOverlay(void);
-GLUTAPI void APIENTRY glutUseLayer(GLenum layer);
-GLUTAPI void APIENTRY glutPostOverlayRedisplay(void);
-GLUTAPI void APIENTRY glutShowOverlay(void);
-GLUTAPI void APIENTRY glutHideOverlay(void);
-
-/* GLUT menu sub-API. */
-GLUTAPI int APIENTRY glutCreateMenu(void (GLUTCALLBACK *)(int));
-GLUTAPI void APIENTRY glutDestroyMenu(int menu);
-GLUTAPI int APIENTRY glutGetMenu(void);
-GLUTAPI void APIENTRY glutSetMenu(int menu);
-GLUTAPI void APIENTRY glutAddMenuEntry(const char *label, int value);
-GLUTAPI void APIENTRY glutAddSubMenu(const char *label, int submenu);
-GLUTAPI void APIENTRY glutChangeToMenuEntry(int item, const char *label, int value);
-GLUTAPI void APIENTRY glutChangeToSubMenu(int item, const char *label, int submenu);
-GLUTAPI void APIENTRY glutRemoveMenuItem(int item);
-GLUTAPI void APIENTRY glutAttachMenu(int button);
-GLUTAPI void APIENTRY glutDetachMenu(int button);
-
-/* GLUT window callback sub-API. */
-GLUTAPI void APIENTRY glutDisplayFunc(void (GLUTCALLBACK * func)(void));
-GLUTAPI void APIENTRY glutReshapeFunc(void (GLUTCALLBACK * func)(int width, int height));
-GLUTAPI void APIENTRY glutKeyboardFunc(void (GLUTCALLBACK * func)(unsigned char key, int x, int y));
-GLUTAPI void APIENTRY glutMouseFunc(void (GLUTCALLBACK * func)(int button, int state, int x, int y));
-GLUTAPI void APIENTRY glutMotionFunc(void (GLUTCALLBACK * func)(int x, int y));
-GLUTAPI void APIENTRY glutPassiveMotionFunc(void (GLUTCALLBACK * func)(int x, int y));
-GLUTAPI void APIENTRY glutEntryFunc(void (GLUTCALLBACK * func)(int state));
-GLUTAPI void APIENTRY glutVisibilityFunc(void (GLUTCALLBACK * func)(int state));
-GLUTAPI void APIENTRY glutIdleFunc(void (GLUTCALLBACK * func)(void));
-GLUTAPI void APIENTRY glutTimerFunc(unsigned int millis, void (GLUTCALLBACK * func)(int value), int value);
-GLUTAPI void APIENTRY glutMenuStateFunc(void (GLUTCALLBACK * func)(int state));
-GLUTAPI void APIENTRY glutSpecialFunc(void (GLUTCALLBACK * func)(int key, int x, int y));
-GLUTAPI void APIENTRY glutSpaceballMotionFunc(void (GLUTCALLBACK * func)(int x, int y, int z));
-GLUTAPI void APIENTRY glutSpaceballRotateFunc(void (GLUTCALLBACK * func)(int x, int y, int z));
-GLUTAPI void APIENTRY glutSpaceballButtonFunc(void (GLUTCALLBACK * func)(int button, int state));
-GLUTAPI void APIENTRY glutButtonBoxFunc(void (GLUTCALLBACK * func)(int button, int state));
-GLUTAPI void APIENTRY glutDialsFunc(void (GLUTCALLBACK * func)(int dial, int value));
-GLUTAPI void APIENTRY glutTabletMotionFunc(void (GLUTCALLBACK * func)(int x, int y));
-GLUTAPI void APIENTRY glutTabletButtonFunc(void (GLUTCALLBACK * func)(int button, int state, int x, int y));
-GLUTAPI void APIENTRY glutMenuStatusFunc(void (GLUTCALLBACK * func)(int status, int x, int y));
-GLUTAPI void APIENTRY glutOverlayDisplayFunc(void (GLUTCALLBACK * func)(void));
-GLUTAPI void APIENTRY glutWindowStatusFunc(void (GLUTCALLBACK * func)(int state));
-
-/* GLUT color index sub-API. */
-GLUTAPI void APIENTRY glutSetColor(int, GLfloat red, GLfloat green, GLfloat blue);
-GLUTAPI GLfloat APIENTRY glutGetColor(int ndx, int component);
-GLUTAPI void APIENTRY glutCopyColormap(int win);
-
-/* GLUT state retrieval sub-API. */
-GLUTAPI int APIENTRY glutGet(GLenum type);
-GLUTAPI int APIENTRY glutDeviceGet(GLenum type);
-
-/* GLUT font sub-API */
-GLUTAPI void APIENTRY glutBitmapCharacter(void *font, int character);
-GLUTAPI int APIENTRY glutBitmapWidth(void *font, int character);
-GLUTAPI void APIENTRY glutStrokeCharacter(void *font, int character);
-GLUTAPI int APIENTRY glutStrokeWidth(void *font, int character);
-
-/* GLUT pre-built models sub-API */
-GLUTAPI void APIENTRY glutWireSphere(GLdouble radius, GLint slices, GLint stacks);
-GLUTAPI void APIENTRY glutSolidSphere(GLdouble radius, GLint slices, GLint stacks);
-GLUTAPI void APIENTRY glutWireCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
-GLUTAPI void APIENTRY glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
-GLUTAPI void APIENTRY glutWireCube(GLdouble size);
-GLUTAPI void APIENTRY glutSolidCube(GLdouble size);
-GLUTAPI void APIENTRY glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
-GLUTAPI void APIENTRY glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
-GLUTAPI void APIENTRY glutWireDodecahedron(void);
-GLUTAPI void APIENTRY glutSolidDodecahedron(void);
-GLUTAPI void APIENTRY glutWireTeapot(GLdouble size);
-GLUTAPI void APIENTRY glutSolidTeapot(GLdouble size);
-GLUTAPI void APIENTRY glutWireOctahedron(void);
-GLUTAPI void APIENTRY glutSolidOctahedron(void);
-GLUTAPI void APIENTRY glutWireTetrahedron(void);
-GLUTAPI void APIENTRY glutSolidTetrahedron(void);
-GLUTAPI void APIENTRY glutWireIcosahedron(void);
-GLUTAPI void APIENTRY glutSolidIcosahedron(void);
-
-#endif /* __AGLUT_H__ */
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index 1d4e82e154..fa9b7c4bf2 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -41,7 +41,13 @@
#define DRI_INTERFACE_H
/* For archs with no drm.h */
-#if !defined(__APPLE__) && !defined(__CYGWIN__) && !defined(__GNU__)
+#if defined(__APPLE__) || defined(__CYGWIN__) || defined(__GNU__)
+#ifndef __NOT_HAVE_DRM_H
+#define __NOT_HAVE_DRM_H
+#endif
+#endif
+
+#ifndef __NOT_HAVE_DRM_H
#include <drm.h>
#else
typedef unsigned int drm_context_t;
@@ -410,15 +416,15 @@ struct __DRIswrastLoaderExtensionRec {
* Put image to drawable
*/
void (*putImage)(__DRIdrawable *drawable, int op,
- int x, int y, int width, int height, char *data,
- void *loaderPrivate);
+ int x, int y, int width, int height,
+ char *data, void *loaderPrivate);
/**
- * Get image from drawable
+ * Get image from readable
*/
- void (*getImage)(__DRIdrawable *drawable,
- int x, int y, int width, int height, char *data,
- void *loaderPrivate);
+ void (*getImage)(__DRIdrawable *readable,
+ int x, int y, int width, int height,
+ char *data, void *loaderPrivate);
};
/**
diff --git a/include/GL/mglmesa.h b/include/GL/mglmesa.h
deleted file mode 100644
index 0f9f789571..0000000000
--- a/include/GL/mglmesa.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-*
-* Mesa bindings for SciTech MGL
-*
-* Copyright (C) 1996 SciTech Software.
-* All rights reserved.
-*
-* Filename: mglmesa.h
-* Version: Revision: 1.1.1.1
-*
-* Language: ANSI C
-* Environment: Any
-*
-* Description: Header file for the Mesa/OpenGL interface bindings for the
-* SciTech MGL graphics library. Uses the MGL internal
-* device context structures to get direct access to the
-* high performance MGL rasterization functions for maximum
-* performance. Utilizes the VESA VBE/AF Accelerator Functions
-* via the MGL's accelerated device driver functions, as well
-* as basic DirectDraw accelerated functions provided by the
-* MGL.
-*
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU Library General Public
-* License as published by the Free Software Foundation; either
-* version 2 of the License, or (at your option) any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Library General Public License for more details.
-*
-* You should have received a copy of the GNU Library General Public
-* License along with this library; if not, write to the Free
-* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*
-*
-****************************************************************************/
-
-#ifndef __MGLMESA_H
-#define __MGLMESA_H
-
-#include "mgraph.h"
-
-/*------------------------- Function Prototypes ---------------------------*/
-
-#ifdef __cplusplus
-extern "C" { /* Use "C" linkage when in C++ mode */
-#endif
-
-#ifndef __WINDOWS__
-#define GLAPIENTRY
-#endif
-
-#ifdef __WINDOWS__
-bool GLAPIENTRY MGLMesaInitDLL(MGLCallbacks *cb,char *version);
-#endif
-void GLAPIENTRY MGLMesaChooseVisual(MGLDC *dc,MGLVisual *visual);
-bool GLAPIENTRY MGLMesaSetVisual(MGLDC *dc,MGLVisual *visual);
-bool GLAPIENTRY MGLMesaCreateContext(MGLDC *dc,bool forceMemDC);
-void GLAPIENTRY MGLMesaDestroyContext(MGLDC *dc);
-void GLAPIENTRY MGLMesaMakeCurrent(MGLDC *dc);
-void GLAPIENTRY MGLMesaSwapBuffers(MGLDC *dc,bool waitVRT);
-
-/* Palette manipulation support. The reason we provide palette manipulation
- * routines is so that when rendering in double buffered modes with a
- * software backbuffer, the palette for the backbuffer is kept consistent
- * with the hardware front buffer.
- */
-
-void GLAPIENTRY MGLMesaSetPaletteEntry(MGLDC *dc,int entry,uchar red,uchar green,uchar blue);
-void GLAPIENTRY MGLMesaSetPalette(MGLDC *dc,palette_t *pal,int numColors,int startIndex);
-void GLAPIENTRY MGLMesaRealizePalette(MGLDC *dc,int numColors,int startIndex,int waitVRT);
-
-#ifdef __cplusplus
-} /* End of "C" linkage for C++ */
-#endif /* __cplusplus */
-
-#endif /* __MGLMESA_H */
diff --git a/progs/SConscript b/progs/SConscript
index aa6640cf7a..a90e13b4cb 100644
--- a/progs/SConscript
+++ b/progs/SConscript
@@ -56,4 +56,5 @@ SConscript([
'wgl/SConscript',
'perf/SConscript',
'gallium/unit/SConscript',
+# 'gallium/raw/SConscript',
])
diff --git a/progs/demos/dissolve.c b/progs/demos/dissolve.c
index 0b8df1bb66..8ab5242d91 100644
--- a/progs/demos/dissolve.c
+++ b/progs/demos/dissolve.c
@@ -1,5 +1,5 @@
/**
- * Dissolve between two images using randomized stencil buffer
+ * Dissolve between two images using randomized/patterned stencil buffer
* and varying stencil ref.
*
* Brian Paul
@@ -9,6 +9,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <math.h>
#include <GL/glut.h>
#include "readtex.h"
@@ -28,6 +29,8 @@ static GLfloat ScaleX[2], ScaleY[2];
static GLubyte StencilRef = 0;
+static int Mode = 0;
+
static void
Idle(void)
@@ -38,13 +41,114 @@ Idle(void)
static void
-RandomizeStencilBuffer(void)
+FillRandomPixels(GLubyte *b)
{
- GLubyte *b = malloc(WinWidth * WinHeight);
int i;
for (i = 0; i < WinWidth * WinHeight; i++) {
b[i] = rand() & 0xff;
}
+}
+
+
+static void
+FillRandomRects(GLubyte *b)
+{
+ int i;
+
+ memset(b, 0, WinWidth * WinHeight);
+
+ for (i = 0; i < 256; i++) {
+ int x = rand() % WinWidth;
+ int y = rand() % WinHeight;
+ int w = rand() % 60;
+ int h = rand() % 60;
+ int ix, iy;
+
+ if (x + w > WinWidth)
+ w = WinWidth - x;
+ if (y + h > WinHeight)
+ h = WinHeight - y;
+
+ for (iy = 0; iy < h; iy++) {
+ for (ix = 0; ix < w; ix++) {
+ int p = (y + iy) * WinWidth + x + ix;
+ b[p] = i;
+ }
+ }
+ }
+}
+
+
+static void
+FillWipe(GLubyte *b)
+{
+ int iy, ix;
+
+ memset(b, 0, WinWidth * WinHeight);
+
+ for (iy = 0; iy < WinHeight; iy++) {
+ for (ix = 0; ix < WinWidth; ix++) {
+ int p = iy * WinWidth + ix;
+ b[p] = 2 * ix + iy / 2;
+ }
+ }
+}
+
+
+static void
+FillMoire(GLubyte *b)
+{
+ int iy, ix;
+
+ memset(b, 0, WinWidth * WinHeight);
+
+ for (iy = 0; iy < WinHeight; iy++) {
+ for (ix = 0; ix < WinWidth; ix++) {
+ int p = iy * WinWidth + ix;
+ b[p] = (ix / 2) * (ix / 2) - (iy / 2) * (iy / 2);
+ }
+ }
+}
+
+
+static void
+FillWaves(GLubyte *b)
+{
+ int iy, ix;
+
+ memset(b, 0, WinWidth * WinHeight);
+
+ for (iy = 0; iy < WinHeight; iy++) {
+ for (ix = 0; ix < WinWidth; ix++) {
+ int p = iy * WinWidth + ix;
+ float x = 8.0 * 3.1415 * ix / (float) WinWidth;
+ b[p] = (int) (25.0 * sin(x) ) - iy*2;
+ }
+ }
+}
+
+
+typedef void (*FillFunc)(GLubyte *b);
+
+
+static FillFunc Funcs[] = {
+ FillRandomPixels,
+ FillRandomRects,
+ FillWipe,
+ FillMoire,
+ FillWaves
+};
+
+#define NUM_MODES (sizeof(Funcs) / sizeof(Funcs[0]))
+
+
+
+static void
+InitStencilBuffer(void)
+{
+ GLubyte *b = malloc(WinWidth * WinHeight);
+
+ Funcs[Mode](b);
glStencilFunc(GL_ALWAYS, 0, ~0);
glPixelZoom(1.0, 1.0);
@@ -54,7 +158,6 @@ RandomizeStencilBuffer(void)
}
-
static void
Draw(void)
{
@@ -85,7 +188,7 @@ Reshape(int width, int height)
glLoadIdentity();
glTranslatef(0.0, 0.0, -15.0);
- RandomizeStencilBuffer();
+ InitStencilBuffer();
ScaleX[0] = (float) width / ImgWidth[0];
ScaleY[0] = (float) height / ImgHeight[0];
@@ -102,12 +205,26 @@ Key(unsigned char key, int x, int y)
(void) y;
switch (key) {
case 'a':
+ case ' ':
Anim = !Anim;
if (Anim)
glutIdleFunc(Idle);
else
glutIdleFunc(NULL);
break;
+ case 'i':
+ InitStencilBuffer();
+ break;
+ case '-':
+ StencilRef--;
+ break;
+ case '+':
+ StencilRef++;
+ break;
+ case 'm':
+ Mode = (Mode + 1) % NUM_MODES;
+ InitStencilBuffer();
+ break;
case 27:
glutDestroyWindow(Win);
exit(0);
@@ -143,8 +260,8 @@ Init(void)
int
main(int argc, char *argv[])
{
- glutInit(&argc, argv);
glutInitWindowSize(WinWidth, WinHeight);
+ glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_STENCIL);
Win = glutCreateWindow(argv[0]);
glutReshapeFunc(Reshape);
@@ -153,6 +270,14 @@ main(int argc, char *argv[])
if (Anim)
glutIdleFunc(Idle);
Init();
+
+ printf("Keys:\n");
+ printf(" a/SPACE toggle animation\n");
+ printf(" +/- single step\n");
+ printf(" i re-init pattern\n");
+ printf(" m change pattern/dissolve mode\n");
+ printf(" ESC exit\n");
+
glutMainLoop();
return 0;
}
diff --git a/progs/demos/stex3d.c b/progs/demos/stex3d.c
index c0bbea0960..de18480c25 100644
--- a/progs/demos/stex3d.c
+++ b/progs/demos/stex3d.c
@@ -36,6 +36,7 @@ static int tex_width=64, tex_height=64, tex_depth=64;
static float angx=0, angy=0, angz=0;
static int texgen = 2, animate = 1, smooth = 1, wireframe = 0;
static int CurTexture = NOISE_TEXTURE, CurObject = TORUS;
+static GLenum Filter = GL_LINEAR;
static void
@@ -298,8 +299,6 @@ create3Dtexture(void)
printf("setting up 3d texture...\n");
glBindTexture(GL_TEXTURE_3D, NOISE_TEXTURE);
- glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_REPEAT);
@@ -406,6 +405,9 @@ drawScene(void)
glDisable(GL_TEXTURE_GEN_R);
}
+ glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, Filter);
+ glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, Filter);
+
glCallList(CurObject);
glPopMatrix();
@@ -505,6 +507,12 @@ KeyHandler(unsigned char key, int x, int y)
else
CurObject = TORUS;
break;
+ case 'f':
+ if (Filter == GL_LINEAR)
+ Filter = GL_NEAREST;
+ else
+ Filter = GL_LINEAR;
+ break;
case 'i':
if (CurTexture == NOISE_TEXTURE)
CurTexture = GRADIENT_TEXTURE;
@@ -513,6 +521,7 @@ KeyHandler(unsigned char key, int x, int y)
glBindTexture(GL_TEXTURE_3D, CurTexture);
break;
case 'a':
+ case ' ':
animate = !animate;
if (animate)
glutIdleFunc(Idle);
@@ -559,8 +568,6 @@ create3Dgradient(void)
glBindTexture(GL_TEXTURE_3D, GRADIENT_TEXTURE);
- glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_REPEAT);
diff --git a/progs/egl/Makefile b/progs/egl/Makefile
deleted file mode 100644
index 25de6e1f70..0000000000
--- a/progs/egl/Makefile
+++ /dev/null
@@ -1,70 +0,0 @@
-# progs/egl/Makefile
-
-TOP = ../..
-include $(TOP)/configs/current
-
-
-INCLUDE_DIRS = -I$(TOP)/include
-
-HEADERS = $(TOP)/include/GLES/egl.h
-LIB_DEP = $(TOP)/$(LIB_DIR)/libEGL.so
-
-LIBS = -L$(TOP)/$(LIB_DIR) -lEGL -lGL
-
-PROGRAMS = \
- demo1 \
- demo2 \
- demo3 \
- egltri \
- eglinfo \
- eglgears \
- eglscreen \
- peglgears \
- xeglgears \
- xeglthreads \
- xegl_tri
-
-
-.c.o:
- $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
-
-
-
-default: $(PROGRAMS)
-
-demo1: demo1.o $(HEADERS) $(LIB_DEP)
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB)
-
-demo2: demo2.o $(HEADERS) $(LIB_DEP)
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB)
-
-demo3: demo3.o $(HEADERS) $(LIB_DEP)
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB)
-
-egltri: egltri.o $(HEADERS) $(LIB_DEP)
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB)
-
-eglinfo: eglinfo.o $(HEADERS) $(LIB_DEP)
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS)
-
-eglgears: eglgears.o $(HEADERS) $(LIB_DEP)
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB) -lm
-
-eglscreen: eglscreen.o $(HEADERS) $(LIB_DEP)
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB)
-
-peglgears: peglgears.o $(HEADERS) $(LIB_DEP)
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB) -lm
-
-xeglgears: xeglgears.o $(HEADERS) $(LIB_DEP)
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) -lm -L$(libdir) -lX11
-
-xeglthreads: xeglthreads.o $(HEADERS) $(LIB_DEP)
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) -lm -L$(libdir) -lX11
-
-xegl_tri: xegl_tri.o $(HEADERS) $(LIB_DEP)
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) -lm -L$(libdir) -lX11
-
-clean:
- -rm -f *.o *~
- -rm -f $(PROGRAMS)
diff --git a/progs/egl/egltri.c b/progs/egl/egltri.c
deleted file mode 100644
index 006e06eb03..0000000000
--- a/progs/egl/egltri.c
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
- * Copyright (C) 2008 Brian Paul All Rights Reserved.
- * Copyright (C) 2008 Jakob Bornecrantz All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * This program is based on eglgears and xegl_tri.
- * Remixed by Jakob Bornecrantz
- *
- * No command line options.
- * Program runs for 5 seconds then exits, outputing framerate to console
- */
-
-#define EGL_EGLEXT_PROTOTYPES
-
-#include <assert.h>
-#include <math.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <GL/gl.h>
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-
-#define MAX_CONFIGS 10
-#define MAX_MODES 100
-
-
-/* XXX this probably isn't very portable */
-
-#include <sys/time.h>
-#include <unistd.h>
-
-/* return current time (in seconds) */
-static double
-current_time(void)
-{
- struct timeval tv;
-#ifdef __VMS
- (void) gettimeofday(&tv, NULL );
-#else
- struct timezone tz;
- (void) gettimeofday(&tv, &tz);
-#endif
- return (double) tv.tv_sec + tv.tv_usec / 1000000.0;
-}
-
-
-static GLfloat view_rotx = 0.0, view_roty = 0.0, view_rotz = 0.0;
-
-static void draw()
-{
- static const GLfloat verts[3][2] = {
- { -1, -1 },
- { 1, -1 },
- { 0, 1 }
- };
- static const GLfloat colors[3][3] = {
- { 1, 0, 0 },
- { 0, 1, 0 },
- { 0, 0, 1 }
- };
-
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- glPushMatrix();
- glRotatef(view_rotx, 1, 0, 0);
- glRotatef(view_roty, 0, 1, 0);
- glRotatef(view_rotz, 0, 0, 1);
-
- {
- glVertexPointer(2, GL_FLOAT, 0, verts);
- glColorPointer(3, GL_FLOAT, 0, colors);
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_COLOR_ARRAY);
-
- glDrawArrays(GL_TRIANGLES, 0, 3);
-
- glDisableClientState(GL_VERTEX_ARRAY);
- glDisableClientState(GL_COLOR_ARRAY);
- }
-
- glPopMatrix();
-}
-
-static void init()
-{
- glClearColor(0.4, 0.4, 0.4, 0.0);
-}
-
-/* new window size or exposure */
-static void reshape(int width, int height)
-{
- GLfloat ar = (GLfloat) width / (GLfloat) height;
-
- glViewport(0, 0, (GLint) width, (GLint) height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustum(-ar, ar, -1, 1, 5.0, 60.0);
-
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef(0.0, 0.0, -10.0);
-}
-
-static void run(EGLDisplay dpy, EGLSurface surf, int ttr)
-{
- double st = current_time();
- double ct = st;
- int frames = 0;
- GLfloat seconds, fps;
-
- while (ct - st < ttr)
- {
- ct = current_time();
-
- draw();
-
- eglSwapBuffers(dpy, surf);
-
- frames++;
- }
-
- seconds = ct - st;
- fps = frames / seconds;
- printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds, fps);
-}
-
-int main(int argc, char *argv[])
-{
- int maj, min;
- EGLContext ctx;
- EGLSurface screen_surf;
- EGLConfig configs[MAX_CONFIGS];
- EGLint numConfigs, i;
- EGLBoolean b;
- EGLDisplay d;
- EGLint screenAttribs[10];
- EGLModeMESA mode[MAX_MODES];
- EGLScreenMESA screen;
- EGLint count, chosenMode = 0;
- GLboolean printInfo = GL_FALSE;
- EGLint width = 0, height = 0;
-
- /* parse cmd line args */
- for (i = 1; i < argc; i++)
- {
- if (strcmp(argv[i], "-info") == 0)
- {
- printInfo = GL_TRUE;
- }
- else
- printf("Warning: unknown parameter: %s\n", argv[i]);
- }
-
- /* DBR : Create EGL context/surface etc */
- d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- assert(d);
-
- if (!eglInitialize(d, &maj, &min)) {
- printf("egltri: eglInitialize failed\n");
- exit(1);
- }
-
- printf("egltri: EGL version = %d.%d\n", maj, min);
- printf("egltri: EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR));
-
- /* XXX use ChooseConfig */
- eglGetConfigs(d, configs, MAX_CONFIGS, &numConfigs);
- eglGetScreensMESA(d, &screen, 1, &count);
-
- if (!eglGetModesMESA(d, screen, mode, MAX_MODES, &count) || count == 0) {
- printf("egltri: eglGetModesMESA failed!\n");
- return 0;
- }
-
- /* Print list of modes, and find the one to use */
- printf("egltri: Found %d modes:\n", count);
- for (i = 0; i < count; i++) {
- EGLint w, h;
- eglGetModeAttribMESA(d, mode[i], EGL_WIDTH, &w);
- eglGetModeAttribMESA(d, mode[i], EGL_HEIGHT, &h);
- printf("%3d: %d x %d\n", i, w, h);
- if (w > width && h > height) {
- width = w;
- height = h;
- chosenMode = i;
- }
- }
- printf("egltri: Using screen mode/size %d: %d x %d\n", chosenMode, width, height);
-
- eglBindAPI(EGL_OPENGL_API);
- ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL);
- if (ctx == EGL_NO_CONTEXT) {
- printf("egltri: failed to create context\n");
- return 0;
- }
-
- /* build up screenAttribs array */
- i = 0;
- screenAttribs[i++] = EGL_WIDTH;
- screenAttribs[i++] = width;
- screenAttribs[i++] = EGL_HEIGHT;
- screenAttribs[i++] = height;
- screenAttribs[i++] = EGL_NONE;
-
- screen_surf = eglCreateScreenSurfaceMESA(d, configs[0], screenAttribs);
- if (screen_surf == EGL_NO_SURFACE) {
- printf("egltri: failed to create screen surface\n");
- return 0;
- }
-
- b = eglShowScreenSurfaceMESA(d, screen, screen_surf, mode[chosenMode]);
- if (!b) {
- printf("egltri: show surface failed\n");
- return 0;
- }
-
- b = eglMakeCurrent(d, screen_surf, screen_surf, ctx);
- if (!b) {
- printf("egltri: make current failed\n");
- return 0;
- }
-
- if (printInfo)
- {
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
- printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
- printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
- printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
- }
-
- init();
- reshape(width, height);
-
- glDrawBuffer( GL_BACK );
-
- run(d, screen_surf, 5.0);
-
- eglDestroySurface(d, screen_surf);
- eglDestroyContext(d, ctx);
- eglTerminate(d);
-
- return 0;
-}
diff --git a/progs/egl/eglut/Makefile b/progs/egl/eglut/Makefile
new file mode 100644
index 0000000000..f5cafa7010
--- /dev/null
+++ b/progs/egl/eglut/Makefile
@@ -0,0 +1,35 @@
+# progs/egl/eglut
+
+TOP = ../../..
+include $(TOP)/configs/current
+
+INCLUDES = \
+ -I$(TOP)/include
+
+SOURCES = $(wildcard *.c)
+
+EGLUT_X11_OBJECTS = eglut.o eglut_x11.o
+EGLUT_SCREEN_OBJECTS = eglut.o eglut_screen.o
+
+default: depend libeglut-x11.a libeglut-screen.a
+
+libeglut-x11.a: $(EGLUT_X11_OBJECTS)
+ $(MKLIB) -o eglut-x11 -static $(EGLUT_X11_OBJECTS)
+
+libeglut-screen.a: $(EGLUT_SCREEN_OBJECTS)
+ $(MKLIB) -o eglut-screen -static $(EGLUT_SCREEN_OBJECTS)
+
+.c.o:
+ $(CC) -c -o $@ $< $(INCLUDES) $(DEFINES) $(CFLAGS)
+
+depend: $(SOURCES)
+ @rm -f depend
+ @touch depend
+ @$(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(SOURCES) \
+ > /dev/null 2>/dev/null
+
+clean:
+ rm -f *.o *.a
+ rm -f depend depend.bak
+
+sinclude depend
diff --git a/progs/egl/eglut/eglut.c b/progs/egl/eglut/eglut.c
new file mode 100644
index 0000000000..0bfd5d5b06
--- /dev/null
+++ b/progs/egl/eglut/eglut.c
@@ -0,0 +1,326 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <sys/time.h>
+
+#include "EGL/egl.h"
+#include "EGL/eglext.h"
+
+#include "eglutint.h"
+
+static struct eglut_state _eglut_state = {
+ .api_mask = EGLUT_OPENGL_ES1_BIT,
+ .window_width = 300,
+ .window_height = 300,
+ .verbose = 0,
+ .num_windows = 0,
+};
+
+struct eglut_state *_eglut = &_eglut_state;
+
+void
+_eglutFatal(char *format, ...)
+{
+ va_list args;
+
+ va_start(args, format);
+
+ fprintf(stderr, "EGLUT: ");
+ vfprintf(stderr, format, args);
+ va_end(args);
+ putc('\n', stderr);
+
+ exit(1);
+}
+
+/* return current time (in milliseconds) */
+int
+_eglutNow(void)
+{
+ struct timeval tv;
+#ifdef __VMS
+ (void) gettimeofday(&tv, NULL );
+#else
+ struct timezone tz;
+ (void) gettimeofday(&tv, &tz);
+#endif
+ return tv.tv_sec * 1000 + tv.tv_usec / 1000;
+}
+
+static void
+_eglutDestroyWindow(struct eglut_window *win)
+{
+ if (_eglut->surface_type != EGL_PBUFFER_BIT &&
+ _eglut->surface_type != EGL_SCREEN_BIT_MESA)
+ eglDestroySurface(_eglut->dpy, win->surface);
+
+ _eglutNativeFiniWindow(win);
+
+ eglDestroyContext(_eglut->dpy, win->context);
+}
+
+static EGLConfig
+_eglutChooseConfig(void)
+{
+ EGLConfig config;
+ EGLint config_attribs[32];
+ EGLint renderable_type, num_configs, i;
+
+ i = 0;
+ config_attribs[i++] = EGL_RED_SIZE;
+ config_attribs[i++] = 1;
+ config_attribs[i++] = EGL_GREEN_SIZE;
+ config_attribs[i++] = 1;
+ config_attribs[i++] = EGL_BLUE_SIZE;
+ config_attribs[i++] = 1;
+ config_attribs[i++] = EGL_DEPTH_SIZE;
+ config_attribs[i++] = 1;
+
+ config_attribs[i++] = EGL_SURFACE_TYPE;
+ config_attribs[i++] = _eglut->surface_type;
+
+ config_attribs[i++] = EGL_RENDERABLE_TYPE;
+ renderable_type = 0x0;
+ if (_eglut->api_mask & EGLUT_OPENGL_BIT)
+ renderable_type |= EGL_OPENGL_BIT;
+ if (_eglut->api_mask & (EGLUT_OPENGL_ES1_BIT | EGLUT_OPENGL_ES2_BIT))
+ renderable_type |= EGL_OPENGL_ES_BIT;
+ if (_eglut->api_mask & EGLUT_OPENVG_BIT)
+ renderable_type |= EGL_OPENVG_BIT;
+ config_attribs[i++] = renderable_type;
+
+ config_attribs[i] = EGL_NONE;
+
+ if (!eglChooseConfig(_eglut->dpy,
+ config_attribs, &config, 1, &num_configs) || !num_configs)
+ _eglutFatal("failed to choose a config");
+
+ return config;
+}
+
+static struct eglut_window *
+_eglutCreateWindow(const char *title, int x, int y, int w, int h)
+{
+ struct eglut_window *win;
+ EGLint context_attribs[4];
+ EGLint api, i;
+
+ win = calloc(1, sizeof(*win));
+ if (!win)
+ _eglutFatal("failed to allocate window");
+
+ win->config = _eglutChooseConfig();
+
+ i = 0;
+ context_attribs[i] = EGL_NONE;
+
+ /* multiple APIs? */
+
+ api = EGL_OPENGL_ES_API;
+ if (_eglut->api_mask & EGLUT_OPENGL_BIT) {
+ api = EGL_OPENGL_API;
+ }
+ else if (_eglut->api_mask & EGLUT_OPENVG_BIT) {
+ api = EGL_OPENVG_API;
+ }
+ else if (_eglut->api_mask & EGLUT_OPENGL_ES2_BIT) {
+ context_attribs[i++] = EGL_CONTEXT_CLIENT_VERSION;
+ context_attribs[i++] = 2;
+ }
+
+ context_attribs[i] = EGL_NONE;
+
+ eglBindAPI(api);
+ win->context = eglCreateContext(_eglut->dpy,
+ win->config, EGL_NO_CONTEXT, context_attribs);
+ if (!win->context)
+ _eglutFatal("failed to create context");
+
+ _eglutNativeInitWindow(win, title, x, y, w, h);
+ switch (_eglut->surface_type) {
+ case EGL_WINDOW_BIT:
+ win->surface = eglCreateWindowSurface(_eglut->dpy,
+ win->config, win->native.u.window, NULL);
+ break;
+ case EGL_PIXMAP_BIT:
+ win->surface = eglCreatePixmapSurface(_eglut->dpy,
+ win->config, win->native.u.pixmap, NULL);
+ break;
+ case EGL_PBUFFER_BIT:
+ case EGL_SCREEN_BIT_MESA:
+ win->surface = win->native.u.surface;
+ break;
+ default:
+ break;
+ }
+ if (win->surface == EGL_NO_SURFACE)
+ _eglutFatal("failed to create surface");
+
+ return win;
+}
+
+void
+eglutInitAPIMask(int mask)
+{
+ _eglut->api_mask = mask;
+}
+
+void
+eglutInitWindowSize(int width, int height)
+{
+ _eglut->window_width = width;
+ _eglut->window_height = height;
+}
+
+void
+eglutInit(int argc, char **argv)
+{
+ int i;
+
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-display") == 0)
+ _eglut->display_name = argv[++i];
+ else if (strcmp(argv[i], "-info") == 0) {
+ _eglut->verbose = 1;
+ }
+ }
+
+ _eglutNativeInitDisplay();
+ _eglut->dpy = eglGetDisplay(_eglut->native_dpy);
+
+ if (!eglInitialize(_eglut->dpy, &_eglut->major, &_eglut->minor))
+ _eglutFatal("failed to initialize EGL display");
+
+ _eglut->init_time = _eglutNow();
+
+ printf("EGL_VERSION = %s\n", eglQueryString(_eglut->dpy, EGL_VERSION));
+}
+
+int
+eglutGet(int state)
+{
+ int val;
+
+ switch (state) {
+ case EGLUT_ELAPSED_TIME:
+ val = _eglutNow() - _eglut->init_time;
+ break;
+ default:
+ val = -1;
+ break;
+ }
+
+ return val;
+}
+
+void
+eglutIdleFunc(EGLUTidleCB func)
+{
+ _eglut->idle_cb = func;
+}
+
+void
+eglutPostRedisplay(void)
+{
+ _eglut->redisplay = 1;
+}
+
+void
+eglutMainLoop(void)
+{
+ struct eglut_window *win = _eglut->current;
+
+ if (!win)
+ _eglutFatal("no window is created\n");
+
+ if (win->reshape_cb)
+ win->reshape_cb(win->native.width, win->native.height);
+
+ _eglutNativeEventLoop();
+}
+
+static void
+_eglutFini(void)
+{
+ eglTerminate(_eglut->dpy);
+ _eglutNativeFiniDisplay();
+}
+
+static void
+_eglutDefaultKeyboard(unsigned char key)
+{
+ if (key == 27) {
+ /* XXX it causes some bug in st/egl KMS backend */
+ if ( _eglut->surface_type != EGL_SCREEN_BIT_MESA)
+ eglMakeCurrent(_eglut->dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+ _eglutDestroyWindow(_eglut->current);
+ _eglutFini();
+
+ exit(0);
+ }
+}
+
+int
+eglutCreateWindow(const char *title)
+{
+ struct eglut_window *win;
+
+ win = _eglutCreateWindow(title, 0, 0,
+ _eglut->window_width, _eglut->window_height);
+
+ win->index = _eglut->num_windows++;
+ win->reshape_cb = NULL;
+ win->display_cb = NULL;
+ win->keyboard_cb = _eglutDefaultKeyboard;
+ win->special_cb = NULL;
+
+ if (!eglMakeCurrent(_eglut->dpy, win->surface, win->surface, win->context))
+ _eglutFatal("failed to make window current");
+ _eglut->current = win;
+
+ return win->index;
+}
+
+int
+eglutGetWindowWidth(void)
+{
+ struct eglut_window *win = _eglut->current;
+ return win->native.width;
+}
+
+int
+eglutGetWindowHeight(void)
+{
+ struct eglut_window *win = _eglut->current;
+ return win->native.height;
+}
+
+void
+eglutDisplayFunc(EGLUTdisplayCB func)
+{
+ struct eglut_window *win = _eglut->current;
+ win->display_cb = func;
+
+}
+
+void
+eglutReshapeFunc(EGLUTreshapeCB func)
+{
+ struct eglut_window *win = _eglut->current;
+ win->reshape_cb = func;
+}
+
+void
+eglutKeyboardFunc(EGLUTkeyboardCB func)
+{
+ struct eglut_window *win = _eglut->current;
+ win->keyboard_cb = func;
+}
+
+void
+eglutSpecialFunc(EGLUTspecialCB func)
+{
+ struct eglut_window *win = _eglut->current;
+ win->special_cb = func;
+}
diff --git a/progs/egl/eglut/eglut.h b/progs/egl/eglut/eglut.h
new file mode 100644
index 0000000000..521cc12eab
--- /dev/null
+++ b/progs/egl/eglut/eglut.h
@@ -0,0 +1,67 @@
+#ifndef EGLUT_H
+#define EGLUT_H
+
+/* used by eglutInitAPIMask */
+enum {
+ EGLUT_OPENGL_BIT = 0x1,
+ EGLUT_OPENGL_ES1_BIT = 0x2,
+ EGLUT_OPENGL_ES2_BIT = 0x4,
+ EGLUT_OPENVG_BIT = 0x8
+};
+
+/* used by EGLUTspecialCB */
+enum {
+ /* function keys */
+ EGLUT_KEY_F1,
+ EGLUT_KEY_F2,
+ EGLUT_KEY_F3,
+ EGLUT_KEY_F4,
+ EGLUT_KEY_F5,
+ EGLUT_KEY_F6,
+ EGLUT_KEY_F7,
+ EGLUT_KEY_F8,
+ EGLUT_KEY_F9,
+ EGLUT_KEY_F10,
+ EGLUT_KEY_F11,
+ EGLUT_KEY_F12,
+
+ /* directional keys */
+ EGLUT_KEY_LEFT,
+ EGLUT_KEY_UP,
+ EGLUT_KEY_RIGHT,
+ EGLUT_KEY_DOWN,
+};
+
+/* used by eglutGet */
+enum {
+ EGLUT_ELAPSED_TIME
+};
+
+typedef void (*EGLUTidleCB)(void);
+typedef void (*EGLUTreshapeCB)(int, int);
+typedef void (*EGLUTdisplayCB)(void);
+typedef void (*EGLUTkeyboardCB)(unsigned char);
+typedef void (*EGLUTspecialCB)(int);
+
+void eglutInitAPIMask(int mask);
+void eglutInitWindowSize(int width, int height);
+void eglutInit(int argc, char **argv);
+
+int eglutGet(int state);
+
+void eglutIdleFunc(EGLUTidleCB func);
+void eglutPostRedisplay(void);
+
+void eglutMainLoop(void);
+
+int eglutCreateWindow(const char *title);
+
+int eglutGetWindowWidth(void);
+int eglutGetWindowHeight(void);
+
+void eglutDisplayFunc(EGLUTdisplayCB func);
+void eglutReshapeFunc(EGLUTreshapeCB func);
+void eglutKeyboardFunc(EGLUTkeyboardCB func);
+void eglutSpecialFunc(EGLUTspecialCB func);
+
+#endif /* EGLUT_H */
diff --git a/progs/egl/eglut/eglut_screen.c b/progs/egl/eglut/eglut_screen.c
new file mode 100644
index 0000000000..50549e4bcf
--- /dev/null
+++ b/progs/egl/eglut/eglut_screen.c
@@ -0,0 +1,154 @@
+#include <stdio.h>
+#include <string.h>
+#include <sys/time.h>
+
+#define EGL_EGLEXT_PROTOTYPES
+#include "EGL/egl.h"
+#include "EGL/eglext.h"
+
+#include "eglutint.h"
+
+#define MAX_MODES 100
+
+static EGLScreenMESA kms_screen;
+static EGLModeMESA kms_mode;
+static EGLint kms_width, kms_height;
+
+void
+_eglutNativeInitDisplay(void)
+{
+ _eglut->native_dpy = EGL_DEFAULT_DISPLAY;
+ _eglut->surface_type = EGL_SCREEN_BIT_MESA;
+}
+
+void
+_eglutNativeFiniDisplay(void)
+{
+ kms_screen = 0;
+ kms_mode = 0;
+ kms_width = 0;
+ kms_height = 0;
+}
+
+static void
+init_kms(void)
+{
+ EGLModeMESA modes[MAX_MODES];
+ EGLint num_screens, num_modes;
+ EGLint width, height, best_mode;
+ EGLint i;
+
+ if (!eglGetScreensMESA(_eglut->dpy, &kms_screen, 1, &num_screens) ||
+ !num_screens)
+ _eglutFatal("eglGetScreensMESA failed\n");
+
+ if (!eglGetModesMESA(_eglut->dpy, kms_screen,
+ modes, MAX_MODES, &num_modes) || !num_modes)
+ _eglutFatal("eglGetModesMESA failed!\n");
+
+ printf("Found %d modes:\n", num_modes);
+
+ best_mode = 0;
+ width = 0;
+ height = 0;
+ for (i = 0; i < num_modes; i++) {
+ EGLint w, h;
+ eglGetModeAttribMESA(_eglut->dpy, modes[i], EGL_WIDTH, &w);
+ eglGetModeAttribMESA(_eglut->dpy, modes[i], EGL_HEIGHT, &h);
+ printf("%3d: %d x %d\n", i, w, h);
+ if (w > width && h > height) {
+ width = w;
+ height = h;
+ best_mode = i;
+ }
+ }
+
+ printf("Will use screen size: %d x %d\n", width, height);
+
+ kms_mode = modes[best_mode];
+ kms_width = width;
+ kms_height = height;
+}
+
+void
+_eglutNativeInitWindow(struct eglut_window *win, const char *title,
+ int x, int y, int w, int h)
+{
+ EGLint surf_attribs[16];
+ EGLint i;
+ const char *exts;
+
+ exts = eglQueryString(_eglut->dpy, EGL_EXTENSIONS);
+ if (!exts || !strstr(exts, "EGL_MESA_screen_surface"))
+ _eglutFatal("EGL_MESA_screen_surface is not supported\n");
+
+ init_kms();
+
+ i = 0;
+ surf_attribs[i++] = EGL_WIDTH;
+ surf_attribs[i++] = kms_width;
+ surf_attribs[i++] = EGL_HEIGHT;
+ surf_attribs[i++] = kms_height;
+ surf_attribs[i++] = EGL_NONE;
+
+ /* create surface */
+ win->native.u.surface = eglCreateScreenSurfaceMESA(_eglut->dpy,
+ win->config, surf_attribs);
+ if (win->native.u.surface == EGL_NO_SURFACE)
+ _eglutFatal("eglCreateScreenSurfaceMESA failed\n");
+
+ if (!eglShowScreenSurfaceMESA(_eglut->dpy, kms_screen,
+ win->native.u.surface, kms_mode))
+ _eglutFatal("eglShowScreenSurfaceMESA failed\n");
+
+ win->native.width = kms_width;
+ win->native.height = kms_height;
+}
+
+void
+_eglutNativeFiniWindow(struct eglut_window *win)
+{
+ eglShowScreenSurfaceMESA(_eglut->dpy,
+ kms_screen, EGL_NO_SURFACE, 0);
+ eglDestroySurface(_eglut->dpy, win->native.u.surface);
+}
+
+void
+_eglutNativeEventLoop(void)
+{
+ int start = _eglutNow();
+ int frames = 0;
+
+ _eglut->redisplay = 1;
+
+ while (1) {
+ struct eglut_window *win = _eglut->current;
+ int now = _eglutNow();
+
+ if (now - start > 5000) {
+ double elapsed = (double) (now - start) / 1000.0;
+
+ printf("%d frames in %3.1f seconds = %6.3f FPS\n",
+ frames, elapsed, frames / elapsed);
+
+ start = now;
+ frames = 0;
+
+ /* send escape */
+ if (win->keyboard_cb)
+ win->keyboard_cb(27);
+ }
+
+ if (_eglut->idle_cb)
+ _eglut->idle_cb();
+
+ if (_eglut->redisplay) {
+ _eglut->redisplay = 0;
+
+ if (win->display_cb)
+ win->display_cb();
+ eglSwapBuffers(_eglut->dpy, win->surface);
+ frames++;
+ }
+ }
+}
diff --git a/progs/egl/eglut/eglut_x11.c b/progs/egl/eglut/eglut_x11.c
new file mode 100644
index 0000000000..f3b2280374
--- /dev/null
+++ b/progs/egl/eglut/eglut_x11.c
@@ -0,0 +1,220 @@
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/keysym.h>
+
+#include "eglutint.h"
+
+void
+_eglutNativeInitDisplay(void)
+{
+ _eglut->native_dpy = XOpenDisplay(_eglut->display_name);
+ if (!_eglut->native_dpy)
+ _eglutFatal("failed to initialize native display");
+
+ _eglut->surface_type = EGL_WINDOW_BIT;
+}
+
+void
+_eglutNativeFiniDisplay(void)
+{
+ XCloseDisplay(_eglut->native_dpy);
+}
+
+void
+_eglutNativeInitWindow(struct eglut_window *win, const char *title,
+ int x, int y, int w, int h)
+{
+ XVisualInfo *visInfo, visTemplate;
+ int num_visuals;
+ Window root, xwin;
+ XSetWindowAttributes attr;
+ unsigned long mask;
+ EGLint vid;
+
+ if (!eglGetConfigAttrib(_eglut->dpy,
+ win->config, EGL_NATIVE_VISUAL_ID, &vid))
+ _eglutFatal("failed to get visual id");
+
+ /* The X window visual must match the EGL config */
+ visTemplate.visualid = vid;
+ visInfo = XGetVisualInfo(_eglut->native_dpy,
+ VisualIDMask, &visTemplate, &num_visuals);
+ if (!visInfo)
+ _eglutFatal("failed to get an visual of id 0x%x", vid);
+
+ root = RootWindow(_eglut->native_dpy, DefaultScreen(_eglut->native_dpy));
+
+ /* window attributes */
+ attr.background_pixel = 0;
+ attr.border_pixel = 0;
+ attr.colormap = XCreateColormap(_eglut->native_dpy,
+ root, visInfo->visual, AllocNone);
+ attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
+ mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
+
+ xwin = XCreateWindow(_eglut->native_dpy, root, x, y, w, h,
+ 0, visInfo->depth, InputOutput, visInfo->visual, mask, &attr);
+ if (!xwin)
+ _eglutFatal("failed to create a window");
+
+ XFree(visInfo);
+
+ /* set hints and properties */
+ {
+ XSizeHints sizehints;
+ sizehints.x = x;
+ sizehints.y = y;
+ sizehints.width = w;
+ sizehints.height = h;
+ sizehints.flags = USSize | USPosition;
+ XSetNormalHints(_eglut->native_dpy, xwin, &sizehints);
+ XSetStandardProperties(_eglut->native_dpy, xwin,
+ title, title, None, (char **) NULL, 0, &sizehints);
+ }
+
+ XMapWindow(_eglut->native_dpy, xwin);
+
+ win->native.u.window = xwin;
+ win->native.width = w;
+ win->native.height = h;
+}
+
+void
+_eglutNativeFiniWindow(struct eglut_window *win)
+{
+ XDestroyWindow(_eglut->native_dpy, win->native.u.window);
+}
+
+static int
+lookup_keysym(KeySym sym)
+{
+ int special;
+
+ switch (sym) {
+ case XK_F1:
+ special = EGLUT_KEY_F1;
+ break;
+ case XK_F2:
+ special = EGLUT_KEY_F2;
+ break;
+ case XK_F3:
+ special = EGLUT_KEY_F3;
+ break;
+ case XK_F4:
+ special = EGLUT_KEY_F4;
+ break;
+ case XK_F5:
+ special = EGLUT_KEY_F5;
+ break;
+ case XK_F6:
+ special = EGLUT_KEY_F6;
+ break;
+ case XK_F7:
+ special = EGLUT_KEY_F7;
+ break;
+ case XK_F8:
+ special = EGLUT_KEY_F8;
+ break;
+ case XK_F9:
+ special = EGLUT_KEY_F9;
+ break;
+ case XK_F10:
+ special = EGLUT_KEY_F10;
+ break;
+ case XK_F11:
+ special = EGLUT_KEY_F11;
+ break;
+ case XK_F12:
+ special = EGLUT_KEY_F12;
+ break;
+ case XK_KP_Left:
+ case XK_Left:
+ special = EGLUT_KEY_LEFT;
+ break;
+ case XK_KP_Up:
+ case XK_Up:
+ special = EGLUT_KEY_UP;
+ break;
+ case XK_KP_Right:
+ case XK_Right:
+ special = EGLUT_KEY_RIGHT;
+ break;
+ case XK_KP_Down:
+ case XK_Down:
+ special = EGLUT_KEY_DOWN;
+ break;
+ default:
+ special = -1;
+ break;
+ }
+
+ return special;
+}
+
+static void
+next_event(struct eglut_window *win)
+{
+ int redraw = 0;
+ XEvent event;
+
+ if (!XPending(_eglut->native_dpy)) {
+ if (_eglut->idle_cb)
+ _eglut->idle_cb();
+ return;
+ }
+
+ XNextEvent(_eglut->native_dpy, &event);
+
+ switch (event.type) {
+ case Expose:
+ redraw = 1;
+ break;
+ case ConfigureNotify:
+ win->native.width = event.xconfigure.width;
+ win->native.height = event.xconfigure.height;
+ if (win->reshape_cb)
+ win->reshape_cb(win->native.width, win->native.height);
+ break;
+ case KeyPress:
+ {
+ char buffer[1];
+ KeySym sym;
+ int r;
+
+ r = XLookupString(&event.xkey,
+ buffer, sizeof(buffer), &sym, NULL);
+ if (r && win->keyboard_cb) {
+ win->keyboard_cb(buffer[0]);
+ }
+ else if (!r && win->special_cb) {
+ r = lookup_keysym(sym);
+ if (r >= 0)
+ win->special_cb(r);
+ }
+ }
+ redraw = 1;
+ break;
+ default:
+ ; /*no-op*/
+ }
+
+ _eglut->redisplay = redraw;
+}
+
+void
+_eglutNativeEventLoop(void)
+{
+ while (1) {
+ struct eglut_window *win = _eglut->current;
+
+ next_event(win);
+
+ if (_eglut->redisplay) {
+ _eglut->redisplay = 0;
+
+ if (win->display_cb)
+ win->display_cb();
+ eglSwapBuffers(_eglut->dpy, win->surface);
+ }
+ }
+}
diff --git a/progs/egl/eglut/eglutint.h b/progs/egl/eglut/eglutint.h
new file mode 100644
index 0000000000..54d329f328
--- /dev/null
+++ b/progs/egl/eglut/eglutint.h
@@ -0,0 +1,78 @@
+#ifndef _EGLUTINT_H_
+#define _EGLUTINT_H_
+
+#include "EGL/egl.h"
+#include "eglut.h"
+
+struct eglut_window {
+ EGLConfig config;
+ EGLContext context;
+
+ /* initialized by native display */
+ struct {
+ union {
+ EGLNativeWindowType window;
+ EGLNativePixmapType pixmap;
+ EGLSurface surface; /* pbuffer or screen surface */
+ } u;
+ int width, height;
+ } native;
+
+ EGLSurface surface;
+
+ int index;
+
+ EGLUTreshapeCB reshape_cb;
+ EGLUTdisplayCB display_cb;
+ EGLUTkeyboardCB keyboard_cb;
+ EGLUTspecialCB special_cb;
+};
+
+struct eglut_state {
+ int api_mask;
+ int window_width, window_height;
+ const char *display_name;
+ int verbose;
+ int init_time;
+
+ EGLUTidleCB idle_cb;
+
+ int num_windows;
+
+ /* initialized by native display */
+ EGLNativeDisplayType native_dpy;
+ EGLint surface_type;
+
+ EGLDisplay dpy;
+ EGLint major, minor;
+
+ struct eglut_window *current;
+
+ int redisplay;
+};
+
+extern struct eglut_state *_eglut;
+
+void
+_eglutFatal(char *format, ...);
+
+int
+_eglutNow(void);
+
+void
+_eglutNativeInitDisplay(void);
+
+void
+_eglutNativeFiniDisplay(void);
+
+void
+_eglutNativeInitWindow(struct eglut_window *win, const char *title,
+ int x, int y, int w, int h);
+
+void
+_eglutNativeFiniWindow(struct eglut_window *win);
+
+void
+_eglutNativeEventLoop(void);
+
+#endif /* _EGLUTINT_H_ */
diff --git a/progs/egl/.gitignore b/progs/egl/opengl/.gitignore
index 7a13d4686a..49c3a511f3 100644
--- a/progs/egl/.gitignore
+++ b/progs/egl/opengl/.gitignore
@@ -1,12 +1,13 @@
demo1
demo2
demo3
-eglgears
+eglgears_x11
+eglgears_screen
eglinfo
eglscreen
-egltri
+egltri_x11
+egltri_screen
peglgears
xeglbindtex
xeglgears
xeglthreads
-xegl_tri
diff --git a/progs/egl/opengl/Makefile b/progs/egl/opengl/Makefile
new file mode 100644
index 0000000000..9a91df9906
--- /dev/null
+++ b/progs/egl/opengl/Makefile
@@ -0,0 +1,83 @@
+# progs/egl/Makefile
+
+TOP = ../../..
+include $(TOP)/configs/current
+
+
+INCLUDE_DIRS = -I$(TOP)/include
+
+HEADERS = $(TOP)/include/GLES/egl.h
+LIB_DEP = $(TOP)/$(LIB_DIR)/libEGL.so
+
+LIBS = -L$(TOP)/$(LIB_DIR) -lEGL -lGL -lm
+
+EGLUT_DIR = $(TOP)/progs/egl/eglut
+
+EGLUT_DEMOS = \
+ eglgears \
+ egltri
+
+EGLUT_X11_DEMOS := $(addsuffix _x11,$(EGLUT_DEMOS))
+EGLUT_SCREEN_DEMOS := $(addsuffix _screen,$(EGLUT_DEMOS))
+
+PROGRAMS = \
+ demo1 \
+ demo2 \
+ demo3 \
+ eglinfo \
+ eglscreen \
+ peglgears \
+ xeglgears \
+ xeglthreads
+
+
+.c.o:
+ $(CC) -c $(INCLUDE_DIRS) -I$(EGLUT_DIR) $(CFLAGS) $< -o $@
+
+
+
+default: $(PROGRAMS) $(EGLUT_X11_DEMOS) $(EGLUT_SCREEN_DEMOS)
+
+demo1: demo1.o $(HEADERS) $(LIB_DEP)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB)
+
+demo2: demo2.o $(HEADERS) $(LIB_DEP)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB)
+
+demo3: demo3.o $(HEADERS) $(LIB_DEP)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB)
+
+eglinfo: eglinfo.o $(HEADERS) $(LIB_DEP)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS)
+
+eglscreen: eglscreen.o $(HEADERS) $(LIB_DEP)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB)
+
+peglgears: peglgears.o $(HEADERS) $(LIB_DEP)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB) -lm
+
+xeglgears: xeglgears.o $(HEADERS) $(LIB_DEP)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) -lm $(X11_LIBS)
+
+xeglthreads: xeglthreads.o $(HEADERS) $(LIB_DEP)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) -lpthread -lm $(X11_LIBS)
+
+$(EGLUT_DIR)/libeglut-x11.a $(EGLUT_DIR)/libeglut-screen.a:
+ @$(MAKE) -C $(EGLUT_DIR)
+
+# define the rules for EGLUT demos
+define eglut-demo-rule
+$(1)_x11 $(1)_screen: $(1)_%: $(1).o $(EGLUT_DIR)/libeglut-%.a $(LIB_DEP)
+endef
+$(foreach demo, $(EGLUT_DEMOS), $(eval $(call eglut-demo-rule,$(demo))))
+
+# build EGLUT demos
+$(EGLUT_X11_DEMOS):
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -L$(EGLUT_DIR) -leglut-$* $(LIBS) -lX11
+$(EGLUT_SCREEN_DEMOS):
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -L$(EGLUT_DIR) -leglut-$* $(LIBS)
+
+clean:
+ -rm -f *.o *~
+ -rm -f $(PROGRAMS) $(EGLUT_X11_DEMOS) $(EGLUT_SCREEN_DEMOS)
+ @$(MAKE) -C $(EGLUT_DIR) clean
diff --git a/progs/egl/demo1.c b/progs/egl/opengl/demo1.c
index d892734ee5..d892734ee5 100644
--- a/progs/egl/demo1.c
+++ b/progs/egl/opengl/demo1.c
diff --git a/progs/egl/demo2.c b/progs/egl/opengl/demo2.c
index b9e92f62ac..b9e92f62ac 100644
--- a/progs/egl/demo2.c
+++ b/progs/egl/opengl/demo2.c
diff --git a/progs/egl/demo3.c b/progs/egl/opengl/demo3.c
index 64b9ee652c..64b9ee652c 100644
--- a/progs/egl/demo3.c
+++ b/progs/egl/opengl/demo3.c
diff --git a/progs/egl/eglgears.c b/progs/egl/opengl/eglgears.c
index 63490953ae..28da9c0ac7 100644
--- a/progs/egl/eglgears.c
+++ b/progs/egl/opengl/eglgears.c
@@ -27,78 +27,16 @@
* Program runs for 5 seconds then exits, outputing framerate to console
*/
-#define EGL_EGLEXT_PROTOTYPES
-
-#include <assert.h>
#include <math.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
#include <GL/gl.h>
#include <EGL/egl.h>
-#include <EGL/eglext.h>
-
-#define MAX_CONFIGS 10
-#define MAX_MODES 100
-
-#define BENCHMARK
-
-#ifdef BENCHMARK
-
-/* XXX this probably isn't very portable */
-
-#include <sys/time.h>
-#include <unistd.h>
-
-/* return current time (in seconds) */
-static double
-current_time(void)
-{
- struct timeval tv;
-#ifdef __VMS
- (void) gettimeofday(&tv, NULL );
-#else
- struct timezone tz;
- (void) gettimeofday(&tv, &tz);
-#endif
- return (double) tv.tv_sec + tv.tv_usec / 1000000.0;
-}
-
-#else /*BENCHMARK*/
-
-/* dummy */
-static double
-current_time(void)
-{
- /* update this function for other platforms! */
- static double t = 0.0;
- static int warn = 1;
- if (warn) {
- fprintf(stderr, "Warning: current_time() not implemented!!\n");
- warn = 0;
- }
- return t += 1.0;
-}
-
-#endif /*BENCHMARK*/
-
-
-#ifndef M_PI
-#define M_PI 3.14159265
-#endif
+#include "eglut.h"
static GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0;
static GLint gear1, gear2, gear3;
static GLfloat angle = 0.0;
-#if 0
-static GLfloat eyesep = 5.0; /* Eye separation. */
-static GLfloat fix_point = 40.0; /* Fixation point distance. */
-static GLfloat left, right, asp; /* Stereo frustum params. */
-#endif
-
-
/*
*
* Draw a gear wheel. You'll probably want to call this function when
@@ -270,6 +208,22 @@ draw(void)
}
+static void
+idle(void)
+{
+ static double t0 = -1.;
+ double dt, t = eglutGet(EGLUT_ELAPSED_TIME) / 1000.0;
+ if (t0 < 0.0)
+ t0 = t;
+ dt = t - t0;
+ t0 = t;
+
+ angle += 70.0 * dt; /* 70 degrees per second */
+ angle = fmod(angle, 360.0); /* prevents eventual overflow */
+
+ eglutPostRedisplay();
+}
+
/* new window size or exposure */
static void
reshape(int width, int height)
@@ -325,158 +279,23 @@ init(void)
glEnable(GL_NORMALIZE);
}
-
-
-
-static void run_gears(EGLDisplay dpy, EGLSurface surf, int ttr)
-{
- double st = current_time();
- double ct = st;
- int frames = 0;
- GLfloat seconds, fps;
-
- while (ct - st < ttr)
- {
- double tt = current_time();
- double dt = tt - ct;
- ct = tt;
-
- /* advance rotation for next frame */
- angle += 70.0 * dt; /* 70 degrees per second */
- if (angle > 3600.0)
- angle -= 3600.0;
-
- draw();
-
- eglSwapBuffers(dpy, surf);
-
-
- frames++;
- }
-
- seconds = ct - st;
- fps = frames / seconds;
- printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds, fps);
-
-}
-
-
int
main(int argc, char *argv[])
{
- int maj, min;
- EGLContext ctx;
- EGLSurface screen_surf;
- EGLConfig configs[MAX_CONFIGS];
- EGLint numConfigs, i;
- EGLBoolean b;
- EGLDisplay d;
- EGLint screenAttribs[10];
- EGLModeMESA mode[MAX_MODES];
- EGLScreenMESA screen;
- EGLint count;
- EGLint chosenMode = 0;
- GLboolean printInfo = GL_FALSE;
- EGLint width = 0, height = 0;
-
- /* parse cmd line args */
- for (i = 1; i < argc; i++)
- {
- if (strcmp(argv[i], "-info") == 0)
- {
- printInfo = GL_TRUE;
- }
- else
- printf("Warning: unknown parameter: %s\n", argv[i]);
- }
-
- /* DBR : Create EGL context/surface etc */
- d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- assert(d);
-
- if (!eglInitialize(d, &maj, &min)) {
- printf("eglgears: eglInitialize failed\n");
- exit(1);
- }
-
- printf("eglgears: EGL version = %d.%d\n", maj, min);
- printf("eglgears: EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR));
-
- /* XXX use ChooseConfig */
- eglGetConfigs(d, configs, MAX_CONFIGS, &numConfigs);
- eglGetScreensMESA(d, &screen, 1, &count);
-
- if (!eglGetModesMESA(d, screen, mode, MAX_MODES, &count) || count == 0) {
- printf("eglgears: eglGetModesMESA failed!\n");
- return 0;
- }
-
- /* Print list of modes, and find the one to use */
- printf("eglgears: Found %d modes:\n", count);
- for (i = 0; i < count; i++) {
- EGLint w, h;
- eglGetModeAttribMESA(d, mode[i], EGL_WIDTH, &w);
- eglGetModeAttribMESA(d, mode[i], EGL_HEIGHT, &h);
- printf("%3d: %d x %d\n", i, w, h);
- if (w > width && h > height) {
- width = w;
- height = h;
- chosenMode = i;
- }
- }
- printf("eglgears: Using screen mode/size %d: %d x %d\n", chosenMode, width, height);
-
- eglBindAPI(EGL_OPENGL_API);
- ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL);
- if (ctx == EGL_NO_CONTEXT) {
- printf("eglgears: failed to create context\n");
- return 0;
- }
-
- /* build up screenAttribs array */
- i = 0;
- screenAttribs[i++] = EGL_WIDTH;
- screenAttribs[i++] = width;
- screenAttribs[i++] = EGL_HEIGHT;
- screenAttribs[i++] = height;
- screenAttribs[i++] = EGL_NONE;
-
- screen_surf = eglCreateScreenSurfaceMESA(d, configs[0], screenAttribs);
- if (screen_surf == EGL_NO_SURFACE) {
- printf("eglgears: failed to create screen surface\n");
- return 0;
- }
-
- b = eglShowScreenSurfaceMESA(d, screen, screen_surf, mode[chosenMode]);
- if (!b) {
- printf("eglgears: show surface failed\n");
- return 0;
- }
-
- b = eglMakeCurrent(d, screen_surf, screen_surf, ctx);
- if (!b) {
- printf("eglgears: make current failed\n");
- return 0;
- }
-
- if (printInfo)
- {
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
- printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
- printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
- printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
- }
-
- init();
- reshape(width, height);
+ eglutInitWindowSize(300, 300);
+ eglutInitAPIMask(EGLUT_OPENGL_BIT);
+ eglutInit(argc, argv);
- glDrawBuffer( GL_BACK );
+ eglutCreateWindow("eglgears");
- run_gears(d, screen_surf, 5.0);
-
- eglDestroySurface(d, screen_surf);
- eglDestroyContext(d, ctx);
- eglTerminate(d);
+ eglutIdleFunc(idle);
+ eglutReshapeFunc(reshape);
+ eglutDisplayFunc(draw);
+
+ init();
+ glDrawBuffer(GL_BACK);
- return 0;
+ eglutMainLoop();
+
+ return 0;
}
diff --git a/progs/egl/eglinfo.c b/progs/egl/opengl/eglinfo.c
index 961fd9ccc7..961fd9ccc7 100644
--- a/progs/egl/eglinfo.c
+++ b/progs/egl/opengl/eglinfo.c
diff --git a/progs/egl/eglscreen.c b/progs/egl/opengl/eglscreen.c
index 520f76ea03..520f76ea03 100644
--- a/progs/egl/eglscreen.c
+++ b/progs/egl/opengl/eglscreen.c
diff --git a/progs/es1/screen/tri.c b/progs/egl/opengl/egltri.c
index bab9499944..fb1dde3529 100644
--- a/progs/es1/screen/tri.c
+++ b/progs/egl/opengl/egltri.c
@@ -1,21 +1,16 @@
/*
- * Copyright (C) 2009 Chia-I Wu <olv@0xlab.org>
- *
- * Based on egltri by
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
* Copyright (C) 2008 Brian Paul All Rights Reserved.
- * Copyright (C) 2008 Jakob Bornecrantz All Rights Reserved.
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
@@ -24,45 +19,36 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <GLES/gl.h>
-#include "winsys.h"
+/*
+ * Draw a triangle with X/EGL.
+ * Brian Paul
+ * 3 June 2008
+ */
-static GLfloat view_rotx = 0.0, view_roty = 0.0, view_rotz = 0.0;
-static void tri_init()
-{
- glClearColor(0.4, 0.4, 0.4, 0.0);
-}
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+#include <GL/gl.h>
-static void tri_reshape(int width, int height)
-{
- GLfloat ar = (GLfloat) width / (GLfloat) height;
+#include "eglut.h"
- glViewport(0, 0, (GLint) width, (GLint) height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustumf(-ar, ar, -1, 1, 5.0, 60.0);
+static GLfloat view_rotx = 0.0, view_roty = 0.0, view_rotz = 0.0;
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef(0.0, 0.0, -10.0);
-}
-static void tri_draw(void *data)
+static void
+draw(void)
{
static const GLfloat verts[3][2] = {
{ -1, -1 },
{ 1, -1 },
{ 0, 1 }
};
- static const GLfloat colors[3][4] = {
- { 1, 0, 0, 1 },
- { 0, 1, 0, 1 },
- { 0, 0, 1, 1 }
+ static const GLfloat colors[3][3] = {
+ { 1, 0, 0 },
+ { 0, 1, 0 },
+ { 0, 0, 1 }
};
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -74,7 +60,7 @@ static void tri_draw(void *data)
{
glVertexPointer(2, GL_FLOAT, 0, verts);
- glColorPointer(4, GL_FLOAT, 0, colors);
+ glColorPointer(3, GL_FLOAT, 0, colors);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
@@ -87,43 +73,69 @@ static void tri_draw(void *data)
glPopMatrix();
}
-static void tri_run(void)
+
+/* new window size or exposure */
+static void
+reshape(int width, int height)
+{
+ GLfloat ar = (GLfloat) width / (GLfloat) height;
+
+ glViewport(0, 0, (GLint) width, (GLint) height);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glFrustum(-ar, ar, -1, 1, 5.0, 60.0);
+
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ glTranslatef(0.0, 0.0, -10.0);
+}
+
+
+static void
+init(void)
{
- winsysRun(3.0, tri_draw, NULL);
+ glClearColor(0.4, 0.4, 0.4, 0.0);
}
-int main(int argc, char *argv[])
+
+static void
+special_key(int special)
{
- EGLint width, height;
- GLboolean printInfo = GL_FALSE;
- int i;
-
- /* parse cmd line args */
- for (i = 1; i < argc; i++) {
- if (strcmp(argv[i], "-info") == 0) {
- printInfo = GL_TRUE;
- }
- else {
- printf("Warning: unknown parameter: %s\n", argv[i]);
- }
+ switch (special) {
+ case EGLUT_KEY_LEFT:
+ view_roty += 5.0;
+ break;
+ case EGLUT_KEY_RIGHT:
+ view_roty -= 5.0;
+ break;
+ case EGLUT_KEY_UP:
+ view_rotx += 5.0;
+ break;
+ case EGLUT_KEY_DOWN:
+ view_rotx -= 5.0;
+ break;
+ default:
+ break;
}
+}
- if (!winsysInitScreen())
- exit(1);
- winsysQueryScreenSize(&width, &height);
+int
+main(int argc, char *argv[])
+{
+ eglutInitWindowSize(300, 300);
+ eglutInitAPIMask(EGLUT_OPENGL_BIT);
+ eglutInit(argc, argv);
- if (printInfo) {
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
- printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
- printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
- printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
- }
+ eglutCreateWindow("egltri");
+
+ eglutReshapeFunc(reshape);
+ eglutDisplayFunc(draw);
+ eglutSpecialFunc(special_key);
- tri_init();
- tri_reshape(width, height);
- tri_run();
+ init();
- winsysFiniScreen();
+ eglutMainLoop();
return 0;
}
diff --git a/progs/egl/peglgears.c b/progs/egl/opengl/peglgears.c
index 212d1acf69..212d1acf69 100644
--- a/progs/egl/peglgears.c
+++ b/progs/egl/opengl/peglgears.c
diff --git a/progs/egl/xeglgears.c b/progs/egl/opengl/xeglgears.c
index a6a977d9ff..a6a977d9ff 100644
--- a/progs/egl/xeglgears.c
+++ b/progs/egl/opengl/xeglgears.c
diff --git a/progs/egl/xeglthreads.c b/progs/egl/opengl/xeglthreads.c
index 5787faecb9..5787faecb9 100644
--- a/progs/egl/xeglthreads.c
+++ b/progs/egl/opengl/xeglthreads.c
diff --git a/progs/egl/opengles1/.gitignore b/progs/egl/opengles1/.gitignore
new file mode 100644
index 0000000000..2caf094edb
--- /dev/null
+++ b/progs/egl/opengles1/.gitignore
@@ -0,0 +1,12 @@
+bindtex
+drawtex
+es1_info
+gears_x11
+gears_screen
+msaa
+pbuffer
+render_tex
+torus
+tri_x11
+tri_screen
+two_win
diff --git a/progs/egl/opengles1/Makefile b/progs/egl/opengles1/Makefile
new file mode 100644
index 0000000000..dac911e39f
--- /dev/null
+++ b/progs/egl/opengles1/Makefile
@@ -0,0 +1,106 @@
+# progs/egl/opengles1/Makefile
+
+TOP = ../../..
+include $(TOP)/configs/current
+
+
+INCLUDE_DIRS = \
+ -I$(TOP)/include \
+
+HEADERS = $(TOP)/include/GLES/egl.h
+
+
+ES1_LIB_DEPS = \
+ $(TOP)/$(LIB_DIR)/libEGL.so \
+ $(TOP)/$(LIB_DIR)/libGLESv1_CM.so
+
+
+ES1_LIBS = \
+ -L$(TOP)/$(LIB_DIR) -lEGL \
+ -L$(TOP)/$(LIB_DIR) -lGLESv1_CM $(LIBDRM_LIB) -lX11
+
+EGLUT_DIR = $(TOP)/progs/egl/eglut
+
+EGLUT_DEMOS = \
+ gears \
+ tri
+
+EGLUT_X11_DEMOS := $(addsuffix _x11,$(EGLUT_DEMOS))
+EGLUT_SCREEN_DEMOS := $(addsuffix _screen,$(EGLUT_DEMOS))
+
+PROGRAMS = \
+ bindtex \
+ drawtex \
+ es1_info \
+ msaa \
+ pbuffer \
+ render_tex \
+ texture_from_pixmap \
+ torus \
+ two_win
+
+
+.c.o:
+ $(CC) -c $(INCLUDE_DIRS) -I$(EGLUT_DIR) $(CFLAGS) $< -o $@
+
+
+
+default: $(PROGRAMS) $(EGLUT_X11_DEMOS) $(EGLUT_SCREEN_DEMOS)
+
+
+
+bindtex: bindtex.o $(ES1_LIB_DEPS)
+ $(CC) $(CFLAGS) bindtex.o $(ES1_LIBS) -o $@
+
+
+drawtex: drawtex.o $(ES1_LIB_DEPS)
+ $(CC) $(CFLAGS) drawtex.o $(ES1_LIBS) -o $@
+
+
+es1_info: es1_info.o $(ES1_LIB_DEPS)
+ $(CC) $(CFLAGS) es1_info.o $(ES1_LIBS) -o $@
+
+
+msaa: msaa.o $(ES1_LIB_DEPS)
+ $(CC) $(CFLAGS) msaa.o $(ES1_LIBS) -o $@
+
+
+pbuffer: pbuffer.o $(ES1_LIB_DEPS)
+ $(CC) $(CFLAGS) pbuffer.o $(ES1_LIBS) -o $@
+
+
+render_tex: render_tex.o $(ES1_LIB_DEPS)
+ $(CC) $(CFLAGS) render_tex.o $(ES1_LIBS) -o $@
+
+
+texture_from_pixmap: texture_from_pixmap.o $(ES1_LIB_DEPS)
+ $(CC) $(CFLAGS) texture_from_pixmap.o $(ES1_LIBS) -o $@
+
+torus: torus.o $(ES1_LIB_DEPS)
+ $(CC) $(CFLAGS) torus.o $(ES1_LIBS) -o $@
+
+
+two_win: two_win.o $(ES1_LIB_DEPS)
+ $(CC) $(CFLAGS) two_win.o $(ES1_LIBS) -o $@
+
+
+$(EGLUT_DIR)/libeglut-x11.a $(EGLUT_DIR)/libeglut-screen.a:
+ @$(MAKE) -C $(EGLUT_DIR)
+
+# define the rules for EGLUT demos
+define eglut-demo-rule
+$(1)_x11 $(1)_screen: $(1)_%: $(1).o $(EGLUT_DIR)/libeglut-%.a $(ES1_LIB_DEPS)
+endef
+$(foreach demo, $(EGLUT_DEMOS), $(eval $(call eglut-demo-rule,$(demo))))
+
+# build EGLUT demos
+$(EGLUT_X11_DEMOS):
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -L$(EGLUT_DIR) -leglut-$* $(ES1_LIBS) -lX11
+$(EGLUT_SCREEN_DEMOS):
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -L$(EGLUT_DIR) -leglut-$* $(ES1_LIBS)
+
+
+clean:
+ -rm -f *.o *~
+ -rm -f $(PROGRAMS) $(EGLUT_X11_DEMOS) $(EGLUT_SCREEN_DEMOS)
+ @$(MAKE) -C $(EGLUT_DIR) clean
diff --git a/progs/es1/xegl/bindtex.c b/progs/egl/opengles1/bindtex.c
index c243b5941b..c243b5941b 100644
--- a/progs/es1/xegl/bindtex.c
+++ b/progs/egl/opengles1/bindtex.c
diff --git a/progs/es1/xegl/drawtex.c b/progs/egl/opengles1/drawtex.c
index ca0615e267..ca0615e267 100644
--- a/progs/es1/xegl/drawtex.c
+++ b/progs/egl/opengles1/drawtex.c
diff --git a/progs/es1/xegl/es1_info.c b/progs/egl/opengles1/es1_info.c
index 93816b5215..93816b5215 100644
--- a/progs/es1/xegl/es1_info.c
+++ b/progs/egl/opengles1/es1_info.c
diff --git a/progs/es1/screen/gears.c b/progs/egl/opengles1/gears.c
index c7625826b9..8462a4871a 100644
--- a/progs/es1/screen/gears.c
+++ b/progs/egl/opengles1/gears.c
@@ -28,7 +28,7 @@
#include <assert.h>
#include <GLES/gl.h>
-#include "winsys.h"
+#include "eglut.h"
#ifndef M_PI
#define M_PI 3.14159265
@@ -247,7 +247,7 @@ draw_gear(const struct gear *gear)
static void
-gears_draw(void *data)
+gears_draw(void)
{
static const GLfloat red[4] = { 0.8, 0.1, 0.0, 1.0 };
static const GLfloat green[4] = { 0.0, 0.8, 0.2, 1.0 };
@@ -288,11 +288,6 @@ gears_draw(void *data)
glPopMatrix();
glPopMatrix();
-
- /* advance rotation for next frame */
- angle += 0.5; /* 0.5 degree per frame */
- if (angle > 3600.0)
- angle -= 3600.0;
}
@@ -348,27 +343,41 @@ gears_reshape(int width, int height)
}
-static void gears_run(void)
+static void
+gears_idle(void)
{
- winsysRun(5.0, gears_draw, NULL);
+ static double t0 = -1.;
+ double dt, t = eglutGet(EGLUT_ELAPSED_TIME) / 1000.0;
+ if (t0 < 0.0)
+ t0 = t;
+ dt = t - t0;
+ t0 = t;
+
+ angle += 70.0 * dt; /* 70 degrees per second */
+ angle = fmod(angle, 360.0); /* prevents eventual overflow */
+
+ eglutPostRedisplay();
}
int
main(int argc, char *argv[])
{
- EGLint width, height;
+ eglutInitWindowSize(300, 300);
+ eglutInitAPIMask(EGLUT_OPENGL_ES1_BIT);
+ eglutInit(argc, argv);
- if (!winsysInitScreen())
- exit(1);
- winsysQueryScreenSize(&width, &height);
+ eglutCreateWindow("gears");
+
+ eglutIdleFunc(gears_idle);
+ eglutReshapeFunc(gears_reshape);
+ eglutDisplayFunc(gears_draw);
gears_init();
- gears_reshape(width, height);
- gears_run();
- gears_fini();
- winsysFiniScreen();
+ eglutMainLoop();
+
+ gears_fini();
return 0;
}
diff --git a/progs/es1/xegl/msaa.c b/progs/egl/opengles1/msaa.c
index b4c6c63217..b4c6c63217 100644
--- a/progs/es1/xegl/msaa.c
+++ b/progs/egl/opengles1/msaa.c
diff --git a/progs/es1/xegl/pbuffer.c b/progs/egl/opengles1/pbuffer.c
index 011c2af58f..011c2af58f 100644
--- a/progs/es1/xegl/pbuffer.c
+++ b/progs/egl/opengles1/pbuffer.c
diff --git a/progs/es1/xegl/render_tex.c b/progs/egl/opengles1/render_tex.c
index 0200fa4cb0..0200fa4cb0 100644
--- a/progs/es1/xegl/render_tex.c
+++ b/progs/egl/opengles1/render_tex.c
diff --git a/progs/egl/opengles1/texture_from_pixmap.c b/progs/egl/opengles1/texture_from_pixmap.c
new file mode 100644
index 0000000000..abb8c28e56
--- /dev/null
+++ b/progs/egl/opengles1/texture_from_pixmap.c
@@ -0,0 +1,579 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.9
+ *
+ * Copyright (C) 2010 LunarG Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Chia-I Wu <olv@lunarg.com>
+ */
+
+/*
+ * This demo uses EGL_KHR_image_pixmap and GL_OES_EGL_image to demonstrate
+ * texture-from-pixmap.
+ */
+
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h> /* for usleep */
+#include <sys/time.h> /* for gettimeofday */
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/keysym.h>
+#include <GLES/gl.h>
+#include <GLES/glext.h>
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+
+struct app_data {
+ /* native */
+ Display *xdpy;
+ Window canvas, cube;
+ Pixmap pix;
+ unsigned int width, height, depth;
+ GC fg, bg;
+
+ /* EGL */
+ EGLDisplay dpy;
+ EGLContext ctx;
+ EGLSurface surf;
+ EGLImageKHR img;
+
+ /* OpenGL ES */
+ GLuint texture;
+
+ PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR;
+ PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR;
+ PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES;
+
+ /* app state */
+ Bool loop;
+ Bool redraw, reshape;
+
+ struct {
+ Bool active;
+ unsigned long next_frame; /* in ms */
+ float view_rotx;
+ float view_roty;
+ float view_rotz;
+
+ } animate;
+
+ struct {
+ Bool active;
+ int x1, y1;
+ int x2, y2;
+ } paint;
+};
+
+static void
+gl_redraw(void)
+{
+ const GLfloat verts[4][2] = {
+ { -1, -1 },
+ { 1, -1 },
+ { 1, 1 },
+ { -1, 1 }
+ };
+ const GLfloat texcoords[4][2] = {
+ { 0, 1 },
+ { 1, 1 },
+ { 1, 0 },
+ { 0, 0 }
+ };
+ const GLfloat faces[6][4] = {
+ { 0, 0, 1, 0 },
+ { 90, 0, 1, 0 },
+ { 180, 0, 1, 0 },
+ { 270, 0, 1, 0 },
+ { 90, 1, 0, 0 },
+ { -90, 1, 0, 0 }
+ };
+ GLint i;
+
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ glVertexPointer(2, GL_FLOAT, 0, verts);
+ glTexCoordPointer(2, GL_FLOAT, 0, texcoords);
+
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+
+ for (i = 0; i < 6; i++) {
+ glPushMatrix();
+ glRotatef(faces[i][0], faces[i][1], faces[i][2], faces[i][3]);
+ glTranslatef(0, 0, 1.0);
+ glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+ glPopMatrix();
+ }
+
+ glDisableClientState(GL_VERTEX_ARRAY);
+ glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+}
+
+static void
+gl_reshape(int width, int height)
+{
+ GLfloat ar = (GLfloat) width / (GLfloat) height;
+
+ glViewport(0, 0, width, height);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glFrustumf(-ar, ar, -1, 1, 5.0, 60.0);
+
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ glTranslatef(0.0, 0.0, -10.0);
+}
+
+static void
+app_redraw(struct app_data *data)
+{
+ /* pixmap has changed */
+ if (data->reshape || data->paint.active) {
+ eglWaitNative(EGL_CORE_NATIVE_ENGINE);
+
+ if (data->reshape) {
+ data->glEGLImageTargetTexture2DOES(GL_TEXTURE_2D,
+ (GLeglImageOES) data->img);
+ }
+ }
+
+ XCopyArea(data->xdpy, data->pix, data->canvas, data->fg,
+ 0, 0, data->width, data->height, 0, 0);
+
+ glPushMatrix();
+ glRotatef(data->animate.view_rotx, 1, 0, 0);
+ glRotatef(data->animate.view_roty, 0, 1, 0);
+ glRotatef(data->animate.view_rotz, 0, 0, 1);
+ gl_redraw();
+ glPopMatrix();
+
+ eglSwapBuffers(data->dpy, data->surf);
+}
+
+static void
+app_reshape(struct app_data *data)
+{
+ const EGLint img_attribs[] = {
+ EGL_IMAGE_PRESERVED_KHR, EGL_TRUE,
+ EGL_NONE
+ };
+
+ XResizeWindow(data->xdpy, data->cube, data->width, data->height);
+ XMoveWindow(data->xdpy, data->cube, data->width, 0);
+
+ if (data->img)
+ data->eglDestroyImageKHR(data->dpy, data->img);
+ if (data->pix)
+ XFreePixmap(data->xdpy, data->pix);
+
+ data->pix = XCreatePixmap(data->xdpy, data->canvas, data->width, data->height, data->depth);
+ XFillRectangle(data->xdpy, data->pix, data->bg, 0, 0, data->width, data->height);
+
+ data->img = data->eglCreateImageKHR(data->dpy, EGL_NO_CONTEXT,
+ EGL_NATIVE_PIXMAP_KHR, (EGLClientBuffer) data->pix, img_attribs);
+
+ gl_reshape(data->width, data->height);
+}
+
+static void
+app_toggle_animate(struct app_data *data)
+{
+ data->animate.active = !data->animate.active;
+
+ if (data->animate.active) {
+ struct timeval tv;
+
+ gettimeofday(&tv, NULL);
+ data->animate.next_frame = tv.tv_sec * 1000 + tv.tv_usec / 1000;
+ }
+}
+
+static void
+app_next_event(struct app_data *data)
+{
+ XEvent event;
+
+ data->reshape = False;
+ data->redraw = False;
+ data->paint.active = False;
+
+ if (data->animate.active) {
+ struct timeval tv;
+ unsigned long now;
+
+ gettimeofday(&tv, NULL);
+ now = tv.tv_sec * 1000 + tv.tv_usec / 1000;
+
+ /* wait for next frame */
+ if (!XPending(data->xdpy) && now < data->animate.next_frame) {
+ usleep((data->animate.next_frame - now) * 1000);
+ gettimeofday(&tv, NULL);
+ now = tv.tv_sec * 1000 + tv.tv_usec / 1000;
+ }
+
+ while (now >= data->animate.next_frame) {
+ data->animate.view_rotx += 1.0;
+ data->animate.view_roty += 2.0;
+ data->animate.view_rotz += 1.5;
+
+ /* 30fps */
+ data->animate.next_frame += 1000 / 30;
+ }
+
+ /* check again in case there were events when sleeping */
+ if (!XPending(data->xdpy)) {
+ data->redraw = True;
+ return;
+ }
+ }
+
+ XNextEvent(data->xdpy, &event);
+
+ switch (event.type) {
+ case ConfigureNotify:
+ data->width = event.xconfigure.width / 2;
+ data->height = event.xconfigure.height;
+ data->reshape = True;
+ break;
+ case Expose:
+ data->redraw = True;
+ break;
+ case KeyPress:
+ {
+ int code;
+
+ code = XLookupKeysym(&event.xkey, 0);
+ switch (code) {
+ case XK_a:
+ app_toggle_animate(data);
+ break;
+ case XK_Escape:
+ data->loop = False;
+ break;
+ default:
+ break;
+ }
+ }
+ break;
+ case ButtonPress:
+ data->paint.x1 = data->paint.x2 = event.xbutton.x;
+ data->paint.y1 = data->paint.y2 = event.xbutton.y;
+ break;
+ case ButtonRelease:
+ data->paint.active = False;
+ break;
+ case MotionNotify:
+ data->paint.x1 = data->paint.x2;
+ data->paint.y1 = data->paint.y2;
+ data->paint.x2 = event.xmotion.x;
+ data->paint.y2 = event.xmotion.y;
+ data->paint.active = True;
+ break;
+ default:
+ break;
+ }
+
+ if (data->paint.active || data->reshape)
+ data->redraw = True;
+}
+
+static void
+app_init_gl(struct app_data *data)
+{
+ glClearColor(0.1, 0.1, 0.3, 0.0);
+ glColor4f(1.0, 1.0, 1.0, 1.0);
+
+ glGenTextures(1, &data->texture);
+
+ glBindTexture(GL_TEXTURE_2D, data->texture);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+
+ glEnable(GL_TEXTURE_2D);
+ glEnable(GL_DEPTH_TEST);
+}
+
+static Bool
+app_init_exts(struct app_data *data)
+{
+ const char *exts;
+
+ exts = eglQueryString(data->dpy, EGL_EXTENSIONS);
+ data->eglCreateImageKHR =
+ (PFNEGLCREATEIMAGEKHRPROC) eglGetProcAddress("eglCreateImageKHR");
+ data->eglDestroyImageKHR =
+ (PFNEGLDESTROYIMAGEKHRPROC) eglGetProcAddress("eglDestroyImageKHR");
+ if (!exts || !strstr(exts, "EGL_KHR_image_pixmap") ||
+ !data->eglCreateImageKHR || !data->eglDestroyImageKHR) {
+ printf("EGL does not support EGL_KHR_image_pixmap\n");
+ return False;
+ }
+
+ exts = (const char *) glGetString(GL_EXTENSIONS);
+ exts = "GL_OES_EGL_image"; /* XXX */
+ data->glEGLImageTargetTexture2DOES = (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)
+ eglGetProcAddress("glEGLImageTargetTexture2DOES");
+ if (!exts || !strstr(exts, "GL_OES_EGL_image") ||
+ !data->glEGLImageTargetTexture2DOES) {
+ printf("OpenGL ES does not support GL_OES_EGL_image\n");
+ return False;
+ }
+
+ return True;
+}
+
+static void
+app_run(struct app_data *data)
+{
+ Window root;
+ int x, y;
+ unsigned int border;
+
+ if (!eglMakeCurrent(data->dpy, data->surf, data->surf, data->ctx))
+ return;
+
+ if (!app_init_exts(data))
+ return;
+
+ printf("Draw something on the left with the mouse!\n");
+
+ app_init_gl(data);
+
+ if (!XGetGeometry(data->xdpy, data->canvas, &root, &x, &y,
+ &data->width, &data->height, &border, &data->depth))
+ return;
+ data->width /= 2;
+
+ app_reshape(data);
+
+ XMapWindow(data->xdpy, data->canvas);
+ XMapWindow(data->xdpy, data->cube);
+
+ app_toggle_animate(data);
+ data->loop = True;
+
+ while (data->loop) {
+ app_next_event(data);
+
+ if (data->reshape)
+ app_reshape(data);
+ if (data->paint.active) {
+ XDrawLine(data->xdpy, data->pix, data->fg,
+ data->paint.x1, data->paint.y1,
+ data->paint.x2, data->paint.y2);
+ }
+
+ if (data->redraw)
+ app_redraw(data);
+ }
+
+ eglMakeCurrent(data->dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+}
+
+static Bool
+make_x_window(struct app_data *data, const char *name,
+ int x, int y, int width, int height)
+{
+ static const EGLint attribs[] = {
+ EGL_RED_SIZE, 1,
+ EGL_GREEN_SIZE, 1,
+ EGL_BLUE_SIZE, 1,
+ EGL_DEPTH_SIZE, 1,
+ EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT,
+ EGL_NONE
+ };
+ static const EGLint ctx_attribs[] = {
+ EGL_CONTEXT_CLIENT_VERSION, 1,
+ EGL_NONE
+ };
+ int scrnum;
+ XSetWindowAttributes attr;
+ unsigned long mask;
+ Window root;
+ Window win;
+ XVisualInfo *visInfo, visTemplate;
+ int num_visuals;
+ EGLConfig config;
+ EGLint num_configs;
+ EGLint vid;
+
+ scrnum = DefaultScreen( data->xdpy );
+ root = RootWindow( data->xdpy, scrnum );
+
+ if (!eglChooseConfig( data->dpy, attribs, &config, 1, &num_configs)) {
+ printf("Error: couldn't get an EGL visual config\n");
+ exit(1);
+ }
+
+ assert(config);
+ assert(num_configs > 0);
+
+ if (!eglGetConfigAttrib(data->dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
+ printf("Error: eglGetConfigAttrib() failed\n");
+ exit(1);
+ }
+
+ /* The X window visual must match the EGL config */
+ visTemplate.visualid = vid;
+ visInfo = XGetVisualInfo(data->xdpy, VisualIDMask, &visTemplate, &num_visuals);
+ if (!visInfo) {
+ printf("Error: couldn't get X visual\n");
+ exit(1);
+ }
+
+ /* window attributes */
+ attr.background_pixel = 0;
+ attr.border_pixel = 0;
+ attr.colormap = XCreateColormap( data->xdpy, root, visInfo->visual, AllocNone);
+ attr.event_mask = StructureNotifyMask | ExposureMask |
+ KeyPressMask | ButtonPressMask | ButtonMotionMask;
+ mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
+
+ win = XCreateWindow( data->xdpy, root, 0, 0, width * 2, height,
+ 0, visInfo->depth, InputOutput,
+ visInfo->visual, mask, &attr );
+
+ /* set hints and properties */
+ {
+ XSizeHints sizehints;
+ sizehints.x = x;
+ sizehints.y = y;
+ sizehints.width = width;
+ sizehints.height = height;
+ sizehints.flags = USSize | USPosition;
+ XSetNormalHints(data->xdpy, win, &sizehints);
+ XSetStandardProperties(data->xdpy, win, name, name,
+ None, (char **)NULL, 0, &sizehints);
+ }
+
+ data->canvas = win;
+
+ attr.event_mask = 0x0;
+ win = XCreateWindow( data->xdpy, win, width, 0, width, height,
+ 0, visInfo->depth, InputOutput,
+ visInfo->visual, mask, &attr );
+ data->cube = win;
+
+ eglBindAPI(EGL_OPENGL_ES_API);
+
+ data->ctx = eglCreateContext(data->dpy, config, EGL_NO_CONTEXT, ctx_attribs );
+ if (!data->ctx) {
+ printf("Error: eglCreateContext failed\n");
+ exit(1);
+ }
+
+ data->surf = eglCreateWindowSurface(data->dpy, config, data->cube, NULL);
+ if (!data->surf) {
+ printf("Error: eglCreateWindowSurface failed\n");
+ exit(1);
+ }
+
+ XFree(visInfo);
+
+ return (data->canvas && data->cube && data->ctx && data->surf);
+}
+
+static void
+app_fini(struct app_data *data)
+{
+ if (data->img)
+ data->eglDestroyImageKHR(data->dpy, data->img);
+ if (data->pix)
+ XFreePixmap(data->xdpy, data->pix);
+
+ if (data->fg)
+ XFreeGC(data->xdpy, data->fg);
+ if (data->bg)
+ XFreeGC(data->xdpy, data->bg);
+
+ if (data->surf)
+ eglDestroySurface(data->dpy, data->surf);
+ if (data->ctx)
+ eglDestroyContext(data->dpy, data->ctx);
+
+ if (data->cube)
+ XDestroyWindow(data->xdpy, data->cube);
+ if (data->canvas)
+ XDestroyWindow(data->xdpy, data->canvas);
+
+ if (data->dpy)
+ eglTerminate(data->dpy);
+ if (data->xdpy)
+ XCloseDisplay(data->xdpy);
+}
+
+static Bool
+app_init(struct app_data *data, int argc, char **argv)
+{
+ XGCValues gc_vals;
+
+ memset(data, 0, sizeof(*data));
+
+ data->xdpy = XOpenDisplay(NULL);
+ if (!data->xdpy)
+ goto fail;
+
+ data->dpy = eglGetDisplay(data->xdpy);
+ if (!data->dpy || !eglInitialize(data->dpy, NULL, NULL))
+ goto fail;
+
+ if (!make_x_window(data, "EGLImage TFP", 0, 0, 300, 300))
+ goto fail;
+
+ gc_vals.function = GXcopy;
+ gc_vals.foreground = WhitePixel(data->xdpy, DefaultScreen(data->xdpy));
+ gc_vals.line_width = 3;
+ gc_vals.line_style = LineSolid;
+ gc_vals.fill_style = FillSolid;
+
+ data->fg = XCreateGC(data->xdpy, data->canvas,
+ GCFunction | GCForeground | GCLineWidth | GCLineStyle | GCFillStyle,
+ &gc_vals);
+ gc_vals.foreground = BlackPixel(data->xdpy, DefaultScreen(data->xdpy));
+ data->bg = XCreateGC(data->xdpy, data->canvas,
+ GCFunction | GCForeground | GCLineWidth | GCLineStyle | GCFillStyle,
+ &gc_vals);
+ if (!data->fg || !data->bg)
+ goto fail;
+
+ return True;
+
+fail:
+ app_fini(data);
+ return False;
+}
+
+int
+main(int argc, char **argv)
+{
+ struct app_data data;
+
+ if (app_init(&data, argc, argv)) {
+ app_run(&data);
+ app_fini(&data);
+ }
+
+ return 0;
+}
diff --git a/progs/es1/xegl/torus.c b/progs/egl/opengles1/torus.c
index 9438a4fe59..9438a4fe59 100644
--- a/progs/es1/xegl/torus.c
+++ b/progs/egl/opengles1/torus.c
diff --git a/progs/egl/opengles1/tri.c b/progs/egl/opengles1/tri.c
new file mode 100644
index 0000000000..01ad9bd37e
--- /dev/null
+++ b/progs/egl/opengles1/tri.c
@@ -0,0 +1,211 @@
+/*
+ * Copyright (C) 2008 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * Draw a triangle with X/EGL and OpenGL ES 1.x
+ * Brian Paul
+ * 5 June 2008
+ */
+
+#define USE_FIXED_POINT 0
+
+
+#include <assert.h>
+#include <math.h>
+#include <stdio.h>
+#include <GLES/gl.h> /* use OpenGL ES 1.x */
+#include <GLES/glext.h>
+#include <EGL/egl.h>
+
+#include "eglut.h"
+
+
+#define FLOAT_TO_FIXED(X) ((X) * 65535.0)
+
+
+
+static GLfloat view_rotx = 0.0, view_roty = 0.0, view_rotz = 0.0;
+
+
+static void
+draw(void)
+{
+#if USE_FIXED_POINT
+ static const GLfixed verts[3][2] = {
+ { -65536, -65536 },
+ { 65536, -65536 },
+ { 0, 65536 }
+ };
+ static const GLfixed colors[3][4] = {
+ { 65536, 0, 0, 65536 },
+ { 0, 65536, 0 , 65536},
+ { 0, 0, 65536 , 65536}
+ };
+#else
+ static const GLfloat verts[3][2] = {
+ { -1, -1 },
+ { 1, -1 },
+ { 0, 1 }
+ };
+ static const GLfloat colors[3][4] = {
+ { 1, 0, 0, 1 },
+ { 0, 1, 0, 1 },
+ { 0, 0, 1, 1 }
+ };
+#endif
+
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ glPushMatrix();
+ glRotatef(view_rotx, 1, 0, 0);
+ glRotatef(view_roty, 0, 1, 0);
+ glRotatef(view_rotz, 0, 0, 1);
+
+ {
+#if USE_FIXED_POINT
+ glVertexPointer(2, GL_FIXED, 0, verts);
+ glColorPointer(4, GL_FIXED, 0, colors);
+#else
+ glVertexPointer(2, GL_FLOAT, 0, verts);
+ glColorPointer(4, GL_FLOAT, 0, colors);
+#endif
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glEnableClientState(GL_COLOR_ARRAY);
+
+ /* draw triangle */
+ glDrawArrays(GL_TRIANGLES, 0, 3);
+
+ /* draw some points */
+ glPointSizex(FLOAT_TO_FIXED(15.5));
+ glDrawArrays(GL_POINTS, 0, 3);
+
+ glDisableClientState(GL_VERTEX_ARRAY);
+ glDisableClientState(GL_COLOR_ARRAY);
+ }
+
+ if (0) {
+ /* test code */
+ GLfixed size;
+ glGetFixedv(GL_POINT_SIZE, &size);
+ printf("GL_POINT_SIZE = 0x%x %f\n", size, size / 65536.0);
+ }
+
+ glPopMatrix();
+}
+
+
+/* new window size or exposure */
+static void
+reshape(int width, int height)
+{
+ GLfloat ar = (GLfloat) width / (GLfloat) height;
+
+ glViewport(0, 0, (GLint) width, (GLint) height);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+#ifdef GL_VERSION_ES_CM_1_0
+ glFrustumf(-ar, ar, -1, 1, 5.0, 60.0);
+#else
+ glFrustum(-ar, ar, -1, 1, 5.0, 60.0);
+#endif
+
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ glTranslatef(0.0, 0.0, -10.0);
+}
+
+
+static void
+test_query_matrix(void)
+{
+ PFNGLQUERYMATRIXXOESPROC procQueryMatrixx;
+ typedef void (*voidproc)();
+ GLfixed mantissa[16];
+ GLint exponent[16];
+ GLbitfield rv;
+ int i;
+
+ procQueryMatrixx = (PFNGLQUERYMATRIXXOESPROC) eglGetProcAddress("glQueryMatrixxOES");
+ assert(procQueryMatrixx);
+ /* Actually try out this one */
+ rv = (*procQueryMatrixx)(mantissa, exponent);
+ for (i = 0; i < 16; i++) {
+ if (rv & (1<<i)) {
+ printf("matrix[%d] invalid\n", i);
+ }
+ else {
+ printf("matrix[%d] = %f * 2^(%d)\n", i, mantissa[i]/65536.0, exponent[i]);
+ }
+ }
+ assert(!eglGetProcAddress("glFoo"));
+}
+
+
+static void
+init(void)
+{
+ glClearColor(0.4, 0.4, 0.4, 0.0);
+
+ if (0)
+ test_query_matrix();
+}
+
+static void
+special_key(int special)
+{
+ switch (special) {
+ case EGLUT_KEY_LEFT:
+ view_roty += 5.0;
+ break;
+ case EGLUT_KEY_RIGHT:
+ view_roty -= 5.0;
+ break;
+ case EGLUT_KEY_UP:
+ view_rotx += 5.0;
+ break;
+ case EGLUT_KEY_DOWN:
+ view_rotx -= 5.0;
+ break;
+ default:
+ break;
+ }
+}
+
+int
+main(int argc, char *argv[])
+{
+ eglutInitWindowSize(300, 300);
+ eglutInitAPIMask(EGLUT_OPENGL_ES1_BIT);
+ eglutInit(argc, argv);
+
+ eglutCreateWindow("tri");
+
+ eglutReshapeFunc(reshape);
+ eglutDisplayFunc(draw);
+ eglutSpecialFunc(special_key);
+
+ init();
+
+ eglutMainLoop();
+
+ return 0;
+}
diff --git a/progs/es1/xegl/two_win.c b/progs/egl/opengles1/two_win.c
index 4785e5304d..4785e5304d 100644
--- a/progs/es1/xegl/two_win.c
+++ b/progs/egl/opengles1/two_win.c
diff --git a/progs/egl/opengles2/.gitignore b/progs/egl/opengles2/.gitignore
new file mode 100644
index 0000000000..6158cc6e68
--- /dev/null
+++ b/progs/egl/opengles2/.gitignore
@@ -0,0 +1,3 @@
+es2_info.c
+es2_info
+tri
diff --git a/progs/es2/xegl/Makefile b/progs/egl/opengles2/Makefile
index 5bb167c1c6..710c4d8c13 100644
--- a/progs/es2/xegl/Makefile
+++ b/progs/egl/opengles2/Makefile
@@ -1,4 +1,4 @@
-# progs/es2/xegl/Makefile
+# progs/egl/opengles2/Makefile
TOP = ../../..
include $(TOP)/configs/current
@@ -33,7 +33,7 @@ default: $(PROGRAMS)
-es2_info.c: ../../es1/xegl/es1_info.c
+es2_info.c: ../opengles1/es1_info.c
cp -f $^ $@
es2_info: es2_info.o $(ES2_LIB_DEPS)
diff --git a/progs/es2/xegl/tri.c b/progs/egl/opengles2/tri.c
index 8981d8a7e2..8981d8a7e2 100644
--- a/progs/es2/xegl/tri.c
+++ b/progs/egl/opengles2/tri.c
diff --git a/progs/openvg/.gitignore b/progs/egl/openvg/.gitignore
index 9b05e1e81d..3e1733c8c8 100644
--- a/progs/openvg/.gitignore
+++ b/progs/egl/openvg/.gitignore
@@ -1,5 +1,7 @@
-demos/lion
-demos/sp
+lion_x11
+lion_screen
+sp_x11
+sp_screen
trivial/arc
trivial/cap
trivial/clear
diff --git a/progs/egl/openvg/Makefile b/progs/egl/openvg/Makefile
new file mode 100644
index 0000000000..5a10cc8055
--- /dev/null
+++ b/progs/egl/openvg/Makefile
@@ -0,0 +1,55 @@
+# progs/egl/openvg/Makefile
+
+TOP = ../../..
+include $(TOP)/configs/current
+
+VG_LIBS=-lm -lEGL -lOpenVG
+INCLUDE_DIRS = -I$(TOP)/include
+
+EGLUT_DIR = $(TOP)/progs/egl/eglut
+
+EGLUT_DEMOS = \
+ sp
+
+EGLUT_X11_DEMOS := $(addsuffix _x11,$(EGLUT_DEMOS))
+EGLUT_SCREEN_DEMOS := $(addsuffix _screen,$(EGLUT_DEMOS))
+
+PROGRAMS = \
+ lion_x11 \
+ lion_screen
+
+.c.o:
+ $(CC) -c $(INCLUDE_DIRS) -I$(EGLUT_DIR) $(CFLAGS) $< -o $@
+
+
+
+default: $(PROGRAMS) $(EGLUT_X11_DEMOS) $(EGLUT_SCREEN_DEMOS)
+
+lion_x11: lion.o lion-render.o $(EGLUT_DIR)/libeglut-x11.a
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ lion.o lion-render.o \
+ -L$(EGLUT_DIR) -leglut-x11 $(VG_LIBS) -lX11
+
+lion_screen: lion.o lion-render.o $(EGLUT_DIR)/libeglut-screen.a
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ lion.o lion-render.o \
+ -L$(EGLUT_DIR) -leglut-screen $(VG_LIBS)
+
+
+$(EGLUT_DIR)/libeglut-x11.a $(EGLUT_DIR)/libeglut-screen.a:
+ @$(MAKE) -C $(EGLUT_DIR)
+
+# define the rules for EGLUT demos
+define eglut-demo-rule
+$(1)_x11 $(1)_screen: $(1)_%: $(1).o $(EGLUT_DIR)/libeglut-%.a
+endef
+$(foreach demo, $(EGLUT_DEMOS), $(eval $(call eglut-demo-rule,$(demo))))
+
+# build EGLUT demos
+$(EGLUT_X11_DEMOS):
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -L$(EGLUT_DIR) -leglut-$* $(VG_LIBS) -lX11
+$(EGLUT_SCREEN_DEMOS):
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -L$(EGLUT_DIR) -leglut-$* $(VG_LIBS)
+
+clean:
+ rm -f *.o *~
+ rm -f $(EGLUT_X11_DEMOS) $(EGLUT_SCREEN_DEMOS)
+ @$(MAKE) -C $(EGLUT_DIR) clean
diff --git a/progs/openvg/demos/lion-render.c b/progs/egl/openvg/lion-render.c
index f3f151f552..f3f151f552 100644
--- a/progs/openvg/demos/lion-render.c
+++ b/progs/egl/openvg/lion-render.c
diff --git a/progs/openvg/demos/lion-render.h b/progs/egl/openvg/lion-render.h
index c4c020b7ed..c4c020b7ed 100644
--- a/progs/openvg/demos/lion-render.h
+++ b/progs/egl/openvg/lion-render.h
diff --git a/progs/egl/openvg/lion.c b/progs/egl/openvg/lion.c
new file mode 100644
index 0000000000..c5dba4fcea
--- /dev/null
+++ b/progs/egl/openvg/lion.c
@@ -0,0 +1,65 @@
+#include <VG/openvg.h>
+#include <EGL/egl.h>
+
+#include "lion-render.h"
+#include "eglut.h"
+
+static VGint width, height;
+struct lion *lion = 0;
+VGfloat angle = 0;
+
+static void
+draw(void)
+{
+ vgClear(0, 0, width, height);
+
+ vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
+ vgLoadIdentity();
+ vgTranslate(width/2, height/2);
+ vgRotate(angle);
+ vgTranslate(-width/2, -height/2);
+
+ lion_render(lion);
+
+ ++angle;
+ eglutPostRedisplay();
+}
+
+
+/* new window size or exposure */
+static void
+reshape(int w, int h)
+{
+ width = w;
+ height = h;
+}
+
+
+static void
+init(void)
+{
+ float clear_color[4] = {1.0, 1.0, 1.0, 1.0};
+ vgSetfv(VG_CLEAR_COLOR, 4, clear_color);
+
+ lion = lion_create();
+}
+
+
+int
+main(int argc, char *argv[])
+{
+ eglutInitWindowSize(350, 450);
+ eglutInitAPIMask(EGLUT_OPENVG_BIT);
+ eglutInit(argc, argv);
+
+ eglutCreateWindow("Lion Example");
+
+ eglutReshapeFunc(reshape);
+ eglutDisplayFunc(draw);
+
+ init();
+
+ eglutMainLoop();
+
+ return 0;
+}
diff --git a/progs/openvg/demos/sp.c b/progs/egl/openvg/sp.c
index 424ec47d69..a20c0a3b4e 100644
--- a/progs/openvg/demos/sp.c
+++ b/progs/egl/openvg/sp.c
@@ -1,13 +1,9 @@
-#include "eglcommon.h"
-
#include <VG/openvg.h>
#include <VG/vgu.h>
-#include <stdio.h>
#include <math.h>
-#include <stdlib.h>
#include <string.h>
-#include <X11/keysym.h>
+#include "eglut.h"
#define ELEMENTS(x) (sizeof(x)/sizeof((x)[0]))
@@ -475,36 +471,13 @@ reshape(int w, int h)
{
}
-static int
-key_press(unsigned key)
-{
- switch(key) {
- case XK_Right:
-
- break;
- case XK_Left:
- break;
- case XK_Up:
- break;
- case XK_Down:
- break;
- case 'a':
- break;
- case 's':
- break;
- default:
- break;
- }
- return VG_FALSE;
-}
-
static void
draw(void)
{
VGint i;
VGfloat save_matrix[9];
- vgClear(0, 0, window_width(), window_height());
+ vgClear(0, 0, eglutGetWindowWidth(), eglutGetWindowHeight());
vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
vgLoadIdentity();
@@ -532,6 +505,18 @@ draw(void)
int main(int argc, char **argv)
{
- set_window_size(400, 400);
- return run(argc, argv, init, reshape, draw, key_press);
+ eglutInitWindowSize(400, 400);
+ eglutInitAPIMask(EGLUT_OPENVG_BIT);
+ eglutInit(argc, argv);
+
+ eglutCreateWindow("sp");
+
+ eglutReshapeFunc(reshape);
+ eglutDisplayFunc(draw);
+
+ init();
+
+ eglutMainLoop();
+
+ return 0;
}
diff --git a/progs/openvg/trivial/Makefile b/progs/egl/openvg/trivial/Makefile
index fcb3484377..8f6d7abe89 100644
--- a/progs/openvg/trivial/Makefile
+++ b/progs/egl/openvg/trivial/Makefile
@@ -1,7 +1,8 @@
+# progs/egl/openvg/trivial/Makefile
# These programs aren't intended to be included with the normal distro.
# They're not too interesting but they're good for testing.
-TOP = ../../../
+TOP = ../../../..
include $(TOP)/configs/current
INCLUDES = -I. -I$(TOP)/include
diff --git a/progs/openvg/trivial/arc.c b/progs/egl/openvg/trivial/arc.c
index db686bea6b..db686bea6b 100644
--- a/progs/openvg/trivial/arc.c
+++ b/progs/egl/openvg/trivial/arc.c
diff --git a/progs/openvg/trivial/cap.c b/progs/egl/openvg/trivial/cap.c
index cd84fe3ac0..cd84fe3ac0 100644
--- a/progs/openvg/trivial/cap.c
+++ b/progs/egl/openvg/trivial/cap.c
diff --git a/progs/openvg/trivial/clear.c b/progs/egl/openvg/trivial/clear.c
index efb6bf4182..efb6bf4182 100644
--- a/progs/openvg/trivial/clear.c
+++ b/progs/egl/openvg/trivial/clear.c
diff --git a/progs/openvg/trivial/coord.c b/progs/egl/openvg/trivial/coord.c
index 81f7cb6fc9..81f7cb6fc9 100644
--- a/progs/openvg/trivial/coord.c
+++ b/progs/egl/openvg/trivial/coord.c
diff --git a/progs/openvg/trivial/dash.c b/progs/egl/openvg/trivial/dash.c
index 2e84ddbd4e..2e84ddbd4e 100644
--- a/progs/openvg/trivial/dash.c
+++ b/progs/egl/openvg/trivial/dash.c
diff --git a/progs/openvg/demos/eglcommon.c b/progs/egl/openvg/trivial/eglcommon.c
index 0316e596c6..0316e596c6 100644
--- a/progs/openvg/demos/eglcommon.c
+++ b/progs/egl/openvg/trivial/eglcommon.c
diff --git a/progs/openvg/demos/eglcommon.h b/progs/egl/openvg/trivial/eglcommon.h
index 958dae9f98..958dae9f98 100644
--- a/progs/openvg/demos/eglcommon.h
+++ b/progs/egl/openvg/trivial/eglcommon.h
diff --git a/progs/openvg/trivial/ellipse.c b/progs/egl/openvg/trivial/ellipse.c
index 4c7d4904f8..4c7d4904f8 100644
--- a/progs/openvg/trivial/ellipse.c
+++ b/progs/egl/openvg/trivial/ellipse.c
diff --git a/progs/openvg/trivial/filter.c b/progs/egl/openvg/trivial/filter.c
index d96257a933..d96257a933 100644
--- a/progs/openvg/trivial/filter.c
+++ b/progs/egl/openvg/trivial/filter.c
diff --git a/progs/openvg/trivial/gradorigin.c b/progs/egl/openvg/trivial/gradorigin.c
index b376263fe5..b376263fe5 100644
--- a/progs/openvg/trivial/gradorigin.c
+++ b/progs/egl/openvg/trivial/gradorigin.c
diff --git a/progs/openvg/trivial/lineto.c b/progs/egl/openvg/trivial/lineto.c
index 94e2981811..94e2981811 100644
--- a/progs/openvg/trivial/lineto.c
+++ b/progs/egl/openvg/trivial/lineto.c
diff --git a/progs/openvg/trivial/lingrad.c b/progs/egl/openvg/trivial/lingrad.c
index bcaad1f101..bcaad1f101 100644
--- a/progs/openvg/trivial/lingrad.c
+++ b/progs/egl/openvg/trivial/lingrad.c
diff --git a/progs/openvg/trivial/lookup.c b/progs/egl/openvg/trivial/lookup.c
index a103ba4488..a103ba4488 100644
--- a/progs/openvg/trivial/lookup.c
+++ b/progs/egl/openvg/trivial/lookup.c
diff --git a/progs/openvg/trivial/mask.c b/progs/egl/openvg/trivial/mask.c
index e5c00c5699..e5c00c5699 100644
--- a/progs/openvg/trivial/mask.c
+++ b/progs/egl/openvg/trivial/mask.c
diff --git a/progs/openvg/trivial/mask4.c b/progs/egl/openvg/trivial/mask4.c
index fe6db39648..fe6db39648 100644
--- a/progs/openvg/trivial/mask4.c
+++ b/progs/egl/openvg/trivial/mask4.c
diff --git a/progs/openvg/trivial/path3.c b/progs/egl/openvg/trivial/path3.c
index 5ce600f65a..5ce600f65a 100644
--- a/progs/openvg/trivial/path3.c
+++ b/progs/egl/openvg/trivial/path3.c
diff --git a/progs/openvg/trivial/radialgrad.c b/progs/egl/openvg/trivial/radialgrad.c
index cf3b1d522d..cf3b1d522d 100644
--- a/progs/openvg/trivial/radialgrad.c
+++ b/progs/egl/openvg/trivial/radialgrad.c
diff --git a/progs/openvg/trivial/readpixels.c b/progs/egl/openvg/trivial/readpixels.c
index c8e286db9a..c8e286db9a 100644
--- a/progs/openvg/trivial/readpixels.c
+++ b/progs/egl/openvg/trivial/readpixels.c
diff --git a/progs/openvg/trivial/roundedrect.c b/progs/egl/openvg/trivial/roundedrect.c
index c80a4ed299..c80a4ed299 100644
--- a/progs/openvg/trivial/roundedrect.c
+++ b/progs/egl/openvg/trivial/roundedrect.c
diff --git a/progs/openvg/trivial/star-nonzero.c b/progs/egl/openvg/trivial/star-nonzero.c
index 012fbd3929..012fbd3929 100644
--- a/progs/openvg/trivial/star-nonzero.c
+++ b/progs/egl/openvg/trivial/star-nonzero.c
diff --git a/progs/openvg/trivial/star-oddeven.c b/progs/egl/openvg/trivial/star-oddeven.c
index 17311cf720..17311cf720 100644
--- a/progs/openvg/trivial/star-oddeven.c
+++ b/progs/egl/openvg/trivial/star-oddeven.c
diff --git a/progs/openvg/trivial/stroke.c b/progs/egl/openvg/trivial/stroke.c
index 58ae5b7bc8..58ae5b7bc8 100644
--- a/progs/openvg/trivial/stroke.c
+++ b/progs/egl/openvg/trivial/stroke.c
diff --git a/progs/openvg/trivial/stroke2.c b/progs/egl/openvg/trivial/stroke2.c
index ce950c1886..ce950c1886 100644
--- a/progs/openvg/trivial/stroke2.c
+++ b/progs/egl/openvg/trivial/stroke2.c
diff --git a/progs/openvg/trivial/vguarc.c b/progs/egl/openvg/trivial/vguarc.c
index 8d971d5c09..8d971d5c09 100644
--- a/progs/openvg/trivial/vguarc.c
+++ b/progs/egl/openvg/trivial/vguarc.c
diff --git a/progs/egl/xegl_tri.c b/progs/egl/xegl_tri.c
deleted file mode 100644
index 1f1a005a21..0000000000
--- a/progs/egl/xegl_tri.c
+++ /dev/null
@@ -1,361 +0,0 @@
-/*
- * Copyright (C) 2008 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * Draw a triangle with X/EGL.
- * Brian Paul
- * 3 June 2008
- */
-
-
-#include <assert.h>
-#include <math.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/keysym.h>
-#include <GL/gl.h> /* using full OpenGL for now */
-#include <GLES/egl.h>
-
-
-static GLfloat view_rotx = 0.0, view_roty = 0.0, view_rotz = 0.0;
-
-
-static void
-draw(void)
-{
- static const GLfloat verts[3][2] = {
- { -1, -1 },
- { 1, -1 },
- { 0, 1 }
- };
- static const GLfloat colors[3][3] = {
- { 1, 0, 0 },
- { 0, 1, 0 },
- { 0, 0, 1 }
- };
-
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- glPushMatrix();
- glRotatef(view_rotx, 1, 0, 0);
- glRotatef(view_roty, 0, 1, 0);
- glRotatef(view_rotz, 0, 0, 1);
-
- {
- glVertexPointer(2, GL_FLOAT, 0, verts);
- glColorPointer(3, GL_FLOAT, 0, colors);
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_COLOR_ARRAY);
-
- glDrawArrays(GL_TRIANGLES, 0, 3);
-
- glDisableClientState(GL_VERTEX_ARRAY);
- glDisableClientState(GL_COLOR_ARRAY);
- }
-
- glPopMatrix();
-}
-
-
-/* new window size or exposure */
-static void
-reshape(int width, int height)
-{
- GLfloat ar = (GLfloat) width / (GLfloat) height;
-
- glViewport(0, 0, (GLint) width, (GLint) height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustum(-ar, ar, -1, 1, 5.0, 60.0);
-
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef(0.0, 0.0, -10.0);
-}
-
-
-static void
-init(void)
-{
- glClearColor(0.4, 0.4, 0.4, 0.0);
-}
-
-
-/*
- * Create an RGB, double-buffered X window.
- * Return the window and context handles.
- */
-static void
-make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
- const char *name,
- int x, int y, int width, int height,
- Window *winRet,
- EGLContext *ctxRet,
- EGLSurface *surfRet)
-{
- static const EGLint attribs[] = {
- EGL_RED_SIZE, 1,
- EGL_GREEN_SIZE, 1,
- EGL_BLUE_SIZE, 1,
- EGL_DEPTH_SIZE, 1,
- EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
- EGL_NONE
- };
-
- int scrnum;
- XSetWindowAttributes attr;
- unsigned long mask;
- Window root;
- Window win;
- XVisualInfo *visInfo, visTemplate;
- int num_visuals;
- EGLContext ctx;
- EGLConfig config;
- EGLint num_configs;
- EGLint vid;
-
- scrnum = DefaultScreen( x_dpy );
- root = RootWindow( x_dpy, scrnum );
-
- if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs) ||
- !num_configs) {
- printf("Error: couldn't get an EGL visual config\n");
- exit(1);
- }
-
- assert(config);
- assert(num_configs > 0);
-
- if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
- printf("Error: eglGetConfigAttrib() failed\n");
- exit(1);
- }
-
- /* The X window visual must match the EGL config */
- visTemplate.visualid = vid;
- visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
- if (!visInfo) {
- printf("Error: couldn't get X visual\n");
- exit(1);
- }
-
- /* window attributes */
- attr.background_pixel = 0;
- attr.border_pixel = 0;
- attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
- attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
- mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
-
- win = XCreateWindow( x_dpy, root, 0, 0, width, height,
- 0, visInfo->depth, InputOutput,
- visInfo->visual, mask, &attr );
-
- /* set hints and properties */
- {
- XSizeHints sizehints;
- sizehints.x = x;
- sizehints.y = y;
- sizehints.width = width;
- sizehints.height = height;
- sizehints.flags = USSize | USPosition;
- XSetNormalHints(x_dpy, win, &sizehints);
- XSetStandardProperties(x_dpy, win, name, name,
- None, (char **)NULL, 0, &sizehints);
- }
-
- eglBindAPI(EGL_OPENGL_API);
-
- ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
- if (!ctx) {
- printf("Error: glXCreateContext failed\n");
- exit(1);
- }
-
- *surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
-
- if (!*surfRet) {
- printf("Error: eglCreateWindowSurface failed\n");
- exit(1);
- }
-
- XFree(visInfo);
-
- *winRet = win;
- *ctxRet = ctx;
-}
-
-
-static void
-event_loop(Display *dpy, Window win,
- EGLDisplay egl_dpy, EGLSurface egl_surf)
-{
- while (1) {
- int redraw = 0;
- XEvent event;
-
- XNextEvent(dpy, &event);
-
- switch (event.type) {
- case Expose:
- redraw = 1;
- break;
- case ConfigureNotify:
- reshape(event.xconfigure.width, event.xconfigure.height);
- break;
- case KeyPress:
- {
- char buffer[10];
- int r, code;
- code = XLookupKeysym(&event.xkey, 0);
- if (code == XK_Left) {
- view_roty += 5.0;
- }
- else if (code == XK_Right) {
- view_roty -= 5.0;
- }
- else if (code == XK_Up) {
- view_rotx += 5.0;
- }
- else if (code == XK_Down) {
- view_rotx -= 5.0;
- }
- else {
- r = XLookupString(&event.xkey, buffer, sizeof(buffer),
- NULL, NULL);
- if (buffer[0] == 27) {
- /* escape */
- return;
- }
- }
- }
- redraw = 1;
- break;
- default:
- ; /*no-op*/
- }
-
- if (redraw) {
- draw();
- eglSwapBuffers(egl_dpy, egl_surf);
- }
- }
-}
-
-
-static void
-usage(void)
-{
- printf("Usage:\n");
- printf(" -display <displayname> set the display to run on\n");
- printf(" -info display OpenGL renderer info\n");
-}
-
-
-int
-main(int argc, char *argv[])
-{
- const int winWidth = 300, winHeight = 300;
- Display *x_dpy;
- Window win;
- EGLSurface egl_surf;
- EGLContext egl_ctx;
- EGLDisplay egl_dpy;
- char *dpyName = NULL;
- GLboolean printInfo = GL_FALSE;
- EGLint egl_major, egl_minor;
- int i;
- const char *s;
-
- for (i = 1; i < argc; i++) {
- if (strcmp(argv[i], "-display") == 0) {
- dpyName = argv[i+1];
- i++;
- }
- else if (strcmp(argv[i], "-info") == 0) {
- printInfo = GL_TRUE;
- }
- else {
- usage();
- return -1;
- }
- }
-
- x_dpy = XOpenDisplay(dpyName);
- if (!x_dpy) {
- printf("Error: couldn't open display %s\n",
- dpyName ? dpyName : getenv("DISPLAY"));
- return -1;
- }
-
- egl_dpy = eglGetDisplay(x_dpy);
- if (!egl_dpy) {
- printf("Error: eglGetDisplay() failed\n");
- return -1;
- }
-
- if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
- printf("Error: eglInitialize() failed\n");
- return -1;
- }
-
- s = eglQueryString(egl_dpy, EGL_VERSION);
- printf("EGL_VERSION = %s\n", s);
-
- make_x_window(x_dpy, egl_dpy,
- "xegl_tri", 0, 0, winWidth, winHeight,
- &win, &egl_ctx, &egl_surf);
-
- XMapWindow(x_dpy, win);
- if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
- printf("Error: eglMakeCurrent() failed\n");
- return -1;
- }
-
- if (printInfo) {
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
- printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
- printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
- }
-
- init();
-
- /* Set initial projection/viewing transformation.
- * We can't be sure we'll get a ConfigureNotify event when the window
- * first appears.
- */
- reshape(winWidth, winHeight);
-
- event_loop(x_dpy, win, egl_dpy, egl_surf);
-
- eglDestroyContext(egl_dpy, egl_ctx);
- eglDestroySurface(egl_dpy, egl_surf);
- eglTerminate(egl_dpy);
-
-
- XDestroyWindow(x_dpy, win);
- XCloseDisplay(x_dpy);
-
- return 0;
-}
diff --git a/progs/es1/.gitignore b/progs/es1/.gitignore
deleted file mode 100644
index 5e29a6b5fa..0000000000
--- a/progs/es1/.gitignore
+++ /dev/null
@@ -1,11 +0,0 @@
-screen/gears
-screen/tri
-xegl/bindtex
-xegl/drawtex
-xegl/es1_info
-xegl/msaa
-xegl/pbuffer
-xegl/render_tex
-xegl/torus
-xegl/tri
-xegl/two_win
diff --git a/progs/es1/screen/Makefile b/progs/es1/screen/Makefile
deleted file mode 100644
index 4ba2f9a7dc..0000000000
--- a/progs/es1/screen/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-# progs/es1/screen/Makefile
-
-TOP = ../../..
-include $(TOP)/configs/current
-
-ES1_CFLAGS = -I$(TOP)/include
-ES1_LIBS = -L$(TOP)/$(LIB_DIR) -lEGL -lGLESv1_CM
-
-ES1_LIB_DEPS = \
- $(TOP)/$(LIB_DIR)/libEGL.so \
- $(TOP)/$(LIB_DIR)/libGLESv1_CM.so
-
-WINSYS_OBJS = winsys.o
-
-PROGRAMS = \
- gears \
- tri
-
-.c.o:
- $(CC) -c $(ES1_CFLAGS) $(CFLAGS) $< -o $@
-
-default: $(PROGRAMS)
-
-gears: gears.o $(WINSYS_OBJS) $(ES1_LIB_DEPS)
- $(CC) $(CFLAGS) -o $@ $@.o $(WINSYS_OBJS) $(ES1_LIBS)
-
-tri: tri.o $(WINSYS_OBJS) $(ES1_LIB_DEPS)
- $(CC) $(CFLAGS) -o $@ $@.o $(WINSYS_OBJS) $(ES1_LIBS)
-
-clean:
- -rm -f *.o *~
- -rm -f $(PROGRAMS)
diff --git a/progs/es1/screen/winsys.c b/progs/es1/screen/winsys.c
deleted file mode 100644
index 84d00471eb..0000000000
--- a/progs/es1/screen/winsys.c
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * Copyright (C) 2009 Chia-I Wu <olv@0xlab.org>
- *
- * Based on eglgears by
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <sys/time.h>
-
-#define EGL_EGLEXT_PROTOTYPES
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-
-#include "winsys.h"
-
-#define MAX_MODES 100
-
-static struct {
- EGLBoolean verbose;
-
- EGLDisplay dpy;
- EGLConfig conf;
-
- EGLScreenMESA screen;
- EGLModeMESA mode;
- EGLint width, height;
-
- EGLContext ctx;
- EGLSurface surf;
-} screen;
-
-
-static EGLBoolean
-init_screen(void)
-{
- EGLModeMESA modes[MAX_MODES];
- EGLint num_screens, num_modes;
- EGLint width, height, best_mode;
- EGLint i;
-
- if (!eglGetScreensMESA(screen.dpy, &screen.screen, 1, &num_screens) ||
- !num_screens) {
- printf("eglGetScreensMESA failed\n");
- return EGL_FALSE;
- }
-
- if (!eglGetModesMESA(screen.dpy, screen.screen, modes, MAX_MODES,
- &num_modes) ||
- !num_modes) {
- printf("eglGetModesMESA failed!\n");
- return EGL_FALSE;
- }
-
- printf("Found %d modes:\n", num_modes);
-
- best_mode = 0;
- width = 0;
- height = 0;
- for (i = 0; i < num_modes; i++) {
- EGLint w, h;
- eglGetModeAttribMESA(screen.dpy, modes[i], EGL_WIDTH, &w);
- eglGetModeAttribMESA(screen.dpy, modes[i], EGL_HEIGHT, &h);
- printf("%3d: %d x %d\n", i, w, h);
- if (w > width && h > height) {
- width = w;
- height = h;
- best_mode = i;
- }
- }
-
- screen.mode = modes[best_mode];
- screen.width = width;
- screen.height = height;
-
- return EGL_TRUE;
-}
-
-
-static EGLBoolean
-init_display(void)
-{
- EGLint maj, min;
- const char *exts;
- const EGLint attribs[] = {
- EGL_SURFACE_TYPE, 0x0, /* should be EGL_SCREEN_BIT_MESA */
- EGL_RENDERABLE_TYPE, 0x0, /* should be EGL_OPENGL_ES_BIT */
- EGL_NONE
- };
- EGLint num_configs;
-
- screen.dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- if (!screen.dpy) {
- printf("eglGetDisplay failed\n");
- return EGL_FALSE;
- }
-
- if (!eglInitialize(screen.dpy, &maj, &min)) {
- printf("eglInitialize failed\n");
- return EGL_FALSE;
- }
-
- printf("EGL_VERSION = %s\n", eglQueryString(screen.dpy, EGL_VERSION));
- printf("EGL_VENDOR = %s\n", eglQueryString(screen.dpy, EGL_VENDOR));
-
- exts = eglQueryString(screen.dpy, EGL_EXTENSIONS);
- assert(exts);
-
- if (!strstr(exts, "EGL_MESA_screen_surface")) {
- printf("EGL_MESA_screen_surface is not supported\n");
- return EGL_FALSE;
- }
-
- if (!eglChooseConfig(screen.dpy, attribs, &screen.conf, 1,
- &num_configs) ||
- !num_configs) {
- printf("eglChooseConfig failed\n");
- return EGL_FALSE;
- }
-
- return EGL_TRUE;
-}
-
-
-EGLBoolean
-winsysInitScreen(void)
-{
- EGLint surf_attribs[20];
- EGLint i;
- EGLBoolean ok;
-
- if (!init_display())
- goto fail;
- if (!init_screen())
- goto fail;
-
- /* create context */
- screen.ctx = eglCreateContext(screen.dpy, screen.conf,
- EGL_NO_CONTEXT, NULL);
- if (screen.ctx == EGL_NO_CONTEXT) {
- printf("eglCreateContext failed\n");
- goto fail;
- }
-
- i = 0;
- surf_attribs[i++] = EGL_WIDTH;
- surf_attribs[i++] = screen.width;
- surf_attribs[i++] = EGL_HEIGHT;
- surf_attribs[i++] = screen.height;
- surf_attribs[i++] = EGL_NONE;
-
- /* create surface */
- printf("Using screen size: %d x %d\n", screen.width, screen.height);
- screen.surf = eglCreateScreenSurfaceMESA(screen.dpy, screen.conf,
- surf_attribs);
- if (screen.surf == EGL_NO_SURFACE) {
- printf("eglCreateScreenSurfaceMESA failed\n");
- goto fail;
- }
-
- ok = eglMakeCurrent(screen.dpy, screen.surf, screen.surf, screen.ctx);
- if (!ok) {
- printf("eglMakeCurrent failed\n");
- goto fail;
- }
-
- ok = eglShowScreenSurfaceMESA(screen.dpy, screen.screen,
- screen.surf, screen.mode);
- if (!ok) {
- printf("eglShowScreenSurfaceMESA failed\n");
- goto fail;
- }
-
- return EGL_TRUE;
-
-fail:
- winsysFiniScreen();
- return EGL_FALSE;
-}
-
-
-EGLBoolean
-winsysQueryScreenSize(EGLint *width, EGLint *height)
-{
- if (!screen.dpy)
- return EGL_FALSE;
-
- if (width)
- *width = screen.width;
- if (height)
- *height = screen.height;
-
- return EGL_TRUE;
-}
-
-
-void
-winsysFiniScreen(void)
-{
- if (screen.dpy) {
- eglMakeCurrent(screen.dpy, EGL_NO_SURFACE, EGL_NO_SURFACE,
- EGL_NO_CONTEXT);
- if (screen.surf != EGL_NO_SURFACE)
- eglDestroySurface(screen.dpy, screen.surf);
- if (screen.ctx != EGL_NO_CONTEXT)
- eglDestroyContext(screen.dpy, screen.ctx);
- eglTerminate(screen.dpy);
-
- memset(&screen, 0, sizeof(screen));
- }
-}
-
-
-void
-winsysSwapBuffers(void)
-{
- eglSwapBuffers(screen.dpy, screen.surf);
-}
-
-
-/* return current time (in seconds) */
-double
-winsysNow(void)
-{
- struct timeval tv;
- gettimeofday(&tv, NULL);
- return (double) tv.tv_sec + tv.tv_usec / 1000000.0;
-}
-
-
-void
-winsysRun(double seconds, void (*draw_frame)(void *data), void *data)
-{
- double begin, end, last_frame, duration;
- EGLint num_frames = 0;
-
- begin = winsysNow();
- end = begin + seconds;
-
- last_frame = begin;
- while (last_frame < end) {
- draw_frame(data);
- winsysSwapBuffers();
- last_frame = winsysNow();
- num_frames++;
- }
-
- duration = last_frame - begin;
- printf("%d frames in %3.1f seconds = %6.3f FPS\n",
- num_frames, duration, (double) num_frames / duration);
-}
diff --git a/progs/es1/xegl/Makefile b/progs/es1/xegl/Makefile
deleted file mode 100644
index 6869c44306..0000000000
--- a/progs/es1/xegl/Makefile
+++ /dev/null
@@ -1,82 +0,0 @@
-# progs/es1/xegl/Makefile
-
-TOP = ../../..
-include $(TOP)/configs/current
-
-
-INCLUDE_DIRS = \
- -I$(TOP)/include \
-
-HEADERS = $(TOP)/include/GLES/egl.h
-
-
-ES1_LIB_DEPS = \
- $(TOP)/$(LIB_DIR)/libEGL.so \
- $(TOP)/$(LIB_DIR)/libGLESv1_CM.so
-
-
-ES1_LIBS = \
- -L$(TOP)/$(LIB_DIR) -lEGL \
- -L$(TOP)/$(LIB_DIR) -lGLESv1_CM $(LIBDRM_LIB) -lX11
-
-PROGRAMS = \
- bindtex \
- drawtex \
- es1_info \
- msaa \
- pbuffer \
- render_tex \
- torus \
- tri \
- two_win
-
-
-.c.o:
- $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
-
-
-
-default: $(PROGRAMS)
-
-
-
-bindtex: bindtex.o $(ES1_LIB_DEPS)
- $(CC) $(CFLAGS) bindtex.o $(ES1_LIBS) -o $@
-
-
-drawtex: drawtex.o $(ES1_LIB_DEPS)
- $(CC) $(CFLAGS) drawtex.o $(ES1_LIBS) -o $@
-
-
-es1_info: es1_info.o $(ES1_LIB_DEPS)
- $(CC) $(CFLAGS) es1_info.o $(ES1_LIBS) -o $@
-
-
-msaa: msaa.o $(ES1_LIB_DEPS)
- $(CC) $(CFLAGS) msaa.o $(ES1_LIBS) -o $@
-
-
-pbuffer: pbuffer.o $(ES1_LIB_DEPS)
- $(CC) $(CFLAGS) pbuffer.o $(ES1_LIBS) -o $@
-
-
-render_tex: render_tex.o $(ES1_LIB_DEPS)
- $(CC) $(CFLAGS) render_tex.o $(ES1_LIBS) -o $@
-
-
-torus: torus.o $(ES1_LIB_DEPS)
- $(CC) $(CFLAGS) torus.o $(ES1_LIBS) -o $@
-
-
-two_win: two_win.o $(ES1_LIB_DEPS)
- $(CC) $(CFLAGS) two_win.o $(ES1_LIBS) -o $@
-
-
-tri: tri.o $(ES1_LIB_DEPS)
- $(CC) $(CFLAGS) tri.o $(ES1_LIBS) -o $@
-
-
-clean:
- rm -f *.o *~
- rm -f $(PROGRAMS)
-
diff --git a/progs/es1/xegl/tri.c b/progs/es1/xegl/tri.c
deleted file mode 100644
index 42a978207c..0000000000
--- a/progs/es1/xegl/tri.c
+++ /dev/null
@@ -1,470 +0,0 @@
-/*
- * Copyright (C) 2008 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * Draw a triangle with X/EGL and OpenGL ES 1.x
- * Brian Paul
- * 5 June 2008
- */
-
-#define USE_FULL_GL 0
-
-#define USE_FIXED_POINT 0
-
-
-#include <assert.h>
-#include <math.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/keysym.h>
-#if USE_FULL_GL
-#include <GL/gl.h> /* use full OpenGL */
-#else
-#include <GLES/gl.h> /* use OpenGL ES 1.x */
-#include <GLES/glext.h>
-#endif
-#include <EGL/egl.h>
-
-
-#define FLOAT_TO_FIXED(X) ((X) * 65535.0)
-
-
-
-static GLfloat view_rotx = 0.0, view_roty = 0.0, view_rotz = 0.0;
-
-
-static void
-draw(void)
-{
-#if USE_FIXED_POINT
- static const GLfixed verts[3][2] = {
- { -65536, -65536 },
- { 65536, -65536 },
- { 0, 65536 }
- };
- static const GLfixed colors[3][4] = {
- { 65536, 0, 0, 65536 },
- { 0, 65536, 0 , 65536},
- { 0, 0, 65536 , 65536}
- };
-#else
- static const GLfloat verts[3][2] = {
- { -1, -1 },
- { 1, -1 },
- { 0, 1 }
- };
- static const GLfloat colors[3][4] = {
- { 1, 0, 0, 1 },
- { 0, 1, 0, 1 },
- { 0, 0, 1, 1 }
- };
-#endif
-
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- glPushMatrix();
- glRotatef(view_rotx, 1, 0, 0);
- glRotatef(view_roty, 0, 1, 0);
- glRotatef(view_rotz, 0, 0, 1);
-
- {
-#if USE_FIXED_POINT
- glVertexPointer(2, GL_FIXED, 0, verts);
- glColorPointer(4, GL_FIXED, 0, colors);
-#else
- glVertexPointer(2, GL_FLOAT, 0, verts);
- glColorPointer(4, GL_FLOAT, 0, colors);
-#endif
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_COLOR_ARRAY);
-
- /* draw triangle */
- glDrawArrays(GL_TRIANGLES, 0, 3);
-
- /* draw some points */
- glPointSizex(FLOAT_TO_FIXED(15.5));
- glDrawArrays(GL_POINTS, 0, 3);
-
- glDisableClientState(GL_VERTEX_ARRAY);
- glDisableClientState(GL_COLOR_ARRAY);
- }
-
- if (0) {
- /* test code */
- GLfixed size;
- glGetFixedv(GL_POINT_SIZE, &size);
- printf("GL_POINT_SIZE = 0x%x %f\n", size, size / 65536.0);
- }
-
- glPopMatrix();
-}
-
-
-/* new window size or exposure */
-static void
-reshape(int width, int height)
-{
- GLfloat ar = (GLfloat) width / (GLfloat) height;
-
- glViewport(0, 0, (GLint) width, (GLint) height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
-#ifdef GL_VERSION_ES_CM_1_0
- glFrustumf(-ar, ar, -1, 1, 5.0, 60.0);
-#else
- glFrustum(-ar, ar, -1, 1, 5.0, 60.0);
-#endif
-
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef(0.0, 0.0, -10.0);
-}
-
-
-static void
-test_query_matrix(void)
-{
- PFNGLQUERYMATRIXXOESPROC procQueryMatrixx;
- typedef void (*voidproc)();
- GLfixed mantissa[16];
- GLint exponent[16];
- GLbitfield rv;
- int i;
-
- procQueryMatrixx = (PFNGLQUERYMATRIXXOESPROC) eglGetProcAddress("glQueryMatrixxOES");
- assert(procQueryMatrixx);
- /* Actually try out this one */
- rv = (*procQueryMatrixx)(mantissa, exponent);
- for (i = 0; i < 16; i++) {
- if (rv & (1<<i)) {
- printf("matrix[%d] invalid\n", i);
- }
- else {
- printf("matrix[%d] = %f * 2^(%d)\n", i, mantissa[i]/65536.0, exponent[i]);
- }
- }
- assert(!eglGetProcAddress("glFoo"));
-}
-
-
-static void
-init(void)
-{
- glClearColor(0.4, 0.4, 0.4, 0.0);
-
- if (0)
- test_query_matrix();
-}
-
-
-/*
- * Create an RGB, double-buffered X window.
- * Return the window and context handles.
- */
-static void
-make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
- const char *name,
- int x, int y, int width, int height,
- Window *winRet,
- EGLContext *ctxRet,
- EGLSurface *surfRet)
-{
- static const EGLint attribs[] = {
- EGL_RED_SIZE, 1,
- EGL_GREEN_SIZE, 1,
- EGL_BLUE_SIZE, 1,
- EGL_DEPTH_SIZE, 1,
- EGL_NONE
- };
-
- int scrnum;
- XSetWindowAttributes attr;
- unsigned long mask;
- Window root;
- Window win;
- XVisualInfo *visInfo, visTemplate;
- int num_visuals;
- EGLContext ctx;
- EGLConfig config;
- EGLint num_configs;
- EGLint vid;
-
- scrnum = DefaultScreen( x_dpy );
- root = RootWindow( x_dpy, scrnum );
-
- if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
- printf("Error: couldn't get an EGL visual config\n");
- exit(1);
- }
-
- assert(config);
- assert(num_configs > 0);
-
- if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
- printf("Error: eglGetConfigAttrib() failed\n");
- exit(1);
- }
-
- /* The X window visual must match the EGL config */
- visTemplate.visualid = vid;
- visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
- if (!visInfo) {
- printf("Error: couldn't get X visual\n");
- exit(1);
- }
-
- /* window attributes */
- attr.background_pixel = 0;
- attr.border_pixel = 0;
- attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
- attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
- mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
-
- win = XCreateWindow( x_dpy, root, 0, 0, width, height,
- 0, visInfo->depth, InputOutput,
- visInfo->visual, mask, &attr );
-
- /* set hints and properties */
- {
- XSizeHints sizehints;
- sizehints.x = x;
- sizehints.y = y;
- sizehints.width = width;
- sizehints.height = height;
- sizehints.flags = USSize | USPosition;
- XSetNormalHints(x_dpy, win, &sizehints);
- XSetStandardProperties(x_dpy, win, name, name,
- None, (char **)NULL, 0, &sizehints);
- }
-
-#if USE_FULL_GL
- eglBindAPI(EGL_OPENGL_API);
-#else
- eglBindAPI(EGL_OPENGL_ES_API);
-#endif
-
- ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
- if (!ctx) {
- printf("Error: eglCreateContext failed\n");
- exit(1);
- }
-
- *surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
-
- if (!*surfRet) {
- printf("Error: eglCreateWindowSurface failed\n");
- exit(1);
- }
-
- XFree(visInfo);
-
- *winRet = win;
- *ctxRet = ctx;
-}
-
-
-static void
-event_loop(Display *dpy, Window win,
- EGLDisplay egl_dpy, EGLSurface egl_surf)
-{
- while (1) {
- int redraw = 0;
- XEvent event;
-
- XNextEvent(dpy, &event);
-
- switch (event.type) {
- case Expose:
- redraw = 1;
- break;
- case ConfigureNotify:
- reshape(event.xconfigure.width, event.xconfigure.height);
- break;
- case KeyPress:
- {
- char buffer[10];
- int r, code;
- code = XLookupKeysym(&event.xkey, 0);
- if (code == XK_Left) {
- view_roty += 5.0;
- }
- else if (code == XK_Right) {
- view_roty -= 5.0;
- }
- else if (code == XK_Up) {
- view_rotx += 5.0;
- }
- else if (code == XK_Down) {
- view_rotx -= 5.0;
- }
- else {
- r = XLookupString(&event.xkey, buffer, sizeof(buffer),
- NULL, NULL);
- if (buffer[0] == 27) {
- /* escape */
- return;
- }
- }
- }
- redraw = 1;
- break;
- default:
- ; /*no-op*/
- }
-
- if (redraw) {
- draw();
- eglSwapBuffers(egl_dpy, egl_surf);
- }
- }
-}
-
-
-static void
-usage(void)
-{
- printf("Usage:\n");
- printf(" -display <displayname> set the display to run on\n");
- printf(" -info display OpenGL renderer info\n");
-}
-
-
-int
-main(int argc, char *argv[])
-{
- const int winWidth = 300, winHeight = 300;
- Display *x_dpy;
- Window win;
- EGLSurface egl_surf;
- EGLContext egl_ctx;
- EGLDisplay egl_dpy;
- char *dpyName = NULL;
- GLboolean printInfo = GL_FALSE;
- EGLint egl_major, egl_minor;
- int i;
- const char *s;
-
- static struct {
- char *name;
- GLenum value;
- enum {GetString, GetInteger} type;
- } info_items[] = {
- {"GL_RENDERER", GL_RENDERER, GetString},
- {"GL_VERSION", GL_VERSION, GetString},
- {"GL_VENDOR", GL_VENDOR, GetString},
- {"GL_EXTENSIONS", GL_EXTENSIONS, GetString},
- {"GL_MAX_PALETTE_MATRICES_OES", GL_MAX_PALETTE_MATRICES_OES, GetInteger},
- {"GL_MAX_VERTEX_UNITS_OES", GL_MAX_VERTEX_UNITS_OES, GetInteger},
- };
-
- for (i = 1; i < argc; i++) {
- if (strcmp(argv[i], "-display") == 0) {
- dpyName = argv[i+1];
- i++;
- }
- else if (strcmp(argv[i], "-info") == 0) {
- printInfo = GL_TRUE;
- }
- else {
- usage();
- return -1;
- }
- }
-
- x_dpy = XOpenDisplay(dpyName);
- if (!x_dpy) {
- printf("Error: couldn't open display %s\n",
- dpyName ? dpyName : getenv("DISPLAY"));
- return -1;
- }
-
- egl_dpy = eglGetDisplay(x_dpy);
- if (!egl_dpy) {
- printf("Error: eglGetDisplay() failed\n");
- return -1;
- }
-
- if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
- printf("Error: eglInitialize() failed\n");
- return -1;
- }
-
- s = eglQueryString(egl_dpy, EGL_VERSION);
- printf("EGL_VERSION = %s\n", s);
-
- s = eglQueryString(egl_dpy, EGL_VENDOR);
- printf("EGL_VENDOR = %s\n", s);
-
- s = eglQueryString(egl_dpy, EGL_EXTENSIONS);
- printf("EGL_EXTENSIONS = %s\n", s);
-
- s = eglQueryString(egl_dpy, EGL_CLIENT_APIS);
- printf("EGL_CLIENT_APIS = %s\n", s);
-
- make_x_window(x_dpy, egl_dpy,
- "OpenGL ES 1.x tri", 0, 0, winWidth, winHeight,
- &win, &egl_ctx, &egl_surf);
-
- XMapWindow(x_dpy, win);
- if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
- printf("Error: eglMakeCurrent() failed\n");
- return -1;
- }
-
- if (printInfo) {
- for (i = 0; i < sizeof(info_items)/sizeof(info_items[0]); i++) {
- switch (info_items[i].type) {
- case GetString:
- printf("%s = %s\n", info_items[i].name, (char *)glGetString(info_items[i].value));
- break;
- case GetInteger: {
- GLint rv = -1;
- glGetIntegerv(info_items[i].value, &rv);
- printf("%s = %d\n", info_items[i].name, rv);
- break;
- }
- }
- }
- };
- init();
-
- /* Set initial projection/viewing transformation.
- * We can't be sure we'll get a ConfigureNotify event when the window
- * first appears.
- */
- reshape(winWidth, winHeight);
-
- event_loop(x_dpy, win, egl_dpy, egl_surf);
-
- eglDestroyContext(egl_dpy, egl_ctx);
- eglDestroySurface(egl_dpy, egl_surf);
- eglTerminate(egl_dpy);
-
-
- XDestroyWindow(x_dpy, win);
- XCloseDisplay(x_dpy);
-
- return 0;
-}
diff --git a/progs/es2/.gitignore b/progs/es2/.gitignore
deleted file mode 100644
index 7d5c16936c..0000000000
--- a/progs/es2/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-xegl/es2_info.c
-xegl/es2_info
-xegl/tri
diff --git a/progs/fpglsl/dowhile.glsl b/progs/fpglsl/dowhile.glsl
new file mode 100644
index 0000000000..ed9d729675
--- /dev/null
+++ b/progs/fpglsl/dowhile.glsl
@@ -0,0 +1,8 @@
+void main() {
+ float sum = 0.0;
+ do {
+ sum += 0.1;
+ break;
+ } while (true);
+ gl_FragColor = vec4(sum);
+}
diff --git a/progs/fpglsl/dowhile2.glsl b/progs/fpglsl/dowhile2.glsl
new file mode 100644
index 0000000000..f3e00b8e86
--- /dev/null
+++ b/progs/fpglsl/dowhile2.glsl
@@ -0,0 +1,10 @@
+void main() {
+ float sum = 0.0;
+ do {
+ sum += 0.1;
+ if (sum < 0.499999)
+ continue;
+ break;
+ } while (true);
+ gl_FragColor = vec4(sum);
+}
diff --git a/progs/fpglsl/for.glsl b/progs/fpglsl/for.glsl
new file mode 100644
index 0000000000..862ca8bd6c
--- /dev/null
+++ b/progs/fpglsl/for.glsl
@@ -0,0 +1,11 @@
+uniform int KernelSizeInt;
+
+void main() {
+ int i;
+ vec4 sum = vec4(0.0);
+ for (i = 0; i < KernelSizeInt; ++i) {
+ sum.g += 0.25;
+ }
+ sum.a = 1.0;
+ gl_FragColor = sum;
+}
diff --git a/progs/fpglsl/forbreak.glsl b/progs/fpglsl/forbreak.glsl
new file mode 100644
index 0000000000..0b8d957cb0
--- /dev/null
+++ b/progs/fpglsl/forbreak.glsl
@@ -0,0 +1,13 @@
+uniform int KernelSizeInt;
+
+void main() {
+ int i;
+ vec4 sum = vec4(0.0);
+ for (i = 0; i < KernelSizeInt; ++i) {
+ sum.g += 0.25;
+ if (i > 0)
+ break;
+ }
+ sum.a = 1.0;
+ gl_FragColor = sum;
+}
diff --git a/progs/fpglsl/fp-tri.c b/progs/fpglsl/fp-tri.c
index c9b08fbbad..8af09845dd 100644
--- a/progs/fpglsl/fp-tri.c
+++ b/progs/fpglsl/fp-tri.c
@@ -129,6 +129,11 @@ static void setup_uniforms()
}
{
+ GLint loci = glGetUniformLocationARB(program, "KernelSizeInt");
+ if (loci >= 0)
+ glUniform1i(loci, 4);
+ }
+ {
GLint loc1f = glGetUniformLocationARB(program, "KernelValue1f");
GLint loc2f = glGetUniformLocationARB(program, "KernelValue2f");
GLint loc4f = glGetUniformLocationARB(program, "KernelValue4f");
diff --git a/progs/fpglsl/simpleif.glsl b/progs/fpglsl/simpleif.glsl
new file mode 100644
index 0000000000..922421b410
--- /dev/null
+++ b/progs/fpglsl/simpleif.glsl
@@ -0,0 +1,6 @@
+void main() {
+ // this should always be true
+ if (gl_FragCoord.x >= 0.0) {
+ gl_FragColor = vec4(0.5, 0.0, 0.5, 1.0);
+ }
+}
diff --git a/progs/fpglsl/while.glsl b/progs/fpglsl/while.glsl
new file mode 100644
index 0000000000..05fb860ddc
--- /dev/null
+++ b/progs/fpglsl/while.glsl
@@ -0,0 +1,7 @@
+void main() {
+ float sum = 0.0;
+ while (sum < 0.499999) {
+ sum += 0.1;
+ }
+ gl_FragColor = vec4(sum);
+}
diff --git a/progs/fpglsl/while2.glsl b/progs/fpglsl/while2.glsl
new file mode 100644
index 0000000000..19c8904e28
--- /dev/null
+++ b/progs/fpglsl/while2.glsl
@@ -0,0 +1,9 @@
+void main() {
+ float sum = 0.0;
+ while (true) {
+ sum += 0.1;
+ if (sum > 0.8)
+ break;
+ }
+ gl_FragColor = vec4(sum);
+}
diff --git a/progs/gallium/python/retrace/interpreter.py b/progs/gallium/python/retrace/interpreter.py
index b30469dfae..1a96181255 100755
--- a/progs/gallium/python/retrace/interpreter.py
+++ b/progs/gallium/python/retrace/interpreter.py
@@ -551,7 +551,6 @@ class Context(Object):
data = vbuf.buffer.read()
values = unpack_from(format, data, offset)
sys.stdout.write('\t\t{' + ', '.join(map(str, values)) + '},\n')
- assert len(values) == velem.nr_components
sys.stdout.write('\t},\n')
sys.stdout.flush()
diff --git a/progs/gallium/python/samples/tri.py b/progs/gallium/python/samples/tri.py
index d7fbdb10ac..8cc272db81 100644
--- a/progs/gallium/python/samples/tri.py
+++ b/progs/gallium/python/samples/tri.py
@@ -30,19 +30,19 @@
from gallium import *
-def make_image(surface):
- data = surface.get_tile_rgba8(0, 0, surface.width, surface.height)
+def make_image(ctx, surface):
+ data = ctx.surface_read_rgba8(surface, 0, 0, surface.width, surface.height)
import Image
outimage = Image.fromstring('RGBA', (surface.width, surface.height), data, "raw", 'RGBA', 0, 1)
return outimage
-def save_image(filename, surface):
- outimage = make_image(surface)
+def save_image(ctx, surface, filename):
+ outimage = make_image(ctx, surface)
outimage.save(filename, "PNG")
-def show_image(surface):
- outimage = make_image(surface)
+def show_image(ctx, surface):
+ outimage = make_image(ctx, surface)
import Tkinter as tk
from PIL import Image, ImageTk
@@ -128,6 +128,7 @@ def test(dev):
scissor.maxy = height
ctx.set_scissor(scissor)
+ # clip
clip = Clip()
clip.nr = 0
ctx.set_clip(clip)
@@ -216,10 +217,10 @@ def test(dev):
ctx.flush()
- show_image(cbuf)
- #show_image(zbuf)
- #save_image('cbuf.png', cbuf)
- #save_image('zbuf.png', zbuf)
+ show_image(ctx, cbuf)
+ show_image(ctx, zbuf)
+ save_image(ctx, cbuf, 'cbuf.png')
+ save_image(ctx, zbuf, 'zbuf.png')
diff --git a/progs/gallium/python/tests/base.py b/progs/gallium/python/tests/base.py
index bd82f50811..d8cf84db36 100755
--- a/progs/gallium/python/tests/base.py
+++ b/progs/gallium/python/tests/base.py
@@ -43,18 +43,9 @@ from gallium import *
# Enumerate all pixel formats
formats = {}
for name, value in globals().items():
- if name.startswith("PIPE_FORMAT_") and isinstance(value, int):
+ if name.startswith("PIPE_FORMAT_") and isinstance(value, int) and name not in ("PIPE_FORMAT_NONE", "PIPE_FORMAT_COUNT"):
formats[value] = name
-def is_depth_stencil_format(format):
- # FIXME: make and use binding to util_format_is_depth_or_stencil
- return format in (
- PIPE_FORMAT_Z32_UNORM,
- PIPE_FORMAT_S8Z24_UNORM,
- PIPE_FORMAT_X8Z24_UNORM,
- PIPE_FORMAT_Z16_UNORM,
- )
-
def make_image(width, height, rgba):
import Image
outimage = Image.new(
@@ -125,18 +116,18 @@ class Test:
def run(self):
result = TestResult()
self._run(result)
- result.summary()
+ result.report()
- def assert_rgba(self, surface, x, y, w, h, expected_rgba, pixel_tol=4.0/256, surface_tol=0.85):
+ def assert_rgba(self, ctx, surface, x, y, w, h, expected_rgba, pixel_tol=4.0/256, surface_tol=0.85):
total = h*w
- different = surface.compare_tile_rgba(x, y, w, h, expected_rgba, tol=pixel_tol)
+ different = ctx.surface_compare_rgba(surface, x, y, w, h, expected_rgba, tol=pixel_tol)
if different:
sys.stderr.write("%u out of %u pixels differ\n" % (different, total))
if float(total - different)/float(total) < surface_tol:
if 0:
rgba = FloatArray(h*w*4)
- surface.get_tile_rgba(x, y, w, h, rgba)
+ ctx.surface_read_rgba(surface, x, y, w, h, rgba)
show_image(w, h, Result=rgba, Expected=expected_rgba)
save_image(w, h, rgba, "result.png")
save_image(w, h, expected_rgba, "expected.png")
@@ -259,7 +250,7 @@ class TestResult:
sys.stdout.write("SKIP\n")
sys.stdout.flush()
self.skipped += 1
- #self.log_result(test, 'skip')
+ self.log_result(test, 'skip')
def test_failed(self, test):
sys.stdout.write("FAIL\n")
@@ -305,11 +296,16 @@ class TestResult:
self.rows.append(row)
- def summary(self):
+ def report(self):
sys.stdout.write("%u tests, %u passed, %u skipped, %u failed\n\n" % (self.tests, self.passed, self.skipped, self.failed))
sys.stdout.flush()
name, ext = os.path.splitext(os.path.basename(sys.argv[0]))
+
+ tree = self.report_tree(name)
+ self.report_junit(name, stdout=tree)
+
+ def report_tree(self, name):
filename = name + '.tsv'
stream = file(filename, 'wt')
@@ -320,6 +316,8 @@ class TestResult:
# rows
for row in self.rows:
+ if row[0] == 'skip':
+ continue
row += ['']*(len(self.names) - len(row))
stream.write('\t'.join(row) + '\n')
@@ -331,7 +329,7 @@ class TestResult:
import orngTree
except ImportError:
sys.stderr.write('Install Orange from http://www.ailab.si/orange/ for a classification tree.\n')
- return
+ return None
data = orange.ExampleTable(filename)
@@ -339,6 +337,63 @@ class TestResult:
orngTree.printTxt(tree, maxDepth=4)
- file(name+'.txt', 'wt').write(orngTree.dumpTree(tree))
+ text_tree = orngTree.dumpTree(tree)
+
+ file(name + '.txt', 'wt').write(text_tree)
orngTree.printDot(tree, fileName=name+'.dot', nodeShape='ellipse', leafShape='box')
+
+ return text_tree
+
+ def report_junit(self, name, stdout=None, stderr=None):
+ """Write test results in ANT's junit XML format, to use with Hudson CI.
+
+ See also:
+ - http://fisheye.hudson-ci.org/browse/Hudson/trunk/hudson/main/core/src/test/resources/hudson/tasks/junit
+ - http://www.junit.org/node/399
+ - http://wiki.apache.org/ant/Proposals/EnhancedTestReports
+ """
+
+ stream = file(name + '.xml', 'wt')
+
+ stream.write('<?xml version="1.0" encoding="UTF-8" ?>\n')
+ stream.write('<testsuite name="%s">\n' % self.escape_xml(name))
+ stream.write(' <properties>\n')
+ stream.write(' </properties>\n')
+
+ names = self.names[1:]
+
+ for row in self.rows:
+
+ test_name = ' '.join(['%s=%s' % pair for pair in zip(self.names[1:], row[1:])])
+
+ stream.write(' <testcase name="%s">\n' % (self.escape_xml(test_name)))
+
+ result = row[0]
+ if result == 'pass':
+ pass
+ elif result == 'skip':
+ stream.write(' <skipped/>\n')
+ else:
+ stream.write(' <failure/>\n')
+
+ stream.write(' </testcase>\n')
+
+ if stdout:
+ stream.write(' <system-out>%s</system-out>\n' % self.escape_xml(stdout))
+ if stderr:
+ stream.write(' <system-err>%s</system-err>\n' % self.escape_xml(stderr))
+
+ stream.write('</testsuite>\n')
+
+ stream.close()
+
+ def escape_xml(self, s):
+ '''Escape a XML string.'''
+ s = s.replace('&', '&amp;')
+ s = s.replace('<', '&lt;')
+ s = s.replace('>', '&gt;')
+ s = s.replace('"', '&quot;')
+ s = s.replace("'", '&apos;')
+ return s
+
diff --git a/progs/gallium/python/tests/surface_copy.py b/progs/gallium/python/tests/surface_copy.py
index a3f1b3e130..3eefa690bd 100755
--- a/progs/gallium/python/tests/surface_copy.py
+++ b/progs/gallium/python/tests/surface_copy.py
@@ -27,6 +27,9 @@
##########################################################################
+import os
+import random
+
from gallium import *
from base import *
@@ -56,6 +59,7 @@ class TextureTest(TestCase):
def test(self):
dev = self.dev
+ ctx = self.ctx
target = self.target
format = self.format
@@ -67,6 +71,14 @@ class TextureTest(TestCase):
level = self.level
zslice = self.zslice
+ tex_usage = PIPE_TEXTURE_USAGE_SAMPLER
+ geom_flags = 0
+ if not dev.is_format_supported(format, target, tex_usage, geom_flags):
+ raise TestSkip
+
+ if not dev.is_format_supported(format, target, tex_usage, geom_flags):
+ raise TestSkip
+
# textures
dst_texture = dev.texture_create(
target = target,
@@ -75,10 +87,8 @@ class TextureTest(TestCase):
height = height,
depth = depth,
last_level = last_level,
- tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET,
+ tex_usage = tex_usage,
)
- if dst_texture is None:
- raise TestSkip
dst_surface = dst_texture.get_surface(face = face, level = level, zslice = zslice)
@@ -94,60 +104,33 @@ class TextureTest(TestCase):
src_surface = src_texture.get_surface()
- x = 0
- y = 0
w = dst_surface.width
h = dst_surface.height
- # ???
- stride = pf_get_stride(texture->format, w)
- size = pf_get_nblocksy(texture->format) * stride
+ stride = util_format_get_stride(format, w)
+ size = util_format_get_nblocksy(format, h) * stride
src_raw = os.urandom(size)
- src_surface.put_tile_raw(0, 0, w, h, src_raw, stride)
+ ctx.surface_write_raw(src_surface, 0, 0, w, h, src_raw, stride)
- ctx = self.dev.context_create()
-
ctx.surface_copy(dst_surface, 0, 0,
src_surface, 0, 0, w, h)
- ctx.flush()
-
- dst_raw = dst_surface.get_tile_raw(0, 0, w, h)
+ dst_raw = ctx.surface_read_raw(dst_surface, 0, 0, w, h)
if dst_raw != src_raw:
raise TestFailure
-
def main():
dev = Device()
+ ctx = dev.context_create()
suite = TestSuite()
targets = [
PIPE_TEXTURE_2D,
PIPE_TEXTURE_CUBE,
- #PIPE_TEXTURE_3D,
- ]
-
- formats = [
- PIPE_FORMAT_B8G8R8A8_UNORM,
- PIPE_FORMAT_B8G8R8X8_UNORM,
- PIPE_FORMAT_B8G8R8A8_SRGB,
- PIPE_FORMAT_B5G6R5_UNORM,
- PIPE_FORMAT_B5G5R5A1_UNORM,
- PIPE_FORMAT_B4G4R4A4_UNORM,
- PIPE_FORMAT_Z32_UNORM,
- PIPE_FORMAT_S8Z24_UNORM,
- PIPE_FORMAT_X8Z24_UNORM,
- PIPE_FORMAT_Z16_UNORM,
- PIPE_FORMAT_S8_UNORM,
- PIPE_FORMAT_A8_UNORM,
- PIPE_FORMAT_L8_UNORM,
- PIPE_FORMAT_DXT1_RGB,
- PIPE_FORMAT_DXT1_RGBA,
- PIPE_FORMAT_DXT3_RGBA,
- PIPE_FORMAT_DXT5_RGBA,
+ PIPE_TEXTURE_3D,
]
sizes = [64, 32, 16, 8, 4, 2, 1]
@@ -164,35 +147,52 @@ def main():
PIPE_TEX_FACE_NEG_Z,
]
- for target in targets:
- for format in formats:
- for size in sizes:
- if target == PIPE_TEXTURE_3D:
- depth = size
- else:
- depth = 1
- for face in faces:
- if target != PIPE_TEXTURE_CUBE and face:
- continue
- levels = lods(size)
- for last_level in range(levels):
- for level in range(0, last_level + 1):
- zslice = 0
- while zslice < depth >> level:
- test = TextureTest(
- dev = dev,
- target = target,
- format = format,
- width = size,
- height = size,
- depth = depth,
- last_level = last_level,
- face = face,
- level = level,
- zslice = zslice,
- )
- suite.add_test(test)
- zslice = (zslice + 1)*2 - 1
+ try:
+ n = int(sys.argv[1])
+ except:
+ n = 10000
+
+ for i in range(n):
+ format = random.choice(formats.keys())
+ if not util_format_is_depth_or_stencil(format):
+ is_depth_or_stencil = util_format_is_depth_or_stencil(format)
+
+ if is_depth_or_stencil:
+ target = PIPE_TEXTURE_2D
+ else:
+ target = random.choice(targets)
+
+ size = random.choice(sizes)
+
+ if target == PIPE_TEXTURE_3D:
+ depth = size
+ else:
+ depth = 1
+
+ if target == PIPE_TEXTURE_CUBE:
+ face = random.choice(faces)
+ else:
+ face = PIPE_TEX_FACE_POS_X
+
+ levels = lods(size)
+ last_level = random.randint(0, levels - 1)
+ level = random.randint(0, last_level)
+ zslice = random.randint(0, max(depth >> level, 1) - 1)
+
+ test = TextureTest(
+ dev = dev,
+ ctx = ctx,
+ target = target,
+ format = format,
+ width = size,
+ height = size,
+ depth = depth,
+ last_level = last_level,
+ face = face,
+ level = level,
+ zslice = zslice,
+ )
+ suite.add_test(test)
suite.run()
diff --git a/progs/gallium/python/tests/texture_sample.py b/progs/gallium/python/tests/texture_blit.py
index 49545c2e07..a68c081931 100755
--- a/progs/gallium/python/tests/texture_sample.py
+++ b/progs/gallium/python/tests/texture_blit.py
@@ -28,6 +28,8 @@
##########################################################################
+import random
+
from gallium import *
from base import *
@@ -115,6 +117,7 @@ class TextureColorSampleTest(TestCase):
def test(self):
dev = self.dev
+ ctx = self.ctx
target = self.target
format = self.format
@@ -125,6 +128,8 @@ class TextureColorSampleTest(TestCase):
face = self.face
level = self.level
zslice = self.zslice
+ minz = 0.0
+ maxz = 1.0
tex_usage = PIPE_TEXTURE_USAGE_SAMPLER
geom_flags = 0
@@ -136,8 +141,6 @@ class TextureColorSampleTest(TestCase):
if not dev.is_format_supported(format, target, tex_usage, geom_flags):
raise TestSkip
- ctx = self.dev.context_create()
-
# disabled blending/masking
blend = Blend()
blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE
@@ -155,7 +158,6 @@ class TextureColorSampleTest(TestCase):
rasterizer = Rasterizer()
rasterizer.front_winding = PIPE_WINDING_CW
rasterizer.cull_mode = PIPE_WINDING_NONE
- rasterizer.bypass_vs_clip_and_viewport = 1
ctx.set_rasterizer(rasterizer)
# samplers
@@ -183,14 +185,45 @@ class TextureColorSampleTest(TestCase):
)
expected_rgba = FloatArray(height*width*4)
- texture.get_surface(
+ surface = texture.get_surface(
face = face,
level = level,
zslice = zslice,
- ).sample_rgba(expected_rgba)
+ )
+
+ ctx.surface_sample_rgba(surface, expected_rgba, True)
ctx.set_fragment_sampler_texture(0, texture)
+ # viewport
+ viewport = Viewport()
+ scale = FloatArray(4)
+ scale[0] = width
+ scale[1] = height
+ scale[2] = (maxz - minz) / 2.0
+ scale[3] = 1.0
+ viewport.scale = scale
+ translate = FloatArray(4)
+ translate[0] = 0.0
+ translate[1] = 0.0
+ translate[2] = (maxz - minz) / 2.0
+ translate[3] = 0.0
+ viewport.translate = translate
+ ctx.set_viewport(viewport)
+
+ # scissor
+ scissor = Scissor()
+ scissor.minx = 0
+ scissor.miny = 0
+ scissor.maxx = width
+ scissor.maxy = height
+ ctx.set_scissor(scissor)
+
+ # clip
+ clip = Clip()
+ clip.nr = 0
+ ctx.set_clip(clip)
+
# framebuffer
cbuf_tex = dev.texture_create(
PIPE_FORMAT_B8G8R8A8_UNORM,
@@ -265,8 +298,8 @@ class TextureColorSampleTest(TestCase):
for i in range(0, 4):
j = 8*i
- verts[j + 0] = pos[i][0] # x
- verts[j + 1] = pos[i][1] # y
+ verts[j + 0] = pos[i][0]/float(width) # x
+ verts[j + 1] = pos[i][1]/float(height) # y
verts[j + 2] = 0.0 # z
verts[j + 3] = 1.0 # w
verts[j + 4] = tex[i][0] # s
@@ -283,7 +316,7 @@ class TextureColorSampleTest(TestCase):
cbuf = cbuf_tex.get_surface()
- self.assert_rgba(cbuf, x, y, w, h, expected_rgba, 4.0/256, 0.85)
+ self.assert_rgba(ctx, cbuf, x, y, w, h, expected_rgba, 4.0/256, 0.85)
class TextureDepthSampleTest(TestCase):
@@ -302,6 +335,7 @@ class TextureDepthSampleTest(TestCase):
def test(self):
dev = self.dev
+ ctx = self.ctx
target = self.target
format = self.format
@@ -312,6 +346,8 @@ class TextureDepthSampleTest(TestCase):
face = self.face
level = self.level
zslice = self.zslice
+ minz = 0.0
+ maxz = 1.0
tex_usage = PIPE_TEXTURE_USAGE_SAMPLER
geom_flags = 0
@@ -323,8 +359,6 @@ class TextureDepthSampleTest(TestCase):
if not dev.is_format_supported(format, target, tex_usage, geom_flags):
raise TestSkip
- ctx = self.dev.context_create()
-
# disabled blending/masking
blend = Blend()
blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE
@@ -345,9 +379,24 @@ class TextureDepthSampleTest(TestCase):
rasterizer = Rasterizer()
rasterizer.front_winding = PIPE_WINDING_CW
rasterizer.cull_mode = PIPE_WINDING_NONE
- rasterizer.bypass_vs_clip_and_viewport = 1
ctx.set_rasterizer(rasterizer)
+ # viewport
+ viewport = Viewport()
+ scale = FloatArray(4)
+ scale[0] = width
+ scale[1] = height
+ scale[2] = (maxz - minz) / 2.0
+ scale[3] = 1.0
+ viewport.scale = scale
+ translate = FloatArray(4)
+ translate[0] = 0.0
+ translate[1] = 0.0
+ translate[2] = (maxz - minz) / 2.0
+ translate[3] = 0.0
+ viewport.translate = translate
+ ctx.set_viewport(viewport)
+
# samplers
sampler = Sampler()
sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE
@@ -373,14 +422,29 @@ class TextureDepthSampleTest(TestCase):
)
expected_rgba = FloatArray(height*width*4)
- texture.get_surface(
+ surface = texture.get_surface(
face = face,
level = level,
zslice = zslice,
- ).sample_rgba(expected_rgba)
+ )
+
+ ctx.surface_sample_rgba(surface, expected_rgba, True)
ctx.set_fragment_sampler_texture(0, texture)
+ # scissor
+ scissor = Scissor()
+ scissor.minx = 0
+ scissor.miny = 0
+ scissor.maxx = width
+ scissor.maxy = height
+ ctx.set_scissor(scissor)
+
+ # clip
+ clip = Clip()
+ clip.nr = 0
+ ctx.set_clip(clip)
+
# framebuffer
cbuf_tex = dev.texture_create(
PIPE_FORMAT_B8G8R8A8_UNORM,
@@ -464,8 +528,8 @@ class TextureDepthSampleTest(TestCase):
for i in range(0, 4):
j = 8*i
- verts[j + 0] = pos[i][0] # x
- verts[j + 1] = pos[i][1] # y
+ verts[j + 0] = pos[i][0]/float(width) # x
+ verts[j + 1] = pos[i][1]/float(height) # y
verts[j + 2] = 0.0 # z
verts[j + 3] = 1.0 # w
verts[j + 4] = tex[i][0] # s
@@ -482,13 +546,16 @@ class TextureDepthSampleTest(TestCase):
zsbuf = zsbuf_tex.get_surface()
- self.assert_rgba(zsbuf, x, y, w, h, expected_rgba, 4.0/256, 0.85)
+ self.assert_rgba(ctx, zsbuf, x, y, w, h, expected_rgba, 4.0/256, 0.85)
def main():
+ random.seed(0xdead3eef)
+
dev = Device()
+ ctx = dev.context_create()
suite = TestSuite()
targets = [
@@ -497,32 +564,9 @@ def main():
PIPE_TEXTURE_3D,
]
- color_formats = [
- PIPE_FORMAT_B8G8R8A8_UNORM,
- PIPE_FORMAT_B8G8R8X8_UNORM,
- #PIPE_FORMAT_B8G8R8A8_SRGB,
- PIPE_FORMAT_B5G6R5_UNORM,
- PIPE_FORMAT_B5G5R5A1_UNORM,
- PIPE_FORMAT_B4G4R4A4_UNORM,
- PIPE_FORMAT_A8_UNORM,
- PIPE_FORMAT_L8_UNORM,
- PIPE_FORMAT_UYVY,
- PIPE_FORMAT_DXT1_RGB,
- #PIPE_FORMAT_DXT1_RGBA,
- #PIPE_FORMAT_DXT3_RGBA,
- #PIPE_FORMAT_DXT5_RGBA,
- ]
-
- depth_formats = [
- PIPE_FORMAT_Z32_UNORM,
- PIPE_FORMAT_S8Z24_UNORM,
- PIPE_FORMAT_X8Z24_UNORM,
- PIPE_FORMAT_Z16_UNORM,
- ]
-
- sizes = [64, 32, 16, 8, 4, 2, 1]
+ #sizes = [64, 32, 16, 8, 4, 2, 1]
#sizes = [1020, 508, 252, 62, 30, 14, 6, 3]
- #sizes = [64]
+ sizes = [64]
#sizes = [63]
faces = [
@@ -534,45 +578,46 @@ def main():
PIPE_TEX_FACE_NEG_Z,
]
- for format in color_formats:
- for target in targets:
- for size in sizes:
- if target == PIPE_TEXTURE_3D:
- depth = size
- else:
- depth = 1
- for face in faces:
- if target != PIPE_TEXTURE_CUBE and face:
- continue
- levels = lods(size)
- for last_level in range(levels):
- for level in range(0, last_level + 1):
- zslice = 0
- while zslice < depth >> level:
- test = TextureColorSampleTest(
- dev = dev,
- target = target,
- format = format,
- width = size,
- height = size,
- depth = depth,
- last_level = last_level,
- face = face,
- level = level,
- zslice = zslice,
- )
- suite.add_test(test)
- zslice = (zslice + 1)*2 - 1
- for format in depth_formats:
- target = PIPE_TEXTURE_2D
- depth = 1
- face = 0
- last_level = 0
- level = 0
- zslice = 0
- for size in sizes:
- test = TextureDepthSampleTest(
+ try:
+ n = int(sys.argv[1])
+ except:
+ n = 10000
+
+ for i in range(n):
+ format = random.choice(formats.keys())
+ if not util_format_is_depth_or_stencil(format):
+ is_depth_or_stencil = util_format_is_depth_or_stencil(format)
+
+ if is_depth_or_stencil:
+ target = PIPE_TEXTURE_2D
+ else:
+ target = random.choice(targets)
+
+ size = random.choice(sizes)
+
+ if target == PIPE_TEXTURE_3D:
+ depth = size
+ else:
+ depth = 1
+
+ if target == PIPE_TEXTURE_CUBE:
+ face = random.choice(faces)
+ else:
+ face = PIPE_TEX_FACE_POS_X
+
+ levels = lods(size)
+ last_level = random.randint(0, levels - 1)
+ level = random.randint(0, last_level)
+ zslice = random.randint(0, max(depth >> level, 1) - 1)
+
+ if is_depth_or_stencil:
+ klass = TextureDepthSampleTest
+ else:
+ klass = TextureColorSampleTest
+
+ test = klass(
dev = dev,
+ ctx = ctx,
target = target,
format = format,
width = size,
diff --git a/progs/gallium/python/tests/texture_render.py b/progs/gallium/python/tests/texture_render.py
index 1e26639db6..12def7ec72 100755
--- a/progs/gallium/python/tests/texture_render.py
+++ b/progs/gallium/python/tests/texture_render.py
@@ -258,10 +258,10 @@ def main():
PIPE_FORMAT_B5G5R5A1_UNORM,
PIPE_FORMAT_B4G4R4A4_UNORM,
#PIPE_FORMAT_Z32_UNORM,
- #PIPE_FORMAT_S8Z24_UNORM,
+ #PIPE_FORMAT_S8_USCALED_Z24_UNORM,
#PIPE_FORMAT_X8Z24_UNORM,
#PIPE_FORMAT_Z16_UNORM,
- #PIPE_FORMAT_S8_UNORM,
+ #PIPE_FORMAT_S8_USCALED,
PIPE_FORMAT_A8_UNORM,
PIPE_FORMAT_L8_UNORM,
#PIPE_FORMAT_DXT1_RGB,
diff --git a/progs/gallium/python/tests/texture_transfer.py b/progs/gallium/python/tests/texture_transfer.py
index 7da00e4255..639d3d362c 100755
--- a/progs/gallium/python/tests/texture_transfer.py
+++ b/progs/gallium/python/tests/texture_transfer.py
@@ -29,6 +29,7 @@
import os
+import random
from gallium import *
from base import *
@@ -59,6 +60,7 @@ class TextureTest(TestCase):
def test(self):
dev = self.dev
+ ctx = self.ctx
target = self.target
format = self.format
@@ -70,8 +72,12 @@ class TextureTest(TestCase):
level = self.level
zslice = self.zslice
- tex_usage = 0
+ tex_usage = PIPE_TEXTURE_USAGE_SAMPLER
+ geom_flags = 0
+ if not dev.is_format_supported(format, target, tex_usage, geom_flags):
+ raise TestSkip
+ # textures
texture = dev.texture_create(
target = target,
format = format,
@@ -81,20 +87,17 @@ class TextureTest(TestCase):
last_level = last_level,
tex_usage = tex_usage,
)
- if texture is None:
- raise TestSkip
surface = texture.get_surface(face, level, zslice)
- # ???
- stride = pf_get_stride(texture->format, w)
- size = pf_get_nblocksy(texture->format) * stride
+ stride = util_format_get_stride(format, surface.width)
+ size = util_format_get_nblocksy(format, surface.height) * stride
in_raw = os.urandom(size)
- surface.put_tile_raw(0, 0, surface.width, surface.height, in_raw, stride)
+ ctx.surface_write_raw(surface, 0, 0, surface.width, surface.height, in_raw, stride)
- out_raw = surface.get_tile_raw(0, 0, surface.width, surface.height)
+ out_raw = ctx.surface_read_raw(surface, 0, 0, surface.width, surface.height)
if in_raw != out_raw:
raise TestFailure
@@ -102,6 +105,7 @@ class TextureTest(TestCase):
def main():
dev = Device()
+ ctx = dev.context_create()
suite = TestSuite()
targets = [
@@ -110,26 +114,6 @@ def main():
PIPE_TEXTURE_3D,
]
- formats = [
- PIPE_FORMAT_B8G8R8A8_UNORM,
- PIPE_FORMAT_B8G8R8X8_UNORM,
- PIPE_FORMAT_B8G8R8A8_SRGB,
- PIPE_FORMAT_B5G6R5_UNORM,
- PIPE_FORMAT_B5G5R5A1_UNORM,
- PIPE_FORMAT_B4G4R4A4_UNORM,
- PIPE_FORMAT_Z32_UNORM,
- PIPE_FORMAT_S8Z24_UNORM,
- PIPE_FORMAT_X8Z24_UNORM,
- PIPE_FORMAT_Z16_UNORM,
- PIPE_FORMAT_S8_UNORM,
- PIPE_FORMAT_A8_UNORM,
- PIPE_FORMAT_L8_UNORM,
- PIPE_FORMAT_DXT1_RGB,
- PIPE_FORMAT_DXT1_RGBA,
- PIPE_FORMAT_DXT3_RGBA,
- PIPE_FORMAT_DXT5_RGBA,
- ]
-
sizes = [64, 32, 16, 8, 4, 2, 1]
#sizes = [1020, 508, 252, 62, 30, 14, 6, 3]
#sizes = [64]
@@ -144,35 +128,52 @@ def main():
PIPE_TEX_FACE_NEG_Z,
]
- for target in targets:
- for format in formats:
- for size in sizes:
- if target == PIPE_TEXTURE_3D:
- depth = size
- else:
- depth = 1
- for face in faces:
- if target != PIPE_TEXTURE_CUBE and face:
- continue
- levels = lods(size)
- for last_level in range(levels):
- for level in range(0, last_level + 1):
- zslice = 0
- while zslice < depth >> level:
- test = TextureTest(
- dev = dev,
- target = target,
- format = format,
- width = size,
- height = size,
- depth = depth,
- last_level = last_level,
- face = face,
- level = level,
- zslice = zslice,
- )
- suite.add_test(test)
- zslice = (zslice + 1)*2 - 1
+ try:
+ n = int(sys.argv[1])
+ except:
+ n = 10000
+
+ for i in range(n):
+ format = random.choice(formats.keys())
+ if not util_format_is_depth_or_stencil(format):
+ is_depth_or_stencil = util_format_is_depth_or_stencil(format)
+
+ if is_depth_or_stencil:
+ target = PIPE_TEXTURE_2D
+ else:
+ target = random.choice(targets)
+
+ size = random.choice(sizes)
+
+ if target == PIPE_TEXTURE_3D:
+ depth = size
+ else:
+ depth = 1
+
+ if target == PIPE_TEXTURE_CUBE:
+ face = random.choice(faces)
+ else:
+ face = PIPE_TEX_FACE_POS_X
+
+ levels = lods(size)
+ last_level = random.randint(0, levels - 1)
+ level = random.randint(0, last_level)
+ zslice = random.randint(0, max(depth >> level, 1) - 1)
+
+ test = TextureTest(
+ dev = dev,
+ ctx = ctx,
+ target = target,
+ format = format,
+ width = size,
+ height = size,
+ depth = depth,
+ last_level = last_level,
+ face = face,
+ level = level,
+ zslice = zslice,
+ )
+ suite.add_test(test)
suite.run()
diff --git a/progs/gallium/raw/SConscript b/progs/gallium/raw/SConscript
new file mode 100644
index 0000000000..073b97951e
--- /dev/null
+++ b/progs/gallium/raw/SConscript
@@ -0,0 +1,17 @@
+Import('*')
+
+env = env.Clone()
+
+env.Prepend(LIBPATH = [graw.dir])
+env.Prepend(LIBS = [graw.name])
+
+progs = [
+ 'clear'
+]
+
+for prog in progs:
+ env.Program(
+ target = prog,
+ source = prog + '.c',
+ )
+
diff --git a/progs/gallium/raw/clear.c b/progs/gallium/raw/clear.c
new file mode 100644
index 0000000000..5ef5254edc
--- /dev/null
+++ b/progs/gallium/raw/clear.c
@@ -0,0 +1,95 @@
+/* Display a cleared blue window. This demo has no dependencies on
+ * any utility code, just the graw interface and gallium.
+ */
+
+#include "state_tracker/graw.h"
+#include "pipe/p_screen.h"
+#include "pipe/p_context.h"
+#include "pipe/p_state.h"
+#include "pipe/p_defines.h"
+#include <unistd.h> /* for sleep() */
+
+#include "util/u_debug.h" /* debug_dump_surface_bmp() */
+
+enum pipe_format formats[] = {
+ PIPE_FORMAT_R8G8B8A8_UNORM,
+ PIPE_FORMAT_B8G8R8A8_UNORM,
+ PIPE_FORMAT_NONE
+};
+
+static const int WIDTH = 300;
+static const int HEIGHT = 300;
+
+int main( int argc, char *argv[] )
+{
+ struct pipe_screen *screen;
+ struct pipe_context *pipe;
+ struct pipe_surface *surf;
+ struct pipe_framebuffer_state fb;
+ struct pipe_texture *tex, templat;
+ void *window = NULL;
+ float clear_color[4] = {1,0,1,1};
+ int i;
+
+ screen = graw_init();
+ if (screen == NULL)
+ exit(1);
+
+ for (i = 0;
+ window == NULL && formats[i] != PIPE_FORMAT_NONE;
+ i++) {
+
+ window = graw_create_window(0,0,300,300, formats[i]);
+ }
+
+ if (window == NULL)
+ exit(2);
+
+ pipe = screen->context_create(screen, NULL);
+ if (pipe == NULL)
+ exit(3);
+
+ templat.target = PIPE_TEXTURE_2D;
+ templat.format = formats[i];
+ templat.width0 = WIDTH;
+ templat.height0 = HEIGHT;
+ templat.depth0 = 1;
+ templat.last_level = 0;
+ templat.nr_samples = 1;
+ templat.tex_usage = (PIPE_TEXTURE_USAGE_RENDER_TARGET |
+ PIPE_TEXTURE_USAGE_DISPLAY_TARGET);
+
+ tex = screen->texture_create(screen,
+ &templat);
+ if (tex == NULL)
+ exit(4);
+
+ surf = screen->get_tex_surface(screen, tex, 0, 0, 0,
+ PIPE_TEXTURE_USAGE_RENDER_TARGET |
+ PIPE_TEXTURE_USAGE_DISPLAY_TARGET);
+ if (surf == NULL)
+ exit(5);
+
+ memset(&fb, 0, sizeof fb);
+ fb.nr_cbufs = 1;
+ fb.width = WIDTH;
+ fb.height = HEIGHT;
+ fb.cbufs[0] = surf;
+
+ pipe->set_framebuffer_state(pipe, &fb);
+ pipe->clear(pipe, PIPE_CLEAR_COLOR, clear_color, 0, 0);
+ pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
+
+ /* At the moment, libgraw includes/makes available all the symbols
+ * from gallium/auxiliary, including these debug helpers. Will
+ * eventually want to bless some of these paths, and lock the
+ * others down so they aren't accessible from test programs.
+ */
+ if (0)
+ debug_dump_surface_bmp(pipe, "result.bmp", surf);
+
+ screen->flush_frontbuffer(screen, surf, window);
+
+ sleep(100);
+ return 0;
+}
diff --git a/progs/gallium/trivial/.gitignore b/progs/gallium/trivial/.gitignore
new file mode 100644
index 0000000000..af6cdedbeb
--- /dev/null
+++ b/progs/gallium/trivial/.gitignore
@@ -0,0 +1,3 @@
+tri
+quad-tex
+result.bmp
diff --git a/progs/gallium/trivial/Makefile b/progs/gallium/trivial/Makefile
new file mode 100644
index 0000000000..2b8af1ac06
--- /dev/null
+++ b/progs/gallium/trivial/Makefile
@@ -0,0 +1,44 @@
+# progs/gallium/simple/Makefile
+
+TOP = ../../..
+include $(TOP)/configs/current
+
+INCLUDES = \
+ -I. \
+ -I$(TOP)/src/gallium/include \
+ -I$(TOP)/src/gallium/auxiliary \
+ -I$(TOP)/src/gallium/drivers \
+ -I$(TOP)/src/gallium/winsys \
+ $(PROG_INCLUDES)
+
+LINKS = \
+ $(TOP)/src/gallium/drivers/trace/libtrace.a \
+ $(TOP)/src/gallium/winsys/sw/null/libws_null.a \
+ $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
+ $(GALLIUM_AUXILIARIES) \
+ $(PROG_LINKS)
+
+SOURCES = \
+ tri.c \
+ quad-tex.c
+
+OBJECTS = $(SOURCES:.c=.o)
+
+PROGS = $(OBJECTS:.o=)
+
+##### TARGETS #####
+
+default: $(PROGS)
+
+clean:
+ -rm -f $(PROGS)
+ -rm -f *.o
+ -rm -f result.bmp
+
+##### RULES #####
+
+$(OBJECTS): %.o: %.c
+ $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $(PROG_DEFINES) $< -o $@
+
+$(PROGS): %: %.o
+ $(CC) $(LDFLAGS) $< $(LINKS) -lm -lpthread -o $@
diff --git a/progs/gallium/trivial/quad-tex.c b/progs/gallium/trivial/quad-tex.c
new file mode 100644
index 0000000000..553f5582e7
--- /dev/null
+++ b/progs/gallium/trivial/quad-tex.c
@@ -0,0 +1,346 @@
+/**************************************************************************
+ *
+ * Copyright © 2010 Jakob Bornecrantz
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+
+#define USE_TRACE 0
+#define WIDTH 300
+#define HEIGHT 300
+#define NEAR 30
+#define FAR 1000
+#define FLIP 0
+
+/* pipe_*_state structs */
+#include "pipe/p_state.h"
+/* pipe_context */
+#include "pipe/p_context.h"
+/* pipe_screen */
+#include "pipe/p_screen.h"
+/* PIPE_* */
+#include "pipe/p_defines.h"
+/* TGSI_SEMANTIC_{POSITION|GENERIC} */
+#include "pipe/p_shader_tokens.h"
+/* pipe_buffer_* helpers */
+#include "util/u_inlines.h"
+
+/* constant state object helper */
+#include "cso_cache/cso_context.h"
+
+/* u_sampler_view_default_template */
+#include "util/u_sampler.h"
+/* debug_dump_surface_bmp */
+#include "util/u_debug.h"
+/* util_draw_vertex_buffer helper */
+#include "util/u_draw_quad.h"
+/* FREE & CALLOC_STRUCT */
+#include "util/u_memory.h"
+/* util_make_[fragment|vertex]_passthrough_shader */
+#include "util/u_simple_shaders.h"
+
+/* softpipe software driver */
+#include "softpipe/sp_public.h"
+
+/* null software winsys */
+#include "sw/null/null_sw_winsys.h"
+
+/* traceing support see src/gallium/drivers/trace/README for more info. */
+#if USE_TRACE
+#include "trace/tr_screen.h"
+#include "trace/tr_context.h"
+#endif
+
+struct program
+{
+ struct pipe_screen *screen;
+ struct pipe_context *pipe;
+ struct cso_context *cso;
+
+ struct pipe_blend_state blend;
+ struct pipe_depth_stencil_alpha_state depthstencil;
+ struct pipe_rasterizer_state rasterizer;
+ struct pipe_sampler_state sampler;
+ struct pipe_viewport_state viewport;
+ struct pipe_framebuffer_state framebuffer;
+ struct pipe_vertex_element velem[2];
+
+ void *vs;
+ void *fs;
+
+ float clear_color[4];
+
+ struct pipe_buffer *vbuf;
+ struct pipe_texture *target;
+ struct pipe_texture *tex;
+ struct pipe_sampler_view *view;
+};
+
+static void init_prog(struct program *p)
+{
+ /* create the software rasterizer */
+ p->screen = softpipe_create_screen(null_sw_create());
+#if USE_TRACE
+ p->screen = trace_screen_create(p->screen);
+#endif
+ p->pipe = p->screen->context_create(p->screen, NULL);
+ p->cso = cso_create_context(p->pipe);
+
+ /* set clear color */
+ p->clear_color[0] = 0.3;
+ p->clear_color[1] = 0.1;
+ p->clear_color[2] = 0.3;
+ p->clear_color[3] = 1.0;
+
+ /* vertex buffer */
+ {
+ float vertices[4][2][4] = {
+ {
+ { 0.9f, 0.9f, 0.0f, 1.0f },
+ { 1.0f, 1.0f, 0.0f, 1.0f }
+ },
+ {
+ { -0.9f, 0.9f, 0.0f, 1.0f },
+ { 0.0f, 1.0f, 0.0f, 1.0f }
+ },
+ {
+ { -0.9f, -0.9f, 0.0f, 1.0f },
+ { 0.0f, 0.0f, 1.0f, 1.0f }
+ },
+ {
+ { 0.9f, -0.9f, 0.0f, 1.0f },
+ { 1.0f, 0.0f, 1.0f, 1.0f }
+ }
+ };
+
+ p->vbuf = pipe_buffer_create(p->screen, 16, PIPE_BUFFER_USAGE_VERTEX, sizeof(vertices));
+ pipe_buffer_write(p->screen, p->vbuf, 0, sizeof(vertices), vertices);
+ }
+
+ /* render target texture */
+ {
+ struct pipe_texture tmplt;
+ memset(&tmplt, 0, sizeof(tmplt));
+ tmplt.target = PIPE_TEXTURE_2D;
+ tmplt.format = PIPE_FORMAT_B8G8R8A8_UNORM; /* All drivers support this */
+ tmplt.width0 = WIDTH;
+ tmplt.height0 = HEIGHT;
+ tmplt.depth0 = 1;
+ tmplt.last_level = 0;
+ tmplt.tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET;
+
+ p->target = p->screen->texture_create(p->screen, &tmplt);
+ }
+
+ /* sampler texture */
+ {
+ uint32_t *ptr;
+ struct pipe_transfer *t;
+ struct pipe_texture t_tmplt;
+ struct pipe_sampler_view v_tmplt;
+
+ memset(&t_tmplt, 0, sizeof(t_tmplt));
+ t_tmplt.target = PIPE_TEXTURE_2D;
+ t_tmplt.format = PIPE_FORMAT_B8G8R8A8_UNORM; /* All drivers support this */
+ t_tmplt.width0 = 2;
+ t_tmplt.height0 = 2;
+ t_tmplt.depth0 = 1;
+ t_tmplt.last_level = 0;
+ t_tmplt.tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET;
+
+ p->tex = p->screen->texture_create(p->screen, &t_tmplt);
+
+ t = p->pipe->get_tex_transfer(p->pipe, p->tex,
+ 0, 0, 0, /* face, level, zslice */
+ PIPE_TRANSFER_WRITE,
+ 0, 0, 2, 2); /* x, y, width, height */
+
+ ptr = p->pipe->transfer_map(p->pipe, t);
+ ptr[0] = 0xffff0000;
+ ptr[1] = 0xff0000ff;
+ ptr[2] = 0xff00ff00;
+ ptr[3] = 0xffffff00;
+ p->pipe->transfer_unmap(p->pipe, t);
+
+ p->pipe->tex_transfer_destroy(p->pipe, t);
+
+ u_sampler_view_default_template(&v_tmplt, p->tex, p->tex->format);
+
+ p->view = p->pipe->create_sampler_view(p->pipe, p->tex, &v_tmplt);
+ }
+
+ /* disabled blending/masking */
+ memset(&p->blend, 0, sizeof(p->blend));
+ p->blend.rt[0].colormask = PIPE_MASK_RGBA;
+
+ /* no-op depth/stencil/alpha */
+ memset(&p->depthstencil, 0, sizeof(p->depthstencil));
+
+ /* rasterizer */
+ memset(&p->rasterizer, 0, sizeof(p->rasterizer));
+ p->rasterizer.front_winding = PIPE_WINDING_CW;
+ p->rasterizer.cull_mode = PIPE_WINDING_NONE;
+ p->rasterizer.gl_rasterization_rules = 1;
+
+ /* sampler */
+ memset(&p->sampler, 0, sizeof(p->sampler));
+ p->sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
+ p->sampler.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
+ p->sampler.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
+ p->sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NONE;
+ p->sampler.min_img_filter = PIPE_TEX_MIPFILTER_LINEAR;
+ p->sampler.mag_img_filter = PIPE_TEX_MIPFILTER_LINEAR;
+ p->sampler.normalized_coords = 1;
+
+ /* drawing destination */
+ memset(&p->framebuffer, 0, sizeof(p->framebuffer));
+ p->framebuffer.width = WIDTH;
+ p->framebuffer.height = HEIGHT;
+ p->framebuffer.nr_cbufs = 1;
+ p->framebuffer.cbufs[0] = p->screen->get_tex_surface(p->screen, p->target, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_WRITE);
+
+ /* viewport, depth isn't really needed */
+ {
+ float x = 0;
+ float y = 0;
+ float z = FAR;
+ float half_width = (float)WIDTH / 2.0f;
+ float half_height = (float)HEIGHT / 2.0f;
+ float half_depth = ((float)FAR - (float)NEAR) / 2.0f;
+ float scale, bias;
+
+ if (FLIP) {
+ scale = -1.0f;
+ bias = (float)HEIGHT;
+ } else {
+ scale = 1.0f;
+ bias = 0.0f;
+ }
+
+ p->viewport.scale[0] = half_width;
+ p->viewport.scale[1] = half_height * scale;
+ p->viewport.scale[2] = half_depth;
+ p->viewport.scale[3] = 1.0f;
+
+ p->viewport.translate[0] = half_width + x;
+ p->viewport.translate[1] = (half_height + y) * scale + bias;
+ p->viewport.translate[2] = half_depth + z;
+ p->viewport.translate[3] = 0.0f;
+ }
+
+ /* vertex elements state */
+ memset(p->velem, 0, sizeof(p->velem));
+ p->velem[0].src_offset = 0 * 4 * sizeof(float); /* offset 0, first element */
+ p->velem[0].instance_divisor = 0;
+ p->velem[0].vertex_buffer_index = 0;
+ p->velem[0].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+
+ p->velem[1].src_offset = 1 * 4 * sizeof(float); /* offset 16, second element */
+ p->velem[1].instance_divisor = 0;
+ p->velem[1].vertex_buffer_index = 0;
+ p->velem[1].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+
+ /* vertex shader */
+ {
+ const uint semantic_names[] = { TGSI_SEMANTIC_POSITION,
+ TGSI_SEMANTIC_GENERIC };
+ const uint semantic_indexes[] = { 0, 0 };
+ p->vs = util_make_vertex_passthrough_shader(p->pipe, 2, semantic_names, semantic_indexes);
+ }
+
+ /* fragment shader */
+ p->fs = util_make_fragment_tex_shader(p->pipe, TGSI_TEXTURE_2D);
+}
+
+static void close_prog(struct program *p)
+{
+ /* unset bound textures as well */
+ cso_set_fragment_sampler_views(p->cso, 0, NULL);
+
+ /* unset all state */
+ cso_release_all(p->cso);
+
+ p->pipe->delete_vs_state(p->pipe, p->vs);
+ p->pipe->delete_fs_state(p->pipe, p->fs);
+
+ pipe_surface_reference(&p->framebuffer.cbufs[0], NULL);
+ pipe_sampler_view_reference(&p->view, NULL);
+ pipe_texture_reference(&p->target, NULL);
+ pipe_texture_reference(&p->tex, NULL);
+ pipe_buffer_reference(&p->vbuf, NULL);
+
+ cso_destroy_context(p->cso);
+ p->pipe->destroy(p->pipe);
+ p->screen->destroy(p->screen);
+
+ FREE(p);
+}
+
+static void draw(struct program *p)
+{
+ /* set the render target */
+ cso_set_framebuffer(p->cso, &p->framebuffer);
+
+ /* clear the render target */
+ p->pipe->clear(p->pipe, PIPE_CLEAR_COLOR, p->clear_color, 0, 0);
+
+ /* set misc state we care about */
+ cso_set_blend(p->cso, &p->blend);
+ cso_set_depth_stencil_alpha(p->cso, &p->depthstencil);
+ cso_set_rasterizer(p->cso, &p->rasterizer);
+ cso_set_viewport(p->cso, &p->viewport);
+
+ /* sampler */
+ cso_single_sampler(p->cso, 0, &p->sampler);
+ cso_single_sampler_done(p->cso);
+
+ /* texture sampler view */
+ cso_set_fragment_sampler_views(p->cso, 1, &p->view);
+
+ /* shaders */
+ cso_set_fragment_shader_handle(p->cso, p->fs);
+ cso_set_vertex_shader_handle(p->cso, p->vs);
+
+ /* vertex element data */
+ cso_set_vertex_elements(p->cso, 2, p->velem);
+
+ util_draw_vertex_buffer(p->pipe,
+ p->vbuf, 0,
+ PIPE_PRIM_QUADS,
+ 4, /* verts */
+ 2); /* attribs/vert */
+
+ p->pipe->flush(p->pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
+
+ debug_dump_surface_bmp(p->pipe, "result.bmp", p->framebuffer.cbufs[0]);
+}
+
+int main(int argc, char** argv)
+{
+ struct program *p = CALLOC_STRUCT(program);
+
+ init_prog(p);
+ draw(p);
+ close_prog(p);
+
+ return 0;
+}
diff --git a/progs/gallium/trivial/tri.c b/progs/gallium/trivial/tri.c
new file mode 100644
index 0000000000..cae1bdb1b1
--- /dev/null
+++ b/progs/gallium/trivial/tri.c
@@ -0,0 +1,278 @@
+/**************************************************************************
+ *
+ * Copyright © 2010 Jakob Bornecrantz
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+
+#define USE_TRACE 0
+#define WIDTH 300
+#define HEIGHT 300
+#define NEAR 30
+#define FAR 1000
+#define FLIP 0
+
+/* pipe_*_state structs */
+#include "pipe/p_state.h"
+/* pipe_context */
+#include "pipe/p_context.h"
+/* pipe_screen */
+#include "pipe/p_screen.h"
+/* PIPE_* */
+#include "pipe/p_defines.h"
+/* TGSI_SEMANTIC_{POSITION|GENERIC} */
+#include "pipe/p_shader_tokens.h"
+/* pipe_buffer_* helpers */
+#include "util/u_inlines.h"
+
+/* constant state object helper */
+#include "cso_cache/cso_context.h"
+
+/* debug_dump_surface_bmp */
+#include "util/u_debug.h"
+/* util_draw_vertex_buffer helper */
+#include "util/u_draw_quad.h"
+/* FREE & CALLOC_STRUCT */
+#include "util/u_memory.h"
+/* util_make_[fragment|vertex]_passthrough_shader */
+#include "util/u_simple_shaders.h"
+
+/* softpipe software driver */
+#include "softpipe/sp_public.h"
+
+/* null software winsys */
+#include "sw/null/null_sw_winsys.h"
+
+/* traceing support see src/gallium/drivers/trace/README for more info. */
+#if USE_TRACE
+#include "trace/tr_screen.h"
+#include "trace/tr_context.h"
+#endif
+
+struct program
+{
+ struct pipe_screen *screen;
+ struct pipe_context *pipe;
+ struct cso_context *cso;
+
+ struct pipe_blend_state blend;
+ struct pipe_depth_stencil_alpha_state depthstencil;
+ struct pipe_rasterizer_state rasterizer;
+ struct pipe_viewport_state viewport;
+ struct pipe_framebuffer_state framebuffer;
+ struct pipe_vertex_element velem[2];
+
+ void *vs;
+ void *fs;
+
+ float clear_color[4];
+
+ struct pipe_buffer *vbuf;
+ struct pipe_texture *target;
+};
+
+static void init_prog(struct program *p)
+{
+ /* create the software rasterizer */
+ p->screen = softpipe_create_screen(null_sw_create());
+#if USE_TRACE
+ p->screen = trace_screen_create(p->screen);
+#endif
+ p->pipe = p->screen->context_create(p->screen, NULL);
+ p->cso = cso_create_context(p->pipe);
+
+ /* set clear color */
+ p->clear_color[0] = 0.3;
+ p->clear_color[1] = 0.1;
+ p->clear_color[2] = 0.3;
+ p->clear_color[3] = 1.0;
+
+ /* vertex buffer */
+ {
+ float vertices[4][2][4] = {
+ {
+ { 0.0f, -0.9f, 0.0f, 1.0f },
+ { 1.0f, 0.0f, 0.0f, 1.0f }
+ },
+ {
+ { -0.9f, 0.9f, 0.0f, 1.0f },
+ { 0.0f, 1.0f, 0.0f, 1.0f }
+ },
+ {
+ { 0.9f, 0.9f, 0.0f, 1.0f },
+ { 0.0f, 0.0f, 1.0f, 1.0f }
+ }
+ };
+
+ p->vbuf = pipe_buffer_create(p->screen, 16, PIPE_BUFFER_USAGE_VERTEX, sizeof(vertices));
+ pipe_buffer_write(p->screen, p->vbuf, 0, sizeof(vertices), vertices);
+ }
+
+ /* render target texture */
+ {
+ struct pipe_texture tmplt;
+ memset(&tmplt, 0, sizeof(tmplt));
+ tmplt.target = PIPE_TEXTURE_2D;
+ tmplt.format = PIPE_FORMAT_B8G8R8A8_UNORM; /* All drivers support this */
+ tmplt.width0 = WIDTH;
+ tmplt.height0 = HEIGHT;
+ tmplt.depth0 = 1;
+ tmplt.last_level = 0;
+ tmplt.tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET;
+
+ p->target = p->screen->texture_create(p->screen, &tmplt);
+ }
+
+ /* disabled blending/masking */
+ memset(&p->blend, 0, sizeof(p->blend));
+ p->blend.rt[0].colormask = PIPE_MASK_RGBA;
+
+ /* no-op depth/stencil/alpha */
+ memset(&p->depthstencil, 0, sizeof(p->depthstencil));
+
+ /* rasterizer */
+ memset(&p->rasterizer, 0, sizeof(p->rasterizer));
+ p->rasterizer.front_winding = PIPE_WINDING_CW;
+ p->rasterizer.cull_mode = PIPE_WINDING_NONE;
+ p->rasterizer.gl_rasterization_rules = 1;
+
+ /* drawing destination */
+ memset(&p->framebuffer, 0, sizeof(p->framebuffer));
+ p->framebuffer.width = WIDTH;
+ p->framebuffer.height = HEIGHT;
+ p->framebuffer.nr_cbufs = 1;
+ p->framebuffer.cbufs[0] = p->screen->get_tex_surface(p->screen, p->target, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_WRITE);
+
+ /* viewport, depth isn't really needed */
+ {
+ float x = 0;
+ float y = 0;
+ float z = FAR;
+ float half_width = (float)WIDTH / 2.0f;
+ float half_height = (float)HEIGHT / 2.0f;
+ float half_depth = ((float)FAR - (float)NEAR) / 2.0f;
+ float scale, bias;
+
+ if (FLIP) {
+ scale = -1.0f;
+ bias = (float)HEIGHT;
+ } else {
+ scale = 1.0f;
+ bias = 0.0f;
+ }
+
+ p->viewport.scale[0] = half_width;
+ p->viewport.scale[1] = half_height * scale;
+ p->viewport.scale[2] = half_depth;
+ p->viewport.scale[3] = 1.0f;
+
+ p->viewport.translate[0] = half_width + x;
+ p->viewport.translate[1] = (half_height + y) * scale + bias;
+ p->viewport.translate[2] = half_depth + z;
+ p->viewport.translate[3] = 0.0f;
+ }
+
+ /* vertex elements state */
+ memset(p->velem, 0, sizeof(p->velem));
+ p->velem[0].src_offset = 0 * 4 * sizeof(float); /* offset 0, first element */
+ p->velem[0].instance_divisor = 0;
+ p->velem[0].vertex_buffer_index = 0;
+ p->velem[0].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+
+ p->velem[1].src_offset = 1 * 4 * sizeof(float); /* offset 16, second element */
+ p->velem[1].instance_divisor = 0;
+ p->velem[1].vertex_buffer_index = 0;
+ p->velem[1].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+
+ /* vertex shader */
+ {
+ const uint semantic_names[] = { TGSI_SEMANTIC_POSITION,
+ TGSI_SEMANTIC_COLOR };
+ const uint semantic_indexes[] = { 0, 0 };
+ p->vs = util_make_vertex_passthrough_shader(p->pipe, 2, semantic_names, semantic_indexes);
+ }
+
+ /* fragment shader */
+ p->fs = util_make_fragment_passthrough_shader(p->pipe);
+}
+
+static void close_prog(struct program *p)
+{
+ /* unset all state */
+ cso_release_all(p->cso);
+
+ p->pipe->delete_vs_state(p->pipe, p->vs);
+ p->pipe->delete_fs_state(p->pipe, p->fs);
+
+ pipe_surface_reference(&p->framebuffer.cbufs[0], NULL);
+ pipe_texture_reference(&p->target, NULL);
+ pipe_buffer_reference(&p->vbuf, NULL);
+
+ cso_destroy_context(p->cso);
+ p->pipe->destroy(p->pipe);
+ p->screen->destroy(p->screen);
+
+ FREE(p);
+}
+
+static void draw(struct program *p)
+{
+ /* set the render target */
+ cso_set_framebuffer(p->cso, &p->framebuffer);
+
+ /* clear the render target */
+ p->pipe->clear(p->pipe, PIPE_CLEAR_COLOR, p->clear_color, 0, 0);
+
+ /* set misc state we care about */
+ cso_set_blend(p->cso, &p->blend);
+ cso_set_depth_stencil_alpha(p->cso, &p->depthstencil);
+ cso_set_rasterizer(p->cso, &p->rasterizer);
+ cso_set_viewport(p->cso, &p->viewport);
+
+ /* shaders */
+ cso_set_fragment_shader_handle(p->cso, p->fs);
+ cso_set_vertex_shader_handle(p->cso, p->vs);
+
+ /* vertex element data */
+ cso_set_vertex_elements(p->cso, 2, p->velem);
+
+ util_draw_vertex_buffer(p->pipe,
+ p->vbuf, 0,
+ PIPE_PRIM_TRIANGLES,
+ 3, /* verts */
+ 2); /* attribs/vert */
+
+ p->pipe->flush(p->pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
+
+ debug_dump_surface_bmp(p->pipe, "result.bmp", p->framebuffer.cbufs[0]);
+}
+
+int main(int argc, char** argv)
+{
+ struct program *p = CALLOC_STRUCT(program);
+
+ init_prog(p);
+ draw(p);
+ close_prog(p);
+
+ return 0;
+}
diff --git a/progs/gallium/unit/Makefile b/progs/gallium/unit/Makefile
new file mode 100644
index 0000000000..f3dbd7695c
--- /dev/null
+++ b/progs/gallium/unit/Makefile
@@ -0,0 +1,44 @@
+# progs/gallium/simple/Makefile
+
+TOP = ../../..
+include $(TOP)/configs/current
+
+INCLUDES = \
+ -I. \
+ -I$(TOP)/src/gallium/include \
+ -I$(TOP)/src/gallium/auxiliary \
+ -I$(TOP)/src/gallium/drivers \
+ -I$(TOP)/src/gallium/winsys \
+ $(PROG_INCLUDES)
+
+LINKS = \
+ $(TOP)/src/gallium/drivers/trace/libtrace.a \
+ $(TOP)/src/gallium/winsys/sw/null/libws_null.a \
+ $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
+ $(GALLIUM_AUXILIARIES) \
+ $(PROG_LINKS)
+
+SOURCES = \
+ u_format_test.c \
+ u_half_test.c
+
+OBJECTS = $(SOURCES:.c=.o)
+
+PROGS = $(OBJECTS:.o=)
+
+##### TARGETS #####
+
+default: $(PROGS)
+
+clean:
+ -rm -f $(PROGS)
+ -rm -f *.o
+ -rm -f result.bmp
+
+##### RULES #####
+
+$(OBJECTS): %.o: %.c
+ $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $(PROG_DEFINES) $< -o $@
+
+$(PROGS): %: %.o
+ $(CC) $(LDFLAGS) $< $(LINKS) -lm -lpthread -ldl -o $@
diff --git a/progs/gallium/unit/SConscript b/progs/gallium/unit/SConscript
index 9891440df6..0db3bb687c 100644
--- a/progs/gallium/unit/SConscript
+++ b/progs/gallium/unit/SConscript
@@ -5,7 +5,8 @@ env = env.Clone()
env.Prepend(LIBS = [gallium])
progs = [
- 'u_format_test'
+ 'u_format_test',
+ 'u_half_test'
]
for prog in progs:
@@ -13,6 +14,8 @@ for prog in progs:
target = prog,
source = prog + '.c',
)
+
+ env.InstallProgram(prog)
# http://www.scons.org/wiki/UnitTests
test_alias = env.Alias('unit', [prog], prog[0].abspath)
diff --git a/progs/gallium/unit/u_format_test.c b/progs/gallium/unit/u_format_test.c
index 2dfba5538b..53e028482b 100644
--- a/progs/gallium/unit/u_format_test.c
+++ b/progs/gallium/unit/u_format_test.c
@@ -28,565 +28,163 @@
#include <stdlib.h>
#include <stdio.h>
+#include <float.h>
+#include "util/u_half.h"
#include "util/u_format.h"
-#include "util/u_format_pack.h"
+#include "util/u_format_tests.h"
+#include "util/u_format_s3tc.h"
-#define MAX_PACKED_BYTES 16
+static boolean
+compare_float(float x, float y)
+{
+ float error = y - x;
+ if (error < 0.0f)
+ error = -error;
-/**
- * A (packed, unpacked) color pair.
- */
-struct util_format_test_case
-{
- enum pipe_format format;
+ if (error > FLT_EPSILON) {
+ return FALSE;
+ }
- /**
- * Mask of the bits that actually meaningful data. Used to mask out the
- * "X" channels.
- */
- uint8_t mask[MAX_PACKED_BYTES];
+ return TRUE;
+}
+
+
+static void
+print_packed(const struct util_format_description *format_desc,
+ const char *prefix,
+ const uint8_t *packed,
+ const char *suffix)
+{
+ unsigned i;
+ const char *sep = "";
- uint8_t packed[MAX_PACKED_BYTES];
+ printf("%s", prefix);
+ for (i = 0; i < format_desc->block.bits/8; ++i) {
+ printf("%s%02x", sep, packed[i]);
+ sep = " ";
+ }
+ printf("%s", suffix);
+}
- /**
- * RGBA.
- */
- double unpacked[4];
-};
+static void
+print_unpacked_doubl(const struct util_format_description *format_desc,
+ const char *prefix,
+ const double unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4],
+ const char *suffix)
+{
+ unsigned i, j;
+ const char *sep = "";
+
+ printf("%s", prefix);
+ for (i = 0; i < format_desc->block.height; ++i) {
+ for (j = 0; j < format_desc->block.width; ++j) {
+ printf("%s{%f, %f, %f, %f}", sep, unpacked[i][j][0], unpacked[i][j][1], unpacked[i][j][2], unpacked[i][j][3]);
+ sep = ", ";
+ }
+ sep = ",\n";
+ }
+ printf("%s", suffix);
+}
-/*
- * Helper macros to create the packed bytes for longer words.
- */
-#define PACKED_1x8(x) {x, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
-#define PACKED_2x8(x, y) {x, y, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
-#define PACKED_3x8(x, y, z) {x, y, z, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
-#define PACKED_4x8(x, y, z, w) {x, y, z, w, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+static void
+print_unpacked_float(const struct util_format_description *format_desc,
+ const char *prefix,
+ const float unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4],
+ const char *suffix)
+{
+ unsigned i, j;
+ const char *sep = "";
+
+ printf("%s", prefix);
+ for (i = 0; i < format_desc->block.height; ++i) {
+ for (j = 0; j < format_desc->block.width; ++j) {
+ printf("%s{%f, %f, %f, %f}", sep, unpacked[i][j][0], unpacked[i][j][1], unpacked[i][j][2], unpacked[i][j][3]);
+ sep = ", ";
+ }
+ sep = ",\n";
+ }
+ printf("%s", suffix);
+}
-#define PACKED_1x16(x) {(x) & 0xff, (x) >> 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
-#define PACKED_2x16(x, y) {(x) & 0xff, (x) >> 8, (y) & 0xff, (y) >> 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
-#define PACKED_3x16(x, y, z) {(x) & 0xff, (x) >> 8, (y) & 0xff, (y) >> 8, (z) & 0xff, (z) >> 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
-#define PACKED_4x16(x, y, z, w) {(x) & 0xff, (x) >> 8, (y) & 0xff, (y) >> 8, (z) & 0xff, (z) >> 8, (w) & 0xff, (w) >> 8, 0, 0, 0, 0, 0, 0, 0, 0}
-#define PACKED_1x32(x) {(x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, (x) >> 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
-#define PACKED_2x32(x, y) {(x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, (x) >> 24, (y) & 0xff, ((y) >> 8) & 0xff, ((y) >> 16) & 0xff, (y) >> 24, 0, 0, 0, 0, 0, 0, 0, 0}
-#define PACKED_3x32(x, y, z) {(x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, (x) >> 24, (y) & 0xff, ((y) >> 8) & 0xff, ((y) >> 16) & 0xff, (y) >> 24, (z) & 0xff, ((z) >> 8) & 0xff, ((z) >> 16) & 0xff, (z) >> 24, 0, 0, 0, 0}
-#define PACKED_4x32(x, y, z, w) {(x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, (x) >> 24, (y) & 0xff, ((y) >> 8) & 0xff, ((y) >> 16) & 0xff, (y) >> 24, (z) & 0xff, ((z) >> 8) & 0xff, ((z) >> 16) & 0xff, (z) >> 24, (w) & 0xff, ((w) >> 8) & 0xff, ((w) >> 16) & 0xff, (w) >> 24}
+static void
+print_unpacked_8unorm(const struct util_format_description *format_desc,
+ const char *prefix,
+ const uint8_t unpacked[][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4],
+ const char *suffix)
+{
+ unsigned i, j;
+ const char *sep = "";
+
+ printf("%s", prefix);
+ for (i = 0; i < format_desc->block.height; ++i) {
+ for (j = 0; j < format_desc->block.width; ++j) {
+ printf("%s{0x%02x, 0x%02x, 0x%02x, 0x%02x}", sep, unpacked[i][j][0], unpacked[i][j][1], unpacked[i][j][2], unpacked[i][j][3]);
+ sep = ", ";
+ }
+ }
+ printf("%s", suffix);
+}
-/**
- * Test cases.
- *
- * These were manually entered. We could generate these
- *
- * To keep this to a we cover only the corner cases, which should produce
- * good enough coverage since that pixel format transformations are afine for
- * non SRGB formats.
- */
-static const struct util_format_test_case
-test_cases[] =
+static boolean
+test_format_fetch_float(const struct util_format_description *format_desc,
+ const struct util_format_test_case *test)
{
+ float unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4] = { { { 0 } } };
+ unsigned i, j, k;
+ boolean success;
+
+ success = TRUE;
+ for (i = 0; i < format_desc->block.height; ++i) {
+ for (j = 0; j < format_desc->block.width; ++j) {
+ format_desc->fetch_float(unpacked[i][j], test->packed, j, i);
+ for (k = 0; k < 4; ++k) {
+ if (!compare_float(test->unpacked[i][j][k], unpacked[i][j][k])) {
+ success = FALSE;
+ }
+ }
+ }
+ }
+
+ if (!success) {
+ print_unpacked_float(format_desc, "FAILED: ", unpacked, " obtained\n");
+ print_unpacked_doubl(format_desc, " ", test->unpacked, " expected\n");
+ }
- /*
- * 32-bit rendertarget formats
- */
-
- {PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), {0.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000ff), {0.0, 0.0, 1.0, 0.0}},
- {PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000ff00), {0.0, 1.0, 0.0, 0.0}},
- {PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00ff0000), {1.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), {0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), {1.0, 1.0, 1.0, 1.0}},
-
- {PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00000000), {0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x000000ff), {0.0, 0.0, 1.0, 1.0}},
- {PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x0000ff00), {0.0, 1.0, 0.0, 1.0}},
- {PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00ff0000), {1.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0xff000000), {0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0xffffffff), {1.0, 1.0, 1.0, 1.0}},
-
- {PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), {0.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000ff), {0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000ff00), {1.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00ff0000), {0.0, 1.0, 0.0, 0.0}},
- {PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), {0.0, 0.0, 1.0, 0.0}},
- {PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), {1.0, 1.0, 1.0, 1.0}},
-
- {PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x00000000), {0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x000000ff), {0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x0000ff00), {1.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x00ff0000), {0.0, 1.0, 0.0, 1.0}},
- {PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0xff000000), {0.0, 0.0, 1.0, 1.0}},
- {PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0xffffffff), {1.0, 1.0, 1.0, 1.0}},
-
- {PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), {0.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000ff), {0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000ff00), {0.0, 0.0, 1.0, 0.0}},
- {PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00ff0000), {0.0, 1.0, 0.0, 0.0}},
- {PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), {1.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), {1.0, 1.0, 1.0, 1.0}},
-
- {PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x00000000), {0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x000000ff), {0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x0000ff00), {0.0, 0.0, 1.0, 1.0}},
- {PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x00ff0000), {0.0, 1.0, 0.0, 1.0}},
- {PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0xff000000), {1.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0xffffffff), {1.0, 1.0, 1.0, 1.0}},
-
- {PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), {0.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000003ff), {1.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000ffc00), {0.0, 1.0, 0.0, 0.0}},
- {PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x3ff00000), {0.0, 0.0, 1.0, 0.0}},
- {PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xc0000000), {0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), {1.0, 1.0, 1.0, 1.0}},
-
- /*
- * 16-bit rendertarget formats
- */
-
- {PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), {0.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x001f), {0.0, 0.0, 1.0, 0.0}},
- {PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x03e0), {0.0, 1.0, 0.0, 0.0}},
- {PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x7c00), {1.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x8000), {0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), {1.0, 1.0, 1.0, 1.0}},
-
- {PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), {0.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x000f), {0.0, 0.0, 1.0, 0.0}},
- {PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x00f0), {0.0, 1.0, 0.0, 0.0}},
- {PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0f00), {1.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xf000), {0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), {1.0, 1.0, 1.0, 1.0}},
-
- {PIPE_FORMAT_B5G6R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), {0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_B5G6R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x001f), {0.0, 0.0, 1.0, 1.0}},
- {PIPE_FORMAT_B5G6R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x07e0), {0.0, 1.0, 0.0, 1.0}},
- {PIPE_FORMAT_B5G6R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xf800), {1.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_B5G6R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), {1.0, 1.0, 1.0, 1.0}},
-
- /*
- * Luminance/intensity/alpha formats
- */
-
- {PIPE_FORMAT_L8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), {0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_L8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0xff), {1.0, 1.0, 1.0, 1.0}},
-
- {PIPE_FORMAT_A8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), {0.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_A8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0xff), {0.0, 0.0, 0.0, 1.0}},
-
- {PIPE_FORMAT_I8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), {0.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_I8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0xff), {1.0, 1.0, 1.0, 1.0}},
-
- {PIPE_FORMAT_L8A8_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), {0.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_L8A8_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x00ff), {1.0, 1.0, 1.0, 0.0}},
- {PIPE_FORMAT_L8A8_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xff00), {0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_L8A8_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), {1.0, 1.0, 1.0, 1.0}},
-
- {PIPE_FORMAT_L16_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), {0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_L16_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), {1.0, 1.0, 1.0, 1.0}},
-
- /*
- * TODO: SRGB formats
- */
-
- /*
- * Mixed-signed formats
- */
-
- {PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00000000), { 0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x0000007f), { 1.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00000081), {-1.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00007f00), { 0.0, 1.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00008100), { 0.0, -1.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00ff0000), { 0.0, 0.0, 1.0, 1.0}},
- {PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0xff000000), { 0.0, 0.0, 0.0, 1.0}},
-
- {PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), { 0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0x000f), { 1.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0x0011), {-1.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0x01e0), { 0.0, 1.0, 0.0, 1.0}},
- {PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0x0220), { 0.0, -1.0, 0.0, 1.0}},
- {PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0xfc00), { 0.0, 0.0, 1.0, 1.0}},
-
- /*
- * TODO: Depth-stencil formats
- */
-
- /*
- * TODO: YUV formats
- */
-
- /*
- * TODO: Compressed formats
- */
-
- /*
- * Standard 8-bit integer formats
- */
-
- {PIPE_FORMAT_R8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), {0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0xff), {1.0, 0.0, 0.0, 1.0}},
-
- {PIPE_FORMAT_R8G8_UNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x00), {0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8G8_UNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0xff, 0x00), {1.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8G8_UNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0xff), {0.0, 1.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8G8_UNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0xff, 0xff), {1.0, 1.0, 0.0, 1.0}},
-
- {PIPE_FORMAT_R8G8B8_UNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x00), {0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8G8B8_UNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xff, 0x00, 0x00), {1.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8G8B8_UNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0xff, 0x00), {0.0, 1.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8G8B8_UNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0xff), {0.0, 0.0, 1.0, 1.0}},
- {PIPE_FORMAT_R8G8B8_UNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xff, 0xff, 0xff), {1.0, 1.0, 1.0, 1.0}},
-
- {PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), {0.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0x00, 0x00, 0x00), {1.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0xff, 0x00, 0x00), {0.0, 1.0, 0.0, 0.0}},
- {PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0xff, 0x00), {0.0, 0.0, 1.0, 0.0}},
- {PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0xff), {0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0xff, 0xff, 0xff), {1.0, 1.0, 1.0, 1.0}},
-
- {PIPE_FORMAT_R8_USCALED, PACKED_1x8(0xff), PACKED_1x8(0x00), { 0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8_USCALED, PACKED_1x8(0xff), PACKED_1x8(0xff), {255.0, 0.0, 0.0, 1.0}},
-
- {PIPE_FORMAT_R8G8_USCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x00), { 0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8G8_USCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0xff, 0x00), {255.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8G8_USCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0xff), { 0.0, 255.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8G8_USCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0xff, 0xff), {255.0, 255.0, 0.0, 1.0}},
-
- {PIPE_FORMAT_R8G8B8_USCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x00), { 0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8G8B8_USCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xff, 0x00, 0x00), {255.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8G8B8_USCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0xff, 0x00), { 0.0, 255.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8G8B8_USCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0xff), { 0.0, 0.0, 255.0, 1.0}},
- {PIPE_FORMAT_R8G8B8_USCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xff, 0xff, 0xff), {255.0, 255.0, 255.0, 1.0}},
-
- {PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), { 0.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0x00, 0x00, 0x00), {255.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0xff, 0x00, 0x00), { 0.0, 255.0, 0.0, 0.0}},
- {PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0xff, 0x00), { 0.0, 0.0, 255.0, 0.0}},
- {PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0xff), { 0.0, 0.0, 0.0, 255.0}},
- {PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0xff, 0xff, 0xff), {255.0, 255.0, 255.0, 255.0}},
-
- {PIPE_FORMAT_R8_SNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), { 0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8_SNORM, PACKED_1x8(0xff), PACKED_1x8(0x7f), { 1.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8_SNORM, PACKED_1x8(0xff), PACKED_1x8(0x81), {-1.0, 0.0, 0.0, 1.0}},
-
- {PIPE_FORMAT_R8G8_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x00), { 0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8G8_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x7f, 0x00), { 1.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8G8_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x81, 0x00), {-1.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8G8_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x7f), { 0.0, 1.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8G8_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x81), { 0.0, -1.0, 0.0, 1.0}},
-
- {PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x00), { 0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x7f, 0x00, 0x00), { 1.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x81, 0x00, 0x00), {-1.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x7f, 0x00), { 0.0, 1.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x81, 0x00), { 0.0, -1.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x7f), { 0.0, 0.0, 1.0, 1.0}},
- {PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x81), { 0.0, 0.0, -1.0, 1.0}},
-
- {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), { 0.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x7f, 0x00, 0x00, 0x00), { 1.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x81, 0x00, 0x00, 0x00), {-1.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x7f, 0x00, 0x00), { 0.0, 1.0, 0.0, 0.0}},
- {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x81, 0x00, 0x00), { 0.0, -1.0, 0.0, 0.0}},
- {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x7f, 0x00), { 0.0, 0.0, 1.0, 0.0}},
- {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x81, 0x00), { 0.0, 0.0, -1.0, 0.0}},
- {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x7f), { 0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x81), { 0.0, 0.0, 0.0, -1.0}},
-
- {PIPE_FORMAT_R8_SSCALED, PACKED_1x8(0xff), PACKED_1x8(0x00), { 0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8_SSCALED, PACKED_1x8(0xff), PACKED_1x8(0x7f), { 127.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8_SSCALED, PACKED_1x8(0xff), PACKED_1x8(0x80), {-128.0, 0.0, 0.0, 1.0}},
-
- {PIPE_FORMAT_R8G8_SSCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x00), { 0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8G8_SSCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x7f, 0x00), { 127.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8G8_SSCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x80, 0x00), {-128.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8G8_SSCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x7f), { 0.0, 127.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8G8_SSCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x80), { 0.0, -128.0, 0.0, 1.0}},
-
- {PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x00), { 0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x7f, 0x00, 0x00), { 127.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x80, 0x00, 0x00), {-128.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x7f, 0x00), { 0.0, 127.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x80, 0x00), { 0.0, -128.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x7f), { 0.0, 0.0, 127.0, 1.0}},
- {PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x80), { 0.0, 0.0, -128.0, 1.0}},
-
- {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), { 0.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x7f, 0x00, 0x00, 0x00), { 127.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x80, 0x00, 0x00, 0x00), {-128.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x7f, 0x00, 0x00), { 0.0, 127.0, 0.0, 0.0}},
- {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x80, 0x00, 0x00), { 0.0, -128.0, 0.0, 0.0}},
- {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x7f, 0x00), { 0.0, 0.0, 127.0, 0.0}},
- {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x80, 0x00), { 0.0, 0.0, -128.0, 0.0}},
- {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x7f), { 0.0, 0.0, 0.0, 127.0}},
- {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x80), { 0.0, 0.0, 0.0, -128.0}},
-
- /*
- * Standard 16-bit integer formats
- */
-
- {PIPE_FORMAT_R16_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), {0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), {1.0, 0.0, 0.0, 1.0}},
-
- {PIPE_FORMAT_R16G16_UNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x0000), {0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16G16_UNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0xffff, 0x0000), {1.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16G16_UNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0xffff), {0.0, 1.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16G16_UNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0xffff, 0xffff), {1.0, 1.0, 0.0, 1.0}},
-
- {PIPE_FORMAT_R16G16B16_UNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x0000), {0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16G16B16_UNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0xffff, 0x0000, 0x0000), {1.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16G16B16_UNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0xffff, 0x0000), {0.0, 1.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16G16B16_UNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0xffff), {0.0, 0.0, 1.0, 1.0}},
- {PIPE_FORMAT_R16G16B16_UNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0xffff, 0xffff, 0xffff), {1.0, 1.0, 1.0, 1.0}},
-
- {PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x0000), {0.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0xffff, 0x0000, 0x0000, 0x0000), {1.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0xffff, 0x0000, 0x0000), {0.0, 1.0, 0.0, 0.0}},
- {PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0xffff, 0x0000), {0.0, 0.0, 1.0, 0.0}},
- {PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0xffff), {0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), {1.0, 1.0, 1.0, 1.0}},
-
- {PIPE_FORMAT_R16_USCALED, PACKED_1x16(0xffff), PACKED_1x16(0x0000), { 0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16_USCALED, PACKED_1x16(0xffff), PACKED_1x16(0xffff), {65535.0, 0.0, 0.0, 1.0}},
-
- {PIPE_FORMAT_R16G16_USCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x0000), { 0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16G16_USCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0xffff, 0x0000), {65535.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16G16_USCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0xffff), { 0.0, 65535.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16G16_USCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0xffff, 0xffff), {65535.0, 65535.0, 0.0, 1.0}},
-
- {PIPE_FORMAT_R16G16B16_USCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x0000), { 0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16G16B16_USCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0xffff, 0x0000, 0x0000), {65535.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16G16B16_USCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0xffff, 0x0000), { 0.0, 65535.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16G16B16_USCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0xffff), { 0.0, 0.0, 65535.0, 1.0}},
- {PIPE_FORMAT_R16G16B16_USCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0xffff, 0xffff, 0xffff), {65535.0, 65535.0, 65535.0, 1.0}},
-
- {PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x0000), { 0.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0xffff, 0x0000, 0x0000, 0x0000), {65535.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0xffff, 0x0000, 0x0000), { 0.0, 65535.0, 0.0, 0.0}},
- {PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0xffff, 0x0000), { 0.0, 0.0, 65535.0, 0.0}},
- {PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0xffff), { 0.0, 0.0, 0.0, 65535.0}},
- {PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), {65535.0, 65535.0, 65535.0, 65535.0}},
-
- {PIPE_FORMAT_R16_SNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), { 0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16_SNORM, PACKED_1x16(0xffff), PACKED_1x16(0x7fff), { 1.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16_SNORM, PACKED_1x16(0xffff), PACKED_1x16(0x8001), { -1.0, 0.0, 0.0, 1.0}},
-
- {PIPE_FORMAT_R16G16_SNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x0000), { 0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16G16_SNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x7fff, 0x0000), { 1.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16G16_SNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x8001, 0x0000), { -1.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16G16_SNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x7fff), { 0.0, 1.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16G16_SNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x8001), { 0.0, -1.0, 0.0, 1.0}},
-
- {PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x0000), { 0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x7fff, 0x0000, 0x0000), { 1.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x8001, 0x0000, 0x0000), { -1.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x7fff, 0x0000), { 0.0, 1.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x8001, 0x0000), { 0.0, -1.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x7fff), { 0.0, 0.0, 1.0, 1.0}},
- {PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x8001), { 0.0, 0.0, -1.0, 1.0}},
-
- {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x0000), { 0.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x7fff, 0x0000, 0x0000, 0x0000), { 1.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x8001, 0x0000, 0x0000, 0x0000), { -1.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x7fff, 0x0000, 0x0000), { 0.0, 1.0, 0.0, 0.0}},
- {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x8001, 0x0000, 0x0000), { 0.0, -1.0, 0.0, 0.0}},
- {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x7fff, 0x0000), { 0.0, 0.0, 1.0, 0.0}},
- {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x8001, 0x0000), { 0.0, 0.0, -1.0, 0.0}},
- {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x7fff), { 0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x8001), { 0.0, 0.0, 0.0, -1.0}},
-
- {PIPE_FORMAT_R16_SSCALED, PACKED_1x16(0xffff), PACKED_1x16(0x0000), { 0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16_SSCALED, PACKED_1x16(0xffff), PACKED_1x16(0x7fff), { 32767.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16_SSCALED, PACKED_1x16(0xffff), PACKED_1x16(0x8000), {-32768.0, 0.0, 0.0, 1.0}},
-
- {PIPE_FORMAT_R16G16_SSCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x0000), { 0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16G16_SSCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x7fff, 0x0000), { 32767.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16G16_SSCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x8000, 0x0000), {-32768.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16G16_SSCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x7fff), { 0.0, 32767.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16G16_SSCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x8000), { 0.0, -32768.0, 0.0, 1.0}},
-
- {PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x0000), { 0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x7fff, 0x0000, 0x0000), { 32767.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x8000, 0x0000, 0x0000), {-32768.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x7fff, 0x0000), { 0.0, 32767.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x8000, 0x0000), { 0.0, -32768.0, 0.0, 1.0}},
- {PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x7fff), { 0.0, 0.0, 32767.0, 1.0}},
- {PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x8000), { 0.0, 0.0, -32768.0, 1.0}},
-
- {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x0000), { 0.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x7fff, 0x0000, 0x0000, 0x0000), { 32767.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x8000, 0x0000, 0x0000, 0x0000), {-32768.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x7fff, 0x0000, 0x0000), { 0.0, 32767.0, 0.0, 0.0}},
- {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x8000, 0x0000, 0x0000), { 0.0, -32768.0, 0.0, 0.0}},
- {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x7fff, 0x0000), { 0.0, 0.0, 32767.0, 0.0}},
- {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x8000, 0x0000), { 0.0, 0.0, -32768.0, 0.0}},
- {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x7fff), { 0.0, 0.0, 0.0, 32767.0}},
- {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x8000), { 0.0, 0.0, 0.0, -32768.0}},
-
- /*
- * Standard 32-bit integer formats
- *
- * NOTE: We can't accurately represent integers larger than +/-0x1000000
- * with single precision floats, so that's as far as we test.
- */
-
- {PIPE_FORMAT_R32_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), {0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), {1.0, 0.0, 0.0, 1.0}},
-
- {PIPE_FORMAT_R32G32_UNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), {0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32_UNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0xffffffff, 0x00000000), {1.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32_UNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0xffffffff), {0.0, 1.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32_UNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0xffffffff, 0xffffffff), {1.0, 1.0, 0.0, 1.0}},
-
- {PIPE_FORMAT_R32G32B32_UNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), {0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32B32_UNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0xffffffff, 0x00000000, 0x00000000), {1.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32B32_UNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0xffffffff, 0x00000000), {0.0, 1.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32B32_UNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0xffffffff), {0.0, 0.0, 1.0, 1.0}},
- {PIPE_FORMAT_R32G32B32_UNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), {1.0, 1.0, 1.0, 1.0}},
-
- {PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), {0.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0xffffffff, 0x00000000, 0x00000000, 0x00000000), {1.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0xffffffff, 0x00000000, 0x00000000), {0.0, 1.0, 0.0, 0.0}},
- {PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0xffffffff, 0x00000000), {0.0, 0.0, 1.0, 0.0}},
- {PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0xffffffff), {0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), {1.0, 1.0, 1.0, 1.0}},
-
- {PIPE_FORMAT_R32_USCALED, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), { 0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32_USCALED, PACKED_1x32(0xffffffff), PACKED_1x32(0x01000000), {16777216.0, 0.0, 0.0, 1.0}},
-
- {PIPE_FORMAT_R32G32_USCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), { 0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32_USCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x01000000, 0x00000000), {16777216.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32_USCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x01000000), { 0.0, 16777216.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32_USCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x01000000, 0x01000000), {16777216.0, 16777216.0, 0.0, 1.0}},
-
- {PIPE_FORMAT_R32G32B32_USCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), { 0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32B32_USCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x01000000, 0x00000000, 0x00000000), {16777216.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32B32_USCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x01000000, 0x00000000), { 0.0, 16777216.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32B32_USCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x01000000), { 0.0, 0.0, 16777216.0, 1.0}},
- {PIPE_FORMAT_R32G32B32_USCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x01000000, 0x01000000, 0x01000000), {16777216.0, 16777216.0, 16777216.0, 1.0}},
-
- {PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), { 0.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x01000000, 0x00000000, 0x00000000, 0x00000000), {16777216.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x01000000, 0x00000000, 0x00000000), { 0.0, 16777216.0, 0.0, 0.0}},
- {PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x01000000, 0x00000000), { 0.0, 0.0, 16777216.0, 0.0}},
- {PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x01000000), { 0.0, 0.0, 0.0, 16777216.0}},
- {PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x01000000, 0x01000000, 0x01000000, 0x01000000), {16777216.0, 16777216.0, 16777216.0, 16777216.0}},
-
- {PIPE_FORMAT_R32_SNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), { 0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32_SNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x7fffffff), { 1.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32_SNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x80000001), { -1.0, 0.0, 0.0, 1.0}},
-
- {PIPE_FORMAT_R32G32_SNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), { 0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32_SNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x7fffffff, 0x00000000), { 1.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32_SNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x80000001, 0x00000000), { -1.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32_SNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x7fffffff), { 0.0, 1.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32_SNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x80000001), { 0.0, -1.0, 0.0, 1.0}},
-
- {PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), { 0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x7fffffff, 0x00000000, 0x00000000), { 1.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x80000001, 0x00000000, 0x00000000), { -1.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x7fffffff, 0x00000000), { 0.0, 1.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x80000001, 0x00000000), { 0.0, -1.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x7fffffff), { 0.0, 0.0, 1.0, 1.0}},
- {PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x80000001), { 0.0, 0.0, -1.0, 1.0}},
-
- {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), { 0.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x7fffffff, 0x00000000, 0x00000000, 0x00000000), { 1.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x80000001, 0x00000000, 0x00000000, 0x00000000), { -1.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x7fffffff, 0x00000000, 0x00000000), { 0.0, 1.0, 0.0, 0.0}},
- {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x80000001, 0x00000000, 0x00000000), { 0.0, -1.0, 0.0, 0.0}},
- {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x7fffffff, 0x00000000), { 0.0, 0.0, 1.0, 0.0}},
- {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x80000001, 0x00000000), { 0.0, 0.0, -1.0, 0.0}},
- {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x7fffffff), { 0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x80000001), { 0.0, 0.0, 0.0, -1.0}},
-
- {PIPE_FORMAT_R32_SSCALED, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), { 0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32_SSCALED, PACKED_1x32(0xffffffff), PACKED_1x32(0x01000000), { 16777216.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32_SSCALED, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), {-16777216.0, 0.0, 0.0, 1.0}},
-
- {PIPE_FORMAT_R32G32_SSCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), { 0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32_SSCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x01000000, 0x00000000), { 16777216.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32_SSCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0xff000000, 0x00000000), {-16777216.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32_SSCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x01000000), { 0.0, 16777216.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32_SSCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0xff000000), { 0.0, -16777216.0, 0.0, 1.0}},
-
- {PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), { 0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x01000000, 0x00000000, 0x00000000), { 16777216.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0xff000000, 0x00000000, 0x00000000), {-16777216.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x01000000, 0x00000000), { 0.0, 16777216.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0xff000000, 0x00000000), { 0.0, -16777216.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x01000000), { 0.0, 0.0, 16777216.0, 1.0}},
- {PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0xff000000), { 0.0, 0.0, -16777216.0, 1.0}},
-
- {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), { 0.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x01000000, 0x00000000, 0x00000000, 0x00000000), { 16777216.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0xff000000, 0x00000000, 0x00000000, 0x00000000), {-16777216.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x01000000, 0x00000000, 0x00000000), { 0.0, 16777216.0, 0.0, 0.0}},
- {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0xff000000, 0x00000000, 0x00000000), { 0.0, -16777216.0, 0.0, 0.0}},
- {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x01000000, 0x00000000), { 0.0, 0.0, 16777216.0, 0.0}},
- {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0xff000000, 0x00000000), { 0.0, 0.0, -16777216.0, 0.0}},
- {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x01000000), { 0.0, 0.0, 0.0, 16777216.0}},
- {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0xff000000), { 0.0, 0.0, 0.0, -16777216.0}},
-
- /*
- * Standard 32-bit float formats
- */
-
- {PIPE_FORMAT_R32_FLOAT, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), { 0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32_FLOAT, PACKED_1x32(0xffffffff), PACKED_1x32(0x3f800000), { 1.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32_FLOAT, PACKED_1x32(0xffffffff), PACKED_1x32(0xbf800000), { -1.0, 0.0, 0.0, 1.0}},
-
- {PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), { 0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x3f800000, 0x00000000), { 1.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0xbf800000, 0x00000000), {-1.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x3f800000), { 0.0, 1.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0xbf800000), { 0.0, -1.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x3f800000, 0x3f800000), { 1.0, 1.0, 0.0, 1.0}},
-
- {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), { 0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x3f800000, 0x00000000, 0x00000000), { 1.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0xbf800000, 0x00000000, 0x00000000), {-1.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x3f800000, 0x00000000), { 0.0, 1.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0xbf800000, 0x00000000), { 0.0, -1.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x3f800000), { 0.0, 0.0, 1.0, 1.0}},
- {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0xbf800000), { 0.0, 0.0, -1.0, 1.0}},
- {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x3f800000, 0x3f800000, 0x3f800000), { 1.0, 1.0, 1.0, 1.0}},
-
- {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), { 0.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x3f800000, 0x00000000, 0x00000000, 0x00000000), { 1.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0xbf800000, 0x00000000, 0x00000000, 0x00000000), {-1.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x3f800000, 0x00000000, 0x00000000), { 0.0, 1.0, 0.0, 0.0}},
- {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0xbf800000, 0x00000000, 0x00000000), { 0.0, -1.0, 0.0, 0.0}},
- {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x3f800000, 0x00000000), { 0.0, 0.0, 1.0, 0.0}},
- {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0xbf800000, 0x00000000), { 0.0, 0.0, -1.0, 0.0}},
- {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x3f800000), { 0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0xbf800000), { 0.0, 0.0, 0.0, -1.0}},
- {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000), { 1.0, 1.0, 1.0, 1.0}},
-};
+ return success;
+}
static boolean
-test_format_unpack_4f(const struct util_format_test_case *test)
+test_format_unpack_float(const struct util_format_description *format_desc,
+ const struct util_format_test_case *test)
{
- float unpacked[4];
- unsigned i;
+ float unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4] = { { { 0 } } };
+ unsigned i, j, k;
boolean success;
- util_format_unpack_4f(test->format, unpacked, test->packed);
+ format_desc->unpack_float(&unpacked[0][0][0], sizeof unpacked[0], test->packed, 0, format_desc->block.width, format_desc->block.height);
success = TRUE;
- for (i = 0; i < 4; ++i)
- if (test->unpacked[i] != unpacked[i])
- success = FALSE;
+ for (i = 0; i < format_desc->block.height; ++i) {
+ for (j = 0; j < format_desc->block.width; ++j) {
+ for (k = 0; k < 4; ++k) {
+ if (!compare_float(test->unpacked[i][j][k], unpacked[i][j][k])) {
+ success = FALSE;
+ }
+ }
+ }
+ }
if (!success) {
- printf("FAILED: (%f %f %f %f) obtained\n", unpacked[0], unpacked[1], unpacked[2], unpacked[3]);
- printf(" (%f %f %f %f) expected\n", test->unpacked[0], test->unpacked[1], test->unpacked[2], test->unpacked[3]);
+ print_unpacked_float(format_desc, "FAILED: ", unpacked, " obtained\n");
+ print_unpacked_doubl(format_desc, " ", test->unpacked, " expected\n");
}
return success;
@@ -594,69 +192,100 @@ test_format_unpack_4f(const struct util_format_test_case *test)
static boolean
-test_format_pack_4f(const struct util_format_test_case *test)
+
+test_format_pack_float(const struct util_format_description *format_desc,
+ const struct util_format_test_case *test)
{
- uint8_t packed[MAX_PACKED_BYTES];
- unsigned i;
+ float unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4];
+ uint8_t packed[UTIL_FORMAT_MAX_PACKED_BYTES];
+ unsigned i, j, k;
boolean success;
+ if (test->format == PIPE_FORMAT_DXT1_RGBA) {
+ /*
+ * Skip S3TC as packed representation is not canonical.
+ *
+ * TODO: Do a round trip conversion.
+ */
+ return TRUE;
+ }
+
memset(packed, 0, sizeof packed);
+ for (i = 0; i < format_desc->block.height; ++i) {
+ for (j = 0; j < format_desc->block.width; ++j) {
+ for (k = 0; k < 4; ++k) {
+ unpacked[i][j][k] = (float) test->unpacked[i][j][k];
+ }
+ }
+ }
- util_format_pack_4f(test->format, packed, test->unpacked[0], test->unpacked[1], test->unpacked[2], test->unpacked[3]);
+ format_desc->pack_float(packed, 0, &unpacked[0][0][0], sizeof unpacked[0], format_desc->block.width, format_desc->block.height);
success = TRUE;
- for (i = 0; i < MAX_PACKED_BYTES; ++i)
+ for (i = 0; i < format_desc->block.bits/8; ++i)
if ((test->packed[i] & test->mask[i]) != (packed[i] & test->mask[i]))
success = FALSE;
if (!success) {
- /* TODO: print more than 4 bytes */
- printf("FAILED: (%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x) obtained\n",
- packed[0], packed[1], packed[2], packed[3],
- packed[4], packed[5], packed[6], packed[7],
- packed[8], packed[9], packed[10], packed[11],
- packed[12], packed[13], packed[14], packed[15]);
- printf(" (%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x) expected\n",
- test->packed[0], test->packed[1], test->packed[2], test->packed[3],
- test->packed[4], test->packed[5], test->packed[6], test->packed[7],
- test->packed[8], test->packed[9], test->packed[10], test->packed[11],
- test->packed[12], test->packed[13], test->packed[14], test->packed[15]);
+ print_packed(format_desc, "FAILED: ", packed, " obtained\n");
+ print_packed(format_desc, " ", test->packed, " expected\n");
}
return success;
}
-static void
-convert_4f_to_4ub(uint8_t *dst, const double *src)
+static boolean
+convert_float_to_8unorm(uint8_t *dst, const double *src)
{
unsigned i;
+ boolean accurate = TRUE;
+
+ for (i = 0; i < UTIL_FORMAT_MAX_UNPACKED_HEIGHT*UTIL_FORMAT_MAX_UNPACKED_WIDTH*4; ++i) {
+ if (src[i] < 0.0) {
+ accurate = FALSE;
+ dst[i] = 0;
+ }
+ else if (src[i] > 1.0) {
+ accurate = FALSE;
+ dst[i] = 255;
+ }
+ else {
+ dst[i] = src[i] * 255.0;
+ }
+ }
- for (i = 0; i < 4; ++i)
- dst[i] = CLAMP(src[i], 0.0, 1.0) * 255.0;
+ return accurate;
}
static boolean
-test_format_unpack_4ub(const struct util_format_test_case *test)
+test_format_unpack_8unorm(const struct util_format_description *format_desc,
+ const struct util_format_test_case *test)
{
- uint8_t unpacked[4];
- uint8_t expected[4];
- unsigned i;
+ uint8_t unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4] = { { { 0 } } };
+ uint8_t expected[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4] = { { { 0 } } };
+ unsigned i, j, k;
boolean success;
- util_format_unpack_4ub(test->format, unpacked, test->packed);
+ format_desc->unpack_8unorm(&unpacked[0][0][0], sizeof unpacked[0], test->packed, 0, 1, 1);
- convert_4f_to_4ub(expected, test->unpacked);
+ convert_float_to_8unorm(&expected[0][0][0], &test->unpacked[0][0][0]);
success = TRUE;
- for (i = 0; i < 4; ++i)
- if (expected[i] != unpacked[i])
- success = FALSE;
+ for (i = 0; i < format_desc->block.height; ++i) {
+ for (j = 0; j < format_desc->block.width; ++j) {
+ for (k = 0; k < 4; ++k) {
+ if (expected[i][j][k] != unpacked[i][j][k]) {
+ success = FALSE;
+ }
+ }
+ }
+ }
if (!success) {
- printf("FAILED: (0x%02x 0x%02x 0x%02x 0x%02x) obtained\n", unpacked[0], unpacked[1], unpacked[2], unpacked[3]);
- printf(" (0x%02x 0x%02x 0x%02x 0x%02x) expected\n", expected[0], expected[1], expected[2], expected[3]);
+ print_unpacked_8unorm(format_desc, "FAILED: ", unpacked, " obtained\n");
+ print_unpacked_8unorm(format_desc, " ", expected, " expected\n");
}
return success;
@@ -664,36 +293,42 @@ test_format_unpack_4ub(const struct util_format_test_case *test)
static boolean
-test_format_pack_4ub(const struct util_format_test_case *test)
+test_format_pack_8unorm(const struct util_format_description *format_desc,
+ const struct util_format_test_case *test)
{
- uint8_t unpacked[4];
- uint8_t packed[MAX_PACKED_BYTES];
+ uint8_t unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4];
+ uint8_t packed[UTIL_FORMAT_MAX_PACKED_BYTES];
unsigned i;
boolean success;
- convert_4f_to_4ub(unpacked, test->unpacked);
+ if (test->format == PIPE_FORMAT_DXT1_RGBA) {
+ /*
+ * Skip S3TC as packed representation is not canonical.
+ *
+ * TODO: Do a round trip conversion.
+ */
+ return TRUE;
+ }
+
+ if (!convert_float_to_8unorm(&unpacked[0][0][0], &test->unpacked[0][0][0])) {
+ /*
+ * Skip test cases which cannot be represented by four unorm bytes.
+ */
+ return TRUE;
+ }
memset(packed, 0, sizeof packed);
- util_format_pack_4ub(test->format, packed, unpacked[0], unpacked[1], unpacked[2], unpacked[3]);
+ format_desc->pack_8unorm(packed, 0, &unpacked[0][0][0], sizeof unpacked[0], 1, 1);
success = TRUE;
- for (i = 0; i < MAX_PACKED_BYTES; ++i)
+ for (i = 0; i < format_desc->block.bits/8; ++i)
if ((test->packed[i] & test->mask[i]) != (packed[i] & test->mask[i]))
success = FALSE;
if (!success) {
- /* TODO: print more than 4 bytes */
- printf("FAILED: (%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x) obtained\n",
- packed[0], packed[1], packed[2], packed[3],
- packed[4], packed[5], packed[6], packed[7],
- packed[8], packed[9], packed[10], packed[11],
- packed[12], packed[13], packed[14], packed[15]);
- printf(" (%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x) expected\n",
- test->packed[0], test->packed[1], test->packed[2], test->packed[3],
- test->packed[4], test->packed[5], test->packed[6], test->packed[7],
- test->packed[8], test->packed[9], test->packed[10], test->packed[11],
- test->packed[12], test->packed[13], test->packed[14], test->packed[15]);
+ print_packed(format_desc, "FAILED: ", packed, " obtained\n");
+ print_packed(format_desc, " ", test->packed, " expected\n");
}
return success;
@@ -701,7 +336,8 @@ test_format_pack_4ub(const struct util_format_test_case *test)
typedef boolean
-(*test_func_t)(const struct util_format_test_case *test);
+(*test_func_t)(const struct util_format_description *format_desc,
+ const struct util_format_test_case *test);
static boolean
@@ -711,16 +347,29 @@ test_one(test_func_t func, const char *suffix)
unsigned i;
bool success = TRUE;
- for (i = 0; i < sizeof(test_cases)/sizeof(test_cases[0]); ++i) {
- if (test_cases[i].format != last_format) {
- const struct util_format_description *format_desc;
- format_desc = util_format_description(test_cases[i].format);
- printf("Testing %s.%s ...\n", format_desc->name, suffix);
- last_format = test_cases[i].format;
+ for (i = 0; i < util_format_nr_test_cases; ++i) {
+ const struct util_format_test_case *test = &util_format_test_cases[i];
+ const struct util_format_description *format_desc;
+ bool skip = FALSE;
+
+ format_desc = util_format_description(test->format);
+
+ if (format_desc->layout == UTIL_FORMAT_LAYOUT_S3TC &&
+ !util_format_s3tc_enabled) {
+ skip = TRUE;
+ }
+
+ if (test->format != last_format) {
+ printf("%s util_format_%s_%s ...\n",
+ skip ? "Skipping" : "Testing", format_desc->short_name, suffix);
+ last_format = test->format;
}
- if (!func(&test_cases[i]))
- success = FALSE;
+ if (!skip) {
+ if (!func(format_desc, &util_format_test_cases[i])) {
+ success = FALSE;
+ }
+ }
}
return success;
@@ -732,16 +381,19 @@ test_all(void)
{
bool success = TRUE;
- if (!test_one(&test_format_pack_4f, "pack_4f"))
+ if (!test_one(&test_format_fetch_float, "fetch_float"))
+ success = FALSE;
+
+ if (!test_one(&test_format_pack_float, "pack_float"))
success = FALSE;
- if (!test_one(&test_format_unpack_4f, "unpack_4f"))
+ if (!test_one(&test_format_unpack_float, "unpack_float"))
success = FALSE;
- if (!test_one(&test_format_pack_4ub, "pack_4ub"))
+ if (!test_one(&test_format_pack_8unorm, "pack_8unorm"))
success = FALSE;
- if (!test_one(&test_format_unpack_4ub, "unpack_4ub"))
+ if (!test_one(&test_format_unpack_8unorm, "unpack_8unorm"))
success = FALSE;
return success;
@@ -752,6 +404,8 @@ int main(int argc, char **argv)
{
boolean success;
+ util_format_s3tc_init();
+
success = test_all();
return success ? 0 : 1;
diff --git a/progs/gallium/unit/u_half_test.c b/progs/gallium/unit/u_half_test.c
new file mode 100644
index 0000000000..9e3392e6d6
--- /dev/null
+++ b/progs/gallium/unit/u_half_test.c
@@ -0,0 +1,32 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <float.h>
+
+#include "util/u_math.h"
+#include "util/u_half.h"
+
+int
+main(int argc, char **argv)
+{
+ unsigned i;
+ unsigned roundtrip_fails = 0;
+ for(i = 0; i < 1 << 16; ++i)
+ {
+ half h = (half) i;
+ union fi f;
+ half rh;
+ f.ui = util_half_to_floatui(h);
+ rh = util_floatui_to_half(f.ui);
+ if(h != rh)
+ {
+ printf("Roundtrip failed: %x -> %x = %f -> %x\n", h, f.ui, f.f, rh);
+ ++roundtrip_fails;
+ }
+ }
+
+ if(roundtrip_fails)
+ printf("Failure! %u/65536 half floats failed a conversion to float and back.\n", roundtrip_fails);
+ else
+ printf("Success!\n");
+ return 0;
+}
diff --git a/progs/glsl/Makefile b/progs/glsl/Makefile
index 3b5a5959ae..6030c8002f 100644
--- a/progs/glsl/Makefile
+++ b/progs/glsl/Makefile
@@ -26,6 +26,7 @@ PROG_SOURCES = \
convolutions.c \
deriv.c \
fragcoord.c \
+ fsraytrace.c \
identity.c \
linktest.c \
mandelbrot.c \
@@ -46,7 +47,8 @@ PROG_SOURCES = \
trirast.c \
twoside.c \
vert-or-frag-only.c \
- vert-tex.c
+ vert-tex.c \
+ vsraytrace.c
UTIL_HEADERS = \
extfuncs.h \
diff --git a/progs/glsl/SConscript b/progs/glsl/SConscript
index 8f2ebcf69c..02884e5a71 100644
--- a/progs/glsl/SConscript
+++ b/progs/glsl/SConscript
@@ -8,6 +8,7 @@ progs = [
'convolutions',
'deriv',
'fragcoord',
+ 'fsraytrace',
'identity',
'linktest',
'mandelbrot',
@@ -27,6 +28,7 @@ progs = [
'twoside',
'vert-or-frag-only',
'vert-tex',
+ 'vsraytrace',
]
for prog in progs:
diff --git a/progs/glsl/fsraytrace.c b/progs/glsl/fsraytrace.c
new file mode 100644
index 0000000000..af72a99099
--- /dev/null
+++ b/progs/glsl/fsraytrace.c
@@ -0,0 +1,412 @@
+/* -*- mode: c; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; coding: utf-8-unix -*- */
+/*
+ Copyright (c) 2010 Kristóf Ralovich
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+*/
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <GL/glew.h>
+#include <GL/glut.h>
+#include "shaderutil.h"
+#include <math.h>
+
+static int Win;
+static int WinWidth = 512, WinHeight = 512;
+static int mouseGrabbed = 0;
+static GLuint vertShader;
+static GLuint fragShader;
+static GLuint program;
+static float rot[9] = {1,0,0, 0,1,0, 0,0,1};
+
+static const char* vsSource =
+ "varying vec2 rayDir; \n"
+ " \n"
+ "void main() \n"
+ "{ \n"
+ " rayDir = gl_MultiTexCoord0.xy - vec2(0.5,0.5); \n"
+ " gl_Position = gl_ProjectionMatrix * gl_Vertex; \n"
+ "}\n";
+
+static const char* fsSource =
+ "const float INF = 9999.9; \n"
+ "const float EPSILON = 0.00001; \n"
+ "const vec3 lightPos = vec3(0.0, 8.0, 1.0); \n"
+ "const vec4 backgroundColor = vec4(0.2,0.3,0.4,1); \n"
+ " \n"
+ "varying vec2 rayDir; \n"
+ " \n"
+ "uniform mat3 rot; \n"
+ " \n"
+ "struct Ray \n"
+ "{ \n"
+ "vec3 orig; \n"
+ "vec3 dir; \n"
+ "}; \n"
+ " \n"
+ "struct Sphere \n"
+ "{ \n"
+ " vec3 c; \n"
+ " float r; \n"
+ "}; \n"
+ " \n"
+ "struct Isec \n"
+ "{ \n"
+ " float t; \n"
+ " int idx; \n"
+ " vec3 hit; \n"
+ " vec3 n; \n"
+ "}; \n"
+ " \n"
+#ifdef __APPLE__
+ "Sphere spheres0 = Sphere( vec3(0.0,0.0,-1.0), 0.5 ); \n"
+ "Sphere spheres1 = Sphere( vec3(-3.0,0.0,-1.0), 1.5 ); \n"
+ "Sphere spheres2 = Sphere( vec3(0.0,3.0,-1.0), 0.5 ); \n"
+ "Sphere spheres3 = Sphere( vec3(2.0,0.0,-1.0), 1.0 ); \n"
+#else
+ "const Sphere spheres0 = Sphere( vec3(0.0,0.0,-1.0), 0.5 ); \n"
+ "const Sphere spheres1 = Sphere( vec3(-3.0,0.0,-1.0), 1.5 ); \n"
+ "const Sphere spheres2 = Sphere( vec3(0.0,3.0,-1.0), 0.5 ); \n"
+ "const Sphere spheres3 = Sphere( vec3(2.0,0.0,-1.0), 1.0 ); \n"
+#endif
+ " \n"
+ "// Mesa intel gen4 generates \"unsupported IR in fragment shader 13\" for\n"
+ "// sqrt, let's work around. \n"
+ "float \n"
+ "sqrt_hack(float f2) \n"
+ "{ \n"
+ " vec3 v = vec3(f2,0.0,0.0); \n"
+ " return length(v); \n"
+ "} \n"
+ " \n"
+ "void \n"
+ "intersect(const in Ray ray, \n"
+ " const in Sphere sph, \n"
+ " const in int idx, \n"
+ " inout Isec isec) \n"
+ "{ \n"
+ " // Project both o and the sphere to the plane perpendicular to d \n"
+ " // and containing c. Let x be the point where the ray intersects \n"
+ " // the plane. If |x-c| < r, the ray intersects the sphere. \n"
+ " vec3 o = ray.orig; \n"
+ " vec3 d = ray.dir; \n"
+ " vec3 n = -d; \n"
+ " vec3 c = sph.c; \n"
+ " float r = sph.r; \n"
+ " float t = dot(c-o,n)/dot(n,d); \n"
+ " vec3 x = o+d*t; \n"
+ " float e = length(x-c); \n"
+ " if(e > r) \n"
+ " { \n"
+ " // no intersection \n"
+ " return; \n"
+ " } \n"
+ " \n"
+ " // Apply Pythagorean theorem on the (intersection,x,c) triangle \n"
+ " // to get the distance between c and the intersection. \n"
+ "#ifndef BUGGY_INTEL_GEN4_GLSL \n"
+ " float f = sqrt(r*r - e*e); \n"
+ "#else \n"
+ " float f = sqrt_hack(r*r - e*e); \n"
+ "#endif \n"
+ " float dist = t - f; \n"
+ " if(dist < 0.0) \n"
+ " { \n"
+ " // inside the sphere \n"
+ " return; \n"
+ " } \n"
+ " \n"
+ " if(dist < EPSILON) \n"
+ " return; \n"
+ " \n"
+ " if(dist > isec.t) \n"
+ " return; \n"
+ " \n"
+ " isec.t = dist; \n"
+ " isec.idx = idx; \n"
+ " \n"
+ " isec.hit = ray.orig + ray.dir * isec.t; \n"
+ " isec.n = (isec.hit - c) / r; \n"
+ "} \n"
+ " \n"
+ "Isec \n"
+ "intersect(const in Ray ray, \n"
+ " const in float max_t /*= INF*/) \n"
+ "{ \n"
+ " Isec nearest; \n"
+ " nearest.t = max_t; \n"
+ " nearest.idx = -1; \n"
+ " \n"
+ " intersect(ray, spheres0, 0, nearest); \n"
+ " intersect(ray, spheres1, 1, nearest); \n"
+ " intersect(ray, spheres2, 2, nearest); \n"
+ " intersect(ray, spheres3, 3, nearest); \n"
+ " \n"
+ " return nearest; \n"
+ "} \n"
+ " \n"
+ "vec4 \n"
+ "idx2color(const in int idx) \n"
+ "{ \n"
+ " vec4 diff; \n"
+ " if(idx == 0) \n"
+ " diff = vec4(1.0, 0.0, 0.0, 0.0); \n"
+ " else if(idx == 1) \n"
+ " diff = vec4(0.0, 1.0, 0.0, 0.0); \n"
+ " else if(idx == 2) \n"
+ " diff = vec4(0.0, 0.0, 1.0, 0.0); \n"
+ " else if(idx == 3) \n"
+ " diff = vec4(1.0, 1.0, 0.0, 0.0); \n"
+ " return diff; \n"
+ "} \n"
+ " \n"
+ "vec4 \n"
+ "trace0(const in Ray ray) \n"
+ "{ \n"
+ " Isec isec = intersect(ray, INF); \n"
+ " \n"
+ " if(isec.idx == -1) \n"
+ " { \n"
+ " return backgroundColor; \n"
+ " } \n"
+ " \n"
+ " vec4 diff = idx2color(isec.idx); \n"
+ " \n"
+ " vec3 N = isec.n; \n"
+ " vec3 L = normalize(lightPos-isec.hit); \n"
+ " vec3 camera_dir = normalize(ray.orig - isec.hit); \n"
+ " return dot(N,L)*diff + pow( \n"
+ " clamp(dot(reflect(-L,N),camera_dir),0.0,1.0),16.0); \n"
+ "} \n"
+ " \n"
+ "vec4 \n"
+ "trace1(const in Ray ray) \n"
+ "{ \n"
+ " Isec isec = intersect(ray, INF); \n"
+ " \n"
+ " if(isec.idx == -1) \n"
+ " { \n"
+ " return backgroundColor; \n"
+ " } \n"
+ " \n"
+ " Ray reflRay = Ray(isec.hit, reflect(ray.dir, isec.n)); \n"
+ " \n"
+ " vec4 reflCol = trace0(reflRay); \n"
+ " \n"
+ " vec4 diff = idx2color(isec.idx) + reflCol; \n"
+ " \n"
+ " vec3 N = isec.n; \n"
+ " vec3 L = normalize(lightPos-isec.hit); \n"
+ " vec3 camera_dir = normalize(ray.orig - isec.hit); \n"
+ " return dot(N,L)*diff + pow( \n"
+ " clamp(dot(reflect(-L,N),camera_dir),0.0,1.0),16.0); \n"
+ "} \n"
+ " \n"
+ "void main() \n"
+ "{ \n"
+ " const float z = -0.5; \n"
+ " const vec3 cameraPos = vec3(0,0,3); \n"
+ " Ray r = Ray(cameraPos, normalize(vec3(rayDir, z) * rot)); \n"
+ " gl_FragColor = trace1(r); \n"
+ "}\n";
+
+static
+float
+deg2rad(const float degree)
+{
+ return( degree * 0.017453292519943295769236907684886F);
+}
+
+static void
+rotate_xy(float* mat3, const float degreesAroundX, const float degreesAroundY)
+{
+ const float rad1 = deg2rad(degreesAroundX);
+ const float c1 = cosf(rad1);
+ const float s1 = sinf(rad1);
+ const float rad2 = deg2rad(degreesAroundY);
+ const float c2 = cosf(rad2);
+ const float s2 = sinf(rad2);
+ mat3[0] = c2; mat3[3] = 0.0F; mat3[6] = s2;
+ mat3[1] = s1*s2; mat3[4] = c1; mat3[7] = -s1*c2;
+ mat3[2] = -c1*s2;mat3[5] = s1; mat3[8] = c1*c2;
+}
+
+static void
+identity(float* mat3)
+{
+ mat3[0] = 1.0F; mat3[3] = 0.0F; mat3[6] = 0.0F;
+ mat3[1] = 0.0F; mat3[4] = 1.0F; mat3[7] = 0.0F;
+ mat3[2] = 0.0F; mat3[5] = 0.0F; mat3[8] = 1.0F;
+}
+
+static void
+Draw(void)
+{
+ GLint location = glGetUniformLocation(program, "rot");
+ static const float m = -10.F;
+ static const float p = 10.F;
+ static const float d = -0.5F;
+
+ glUseProgram(program);
+ glUniformMatrix3fv(location, 1, 0, rot);
+
+ glBegin(GL_QUADS);
+ {
+ glTexCoord2f(0.0F, 0.0F); glVertex3f(m, m, d);
+ glTexCoord2f(1.0F, 0.0F); glVertex3f(p, m, d);
+ glTexCoord2f(1.0F, 1.0F); glVertex3f(p, p, d);
+ glTexCoord2f(0.0F, 1.0F); glVertex3f(m, p, d);
+ }
+ glEnd();
+ glUseProgram(0);
+
+ glutSwapBuffers();
+
+ {
+ static int frames = 0;
+ static int t0 = 0;
+ static int t1 = 0;
+ float dt;
+ frames++;
+ t1 = glutGet(GLUT_ELAPSED_TIME);
+ dt = (float)(t1-t0)/1000.0F;
+ if(dt >= 5.0F)
+ {
+ float fps = (float)frames / dt;
+ printf("%f FPS (%d frames in %f seconds)\n", fps, frames, dt);
+ frames = 0;
+ t0 = t1;
+ }
+ }
+}
+
+
+static void
+Reshape(int width, int height)
+{
+ WinWidth = width;
+ WinHeight = height;
+ glViewport(0, 0, width, height);
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrtho(-10, 10, -10, 10, -1, 1);
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+}
+
+
+static void
+Key(unsigned char key, int x, int y)
+{
+ (void) x;
+ (void) y;
+ switch (key) {
+ case 27:
+ glutDestroyWindow(Win);
+ exit(0);
+ break;
+ }
+ glutPostRedisplay();
+}
+
+
+static
+void
+drag(int x, int y)
+{
+ float scale = 1.5F;
+ if(mouseGrabbed)
+ {
+ static GLfloat xRot = 0, yRot = 0;
+ xRot = (float)(x - WinWidth/2) / scale;
+ yRot = (float)(y - WinHeight/2) / scale;
+ identity(rot);
+ rotate_xy(rot, yRot, xRot);
+ glutPostRedisplay();
+ }
+}
+
+
+static
+void
+mouse(int button, int state, int x, int y)
+{
+ mouseGrabbed = (state == GLUT_DOWN);
+}
+
+
+static void
+Init(void)
+{
+ glDisable(GL_DEPTH_TEST);
+
+ if(!ShadersSupported())
+ {
+ fprintf(stderr, "Shaders are not supported!\n");
+ exit(-1);
+ }
+
+ vertShader = CompileShaderText(GL_VERTEX_SHADER, vsSource);
+ fragShader = CompileShaderText(GL_FRAGMENT_SHADER, fsSource);
+ program = LinkShaders(vertShader, fragShader);
+ glUseProgram(0);
+
+ if(glGetError() != 0)
+ {
+ fprintf(stderr, "Shaders were not loaded!\n");
+ exit(-1);
+ }
+
+ if(!glIsShader(vertShader))
+ {
+ fprintf(stderr, "Vertex shader failed!\n");
+ exit(-1);
+ }
+
+ if(!glIsProgram(program))
+ {
+ fprintf(stderr, "Shader program failed!\n");
+ exit(-1);
+ }
+
+ printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
+}
+
+
+int
+main(int argc, char *argv[])
+{
+ glutInitWindowSize(WinWidth, WinHeight);
+ glutInit(&argc, argv);
+ glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
+ Win = glutCreateWindow(argv[0]);
+ glewInit();
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutDisplayFunc(Draw);
+ glutMouseFunc(mouse);
+ glutMotionFunc(drag);
+ glutIdleFunc(Draw);
+ Init();
+ glutMainLoop();
+ return 0;
+}
+
diff --git a/progs/glsl/vsraytrace.c b/progs/glsl/vsraytrace.c
new file mode 100644
index 0000000000..64d928883e
--- /dev/null
+++ b/progs/glsl/vsraytrace.c
@@ -0,0 +1,401 @@
+/* -*- mode: c; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; coding: utf-8-unix -*- */
+/*
+ Copyright (c) 2010 Kristóf Ralovich
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+*/
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <GL/glew.h>
+#include <GL/glut.h>
+#include "shaderutil.h"
+#include <math.h>
+
+static int Win;
+static int WinWidth = 256, WinHeight = 256;
+static GLboolean mouseGrabbed = GL_FALSE;
+static GLuint vertShader;
+static GLuint program;
+float rot[9] = {1,0,0, 0,1,0, 0,0,1};
+
+static const char* vsSource =
+ "const float INF = 9999.9; \n"
+ "const float EPSILON = 0.00001; \n"
+ "const vec3 lightPos = vec3(0.0, 8.0, 1.0); \n"
+ "const vec4 backgroundColor = vec4(0.2,0.3,0.4,1); \n"
+ " \n"
+ "uniform mat3 rot; \n"
+ " \n"
+ "struct Ray \n"
+ "{ \n"
+ "vec3 orig; \n"
+ "vec3 dir; \n"
+ "}; \n"
+ " \n"
+ "struct Sphere \n"
+ "{ \n"
+ " vec3 c; \n"
+ " float r; \n"
+ "}; \n"
+ " \n"
+ "struct Isec \n"
+ "{ \n"
+ " float t; \n"
+ " int idx; \n"
+ " vec3 hit; \n"
+ " vec3 n; \n"
+ "}; \n"
+ " \n"
+#ifdef __APPLE__
+ "Sphere spheres0 = Sphere( vec3(0.0,0.0,-1.0), 0.5 ); \n"
+ "Sphere spheres1 = Sphere( vec3(-3.0,0.0,-1.0), 1.5 ); \n"
+ "Sphere spheres2 = Sphere( vec3(0.0,3.0,-1.0), 0.5 ); \n"
+ "Sphere spheres3 = Sphere( vec3(2.0,0.0,-1.0), 1.0 ); \n"
+#else
+ "const Sphere spheres0 = Sphere( vec3(0.0,0.0,-1.0), 0.5 ); \n"
+ "const Sphere spheres1 = Sphere( vec3(-3.0,0.0,-1.0), 1.5 ); \n"
+ "const Sphere spheres2 = Sphere( vec3(0.0,3.0,-1.0), 0.5 ); \n"
+ "const Sphere spheres3 = Sphere( vec3(2.0,0.0,-1.0), 1.0 ); \n"
+#endif
+ " \n"
+ "// Mesa intel gen4 generates \"unsupported IR in fragment shader 13\" for\n"
+ "// sqrt, let's work around. \n"
+ "float \n"
+ "sqrt_hack(float f2) \n"
+ "{ \n"
+ " vec3 v = vec3(f2,0.0,0.0); \n"
+ " return length(v); \n"
+ "} \n"
+ " \n"
+ "void \n"
+ "intersect(const in Ray ray, \n"
+ " const in Sphere sph, \n"
+ " const in int idx, \n"
+ " inout Isec isec) \n"
+ "{ \n"
+ " // Project both o and the sphere to the plane perpendicular to d \n"
+ " // and containing c. Let x be the point where the ray intersects \n"
+ " // the plane. If |x-c| < r, the ray intersects the sphere. \n"
+ " vec3 o = ray.orig; \n"
+ " vec3 d = ray.dir; \n"
+ " vec3 n = -d; \n"
+ " vec3 c = sph.c; \n"
+ " float r = sph.r; \n"
+ " float t = dot(c-o,n)/dot(n,d); \n"
+ " vec3 x = o+d*t; \n"
+ " float e = length(x-c); \n"
+ " if(e > r) \n"
+ " { \n"
+ " // no intersection \n"
+ " return; \n"
+ " } \n"
+ " \n"
+ " // Apply Pythagorean theorem on the (intersection,x,c) triangle \n"
+ " // to get the distance between c and the intersection. \n"
+ "#define BUGGY_INTEL_GEN4_GLSL 1 \n"
+ "#ifndef BUGGY_INTEL_GEN4_GLSL \n"
+ " float f = sqrt(r*r - e*e); \n"
+ "#else \n"
+ " float f = sqrt_hack(r*r - e*e); \n"
+ "#endif \n"
+ " float dist = t - f; \n"
+ " if(dist < 0.0) \n"
+ " { \n"
+ " // inside the sphere \n"
+ " return; \n"
+ " } \n"
+ " \n"
+ " if(dist < EPSILON) \n"
+ " return; \n"
+ " \n"
+ " if(dist > isec.t) \n"
+ " return; \n"
+ " \n"
+ " isec.t = dist; \n"
+ " isec.idx = idx; \n"
+ " \n"
+ " isec.hit = ray.orig + ray.dir * isec.t; \n"
+ " isec.n = (isec.hit - c) / r; \n"
+ "} \n"
+ " \n"
+ "Isec \n"
+ "intersect(const in Ray ray, \n"
+ " const in float max_t /*= INF*/) \n"
+ "{ \n"
+ " Isec nearest; \n"
+ " nearest.t = max_t; \n"
+ " nearest.idx = -1; \n"
+ " \n"
+ " intersect(ray, spheres0, 0, nearest); \n"
+ " intersect(ray, spheres1, 1, nearest); \n"
+ " intersect(ray, spheres2, 2, nearest); \n"
+ " intersect(ray, spheres3, 3, nearest); \n"
+ " \n"
+ " return nearest; \n"
+ "} \n"
+ " \n"
+ "vec4 \n"
+ "idx2color(const in int idx) \n"
+ "{ \n"
+ " vec4 diff; \n"
+ " if(idx == 0) \n"
+ " diff = vec4(1.0, 0.0, 0.0, 0.0); \n"
+ " else if(idx == 1) \n"
+ " diff = vec4(0.0, 1.0, 0.0, 0.0); \n"
+ " else if(idx == 2) \n"
+ " diff = vec4(0.0, 0.0, 1.0, 0.0); \n"
+ " else if(idx == 3) \n"
+ " diff = vec4(1.0, 1.0, 0.0, 0.0); \n"
+ " return diff; \n"
+ "} \n"
+ " \n"
+ "vec4 \n"
+ "trace0(const in Ray ray) \n"
+ "{ \n"
+ " Isec isec = intersect(ray, INF); \n"
+ " \n"
+ " if(isec.idx == -1) \n"
+ " { \n"
+ " return backgroundColor; \n"
+ " } \n"
+ " \n"
+ " vec4 diff = idx2color(isec.idx); \n"
+ " \n"
+ " vec3 N = isec.n; \n"
+ " vec3 L = normalize(lightPos-isec.hit); \n"
+ " vec3 camera_dir = normalize(ray.orig - isec.hit); \n"
+ " return dot(N,L)*diff + pow( \n"
+ " clamp(dot(reflect(-L,N),camera_dir),0.0,1.0),16.0); \n"
+ "} \n"
+ " \n"
+ "vec4 \n"
+ "trace1(const in Ray ray) \n"
+ "{ \n"
+ " Isec isec = intersect(ray, INF); \n"
+ " \n"
+ " if(isec.idx == -1) \n"
+ " { \n"
+ " return backgroundColor; \n"
+ " } \n"
+ " \n"
+ " Ray reflRay = Ray(isec.hit, reflect(ray.dir, isec.n)); \n"
+ " \n"
+ " vec4 reflCol = trace0(reflRay); \n"
+ " \n"
+ " vec4 diff = idx2color(isec.idx) + reflCol; \n"
+ " \n"
+ " vec3 N = isec.n; \n"
+ " vec3 L = normalize(lightPos-isec.hit); \n"
+ " vec3 camera_dir = normalize(ray.orig - isec.hit); \n"
+ " return dot(N,L)*diff + pow( \n"
+ " clamp(dot(reflect(-L,N),camera_dir),0.0,1.0),16.0); \n"
+ "} \n"
+ " \n"
+ "void main() \n"
+ "{ \n"
+ " const vec3 cameraPos = vec3(0,0,3); \n"
+ " vec3 rayDir = normalize(vec3(gl_Vertex.x, gl_Vertex.y, -1.0) * rot);\n"
+ " Ray ray = Ray(cameraPos, rayDir); \n"
+ " gl_Position = gl_Vertex; \n"
+ " gl_FrontColor = trace1(ray); \n"
+ "}\n";
+
+
+static
+float
+deg2rad(const float degree)
+{
+ return( degree * 0.017453292519943295769236907684886F);
+}
+
+static void
+rotate_xy(float* mat3, const float degreesAroundX, const float degreesAroundY)
+{
+ const float rad1 = deg2rad(degreesAroundX);
+ const float c1 = cosf(rad1);
+ const float s1 = sinf(rad1);
+ const float rad2 = deg2rad(degreesAroundY);
+ const float c2 = cosf(rad2);
+ const float s2 = sinf(rad2);
+ mat3[0] = c2; mat3[3] = 0.0F; mat3[6] = s2;
+ mat3[1] = s1*s2; mat3[4] = c1; mat3[7] = -s1*c2;
+ mat3[2] = -c1*s2;mat3[5] = s1; mat3[8] = c1*c2;
+}
+
+static void
+identity(float* mat3)
+{
+ mat3[0] = 1.0F; mat3[3] = 0.0F; mat3[6] = 0.0F;
+ mat3[1] = 0.0F; mat3[4] = 1.0F; mat3[7] = 0.0F;
+ mat3[2] = 0.0F; mat3[5] = 0.0F; mat3[8] = 1.0F;
+}
+
+static void
+Draw(void)
+{
+ const float w = 0.5F * WinWidth;
+ const float h = 0.5F * WinHeight;
+ int x,y;
+
+ GLint location = glGetUniformLocation(program, "rot");
+
+ glUseProgram(program);
+ glUniformMatrix3fv(location, 1, 0, rot);
+ glBegin(GL_POINTS);
+ for(y = 0; y < WinHeight; y++)
+ {
+ for(x = 0; x < WinWidth; x++)
+ {
+ const float posx = x / w - 1.0F;
+ const float posy = y / h - 1.0F;
+ glVertex2f(posx, posy);
+ }
+ }
+ glEnd();
+ glUseProgram(0);
+
+ glutSwapBuffers();
+
+ {
+ static int frames = 0;
+ static int t0 = 0;
+ static int t1 = 0;
+ float dt;
+ frames++;
+ t1 = glutGet(GLUT_ELAPSED_TIME);
+ dt = (float)(t1-t0)/1000.0F;
+ if (dt >= 5.0F)
+ {
+ float fps = (float)frames / dt;
+ printf("%f FPS (%d frames in %f seconds)\n", fps, frames, dt);
+ frames = 0;
+ t0 = t1;
+ }
+ }
+}
+
+
+static void
+Reshape(int width, int height)
+{
+ WinWidth = width;
+ WinHeight = height;
+ glViewport(0, 0, width, height);
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+}
+
+
+static void
+Key(unsigned char key, int x, int y)
+{
+ if(key == 27)
+ {
+ glutDestroyWindow(Win);
+ exit(0);
+ }
+ glutPostRedisplay();
+}
+
+
+static
+void
+drag(int x, int y)
+{
+ float scale = 1.5F;
+ if(mouseGrabbed)
+ {
+ static GLfloat xRot = 0, yRot = 0;
+ xRot = (float)(x - WinWidth/2) / scale;
+ yRot = (float)(y - WinHeight/2) / scale;
+ identity(rot);
+ rotate_xy(rot, yRot, xRot);
+ glutPostRedisplay();
+ }
+}
+
+
+static
+void
+mouse(int button, int state, int x, int y)
+{
+ mouseGrabbed = (state == GLUT_DOWN);
+}
+
+
+static void
+Init(void)
+{
+ glDisable(GL_DEPTH_TEST);
+
+ if(!ShadersSupported())
+ {
+ fprintf(stderr, "Shaders are not supported!\n");
+ exit(-1);
+ }
+
+ vertShader = CompileShaderText(GL_VERTEX_SHADER, vsSource);
+ program = LinkShaders(vertShader, 0);
+ glUseProgram(0);
+
+ if(glGetError() != 0)
+ {
+ fprintf(stderr, "Shaders were not loaded!\n");
+ exit(-1);
+ }
+
+ if(!glIsShader(vertShader))
+ {
+ fprintf(stderr, "Vertex shader failed!\n");
+ exit(-1);
+ }
+
+ if(!glIsProgram(program))
+ {
+ fprintf(stderr, "Shader program failed!\n");
+ exit(-1);
+ }
+
+ printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
+}
+
+
+int
+main(int argc, char *argv[])
+{
+ glutInitWindowSize(WinWidth, WinHeight);
+ glutInit(&argc, argv);
+ glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
+ Win = glutCreateWindow(argv[0]);
+ glewInit();
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutDisplayFunc(Draw);
+ glutIdleFunc(Draw);
+ glutMouseFunc(mouse);
+ glutMotionFunc(drag);
+ Init();
+ glutMainLoop();
+ return 0;
+}
+
diff --git a/progs/objviewer/skybox.c b/progs/objviewer/skybox.c
index 4e30742e20..93331b9c16 100644
--- a/progs/objviewer/skybox.c
+++ b/progs/objviewer/skybox.c
@@ -88,9 +88,9 @@ LoadSkyBoxCubeTexture(const char *filePosX,
return 0;
if (!load(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, fileNegX, GL_TRUE, GL_TRUE))
return 0;
- if (!load(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, filePosY, 1+GL_FALSE, GL_TRUE))
+ if (!load(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, filePosY, GL_TRUE, GL_TRUE))
return 0;
- if (!load(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, fileNegY, 1+GL_FALSE, GL_TRUE))
+ if (!load(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, fileNegY, GL_TRUE, GL_TRUE))
return 0;
if (!load(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, filePosZ, GL_TRUE, GL_TRUE))
return 0;
diff --git a/progs/openvg/demos/Makefile b/progs/openvg/demos/Makefile
deleted file mode 100644
index 89b0ce441b..0000000000
--- a/progs/openvg/demos/Makefile
+++ /dev/null
@@ -1,39 +0,0 @@
-# progs/vg/Makefile
-
-TOP = ../../..
-include $(TOP)/configs/current
-
-VG_LIBS=-lm -pthread -lX11 -lEGL -lOpenVG
-INCLUDE_DIRS = -I$(TOP)/include
-
-PROGRAMS = \
- lion \
- sp
-
-.c.o:
- $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
-
-
-
-default: $(PROGRAMS)
-
-lion: lion.o lion-render.o
- $(CC) $(CFLAGS) lion.o lion-render.o -L$(TOP)/$(LIB_DIR) $(VG_LIBS) -o $@
-
-lion.o: lion.c lion-render.h $(HEADERS)
- $(CC) -c $(CFLAGS) -I$(TOP)/include lion.c
-lion-render.o: lion-render.c lion-render.h $(HEADERS)
- $(CC) -c $(CFLAGS) -I$(TOP)/include lion-render.c
-
-
-sp: sp.c eglcommon.o
- $(CC) $(INCLUDE_DIRS) $(CFLAGS) $^ -L$(TOP)/$(LIB_DIR) $(LIBS) $(VG_LIBS) $(APP_LIB_DEPS) -o $@
-
-eglcommon.o: eglcommon.c $(HEADERS)
- $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) eglcommon.c
-
-
-clean:
- rm -f *.o *~
- rm -f *.so
- rm -f $(PROGRAMS)
diff --git a/progs/openvg/demos/lion.c b/progs/openvg/demos/lion.c
deleted file mode 100644
index adb269bfd8..0000000000
--- a/progs/openvg/demos/lion.c
+++ /dev/null
@@ -1,289 +0,0 @@
-#include <assert.h>
-#include <math.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/keysym.h>
-#include <VG/openvg.h>
-#include <GLES/egl.h>
-
-#include "lion-render.h"
-
-static VGint width, height;
-struct lion *lion = 0;
-VGfloat angle = 0;
-
-static void
-draw(void)
-{
- vgClear(0, 0, width, height);
-
- vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
- vgLoadIdentity();
- vgTranslate(width/2, height/2);
- vgRotate(angle);
- vgTranslate(-width/2, -height/2);
-
- lion_render(lion);
-
- ++angle;
-}
-
-
-/* new window size or exposure */
-static void
-reshape(int w, int h)
-{
- width = w;
- height = h;
-}
-
-
-static void
-init(void)
-{
- float clear_color[4] = {1.0, 1.0, 1.0, 1.0};
- vgSetfv(VG_CLEAR_COLOR, 4, clear_color);
-
- lion = lion_create();
-}
-
-
-/*
- * Create an RGB, double-buffered X window.
- * Return the window and context handles.
- */
-static void
-make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
- const char *name,
- int x, int y, int width, int height,
- Window *winRet,
- EGLContext *ctxRet,
- EGLSurface *surfRet)
-{
- static const EGLint attribs[] = {
- EGL_RED_SIZE, 1,
- EGL_GREEN_SIZE, 1,
- EGL_BLUE_SIZE, 1,
- EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT,
- EGL_NONE
- };
-
- int scrnum;
- XSetWindowAttributes attr;
- unsigned long mask;
- Window root;
- Window win;
- XVisualInfo *visInfo, visTemplate;
- int num_visuals;
- EGLContext ctx;
- EGLConfig config;
- EGLint num_configs;
- EGLint vid;
-
- scrnum = DefaultScreen( x_dpy );
- root = RootWindow( x_dpy, scrnum );
-
- if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs) ||
- !num_configs) {
- printf("Error: couldn't get an EGL visual config\n");
- exit(1);
- }
-
- assert(config);
-
- if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
- printf("Error: eglGetConfigAttrib() failed\n");
- exit(1);
- }
-
- /* The X window visual must match the EGL config */
- visTemplate.visualid = vid;
- visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
- if (!visInfo) {
- printf("Error: couldn't get X visual\n");
- exit(1);
- }
-
- /* window attributes */
- attr.background_pixel = 0;
- attr.border_pixel = 0;
- attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
- attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
- mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
-
- win = XCreateWindow( x_dpy, root, 0, 0, width, height,
- 0, visInfo->depth, InputOutput,
- visInfo->visual, mask, &attr );
-
- /* set hints and properties */
- {
- XSizeHints sizehints;
- sizehints.x = x;
- sizehints.y = y;
- sizehints.width = width;
- sizehints.height = height;
- sizehints.flags = USSize | USPosition;
- XSetNormalHints(x_dpy, win, &sizehints);
- XSetStandardProperties(x_dpy, win, name, name,
- None, (char **)NULL, 0, &sizehints);
- }
-
- eglBindAPI(EGL_OPENVG_API);
-
- ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
- if (!ctx) {
- printf("Error: eglCreateContext failed\n");
- exit(1);
- }
-
- *surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
-
- if (!*surfRet) {
- printf("Error: eglCreateWindowSurface failed\n");
- exit(1);
- }
-
- XFree(visInfo);
-
- *winRet = win;
- *ctxRet = ctx;
-}
-
-
-static void
-event_loop(Display *dpy, Window win,
- EGLDisplay egl_dpy, EGLSurface egl_surf)
-{
- while (1) {
- XEvent event;
-
- while (XPending(dpy) > 0) {
- XNextEvent(dpy, &event);
-
- switch (event.type) {
- case Expose:
- break;
- case ConfigureNotify:
- reshape(event.xconfigure.width, event.xconfigure.height);
- break;
- case KeyPress:
- {
- char buffer[10];
- int r, code;
- code = XLookupKeysym(&event.xkey, 0);
- r = XLookupString(&event.xkey, buffer, sizeof(buffer),
- NULL, NULL);
- if (buffer[0] == 27) {
- /* escape */
- return;
- }
- }
- break;
- default:
- ; /*no-op*/
- }
- }
-
- draw();
- eglSwapBuffers(egl_dpy, egl_surf);
- }
-}
-
-
-static void
-usage(void)
-{
- printf("Usage:\n");
- printf(" -display <displayname> set the display to run on\n");
- printf(" -info display OpenGL renderer info\n");
-}
-
-int
-main(int argc, char *argv[])
-{
- const int winWidth = 350, winHeight = 450;
- Display *x_dpy;
- Window win;
- EGLSurface egl_surf;
- EGLContext egl_ctx;
- EGLDisplay egl_dpy;
- char *dpyName = NULL;
- GLboolean printInfo = GL_FALSE;
- EGLint egl_major, egl_minor;
- int i;
- const char *s;
-
- for (i = 1; i < argc; i++) {
- if (strcmp(argv[i], "-display") == 0) {
- dpyName = argv[i+1];
- i++;
- }
- else if (strcmp(argv[i], "-info") == 0) {
- printInfo = GL_TRUE;
- }
- else {
- usage();
- return -1;
- }
- }
-
- x_dpy = XOpenDisplay(dpyName);
- if (!x_dpy) {
- printf("Error: couldn't open display %s\n",
- dpyName ? dpyName : getenv("DISPLAY"));
- return -1;
- }
-
- egl_dpy = eglGetDisplay(x_dpy);
- if (!egl_dpy) {
- printf("Error: eglGetDisplay() failed\n");
- return -1;
- }
-
- if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
- printf("Error: eglInitialize() failed\n");
- return -1;
- }
-
- s = eglQueryString(egl_dpy, EGL_VERSION);
- printf("EGL_VERSION = %s\n", s);
-
- make_x_window(x_dpy, egl_dpy,
- "Lion Example", 0, 0, winWidth, winHeight,
- &win, &egl_ctx, &egl_surf);
-
- XMapWindow(x_dpy, win);
- if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
- printf("Error: eglMakeCurrent() failed\n");
- return -1;
- }
-
- if (printInfo) {
- printf("VG_RENDERER = %s\n", (char *) vgGetString(VG_RENDERER));
- printf("VG_VERSION = %s\n", (char *) vgGetString(VG_VERSION));
- printf("VG_VENDOR = %s\n", (char *) vgGetString(VG_VENDOR));
- }
-
- init();
-
- /* Set initial projection/viewing transformation.
- * We can't be sure we'll get a ConfigureNotify event when the window
- * first appears.
- */
- reshape(winWidth, winHeight);
-
- event_loop(x_dpy, win, egl_dpy, egl_surf);
-
- eglDestroyContext(egl_dpy, egl_ctx);
- eglDestroySurface(egl_dpy, egl_surf);
- eglTerminate(egl_dpy);
-
-
- XDestroyWindow(x_dpy, win);
- XCloseDisplay(x_dpy);
-
- return 0;
-}
diff --git a/progs/openvg/trivial/eglcommon.c b/progs/openvg/trivial/eglcommon.c
deleted file mode 100644
index 0316e596c6..0000000000
--- a/progs/openvg/trivial/eglcommon.c
+++ /dev/null
@@ -1,289 +0,0 @@
-#include "eglcommon.h"
-
-
-#include <assert.h>
-#include <math.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/keysym.h>
-#include <VG/openvg.h> /* using full OpenGL for now */
-#include <GLES/egl.h>
-
-
-static init_func init = 0;
-static draw_func draw = 0;
-static reshape_func reshape = 0;
-static key_func keyPress = 0;
-static VGint width = 300, height = 300;
-
-
-void set_window_size(int w, int h)
-{
- width = w;
- height = h;
-}
-
-/*
- * Create an RGB, double-buffered X window.
- * Return the window and context handles.
- */
-static void
-make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
- const char *name,
- int x, int y, int width, int height,
- Window *winRet,
- EGLContext *ctxRet,
- EGLSurface *surfRet)
-{
- static const EGLint attribs[] = {
- EGL_RED_SIZE, 1,
- EGL_GREEN_SIZE, 1,
- EGL_BLUE_SIZE, 1,
- EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT,
- EGL_NONE
- };
-
- int scrnum;
- XSetWindowAttributes attr;
- unsigned long mask;
- Window root;
- Window win;
- XVisualInfo *visInfo, visTemplate;
- int num_visuals;
- EGLContext ctx;
- EGLConfig config;
- EGLint num_configs;
- EGLint vid;
-
- scrnum = DefaultScreen( x_dpy );
- root = RootWindow( x_dpy, scrnum );
-
- if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs) ||
- !num_configs) {
- printf("Error: couldn't get an EGL visual config\n");
- exit(1);
- }
-
- assert(config);
-
- if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
- printf("Error: eglGetConfigAttrib() failed\n");
- exit(1);
- }
-
- /* The X window visual must match the EGL config */
- visTemplate.visualid = vid;
- visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
- if (!visInfo) {
- printf("Error: couldn't get X visual\n");
- exit(1);
- }
-
- /* window attributes */
- attr.background_pixel = 0;
- attr.border_pixel = 0;
- attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
- attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
- mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
-
- win = XCreateWindow( x_dpy, root, 0, 0, width, height,
- 0, visInfo->depth, InputOutput,
- visInfo->visual, mask, &attr );
-
- /* set hints and properties */
- {
- XSizeHints sizehints;
- sizehints.x = x;
- sizehints.y = y;
- sizehints.width = width;
- sizehints.height = height;
- sizehints.flags = USSize | USPosition;
- XSetNormalHints(x_dpy, win, &sizehints);
- XSetStandardProperties(x_dpy, win, name, name,
- None, (char **)NULL, 0, &sizehints);
- }
-
- eglBindAPI(EGL_OPENVG_API);
-
- ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
- if (!ctx) {
- printf("Error: eglCreateContext failed\n");
- exit(1);
- }
-
- *surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
-
- if (!*surfRet) {
- printf("Error: eglCreateWindowSurface failed\n");
- exit(1);
- }
-
- XFree(visInfo);
-
- *winRet = win;
- *ctxRet = ctx;
-}
-
-static void
-event_loop(Display *dpy, Window win,
- EGLDisplay egl_dpy, EGLSurface egl_surf)
-{
- while (1) {
- int redraw = 0;
- XEvent event;
-
- XNextEvent(dpy, &event);
-
- switch (event.type) {
- case Expose:
- redraw = 1;
- break;
- case ConfigureNotify:
- if (reshape) {
- width = event.xconfigure.width;
- height = event.xconfigure.height;
- reshape(event.xconfigure.width, event.xconfigure.height);
- }
- break;
- case KeyPress:
- {
- char buffer[10];
- int r, code;
- code = XLookupKeysym(&event.xkey, 0);
- if (!keyPress || !keyPress(code)) {
- r = XLookupString(&event.xkey, buffer, sizeof(buffer),
- NULL, NULL);
- if (buffer[0] == 27) {
- /* escape */
- return;
- }
- }
- }
- redraw = 1;
- break;
- default:
- ; /*no-op*/
- }
-
- if (redraw) {
- draw();
- eglSwapBuffers(egl_dpy, egl_surf);
- }
- }
-}
-
-int window_width(void)
-{
- return width;
-}
-
-int window_height(void)
-{
- return height;
-}
-
-static void
-usage(void)
-{
- printf("Usage:\n");
- printf(" -display <displayname> set the display to run on\n");
- printf(" -info display OpenGL renderer info\n");
-}
-
-int run(int argc, char **argv,
- init_func init_f,
- reshape_func resh_f,
- draw_func draw_f,
- key_func key_f)
-{
- const int winWidth = width, winHeight = height;
- Display *x_dpy;
- Window win;
- EGLSurface egl_surf;
- EGLContext egl_ctx;
- EGLDisplay egl_dpy;
- char *dpyName = NULL;
- GLboolean printInfo = GL_FALSE;
- EGLint egl_major, egl_minor;
- int i;
- const char *s;
-
- init = init_f;
- draw = draw_f;
- reshape = resh_f;
- keyPress = key_f;
-
- for (i = 1; i < argc; i++) {
- if (strcmp(argv[i], "-display") == 0) {
- dpyName = argv[i+1];
- i++;
- }
- else if (strcmp(argv[i], "-info") == 0) {
- printInfo = GL_TRUE;
- }
- }
-
- x_dpy = XOpenDisplay(dpyName);
- if (!x_dpy) {
- printf("Error: couldn't open display %s\n",
- dpyName ? dpyName : getenv("DISPLAY"));
- return -1;
- }
-
- egl_dpy = eglGetDisplay(x_dpy);
- if (!egl_dpy) {
- printf("Error: eglGetDisplay() failed\n");
- return -1;
- }
-
- if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
- printf("Error: eglInitialize() failed\n");
- return -1;
- }
-
- s = eglQueryString(egl_dpy, EGL_VERSION);
- printf("EGL_VERSION = %s\n", s);
-
- make_x_window(x_dpy, egl_dpy,
- "OpenVG Example", 0, 0, winWidth, winHeight,
- &win, &egl_ctx, &egl_surf);
-
- XMapWindow(x_dpy, win);
- if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
- printf("Error: eglMakeCurrent() failed\n");
- return -1;
- }
-
- if (printInfo) {
- printf("VG_RENDERER = %s\n", (char *) vgGetString(VG_RENDERER));
- printf("VG_VERSION = %s\n", (char *) vgGetString(VG_VERSION));
- printf("VG_VENDOR = %s\n", (char *) vgGetString(VG_VENDOR));
- }
-
- if (init)
- init();
-
- /* Set initial projection/viewing transformation.
- * We can't be sure we'll get a ConfigureNotify event when the window
- * first appears.
- */
- if (reshape)
- reshape(winWidth, winHeight);
-
- event_loop(x_dpy, win, egl_dpy, egl_surf);
-
- eglMakeCurrent(egl_dpy, 0, 0, 0);
- eglDestroyContext(egl_dpy, egl_ctx);
- eglDestroySurface(egl_dpy, egl_surf);
- eglTerminate(egl_dpy);
-
-
- XDestroyWindow(x_dpy, win);
- XCloseDisplay(x_dpy);
-
- return 0;
-}
-
diff --git a/progs/openvg/trivial/eglcommon.h b/progs/openvg/trivial/eglcommon.h
deleted file mode 100644
index 958dae9f98..0000000000
--- a/progs/openvg/trivial/eglcommon.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef EGLCOMMON_H
-#define EGLCOMMON_H
-
-typedef void (*init_func)();
-typedef void (*reshape_func)(int, int);
-typedef void (*draw_func)();
-typedef int (*key_func)(unsigned key);
-
-
-void set_window_size(int width, int height);
-int window_width(void);
-int window_height(void);
-
-int run(int argc, char **argv,
- init_func init,
- reshape_func resh,
- draw_func draw,
- key_func key);
-
-#endif
diff --git a/progs/samples/copy.c b/progs/samples/copy.c
index 391c637d6f..353a3a2e1a 100644
--- a/progs/samples/copy.c
+++ b/progs/samples/copy.c
@@ -25,6 +25,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include <GL/glew.h>
#include <GL/glut.h>
@@ -35,7 +36,6 @@ GLint windW, windH;
char *fileName = 0;
PPMImage *image;
-float point[3];
float zoom;
GLint x, y;
@@ -97,27 +97,27 @@ static void Mouse(int button, int state, int mouseX, int mouseY)
static void Draw(void)
{
+ GLint src[3], dst[3];
glClear(GL_COLOR_BUFFER_BIT);
- point[0] = (windW / 2) - (image->sizeX / 2);
- point[1] = (windH / 2) - (image->sizeY / 2);
- point[2] = 0;
- glRasterPos3fv(point);
+ src[0] = (int) ((windW / 2.0) - (image->sizeX / 2.0));
+ src[1] = (int) ((windH / 2.0) - (image->sizeY / 2.0));
+ src[2] = 0;
+ glWindowPos3ivARB(src);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glPixelZoom(1.0, 1.0);
glDrawPixels(image->sizeX, image->sizeY, GL_RGB, GL_UNSIGNED_BYTE,
image->data);
- point[0] = (float)x;
- point[1] = windH - (float)y;
- point[2] = 0.0;
- glRasterPos3fv(point);
+ dst[0] = x;
+ dst[1] = windH - y;
+ dst[2] = 0;
+ glWindowPos3ivARB(dst);
glPixelZoom(zoom, zoom);
- glCopyPixels((windW/2)-(image->sizeX/2),
- (windH/2)-(image->sizeY/2),
+ glCopyPixels(src[0], src[1],
image->sizeX, image->sizeY, GL_COLOR);
glFlush();
@@ -170,8 +170,8 @@ int main(int argc, char **argv)
image = LoadPPM(fileName);
- windW = 300;
- windH = 300;
+ windW = 2*300;
+ windH = 2*300;
glutInitWindowPosition(0, 0); glutInitWindowSize( windW, windH);
type = GLUT_RGB;
@@ -182,6 +182,7 @@ int main(int argc, char **argv)
exit(1);
}
+ glewInit();
Init();
glutReshapeFunc(Reshape);
diff --git a/progs/samples/loadppm.c b/progs/samples/loadppm.c
index be056d6294..adae9b491e 100644
--- a/progs/samples/loadppm.c
+++ b/progs/samples/loadppm.c
@@ -9,7 +9,7 @@ static PPMImage *LoadPPM(const char *filename)
char buff[16];
PPMImage *result;
FILE *fp;
- int maxval;
+ int maxval, w, h;
fp = fopen(filename, "rb");
if (!fp)
@@ -37,11 +37,13 @@ static PPMImage *LoadPPM(const char *filename)
exit(1);
}
- if (fscanf(fp, "%lu %lu", &result->sizeX, &result->sizeY) != 2)
+ if (fscanf(fp, "%d %d", &w, &h) != 2)
{
fprintf(stderr, "Error loading image `%s'\n", filename);
exit(1);
}
+ result->sizeX = w;
+ result->sizeY = h;
if (fscanf(fp, "%d", &maxval) != 1)
{
diff --git a/progs/tests/fbotest1.c b/progs/tests/fbotest1.c
index 0cd7f95c35..a95fdff74c 100644
--- a/progs/tests/fbotest1.c
+++ b/progs/tests/fbotest1.c
@@ -36,8 +36,8 @@ Display( void )
/* draw to user framebuffer */
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB);
- glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT);
- glReadBuffer(GL_COLOR_ATTACHMENT1_EXT);
+ glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
+ glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
@@ -161,7 +161,7 @@ Init( void )
assert(i == MyFB);
CheckError(__LINE__);
- glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT,
+ glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
GL_RENDERBUFFER_EXT, MyRB);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height);
diff --git a/progs/tests/fbotest2.c b/progs/tests/fbotest2.c
index f9c506193f..faf0dd8748 100644
--- a/progs/tests/fbotest2.c
+++ b/progs/tests/fbotest2.c
@@ -33,15 +33,16 @@ CheckError(int line)
static void
Display( void )
{
- GLubyte *buffer = malloc(Width * Height * 4);
+ GLboolean copyPix = GL_FALSE;
+ GLboolean blitPix = GL_FALSE;
GLenum status;
CheckError(__LINE__);
/* draw to user framebuffer */
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB);
- glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT);
- glReadBuffer(GL_COLOR_ATTACHMENT1_EXT);
+ glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
+ glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
@@ -63,16 +64,43 @@ Display( void )
glutSolidTeapot(2.0);
glPopMatrix();
- /* read from user framebuffer */
- glReadPixels(0, 0, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
+ if (copyPix) {
+ glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, MyFB);
+ glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
+ glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0);
+ glDrawBuffer(GL_BACK);
- /* draw to window */
- glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
- glDisable(GL_DEPTH_TEST); /* in case window has depth buffer */
- glWindowPos2iARB(0, 0);
- glDrawPixels(Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
+ glDisable(GL_DEPTH_TEST); /* in case window has depth buffer */
+
+ glWindowPos2iARB(0, 0);
+ glCopyPixels(0, 0, Width, Height, GL_COLOR);
+ }
+ else if (blitPix) {
+ glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, MyFB);
+ glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
+ glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0);
+ glDrawBuffer(GL_BACK);
+
+ glDisable(GL_DEPTH_TEST); /* in case window has depth buffer */
+
+ glBlitFramebufferEXT(0, 0, Width, Height,
+ 0, 0, Width, Height,
+ GL_COLOR_BUFFER_BIT, GL_NEAREST);
+ }
+ else {
+ GLubyte *buffer = malloc(Width * Height * 4);
+ /* read from user framebuffer */
+ glReadPixels(0, 0, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
+
+ /* draw to window */
+ glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+ glDisable(GL_DEPTH_TEST); /* in case window has depth buffer */
+ glWindowPos2iARB(0, 0);
+ glDrawPixels(Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
+
+ free(buffer);
+ }
- free(buffer);
glutSwapBuffers();
CheckError(__LINE__);
}
@@ -163,7 +191,7 @@ Init( void )
glGenRenderbuffersEXT(1, &ColorRb);
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, ColorRb);
assert(glIsRenderbufferEXT(ColorRb));
- glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT,
+ glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
GL_RENDERBUFFER_EXT, ColorRb);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height);
diff --git a/progs/tests/fbotest3.c b/progs/tests/fbotest3.c
index 8e288b38b8..c176f82d2b 100644
--- a/progs/tests/fbotest3.c
+++ b/progs/tests/fbotest3.c
@@ -50,8 +50,8 @@ Display( void )
/* draw to user framebuffer */
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB);
- glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT);
- glReadBuffer(GL_COLOR_ATTACHMENT1_EXT);
+ glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
+ glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
@@ -189,7 +189,7 @@ Init( void )
glGenRenderbuffersEXT(1, &ColorRb);
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, ColorRb);
assert(glIsRenderbufferEXT(ColorRb));
- glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT,
+ glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
GL_RENDERBUFFER_EXT, ColorRb);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height);
diff --git a/progs/tests/stencil_twoside.c b/progs/tests/stencil_twoside.c
index 7d871e5877..1010139a20 100644
--- a/progs/tests/stencil_twoside.c
+++ b/progs/tests/stencil_twoside.c
@@ -26,7 +26,7 @@
* \file stencil_twoside.c
*
* Simple test of GL_ATI_separate_stencil (or the OGL 2.0 equivalent) functionality.
- * Four squares are drawn
+ * Five squares (or six if stencil wrap is available) are drawn
* with different stencil modes, but all should be rendered with the same
* final color.
*/
@@ -37,7 +37,7 @@
#include <GL/glut.h>
static int use20syntax = 1;
-static int Width = 550;
+static int Width = 650;
static int Height = 200;
static const GLfloat Near = 5.0, Far = 25.0;
@@ -70,7 +70,7 @@ static void Display( void )
*/
glDisable(GL_STENCIL_TEST);
- glTranslatef(-6.0, 0, 0);
+ glTranslatef(-7.0, 0, 0);
glBegin(GL_QUADS);
glColor3f( 0.5, 0.5, 0.5 );
glVertex2f(-1, -1);
@@ -85,6 +85,9 @@ static void Display( void )
/* Draw the first two squares using incr for the affected face
*/
+ /*************************************************************************
+ * 2nd square
+ */
if (use20syntax) {
stencil_func_separate(GL_FRONT, GL_ALWAYS, 0, ~0);
stencil_func_separate(GL_BACK, GL_ALWAYS, 0, ~0);
@@ -98,8 +101,8 @@ static void Display( void )
glTranslatef(3.0, 0, 0);
glBegin(GL_QUADS);
glColor3f( 0.9, 0.9, 0.9 );
- /* this should be front facing */
for ( i = 0 ; i < (max_stencil + 5) ; i++ ) {
+ /* this should be front facing */
glVertex2f(-1, -1);
glVertex2f( 1, -1);
glVertex2f( 1, 1);
@@ -107,6 +110,7 @@ static void Display( void )
}
glEnd();
+ /* stencil vals should be equal to max_stencil */
glStencilFunc(GL_EQUAL, max_stencil, ~0);
glBegin(GL_QUADS);
glColor3f( 0.5, 0.5, 0.5 );
@@ -116,6 +120,9 @@ static void Display( void )
glVertex2f(-1, 1);
glEnd();
+ /*************************************************************************
+ * 3rd square
+ */
if (use20syntax) {
stencil_func_separate(GL_FRONT, GL_ALWAYS, 0, ~0);
stencil_func_separate(GL_BACK, GL_ALWAYS, 0, ~0);
@@ -129,9 +136,8 @@ static void Display( void )
glTranslatef(3.0, 0, 0);
glBegin(GL_QUADS);
glColor3f( 0.9, 0.9, 0.9 );
-
- /* this should be back facing */
for ( i = 0 ; i < (max_stencil + 5) ; i++ ) {
+ /* this should be back facing */
glVertex2f(-1, -1);
glVertex2f(-1, 1);
glVertex2f( 1, 1);
@@ -139,6 +145,7 @@ static void Display( void )
}
glEnd();
+ /* stencil vals should be equal to max_stencil */
glStencilFunc(GL_EQUAL, max_stencil, ~0);
glBegin(GL_QUADS);
glColor3f( 0.5, 0.5, 0.5 );
@@ -148,6 +155,9 @@ static void Display( void )
glVertex2f(-1, 1);
glEnd();
+ /*************************************************************************
+ * 4th square
+ */
if (use20syntax) {
stencil_func_separate(GL_FRONT, GL_NEVER, 0, ~0);
stencil_func_separate(GL_BACK, GL_ALWAYS, 0, ~0);
@@ -161,15 +171,13 @@ static void Display( void )
glTranslatef(3.0, 0, 0);
glBegin(GL_QUADS);
glColor3f( 0.9, 0.9, 0.9 );
-
- /* this should be back facing */
for ( i = 0 ; i < (max_stencil + 5) ; i++ ) {
- /* this should be back facing */
+ /* this should be back facing */
glVertex2f(-1, -1);
glVertex2f(-1, 1);
glVertex2f( 1, 1);
glVertex2f( 1, -1);
- /* this should be front facing */
+ /* this should be front facing */
glVertex2f(-1, -1);
glVertex2f( 1, -1);
glVertex2f( 1, 1);
@@ -177,6 +185,7 @@ static void Display( void )
}
glEnd();
+ /* stencil vals should be equal to max_stencil */
glStencilFunc(GL_EQUAL, max_stencil, ~0);
glBegin(GL_QUADS);
glColor3f( 0.5, 0.5, 0.5 );
@@ -186,6 +195,9 @@ static void Display( void )
glVertex2f(-1, 1);
glEnd();
+ /*************************************************************************
+ * 5th square
+ */
if (use20syntax) {
stencil_func_separate(GL_FRONT, GL_ALWAYS, 0, ~0);
stencil_func_separate(GL_BACK, GL_ALWAYS, 0, ~0);
@@ -193,21 +205,19 @@ static void Display( void )
else {
stencil_func_separate_ati(GL_ALWAYS, GL_ALWAYS, 0, ~0);
}
- stencil_op_separate(GL_FRONT, GL_KEEP, GL_KEEP, GL_DECR);
- stencil_op_separate(GL_BACK, GL_KEEP, GL_KEEP, GL_INCR);
+ stencil_op_separate(GL_FRONT, GL_KEEP, GL_KEEP, GL_INCR);
+ stencil_op_separate(GL_BACK, GL_KEEP, GL_KEEP, GL_DECR);
glTranslatef(3.0, 0, 0);
glBegin(GL_QUADS);
glColor3f( 0.9, 0.9, 0.9 );
-
- /* this should be back facing */
for ( i = 0 ; i < (max_stencil + 5) ; i++ ) {
- /* this should be back facing */
+ /* this should be back facing */
glVertex2f(-1, -1);
glVertex2f(-1, 1);
glVertex2f( 1, 1);
glVertex2f( 1, -1);
- /* this should be front facing */
+ /* this should be front facing */
glVertex2f(-1, -1);
glVertex2f( 1, -1);
glVertex2f( 1, 1);
@@ -224,6 +234,47 @@ static void Display( void )
glVertex2f(-1, 1);
glEnd();
+ /*************************************************************************
+ * 6th square
+ */
+ if (glutExtensionSupported("GL_EXT_stencil_wrap")) {
+ if (use20syntax) {
+ stencil_func_separate(GL_FRONT, GL_ALWAYS, 0, ~0);
+ stencil_func_separate(GL_BACK, GL_ALWAYS, 0, ~0);
+ }
+ else {
+ stencil_func_separate_ati(GL_ALWAYS, GL_ALWAYS, 0, ~0);
+ }
+ stencil_op_separate(GL_FRONT, GL_KEEP, GL_KEEP, GL_KEEP);
+ stencil_op_separate(GL_BACK, GL_KEEP, GL_KEEP, GL_INCR_WRAP);
+
+ glTranslatef(3.0, 0, 0);
+ glBegin(GL_QUADS);
+ glColor3f( 0.9, 0.9, 0.9 );
+ for ( i = 0 ; i < (max_stencil + 5) ; i++ ) {
+ /* this should be back facing */
+ glVertex2f(-1, -1);
+ glVertex2f(-1, 1);
+ glVertex2f( 1, 1);
+ glVertex2f( 1, -1);
+ /* this should be front facing */
+ glVertex2f(-1, -1);
+ glVertex2f( 1, -1);
+ glVertex2f( 1, 1);
+ glVertex2f(-1, 1);
+ }
+ glEnd();
+
+ glStencilFunc(GL_EQUAL, 260 - 255, ~0);
+ glBegin(GL_QUADS);
+ glColor3f( 0.5, 0.5, 0.5 );
+ glVertex2f(-1, -1);
+ glVertex2f( 1, -1);
+ glVertex2f( 1, 1);
+ glVertex2f(-1, 1);
+ glEnd();
+ }
+
glPopMatrix();
glutSwapBuffers();
@@ -278,7 +329,7 @@ static void Init( void )
stencil_func_separate_ati = (PFNGLSTENCILFUNCSEPARATEATIPROC) glutGetProcAddress( "glStencilFuncSeparateATI" );
stencil_op_separate = (PFNGLSTENCILOPSEPARATEPROC) glutGetProcAddress( "glStencilOpSeparate" );
- printf("\nAll 5 squares should be the same color.\n");
+ printf("\nAll 5 (or 6) squares should be the same color.\n");
}
diff --git a/progs/trivial/Makefile b/progs/trivial/Makefile
index b4a903cb68..a10748f948 100644
--- a/progs/trivial/Makefile
+++ b/progs/trivial/Makefile
@@ -11,6 +11,7 @@ include $(TOP)/configs/current
LIBS = -L$(TOP)/$(LIB_DIR) -l $(GLEW_LIB) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS)
SOURCES = \
+ clear-fbo-scissor.c \
clear-fbo-tex.c \
clear-fbo.c \
clear-scissor.c \
diff --git a/progs/trivial/SConscript b/progs/trivial/SConscript
index f480da047e..24b4f91fb0 100644
--- a/progs/trivial/SConscript
+++ b/progs/trivial/SConscript
@@ -1,7 +1,8 @@
Import('*')
progs = [
- 'clear-fbo-tex',
+ 'clear-fbo-scissor',
+ 'clear-fbo-tex',
'clear-fbo',
'clear-scissor',
'clear-undefined',
diff --git a/progs/trivial/clear-fbo-scissor.c b/progs/trivial/clear-fbo-scissor.c
new file mode 100644
index 0000000000..6a605e16a8
--- /dev/null
+++ b/progs/trivial/clear-fbo-scissor.c
@@ -0,0 +1,234 @@
+/*
+ * Use scissor to clear the four quadrants of the FBO to different
+ * colors. Then draw a grey triangle in the middle.
+ */
+
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+#include <GL/glew.h>
+#include <GL/glut.h>
+#include <GL/glu.h>
+
+
+static int Width = 512, Height = 512;
+static GLuint MyFB, MyRB;
+static GLboolean UseTex = GL_FALSE;
+static GLboolean UseCopyPix = GL_FALSE;
+
+
+#define CheckError() \
+ do { \
+ GLenum err = glGetError(); \
+ if (err != GL_NO_ERROR) \
+ printf("Error: %s\n", gluErrorString(err)); \
+ assert(err == GL_NO_ERROR); \
+ } while (0)
+
+
+static void
+Init(void)
+{
+ GLenum status;
+
+ fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
+ fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
+ fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ fflush(stderr);
+
+ if (!glutExtensionSupported("GL_EXT_framebuffer_object")) {
+ printf("GL_EXT_framebuffer_object not found!\n");
+ exit(0);
+ }
+
+ glGenFramebuffersEXT(1, &MyFB);
+ glGenRenderbuffersEXT(1, &MyRB);
+
+ glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB);
+
+ if (UseTex) {
+ GLuint tex;
+ glGenTextures(1, &tex);
+ glBindTexture(GL_TEXTURE_2D, tex);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, Width, Height, 0,
+ GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
+ GL_COLOR_ATTACHMENT0_EXT,
+ GL_TEXTURE_2D, tex, 0);
+ }
+ else {
+ glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, MyRB);
+
+ glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
+ GL_COLOR_ATTACHMENT0_EXT,
+ GL_RENDERBUFFER_EXT, MyRB);
+
+ glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height);
+ }
+
+ status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
+ if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
+ fprintf(stderr, "Framebuffer object is incomplete (0x%x)!\n", status);
+ }
+
+ glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+}
+
+
+static void
+Reshape(int width, int height)
+{
+ glViewport(0, 0, width, height);
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
+ glMatrixMode(GL_MODELVIEW);
+
+ Width = width;
+ Height = height;
+ if (!UseTex) {
+ glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height);
+ }
+}
+
+
+static void
+Key(unsigned char key, int x, int y)
+{
+ if (key == 27) {
+ exit(0);
+ }
+ glutPostRedisplay();
+}
+
+
+static void
+Draw(void)
+{
+ GLboolean scissor = GL_TRUE;
+
+ /* draw to user framebuffer */
+ glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB);
+ glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
+ glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
+
+ glViewport(0, 0, Width, Height);
+ CheckError();
+
+ if (scissor) {
+ glEnable(GL_SCISSOR_TEST);
+
+ /* lower-left = red */
+ glClearColor(1, 0, 0, 0);
+ glScissor(0, 0, Width / 2, Height / 2);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ /* lower-right = green */
+ glClearColor(0, 1, 0, 0);
+ glScissor(Width / 2, 0, Width - Width / 2, Height / 2);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ /* upper-left = blue */
+ glClearColor(0, 0, 1, 0);
+ glScissor(0, Height / 2, Width / 2, Height - Height / 2);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ /* upper-right = white */
+ glClearColor(1, 1, 1, 0);
+ glScissor(Width / 2, Height / 2, Width - Width / 2, Height - Height / 2);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ glDisable(GL_SCISSOR_TEST);
+ }
+ else {
+ glClearColor(0, 1, 0, 0);
+ glClear(GL_COLOR_BUFFER_BIT);
+ }
+
+ CheckError();
+
+ /* gray triangle in middle, pointing up */
+ glColor3f(0.5, 0.5, 0.5);
+ glBegin(GL_TRIANGLES);
+ glVertex2f(Width/4, Height/4);
+ glVertex2f(Width*3/4, Height/4);
+ glVertex2f(Width/2, Height*3/4);
+ glVertex2f(-0.5, -0.5);
+ glVertex2f(+0.5, -0.5);
+ glVertex2f( 0.0, 0.7);
+ glEnd();
+
+ CheckError();
+
+ /* copy fbo to window */
+ glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, MyFB);
+ glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
+ glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0);
+ glDrawBuffer(GL_BACK);
+
+ if (UseCopyPix) {
+ glWindowPos2i(0, 0);
+ glCopyPixels(0, 0, Width, Height, GL_COLOR);
+ }
+ else {
+ GLubyte *buffer = malloc(Width * Height * 4);
+
+ /* read from user framebuffer */
+ glReadPixels(0, 0, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
+
+ /* draw to window */
+ glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+ glWindowPos2iARB(0, 0);
+ glDrawPixels(Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
+
+ free(buffer);
+ }
+
+ /* Bind normal framebuffer */
+ glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+
+ glutSwapBuffers();
+
+ CheckError();
+}
+
+
+int
+main(int argc, char *argv[])
+{
+ int i;
+
+ glutInit(&argc, argv);
+ glutInitWindowPosition(100, 0);
+ glutInitWindowSize(Width, Height);
+ glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
+
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-t") == 0)
+ UseTex = GL_TRUE;
+ else if (strcmp(argv[i], "-c") == 0)
+ UseCopyPix = GL_TRUE;
+ }
+
+ if (UseTex)
+ printf("Using render to texture\n");
+ else
+ printf("Using user-created render buffer\n");
+
+ if (!glutCreateWindow(argv[0])) {
+ exit(1);
+ }
+
+ glewInit();
+ Init();
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutDisplayFunc(Draw);
+ glutMainLoop();
+ return 0;
+}
diff --git a/progs/trivial/tri-stencil.c b/progs/trivial/tri-stencil.c
index 9f68bca914..d66b68c415 100644
--- a/progs/trivial/tri-stencil.c
+++ b/progs/trivial/tri-stencil.c
@@ -77,6 +77,7 @@ static void Draw(void)
glStencilFunc(GL_ALWAYS, 1, 1);
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
+ /* red triangle (setting stencil to 1) */
glColor3ub(200, 0, 0);
glBegin(GL_POLYGON);
glVertex3i(-4, -4, 0);
@@ -88,6 +89,7 @@ static void Draw(void)
glStencilFunc(GL_EQUAL, 1, 1);
glStencilOp(GL_INCR, GL_KEEP, GL_DECR);
+ /* green quad (if over red, decr stencil to 0, else incr to 1) */
glColor3ub(0, 200, 0);
glBegin(GL_POLYGON);
glVertex3i(3, 3, 0);
@@ -101,6 +103,7 @@ static void Draw(void)
glStencilFunc(GL_EQUAL, 1, 1);
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
+ /* blue quad (where stencil == 1) */
glColor3ub(0, 0, 200);
glBegin(GL_POLYGON);
glVertex3f(2.5, 2.5, 0);
diff --git a/progs/xdemos/Makefile b/progs/xdemos/Makefile
index d81caab4dd..2663015b2c 100644
--- a/progs/xdemos/Makefile
+++ b/progs/xdemos/Makefile
@@ -9,9 +9,9 @@ INCDIR = $(TOP)/include
LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
# Add X11 and pthread libs to satisfy GNU gold.
-APP_LIB_DEPS += -lX11 -lpthread
+APP_LIB_DEPS += $(X11_LIBS) -lpthread
-LIBS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L$(libdir) $(APP_LIB_DEPS)
+LIBS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) $(APP_LIB_DEPS)
PROGS = \
corender \
diff --git a/progs/xdemos/omlsync.c b/progs/xdemos/omlsync.c
index a2baf4ad72..061d6c6861 100644
--- a/progs/xdemos/omlsync.c
+++ b/progs/xdemos/omlsync.c
@@ -249,11 +249,13 @@ int main(int argc, char *argv[])
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glRectf(0, 0, width, height);
- glXSwapBuffersMscOML(disp, winGL, 0, divisor, remainder);
-
- if (wait_interval) {
+ if (!wait_interval)
+ glXSwapBuffersMscOML(disp, winGL, 0, divisor,
+ remainder);
+ else {
glXWaitForMscOML(disp, winGL, msc + wait_interval,
- 0, 0, &ust, &msc, &sbc);
+ divisor, remainder, &ust, &msc, &sbc);
+ glXSwapBuffersMscOML(disp, winGL, 0, 0, 0);
}
}
diff --git a/scons/llvm.py b/scons/llvm.py
index 37c503ec98..01eae2403a 100644
--- a/scons/llvm.py
+++ b/scons/llvm.py
@@ -29,7 +29,9 @@ Tool-specific initialization for LLVM
import os
import os.path
+import re
import sys
+import distutils.version
import SCons.Errors
import SCons.Util
@@ -60,71 +62,98 @@ def generate(env):
if env['platform'] == 'windows':
# XXX: There is no llvm-config on Windows, so assume a standard layout
- if llvm_dir is not None:
- env.Prepend(CPPPATH = [os.path.join(llvm_dir, 'include')])
- env.AppendUnique(CPPDEFINES = [
- '__STDC_LIMIT_MACROS',
- '__STDC_CONSTANT_MACROS',
- 'HAVE_STDINT_H',
+ if llvm_dir is None:
+ return
+
+ # Try to determine the LLVM version from llvm/Config/config.h
+ llvm_config = os.path.join(llvm_dir, 'include/llvm/Config/config.h')
+ if not os.path.exists(llvm_config):
+ print 'scons: could not find %s' % llvm_config
+ return
+ llvm_version_re = re.compile(r'^#define PACKAGE_VERSION "([^"]*)"')
+ llvm_version = None
+ for line in open(llvm_config, 'rt'):
+ mo = llvm_version_re.match(line)
+ if mo:
+ llvm_version = mo.group(1)
+ llvm_version = distutils.version.LooseVersion(llvm_version)
+ break
+ if llvm_version is None:
+ print 'scons: could not determine the LLVM version from %s' % llvm_config
+ return
+
+ env.Prepend(CPPPATH = [os.path.join(llvm_dir, 'include')])
+ env.AppendUnique(CPPDEFINES = [
+ '__STDC_LIMIT_MACROS',
+ '__STDC_CONSTANT_MACROS',
+ 'HAVE_STDINT_H',
+ ])
+ env.Prepend(LIBPATH = [os.path.join(llvm_dir, 'lib')])
+ if llvm_version >= distutils.version.LooseVersion('2.7'):
+ # 2.7
+ env.Prepend(LIBS = [
+ 'LLVMLinker', 'LLVMipo', 'LLVMInterpreter',
+ 'LLVMInstrumentation', 'LLVMJIT', 'LLVMExecutionEngine',
+ 'LLVMBitWriter', 'LLVMX86Disassembler', 'LLVMX86AsmParser',
+ 'LLVMMCParser', 'LLVMX86AsmPrinter', 'LLVMX86CodeGen',
+ 'LLVMSelectionDAG', 'LLVMX86Info', 'LLVMAsmPrinter',
+ 'LLVMCodeGen', 'LLVMScalarOpts', 'LLVMInstCombine',
+ 'LLVMTransformUtils', 'LLVMipa', 'LLVMAsmParser',
+ 'LLVMArchive', 'LLVMBitReader', 'LLVMAnalysis', 'LLVMTarget',
+ 'LLVMMC', 'LLVMCore', 'LLVMSupport', 'LLVMSystem',
])
- env.Prepend(LIBPATH = [os.path.join(llvm_dir, 'lib')])
+ else:
+ # 2.6
env.Prepend(LIBS = [
- 'LLVMX86AsmParser',
- 'LLVMX86AsmPrinter',
- 'LLVMX86CodeGen',
- 'LLVMX86Info',
- 'LLVMLinker',
- 'LLVMipo',
- 'LLVMInterpreter',
- 'LLVMInstrumentation',
- 'LLVMJIT',
- 'LLVMExecutionEngine',
- 'LLVMDebugger',
- 'LLVMBitWriter',
- 'LLVMAsmParser',
- 'LLVMArchive',
- 'LLVMBitReader',
- 'LLVMSelectionDAG',
- 'LLVMAsmPrinter',
- 'LLVMCodeGen',
- 'LLVMScalarOpts',
- 'LLVMTransformUtils',
- 'LLVMipa',
- 'LLVMAnalysis',
- 'LLVMTarget',
- 'LLVMMC',
- 'LLVMCore',
- 'LLVMSupport',
+ 'LLVMX86AsmParser', 'LLVMX86AsmPrinter', 'LLVMX86CodeGen',
+ 'LLVMX86Info', 'LLVMLinker', 'LLVMipo', 'LLVMInterpreter',
+ 'LLVMInstrumentation', 'LLVMJIT', 'LLVMExecutionEngine',
+ 'LLVMDebugger', 'LLVMBitWriter', 'LLVMAsmParser',
+ 'LLVMArchive', 'LLVMBitReader', 'LLVMSelectionDAG',
+ 'LLVMAsmPrinter', 'LLVMCodeGen', 'LLVMScalarOpts',
+ 'LLVMTransformUtils', 'LLVMipa', 'LLVMAnalysis',
+ 'LLVMTarget', 'LLVMMC', 'LLVMCore', 'LLVMSupport',
'LLVMSystem',
- 'imagehlp',
- 'psapi',
])
- if env['msvc']:
- # Some of the LLVM C headers use the inline keyword without
- # defining it.
- env.Append(CPPDEFINES = [('inline', '__inline')])
- if env['debug']:
- # LLVM libraries are static, build with /MT, and they
- # automatically link agains LIBCMT. When we're doing a
- # debug build we'll be linking against LIBCMTD, so disable
- # that.
- env.Append(LINKFLAGS = ['/nodefaultlib:LIBCMT'])
- env['LLVM_VERSION'] = '2.6'
- return
+ env.Append(LIBS = [
+ 'imagehlp',
+ 'psapi',
+ ])
+ if env['msvc']:
+ # Some of the LLVM C headers use the inline keyword without
+ # defining it.
+ env.Append(CPPDEFINES = [('inline', '__inline')])
+ if env['debug']:
+ # LLVM libraries are static, build with /MT, and they
+ # automatically link agains LIBCMT. When we're doing a
+ # debug build we'll be linking against LIBCMTD, so disable
+ # that.
+ env.Append(LINKFLAGS = ['/nodefaultlib:LIBCMT'])
elif env.Detect('llvm-config'):
- version = env.backtick('llvm-config --version').rstrip()
+ llvm_version = env.backtick('llvm-config --version').rstrip()
+ llvm_version = distutils.version.LooseVersion(llvm_version)
try:
env.ParseConfig('llvm-config --cppflags')
env.ParseConfig('llvm-config --libs jit interpreter nativecodegen bitwriter')
env.ParseConfig('llvm-config --ldflags')
except OSError:
- print 'llvm-config version %s failed' % version
+ print 'llvm-config version %s failed' % llvm_version
else:
- if env['platform'] == 'windows':
- env.Append(LIBS = ['imagehlp', 'psapi'])
env['LINK'] = env['CXX']
- env['LLVM_VERSION'] = version
+ else:
+ return
+
+ assert llvm_version is not None
+
+ print 'scons: Found LLVM version %s' % llvm_version
+ env['LLVM_VERSION'] = llvm_version
+
+ # Define HAVE_LLVM macro with the major/minor version number (e.g., 0x0206 for 2.6)
+ llvm_version_major = int(llvm_version.version[0])
+ llvm_version_minor = int(llvm_version.version[1])
+ llvm_version_hex = '0x%02x%02x' % (llvm_version_major, llvm_version_minor)
+ env.Prepend(CPPDEFINES = [('HAVE_LLVM', llvm_version_hex)])
def exists(env):
return True
diff --git a/scons/x11.py b/scons/x11.py
new file mode 100644
index 0000000000..99bf079626
--- /dev/null
+++ b/scons/x11.py
@@ -0,0 +1,52 @@
+"""x11
+
+Tool-specific initialization for X11
+
+"""
+
+#
+# Copyright (c) 2010 VMware, Inc.
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+
+def generate(env):
+ env.Append(CPPPATH = ['/usr/X11R6/include'])
+ env.Append(LIBPATH = ['/usr/X11R6/lib'])
+
+ env.Append(LIBS = [
+ 'X11',
+ 'Xext',
+ 'Xxf86vm',
+ 'Xdamage',
+ 'Xfixes',
+ ])
+
+
+def exists(env):
+ # TODO: actually detect the presence of the headers
+ if env['platform'] in ('linux', 'freebsd', 'darwin'):
+ return True
+ else:
+ return False
+
+
+# vim:set ts=4 sw=4 et:
diff --git a/src/SConscript b/src/SConscript
index cd4896ada4..cf6db730da 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -1,13 +1,12 @@
Import('*')
SConscript('glsl/SConscript')
-SConscript('gallium/SConscript')
if 'mesa' in env['statetrackers']:
- SConscript('mesa/SConscript')
+ SConscript('mesa/SConscript')
-SConscript('gallium/winsys/SConscript')
+SConscript('gallium/SConscript')
if platform != 'embedded':
- SConscript('glut/glx/SConscript')
- SConscript('glew/SConscript')
+ SConscript('glut/glx/SConscript')
+ SConscript('glew/SConscript')
diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c
index 012d8dfe1f..5e831aab33 100644
--- a/src/egl/main/eglcontext.c
+++ b/src/egl/main/eglcontext.c
@@ -212,21 +212,35 @@ _eglBindContextToSurfaces(_EGLContext *ctx,
_EGLSurface **draw, _EGLSurface **read)
{
_EGLSurface *newDraw = *draw, *newRead = *read;
+ _EGLContext *oldCtx;
- if (newDraw->CurrentContext)
- newDraw->CurrentContext->DrawSurface = NULL;
- newDraw->CurrentContext = ctx;
+ oldCtx = newDraw->CurrentContext;
+ if (ctx != oldCtx) {
+ if (oldCtx) {
+ assert(*draw == oldCtx->DrawSurface);
+ oldCtx->DrawSurface = NULL;
+ }
+ if (ctx) {
+ *draw = ctx->DrawSurface;
+ ctx->DrawSurface = newDraw;
+ }
- if (newRead->CurrentContext)
- newRead->CurrentContext->ReadSurface = NULL;
- newRead->CurrentContext = ctx;
+ newDraw->CurrentContext = ctx;
+ }
- if (ctx) {
- *draw = ctx->DrawSurface;
- ctx->DrawSurface = newDraw;
+ if (newRead != newDraw)
+ oldCtx = newRead->CurrentContext;
+ if (ctx != oldCtx) {
+ if (oldCtx) {
+ assert(*read == oldCtx->ReadSurface);
+ oldCtx->ReadSurface = NULL;
+ }
+ if (ctx) {
+ *read = ctx->ReadSurface;
+ ctx->ReadSurface = newRead;
+ }
- *read = ctx->ReadSurface;
- ctx->ReadSurface = newRead;
+ newRead->CurrentContext = ctx;
}
}
@@ -246,15 +260,14 @@ _eglBindContextToThread(_EGLContext *ctx, _EGLThreadInfo *t)
_eglConvertApiToIndex(ctx->ClientAPI) : t->CurrentAPIIndex;
oldCtx = t->CurrentContexts[apiIndex];
- if (ctx == oldCtx)
- return NULL;
+ if (ctx != oldCtx) {
+ if (oldCtx)
+ oldCtx->Binding = NULL;
+ if (ctx)
+ ctx->Binding = t;
- if (oldCtx)
- oldCtx->Binding = NULL;
- if (ctx)
- ctx->Binding = t;
-
- t->CurrentContexts[apiIndex] = ctx;
+ t->CurrentContexts[apiIndex] = ctx;
+ }
return oldCtx;
}
@@ -352,7 +365,7 @@ _eglBindContext(_EGLContext **ctx, _EGLSurface **draw, _EGLSurface **read)
_eglBindContextToSurfaces(newCtx, draw, read);
/* unbind the old context from its binding surfaces */
- if (oldCtx) {
+ if (oldCtx && oldCtx != newCtx) {
/*
* If the new context replaces some old context, the new one should not
* be current before the replacement and it should not be bound to any
diff --git a/src/gallium/Makefile.template b/src/gallium/Makefile.template
index 91a9b54b36..b5a9938c74 100644
--- a/src/gallium/Makefile.template
+++ b/src/gallium/Makefile.template
@@ -26,7 +26,7 @@ INCLUDES = \
##### TARGETS #####
-default: depend lib$(LIBNAME).a
+default: depend lib$(LIBNAME).a $(PROGS)
lib$(LIBNAME).a: $(OBJECTS) $(EXTRA_OBJECTS) Makefile $(TOP)/src/gallium/Makefile.template
$(MKLIB) -o $(LIBNAME) -static $(OBJECTS) $(EXTRA_OBJECTS)
@@ -36,13 +36,16 @@ depend: $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(SYMLINKS) $(GENERATED_SOURC
touch depend
$(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(GENERATED_SOURCES) 2> /dev/null
+$(PROGS): % : %.o
+ $(LD) $(filter %.o,$^) -o $@ -Wl,--start-group $(LIBS) -Wl,--end-group
+
# Emacs tags
tags:
etags `find . -name \*.[ch]` `find $(TOP)/src/gallium/include -name \*.h`
# Remove .o and backup files
clean:
- rm -f $(OBJECTS) $(GENERATED_SOURCES) lib$(LIBNAME).a depend depend.bak
+ rm -f $(OBJECTS) $(GENERATED_SOURCES) $(PROGS) lib$(LIBNAME).a depend depend.bak
# Dummy target
install:
diff --git a/src/gallium/SConscript b/src/gallium/SConscript
index d56c5c8461..b8c04f7237 100644
--- a/src/gallium/SConscript
+++ b/src/gallium/SConscript
@@ -7,6 +7,9 @@ SConscript('auxiliary/SConscript')
for driver in env['drivers']:
SConscript(os.path.join('drivers', driver, 'SConscript'))
+# Needed by some state trackers
+SConscript('winsys/sw/null/SConscript')
+
SConscript('state_trackers/python/SConscript')
if platform != 'embedded':
SConscript('state_trackers/glx/xlib/SConscript')
@@ -15,3 +18,7 @@ if platform != 'embedded':
if platform == 'windows':
SConscript('state_trackers/wgl/SConscript')
+
+SConscript('winsys/SConscript')
+
+SConscript('targets/SConscript')
diff --git a/src/gallium/auxiliary/Makefile b/src/gallium/auxiliary/Makefile
index 1d0930e024..843778d810 100644
--- a/src/gallium/auxiliary/Makefile
+++ b/src/gallium/auxiliary/Makefile
@@ -105,9 +105,12 @@ C_SOURCES = \
util/u_cpu_detect.c \
util/u_dl.c \
util/u_draw_quad.c \
- util/u_format_access.c \
+ util/u_format.c \
+ util/u_format_s3tc.c \
util/u_format_table.c \
+ util/u_format_tests.c \
util/u_gen_mipmap.c \
+ util/u_half.c \
util/u_handle_table.c \
util/u_hash_table.c \
util/u_hash.c \
@@ -118,6 +121,7 @@ C_SOURCES = \
util/u_mm.c \
util/u_rect.c \
util/u_ringbuffer.c \
+ util/u_sampler.c \
util/u_simple_shaders.c \
util/u_snprintf.c \
util/u_surface.c \
@@ -126,11 +130,14 @@ C_SOURCES = \
util/u_timed_winsys.c \
util/u_upload_mgr.c \
util/u_simple_screen.c \
- vl/vl_bitstream_parser.c \
- vl/vl_mpeg12_mc_renderer.c \
- vl/vl_compositor.c \
- vl/vl_csc.c \
- vl/vl_shader_build.c
+ target-helpers/wrap_screen.c
+
+ # Disabling until pipe-video branch gets merged in
+ #vl/vl_bitstream_parser.c \
+ #vl/vl_mpeg12_mc_renderer.c \
+ #vl/vl_compositor.c \
+ #vl/vl_csc.c \
+ #vl/vl_shader_build.c \
GALLIVM_SOURCES = \
gallivm/lp_bld_alpha.c \
@@ -143,13 +150,12 @@ GALLIVM_SOURCES = \
gallivm/lp_bld_debug.c \
gallivm/lp_bld_depth.c \
gallivm/lp_bld_flow.c \
- gallivm/lp_bld_format_aos.c \
- gallivm/lp_bld_format_query.c \
gallivm/lp_bld_format_soa.c \
gallivm/lp_bld_interp.c \
gallivm/lp_bld_intr.c \
gallivm/lp_bld_logic.c \
gallivm/lp_bld_pack.c \
+ gallivm/lp_bld_printf.c \
gallivm/lp_bld_sample.c \
gallivm/lp_bld_sample_soa.c \
gallivm/lp_bld_struct.c \
@@ -163,9 +169,8 @@ GALLIVM_CPP_SOURCES = \
GENERATED_SOURCES = \
indices/u_indices_gen.c \
indices/u_unfilled_gen.c \
- util/u_format_access.c \
- util/u_format_pack.h \
- util/u_format_table.c
+ util/u_format_table.c \
+ util/u_half.c
ifeq ($(MESA_LLVM),1)
@@ -188,12 +193,11 @@ indices/u_indices_gen.c: indices/u_indices_gen.py
indices/u_unfilled_gen.c: indices/u_unfilled_gen.py
python $< > $@
-util/u_format_table.c: util/u_format_table.py util/u_format_parse.py util/u_format.csv
+util/u_format_table.c: util/u_format_table.py util/u_format_pack.py util/u_format_parse.py util/u_format.csv
python util/u_format_table.py util/u_format.csv > $@
-util/u_format_pack.h: util/u_format_pack.py util/u_format_parse.py util/u_format.csv
- python util/u_format_pack.py util/u_format.csv > $@
-
util/u_format_access.c: util/u_format_access.py util/u_format_parse.py util/u_format.csv
python util/u_format_access.py util/u_format.csv > $@
+util/u_half.c: util/u_half.py
+ python util/u_half.py > $@
diff --git a/src/gallium/auxiliary/SConscript b/src/gallium/auxiliary/SConscript
index f365c4bbdd..73d4150448 100644
--- a/src/gallium/auxiliary/SConscript
+++ b/src/gallium/auxiliary/SConscript
@@ -7,6 +7,8 @@ env.Append(CPPPATH = [
'util',
])
+env.Tool('udis86')
+
env.CodeGenerate(
target = 'indices/u_indices_gen.c',
script = 'indices/u_indices_gen.py',
@@ -29,18 +31,16 @@ env.CodeGenerate(
)
env.CodeGenerate(
- target = File('util/u_format_pack.h').srcnode(),
- script = 'util/u_format_pack.py',
- source = ['util/u_format.csv'],
- command = 'python $SCRIPT $SOURCE > $TARGET'
+ target = 'util/u_half.c',
+ script = 'util/u_half.py',
+ source = [],
+ command = 'python $SCRIPT > $TARGET'
)
-env.CodeGenerate(
- target = 'util/u_format_access.c',
- script = 'util/u_format_access.py',
- source = ['util/u_format.csv'],
- command = 'python $SCRIPT $SOURCE > $TARGET'
-)
+env.Depends('util/u_format_table.c', [
+ 'util/u_format_parse.py',
+ 'util/u_format_pack.py',
+])
source = [
'cso_cache/cso_context.c',
@@ -147,9 +147,12 @@ source = [
'util/u_dump_state.c',
'util/u_dl.c',
'util/u_draw_quad.c',
- 'util/u_format_access.c',
+ 'util/u_format.c',
+ 'util/u_format_s3tc.c',
'util/u_format_table.c',
+ 'util/u_format_tests.c',
'util/u_gen_mipmap.c',
+ 'util/u_half.c',
'util/u_handle_table.c',
'util/u_hash.c',
'util/u_hash_table.c',
@@ -159,6 +162,7 @@ source = [
'util/u_mm.c',
'util/u_rect.c',
'util/u_ringbuffer.c',
+ 'util/u_sampler.c',
'util/u_simple_shaders.c',
'util/u_snprintf.c',
'util/u_surface.c',
@@ -167,11 +171,13 @@ source = [
'util/u_timed_winsys.c',
'util/u_upload_mgr.c',
'util/u_simple_screen.c',
- 'vl/vl_bitstream_parser.c',
- 'vl/vl_mpeg12_mc_renderer.c',
- 'vl/vl_compositor.c',
- 'vl/vl_csc.c',
- 'vl/vl_shader_build.c',
+ # Disabling until pipe-video branch gets merged in
+ #'vl/vl_bitstream_parser.c',
+ #'vl/vl_mpeg12_mc_renderer.c',
+ #'vl/vl_compositor.c',
+ #'vl/vl_csc.c',
+ #'vl/vl_shader_build.c',
+ 'target-helpers/wrap_screen.c',
]
if drawllvm:
@@ -186,14 +192,13 @@ if drawllvm:
'gallivm/lp_bld_debug.c',
'gallivm/lp_bld_depth.c',
'gallivm/lp_bld_flow.c',
- 'gallivm/lp_bld_format_aos.c',
- 'gallivm/lp_bld_format_query.c',
'gallivm/lp_bld_format_soa.c',
'gallivm/lp_bld_interp.c',
'gallivm/lp_bld_intr.c',
'gallivm/lp_bld_logic.c',
'gallivm/lp_bld_init.cpp',
'gallivm/lp_bld_pack.c',
+ 'gallivm/lp_bld_printf.c',
'gallivm/lp_bld_sample.c',
'gallivm/lp_bld_sample_soa.c',
'gallivm/lp_bld_struct.c',
diff --git a/src/gallium/auxiliary/cso_cache/cso_cache.c b/src/gallium/auxiliary/cso_cache/cso_cache.c
index a6a07e72c2..900c64df4b 100644
--- a/src/gallium/auxiliary/cso_cache/cso_cache.c
+++ b/src/gallium/auxiliary/cso_cache/cso_cache.c
@@ -43,6 +43,7 @@ struct cso_cache {
struct cso_hash *vs_hash;
struct cso_hash *rasterizer_hash;
struct cso_hash *sampler_hash;
+ struct cso_hash *velements_hash;
int max_size;
cso_sanitize_callback sanitize_cb;
@@ -108,6 +109,9 @@ static struct cso_hash *_cso_hash_for_type(struct cso_cache *sc, enum cso_cache_
case CSO_VERTEX_SHADER:
hash = sc->vs_hash;
break;
+ case CSO_VELEMENTS:
+ hash = sc->velements_hash;
+ break;
}
return hash;
@@ -161,6 +165,13 @@ static void delete_vs_state(void *state, void *data)
FREE(state);
}
+static void delete_velements(void *state, void *data)
+{
+ struct cso_velements *cso = (struct cso_velements *)state;
+ if (cso->delete_state)
+ cso->delete_state(cso->context, cso->data);
+ FREE(state);
+}
static INLINE void delete_cso(void *state, enum cso_cache_type type)
{
@@ -183,6 +194,9 @@ static INLINE void delete_cso(void *state, enum cso_cache_type type)
case CSO_VERTEX_SHADER:
delete_vs_state(state, 0);
break;
+ case CSO_VELEMENTS:
+ delete_velements(state, 0);
+ break;
default:
assert(0);
FREE(state);
@@ -294,6 +308,7 @@ struct cso_cache *cso_cache_create(void)
sc->rasterizer_hash = cso_hash_create();
sc->fs_hash = cso_hash_create();
sc->vs_hash = cso_hash_create();
+ sc->velements_hash = cso_hash_create();
sc->sanitize_cb = sanitize_cb;
sc->sanitize_data = 0;
@@ -325,6 +340,9 @@ void cso_for_each_state(struct cso_cache *sc, enum cso_cache_type type,
case CSO_VERTEX_SHADER:
hash = sc->vs_hash;
break;
+ case CSO_VELEMENTS:
+ hash = sc->velements_hash;
+ break;
}
iter = cso_hash_first_node(hash);
@@ -351,6 +369,7 @@ void cso_cache_delete(struct cso_cache *sc)
cso_for_each_state(sc, CSO_VERTEX_SHADER, delete_vs_state, 0);
cso_for_each_state(sc, CSO_RASTERIZER, delete_rasterizer_state, 0);
cso_for_each_state(sc, CSO_SAMPLER, delete_sampler_state, 0);
+ cso_for_each_state(sc, CSO_VELEMENTS, delete_velements, 0);
cso_hash_delete(sc->blend_hash);
cso_hash_delete(sc->sampler_hash);
@@ -358,6 +377,7 @@ void cso_cache_delete(struct cso_cache *sc)
cso_hash_delete(sc->rasterizer_hash);
cso_hash_delete(sc->fs_hash);
cso_hash_delete(sc->vs_hash);
+ cso_hash_delete(sc->velements_hash);
FREE(sc);
}
@@ -372,6 +392,7 @@ void cso_set_maximum_cache_size(struct cso_cache *sc, int number)
sanitize_hash(sc, sc->vs_hash, CSO_VERTEX_SHADER, sc->max_size);
sanitize_hash(sc, sc->rasterizer_hash, CSO_RASTERIZER, sc->max_size);
sanitize_hash(sc, sc->sampler_hash, CSO_SAMPLER, sc->max_size);
+ sanitize_hash(sc, sc->velements_hash, CSO_VELEMENTS, sc->max_size);
}
int cso_maximum_cache_size(const struct cso_cache *sc)
diff --git a/src/gallium/auxiliary/cso_cache/cso_cache.h b/src/gallium/auxiliary/cso_cache/cso_cache.h
index eea60b940b..fb09b83c62 100644
--- a/src/gallium/auxiliary/cso_cache/cso_cache.h
+++ b/src/gallium/auxiliary/cso_cache/cso_cache.h
@@ -53,6 +53,7 @@
* - rasterizer (old setup)
* - sampler
* - vertex shader
+ * - vertex elements
*
* Things that are not constant state objects include:
* - blend_color
@@ -90,7 +91,8 @@ enum cso_cache_type {
CSO_DEPTH_STENCIL_ALPHA,
CSO_RASTERIZER,
CSO_FRAGMENT_SHADER,
- CSO_VERTEX_SHADER
+ CSO_VERTEX_SHADER,
+ CSO_VELEMENTS
};
typedef void (*cso_state_callback)(void *ctx, void *obj);
@@ -144,6 +146,18 @@ struct cso_sampler {
struct pipe_context *context;
};
+struct cso_velems_state {
+ unsigned count;
+ struct pipe_vertex_element velems[PIPE_MAX_ATTRIBS];
+};
+
+struct cso_velements {
+ struct cso_velems_state state;
+ void *data;
+ cso_state_callback delete_state;
+ struct pipe_context *context;
+};
+
unsigned cso_construct_key(void *item, int item_size);
struct cso_cache *cso_cache_create(void);
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c
index a7335c340c..6fd4bd3642 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
@@ -37,6 +37,7 @@
#include "pipe/p_state.h"
#include "util/u_inlines.h"
+#include "util/u_math.h"
#include "util/u_memory.h"
#include "tgsi/tgsi_parse.h"
@@ -69,17 +70,17 @@ struct cso_context {
unsigned nr_vertex_samplers_saved;
void *vertex_samplers_saved[PIPE_MAX_VERTEX_SAMPLERS];
- struct pipe_texture *textures[PIPE_MAX_SAMPLERS];
- uint nr_textures;
+ uint nr_fragment_sampler_views;
+ struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS];
- struct pipe_texture *vertex_textures[PIPE_MAX_VERTEX_SAMPLERS];
- uint nr_vertex_textures;
+ uint nr_vertex_sampler_views;
+ struct pipe_sampler_view *vertex_sampler_views[PIPE_MAX_VERTEX_SAMPLERS];
- uint nr_textures_saved;
- struct pipe_texture *textures_saved[PIPE_MAX_SAMPLERS];
+ uint nr_fragment_sampler_views_saved;
+ struct pipe_sampler_view *fragment_sampler_views_saved[PIPE_MAX_SAMPLERS];
- uint nr_vertex_textures_saved;
- struct pipe_texture *vertex_textures_saved[PIPE_MAX_SAMPLERS];
+ uint nr_vertex_sampler_views_saved;
+ struct pipe_sampler_view *vertex_sampler_views_saved[PIPE_MAX_VERTEX_SAMPLERS];
/** Current and saved state.
* The saved state is used as a 1-deep stack.
@@ -89,6 +90,7 @@ struct cso_context {
void *rasterizer, *rasterizer_saved;
void *fragment_shader, *fragment_shader_saved, *geometry_shader;
void *vertex_shader, *vertex_shader_saved, *geometry_shader_saved;
+ void *velements, *velements_saved;
struct pipe_clip_state clip;
struct pipe_clip_state clip_saved;
@@ -174,6 +176,20 @@ static boolean delete_vs_state(struct cso_context *ctx, void *state)
return FALSE;
}
+static boolean delete_vertex_elements(struct cso_context *ctx,
+ void *state)
+{
+ struct cso_velements *cso = (struct cso_velements *)state;
+
+ if (ctx->velements == cso->data)
+ return FALSE;
+
+ if (cso->delete_state)
+ cso->delete_state(cso->context, cso->data);
+ FREE(state);
+ return TRUE;
+}
+
static INLINE boolean delete_cso(struct cso_context *ctx,
void *state, enum cso_cache_type type)
@@ -197,6 +213,9 @@ static INLINE boolean delete_cso(struct cso_context *ctx,
case CSO_VERTEX_SHADER:
return delete_vs_state(ctx, state);
break;
+ case CSO_VELEMENTS:
+ return delete_vertex_elements(ctx, state);
+ break;
default:
assert(0);
FREE(state);
@@ -271,16 +290,17 @@ void cso_release_all( struct cso_context *ctx )
ctx->pipe->bind_depth_stencil_alpha_state( ctx->pipe, NULL );
ctx->pipe->bind_fs_state( ctx->pipe, NULL );
ctx->pipe->bind_vs_state( ctx->pipe, NULL );
+ ctx->pipe->bind_vertex_elements_state( ctx->pipe, NULL );
}
for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
- pipe_texture_reference(&ctx->textures[i], NULL);
- pipe_texture_reference(&ctx->textures_saved[i], NULL);
+ pipe_sampler_view_reference(&ctx->fragment_sampler_views[i], NULL);
+ pipe_sampler_view_reference(&ctx->fragment_sampler_views_saved[i], NULL);
}
for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) {
- pipe_texture_reference(&ctx->vertex_textures[i], NULL);
- pipe_texture_reference(&ctx->vertex_textures_saved[i], NULL);
+ pipe_sampler_view_reference(&ctx->vertex_sampler_views[i], NULL);
+ pipe_sampler_view_reference(&ctx->vertex_sampler_views_saved[i], NULL);
}
free_framebuffer_state(&ctx->fb);
@@ -597,114 +617,6 @@ cso_restore_vertex_samplers(struct cso_context *ctx)
}
-enum pipe_error cso_set_sampler_textures( struct cso_context *ctx,
- uint count,
- struct pipe_texture **textures )
-{
- uint i;
-
- ctx->nr_textures = count;
-
- for (i = 0; i < count; i++)
- pipe_texture_reference(&ctx->textures[i], textures[i]);
- for ( ; i < PIPE_MAX_SAMPLERS; i++)
- pipe_texture_reference(&ctx->textures[i], NULL);
-
- ctx->pipe->set_fragment_sampler_textures(ctx->pipe, count, textures);
-
- return PIPE_OK;
-}
-
-void cso_save_sampler_textures( struct cso_context *ctx )
-{
- uint i;
-
- ctx->nr_textures_saved = ctx->nr_textures;
- for (i = 0; i < ctx->nr_textures; i++) {
- assert(!ctx->textures_saved[i]);
- pipe_texture_reference(&ctx->textures_saved[i], ctx->textures[i]);
- }
-}
-
-void cso_restore_sampler_textures( struct cso_context *ctx )
-{
- uint i;
-
- ctx->nr_textures = ctx->nr_textures_saved;
-
- for (i = 0; i < ctx->nr_textures; i++) {
- pipe_texture_reference(&ctx->textures[i], NULL);
- ctx->textures[i] = ctx->textures_saved[i];
- ctx->textures_saved[i] = NULL;
- }
- for ( ; i < PIPE_MAX_SAMPLERS; i++)
- pipe_texture_reference(&ctx->textures[i], NULL);
-
- ctx->pipe->set_fragment_sampler_textures(ctx->pipe, ctx->nr_textures, ctx->textures);
-
- ctx->nr_textures_saved = 0;
-}
-
-
-
-enum pipe_error
-cso_set_vertex_sampler_textures(struct cso_context *ctx,
- uint count,
- struct pipe_texture **textures)
-{
- uint i;
-
- ctx->nr_vertex_textures = count;
-
- for (i = 0; i < count; i++) {
- pipe_texture_reference(&ctx->vertex_textures[i], textures[i]);
- }
- for ( ; i < PIPE_MAX_VERTEX_SAMPLERS; i++) {
- pipe_texture_reference(&ctx->vertex_textures[i], NULL);
- }
-
- ctx->pipe->set_vertex_sampler_textures(ctx->pipe, count, textures);
-
- return PIPE_OK;
-}
-
-void
-cso_save_vertex_sampler_textures(struct cso_context *ctx)
-{
- uint i;
-
- ctx->nr_vertex_textures_saved = ctx->nr_vertex_textures;
- for (i = 0; i < ctx->nr_vertex_textures; i++) {
- assert(!ctx->vertex_textures_saved[i]);
- pipe_texture_reference(&ctx->vertex_textures_saved[i], ctx->vertex_textures[i]);
- }
-}
-
-void
-cso_restore_vertex_sampler_textures(struct cso_context *ctx)
-{
- uint i;
-
- ctx->nr_vertex_textures = ctx->nr_vertex_textures_saved;
-
- for (i = 0; i < ctx->nr_vertex_textures; i++) {
- pipe_texture_reference(&ctx->vertex_textures[i], NULL);
- ctx->vertex_textures[i] = ctx->vertex_textures_saved[i];
- ctx->vertex_textures_saved[i] = NULL;
- }
- for ( ; i < PIPE_MAX_VERTEX_SAMPLERS; i++) {
- pipe_texture_reference(&ctx->vertex_textures[i], NULL);
- }
-
- ctx->pipe->set_vertex_sampler_textures(ctx->pipe,
- ctx->nr_vertex_textures,
- ctx->vertex_textures);
-
- ctx->nr_vertex_textures_saved = 0;
-}
-
-
-
enum pipe_error cso_set_depth_stencil_alpha(struct cso_context *ctx,
const struct pipe_depth_stencil_alpha_state *templ)
{
@@ -1130,7 +1042,6 @@ void cso_restore_geometry_shader(struct cso_context *ctx)
ctx->geometry_shader_saved = NULL;
}
-
/* clip state */
static INLINE void
@@ -1180,3 +1091,185 @@ cso_restore_clip(struct cso_context *ctx)
ctx->pipe->set_clip_state(ctx->pipe, &ctx->clip_saved);
}
}
+
+enum pipe_error cso_set_vertex_elements(struct cso_context *ctx,
+ unsigned count,
+ const struct pipe_vertex_element *states)
+{
+ unsigned key_size, hash_key;
+ struct cso_hash_iter iter;
+ void *handle;
+ struct cso_velems_state velems_state;
+
+ /* need to include the count into the stored state data too.
+ Otherwise first few count pipe_vertex_elements could be identical even if count
+ is different, and there's no guarantee the hash would be different in that
+ case neither */
+ key_size = sizeof(struct pipe_vertex_element) * count + sizeof(unsigned);
+ velems_state.count = count;
+ memcpy(velems_state.velems, states, sizeof(struct pipe_vertex_element) * count);
+ hash_key = cso_construct_key((void*)&velems_state, key_size);
+ iter = cso_find_state_template(ctx->cache, hash_key, CSO_VELEMENTS, (void*)&velems_state, key_size);
+
+ if (cso_hash_iter_is_null(iter)) {
+ struct cso_velements *cso = MALLOC(sizeof(struct cso_velements));
+ if (!cso)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+
+ memcpy(&cso->state, &velems_state, key_size);
+ cso->data = ctx->pipe->create_vertex_elements_state(ctx->pipe, count, &cso->state.velems[0]);
+ cso->delete_state = (cso_state_callback)ctx->pipe->delete_vertex_elements_state;
+ cso->context = ctx->pipe;
+
+ iter = cso_insert_state(ctx->cache, hash_key, CSO_VELEMENTS, cso);
+ if (cso_hash_iter_is_null(iter)) {
+ FREE(cso);
+ return PIPE_ERROR_OUT_OF_MEMORY;
+ }
+
+ handle = cso->data;
+ }
+ else {
+ handle = ((struct cso_velements *)cso_hash_iter_data(iter))->data;
+ }
+
+ if (ctx->velements != handle) {
+ ctx->velements = handle;
+ ctx->pipe->bind_vertex_elements_state(ctx->pipe, handle);
+ }
+ return PIPE_OK;
+}
+
+void cso_save_vertex_elements(struct cso_context *ctx)
+{
+ assert(!ctx->velements_saved);
+ ctx->velements_saved = ctx->velements;
+}
+
+void cso_restore_vertex_elements(struct cso_context *ctx)
+{
+ if (ctx->velements != ctx->velements_saved) {
+ ctx->velements = ctx->velements_saved;
+ ctx->pipe->bind_vertex_elements_state(ctx->pipe, ctx->velements_saved);
+ }
+ ctx->velements_saved = NULL;
+}
+
+/* fragment sampler view state */
+
+void
+cso_set_fragment_sampler_views(struct cso_context *cso,
+ uint count,
+ struct pipe_sampler_view **views)
+{
+ uint i;
+
+ for (i = 0; i < count; i++) {
+ pipe_sampler_view_reference(&cso->fragment_sampler_views[i], views[i]);
+ }
+ for (; i < cso->nr_fragment_sampler_views; i++) {
+ pipe_sampler_view_reference(&cso->fragment_sampler_views[i], NULL);
+ }
+
+ cso->pipe->set_fragment_sampler_views(cso->pipe,
+ MAX2(count, cso->nr_fragment_sampler_views),
+ cso->fragment_sampler_views);
+
+ cso->nr_fragment_sampler_views = count;
+}
+
+void
+cso_save_fragment_sampler_views(struct cso_context *cso)
+{
+ uint i;
+
+ cso->nr_fragment_sampler_views_saved = cso->nr_fragment_sampler_views;
+
+ for (i = 0; i < cso->nr_fragment_sampler_views; i++) {
+ assert(!cso->fragment_sampler_views_saved[i]);
+
+ pipe_sampler_view_reference(&cso->fragment_sampler_views_saved[i],
+ cso->fragment_sampler_views[i]);
+ }
+}
+
+void
+cso_restore_fragment_sampler_views(struct cso_context *cso)
+{
+ uint i;
+
+ for (i = 0; i < cso->nr_fragment_sampler_views_saved; i++) {
+ pipe_sampler_view_reference(&cso->fragment_sampler_views[i], cso->fragment_sampler_views_saved[i]);
+ pipe_sampler_view_reference(&cso->fragment_sampler_views_saved[i], NULL);
+ }
+ for (; i < cso->nr_fragment_sampler_views; i++) {
+ pipe_sampler_view_reference(&cso->fragment_sampler_views[i], NULL);
+ }
+
+ cso->pipe->set_fragment_sampler_views(cso->pipe,
+ MAX2(cso->nr_fragment_sampler_views, cso->nr_fragment_sampler_views_saved),
+ cso->fragment_sampler_views);
+
+ cso->nr_fragment_sampler_views = cso->nr_fragment_sampler_views_saved;
+ cso->nr_fragment_sampler_views_saved = 0;
+}
+
+
+/* vertex sampler view state */
+
+void
+cso_set_vertex_sampler_views(struct cso_context *cso,
+ uint count,
+ struct pipe_sampler_view **views)
+{
+ uint i;
+
+ for (i = 0; i < count; i++) {
+ pipe_sampler_view_reference(&cso->vertex_sampler_views[i], views[i]);
+ }
+ for (; i < cso->nr_vertex_sampler_views; i++) {
+ pipe_sampler_view_reference(&cso->vertex_sampler_views[i], NULL);
+ }
+
+ cso->pipe->set_vertex_sampler_views(cso->pipe,
+ MAX2(count, cso->nr_vertex_sampler_views),
+ cso->vertex_sampler_views);
+
+ cso->nr_vertex_sampler_views = count;
+}
+
+void
+cso_save_vertex_sampler_views(struct cso_context *cso)
+{
+ uint i;
+
+ cso->nr_vertex_sampler_views_saved = cso->nr_vertex_sampler_views;
+
+ for (i = 0; i < cso->nr_vertex_sampler_views; i++) {
+ assert(!cso->vertex_sampler_views_saved[i]);
+
+ pipe_sampler_view_reference(&cso->vertex_sampler_views_saved[i],
+ cso->vertex_sampler_views[i]);
+ }
+}
+
+void
+cso_restore_vertex_sampler_views(struct cso_context *cso)
+{
+ uint i;
+
+ for (i = 0; i < cso->nr_vertex_sampler_views_saved; i++) {
+ pipe_sampler_view_reference(&cso->vertex_sampler_views[i], cso->vertex_sampler_views_saved[i]);
+ pipe_sampler_view_reference(&cso->vertex_sampler_views_saved[i], NULL);
+ }
+ for (; i < cso->nr_vertex_sampler_views; i++) {
+ pipe_sampler_view_reference(&cso->vertex_sampler_views[i], NULL);
+ }
+
+ cso->pipe->set_vertex_sampler_views(cso->pipe,
+ MAX2(cso->nr_vertex_sampler_views, cso->nr_vertex_sampler_views_saved),
+ cso->vertex_sampler_views);
+
+ cso->nr_vertex_sampler_views = cso->nr_vertex_sampler_views_saved;
+ cso->nr_vertex_sampler_views_saved = 0;
+}
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h b/src/gallium/auxiliary/cso_cache/cso_context.h
index 251a9a644f..d6bcb1fe8f 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.h
+++ b/src/gallium/auxiliary/cso_cache/cso_context.h
@@ -103,24 +103,11 @@ void
cso_single_vertex_sampler_done(struct cso_context *cso);
-
-enum pipe_error cso_set_sampler_textures( struct cso_context *cso,
- uint count,
- struct pipe_texture **textures );
-void cso_save_sampler_textures( struct cso_context *cso );
-void cso_restore_sampler_textures( struct cso_context *cso );
-
-
-
-enum pipe_error
-cso_set_vertex_sampler_textures(struct cso_context *cso,
- uint count,
- struct pipe_texture **textures);
-void
-cso_save_vertex_sampler_textures(struct cso_context *cso);
-void
-cso_restore_vertex_sampler_textures(struct cso_context *cso);
-
+enum pipe_error cso_set_vertex_elements(struct cso_context *ctx,
+ unsigned count,
+ const struct pipe_vertex_element *states);
+void cso_save_vertex_elements(struct cso_context *ctx);
+void cso_restore_vertex_elements(struct cso_context *ctx);
/* These aren't really sensible -- most of the time the api provides
@@ -157,7 +144,6 @@ void cso_save_geometry_shader(struct cso_context *cso);
void cso_restore_geometry_shader(struct cso_context *cso);
-
enum pipe_error cso_set_framebuffer(struct cso_context *cso,
const struct pipe_framebuffer_state *fb);
void cso_save_framebuffer(struct cso_context *cso);
@@ -193,6 +179,34 @@ void
cso_restore_clip(struct cso_context *cso);
+/* fragment sampler view state */
+
+void
+cso_set_fragment_sampler_views(struct cso_context *cso,
+ uint count,
+ struct pipe_sampler_view **views);
+
+void
+cso_save_fragment_sampler_views(struct cso_context *cso);
+
+void
+cso_restore_fragment_sampler_views(struct cso_context *cso);
+
+
+/* vertex sampler view state */
+
+void
+cso_set_vertex_sampler_views(struct cso_context *cso,
+ uint count,
+ struct pipe_sampler_view **views);
+
+void
+cso_save_vertex_sampler_views(struct cso_context *cso);
+
+void
+cso_restore_vertex_sampler_views(struct cso_context *cso);
+
+
#ifdef __cplusplus
}
#endif
diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
index 8f6ca15dfa..f4615064e6 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
@@ -40,6 +40,7 @@
#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
+#include "util/u_sampler.h"
#include "tgsi/tgsi_transform.h"
#include "tgsi/tgsi_dump.h"
@@ -88,8 +89,9 @@ struct aaline_stage
void *sampler_cso;
struct pipe_texture *texture;
+ struct pipe_sampler_view *sampler_view;
uint num_samplers;
- uint num_textures;
+ uint num_sampler_views;
/*
@@ -98,7 +100,7 @@ struct aaline_stage
struct aaline_fragment_shader *fs;
struct {
void *sampler[PIPE_MAX_SAMPLERS];
- struct pipe_texture *texture[PIPE_MAX_SAMPLERS];
+ struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS];
} state;
/*
@@ -111,8 +113,9 @@ struct aaline_stage
void (*driver_bind_sampler_states)(struct pipe_context *, unsigned,
void **);
- void (*driver_set_sampler_textures)(struct pipe_context *, unsigned,
- struct pipe_texture **);
+ void (*driver_set_sampler_views)(struct pipe_context *,
+ unsigned,
+ struct pipe_sampler_view **);
struct pipe_context *pipe;
};
@@ -394,6 +397,7 @@ aaline_create_texture(struct aaline_stage *aaline)
struct pipe_context *pipe = aaline->pipe;
struct pipe_screen *screen = pipe->screen;
struct pipe_texture texTemp;
+ struct pipe_sampler_view viewTempl;
uint level;
memset(&texTemp, 0, sizeof(texTemp));
@@ -408,6 +412,16 @@ aaline_create_texture(struct aaline_stage *aaline)
if (!aaline->texture)
return FALSE;
+ u_sampler_view_default_template(&viewTempl,
+ aaline->texture,
+ aaline->texture->format);
+ aaline->sampler_view = pipe->create_sampler_view(pipe,
+ aaline->texture,
+ &viewTempl);
+ if (!aaline->sampler_view) {
+ return FALSE;
+ }
+
/* Fill in mipmap images.
* Basically each level is solid opaque, except for the outermost
* texels which are zero. Special case the 1x1 and 2x2 levels.
@@ -422,9 +436,9 @@ aaline_create_texture(struct aaline_stage *aaline)
/* This texture is new, no need to flush.
*/
- transfer = screen->get_tex_transfer(screen, aaline->texture, 0, level, 0,
+ transfer = pipe->get_tex_transfer(pipe, aaline->texture, 0, level, 0,
PIPE_TRANSFER_WRITE, 0, 0, size, size);
- data = screen->transfer_map(screen, transfer);
+ data = pipe->transfer_map(pipe, transfer);
if (data == NULL)
return FALSE;
@@ -448,8 +462,8 @@ aaline_create_texture(struct aaline_stage *aaline)
}
/* unmap */
- screen->transfer_unmap(screen, transfer);
- screen->tex_transfer_destroy(transfer);
+ pipe->transfer_unmap(pipe, transfer);
+ pipe->tex_transfer_destroy(pipe, transfer);
}
return TRUE;
}
@@ -669,16 +683,16 @@ aaline_first_line(struct draw_stage *stage, struct prim_header *header)
/* how many samplers? */
/* we'll use sampler/texture[pstip->sampler_unit] for the stipple */
- num_samplers = MAX2(aaline->num_textures, aaline->num_samplers);
+ num_samplers = MAX2(aaline->num_sampler_views, aaline->num_samplers);
num_samplers = MAX2(num_samplers, aaline->fs->sampler_unit + 1);
aaline->state.sampler[aaline->fs->sampler_unit] = aaline->sampler_cso;
- pipe_texture_reference(&aaline->state.texture[aaline->fs->sampler_unit],
- aaline->texture);
+ pipe_sampler_view_reference(&aaline->state.sampler_views[aaline->fs->sampler_unit],
+ aaline->sampler_view);
draw->suspend_flushing = TRUE;
aaline->driver_bind_sampler_states(pipe, num_samplers, aaline->state.sampler);
- aaline->driver_set_sampler_textures(pipe, num_samplers, aaline->state.texture);
+ aaline->driver_set_sampler_views(pipe, num_samplers, aaline->state.sampler_views);
draw->suspend_flushing = FALSE;
/* now really draw first line */
@@ -702,8 +716,9 @@ aaline_flush(struct draw_stage *stage, unsigned flags)
aaline->driver_bind_fs_state(pipe, aaline->fs->driver_fs);
aaline->driver_bind_sampler_states(pipe, aaline->num_samplers,
aaline->state.sampler);
- aaline->driver_set_sampler_textures(pipe, aaline->num_textures,
- aaline->state.texture);
+ aaline->driver_set_sampler_views(pipe,
+ aaline->num_sampler_views,
+ aaline->state.sampler_views);
draw->suspend_flushing = FALSE;
draw->extra_shader_outputs.slot = 0;
@@ -724,7 +739,7 @@ aaline_destroy(struct draw_stage *stage)
uint i;
for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
- pipe_texture_reference(&aaline->state.texture[i], NULL);
+ pipe_sampler_view_reference(&aaline->state.sampler_views[i], NULL);
}
if (aaline->sampler_cso)
@@ -733,6 +748,10 @@ aaline_destroy(struct draw_stage *stage)
if (aaline->texture)
pipe_texture_reference(&aaline->texture, NULL);
+ if (aaline->sampler_view) {
+ pipe_sampler_view_reference(&aaline->sampler_view, NULL);
+ }
+
draw_free_temp_verts( stage );
FREE( stage );
@@ -844,23 +863,24 @@ aaline_bind_sampler_states(struct pipe_context *pipe,
static void
-aaline_set_sampler_textures(struct pipe_context *pipe,
- unsigned num, struct pipe_texture **texture)
+aaline_set_sampler_views(struct pipe_context *pipe,
+ unsigned num,
+ struct pipe_sampler_view **views)
{
struct aaline_stage *aaline = aaline_stage_from_pipe(pipe);
uint i;
/* save current */
for (i = 0; i < num; i++) {
- pipe_texture_reference(&aaline->state.texture[i], texture[i]);
+ pipe_sampler_view_reference(&aaline->state.sampler_views[i], views[i]);
}
for ( ; i < PIPE_MAX_SAMPLERS; i++) {
- pipe_texture_reference(&aaline->state.texture[i], NULL);
+ pipe_sampler_view_reference(&aaline->state.sampler_views[i], NULL);
}
- aaline->num_textures = num;
+ aaline->num_sampler_views = num;
/* pass-through */
- aaline->driver_set_sampler_textures(aaline->pipe, num, texture);
+ aaline->driver_set_sampler_views(aaline->pipe, num, views);
}
@@ -898,7 +918,7 @@ draw_install_aaline_stage(struct draw_context *draw, struct pipe_context *pipe)
aaline->driver_delete_fs_state = pipe->delete_fs_state;
aaline->driver_bind_sampler_states = pipe->bind_fragment_sampler_states;
- aaline->driver_set_sampler_textures = pipe->set_fragment_sampler_textures;
+ aaline->driver_set_sampler_views = pipe->set_fragment_sampler_views;
/* override the driver's functions */
pipe->create_fs_state = aaline_create_fs_state;
@@ -906,7 +926,7 @@ draw_install_aaline_stage(struct draw_context *draw, struct pipe_context *pipe)
pipe->delete_fs_state = aaline_delete_fs_state;
pipe->bind_fragment_sampler_states = aaline_bind_sampler_states;
- pipe->set_fragment_sampler_textures = aaline_set_sampler_textures;
+ pipe->set_fragment_sampler_views = aaline_set_sampler_views;
/* Install once everything is known to be OK:
*/
diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
index d0d99aa331..794fd81d70 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
@@ -42,6 +42,7 @@
#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
+#include "util/u_sampler.h"
#include "tgsi/tgsi_transform.h"
#include "tgsi/tgsi_dump.h"
@@ -75,8 +76,9 @@ struct pstip_stage
void *sampler_cso;
struct pipe_texture *texture;
+ struct pipe_sampler_view *sampler_view;
uint num_samplers;
- uint num_textures;
+ uint num_sampler_views;
/*
* Currently bound state
@@ -84,7 +86,7 @@ struct pstip_stage
struct pstip_fragment_shader *fs;
struct {
void *samplers[PIPE_MAX_SAMPLERS];
- struct pipe_texture *textures[PIPE_MAX_SAMPLERS];
+ struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS];
const struct pipe_poly_stipple *stipple;
} state;
@@ -98,8 +100,9 @@ struct pstip_stage
void (*driver_bind_sampler_states)(struct pipe_context *, unsigned, void **);
- void (*driver_set_sampler_textures)(struct pipe_context *, unsigned,
- struct pipe_texture **);
+ void (*driver_set_sampler_views)(struct pipe_context *,
+ unsigned,
+ struct pipe_sampler_view **);
void (*driver_set_polygon_stipple)(struct pipe_context *,
const struct pipe_poly_stipple *);
@@ -374,19 +377,21 @@ pstip_update_texture(struct pstip_stage *pstip)
{
static const uint bit31 = 1 << 31;
struct pipe_context *pipe = pstip->pipe;
- struct pipe_screen *screen = pipe->screen;
struct pipe_transfer *transfer;
const uint *stipple = pstip->state.stipple->stipple;
uint i, j;
ubyte *data;
/* XXX: want to avoid flushing just because we use stipple:
+ *
+ * Flush should no longer be necessary if driver is properly
+ * interleaving drawing and transfers on a given context:
*/
pipe->flush( pipe, PIPE_FLUSH_TEXTURE_CACHE, NULL );
- transfer = screen->get_tex_transfer(screen, pstip->texture, 0, 0, 0,
- PIPE_TRANSFER_WRITE, 0, 0, 32, 32);
- data = screen->transfer_map(screen, transfer);
+ transfer = pipe->get_tex_transfer(pipe, pstip->texture, 0, 0, 0,
+ PIPE_TRANSFER_WRITE, 0, 0, 32, 32);
+ data = pipe->transfer_map(pipe, transfer);
/*
* Load alpha texture.
@@ -408,8 +413,8 @@ pstip_update_texture(struct pstip_stage *pstip)
}
/* unmap */
- screen->transfer_unmap(screen, transfer);
- screen->tex_transfer_destroy(transfer);
+ pipe->transfer_unmap(pipe, transfer);
+ pipe->tex_transfer_destroy(pipe, transfer);
}
@@ -422,6 +427,7 @@ pstip_create_texture(struct pstip_stage *pstip)
struct pipe_context *pipe = pstip->pipe;
struct pipe_screen *screen = pipe->screen;
struct pipe_texture texTemp;
+ struct pipe_sampler_view viewTempl;
memset(&texTemp, 0, sizeof(texTemp));
texTemp.target = PIPE_TEXTURE_2D;
@@ -435,6 +441,16 @@ pstip_create_texture(struct pstip_stage *pstip)
if (pstip->texture == NULL)
return FALSE;
+ u_sampler_view_default_template(&viewTempl,
+ pstip->texture,
+ pstip->texture->format);
+ pstip->sampler_view = pipe->create_sampler_view(pipe,
+ pstip->texture,
+ &viewTempl);
+ if (!pstip->sampler_view) {
+ return FALSE;
+ }
+
return TRUE;
}
@@ -513,19 +529,19 @@ pstip_first_tri(struct draw_stage *stage, struct prim_header *header)
/* how many samplers? */
/* we'll use sampler/texture[pstip->sampler_unit] for the stipple */
- num_samplers = MAX2(pstip->num_textures, pstip->num_samplers);
+ num_samplers = MAX2(pstip->num_sampler_views, pstip->num_samplers);
num_samplers = MAX2(num_samplers, pstip->fs->sampler_unit + 1);
/* plug in our sampler, texture */
pstip->state.samplers[pstip->fs->sampler_unit] = pstip->sampler_cso;
- pipe_texture_reference(&pstip->state.textures[pstip->fs->sampler_unit],
- pstip->texture);
+ pipe_sampler_view_reference(&pstip->state.sampler_views[pstip->fs->sampler_unit],
+ pstip->sampler_view);
assert(num_samplers <= PIPE_MAX_SAMPLERS);
draw->suspend_flushing = TRUE;
pstip->driver_bind_sampler_states(pipe, num_samplers, pstip->state.samplers);
- pstip->driver_set_sampler_textures(pipe, num_samplers, pstip->state.textures);
+ pstip->driver_set_sampler_views(pipe, num_samplers, pstip->state.sampler_views);
draw->suspend_flushing = FALSE;
/* now really draw first triangle */
@@ -549,8 +565,9 @@ pstip_flush(struct draw_stage *stage, unsigned flags)
pstip->driver_bind_fs_state(pipe, pstip->fs->driver_fs);
pstip->driver_bind_sampler_states(pipe, pstip->num_samplers,
pstip->state.samplers);
- pstip->driver_set_sampler_textures(pipe, pstip->num_textures,
- pstip->state.textures);
+ pstip->driver_set_sampler_views(pipe,
+ pstip->num_sampler_views,
+ pstip->state.sampler_views);
draw->suspend_flushing = FALSE;
}
@@ -569,13 +586,17 @@ pstip_destroy(struct draw_stage *stage)
uint i;
for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
- pipe_texture_reference(&pstip->state.textures[i], NULL);
+ pipe_sampler_view_reference(&pstip->state.sampler_views[i], NULL);
}
pstip->pipe->delete_sampler_state(pstip->pipe, pstip->sampler_cso);
pipe_texture_reference(&pstip->texture, NULL);
+ if (pstip->sampler_view) {
+ pipe_sampler_view_reference(&pstip->sampler_view, NULL);
+ }
+
draw_free_temp_verts( stage );
FREE( stage );
}
@@ -680,24 +701,25 @@ pstip_bind_sampler_states(struct pipe_context *pipe,
static void
-pstip_set_sampler_textures(struct pipe_context *pipe,
- unsigned num, struct pipe_texture **texture)
+pstip_set_sampler_views(struct pipe_context *pipe,
+ unsigned num,
+ struct pipe_sampler_view **views)
{
struct pstip_stage *pstip = pstip_stage_from_pipe(pipe);
uint i;
/* save current */
for (i = 0; i < num; i++) {
- pipe_texture_reference(&pstip->state.textures[i], texture[i]);
+ pipe_sampler_view_reference(&pstip->state.sampler_views[i], views[i]);
}
for (; i < PIPE_MAX_SAMPLERS; i++) {
- pipe_texture_reference(&pstip->state.textures[i], NULL);
+ pipe_sampler_view_reference(&pstip->state.sampler_views[i], NULL);
}
- pstip->num_textures = num;
+ pstip->num_sampler_views = num;
/* pass-through */
- pstip->driver_set_sampler_textures(pstip->pipe, num, texture);
+ pstip->driver_set_sampler_views(pstip->pipe, num, views);
}
@@ -754,7 +776,7 @@ draw_install_pstipple_stage(struct draw_context *draw,
pstip->driver_delete_fs_state = pipe->delete_fs_state;
pstip->driver_bind_sampler_states = pipe->bind_fragment_sampler_states;
- pstip->driver_set_sampler_textures = pipe->set_fragment_sampler_textures;
+ pstip->driver_set_sampler_views = pipe->set_fragment_sampler_views;
pstip->driver_set_polygon_stipple = pipe->set_polygon_stipple;
/* override the driver's functions */
@@ -763,7 +785,7 @@ draw_install_pstipple_stage(struct draw_context *draw,
pipe->delete_fs_state = pstip_delete_fs_state;
pipe->bind_fragment_sampler_states = pstip_bind_sampler_states;
- pipe->set_fragment_sampler_textures = pstip_set_sampler_textures;
+ pipe->set_fragment_sampler_views = pstip_set_sampler_views;
pipe->set_polygon_stipple = pstip_set_polygon_stipple;
return TRUE;
diff --git a/src/gallium/auxiliary/draw/draw_pipe_vbuf.c b/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
index 2709957961..1c7db0005a 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
@@ -238,38 +238,15 @@ vbuf_start_prim( struct vbuf_stage *vbuf, uint prim )
unsigned output_format;
unsigned src_offset = (vbuf->vinfo->attrib[i].src_index * 4 * sizeof(float) );
- switch (vbuf->vinfo->attrib[i].emit) {
- case EMIT_4F:
- output_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
- emit_sz = 4 * sizeof(float);
- break;
- case EMIT_3F:
- output_format = PIPE_FORMAT_R32G32B32_FLOAT;
- emit_sz = 3 * sizeof(float);
- break;
- case EMIT_2F:
- output_format = PIPE_FORMAT_R32G32_FLOAT;
- emit_sz = 2 * sizeof(float);
- break;
- case EMIT_1F:
- output_format = PIPE_FORMAT_R32_FLOAT;
- emit_sz = 1 * sizeof(float);
- break;
- case EMIT_1F_PSIZE:
- output_format = PIPE_FORMAT_R32_FLOAT;
- emit_sz = 1 * sizeof(float);
+ output_format = draw_translate_vinfo_format(vbuf->vinfo->attrib[i].emit);
+ emit_sz = draw_translate_vinfo_size(vbuf->vinfo->attrib[i].emit);
+
+ /* doesn't handle EMIT_OMIT */
+ assert(emit_sz != 0);
+
+ if (vbuf->vinfo->attrib[i].emit == EMIT_1F_PSIZE) {
src_buffer = 1;
src_offset = 0;
- break;
- case EMIT_4UB:
- output_format = PIPE_FORMAT_A8R8G8B8_UNORM;
- emit_sz = 4 * sizeof(ubyte);
- break;
- default:
- assert(0);
- output_format = PIPE_FORMAT_NONE;
- emit_sz = 0;
- break;
}
hw_key.element[i].type = TRANSLATE_ELEMENT_NORMAL;
diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c
index 6d90a6c42f..a8cdc57ad9 100644
--- a/src/gallium/auxiliary/draw/draw_pt.c
+++ b/src/gallium/auxiliary/draw/draw_pt.c
@@ -307,9 +307,8 @@ draw_arrays_instanced(struct draw_context *draw,
tgsi_dump(draw->vs.vertex_shader->state.tokens, 0);
debug_printf("Elements:\n");
for (i = 0; i < draw->pt.nr_vertex_elements; i++) {
- debug_printf(" format=%s comps=%u\n",
- util_format_name(draw->pt.vertex_element[i].src_format),
- draw->pt.vertex_element[i].nr_components);
+ debug_printf(" format=%s\n",
+ util_format_name(draw->pt.vertex_element[i].src_format));
}
debug_printf("Buffers:\n");
for (i = 0; i < draw->pt.nr_vertex_buffers; i++) {
diff --git a/src/gallium/auxiliary/draw/draw_pt_decompose.h b/src/gallium/auxiliary/draw/draw_pt_decompose.h
index 4ca5b52020..3c44f7c11e 100644
--- a/src/gallium/auxiliary/draw/draw_pt_decompose.h
+++ b/src/gallium/auxiliary/draw/draw_pt_decompose.h
@@ -105,40 +105,20 @@ static void FUNC( ARGS,
case PIPE_PRIM_QUADS:
- if (flatfirst) {
- for (i = 0; i+3 < count; i += 4) {
- QUAD( (i + 1),
- (i + 2),
- (i + 3),
- (i + 0) );
- }
- }
- else {
- for (i = 0; i+3 < count; i += 4) {
- QUAD( (i + 0),
- (i + 1),
- (i + 2),
- (i + 3));
- }
+ for (i = 0; i+3 < count; i += 4) {
+ QUAD( (i + 0),
+ (i + 1),
+ (i + 2),
+ (i + 3));
}
break;
case PIPE_PRIM_QUAD_STRIP:
- if (flatfirst) {
- for (i = 0; i+3 < count; i += 2) {
- QUAD( (i + 1),
- (i + 3),
- (i + 2),
- (i + 0) );
- }
- }
- else {
- for (i = 0; i+3 < count; i += 2) {
- QUAD( (i + 2),
- (i + 0),
- (i + 1),
- (i + 3));
- }
+ for (i = 0; i+3 < count; i += 2) {
+ QUAD( (i + 2),
+ (i + 0),
+ (i + 1),
+ (i + 3));
}
break;
diff --git a/src/gallium/auxiliary/draw/draw_pt_emit.c b/src/gallium/auxiliary/draw/draw_pt_emit.c
index ae357b5122..a7917f54b0 100644
--- a/src/gallium/auxiliary/draw/draw_pt_emit.c
+++ b/src/gallium/auxiliary/draw/draw_pt_emit.c
@@ -86,40 +86,15 @@ void draw_pt_emit_prepare( struct pt_emit *emit,
unsigned output_format;
unsigned src_offset = (vinfo->attrib[i].src_index * 4 * sizeof(float) );
+ output_format = draw_translate_vinfo_format(vinfo->attrib[i].emit);
+ emit_sz = draw_translate_vinfo_size(vinfo->attrib[i].emit);
-
- switch (vinfo->attrib[i].emit) {
- case EMIT_4F:
- output_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
- emit_sz = 4 * sizeof(float);
- break;
- case EMIT_3F:
- output_format = PIPE_FORMAT_R32G32B32_FLOAT;
- emit_sz = 3 * sizeof(float);
- break;
- case EMIT_2F:
- output_format = PIPE_FORMAT_R32G32_FLOAT;
- emit_sz = 2 * sizeof(float);
- break;
- case EMIT_1F:
- output_format = PIPE_FORMAT_R32_FLOAT;
- emit_sz = 1 * sizeof(float);
- break;
- case EMIT_1F_PSIZE:
- output_format = PIPE_FORMAT_R32_FLOAT;
- emit_sz = 1 * sizeof(float);
+ /* doesn't handle EMIT_OMIT */
+ assert(emit_sz != 0);
+
+ if (vinfo->attrib[i].emit == EMIT_1F_PSIZE) {
src_buffer = 1;
src_offset = 0;
- break;
- case EMIT_4UB:
- output_format = PIPE_FORMAT_A8R8G8B8_UNORM;
- emit_sz = 4 * sizeof(ubyte);
- break;
- default:
- assert(0);
- output_format = PIPE_FORMAT_NONE;
- emit_sz = 0;
- break;
}
hw_key.element[i].type = TRANSLATE_ELEMENT_NORMAL;
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c b/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
index 2a604470e9..1994ddf2bc 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
@@ -129,41 +129,16 @@ static void fetch_emit_prepare( struct draw_pt_middle_end *middle,
unsigned input_offset = src->src_offset;
unsigned output_format;
- switch (vinfo->attrib[i].emit) {
- case EMIT_4UB:
- output_format = PIPE_FORMAT_R8G8B8A8_UNORM;
- emit_sz = 4 * sizeof(unsigned char);
- break;
- case EMIT_4F:
- output_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
- emit_sz = 4 * sizeof(float);
- break;
- case EMIT_3F:
- output_format = PIPE_FORMAT_R32G32B32_FLOAT;
- emit_sz = 3 * sizeof(float);
- break;
- case EMIT_2F:
- output_format = PIPE_FORMAT_R32G32_FLOAT;
- emit_sz = 2 * sizeof(float);
- break;
- case EMIT_1F:
- output_format = PIPE_FORMAT_R32_FLOAT;
- emit_sz = 1 * sizeof(float);
- break;
- case EMIT_1F_PSIZE:
+ output_format = draw_translate_vinfo_format(vinfo->attrib[i].emit);
+ emit_sz = draw_translate_vinfo_size(vinfo->attrib[i].emit);
+
+ if (vinfo->attrib[i].emit == EMIT_OMIT)
+ continue;
+
+ if (vinfo->attrib[i].emit == EMIT_1F_PSIZE) {
input_format = PIPE_FORMAT_R32_FLOAT;
input_buffer = draw->pt.nr_vertex_buffers;
input_offset = 0;
- output_format = PIPE_FORMAT_R32_FLOAT;
- emit_sz = 1 * sizeof(float);
- break;
- case EMIT_OMIT:
- continue;
- default:
- assert(0);
- output_format = PIPE_FORMAT_NONE;
- emit_sz = 0;
- continue;
}
key.element[i].type = TRANSLATE_ELEMENT_NORMAL;
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
index 1aecb51077..389e2b105e 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
@@ -130,31 +130,10 @@ static void fse_prepare( struct draw_pt_middle_end *middle,
unsigned dst_offset = 0;
for (i = 0; i < vinfo->num_attribs; i++) {
- unsigned emit_sz = 0;
-
- switch (vinfo->attrib[i].emit) {
- case EMIT_4F:
- emit_sz = 4 * sizeof(float);
- break;
- case EMIT_3F:
- emit_sz = 3 * sizeof(float);
- break;
- case EMIT_2F:
- emit_sz = 2 * sizeof(float);
- break;
- case EMIT_1F:
- emit_sz = 1 * sizeof(float);
- break;
- case EMIT_1F_PSIZE:
- emit_sz = 1 * sizeof(float);
- break;
- case EMIT_4UB:
- emit_sz = 4 * sizeof(ubyte);
- break;
- default:
- assert(0);
- break;
- }
+ unsigned emit_sz = draw_translate_vinfo_size(vinfo->attrib[i].emit);
+
+ /* doesn't handle EMIT_OMIT */
+ assert(emit_sz != 0);
/* The elements in the key correspond to vertex shader output
* numbers, not to positions in the hw vertex description --
diff --git a/src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h b/src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h
index 62822a3d56..7cba8547f1 100644
--- a/src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h
+++ b/src/gallium/auxiliary/draw/draw_pt_vcache_tmp.h
@@ -118,39 +118,21 @@ static void FUNC( struct draw_pt_front_end *frontend,
case PIPE_PRIM_QUADS:
for (i = 0; i+3 < count; i += 4) {
- if (flatfirst) {
- QUAD( vcache,
- get_elt(elts, i + 0),
- get_elt(elts, i + 1),
- get_elt(elts, i + 2),
- get_elt(elts, i + 3) );
- }
- else {
- QUAD( vcache,
- get_elt(elts, i + 0),
- get_elt(elts, i + 1),
- get_elt(elts, i + 2),
- get_elt(elts, i + 3) );
- }
+ QUAD( vcache,
+ get_elt(elts, i + 0),
+ get_elt(elts, i + 1),
+ get_elt(elts, i + 2),
+ get_elt(elts, i + 3) );
}
break;
case PIPE_PRIM_QUAD_STRIP:
for (i = 0; i+3 < count; i += 2) {
- if (flatfirst) {
- QUAD( vcache,
- get_elt(elts, i + 0),
- get_elt(elts, i + 1),
- get_elt(elts, i + 3),
- get_elt(elts, i + 2) );
- }
- else {
- QUAD( vcache,
- get_elt(elts, i + 2),
- get_elt(elts, i + 0),
- get_elt(elts, i + 1),
- get_elt(elts, i + 3) );
- }
+ QUAD( vcache,
+ get_elt(elts, i + 2),
+ get_elt(elts, i + 0),
+ get_elt(elts, i + 1),
+ get_elt(elts, i + 3) );
}
break;
diff --git a/src/gallium/auxiliary/draw/draw_vertex.c b/src/gallium/auxiliary/draw/draw_vertex.c
index 3214213e44..a4f5e882c0 100644
--- a/src/gallium/auxiliary/draw/draw_vertex.c
+++ b/src/gallium/auxiliary/draw/draw_vertex.c
@@ -48,30 +48,12 @@ draw_compute_vertex_size(struct vertex_info *vinfo)
uint i;
vinfo->size = 0;
- for (i = 0; i < vinfo->num_attribs; i++) {
- switch (vinfo->attrib[i].emit) {
- case EMIT_OMIT:
- break;
- case EMIT_4UB:
- /* fall-through */
- case EMIT_1F_PSIZE:
- /* fall-through */
- case EMIT_1F:
- vinfo->size += 1;
- break;
- case EMIT_2F:
- vinfo->size += 2;
- break;
- case EMIT_3F:
- vinfo->size += 3;
- break;
- case EMIT_4F:
- vinfo->size += 4;
- break;
- default:
- assert(0);
- }
- }
+ for (i = 0; i < vinfo->num_attribs; i++)
+ vinfo->size += draw_translate_vinfo_size(vinfo->attrib[i].emit);
+
+ assert(vinfo->size % 4 == 0);
+ /* in dwords */
+ vinfo->size /= 4;
}
@@ -120,6 +102,13 @@ draw_dump_emitted_vertex(const struct vertex_info *vinfo, const uint8_t *data)
debug_printf("%u ", *data++);
debug_printf("%u ", *data++);
break;
+ case EMIT_4UB_BGRA:
+ debug_printf("EMIT_4UB_BGRA:\t");
+ debug_printf("%u ", *data++);
+ debug_printf("%u ", *data++);
+ debug_printf("%u ", *data++);
+ debug_printf("%u ", *data++);
+ break;
default:
assert(0);
}
diff --git a/src/gallium/auxiliary/draw/draw_vertex.h b/src/gallium/auxiliary/draw/draw_vertex.h
index 8c3c7befbc..ca27237126 100644
--- a/src/gallium/auxiliary/draw/draw_vertex.h
+++ b/src/gallium/auxiliary/draw/draw_vertex.h
@@ -54,7 +54,8 @@ enum attrib_emit {
EMIT_2F,
EMIT_3F,
EMIT_4F,
- EMIT_4UB /**< XXX may need variations for RGBA vs BGRA, etc */
+ EMIT_4UB, /**< is RGBA like the rest */
+ EMIT_4UB_BGRA
};
@@ -141,9 +142,11 @@ void draw_dump_emitted_vertex(const struct vertex_info *vinfo,
const uint8_t *data);
-static INLINE unsigned draw_translate_vinfo_format(unsigned format )
+static INLINE unsigned draw_translate_vinfo_format(enum attrib_emit emit)
{
- switch (format) {
+ switch (emit) {
+ case EMIT_OMIT:
+ return PIPE_FORMAT_NONE;
case EMIT_1F:
case EMIT_1F_PSIZE:
return PIPE_FORMAT_R32_FLOAT;
@@ -155,10 +158,36 @@ static INLINE unsigned draw_translate_vinfo_format(unsigned format )
return PIPE_FORMAT_R32G32B32A32_FLOAT;
case EMIT_4UB:
return PIPE_FORMAT_R8G8B8A8_UNORM;
+ case EMIT_4UB_BGRA:
+ return PIPE_FORMAT_B8G8R8A8_UNORM;
default:
+ assert(!"unexpected format");
return PIPE_FORMAT_NONE;
}
}
+static INLINE unsigned draw_translate_vinfo_size(enum attrib_emit emit)
+{
+ switch (emit) {
+ case EMIT_OMIT:
+ return 0;
+ case EMIT_1F:
+ case EMIT_1F_PSIZE:
+ return 1 * sizeof(float);
+ case EMIT_2F:
+ return 2 * sizeof(float);
+ case EMIT_3F:
+ return 3 * sizeof(float);
+ case EMIT_4F:
+ return 4 * sizeof(float);
+ case EMIT_4UB:
+ return 4 * sizeof(unsigned char);
+ case EMIT_4UB_BGRA:
+ return 4 * sizeof(unsigned char);
+ default:
+ assert(!"unexpected format");
+ return 0;
+ }
+}
#endif /* DRAW_VERTEX_H */
diff --git a/src/gallium/auxiliary/draw/draw_vs_aos_io.c b/src/gallium/auxiliary/draw/draw_vs_aos_io.c
index ece1ddde0c..8f8bbe7cb8 100644
--- a/src/gallium/auxiliary/draw/draw_vs_aos_io.c
+++ b/src/gallium/auxiliary/draw/draw_vs_aos_io.c
@@ -401,13 +401,11 @@ static boolean emit_output( struct aos_compilation *cp,
emit_store_R32G32B32A32(cp, ptr, dataXMM);
break;
case EMIT_4UB:
- if (1) {
- emit_swizzle(cp, dataXMM, dataXMM, SHUF(Z,Y,X,W));
- emit_store_R8G8B8A8_UNORM(cp, ptr, dataXMM);
- }
- else {
- emit_store_R8G8B8A8_UNORM(cp, ptr, dataXMM);
- }
+ emit_store_R8G8B8A8_UNORM(cp, ptr, dataXMM);
+ break;
+ case EMIT_4UB_BGRA:
+ emit_swizzle(cp, dataXMM, dataXMM, SHUF(Z,Y,X,W));
+ emit_store_R8G8B8A8_UNORM(cp, ptr, dataXMM);
break;
default:
AOS_ERROR(cp, "unhandled output format");
diff --git a/src/gallium/auxiliary/gallivm/lp_bld.h b/src/gallium/auxiliary/gallivm/lp_bld.h
new file mode 100644
index 0000000000..70a4960f91
--- /dev/null
+++ b/src/gallium/auxiliary/gallivm/lp_bld.h
@@ -0,0 +1,47 @@
+/**************************************************************************
+ *
+ * Copyright 2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+/**
+ * @file
+ * Wrapper for LLVM header file #includes.
+ */
+
+
+#ifndef LP_BLD_H
+#define LP_BLD_H
+
+
+#include <llvm-c/Core.h>
+
+
+/** Set version to 0 if missing to avoid #ifdef HAVE_LLVM everywhere */
+#ifndef HAVE_LLVM
+#define HAVE_LLVM 0x0207
+#endif
+
+
+#endif /* LP_BLD_H */
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_alpha.h b/src/gallium/auxiliary/gallivm/lp_bld_alpha.h
index 634575670d..0f99fec65e 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_alpha.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_alpha.h
@@ -35,7 +35,7 @@
#define LP_BLD_ALPHA_H
-#include <llvm-c/Core.h>
+#include "gallivm/lp_bld.h"
struct pipe_alpha_state;
struct lp_type;
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
index 32f9e5201c..8e8fcccf56 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
@@ -232,6 +232,37 @@ lp_build_add(struct lp_build_context *bld,
}
+/** Return the sum of the elements of a */
+LLVMValueRef
+lp_build_sum_vector(struct lp_build_context *bld,
+ LLVMValueRef a)
+{
+ const struct lp_type type = bld->type;
+ LLVMValueRef index, res;
+ int i;
+
+ if (a == bld->zero)
+ return bld->zero;
+ if (a == bld->undef)
+ return bld->undef;
+ assert(type.length > 1);
+
+ assert(!bld->type.norm);
+
+ index = LLVMConstInt(LLVMInt32Type(), 0, 0);
+ res = LLVMBuildExtractElement(bld->builder, a, index, "");
+
+ for (i = 1; i < type.length; i++) {
+ index = LLVMConstInt(LLVMInt32Type(), i, 0);
+ res = LLVMBuildAdd(bld->builder, res,
+ LLVMBuildExtractElement(bld->builder, a, index, ""),
+ "");
+ }
+
+ return res;
+}
+
+
/**
* Generate a - b
*/
@@ -330,12 +361,12 @@ lp_build_mul_u8n(LLVMBuilderRef builder,
LLVMValueRef c8;
LLVMValueRef ab;
- c8 = lp_build_int_const_scalar(i16_type, 8);
+ c8 = lp_build_const_int_vec(i16_type, 8);
#if 0
/* a*b/255 ~= (a*(b + 1)) >> 256 */
- b = LLVMBuildAdd(builder, b, lp_build_int_const_scalar(i16_type, 1), "");
+ b = LLVMBuildAdd(builder, b, lp_build_const_int_vec(i16_type, 1), "");
ab = LLVMBuildMul(builder, a, b, "");
#else
@@ -343,7 +374,7 @@ lp_build_mul_u8n(LLVMBuilderRef builder,
/* ab/255 ~= (ab + (ab >> 8) + 0x80) >> 8 */
ab = LLVMBuildMul(builder, a, b, "");
ab = LLVMBuildAdd(builder, ab, LLVMBuildLShr(builder, ab, c8, ""), "");
- ab = LLVMBuildAdd(builder, ab, lp_build_int_const_scalar(i16_type, 0x80), "");
+ ab = LLVMBuildAdd(builder, ab, lp_build_const_int_vec(i16_type, 0x80), "");
#endif
@@ -398,7 +429,7 @@ lp_build_mul(struct lp_build_context *bld,
}
if(type.fixed)
- shift = lp_build_int_const_scalar(type, type.width/2);
+ shift = lp_build_const_int_vec(type, type.width/2);
else
shift = NULL;
@@ -460,7 +491,7 @@ lp_build_mul_imm(struct lp_build_context *bld,
* for Inf and NaN.
*/
unsigned mantissa = lp_mantissa(bld->type);
- factor = lp_build_int_const_scalar(bld->type, (unsigned long long)shift << mantissa);
+ factor = lp_build_const_int_vec(bld->type, (unsigned long long)shift << mantissa);
a = LLVMBuildBitCast(bld->builder, a, lp_build_int_vec_type(bld->type), "");
a = LLVMBuildAdd(bld->builder, a, factor, "");
a = LLVMBuildBitCast(bld->builder, a, lp_build_vec_type(bld->type), "");
@@ -468,12 +499,12 @@ lp_build_mul_imm(struct lp_build_context *bld,
#endif
}
else {
- factor = lp_build_const_scalar(bld->type, shift);
+ factor = lp_build_const_vec(bld->type, shift);
return LLVMBuildShl(bld->builder, a, factor, "");
}
}
- factor = lp_build_const_scalar(bld->type, (double)b);
+ factor = lp_build_const_vec(bld->type, (double)b);
return lp_build_mul(bld, a, factor);
}
@@ -536,7 +567,7 @@ lp_build_lerp(struct lp_build_context *bld,
* but it will be wrong for other uses. Basically we need a more
* powerful lp_type, capable of further distinguishing the values
* interpretation from the value storage. */
- res = LLVMBuildAnd(bld->builder, res, lp_build_int_const_scalar(bld->type, (1 << bld->type.width/2) - 1), "");
+ res = LLVMBuildAnd(bld->builder, res, lp_build_const_int_vec(bld->type, (1 << bld->type.width/2) - 1), "");
return res;
}
@@ -644,13 +675,26 @@ lp_build_abs(struct lp_build_context *bld,
if(type.floating) {
/* Mask out the sign bit */
- LLVMTypeRef int_vec_type = lp_build_int_vec_type(type);
- unsigned long long absMask = ~(1ULL << (type.width - 1));
- LLVMValueRef mask = lp_build_int_const_scalar(type, ((unsigned long long) absMask));
- a = LLVMBuildBitCast(bld->builder, a, int_vec_type, "");
- a = LLVMBuildAnd(bld->builder, a, mask, "");
- a = LLVMBuildBitCast(bld->builder, a, vec_type, "");
- return a;
+ if (type.length == 1) {
+ LLVMTypeRef int_type = LLVMIntType(type.width);
+ LLVMTypeRef float_type = LLVMFloatType();
+ unsigned long long absMask = ~(1ULL << (type.width - 1));
+ LLVMValueRef mask = LLVMConstInt(int_type, absMask, 0);
+ a = LLVMBuildBitCast(bld->builder, a, int_type, "");
+ a = LLVMBuildAnd(bld->builder, a, mask, "");
+ a = LLVMBuildBitCast(bld->builder, a, float_type, "");
+ return a;
+ }
+ else {
+ /* vector of floats */
+ LLVMTypeRef int_vec_type = lp_build_int_vec_type(type);
+ unsigned long long absMask = ~(1ULL << (type.width - 1));
+ LLVMValueRef mask = lp_build_const_int_vec(type, ((unsigned long long) absMask));
+ a = LLVMBuildBitCast(bld->builder, a, int_vec_type, "");
+ a = LLVMBuildAnd(bld->builder, a, mask, "");
+ a = LLVMBuildBitCast(bld->builder, a, vec_type, "");
+ return a;
+ }
}
if(type.width*type.length == 128 && util_cpu_caps.has_ssse3) {
@@ -676,12 +720,12 @@ lp_build_negate(struct lp_build_context *bld,
}
+/** Return -1, 0 or +1 depending on the sign of a */
LLVMValueRef
lp_build_sgn(struct lp_build_context *bld,
LLVMValueRef a)
{
const struct lp_type type = bld->type;
- LLVMTypeRef vec_type = lp_build_vec_type(type);
LLVMValueRef cond;
LLVMValueRef res;
@@ -691,27 +735,42 @@ lp_build_sgn(struct lp_build_context *bld,
res = bld->one;
}
else if(type.floating) {
- /* Take the sign bit and add it to 1 constant */
- LLVMTypeRef int_vec_type = lp_build_int_vec_type(type);
- LLVMValueRef mask = lp_build_int_const_scalar(type, (unsigned long long)1 << (type.width - 1));
+ LLVMTypeRef vec_type;
+ LLVMTypeRef int_type;
+ LLVMValueRef mask;
LLVMValueRef sign;
LLVMValueRef one;
- sign = LLVMBuildBitCast(bld->builder, a, int_vec_type, "");
+ unsigned long long maskBit = (unsigned long long)1 << (type.width - 1);
+
+ if (type.length == 1) {
+ int_type = lp_build_int_elem_type(type);
+ vec_type = lp_build_elem_type(type);
+ mask = LLVMConstInt(int_type, maskBit, 0);
+ }
+ else {
+ /* vector */
+ int_type = lp_build_int_vec_type(type);
+ vec_type = lp_build_vec_type(type);
+ mask = lp_build_const_int_vec(type, maskBit);
+ }
+
+ /* Take the sign bit and add it to 1 constant */
+ sign = LLVMBuildBitCast(bld->builder, a, int_type, "");
sign = LLVMBuildAnd(bld->builder, sign, mask, "");
- one = LLVMConstBitCast(bld->one, int_vec_type);
+ one = LLVMConstBitCast(bld->one, int_type);
res = LLVMBuildOr(bld->builder, sign, one, "");
res = LLVMBuildBitCast(bld->builder, res, vec_type, "");
}
else
{
- LLVMValueRef minus_one = lp_build_const_scalar(type, -1.0);
+ LLVMValueRef minus_one = lp_build_const_vec(type, -1.0);
cond = lp_build_cmp(bld, PIPE_FUNC_GREATER, a, bld->zero);
res = lp_build_select(bld, cond, bld->one, minus_one);
}
/* Handle zero */
cond = lp_build_cmp(bld, PIPE_FUNC_EQUAL, a, bld->zero);
- res = lp_build_select(bld, cond, bld->zero, bld->one);
+ res = lp_build_select(bld, cond, bld->zero, res);
return res;
}
@@ -730,8 +789,8 @@ lp_build_set_sign(struct lp_build_context *bld,
const struct lp_type type = bld->type;
LLVMTypeRef int_vec_type = lp_build_int_vec_type(type);
LLVMTypeRef vec_type = lp_build_vec_type(type);
- LLVMValueRef shift = lp_build_int_const_scalar(type, type.width - 1);
- LLVMValueRef mask = lp_build_int_const_scalar(type,
+ LLVMValueRef shift = lp_build_const_int_vec(type, type.width - 1);
+ LLVMValueRef mask = lp_build_const_int_vec(type,
~((unsigned long long) 1 << (type.width - 1)));
LLVMValueRef val, res;
@@ -753,7 +812,7 @@ lp_build_set_sign(struct lp_build_context *bld,
/**
- * Convert vector of int to vector of float.
+ * Convert vector of (or scalar) int to vector of (or scalar) float.
*/
LLVMValueRef
lp_build_int_to_float(struct lp_build_context *bld,
@@ -764,7 +823,11 @@ lp_build_int_to_float(struct lp_build_context *bld,
assert(type.floating);
/*assert(lp_check_value(type, a));*/
- {
+ if (type.length == 1) {
+ LLVMTypeRef float_type = LLVMFloatType();
+ return LLVMBuildSIToFP(bld->builder, a, float_type, "");
+ }
+ else {
LLVMTypeRef vec_type = lp_build_vec_type(type);
/*LLVMTypeRef int_vec_type = lp_build_int_vec_type(type);*/
LLVMValueRef res;
@@ -866,6 +929,13 @@ lp_build_floor(struct lp_build_context *bld,
assert(type.floating);
+ if (type.length == 1) {
+ LLVMValueRef res;
+ res = lp_build_ifloor(bld, a);
+ res = LLVMBuildSIToFP(bld->builder, res, LLVMFloatType(), "");
+ return res;
+ }
+
if(util_cpu_caps.has_sse4_1)
return lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_FLOOR);
else {
@@ -921,15 +991,24 @@ lp_build_itrunc(struct lp_build_context *bld,
LLVMValueRef a)
{
const struct lp_type type = bld->type;
- LLVMTypeRef int_vec_type = lp_build_int_vec_type(type);
assert(type.floating);
- assert(lp_check_value(type, a));
- return LLVMBuildFPToSI(bld->builder, a, int_vec_type, "");
+ if (type.length == 1) {
+ LLVMTypeRef int_type = LLVMIntType(type.width);
+ return LLVMBuildFPToSI(bld->builder, a, int_type, "");
+ }
+ else {
+ LLVMTypeRef int_vec_type = lp_build_int_vec_type(type);
+ assert(lp_check_value(type, a));
+ return LLVMBuildFPToSI(bld->builder, a, int_vec_type, "");
+ }
}
+/**
+ * Convert float[] to int[] with round().
+ */
LLVMValueRef
lp_build_iround(struct lp_build_context *bld,
LLVMValueRef a)
@@ -939,6 +1018,15 @@ lp_build_iround(struct lp_build_context *bld,
LLVMValueRef res;
assert(type.floating);
+
+ if (type.length == 1) {
+ /* scalar float to int */
+ LLVMTypeRef int_type = LLVMIntType(type.width);
+ /* XXX we want rounding here! */
+ res = LLVMBuildFPToSI(bld->builder, a, int_type, "");
+ return res;
+ }
+
assert(lp_check_value(type, a));
if(util_cpu_caps.has_sse4_1) {
@@ -946,7 +1034,7 @@ lp_build_iround(struct lp_build_context *bld,
}
else {
LLVMTypeRef vec_type = lp_build_vec_type(type);
- LLVMValueRef mask = lp_build_int_const_scalar(type, (unsigned long long)1 << (type.width - 1));
+ LLVMValueRef mask = lp_build_const_int_vec(type, (unsigned long long)1 << (type.width - 1));
LLVMValueRef sign;
LLVMValueRef half;
@@ -955,7 +1043,7 @@ lp_build_iround(struct lp_build_context *bld,
sign = LLVMBuildAnd(bld->builder, sign, mask, "");
/* sign * 0.5 */
- half = lp_build_const_scalar(type, 0.5);
+ half = lp_build_const_vec(type, 0.5);
half = LLVMBuildBitCast(bld->builder, half, int_vec_type, "");
half = LLVMBuildOr(bld->builder, sign, half, "");
half = LLVMBuildBitCast(bld->builder, half, vec_type, "");
@@ -981,6 +1069,14 @@ lp_build_ifloor(struct lp_build_context *bld,
LLVMValueRef res;
assert(type.floating);
+
+ if (type.length == 1) {
+ /* scalar float to int */
+ LLVMTypeRef int_type = LLVMIntType(type.width);
+ res = LLVMBuildFPToSI(bld->builder, a, int_type, "");
+ return res;
+ }
+
assert(lp_check_value(type, a));
if(util_cpu_caps.has_sse4_1) {
@@ -990,18 +1086,18 @@ lp_build_ifloor(struct lp_build_context *bld,
/* Take the sign bit and add it to 1 constant */
LLVMTypeRef vec_type = lp_build_vec_type(type);
unsigned mantissa = lp_mantissa(type);
- LLVMValueRef mask = lp_build_int_const_scalar(type, (unsigned long long)1 << (type.width - 1));
+ LLVMValueRef mask = lp_build_const_int_vec(type, (unsigned long long)1 << (type.width - 1));
LLVMValueRef sign;
LLVMValueRef offset;
/* sign = a < 0 ? ~0 : 0 */
sign = LLVMBuildBitCast(bld->builder, a, int_vec_type, "");
sign = LLVMBuildAnd(bld->builder, sign, mask, "");
- sign = LLVMBuildAShr(bld->builder, sign, lp_build_int_const_scalar(type, type.width - 1), "");
+ sign = LLVMBuildAShr(bld->builder, sign, lp_build_const_int_vec(type, type.width - 1), "");
lp_build_name(sign, "floor.sign");
/* offset = -0.99999(9)f */
- offset = lp_build_const_scalar(type, -(double)(((unsigned long long)1 << mantissa) - 1)/((unsigned long long)1 << mantissa));
+ offset = lp_build_const_vec(type, -(double)(((unsigned long long)1 << mantissa) - 1)/((unsigned long long)1 << mantissa));
offset = LLVMConstBitCast(offset, int_vec_type);
/* offset = a < 0 ? -0.99999(9)f : 0.0f */
@@ -1172,7 +1268,7 @@ lp_build_exp(struct lp_build_context *bld,
LLVMValueRef x)
{
/* log2(e) = 1/log(2) */
- LLVMValueRef log2e = lp_build_const_scalar(bld->type, 1.4426950408889634);
+ LLVMValueRef log2e = lp_build_const_vec(bld->type, 1.4426950408889634);
return lp_build_mul(bld, log2e, lp_build_exp2(bld, x));
}
@@ -1186,7 +1282,7 @@ lp_build_log(struct lp_build_context *bld,
LLVMValueRef x)
{
/* log(2) */
- LLVMValueRef log2 = lp_build_const_scalar(bld->type, 0.69314718055994529);
+ LLVMValueRef log2 = lp_build_const_vec(bld->type, 0.69314718055994529);
return lp_build_mul(bld, log2, lp_build_exp2(bld, x));
}
@@ -1207,6 +1303,7 @@ lp_build_polynomial(struct lp_build_context *bld,
unsigned num_coeffs)
{
const struct lp_type type = bld->type;
+ LLVMTypeRef float_type = LLVMFloatType();
LLVMValueRef res = NULL;
unsigned i;
@@ -1216,7 +1313,13 @@ lp_build_polynomial(struct lp_build_context *bld,
__FUNCTION__);
for (i = num_coeffs; i--; ) {
- LLVMValueRef coeff = lp_build_const_scalar(type, coeffs[i]);
+ LLVMValueRef coeff;
+
+ if (type.length == 1)
+ coeff = LLVMConstReal(float_type, coeffs[i]);
+ else
+ coeff = lp_build_const_vec(type, coeffs[i]);
+
if(res)
res = lp_build_add(bld, coeff, lp_build_mul(bld, x, res));
else
@@ -1272,11 +1375,11 @@ lp_build_exp2_approx(struct lp_build_context *bld,
assert(type.floating && type.width == 32);
- x = lp_build_min(bld, x, lp_build_const_scalar(type, 129.0));
- x = lp_build_max(bld, x, lp_build_const_scalar(type, -126.99999));
+ x = lp_build_min(bld, x, lp_build_const_vec(type, 129.0));
+ x = lp_build_max(bld, x, lp_build_const_vec(type, -126.99999));
/* ipart = int(x - 0.5) */
- ipart = LLVMBuildSub(bld->builder, x, lp_build_const_scalar(type, 0.5f), "");
+ ipart = LLVMBuildSub(bld->builder, x, lp_build_const_vec(type, 0.5f), "");
ipart = LLVMBuildFPToSI(bld->builder, ipart, int_vec_type, "");
/* fpart = x - ipart */
@@ -1286,8 +1389,8 @@ lp_build_exp2_approx(struct lp_build_context *bld,
if(p_exp2_int_part || p_exp2) {
/* expipart = (float) (1 << ipart) */
- expipart = LLVMBuildAdd(bld->builder, ipart, lp_build_int_const_scalar(type, 127), "");
- expipart = LLVMBuildShl(bld->builder, expipart, lp_build_int_const_scalar(type, 23), "");
+ expipart = LLVMBuildAdd(bld->builder, ipart, lp_build_const_int_vec(type, 127), "");
+ expipart = LLVMBuildShl(bld->builder, expipart, lp_build_const_int_vec(type, 23), "");
expipart = LLVMBuildBitCast(bld->builder, expipart, vec_type, "");
}
@@ -1353,8 +1456,8 @@ lp_build_log2_approx(struct lp_build_context *bld,
LLVMTypeRef vec_type = lp_build_vec_type(type);
LLVMTypeRef int_vec_type = lp_build_int_vec_type(type);
- LLVMValueRef expmask = lp_build_int_const_scalar(type, 0x7f800000);
- LLVMValueRef mantmask = lp_build_int_const_scalar(type, 0x007fffff);
+ LLVMValueRef expmask = lp_build_const_int_vec(type, 0x7f800000);
+ LLVMValueRef mantmask = lp_build_const_int_vec(type, 0x007fffff);
LLVMValueRef one = LLVMConstBitCast(bld->one, int_vec_type);
LLVMValueRef i = NULL;
@@ -1379,8 +1482,8 @@ lp_build_log2_approx(struct lp_build_context *bld,
}
if(p_floor_log2 || p_log2) {
- logexp = LLVMBuildLShr(bld->builder, exp, lp_build_int_const_scalar(type, 23), "");
- logexp = LLVMBuildSub(bld->builder, logexp, lp_build_int_const_scalar(type, 127), "");
+ logexp = LLVMBuildLShr(bld->builder, exp, lp_build_const_int_vec(type, 23), "");
+ logexp = LLVMBuildSub(bld->builder, logexp, lp_build_const_int_vec(type, 127), "");
logexp = LLVMBuildSIToFP(bld->builder, logexp, vec_type, "");
}
@@ -1410,11 +1513,87 @@ lp_build_log2_approx(struct lp_build_context *bld,
}
+/** scalar version of above function */
+static void
+lp_build_float_log2_approx(struct lp_build_context *bld,
+ LLVMValueRef x,
+ LLVMValueRef *p_exp,
+ LLVMValueRef *p_floor_log2,
+ LLVMValueRef *p_log2)
+{
+ const struct lp_type type = bld->type;
+ LLVMTypeRef float_type = LLVMFloatType();
+ LLVMTypeRef int_type = LLVMIntType(type.width);
+
+ LLVMValueRef expmask = LLVMConstInt(int_type, 0x7f800000, 0);
+ LLVMValueRef mantmask = LLVMConstInt(int_type, 0x007fffff, 0);
+ LLVMValueRef one = LLVMConstBitCast(bld->one, int_type);
+
+ LLVMValueRef i = NULL;
+ LLVMValueRef exp = NULL;
+ LLVMValueRef mant = NULL;
+ LLVMValueRef logexp = NULL;
+ LLVMValueRef logmant = NULL;
+ LLVMValueRef res = NULL;
+
+ if(p_exp || p_floor_log2 || p_log2) {
+ /* TODO: optimize the constant case */
+ if(LLVMIsConstant(x))
+ debug_printf("%s: inefficient/imprecise constant arithmetic\n",
+ __FUNCTION__);
+
+ assert(type.floating && type.width == 32);
+
+ i = LLVMBuildBitCast(bld->builder, x, int_type, "");
+
+ /* exp = (float) exponent(x) */
+ exp = LLVMBuildAnd(bld->builder, i, expmask, "");
+ }
+
+ if(p_floor_log2 || p_log2) {
+ LLVMValueRef c23 = LLVMConstInt(int_type, 23, 0);
+ LLVMValueRef c127 = LLVMConstInt(int_type, 127, 0);
+ logexp = LLVMBuildLShr(bld->builder, exp, c23, "");
+ logexp = LLVMBuildSub(bld->builder, logexp, c127, "");
+ logexp = LLVMBuildSIToFP(bld->builder, logexp, float_type, "");
+ }
+
+ if(p_log2) {
+ /* mant = (float) mantissa(x) */
+ mant = LLVMBuildAnd(bld->builder, i, mantmask, "");
+ mant = LLVMBuildOr(bld->builder, mant, one, "");
+ mant = LLVMBuildBitCast(bld->builder, mant, float_type, "");
+
+ logmant = lp_build_polynomial(bld, mant, lp_build_log2_polynomial,
+ Elements(lp_build_log2_polynomial));
+
+ /* This effectively increases the polynomial degree by one, but ensures that log2(1) == 0*/
+ logmant = LLVMBuildMul(bld->builder, logmant, LLVMBuildSub(bld->builder, mant, bld->one, ""), "");
+
+ res = LLVMBuildAdd(bld->builder, logmant, logexp, "");
+ }
+
+ if(p_exp)
+ *p_exp = exp;
+
+ if(p_floor_log2)
+ *p_floor_log2 = logexp;
+
+ if(p_log2)
+ *p_log2 = res;
+}
+
+
LLVMValueRef
lp_build_log2(struct lp_build_context *bld,
LLVMValueRef x)
{
LLVMValueRef res;
- lp_build_log2_approx(bld, x, NULL, NULL, &res);
+ if (bld->type.length == 1) {
+ lp_build_float_log2_approx(bld, x, NULL, NULL, &res);
+ }
+ else {
+ lp_build_log2_approx(bld, x, NULL, NULL, &res);
+ }
return res;
}
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.h b/src/gallium/auxiliary/gallivm/lp_bld_arit.h
index 55385e3a66..31efa9921c 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_arit.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.h
@@ -37,7 +37,7 @@
#define LP_BLD_ARIT_H
-#include <llvm-c/Core.h>
+#include "gallivm/lp_bld.h"
struct lp_type;
@@ -57,6 +57,10 @@ lp_build_add(struct lp_build_context *bld,
LLVMValueRef b);
LLVMValueRef
+lp_build_sum_vector(struct lp_build_context *bld,
+ LLVMValueRef a);
+
+LLVMValueRef
lp_build_sub(struct lp_build_context *bld,
LLVMValueRef a,
LLVMValueRef b);
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_blend.h b/src/gallium/auxiliary/gallivm/lp_bld_blend.h
index da272e549f..ebbdb1a604 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_blend.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_blend.h
@@ -40,7 +40,7 @@
* for a standalone example.
*/
-#include <llvm-c/Core.h>
+#include "gallivm/lp_bld.h"
#include "pipe/p_format.h"
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_const.c b/src/gallium/auxiliary/gallivm/lp_bld_const.c
index c8eaa8c394..57843e9a60 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_const.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_const.c
@@ -221,8 +221,16 @@ lp_build_undef(struct lp_type type)
LLVMValueRef
lp_build_zero(struct lp_type type)
{
- LLVMTypeRef vec_type = lp_build_vec_type(type);
- return LLVMConstNull(vec_type);
+ if (type.length == 1) {
+ if (type.floating)
+ return LLVMConstReal(LLVMFloatType(), 0.0);
+ else
+ return LLVMConstInt(LLVMIntType(type.width), 0, 0);
+ }
+ else {
+ LLVMTypeRef vec_type = lp_build_vec_type(type);
+ return LLVMConstNull(vec_type);
+ }
}
@@ -255,7 +263,7 @@ lp_build_one(struct lp_type type)
if(type.sign)
/* TODO: Unfortunately this caused "Tried to create a shift operation
* on a non-integer type!" */
- vec = LLVMConstLShr(vec, lp_build_int_const_scalar(type, 1));
+ vec = LLVMConstLShr(vec, lp_build_const_int_vec(type, 1));
#endif
return vec;
@@ -264,13 +272,19 @@ lp_build_one(struct lp_type type)
for(i = 1; i < type.length; ++i)
elems[i] = elems[0];
- return LLVMConstVector(elems, type.length);
+ if (type.length == 1)
+ return elems[0];
+ else
+ return LLVMConstVector(elems, type.length);
}
+/**
+ * Build constant-valued vector from a scalar value.
+ */
LLVMValueRef
-lp_build_const_scalar(struct lp_type type,
- double val)
+lp_build_const_vec(struct lp_type type,
+ double val)
{
LLVMTypeRef elem_type = lp_build_elem_type(type);
LLVMValueRef elems[LP_MAX_VECTOR_LENGTH];
@@ -295,7 +309,7 @@ lp_build_const_scalar(struct lp_type type,
LLVMValueRef
-lp_build_int_const_scalar(struct lp_type type,
+lp_build_const_int_vec(struct lp_type type,
long long val)
{
LLVMTypeRef elem_type = lp_build_int_elem_type(type);
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_const.h b/src/gallium/auxiliary/gallivm/lp_bld_const.h
index cb8e1c7b00..9ca2f0664e 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_const.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_const.h
@@ -37,9 +37,9 @@
#define LP_BLD_CONST_H
-#include <llvm-c/Core.h>
+#include "pipe/p_compiler.h"
+#include "gallivm/lp_bld.h"
-#include <pipe/p_compiler.h>
struct lp_type;
@@ -85,13 +85,11 @@ lp_build_one(struct lp_type type);
LLVMValueRef
-lp_build_const_scalar(struct lp_type type,
- double val);
+lp_build_const_vec(struct lp_type type, double val);
LLVMValueRef
-lp_build_int_const_scalar(struct lp_type type,
- long long val);
+lp_build_const_int_vec(struct lp_type type, long long val);
LLVMValueRef
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_conv.c b/src/gallium/auxiliary/gallivm/lp_bld_conv.c
index f77cf78721..3f7f2ebde9 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_conv.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_conv.c
@@ -114,13 +114,13 @@ lp_build_clamped_float_to_unsigned_norm(LLVMBuilderRef builder,
scale = (double)mask/ubound;
bias = (double)((unsigned long long)1 << (mantissa - n));
- res = LLVMBuildMul(builder, src, lp_build_const_scalar(src_type, scale), "");
- res = LLVMBuildAdd(builder, res, lp_build_const_scalar(src_type, bias), "");
+ res = LLVMBuildMul(builder, src, lp_build_const_vec(src_type, scale), "");
+ res = LLVMBuildAdd(builder, res, lp_build_const_vec(src_type, bias), "");
res = LLVMBuildBitCast(builder, res, int_vec_type, "");
if(dst_width > n) {
int shift = dst_width - n;
- res = LLVMBuildShl(builder, res, lp_build_int_const_scalar(src_type, shift), "");
+ res = LLVMBuildShl(builder, res, lp_build_const_int_vec(src_type, shift), "");
/* TODO: Fill in the empty lower bits for additional precision? */
/* YES: this fixes progs/trivial/tri-z-eq.c.
@@ -130,21 +130,21 @@ lp_build_clamped_float_to_unsigned_norm(LLVMBuilderRef builder,
#if 0
{
LLVMValueRef msb;
- msb = LLVMBuildLShr(builder, res, lp_build_int_const_scalar(src_type, dst_width - 1), "");
- msb = LLVMBuildShl(builder, msb, lp_build_int_const_scalar(src_type, shift), "");
- msb = LLVMBuildSub(builder, msb, lp_build_int_const_scalar(src_type, 1), "");
+ msb = LLVMBuildLShr(builder, res, lp_build_const_int_vec(src_type, dst_width - 1), "");
+ msb = LLVMBuildShl(builder, msb, lp_build_const_int_vec(src_type, shift), "");
+ msb = LLVMBuildSub(builder, msb, lp_build_const_int_vec(src_type, 1), "");
res = LLVMBuildOr(builder, res, msb, "");
}
#elif 0
while(shift > 0) {
- res = LLVMBuildOr(builder, res, LLVMBuildLShr(builder, res, lp_build_int_const_scalar(src_type, n), ""), "");
+ res = LLVMBuildOr(builder, res, LLVMBuildLShr(builder, res, lp_build_const_int_vec(src_type, n), ""), "");
shift -= n;
n *= 2;
}
#endif
}
else
- res = LLVMBuildAnd(builder, res, lp_build_int_const_scalar(src_type, mask), "");
+ res = LLVMBuildAnd(builder, res, lp_build_const_int_vec(src_type, mask), "");
return res;
}
@@ -183,10 +183,10 @@ lp_build_unsigned_norm_to_float(LLVMBuilderRef builder,
if(src_width > mantissa) {
int shift = src_width - mantissa;
- res = LLVMBuildLShr(builder, res, lp_build_int_const_scalar(dst_type, shift), "");
+ res = LLVMBuildLShr(builder, res, lp_build_const_int_vec(dst_type, shift), "");
}
- bias_ = lp_build_const_scalar(dst_type, bias);
+ bias_ = lp_build_const_vec(dst_type, bias);
res = LLVMBuildOr(builder,
res,
@@ -195,7 +195,7 @@ lp_build_unsigned_norm_to_float(LLVMBuilderRef builder,
res = LLVMBuildBitCast(builder, res, vec_type, "");
res = LLVMBuildSub(builder, res, bias_, "");
- res = LLVMBuildMul(builder, res, lp_build_const_scalar(dst_type, scale), "");
+ res = LLVMBuildMul(builder, res, lp_build_const_vec(dst_type, scale), "");
return res;
}
@@ -251,7 +251,7 @@ lp_build_conv(LLVMBuilderRef builder,
if(dst_min == 0.0)
thres = bld.zero;
else
- thres = lp_build_const_scalar(src_type, dst_min);
+ thres = lp_build_const_vec(src_type, dst_min);
for(i = 0; i < num_tmps; ++i)
tmp[i] = lp_build_max(&bld, tmp[i], thres);
}
@@ -260,7 +260,7 @@ lp_build_conv(LLVMBuilderRef builder,
if(dst_max == 1.0)
thres = bld.one;
else
- thres = lp_build_const_scalar(src_type, dst_max);
+ thres = lp_build_const_vec(src_type, dst_max);
for(i = 0; i < num_tmps; ++i)
tmp[i] = lp_build_min(&bld, tmp[i], thres);
}
@@ -288,7 +288,7 @@ lp_build_conv(LLVMBuilderRef builder,
LLVMTypeRef tmp_vec_type;
if (dst_scale != 1.0) {
- LLVMValueRef scale = lp_build_const_scalar(tmp_type, dst_scale);
+ LLVMValueRef scale = lp_build_const_vec(tmp_type, dst_scale);
for(i = 0; i < num_tmps; ++i)
tmp[i] = LLVMBuildMul(builder, tmp[i], scale, "");
}
@@ -315,7 +315,7 @@ lp_build_conv(LLVMBuilderRef builder,
/* FIXME: compensate different offsets too */
if(src_shift > dst_shift) {
- LLVMValueRef shift = lp_build_int_const_scalar(tmp_type, src_shift - dst_shift);
+ LLVMValueRef shift = lp_build_const_int_vec(tmp_type, src_shift - dst_shift);
for(i = 0; i < num_tmps; ++i)
if(src_type.sign)
tmp[i] = LLVMBuildAShr(builder, tmp[i], shift, "");
@@ -388,7 +388,7 @@ lp_build_conv(LLVMBuilderRef builder,
}
if (src_scale != 1.0) {
- LLVMValueRef scale = lp_build_const_scalar(tmp_type, 1.0/src_scale);
+ LLVMValueRef scale = lp_build_const_vec(tmp_type, 1.0/src_scale);
for(i = 0; i < num_tmps; ++i)
tmp[i] = LLVMBuildMul(builder, tmp[i], scale, "");
}
@@ -400,7 +400,7 @@ lp_build_conv(LLVMBuilderRef builder,
/* FIXME: compensate different offsets too */
if(src_shift < dst_shift) {
- LLVMValueRef shift = lp_build_int_const_scalar(tmp_type, dst_shift - src_shift);
+ LLVMValueRef shift = lp_build_const_int_vec(tmp_type, dst_shift - src_shift);
for(i = 0; i < num_tmps; ++i)
tmp[i] = LLVMBuildShl(builder, tmp[i], shift, "");
}
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_conv.h b/src/gallium/auxiliary/gallivm/lp_bld_conv.h
index 948e68fae4..628831c3ad 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_conv.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_conv.h
@@ -37,7 +37,7 @@
#define LP_BLD_CONV_H
-#include <llvm-c/Core.h>
+#include "gallivm/lp_bld.h"
struct lp_type;
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.h b/src/gallium/auxiliary/gallivm/lp_bld_debug.h
index 583e6132b4..7b010cbdb0 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_debug.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.h
@@ -30,7 +30,7 @@
#define LP_BLD_DEBUG_H
-#include <llvm-c/Core.h>
+#include "gallivm/lp_bld.h"
#include "pipe/p_compiler.h"
#include "util/u_string.h"
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_depth.c b/src/gallium/auxiliary/gallivm/lp_bld_depth.c
index f08f8eb6d8..c6d0e4bc04 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_depth.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_depth.c
@@ -52,7 +52,14 @@
* Z31 Z32 Z41 Z42 Z33 Z34 Z43 Z44 ...
* ... ... ... ... ... ... ... ... ...
*
- * FIXME: Code generate stencil test
+ *
+ * Stencil test:
+ * Two-sided stencil test is supported but probably not as efficient as
+ * it could be. Currently, we use if/then/else constructs to do the
+ * operations for front vs. back-facing polygons. We could probably do
+ * both the front and back arithmetic then use a Select() instruction to
+ * choose the result depending on polyon orientation. We'd have to
+ * measure performance both ways and see which is better.
*
* @author Jose Fonseca <jfonseca@vmware.com>
*/
@@ -61,11 +68,264 @@
#include "util/u_format.h"
#include "lp_bld_type.h"
+#include "lp_bld_arit.h"
#include "lp_bld_const.h"
#include "lp_bld_logic.h"
#include "lp_bld_flow.h"
#include "lp_bld_debug.h"
#include "lp_bld_depth.h"
+#include "lp_bld_swizzle.h"
+
+
+/** Used to select fields from pipe_stencil_state */
+enum stencil_op {
+ S_FAIL_OP,
+ Z_FAIL_OP,
+ Z_PASS_OP
+};
+
+
+
+/**
+ * Do the stencil test comparison (compare FB stencil values against ref value).
+ * This will be used twice when generating two-sided stencil code.
+ * \param stencil the front/back stencil state
+ * \param stencilRef the stencil reference value, replicated as a vector
+ * \param stencilVals vector of stencil values from framebuffer
+ * \return vector mask of pass/fail values (~0 or 0)
+ */
+static LLVMValueRef
+lp_build_stencil_test_single(struct lp_build_context *bld,
+ const struct pipe_stencil_state *stencil,
+ LLVMValueRef stencilRef,
+ LLVMValueRef stencilVals)
+{
+ const unsigned stencilMax = 255; /* XXX fix */
+ struct lp_type type = bld->type;
+ LLVMValueRef res;
+
+ assert(type.sign);
+
+ assert(stencil->enabled);
+
+ if (stencil->valuemask != stencilMax) {
+ /* compute stencilRef = stencilRef & valuemask */
+ LLVMValueRef valuemask = lp_build_const_int_vec(type, stencil->valuemask);
+ stencilRef = LLVMBuildAnd(bld->builder, stencilRef, valuemask, "");
+ /* compute stencilVals = stencilVals & valuemask */
+ stencilVals = LLVMBuildAnd(bld->builder, stencilVals, valuemask, "");
+ }
+
+ res = lp_build_cmp(bld, stencil->func, stencilVals, stencilRef);
+
+ return res;
+}
+
+
+/**
+ * Do the one or two-sided stencil test comparison.
+ * \sa lp_build_stencil_test_single
+ * \param face an integer indicating front (+) or back (-) facing polygon.
+ * If NULL, assume front-facing.
+ */
+static LLVMValueRef
+lp_build_stencil_test(struct lp_build_context *bld,
+ const struct pipe_stencil_state stencil[2],
+ LLVMValueRef stencilRefs[2],
+ LLVMValueRef stencilVals,
+ LLVMValueRef face)
+{
+ LLVMValueRef res;
+
+ assert(stencil[0].enabled);
+
+ if (stencil[1].enabled && face) {
+ /* do two-sided test */
+ struct lp_build_flow_context *flow_ctx;
+ struct lp_build_if_state if_ctx;
+ LLVMValueRef front_facing;
+ LLVMValueRef zero = LLVMConstReal(LLVMFloatType(), 0.0);
+ LLVMValueRef result = bld->undef;
+
+ flow_ctx = lp_build_flow_create(bld->builder);
+ lp_build_flow_scope_begin(flow_ctx);
+
+ lp_build_flow_scope_declare(flow_ctx, &result);
+
+ /* front_facing = face > 0.0 */
+ front_facing = LLVMBuildFCmp(bld->builder, LLVMRealUGT, face, zero, "");
+
+ lp_build_if(&if_ctx, flow_ctx, bld->builder, front_facing);
+ {
+ result = lp_build_stencil_test_single(bld, &stencil[0],
+ stencilRefs[0], stencilVals);
+ }
+ lp_build_else(&if_ctx);
+ {
+ result = lp_build_stencil_test_single(bld, &stencil[1],
+ stencilRefs[1], stencilVals);
+ }
+ lp_build_endif(&if_ctx);
+
+ lp_build_flow_scope_end(flow_ctx);
+ lp_build_flow_destroy(flow_ctx);
+
+ res = result;
+ }
+ else {
+ /* do single-side test */
+ res = lp_build_stencil_test_single(bld, &stencil[0],
+ stencilRefs[0], stencilVals);
+ }
+
+ return res;
+}
+
+
+/**
+ * Apply the stencil operator (add/sub/keep/etc) to the given vector
+ * of stencil values.
+ * \return new stencil values vector
+ */
+static LLVMValueRef
+lp_build_stencil_op_single(struct lp_build_context *bld,
+ const struct pipe_stencil_state *stencil,
+ enum stencil_op op,
+ LLVMValueRef stencilRef,
+ LLVMValueRef stencilVals,
+ LLVMValueRef mask)
+
+{
+ const unsigned stencilMax = 255; /* XXX fix */
+ struct lp_type type = bld->type;
+ LLVMValueRef res;
+ LLVMValueRef max = lp_build_const_int_vec(type, stencilMax);
+ unsigned stencil_op;
+
+ assert(type.sign);
+
+ switch (op) {
+ case S_FAIL_OP:
+ stencil_op = stencil->fail_op;
+ break;
+ case Z_FAIL_OP:
+ stencil_op = stencil->zfail_op;
+ break;
+ case Z_PASS_OP:
+ stencil_op = stencil->zpass_op;
+ break;
+ default:
+ assert(0 && "Invalid stencil_op mode");
+ stencil_op = PIPE_STENCIL_OP_KEEP;
+ }
+
+ switch (stencil_op) {
+ case PIPE_STENCIL_OP_KEEP:
+ res = stencilVals;
+ /* we can return early for this case */
+ return res;
+ case PIPE_STENCIL_OP_ZERO:
+ res = bld->zero;
+ break;
+ case PIPE_STENCIL_OP_REPLACE:
+ res = stencilRef;
+ break;
+ case PIPE_STENCIL_OP_INCR:
+ res = lp_build_add(bld, stencilVals, bld->one);
+ res = lp_build_min(bld, res, max);
+ break;
+ case PIPE_STENCIL_OP_DECR:
+ res = lp_build_sub(bld, stencilVals, bld->one);
+ res = lp_build_max(bld, res, bld->zero);
+ break;
+ case PIPE_STENCIL_OP_INCR_WRAP:
+ res = lp_build_add(bld, stencilVals, bld->one);
+ res = LLVMBuildAnd(bld->builder, res, max, "");
+ break;
+ case PIPE_STENCIL_OP_DECR_WRAP:
+ res = lp_build_sub(bld, stencilVals, bld->one);
+ res = LLVMBuildAnd(bld->builder, res, max, "");
+ break;
+ case PIPE_STENCIL_OP_INVERT:
+ res = LLVMBuildNot(bld->builder, stencilVals, "");
+ res = LLVMBuildAnd(bld->builder, res, max, "");
+ break;
+ default:
+ assert(0 && "bad stencil op mode");
+ res = NULL;
+ }
+
+ if (stencil->writemask != stencilMax) {
+ /* compute res = (res & mask) | (stencilVals & ~mask) */
+ LLVMValueRef mask = lp_build_const_int_vec(type, stencil->writemask);
+ LLVMValueRef cmask = LLVMBuildNot(bld->builder, mask, "notWritemask");
+ LLVMValueRef t1 = LLVMBuildAnd(bld->builder, res, mask, "t1");
+ LLVMValueRef t2 = LLVMBuildAnd(bld->builder, stencilVals, cmask, "t2");
+ res = LLVMBuildOr(bld->builder, t1, t2, "t1_or_t2");
+ }
+
+ /* only the update the vector elements enabled by 'mask' */
+ res = lp_build_select(bld, mask, res, stencilVals);
+
+ return res;
+}
+
+
+/**
+ * Do the one or two-sided stencil test op/update.
+ */
+static LLVMValueRef
+lp_build_stencil_op(struct lp_build_context *bld,
+ const struct pipe_stencil_state stencil[2],
+ enum stencil_op op,
+ LLVMValueRef stencilRefs[2],
+ LLVMValueRef stencilVals,
+ LLVMValueRef mask,
+ LLVMValueRef face)
+
+{
+ assert(stencil[0].enabled);
+
+ if (stencil[1].enabled && face) {
+ /* do two-sided op */
+ struct lp_build_flow_context *flow_ctx;
+ struct lp_build_if_state if_ctx;
+ LLVMValueRef front_facing;
+ LLVMValueRef zero = LLVMConstReal(LLVMFloatType(), 0.0);
+ LLVMValueRef result = bld->undef;
+
+ flow_ctx = lp_build_flow_create(bld->builder);
+ lp_build_flow_scope_begin(flow_ctx);
+
+ lp_build_flow_scope_declare(flow_ctx, &result);
+
+ /* front_facing = face > 0.0 */
+ front_facing = LLVMBuildFCmp(bld->builder, LLVMRealUGT, face, zero, "");
+
+ lp_build_if(&if_ctx, flow_ctx, bld->builder, front_facing);
+ {
+ result = lp_build_stencil_op_single(bld, &stencil[0], op,
+ stencilRefs[0], stencilVals, mask);
+ }
+ lp_build_else(&if_ctx);
+ {
+ result = lp_build_stencil_op_single(bld, &stencil[1], op,
+ stencilRefs[1], stencilVals, mask);
+ }
+ lp_build_endif(&if_ctx);
+
+ lp_build_flow_scope_end(flow_ctx);
+ lp_build_flow_destroy(flow_ctx);
+
+ return result;
+ }
+ else {
+ /* do single-sided op */
+ return lp_build_stencil_op_single(bld, &stencil[0], op,
+ stencilRefs[0], stencilVals, mask);
+ }
+}
+
/**
@@ -109,105 +369,303 @@ lp_depth_type(const struct util_format_description *format_desc,
/**
- * Depth test.
+ * Compute bitmask and bit shift to apply to the incoming fragment Z values
+ * and the Z buffer values needed before doing the Z comparison.
+ *
+ * Note that we leave the Z bits in the position that we find them
+ * in the Z buffer (typically 0xffffff00 or 0x00ffffff). That lets us
+ * get by with fewer bit twiddling steps.
*/
-void
-lp_build_depth_test(LLVMBuilderRef builder,
- const struct pipe_depth_state *state,
- struct lp_type type,
- const struct util_format_description *format_desc,
- struct lp_build_mask_context *mask,
- LLVMValueRef src,
- LLVMValueRef dst_ptr)
+static boolean
+get_z_shift_and_mask(const struct util_format_description *format_desc,
+ unsigned *shift, unsigned *mask)
{
- struct lp_build_context bld;
+ const unsigned total_bits = format_desc->block.bits;
unsigned z_swizzle;
- LLVMValueRef dst;
- LLVMValueRef z_bitmask = NULL;
- LLVMValueRef test;
-
- if(!state->enabled)
- return;
-
+ int chan;
+ unsigned padding_left, padding_right;
+
assert(format_desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS);
assert(format_desc->block.width == 1);
assert(format_desc->block.height == 1);
z_swizzle = format_desc->swizzle[0];
- if(z_swizzle == UTIL_FORMAT_SWIZZLE_NONE)
- return;
- /* Sanity checking */
- assert(z_swizzle < 4);
- assert(format_desc->block.bits == type.width);
- if(type.floating) {
- assert(z_swizzle == 0);
- assert(format_desc->channel[z_swizzle].type == UTIL_FORMAT_TYPE_FLOAT);
- assert(format_desc->channel[z_swizzle].size == format_desc->block.bits);
+ if (z_swizzle == UTIL_FORMAT_SWIZZLE_NONE)
+ return FALSE;
+
+ padding_right = 0;
+ for (chan = 0; chan < z_swizzle; ++chan)
+ padding_right += format_desc->channel[chan].size;
+
+ padding_left =
+ total_bits - (padding_right + format_desc->channel[z_swizzle].size);
+
+ if (padding_left || padding_right) {
+ unsigned long long mask_left = (1ULL << (total_bits - padding_left)) - 1;
+ unsigned long long mask_right = (1ULL << (padding_right)) - 1;
+ *mask = mask_left ^ mask_right;
}
else {
- assert(format_desc->channel[z_swizzle].type == UTIL_FORMAT_TYPE_UNSIGNED);
- assert(format_desc->channel[z_swizzle].normalized);
- assert(!type.fixed);
- assert(!type.sign);
- assert(type.norm);
+ *mask = 0xffffffff;
+ }
+
+ *shift = padding_left;
+
+ return TRUE;
+}
+
+
+/**
+ * Compute bitmask and bit shift to apply to the framebuffer pixel values
+ * to put the stencil bits in the least significant position.
+ * (i.e. 0x000000ff)
+ */
+static boolean
+get_s_shift_and_mask(const struct util_format_description *format_desc,
+ unsigned *shift, unsigned *mask)
+{
+ unsigned s_swizzle;
+ int chan, sz;
+
+ s_swizzle = format_desc->swizzle[1];
+
+ if (s_swizzle == UTIL_FORMAT_SWIZZLE_NONE)
+ return FALSE;
+
+ *shift = 0;
+ for (chan = 0; chan < s_swizzle; chan++)
+ *shift += format_desc->channel[chan].size;
+
+ sz = format_desc->channel[s_swizzle].size;
+ *mask = (1U << sz) - 1U;
+
+ return TRUE;
+}
+
+
+
+/**
+ * Generate code for performing depth and/or stencil tests.
+ * We operate on a vector of values (typically a 2x2 quad).
+ *
+ * \param depth the depth test state
+ * \param stencil the front/back stencil state
+ * \param type the data type of the fragment depth/stencil values
+ * \param format_desc description of the depth/stencil surface
+ * \param mask the alive/dead pixel mask for the quad (vector)
+ * \param stencil_refs the front/back stencil ref values (scalar)
+ * \param z_src the incoming depth/stencil values (a 2x2 quad)
+ * \param zs_dst_ptr pointer to depth/stencil values in framebuffer
+ * \param facing contains float value indicating front/back facing polygon
+ */
+void
+lp_build_depth_stencil_test(LLVMBuilderRef builder,
+ const struct pipe_depth_state *depth,
+ const struct pipe_stencil_state stencil[2],
+ struct lp_type type,
+ const struct util_format_description *format_desc,
+ struct lp_build_mask_context *mask,
+ LLVMValueRef stencil_refs[2],
+ LLVMValueRef z_src,
+ LLVMValueRef zs_dst_ptr,
+ LLVMValueRef face)
+{
+ struct lp_build_context bld;
+ struct lp_build_context sbld;
+ struct lp_type s_type;
+ LLVMValueRef zs_dst, z_dst = NULL;
+ LLVMValueRef stencil_vals = NULL;
+ LLVMValueRef z_bitmask = NULL, stencil_shift = NULL;
+ LLVMValueRef z_pass = NULL, s_pass_mask = NULL;
+ LLVMValueRef orig_mask = mask->value;
+
+ /* Sanity checking */
+ {
+ const unsigned z_swizzle = format_desc->swizzle[0];
+ const unsigned s_swizzle = format_desc->swizzle[1];
+
+ assert(z_swizzle != UTIL_FORMAT_SWIZZLE_NONE ||
+ s_swizzle != UTIL_FORMAT_SWIZZLE_NONE);
+
+ assert(depth->enabled || stencil[0].enabled);
+
+ assert(format_desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS);
+ assert(format_desc->block.width == 1);
+ assert(format_desc->block.height == 1);
+
+ if (stencil[0].enabled) {
+ assert(format_desc->format == PIPE_FORMAT_Z24_UNORM_S8_USCALED ||
+ format_desc->format == PIPE_FORMAT_S8_USCALED_Z24_UNORM);
+ }
+
+ assert(z_swizzle < 4);
+ assert(format_desc->block.bits == type.width);
+ if (type.floating) {
+ assert(z_swizzle == 0);
+ assert(format_desc->channel[z_swizzle].type ==
+ UTIL_FORMAT_TYPE_FLOAT);
+ assert(format_desc->channel[z_swizzle].size ==
+ format_desc->block.bits);
+ }
+ else {
+ assert(format_desc->channel[z_swizzle].type ==
+ UTIL_FORMAT_TYPE_UNSIGNED);
+ assert(format_desc->channel[z_swizzle].normalized);
+ assert(!type.fixed);
+ assert(!type.sign);
+ assert(type.norm);
+ }
}
- /* Setup build context */
+
+ /* Setup build context for Z vals */
lp_build_context_init(&bld, builder, type);
- dst = LLVMBuildLoad(builder, dst_ptr, "");
+ /* Setup build context for stencil vals */
+ s_type = lp_type_int_vec(type.width);
+ lp_build_context_init(&sbld, builder, s_type);
+
+ /* Load current z/stencil value from z/stencil buffer */
+ zs_dst = LLVMBuildLoad(builder, zs_dst_ptr, "");
+
+ lp_build_name(zs_dst, "zsbufval");
- lp_build_name(dst, "zsbuf");
- /* Align the source depth bits with the destination's, and mask out any
- * stencil or padding bits from both */
- if(format_desc->channel[z_swizzle].size == format_desc->block.bits) {
- assert(z_swizzle == 0);
- /* nothing to do */
+ /* Compute and apply the Z/stencil bitmasks and shifts.
+ */
+ {
+ unsigned z_shift, z_mask;
+ unsigned s_shift, s_mask;
+
+ if (get_z_shift_and_mask(format_desc, &z_shift, &z_mask)) {
+ if (z_shift) {
+ LLVMValueRef shift = lp_build_const_int_vec(type, z_shift);
+ z_src = LLVMBuildLShr(builder, z_src, shift, "");
+ }
+
+ if (z_mask != 0xffffffff) {
+ LLVMValueRef mask = lp_build_const_int_vec(type, z_mask);
+ z_src = LLVMBuildAnd(builder, z_src, mask, "");
+ z_dst = LLVMBuildAnd(builder, zs_dst, mask, "");
+ z_bitmask = mask; /* used below */
+ }
+ else {
+ z_dst = zs_dst;
+ }
+
+ lp_build_name(z_dst, "zsbuf.z");
+ }
+
+ if (get_s_shift_and_mask(format_desc, &s_shift, &s_mask)) {
+ if (s_shift) {
+ LLVMValueRef shift = lp_build_const_int_vec(type, s_shift);
+ stencil_vals = LLVMBuildLShr(builder, zs_dst, shift, "");
+ stencil_shift = shift; /* used below */
+ }
+ else {
+ stencil_vals = zs_dst;
+ }
+
+ if (s_mask != 0xffffffff) {
+ LLVMValueRef mask = lp_build_const_int_vec(type, s_mask);
+ stencil_vals = LLVMBuildAnd(builder, stencil_vals, mask, "");
+ }
+
+ lp_build_name(stencil_vals, "stencil");
+ }
}
- else {
- unsigned padding_left;
- unsigned padding_right;
- unsigned chan;
-
- assert(format_desc->layout == UTIL_FORMAT_LAYOUT_PLAIN);
- assert(format_desc->channel[z_swizzle].type == UTIL_FORMAT_TYPE_UNSIGNED);
- assert(format_desc->channel[z_swizzle].size <= format_desc->block.bits);
- assert(format_desc->channel[z_swizzle].normalized);
-
- padding_right = 0;
- for(chan = 0; chan < z_swizzle; ++chan)
- padding_right += format_desc->channel[chan].size;
- padding_left = format_desc->block.bits -
- (padding_right + format_desc->channel[z_swizzle].size);
-
- if(padding_left || padding_right) {
- const unsigned long long mask_left = ((unsigned long long)1 << (format_desc->block.bits - padding_left)) - 1;
- const unsigned long long mask_right = ((unsigned long long)1 << (padding_right)) - 1;
- z_bitmask = lp_build_int_const_scalar(type, mask_left ^ mask_right);
+
+
+ if (stencil[0].enabled) {
+ /* convert scalar stencil refs into vectors */
+ stencil_refs[0] = lp_build_broadcast_scalar(&bld, stencil_refs[0]);
+ stencil_refs[1] = lp_build_broadcast_scalar(&bld, stencil_refs[1]);
+
+ s_pass_mask = lp_build_stencil_test(&sbld, stencil,
+ stencil_refs, stencil_vals, face);
+
+ /* apply stencil-fail operator */
+ {
+ LLVMValueRef s_fail_mask = lp_build_andc(&bld, orig_mask, s_pass_mask);
+ stencil_vals = lp_build_stencil_op(&sbld, stencil, S_FAIL_OP,
+ stencil_refs, stencil_vals,
+ s_fail_mask, face);
+ }
+ }
+
+ if (depth->enabled) {
+ /* compare src Z to dst Z, returning 'pass' mask */
+ z_pass = lp_build_cmp(&bld, depth->func, z_src, z_dst);
+
+ if (!stencil[0].enabled) {
+ /* We can potentially skip all remaining operations here, but only
+ * if stencil is disabled because we still need to update the stencil
+ * buffer values. Don't need to update Z buffer values.
+ */
+ lp_build_mask_update(mask, z_pass);
+ }
+
+ if (depth->writemask) {
+ if(z_bitmask)
+ z_bitmask = LLVMBuildAnd(builder, mask->value, z_bitmask, "");
+ else
+ z_bitmask = mask->value;
+
+ z_dst = lp_build_select(&bld, z_bitmask, z_src, z_dst);
}
- if(padding_left)
- src = LLVMBuildLShr(builder, src, lp_build_int_const_scalar(type, padding_left), "");
- if(padding_right)
- src = LLVMBuildAnd(builder, src, z_bitmask, "");
- if(padding_left || padding_right)
- dst = LLVMBuildAnd(builder, dst, z_bitmask, "");
+ if (stencil[0].enabled) {
+ /* update stencil buffer values according to z pass/fail result */
+ LLVMValueRef z_fail_mask, z_pass_mask;
+
+ /* apply Z-fail operator */
+ z_fail_mask = lp_build_andc(&bld, orig_mask, z_pass);
+ stencil_vals = lp_build_stencil_op(&sbld, stencil, Z_FAIL_OP,
+ stencil_refs, stencil_vals,
+ z_fail_mask, face);
+
+ /* apply Z-pass operator */
+ z_pass_mask = LLVMBuildAnd(bld.builder, orig_mask, z_pass, "");
+ stencil_vals = lp_build_stencil_op(&sbld, stencil, Z_PASS_OP,
+ stencil_refs, stencil_vals,
+ z_pass_mask, face);
+ }
+ }
+ else {
+ /* No depth test: apply Z-pass operator to stencil buffer values which
+ * passed the stencil test.
+ */
+ s_pass_mask = LLVMBuildAnd(bld.builder, orig_mask, s_pass_mask, "");
+ stencil_vals = lp_build_stencil_op(&sbld, stencil, Z_PASS_OP,
+ stencil_refs, stencil_vals,
+ s_pass_mask, face);
}
- lp_build_name(dst, "zsbuf.z");
+ /* The Z bits are already in the right place but we may need to shift the
+ * stencil bits before ORing Z with Stencil to make the final pixel value.
+ */
+ if (stencil_vals && stencil_shift)
+ stencil_vals = LLVMBuildShl(bld.builder, stencil_vals,
+ stencil_shift, "");
- test = lp_build_cmp(&bld, state->func, src, dst);
- lp_build_mask_update(mask, test);
+ /* Finally, merge/store the z/stencil values */
+ if ((depth->enabled && depth->writemask) ||
+ (stencil[0].enabled && stencil[0].writemask)) {
- if(state->writemask) {
- if(z_bitmask)
- z_bitmask = LLVMBuildAnd(builder, mask->value, z_bitmask, "");
+ if (z_dst && stencil_vals)
+ zs_dst = LLVMBuildOr(bld.builder, z_dst, stencil_vals, "");
+ else if (z_dst)
+ zs_dst = z_dst;
else
- z_bitmask = mask->value;
+ zs_dst = stencil_vals;
- dst = lp_build_select(&bld, z_bitmask, src, dst);
- LLVMBuildStore(builder, dst, dst_ptr);
+ LLVMBuildStore(builder, zs_dst, zs_dst_ptr);
}
+
+ if (s_pass_mask)
+ lp_build_mask_update(mask, s_pass_mask);
+
+ if (depth->enabled && stencil[0].enabled)
+ lp_build_mask_update(mask, z_pass);
}
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_depth.h b/src/gallium/auxiliary/gallivm/lp_bld_depth.h
index 79d6981bb5..27dd46b625 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_depth.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_depth.h
@@ -36,7 +36,7 @@
#define LP_BLD_DEPTH_H
-#include <llvm-c/Core.h>
+#include "gallivm/lp_bld.h"
struct pipe_depth_state;
@@ -51,13 +51,16 @@ lp_depth_type(const struct util_format_description *format_desc,
void
-lp_build_depth_test(LLVMBuilderRef builder,
- const struct pipe_depth_state *state,
- struct lp_type type,
- const struct util_format_description *format_desc,
- struct lp_build_mask_context *mask,
- LLVMValueRef src,
- LLVMValueRef dst_ptr);
+lp_build_depth_stencil_test(LLVMBuilderRef builder,
+ const struct pipe_depth_state *depth,
+ const struct pipe_stencil_state stencil[2],
+ struct lp_type type,
+ const struct util_format_description *format_desc,
+ struct lp_build_mask_context *mask,
+ LLVMValueRef stencil_refs[2],
+ LLVMValueRef zs_src,
+ LLVMValueRef zs_dst_ptr,
+ LLVMValueRef facing);
#endif /* !LP_BLD_DEPTH_H */
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_flow.c b/src/gallium/auxiliary/gallivm/lp_bld_flow.c
index bc83138908..106fc03e46 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_flow.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_flow.c
@@ -308,7 +308,7 @@ lp_build_flow_scope_end(struct lp_build_flow_context *flow)
* Note: this function has no dependencies on the flow code and could
* be used elsewhere.
*/
-static LLVMBasicBlockRef
+LLVMBasicBlockRef
lp_build_insert_new_block(LLVMBuilderRef builder, const char *name)
{
LLVMBasicBlockRef current_block;
@@ -648,7 +648,9 @@ lp_build_if(struct lp_build_if_state *ctx,
ifthen->phi[i] = LLVMBuildPhi(builder, LLVMTypeOf(*flow->variables[i]), "");
/* add add the initial value of the var from the entry block */
- LLVMAddIncoming(ifthen->phi[i], flow->variables[i], &ifthen->entry_block, 1);
+ if (!LLVMIsUndef(*flow->variables[i]))
+ LLVMAddIncoming(ifthen->phi[i], flow->variables[i],
+ &ifthen->entry_block, 1);
}
/* create/insert true_block before merge_block */
@@ -695,18 +697,21 @@ lp_build_endif(struct lp_build_if_state *ctx)
{
struct lp_build_flow_context *flow = ctx->flow;
struct lp_build_flow_if *ifthen;
+ LLVMBasicBlockRef curBlock = LLVMGetInsertBlock(ctx->builder);
unsigned i;
ifthen = &lp_build_flow_pop(flow, LP_BUILD_FLOW_IF)->ifthen;
assert(ifthen);
+ /* Insert branch to the merge block from current block */
+ LLVMBuildBr(ctx->builder, ifthen->merge_block);
+
if (ifthen->false_block) {
LLVMPositionBuilderAtEnd(ctx->builder, ifthen->merge_block);
/* for each variable, update the Phi node with a (variable, block) pair */
for (i = 0; i < flow->num_variables; i++) {
assert(*flow->variables[i]);
- LLVMAddIncoming(ifthen->phi[i], flow->variables[i], &ifthen->false_block, 1);
-
+ LLVMAddIncoming(ifthen->phi[i], flow->variables[i], &curBlock, 1);
/* replace the variable ref with the phi function */
*flow->variables[i] = ifthen->phi[i];
}
@@ -742,15 +747,18 @@ lp_build_endif(struct lp_build_if_state *ctx)
ifthen->true_block, ifthen->merge_block);
}
- /* Append an unconditional Br(anch) instruction on the true_block */
- LLVMPositionBuilderAtEnd(ctx->builder, ifthen->true_block);
- LLVMBuildBr(ctx->builder, ifthen->merge_block);
+ /* Insert branch from end of true_block to merge_block */
if (ifthen->false_block) {
- /* Append an unconditional Br(anch) instruction on the false_block */
- LLVMPositionBuilderAtEnd(ctx->builder, ifthen->false_block);
+ /* Append an unconditional Br(anch) instruction on the true_block */
+ LLVMPositionBuilderAtEnd(ctx->builder, ifthen->true_block);
LLVMBuildBr(ctx->builder, ifthen->merge_block);
}
-
+ else {
+ /* No else clause.
+ * Note that we've already inserted the branch at the end of
+ * true_block. See the very first LLVMBuildBr() call in this function.
+ */
+ }
/* Resume building code at end of the ifthen->merge_block */
LLVMPositionBuilderAtEnd(ctx->builder, ifthen->merge_block);
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_flow.h b/src/gallium/auxiliary/gallivm/lp_bld_flow.h
index 4c225a0d4f..c2b50e1b60 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_flow.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_flow.h
@@ -35,7 +35,7 @@
#define LP_BLD_FLOW_H
-#include <llvm-c/Core.h>
+#include "gallivm/lp_bld.h"
struct lp_type;
@@ -145,7 +145,9 @@ lp_build_else(struct lp_build_if_state *ctx);
void
lp_build_endif(struct lp_build_if_state *ctx);
-
+
+LLVMBasicBlockRef
+lp_build_insert_new_block(LLVMBuilderRef builder, const char *name);
#endif /* !LP_BLD_FLOW_H */
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format.h b/src/gallium/auxiliary/gallivm/lp_bld_format.h
index 970bee379f..73ab6de3f2 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_format.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_format.h
@@ -34,7 +34,7 @@
* Pixel format helpers.
*/
-#include <llvm-c/Core.h>
+#include "gallivm/lp_bld.h"
#include "pipe/p_format.h"
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c
deleted file mode 100644
index a07f7418f2..0000000000
--- a/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c
+++ /dev/null
@@ -1,383 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2009 VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-/**
- * @file
- * AoS pixel format manipulation.
- *
- * @author Jose Fonseca <jfonseca@vmware.com>
- */
-
-
-#include "util/u_cpu_detect.h"
-#include "util/u_format.h"
-
-#include "lp_bld_type.h"
-#include "lp_bld_const.h"
-#include "lp_bld_swizzle.h"
-#include "lp_bld_format.h"
-
-
-/**
- * Unpack a single pixel into its RGBA components.
- *
- * @param packed integer.
- *
- * @return RGBA in a 4 floats vector.
- *
- * XXX: This is mostly for reference and testing -- operating a single pixel at
- * a time is rarely if ever needed.
- */
-LLVMValueRef
-lp_build_unpack_rgba_aos(LLVMBuilderRef builder,
- const struct util_format_description *desc,
- LLVMValueRef packed)
-{
- LLVMTypeRef type;
- LLVMValueRef shifted, casted, scaled, masked;
- LLVMValueRef shifts[4];
- LLVMValueRef masks[4];
- LLVMValueRef scales[4];
- LLVMValueRef swizzles[4];
- LLVMValueRef aux[4];
- bool normalized;
- int empty_channel;
- unsigned shift;
- unsigned i;
-
- /* FIXME: Support more formats */
- assert(desc->layout == UTIL_FORMAT_LAYOUT_PLAIN);
- assert(desc->block.width == 1);
- assert(desc->block.height == 1);
- assert(desc->block.bits <= 32);
-
- type = LLVMIntType(desc->block.bits);
-
- /* Do the intermediate integer computations with 32bit integers since it
- * matches floating point size */
- if (desc->block.bits < 32)
- packed = LLVMBuildZExt(builder, packed, LLVMInt32Type(), "");
-
- /* Broadcast the packed value to all four channels */
- packed = LLVMBuildInsertElement(builder,
- LLVMGetUndef(LLVMVectorType(LLVMInt32Type(), 4)),
- packed,
- LLVMConstNull(LLVMInt32Type()),
- "");
- packed = LLVMBuildShuffleVector(builder,
- packed,
- LLVMGetUndef(LLVMVectorType(LLVMInt32Type(), 4)),
- LLVMConstNull(LLVMVectorType(LLVMInt32Type(), 4)),
- "");
-
- /* Initialize vector constants */
- normalized = FALSE;
- empty_channel = -1;
- shift = 0;
- for (i = 0; i < 4; ++i) {
- unsigned bits = desc->channel[i].size;
-
- if (desc->channel[i].type == UTIL_FORMAT_TYPE_VOID) {
- shifts[i] = LLVMGetUndef(LLVMInt32Type());
- masks[i] = LLVMConstNull(LLVMInt32Type());
- scales[i] = LLVMConstNull(LLVMFloatType());
- empty_channel = i;
- }
- else {
- unsigned mask = (1 << bits) - 1;
-
- assert(desc->channel[i].type == UTIL_FORMAT_TYPE_UNSIGNED);
- assert(bits < 32);
-
- shifts[i] = LLVMConstInt(LLVMInt32Type(), shift, 0);
- masks[i] = LLVMConstInt(LLVMInt32Type(), mask, 0);
-
- if (desc->channel[i].normalized) {
- scales[i] = LLVMConstReal(LLVMFloatType(), 1.0/mask);
- normalized = TRUE;
- }
- else
- scales[i] = LLVMConstReal(LLVMFloatType(), 1.0);
- }
-
- shift += bits;
- }
-
- shifted = LLVMBuildLShr(builder, packed, LLVMConstVector(shifts, 4), "");
- masked = LLVMBuildAnd(builder, shifted, LLVMConstVector(masks, 4), "");
- /* UIToFP can't be expressed in SSE2 */
- casted = LLVMBuildSIToFP(builder, masked, LLVMVectorType(LLVMFloatType(), 4), "");
-
- if (normalized)
- scaled = LLVMBuildMul(builder, casted, LLVMConstVector(scales, 4), "");
- else
- scaled = casted;
-
- for (i = 0; i < 4; ++i)
- aux[i] = LLVMGetUndef(LLVMFloatType());
-
- for (i = 0; i < 4; ++i) {
- enum util_format_swizzle swizzle = desc->swizzle[i];
-
- switch (swizzle) {
- case UTIL_FORMAT_SWIZZLE_X:
- case UTIL_FORMAT_SWIZZLE_Y:
- case UTIL_FORMAT_SWIZZLE_Z:
- case UTIL_FORMAT_SWIZZLE_W:
- swizzles[i] = LLVMConstInt(LLVMInt32Type(), swizzle, 0);
- break;
- case UTIL_FORMAT_SWIZZLE_0:
- assert(empty_channel >= 0);
- swizzles[i] = LLVMConstInt(LLVMInt32Type(), empty_channel, 0);
- break;
- case UTIL_FORMAT_SWIZZLE_1:
- swizzles[i] = LLVMConstInt(LLVMInt32Type(), 4, 0);
- aux[0] = LLVMConstReal(LLVMFloatType(), 1.0);
- break;
- case UTIL_FORMAT_SWIZZLE_NONE:
- swizzles[i] = LLVMGetUndef(LLVMFloatType());
- assert(0);
- break;
- }
- }
-
- return LLVMBuildShuffleVector(builder, scaled, LLVMConstVector(aux, 4), LLVMConstVector(swizzles, 4), "");
-}
-
-
-/**
- * Take a vector with packed pixels and unpack into a rgba8 vector.
- *
- * Formats with bit depth smaller than 32bits are accepted, but they must be
- * padded to 32bits.
- */
-LLVMValueRef
-lp_build_unpack_rgba8_aos(LLVMBuilderRef builder,
- const struct util_format_description *desc,
- struct lp_type type,
- LLVMValueRef packed)
-{
- struct lp_build_context bld;
- bool rgba8;
- LLVMValueRef res;
- unsigned i;
-
- lp_build_context_init(&bld, builder, type);
-
- /* FIXME: Support more formats */
- assert(desc->layout == UTIL_FORMAT_LAYOUT_PLAIN);
- assert(desc->block.width == 1);
- assert(desc->block.height == 1);
- assert(desc->block.bits <= 32);
-
- assert(!type.floating);
- assert(!type.fixed);
- assert(type.norm);
- assert(type.width == 8);
- assert(type.length % 4 == 0);
-
- rgba8 = TRUE;
- for(i = 0; i < 4; ++i) {
- assert(desc->channel[i].type == UTIL_FORMAT_TYPE_UNSIGNED ||
- desc->channel[i].type == UTIL_FORMAT_TYPE_VOID);
- if(desc->channel[0].size != 8)
- rgba8 = FALSE;
- }
-
- if(rgba8) {
- /*
- * The pixel is already in a rgba8 format variant. All it is necessary
- * is to swizzle the channels.
- */
-
- unsigned char swizzles[4];
- boolean zeros[4]; /* bitwise AND mask */
- boolean ones[4]; /* bitwise OR mask */
- boolean swizzles_needed = FALSE;
- boolean zeros_needed = FALSE;
- boolean ones_needed = FALSE;
-
- for(i = 0; i < 4; ++i) {
- enum util_format_swizzle swizzle = desc->swizzle[i];
-
- /* Initialize with the no-op case */
- swizzles[i] = util_cpu_caps.little_endian ? 3 - i : i;
- zeros[i] = TRUE;
- ones[i] = FALSE;
-
- switch (swizzle) {
- case UTIL_FORMAT_SWIZZLE_X:
- case UTIL_FORMAT_SWIZZLE_Y:
- case UTIL_FORMAT_SWIZZLE_Z:
- case UTIL_FORMAT_SWIZZLE_W:
- if(swizzle != swizzles[i]) {
- swizzles[i] = swizzle;
- swizzles_needed = TRUE;
- }
- break;
- case UTIL_FORMAT_SWIZZLE_0:
- zeros[i] = FALSE;
- zeros_needed = TRUE;
- break;
- case UTIL_FORMAT_SWIZZLE_1:
- ones[i] = TRUE;
- ones_needed = TRUE;
- break;
- case UTIL_FORMAT_SWIZZLE_NONE:
- assert(0);
- break;
- }
- }
-
- res = packed;
-
- if(swizzles_needed)
- res = lp_build_swizzle1_aos(&bld, res, swizzles);
-
- if(zeros_needed) {
- /* Mask out zero channels */
- LLVMValueRef mask = lp_build_const_mask_aos(type, zeros);
- res = LLVMBuildAnd(builder, res, mask, "");
- }
-
- if(ones_needed) {
- /* Or one channels */
- LLVMValueRef mask = lp_build_const_mask_aos(type, ones);
- res = LLVMBuildOr(builder, res, mask, "");
- }
- }
- else {
- /* FIXME */
- assert(0);
- res = lp_build_undef(type);
- }
-
- return res;
-}
-
-
-/**
- * Pack a single pixel.
- *
- * @param rgba 4 float vector with the unpacked components.
- *
- * XXX: This is mostly for reference and testing -- operating a single pixel at
- * a time is rarely if ever needed.
- */
-LLVMValueRef
-lp_build_pack_rgba_aos(LLVMBuilderRef builder,
- const struct util_format_description *desc,
- LLVMValueRef rgba)
-{
- LLVMTypeRef type;
- LLVMValueRef packed = NULL;
- LLVMValueRef swizzles[4];
- LLVMValueRef shifted, casted, scaled, unswizzled;
- LLVMValueRef shifts[4];
- LLVMValueRef scales[4];
- bool normalized;
- unsigned shift;
- unsigned i, j;
-
- assert(desc->layout == UTIL_FORMAT_LAYOUT_PLAIN);
- assert(desc->block.width == 1);
- assert(desc->block.height == 1);
-
- type = LLVMIntType(desc->block.bits);
-
- /* Unswizzle the color components into the source vector. */
- for (i = 0; i < 4; ++i) {
- for (j = 0; j < 4; ++j) {
- if (desc->swizzle[j] == i)
- break;
- }
- if (j < 4)
- swizzles[i] = LLVMConstInt(LLVMInt32Type(), j, 0);
- else
- swizzles[i] = LLVMGetUndef(LLVMInt32Type());
- }
-
- unswizzled = LLVMBuildShuffleVector(builder, rgba,
- LLVMGetUndef(LLVMVectorType(LLVMFloatType(), 4)),
- LLVMConstVector(swizzles, 4), "");
-
- normalized = FALSE;
- shift = 0;
- for (i = 0; i < 4; ++i) {
- unsigned bits = desc->channel[i].size;
-
- if (desc->channel[i].type == UTIL_FORMAT_TYPE_VOID) {
- shifts[i] = LLVMGetUndef(LLVMInt32Type());
- scales[i] = LLVMGetUndef(LLVMFloatType());
- }
- else {
- unsigned mask = (1 << bits) - 1;
-
- assert(desc->channel[i].type == UTIL_FORMAT_TYPE_UNSIGNED);
- assert(bits < 32);
-
- shifts[i] = LLVMConstInt(LLVMInt32Type(), shift, 0);
-
- if (desc->channel[i].normalized) {
- scales[i] = LLVMConstReal(LLVMFloatType(), mask);
- normalized = TRUE;
- }
- else
- scales[i] = LLVMConstReal(LLVMFloatType(), 1.0);
- }
-
- shift += bits;
- }
-
- if (normalized)
- scaled = LLVMBuildMul(builder, unswizzled, LLVMConstVector(scales, 4), "");
- else
- scaled = unswizzled;
-
- casted = LLVMBuildFPToSI(builder, scaled, LLVMVectorType(LLVMInt32Type(), 4), "");
-
- shifted = LLVMBuildShl(builder, casted, LLVMConstVector(shifts, 4), "");
-
- /* Bitwise or all components */
- for (i = 0; i < 4; ++i) {
- if (desc->channel[i].type == UTIL_FORMAT_TYPE_UNSIGNED) {
- LLVMValueRef component = LLVMBuildExtractElement(builder, shifted, LLVMConstInt(LLVMInt32Type(), i, 0), "");
- if (packed)
- packed = LLVMBuildOr(builder, packed, component, "");
- else
- packed = component;
- }
- }
-
- if (!packed)
- packed = LLVMGetUndef(LLVMInt32Type());
-
- if (desc->block.bits < 32)
- packed = LLVMBuildTrunc(builder, packed, type, "");
-
- return packed;
-}
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_query.c b/src/gallium/auxiliary/gallivm/lp_bld_format_query.c
deleted file mode 100644
index f3832d07ff..0000000000
--- a/src/gallium/auxiliary/gallivm/lp_bld_format_query.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2009 VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-/**
- * @file
- * Utility functions to make assertions about formats.
- *
- * This module centralizes most of logic used when determining what algorithm
- * is most suitable (i.e., most efficient yet correct) for a given format.
- *
- * It might be possible to move some of these functions to u_format module,
- * but since tiny differences in the format my render it more/less
- * appropriate to a given algorithm it is impossible to make any long term
- * guarantee about the semantics of these functions.
- *
- * @author Jose Fonseca <jfonseca@vmware.com>
- */
-
-
-#include "util/u_format.h"
-
-#include "lp_bld_format.h"
-
-
-/**
- * Whether this format is a 4 rgba8 variant
- */
-boolean
-lp_format_is_rgba8(const struct util_format_description *desc)
-{
- unsigned chan;
-
- if(desc->block.width != 1 ||
- desc->block.height != 1 ||
- desc->block.bits != 32)
- return FALSE;
-
- for(chan = 0; chan < 4; ++chan) {
- if(desc->channel[chan].type != UTIL_FORMAT_TYPE_UNSIGNED &&
- desc->channel[chan].type != UTIL_FORMAT_TYPE_SIGNED &&
- desc->channel[chan].type != UTIL_FORMAT_TYPE_VOID)
- return FALSE;
- if(desc->channel[chan].size != 8)
- return FALSE;
- }
-
- return TRUE;
-}
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c
index abb27e4c32..9f242844e5 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c
@@ -80,6 +80,24 @@ lp_build_format_swizzle_soa(const struct util_format_description *format_desc,
}
+/**
+ * Unpack several pixels in SoA.
+ *
+ * It takes a vector of packed pixels:
+ *
+ * packed = {P0, P1, P2, P3, ..., Pn}
+ *
+ * And will produce four vectors:
+ *
+ * red = {R0, R1, R2, R3, ..., Rn}
+ * green = {G0, G1, G2, G3, ..., Gn}
+ * blue = {B0, B1, B2, B3, ..., Bn}
+ * alpha = {A0, A1, A2, A3, ..., An}
+ *
+ * It requires that a packed pixel fits into an element of the output
+ * channels. The common case is when converting pixel with a depth of 32 bit or
+ * less into floats.
+ */
void
lp_build_unpack_rgba_soa(LLVMBuilderRef builder,
const struct util_format_description *format_desc,
@@ -91,15 +109,17 @@ lp_build_unpack_rgba_soa(LLVMBuilderRef builder,
unsigned start;
unsigned chan;
- /* FIXME: Support more formats */
- assert(format_desc->layout == UTIL_FORMAT_LAYOUT_PLAIN);
+ /* FIXME: Support more pixel formats */
assert(format_desc->block.width == 1);
assert(format_desc->block.height == 1);
- assert(format_desc->block.bits <= 32);
+ assert(format_desc->block.bits <= type.width);
+ /* FIXME: Support more output types */
+ assert(type.floating);
+ assert(type.width == 32);
/* Decode the input vector components */
start = 0;
- for (chan = 0; chan < 4; ++chan) {
+ for (chan = 0; chan < format_desc->nr_channels; ++chan) {
unsigned width = format_desc->channel[chan].size;
unsigned stop = start + width;
LLVMValueRef input;
@@ -108,32 +128,107 @@ lp_build_unpack_rgba_soa(LLVMBuilderRef builder,
switch(format_desc->channel[chan].type) {
case UTIL_FORMAT_TYPE_VOID:
- input = NULL;
+ input = lp_build_undef(type);
break;
case UTIL_FORMAT_TYPE_UNSIGNED:
- if(type.floating) {
- if(start)
- input = LLVMBuildLShr(builder, input, lp_build_int_const_scalar(type, start), "");
- if(stop < format_desc->block.bits) {
- unsigned mask = ((unsigned long long)1 << width) - 1;
- input = LLVMBuildAnd(builder, input, lp_build_int_const_scalar(type, mask), "");
- }
+ /*
+ * Align the LSB
+ */
+
+ if (start) {
+ input = LLVMBuildLShr(builder, input, lp_build_const_int_vec(type, start), "");
+ }
+ /*
+ * Zero the MSBs
+ */
+
+ if (stop < format_desc->block.bits) {
+ unsigned mask = ((unsigned long long)1 << width) - 1;
+ input = LLVMBuildAnd(builder, input, lp_build_const_int_vec(type, mask), "");
+ }
+
+ /*
+ * Type conversion
+ */
+
+ if (type.floating) {
if(format_desc->channel[chan].normalized)
input = lp_build_unsigned_norm_to_float(builder, width, type, input);
else
- input = LLVMBuildFPToSI(builder, input, lp_build_vec_type(type), "");
+ input = LLVMBuildSIToFP(builder, input, lp_build_vec_type(type), "");
+ }
+ else {
+ /* FIXME */
+ assert(0);
+ input = lp_build_undef(type);
+ }
+
+ break;
+
+ case UTIL_FORMAT_TYPE_SIGNED:
+ /*
+ * Align the sign bit first.
+ */
+
+ if (stop < type.width) {
+ unsigned bits = type.width - stop;
+ LLVMValueRef bits_val = lp_build_const_int_vec(type, bits);
+ input = LLVMBuildShl(builder, input, bits_val, "");
+ }
+
+ /*
+ * Align the LSB (with an arithmetic shift to preserve the sign)
+ */
+
+ if (format_desc->channel[chan].size < type.width) {
+ unsigned bits = type.width - format_desc->channel[chan].size;
+ LLVMValueRef bits_val = lp_build_const_int_vec(type, bits);
+ input = LLVMBuildAShr(builder, input, bits_val, "");
+ }
+
+ /*
+ * Type conversion
+ */
+
+ if (type.floating) {
+ input = LLVMBuildSIToFP(builder, input, lp_build_vec_type(type), "");
+ if (format_desc->channel[chan].normalized) {
+ double scale = 1.0 / ((1 << (format_desc->channel[chan].size - 1)) - 1);
+ LLVMValueRef scale_val = lp_build_const_vec(type, scale);
+ input = LLVMBuildMul(builder, input, scale_val, "");
+ }
}
else {
/* FIXME */
assert(0);
input = lp_build_undef(type);
}
+
+ break;
+
+ case UTIL_FORMAT_TYPE_FLOAT:
+ if (type.floating) {
+ assert(start == 0);
+ assert(stop == 32);
+ assert(type.width == 32);
+ input = LLVMBuildBitCast(builder, input, lp_build_vec_type(type), "");
+ }
+ else {
+ /* FIXME */
+ assert(0);
+ input = lp_build_undef(type);
+ }
+ break;
+
+ case UTIL_FORMAT_TYPE_FIXED:
+ assert(0);
+ input = lp_build_undef(type);
break;
default:
- /* fall through */
+ assert(0);
input = lp_build_undef(type);
break;
}
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_interp.c b/src/gallium/auxiliary/gallivm/lp_bld_interp.c
index 2fc894017d..09efb16121 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_interp.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_interp.c
@@ -289,17 +289,17 @@ pos_update(struct lp_build_interp_soa_context *bld, int quad_index)
/* top-right or bottom-right quad in block */
/* build x += xstep */
x = lp_build_add(&bld->base, x,
- lp_build_const_scalar(bld->base.type, xstep));
+ lp_build_const_vec(bld->base.type, xstep));
}
if (quad_index == 2) {
/* bottom-left quad in block */
/* build y += ystep */
y = lp_build_add(&bld->base, y,
- lp_build_const_scalar(bld->base.type, ystep));
+ lp_build_const_vec(bld->base.type, ystep));
/* build x -= xstep */
x = lp_build_sub(&bld->base, x,
- lp_build_const_scalar(bld->base.type, xstep));
+ lp_build_const_vec(bld->base.type, xstep));
}
lp_build_name(x, "pos.x");
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_interp.h b/src/gallium/auxiliary/gallivm/lp_bld_interp.h
index ca958cdf34..a4937bbb04 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_interp.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_interp.h
@@ -41,7 +41,7 @@
#define LP_BLD_INTERP_H
-#include <llvm-c/Core.h>
+#include "gallivm/lp_bld.h"
#include "tgsi/tgsi_exec.h"
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_intr.h b/src/gallium/auxiliary/gallivm/lp_bld_intr.h
index f813f27074..977f767322 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_intr.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_intr.h
@@ -37,7 +37,7 @@
#define LP_BLD_INTR_H
-#include <llvm-c/Core.h>
+#include "gallivm/lp_bld.h"
/**
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_logic.c b/src/gallium/auxiliary/gallivm/lp_bld_logic.c
index 2726747eae..a3b6970116 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_logic.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_logic.c
@@ -42,6 +42,26 @@
#include "lp_bld_logic.h"
+/*
+ * XXX
+ *
+ * Selection with vector conditional like
+ *
+ * select <4 x i1> %C, %A, %B
+ *
+ * is valid IR (e.g. llvm/test/Assembler/vector-select.ll), but it is not
+ * supported on any backend.
+ *
+ * Expanding the boolean vector to full SIMD register width, as in
+ *
+ * sext <4 x i1> %C to <4 x i32>
+ *
+ * is valid and supported (e.g., llvm/test/CodeGen/X86/vec_compare.ll), but
+ * it causes assertion failures in LLVM 2.6. It appears to work correctly on
+ * LLVM 2.7.
+ */
+
+
/**
* Build code to compare two values 'a' and 'b' of 'type' using the given func.
* \param func one of PIPE_FUNC_x
@@ -54,13 +74,11 @@ lp_build_compare(LLVMBuilderRef builder,
LLVMValueRef a,
LLVMValueRef b)
{
- LLVMTypeRef vec_type = lp_build_vec_type(type);
LLVMTypeRef int_vec_type = lp_build_int_vec_type(type);
LLVMValueRef zeros = LLVMConstNull(int_vec_type);
LLVMValueRef ones = LLVMConstAllOnes(int_vec_type);
LLVMValueRef cond;
LLVMValueRef res;
- unsigned i;
assert(func >= PIPE_FUNC_NEVER);
assert(func <= PIPE_FUNC_ALWAYS);
@@ -74,10 +92,12 @@ lp_build_compare(LLVMBuilderRef builder,
/* XXX: It is not clear if we should use the ordered or unordered operators */
+#if HAVE_LLVM < 0x0207
#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
if(type.width * type.length == 128) {
if(type.floating && util_cpu_caps.has_sse) {
/* float[4] comparison */
+ LLVMTypeRef vec_type = lp_build_vec_type(type);
LLVMValueRef args[3];
unsigned cc;
boolean swap;
@@ -147,6 +167,7 @@ lp_build_compare(LLVMBuilderRef builder,
const char *pcmpgt;
LLVMValueRef args[2];
LLVMValueRef res;
+ LLVMTypeRef vec_type = lp_build_vec_type(type);
switch (type.width) {
case 8:
@@ -172,7 +193,7 @@ lp_build_compare(LLVMBuilderRef builder,
if(table[func].gt &&
((type.width == 8 && type.sign) ||
(type.width != 8 && !type.sign))) {
- LLVMValueRef msb = lp_build_int_const_scalar(type, (unsigned long long)1 << (type.width - 1));
+ LLVMValueRef msb = lp_build_const_int_vec(type, (unsigned long long)1 << (type.width - 1));
a = LLVMBuildXor(builder, a, msb, "");
b = LLVMBuildXor(builder, b, msb, "");
}
@@ -198,8 +219,9 @@ lp_build_compare(LLVMBuilderRef builder,
return res;
}
- }
+ } /* if (type.width * type.length == 128) */
#endif
+#endif /* HAVE_LLVM < 0x0207 */
if(type.floating) {
LLVMRealPredicate op;
@@ -233,25 +255,33 @@ lp_build_compare(LLVMBuilderRef builder,
return lp_build_undef(type);
}
-#if 0
- /* XXX: Although valid IR, no LLVM target currently support this */
+#if HAVE_LLVM >= 0x0207
cond = LLVMBuildFCmp(builder, op, a, b, "");
- res = LLVMBuildSelect(builder, cond, ones, zeros, "");
+ res = LLVMBuildSExt(builder, cond, int_vec_type, "");
#else
- debug_printf("%s: warning: using slow element-wise vector comparison\n",
- __FUNCTION__);
- res = LLVMGetUndef(int_vec_type);
- for(i = 0; i < type.length; ++i) {
- LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), i, 0);
- cond = LLVMBuildFCmp(builder, op,
- LLVMBuildExtractElement(builder, a, index, ""),
- LLVMBuildExtractElement(builder, b, index, ""),
- "");
- cond = LLVMBuildSelect(builder, cond,
- LLVMConstExtractElement(ones, index),
- LLVMConstExtractElement(zeros, index),
- "");
- res = LLVMBuildInsertElement(builder, res, cond, index, "");
+ if (type.length == 1) {
+ cond = LLVMBuildFCmp(builder, op, a, b, "");
+ res = LLVMBuildSExt(builder, cond, int_vec_type, "");
+ }
+ else {
+ unsigned i;
+
+ res = LLVMGetUndef(int_vec_type);
+
+ debug_printf("%s: warning: using slow element-wise float"
+ " vector comparison\n", __FUNCTION__);
+ for (i = 0; i < type.length; ++i) {
+ LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), i, 0);
+ cond = LLVMBuildFCmp(builder, op,
+ LLVMBuildExtractElement(builder, a, index, ""),
+ LLVMBuildExtractElement(builder, b, index, ""),
+ "");
+ cond = LLVMBuildSelect(builder, cond,
+ LLVMConstExtractElement(ones, index),
+ LLVMConstExtractElement(zeros, index),
+ "");
+ res = LLVMBuildInsertElement(builder, res, cond, index, "");
+ }
}
#endif
}
@@ -281,25 +311,34 @@ lp_build_compare(LLVMBuilderRef builder,
return lp_build_undef(type);
}
-#if 0
- /* XXX: Although valid IR, no LLVM target currently support this */
+#if HAVE_LLVM >= 0x0207
cond = LLVMBuildICmp(builder, op, a, b, "");
- res = LLVMBuildSelect(builder, cond, ones, zeros, "");
+ res = LLVMBuildSExt(builder, cond, int_vec_type, "");
#else
- debug_printf("%s: warning: using slow element-wise int vector comparison\n",
- __FUNCTION__);
- res = LLVMGetUndef(int_vec_type);
- for(i = 0; i < type.length; ++i) {
- LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), i, 0);
- cond = LLVMBuildICmp(builder, op,
- LLVMBuildExtractElement(builder, a, index, ""),
- LLVMBuildExtractElement(builder, b, index, ""),
- "");
- cond = LLVMBuildSelect(builder, cond,
- LLVMConstExtractElement(ones, index),
- LLVMConstExtractElement(zeros, index),
- "");
- res = LLVMBuildInsertElement(builder, res, cond, index, "");
+ if (type.length == 1) {
+ cond = LLVMBuildICmp(builder, op, a, b, "");
+ res = LLVMBuildSExt(builder, cond, int_vec_type, "");
+ }
+ else {
+ unsigned i;
+
+ res = LLVMGetUndef(int_vec_type);
+
+ debug_printf("%s: warning: using slow element-wise int"
+ " vector comparison\n", __FUNCTION__);
+
+ for(i = 0; i < type.length; ++i) {
+ LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), i, 0);
+ cond = LLVMBuildICmp(builder, op,
+ LLVMBuildExtractElement(builder, a, index, ""),
+ LLVMBuildExtractElement(builder, b, index, ""),
+ "");
+ cond = LLVMBuildSelect(builder, cond,
+ LLVMConstExtractElement(ones, index),
+ LLVMConstExtractElement(zeros, index),
+ "");
+ res = LLVMBuildInsertElement(builder, res, cond, index, "");
+ }
}
#endif
}
@@ -326,6 +365,8 @@ lp_build_cmp(struct lp_build_context *bld,
/**
* Return mask ? a : b;
+ *
+ * mask is a bitwise mask, composed of 0 or ~0 for each element.
*/
LLVMValueRef
lp_build_select(struct lp_build_context *bld,
@@ -339,26 +380,32 @@ lp_build_select(struct lp_build_context *bld,
if(a == b)
return a;
- if(type.floating) {
- LLVMTypeRef int_vec_type = lp_build_int_vec_type(type);
- a = LLVMBuildBitCast(bld->builder, a, int_vec_type, "");
- b = LLVMBuildBitCast(bld->builder, b, int_vec_type, "");
+ if (type.length == 1) {
+ mask = LLVMBuildTrunc(bld->builder, mask, LLVMInt1Type(), "");
+ res = LLVMBuildSelect(bld->builder, mask, a, b, "");
}
+ else {
+ if(type.floating) {
+ LLVMTypeRef int_vec_type = lp_build_int_vec_type(type);
+ a = LLVMBuildBitCast(bld->builder, a, int_vec_type, "");
+ b = LLVMBuildBitCast(bld->builder, b, int_vec_type, "");
+ }
- a = LLVMBuildAnd(bld->builder, a, mask, "");
+ a = LLVMBuildAnd(bld->builder, a, mask, "");
- /* This often gets translated to PANDN, but sometimes the NOT is
- * pre-computed and stored in another constant. The best strategy depends
- * on available registers, so it is not a big deal -- hopefully LLVM does
- * the right decision attending the rest of the program.
- */
- b = LLVMBuildAnd(bld->builder, b, LLVMBuildNot(bld->builder, mask, ""), "");
+ /* This often gets translated to PANDN, but sometimes the NOT is
+ * pre-computed and stored in another constant. The best strategy depends
+ * on available registers, so it is not a big deal -- hopefully LLVM does
+ * the right decision attending the rest of the program.
+ */
+ b = LLVMBuildAnd(bld->builder, b, LLVMBuildNot(bld->builder, mask, ""), "");
- res = LLVMBuildOr(bld->builder, a, b, "");
+ res = LLVMBuildOr(bld->builder, a, b, "");
- if(type.floating) {
- LLVMTypeRef vec_type = lp_build_vec_type(type);
- res = LLVMBuildBitCast(bld->builder, res, vec_type, "");
+ if(type.floating) {
+ LLVMTypeRef vec_type = lp_build_vec_type(type);
+ res = LLVMBuildBitCast(bld->builder, res, vec_type, "");
+ }
}
return res;
@@ -436,3 +483,13 @@ lp_build_alloca(struct lp_build_context *bld)
return LLVMBuildAlloca(bld->builder, lp_build_elem_type(type), "");
}
}
+
+
+/** Return (a & ~b) */
+LLVMValueRef
+lp_build_andc(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b)
+{
+ b = LLVMBuildNot(bld->builder, b, "");
+ b = LLVMBuildAnd(bld->builder, a, b, "");
+ return b;
+}
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_logic.h b/src/gallium/auxiliary/gallivm/lp_bld_logic.h
index a399ebf39e..00a8c75019 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_logic.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_logic.h
@@ -37,7 +37,7 @@
#define LP_BLD_LOGIC_H
-#include <llvm-c/Core.h>
+#include "gallivm/lp_bld.h"
#include "pipe/p_defines.h" /* For PIPE_FUNC_xxx */
@@ -79,4 +79,9 @@ lp_build_select_aos(struct lp_build_context *bld,
LLVMValueRef
lp_build_alloca(struct lp_build_context *bld);
+
+LLVMValueRef
+lp_build_andc(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b);
+
+
#endif /* !LP_BLD_LOGIC_H */
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_pack.c b/src/gallium/auxiliary/gallivm/lp_bld_pack.c
index bc360ad77a..2daa8a3b58 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_pack.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_pack.c
@@ -164,7 +164,7 @@ lp_build_unpack2(LLVMBuilderRef builder,
if(dst_type.sign && src_type.sign) {
/* Replicate the sign bit in the most significant bits */
- msb = LLVMBuildAShr(builder, src, lp_build_int_const_scalar(src_type, src_type.width - 1), "");
+ msb = LLVMBuildAShr(builder, src, lp_build_const_int_vec(src_type, src_type.width - 1), "");
}
else
/* Most significant bits always zero */
@@ -256,7 +256,9 @@ lp_build_pack2(LLVMBuilderRef builder,
LLVMValueRef lo,
LLVMValueRef hi)
{
+#if HAVE_LLVM < 0x0207
LLVMTypeRef src_vec_type = lp_build_vec_type(src_type);
+#endif
LLVMTypeRef dst_vec_type = lp_build_vec_type(dst_type);
LLVMValueRef shuffle;
LLVMValueRef res;
@@ -272,11 +274,14 @@ lp_build_pack2(LLVMBuilderRef builder,
switch(src_type.width) {
case 32:
if(dst_type.sign) {
+#if HAVE_LLVM >= 0x0207
+ res = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packssdw.128", dst_vec_type, lo, hi);
+#else
res = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packssdw.128", src_vec_type, lo, hi);
+#endif
}
else {
if (util_cpu_caps.has_sse4_1) {
- /* PACKUSDW is the only instrinsic with a consistent signature */
return lp_build_intrinsic_binary(builder, "llvm.x86.sse41.packusdw", dst_vec_type, lo, hi);
}
else {
@@ -288,9 +293,17 @@ lp_build_pack2(LLVMBuilderRef builder,
case 16:
if(dst_type.sign)
+#if HAVE_LLVM >= 0x0207
+ res = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packsswb.128", dst_vec_type, lo, hi);
+#else
res = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packsswb.128", src_vec_type, lo, hi);
+#endif
else
+#if HAVE_LLVM >= 0x0207
+ res = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packuswb.128", dst_vec_type, lo, hi);
+#else
res = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packuswb.128", src_vec_type, lo, hi);
+#endif
break;
default:
@@ -348,7 +361,7 @@ lp_build_packs2(LLVMBuilderRef builder,
if(clamp) {
struct lp_build_context bld;
unsigned dst_bits = dst_type.sign ? dst_type.width - 1 : dst_type.width;
- LLVMValueRef dst_max = lp_build_int_const_scalar(src_type, ((unsigned long long)1 << dst_bits) - 1);
+ LLVMValueRef dst_max = lp_build_const_int_vec(src_type, ((unsigned long long)1 << dst_bits) - 1);
lp_build_context_init(&bld, builder, src_type);
lo = lp_build_min(&bld, lo, dst_max);
hi = lp_build_min(&bld, hi, dst_max);
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_pack.h b/src/gallium/auxiliary/gallivm/lp_bld_pack.h
index fb2a34984a..41adeed220 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_pack.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_pack.h
@@ -37,7 +37,7 @@
#define LP_BLD_PACK_H
-#include <llvm-c/Core.h>
+#include "gallivm/lp_bld.h"
struct lp_type;
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_printf.c b/src/gallium/auxiliary/gallivm/lp_bld_printf.c
new file mode 100644
index 0000000000..153ba5b15b
--- /dev/null
+++ b/src/gallium/auxiliary/gallivm/lp_bld_printf.c
@@ -0,0 +1,121 @@
+/**************************************************************************
+ *
+ * Copyright 2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#include <stdio.h>
+
+#include "util/u_debug.h"
+#include "util/u_memory.h"
+#include "lp_bld_printf.h"
+
+
+static int
+lp_get_printf_arg_count(const char *fmt)
+{
+ int count =0;
+ const char *p = fmt;
+ int c;
+
+ while ((c = *p++)) {
+ if (c != '%')
+ continue;
+ switch (*p) {
+ case '\0':
+ continue;
+ case '%':
+ p++;
+ continue;
+ case '.':
+ if (p[1] == '*' && p[2] == 's') {
+ count += 2;
+ p += 3;
+ continue;
+ }
+ /* fallthrough */
+ default:
+ count ++;
+ }
+ }
+ return count;
+}
+
+LLVMValueRef
+lp_build_const_string_variable(LLVMModuleRef module, const char *str, int len)
+{
+ LLVMValueRef string = LLVMAddGlobal(module, LLVMArrayType(LLVMInt8Type(), len + 1), "");
+ LLVMSetGlobalConstant(string, TRUE);
+ LLVMSetLinkage(string, LLVMInternalLinkage);
+ LLVMSetInitializer(string, LLVMConstString(str, len + 1, TRUE));
+ return string;
+}
+
+
+/**
+ * lp_build_printf.
+ *
+ * Build printf call in LLVM IR. The output goes to stdout.
+ * The additional variable arguments need to have type
+ * LLVMValueRef.
+ */
+LLVMValueRef
+lp_build_printf(LLVMBuilderRef builder, const char *fmt, ...)
+{
+ va_list arglist;
+ int i = 0;
+ int argcount = lp_get_printf_arg_count(fmt);
+ LLVMModuleRef module = LLVMGetGlobalParent(LLVMGetBasicBlockParent(LLVMGetInsertBlock(builder)));
+ LLVMValueRef params[50];
+ LLVMValueRef fmtarg = lp_build_const_string_variable(module, fmt, strlen(fmt) + 1);
+ LLVMValueRef int0 = LLVMConstInt(LLVMInt32Type(), 0, 0);
+ LLVMValueRef index[2];
+ LLVMValueRef func_printf = LLVMGetNamedFunction(module, "printf");
+
+ assert(Elements(params) >= argcount + 1);
+
+ index[0] = index[1] = int0;
+
+ if (!func_printf) {
+ LLVMTypeRef printf_type = LLVMFunctionType(LLVMIntType(32), NULL, 0, 1);
+ func_printf = LLVMAddFunction(module, "printf", printf_type);
+ }
+
+ params[0] = LLVMBuildGEP(builder, fmtarg, index, 2, "");
+
+ va_start(arglist, fmt);
+ for (i = 1; i <= argcount; i++) {
+ LLVMValueRef val = va_arg(arglist, LLVMValueRef);
+ LLVMTypeRef type = LLVMTypeOf(val);
+ /* printf wants doubles, so lets convert so that
+ * we can actually print them */
+ if (LLVMGetTypeKind(type) == LLVMFloatTypeKind)
+ val = LLVMBuildFPExt(builder, val, LLVMDoubleType(), "");
+ params[i] = val;
+ }
+ va_end(arglist);
+
+ return LLVMBuildCall(builder, func_printf, params, argcount + 1, "");
+}
+
diff --git a/src/gallium/drivers/cell/ppu/cell_winsys.h b/src/gallium/auxiliary/gallivm/lp_bld_printf.h
index e227e065ff..83bd8f1d55 100644
--- a/src/gallium/drivers/cell/ppu/cell_winsys.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_printf.h
@@ -1,8 +1,8 @@
/**************************************************************************
- *
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
+ *
+ * Copyright 2010 VMware, Inc.
* All Rights Reserved.
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
@@ -10,38 +10,30 @@
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
- *
+ *
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
+ *
**************************************************************************/
+#ifndef LP_BLD_PRINTF_H
+#define LP_BLD_PRINTF_H
-#ifndef CELL_WINSYS_H
-#define CELL_WINSYS_H
#include "pipe/p_compiler.h"
+#include "lp_bld.h"
-
-/**
- * Very simple winsys at this time.
- * Will probably eventually add SPU control info.
- */
-struct cell_winsys
-{
- uint dummy;
-};
-
-
-
+LLVMValueRef lp_build_const_string_variable(LLVMModuleRef module, const char *str, int len);
+LLVMValueRef lp_build_printf(LLVMBuilderRef builder, const char *fmt, ...);
#endif
+
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
index 6a026e468e..bb76ad4c6b 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
@@ -62,6 +62,18 @@ lp_sampler_static_state(struct lp_sampler_static_state *state,
if(!sampler)
return;
+ /*
+ * We don't copy sampler state over unless it is actually enabled, to avoid
+ * spurious recompiles, as the sampler static state is part of the shader
+ * key.
+ *
+ * Ideally the state tracker or cso_cache module would make all state
+ * canonical, but until that happens it's better to be safe than sorry here.
+ *
+ * XXX: Actually there's much more than can be done here, especially
+ * regarding 1D/2D/3D/CUBE textures, wrap modes, etc.
+ */
+
state->format = texture->format;
state->target = texture->target;
state->pot_width = util_is_pot(texture->width0);
@@ -72,10 +84,18 @@ lp_sampler_static_state(struct lp_sampler_static_state *state,
state->wrap_t = sampler->wrap_t;
state->wrap_r = sampler->wrap_r;
state->min_img_filter = sampler->min_img_filter;
- state->min_mip_filter = sampler->min_mip_filter;
state->mag_img_filter = sampler->mag_img_filter;
+ if (texture->last_level) {
+ state->min_mip_filter = sampler->min_mip_filter;
+ } else {
+ state->min_mip_filter = PIPE_TEX_MIPFILTER_NONE;
+ }
+
state->compare_mode = sampler->compare_mode;
- state->compare_func = sampler->compare_func;
+ if (sampler->compare_mode != PIPE_TEX_COMPARE_NONE) {
+ state->compare_func = sampler->compare_func;
+ }
+
state->normalized_coords = sampler->normalized_coords;
state->lod_bias = sampler->lod_bias;
state->min_lod = sampler->min_lod;
@@ -139,20 +159,21 @@ lp_build_gather(LLVMBuilderRef builder,
/**
* Compute the offset of a pixel.
*
- * x, y, y_stride are vectors
+ * x, y, z, y_stride, z_stride are vectors
*/
LLVMValueRef
lp_build_sample_offset(struct lp_build_context *bld,
const struct util_format_description *format_desc,
LLVMValueRef x,
LLVMValueRef y,
+ LLVMValueRef z,
LLVMValueRef y_stride,
- LLVMValueRef data_ptr)
+ LLVMValueRef z_stride)
{
LLVMValueRef x_stride;
LLVMValueRef offset;
- x_stride = lp_build_const_scalar(bld->type, format_desc->block.bits/8);
+ x_stride = lp_build_const_vec(bld->type, format_desc->block.bits/8);
if(format_desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS) {
LLVMValueRef x_lo, x_hi;
@@ -163,6 +184,10 @@ lp_build_sample_offset(struct lp_build_context *bld,
LLVMValueRef y_offset_lo, y_offset_hi;
LLVMValueRef offset_lo, offset_hi;
+ /* XXX 1D & 3D addressing not done yet */
+ assert(!z);
+ assert(!z_stride);
+
x_lo = LLVMBuildAnd(bld->builder, x, bld->one, "");
y_lo = LLVMBuildAnd(bld->builder, y, bld->one, "");
@@ -170,9 +195,9 @@ lp_build_sample_offset(struct lp_build_context *bld,
y_hi = LLVMBuildLShr(bld->builder, y, bld->one, "");
x_stride_lo = x_stride;
- y_stride_lo = lp_build_const_scalar(bld->type, 2*format_desc->block.bits/8);
+ y_stride_lo = lp_build_const_vec(bld->type, 2*format_desc->block.bits/8);
- x_stride_hi = lp_build_const_scalar(bld->type, 4*format_desc->block.bits/8);
+ x_stride_hi = lp_build_const_vec(bld->type, 4*format_desc->block.bits/8);
y_stride_hi = LLVMBuildShl(bld->builder, y_stride, bld->one, "");
x_offset_lo = lp_build_mul(bld, x_lo, x_stride_lo);
@@ -186,13 +211,17 @@ lp_build_sample_offset(struct lp_build_context *bld,
offset = lp_build_add(bld, offset_hi, offset_lo);
}
else {
- LLVMValueRef x_offset;
- LLVMValueRef y_offset;
+ offset = lp_build_mul(bld, x, x_stride);
- x_offset = lp_build_mul(bld, x, x_stride);
- y_offset = lp_build_mul(bld, y, y_stride);
+ if (y && y_stride) {
+ LLVMValueRef y_offset = lp_build_mul(bld, y, y_stride);
+ offset = lp_build_add(bld, offset, y_offset);
+ }
- offset = lp_build_add(bld, x_offset, y_offset);
+ if (z && z_stride) {
+ LLVMValueRef z_offset = lp_build_mul(bld, z, z_stride);
+ offset = lp_build_add(bld, offset, z_offset);
+ }
}
return offset;
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h b/src/gallium/auxiliary/gallivm/lp_bld_sample.h
index 5ba0925bb6..92f3c57435 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h
@@ -36,7 +36,7 @@
#define LP_BLD_SAMPLE_H
-#include <llvm-c/Core.h>
+#include "gallivm/lp_bld.h"
struct pipe_texture;
struct pipe_sampler_state;
@@ -113,9 +113,9 @@ struct lp_sampler_dynamic_state
unsigned unit);
LLVMValueRef
- (*stride)( struct lp_sampler_dynamic_state *state,
- LLVMBuilderRef builder,
- unsigned unit);
+ (*row_stride)( struct lp_sampler_dynamic_state *state,
+ LLVMBuilderRef builder,
+ unsigned unit);
LLVMValueRef
(*data_ptr)( struct lp_sampler_dynamic_state *state,
@@ -148,8 +148,9 @@ lp_build_sample_offset(struct lp_build_context *bld,
const struct util_format_description *format_desc,
LLVMValueRef x,
LLVMValueRef y,
+ LLVMValueRef z,
LLVMValueRef y_stride,
- LLVMValueRef data_ptr);
+ LLVMValueRef z_stride);
void
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
index 9058f76c1d..5b56f2cf3b 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -48,6 +48,7 @@
#include "lp_bld_logic.h"
#include "lp_bld_swizzle.h"
#include "lp_bld_pack.h"
+#include "lp_bld_flow.h"
#include "lp_bld_format.h"
#include "lp_bld_sample.h"
@@ -65,6 +66,14 @@ struct lp_build_sample_context
const struct util_format_description *format_desc;
+ /** regular scalar float type */
+ struct lp_type float_type;
+ struct lp_build_context float_bld;
+
+ /** regular scalar float type */
+ struct lp_type int_type;
+ struct lp_build_context int_bld;
+
/** Incoming coordinates type and build context */
struct lp_type coord_type;
struct lp_build_context coord_bld;
@@ -108,9 +117,78 @@ wrap_mode_uses_border_color(unsigned mode)
}
+static LLVMValueRef
+lp_build_get_mipmap_level(struct lp_build_sample_context *bld,
+ LLVMValueRef data_array, LLVMValueRef level)
+{
+ LLVMValueRef indexes[2], data_ptr;
+ indexes[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
+ indexes[1] = level;
+ data_ptr = LLVMBuildGEP(bld->builder, data_array, indexes, 2, "");
+ data_ptr = LLVMBuildLoad(bld->builder, data_ptr, "");
+ return data_ptr;
+}
+
+
+static LLVMValueRef
+lp_build_get_const_mipmap_level(struct lp_build_sample_context *bld,
+ LLVMValueRef data_array, int level)
+{
+ LLVMValueRef lvl = LLVMConstInt(LLVMInt32Type(), level, 0);
+ return lp_build_get_mipmap_level(bld, data_array, lvl);
+}
+
+
+/**
+ * Dereference stride_array[mipmap_level] array to get a stride.
+ * Return stride as a vector.
+ */
+static LLVMValueRef
+lp_build_get_level_stride_vec(struct lp_build_sample_context *bld,
+ LLVMValueRef stride_array, LLVMValueRef level)
+{
+ LLVMValueRef indexes[2], stride;
+ indexes[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
+ indexes[1] = level;
+ stride = LLVMBuildGEP(bld->builder, stride_array, indexes, 2, "");
+ stride = LLVMBuildLoad(bld->builder, stride, "");
+ stride = lp_build_broadcast_scalar(&bld->int_coord_bld, stride);
+ return stride;
+}
+
+
+/** Dereference stride_array[0] array to get a stride (as vector). */
+static LLVMValueRef
+lp_build_get_const_level_stride_vec(struct lp_build_sample_context *bld,
+ LLVMValueRef stride_array, int level)
+{
+ LLVMValueRef lvl = LLVMConstInt(LLVMInt32Type(), level, 0);
+ return lp_build_get_level_stride_vec(bld, stride_array, lvl);
+}
+
+
+static int
+texture_dims(enum pipe_texture_target tex)
+{
+ switch (tex) {
+ case PIPE_TEXTURE_1D:
+ return 1;
+ case PIPE_TEXTURE_2D:
+ case PIPE_TEXTURE_CUBE:
+ return 2;
+ case PIPE_TEXTURE_3D:
+ return 3;
+ default:
+ assert(0 && "bad texture target in texture_dims()");
+ return 2;
+ }
+}
+
+
/**
- * Gen code to fetch a texel from a texture at int coords (x, y).
+ * Generate code to fetch a texel from a texture at int coords (x, y, z).
+ * The computation depends on whether the texture is 1D, 2D or 3D.
* The result, texel, will be:
* texel[0] = red values
* texel[1] = green values
@@ -121,12 +199,16 @@ static void
lp_build_sample_texel_soa(struct lp_build_sample_context *bld,
LLVMValueRef width,
LLVMValueRef height,
+ LLVMValueRef depth,
LLVMValueRef x,
LLVMValueRef y,
+ LLVMValueRef z,
LLVMValueRef y_stride,
+ LLVMValueRef z_stride,
LLVMValueRef data_ptr,
LLVMValueRef *texel)
{
+ const int dims = texture_dims(bld->static_state->target);
struct lp_build_context *int_coord_bld = &bld->int_coord_bld;
LLVMValueRef offset;
LLVMValueRef packed;
@@ -140,7 +222,7 @@ lp_build_sample_texel_soa(struct lp_build_sample_context *bld,
use_border = LLVMBuildOr(bld->builder, b1, b2, "b1_or_b2");
}
- if (wrap_mode_uses_border_color(bld->static_state->wrap_t)) {
+ if (dims >= 2 && wrap_mode_uses_border_color(bld->static_state->wrap_t)) {
LLVMValueRef b1, b2;
b1 = lp_build_cmp(int_coord_bld, PIPE_FUNC_LESS, y, int_coord_bld->zero);
b2 = lp_build_cmp(int_coord_bld, PIPE_FUNC_GEQUAL, y, height);
@@ -153,6 +235,19 @@ lp_build_sample_texel_soa(struct lp_build_sample_context *bld,
}
}
+ if (dims == 3 && wrap_mode_uses_border_color(bld->static_state->wrap_r)) {
+ LLVMValueRef b1, b2;
+ b1 = lp_build_cmp(int_coord_bld, PIPE_FUNC_LESS, z, int_coord_bld->zero);
+ b2 = lp_build_cmp(int_coord_bld, PIPE_FUNC_GEQUAL, z, depth);
+ if (use_border) {
+ use_border = LLVMBuildOr(bld->builder, use_border, b1, "ub_or_b1");
+ use_border = LLVMBuildOr(bld->builder, use_border, b2, "ub_or_b2");
+ }
+ else {
+ use_border = LLVMBuildOr(bld->builder, b1, b2, "b1_or_b2");
+ }
+ }
+
/*
* Note: if we find an app which frequently samples the texture border
* we might want to implement a true conditional here to avoid sampling
@@ -168,11 +263,10 @@ lp_build_sample_texel_soa(struct lp_build_sample_context *bld,
* the texel color results with the border color.
*/
- /* convert x,y coords to linear offset from start of texture, in bytes */
+ /* convert x,y,z coords to linear offset from start of texture, in bytes */
offset = lp_build_sample_offset(&bld->uint_coord_bld,
bld->format_desc,
- x, y, y_stride,
- data_ptr);
+ x, y, z, y_stride, z_stride);
assert(bld->format_desc->block.width == 1);
assert(bld->format_desc->block.height == 1);
@@ -185,6 +279,8 @@ lp_build_sample_texel_soa(struct lp_build_sample_context *bld,
bld->texel_type.width,
data_ptr, offset);
+ texel[0] = texel[1] = texel[2] = texel[3] = NULL;
+
/* convert texels to float rgba */
lp_build_unpack_rgba_soa(bld->builder,
bld->format_desc,
@@ -196,7 +292,7 @@ lp_build_sample_texel_soa(struct lp_build_sample_context *bld,
int chan;
for (chan = 0; chan < 4; chan++) {
LLVMValueRef border_chan =
- lp_build_const_scalar(bld->texel_type,
+ lp_build_const_vec(bld->texel_type,
bld->static_state->border_color[chan]);
texel[chan] = lp_build_select(&bld->texel_bld, use_border,
border_chan, texel[chan]);
@@ -210,19 +306,22 @@ lp_build_sample_packed(struct lp_build_sample_context *bld,
LLVMValueRef x,
LLVMValueRef y,
LLVMValueRef y_stride,
- LLVMValueRef data_ptr)
+ LLVMValueRef data_array)
{
LLVMValueRef offset;
+ LLVMValueRef data_ptr;
offset = lp_build_sample_offset(&bld->uint_coord_bld,
bld->format_desc,
- x, y, y_stride,
- data_ptr);
+ x, y, NULL, y_stride, NULL);
assert(bld->format_desc->block.width == 1);
assert(bld->format_desc->block.height == 1);
assert(bld->format_desc->block.bits <= bld->texel_type.width);
+ /* get pointer to mipmap level 0 data */
+ data_ptr = lp_build_get_const_mipmap_level(bld, data_array, 0);
+
return lp_build_gather(bld->builder,
bld->texel_type.length,
bld->format_desc->block.bits,
@@ -358,8 +457,8 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context *bld,
struct lp_build_context *coord_bld = &bld->coord_bld;
struct lp_build_context *int_coord_bld = &bld->int_coord_bld;
struct lp_build_context *uint_coord_bld = &bld->uint_coord_bld;
- LLVMValueRef two = lp_build_const_scalar(coord_bld->type, 2.0);
- LLVMValueRef half = lp_build_const_scalar(coord_bld->type, 0.5);
+ LLVMValueRef two = lp_build_const_vec(coord_bld->type, 2.0);
+ LLVMValueRef half = lp_build_const_vec(coord_bld->type, 0.5);
LLVMValueRef length_f = lp_build_int_to_float(coord_bld, length);
LLVMValueRef length_minus_one = lp_build_sub(uint_coord_bld, length, uint_coord_bld->one);
LLVMValueRef length_f_minus_one = lp_build_sub(coord_bld, length_f, coord_bld->one);
@@ -413,7 +512,7 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context *bld,
else {
LLVMValueRef min, max;
/* clamp to [0.5, length - 0.5] */
- min = lp_build_const_scalar(coord_bld->type, 0.5F);
+ min = lp_build_const_vec(coord_bld->type, 0.5F);
max = lp_build_sub(coord_bld, length_f, min);
coord = lp_build_clamp(coord_bld, coord, min, max);
}
@@ -434,7 +533,7 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context *bld,
if (bld->static_state->normalized_coords) {
/* min = -1.0 / (2 * length) = -0.5 / length */
min = lp_build_mul(coord_bld,
- lp_build_const_scalar(coord_bld->type, -0.5F),
+ lp_build_const_vec(coord_bld->type, -0.5F),
lp_build_rcp(coord_bld, length_f));
/* max = 1.0 - min */
max = lp_build_sub(coord_bld, coord_bld->one, min);
@@ -446,7 +545,7 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context *bld,
}
else {
/* clamp to [-0.5, length + 0.5] */
- min = lp_build_const_scalar(coord_bld->type, -0.5F);
+ min = lp_build_const_vec(coord_bld->type, -0.5F);
max = lp_build_sub(coord_bld, length_f, min);
coord = lp_build_clamp(coord_bld, coord, min, max);
coord = lp_build_sub(coord_bld, coord, half);
@@ -521,7 +620,7 @@ lp_build_sample_wrap_linear(struct lp_build_sample_context *bld,
LLVMValueRef min, max;
/* min = -1.0 / (2 * length) = -0.5 / length */
min = lp_build_mul(coord_bld,
- lp_build_const_scalar(coord_bld->type, -0.5F),
+ lp_build_const_vec(coord_bld->type, -0.5F),
lp_build_rcp(coord_bld, length_f));
/* max = 1.0 - min */
max = lp_build_sub(coord_bld, coord_bld->one, min);
@@ -566,7 +665,7 @@ lp_build_sample_wrap_nearest(struct lp_build_sample_context *bld,
struct lp_build_context *coord_bld = &bld->coord_bld;
struct lp_build_context *int_coord_bld = &bld->int_coord_bld;
struct lp_build_context *uint_coord_bld = &bld->uint_coord_bld;
- LLVMValueRef two = lp_build_const_scalar(coord_bld->type, 2.0);
+ LLVMValueRef two = lp_build_const_vec(coord_bld->type, 2.0);
LLVMValueRef length_f = lp_build_int_to_float(coord_bld, length);
LLVMValueRef length_minus_one = lp_build_sub(uint_coord_bld, length, uint_coord_bld->one);
LLVMValueRef length_f_minus_one = lp_build_sub(coord_bld, length_f, coord_bld->one);
@@ -609,7 +708,7 @@ lp_build_sample_wrap_nearest(struct lp_build_sample_context *bld,
}
else {
/* clamp to [0.5, length - 0.5] */
- min = lp_build_const_scalar(coord_bld->type, 0.5F);
+ min = lp_build_const_vec(coord_bld->type, 0.5F);
max = lp_build_sub(coord_bld, length_f, min);
}
/* coord = clamp(coord, min, max) */
@@ -625,7 +724,7 @@ lp_build_sample_wrap_nearest(struct lp_build_sample_context *bld,
if (bld->static_state->normalized_coords) {
/* min = -1.0 / (2 * length) = -0.5 / length */
min = lp_build_mul(coord_bld,
- lp_build_const_scalar(coord_bld->type, -0.5F),
+ lp_build_const_vec(coord_bld->type, -0.5F),
lp_build_rcp(coord_bld, length_f));
/* max = length - min */
max = lp_build_sub(coord_bld, length_f, min);
@@ -634,7 +733,7 @@ lp_build_sample_wrap_nearest(struct lp_build_sample_context *bld,
}
else {
/* clamp to [-0.5, length + 0.5] */
- min = lp_build_const_scalar(coord_bld->type, -0.5F);
+ min = lp_build_const_vec(coord_bld->type, -0.5F);
max = lp_build_sub(coord_bld, length_f, min);
}
/* coord = clamp(coord, min, max) */
@@ -711,83 +810,905 @@ lp_build_sample_wrap_nearest(struct lp_build_sample_context *bld,
/**
- * Sample 2D texture with nearest filtering.
+ * Codegen equivalent for u_minify().
+ * Return max(1, base_size >> level);
+ */
+static LLVMValueRef
+lp_build_minify(struct lp_build_sample_context *bld,
+ LLVMValueRef base_size,
+ LLVMValueRef level)
+{
+ LLVMValueRef size = LLVMBuildAShr(bld->builder, base_size, level, "minify");
+ size = lp_build_max(&bld->int_coord_bld, size, bld->int_coord_bld.one);
+ return size;
+}
+
+
+/**
+ * Generate code to compute texture level of detail (lambda).
+ * \param s vector of texcoord s values
+ * \param t vector of texcoord t values
+ * \param r vector of texcoord r values
+ * \param width scalar int texture width
+ * \param height scalar int texture height
+ * \param depth scalar int texture depth
+ */
+static LLVMValueRef
+lp_build_lod_selector(struct lp_build_sample_context *bld,
+ LLVMValueRef s,
+ LLVMValueRef t,
+ LLVMValueRef r,
+ LLVMValueRef width,
+ LLVMValueRef height,
+ LLVMValueRef depth)
+
+{
+ if (bld->static_state->min_lod == bld->static_state->max_lod) {
+ /* User is forcing sampling from a particular mipmap level.
+ * This is hit during mipmap generation.
+ */
+ return LLVMConstReal(LLVMFloatType(), bld->static_state->min_lod);
+ }
+ else {
+ const int dims = texture_dims(bld->static_state->target);
+ struct lp_build_context *float_bld = &bld->float_bld;
+ LLVMValueRef lod_bias = LLVMConstReal(LLVMFloatType(),
+ bld->static_state->lod_bias);
+ LLVMValueRef min_lod = LLVMConstReal(LLVMFloatType(),
+ bld->static_state->min_lod);
+ LLVMValueRef max_lod = LLVMConstReal(LLVMFloatType(),
+ bld->static_state->max_lod);
+
+ LLVMValueRef index0 = LLVMConstInt(LLVMInt32Type(), 0, 0);
+ LLVMValueRef index1 = LLVMConstInt(LLVMInt32Type(), 1, 0);
+ LLVMValueRef index2 = LLVMConstInt(LLVMInt32Type(), 2, 0);
+
+ LLVMValueRef s0, s1, s2;
+ LLVMValueRef t0, t1, t2;
+ LLVMValueRef r0, r1, r2;
+ LLVMValueRef dsdx, dsdy, dtdx, dtdy, drdx, drdy;
+ LLVMValueRef rho, lod;
+
+ /*
+ * dsdx = abs(s[1] - s[0]);
+ * dsdy = abs(s[2] - s[0]);
+ * dtdx = abs(t[1] - t[0]);
+ * dtdy = abs(t[2] - t[0]);
+ * drdx = abs(r[1] - r[0]);
+ * drdy = abs(r[2] - r[0]);
+ * XXX we're assuming a four-element quad in 2x2 layout here.
+ */
+ s0 = LLVMBuildExtractElement(bld->builder, s, index0, "s0");
+ s1 = LLVMBuildExtractElement(bld->builder, s, index1, "s1");
+ s2 = LLVMBuildExtractElement(bld->builder, s, index2, "s2");
+ dsdx = LLVMBuildSub(bld->builder, s1, s0, "");
+ dsdx = lp_build_abs(float_bld, dsdx);
+ dsdy = LLVMBuildSub(bld->builder, s2, s0, "");
+ dsdy = lp_build_abs(float_bld, dsdy);
+ if (dims > 1) {
+ t0 = LLVMBuildExtractElement(bld->builder, t, index0, "t0");
+ t1 = LLVMBuildExtractElement(bld->builder, t, index1, "t1");
+ t2 = LLVMBuildExtractElement(bld->builder, t, index2, "t2");
+ dtdx = LLVMBuildSub(bld->builder, t1, t0, "");
+ dtdx = lp_build_abs(float_bld, dtdx);
+ dtdy = LLVMBuildSub(bld->builder, t2, t0, "");
+ dtdy = lp_build_abs(float_bld, dtdy);
+ if (dims > 2) {
+ r0 = LLVMBuildExtractElement(bld->builder, r, index0, "r0");
+ r1 = LLVMBuildExtractElement(bld->builder, r, index1, "r1");
+ r2 = LLVMBuildExtractElement(bld->builder, r, index2, "r2");
+ drdx = LLVMBuildSub(bld->builder, r1, r0, "");
+ drdx = lp_build_abs(float_bld, drdx);
+ drdy = LLVMBuildSub(bld->builder, r2, r0, "");
+ drdy = lp_build_abs(float_bld, drdy);
+ }
+ }
+
+ /* Compute rho = max of all partial derivatives scaled by texture size.
+ * XXX this could be vectorized somewhat
+ */
+ rho = LLVMBuildMul(bld->builder,
+ lp_build_max(float_bld, dsdx, dsdy),
+ lp_build_int_to_float(float_bld, width), "");
+ if (dims > 1) {
+ LLVMValueRef max;
+ max = LLVMBuildMul(bld->builder,
+ lp_build_max(float_bld, dtdx, dtdy),
+ lp_build_int_to_float(float_bld, height), "");
+ rho = lp_build_max(float_bld, rho, max);
+ if (dims > 2) {
+ max = LLVMBuildMul(bld->builder,
+ lp_build_max(float_bld, drdx, drdy),
+ lp_build_int_to_float(float_bld, depth), "");
+ rho = lp_build_max(float_bld, rho, max);
+ }
+ }
+
+ /* compute lod = log2(rho) */
+ lod = lp_build_log2(float_bld, rho);
+
+ /* add lod bias */
+ lod = LLVMBuildAdd(bld->builder, lod, lod_bias, "LOD bias");
+
+ /* clamp lod */
+ lod = lp_build_clamp(float_bld, lod, min_lod, max_lod);
+
+ return lod;
+ }
+}
+
+
+/**
+ * For PIPE_TEX_MIPFILTER_NEAREST, convert float LOD to integer
+ * mipmap level index.
+ * Note: this is all scalar code.
+ * \param lod scalar float texture level of detail
+ * \param level_out returns integer
*/
static void
-lp_build_sample_2d_nearest_soa(struct lp_build_sample_context *bld,
- LLVMValueRef s,
- LLVMValueRef t,
- LLVMValueRef width,
- LLVMValueRef height,
- LLVMValueRef stride,
- LLVMValueRef data_ptr,
- LLVMValueRef *texel)
+lp_build_nearest_mip_level(struct lp_build_sample_context *bld,
+ unsigned unit,
+ LLVMValueRef lod,
+ LLVMValueRef *level_out)
{
- LLVMValueRef x, y;
+ struct lp_build_context *float_bld = &bld->float_bld;
+ struct lp_build_context *int_bld = &bld->int_bld;
+ LLVMValueRef last_level, level;
- x = lp_build_sample_wrap_nearest(bld, s, width,
- bld->static_state->pot_width,
- bld->static_state->wrap_s);
- y = lp_build_sample_wrap_nearest(bld, t, height,
- bld->static_state->pot_height,
- bld->static_state->wrap_t);
+ LLVMValueRef zero = LLVMConstInt(LLVMInt32Type(), 0, 0);
- lp_build_name(x, "tex.x.wrapped");
- lp_build_name(y, "tex.y.wrapped");
+ last_level = bld->dynamic_state->last_level(bld->dynamic_state,
+ bld->builder, unit);
+
+ /* convert float lod to integer */
+ level = lp_build_iround(float_bld, lod);
- lp_build_sample_texel_soa(bld, width, height, x, y, stride, data_ptr, texel);
+ /* clamp level to legal range of levels */
+ *level_out = lp_build_clamp(int_bld, level, zero, last_level);
}
/**
- * Sample 2D texture with bilinear filtering.
+ * For PIPE_TEX_MIPFILTER_LINEAR, convert float LOD to integer to
+ * two (adjacent) mipmap level indexes. Later, we'll sample from those
+ * two mipmap levels and interpolate between them.
*/
static void
-lp_build_sample_2d_linear_soa(struct lp_build_sample_context *bld,
+lp_build_linear_mip_levels(struct lp_build_sample_context *bld,
+ unsigned unit,
+ LLVMValueRef lod,
+ LLVMValueRef *level0_out,
+ LLVMValueRef *level1_out,
+ LLVMValueRef *weight_out)
+{
+ struct lp_build_context *float_bld = &bld->float_bld;
+ struct lp_build_context *int_bld = &bld->int_bld;
+ LLVMValueRef last_level, level;
+
+ last_level = bld->dynamic_state->last_level(bld->dynamic_state,
+ bld->builder, unit);
+
+ /* convert float lod to integer */
+ level = lp_build_ifloor(float_bld, lod);
+
+ /* compute level 0 and clamp to legal range of levels */
+ *level0_out = lp_build_clamp(int_bld, level,
+ int_bld->zero,
+ last_level);
+ /* compute level 1 and clamp to legal range of levels */
+ *level1_out = lp_build_add(int_bld, *level0_out, int_bld->one);
+ *level1_out = lp_build_min(int_bld, *level1_out, last_level);
+
+ *weight_out = lp_build_fract(float_bld, lod);
+}
+
+
+/**
+ * Generate code to sample a mipmap level with nearest filtering.
+ * If sampling a cube texture, r = cube face in [0,5].
+ */
+static void
+lp_build_sample_image_nearest(struct lp_build_sample_context *bld,
+ LLVMValueRef width_vec,
+ LLVMValueRef height_vec,
+ LLVMValueRef depth_vec,
+ LLVMValueRef row_stride_vec,
+ LLVMValueRef img_stride_vec,
+ LLVMValueRef data_ptr,
LLVMValueRef s,
LLVMValueRef t,
- LLVMValueRef width,
- LLVMValueRef height,
- LLVMValueRef stride,
- LLVMValueRef data_ptr,
- LLVMValueRef *texel)
+ LLVMValueRef r,
+ LLVMValueRef colors_out[4])
{
- LLVMValueRef s_fpart;
- LLVMValueRef t_fpart;
- LLVMValueRef x0, x1;
- LLVMValueRef y0, y1;
+ const int dims = texture_dims(bld->static_state->target);
+ LLVMValueRef x, y, z;
+
+ /*
+ * Compute integer texcoords.
+ */
+ x = lp_build_sample_wrap_nearest(bld, s, width_vec,
+ bld->static_state->pot_width,
+ bld->static_state->wrap_s);
+ lp_build_name(x, "tex.x.wrapped");
+
+ if (dims >= 2) {
+ y = lp_build_sample_wrap_nearest(bld, t, height_vec,
+ bld->static_state->pot_height,
+ bld->static_state->wrap_t);
+ lp_build_name(y, "tex.y.wrapped");
+
+ if (dims == 3) {
+ z = lp_build_sample_wrap_nearest(bld, r, depth_vec,
+ bld->static_state->pot_height,
+ bld->static_state->wrap_r);
+ lp_build_name(z, "tex.z.wrapped");
+ }
+ else if (bld->static_state->target == PIPE_TEXTURE_CUBE) {
+ z = r;
+ }
+ else {
+ z = NULL;
+ }
+ }
+ else {
+ y = z = NULL;
+ }
+
+ /*
+ * Get texture colors.
+ */
+ lp_build_sample_texel_soa(bld, width_vec, height_vec, depth_vec,
+ x, y, z,
+ row_stride_vec, img_stride_vec,
+ data_ptr, colors_out);
+}
+
+
+/**
+ * Generate code to sample a mipmap level with linear filtering.
+ * If sampling a cube texture, r = cube face in [0,5].
+ */
+static void
+lp_build_sample_image_linear(struct lp_build_sample_context *bld,
+ LLVMValueRef width_vec,
+ LLVMValueRef height_vec,
+ LLVMValueRef depth_vec,
+ LLVMValueRef row_stride_vec,
+ LLVMValueRef img_stride_vec,
+ LLVMValueRef data_ptr,
+ LLVMValueRef s,
+ LLVMValueRef t,
+ LLVMValueRef r,
+ LLVMValueRef colors_out[4])
+{
+ const int dims = texture_dims(bld->static_state->target);
+ LLVMValueRef x0, y0, z0, x1, y1, z1;
+ LLVMValueRef s_fpart, t_fpart, r_fpart;
LLVMValueRef neighbors[2][2][4];
- unsigned chan;
+ int chan;
- lp_build_sample_wrap_linear(bld, s, width, bld->static_state->pot_width,
- bld->static_state->wrap_s, &x0, &x1, &s_fpart);
- lp_build_sample_wrap_linear(bld, t, height, bld->static_state->pot_height,
- bld->static_state->wrap_t, &y0, &y1, &t_fpart);
+ /*
+ * Compute integer texcoords.
+ */
+ lp_build_sample_wrap_linear(bld, s, width_vec,
+ bld->static_state->pot_width,
+ bld->static_state->wrap_s,
+ &x0, &x1, &s_fpart);
+ lp_build_name(x0, "tex.x0.wrapped");
+ lp_build_name(x1, "tex.x1.wrapped");
+
+ if (dims >= 2) {
+ lp_build_sample_wrap_linear(bld, t, height_vec,
+ bld->static_state->pot_height,
+ bld->static_state->wrap_t,
+ &y0, &y1, &t_fpart);
+ lp_build_name(y0, "tex.y0.wrapped");
+ lp_build_name(y1, "tex.y1.wrapped");
+
+ if (dims == 3) {
+ lp_build_sample_wrap_linear(bld, r, depth_vec,
+ bld->static_state->pot_depth,
+ bld->static_state->wrap_r,
+ &z0, &z1, &r_fpart);
+ lp_build_name(z0, "tex.z0.wrapped");
+ lp_build_name(z1, "tex.z1.wrapped");
+ }
+ else if (bld->static_state->target == PIPE_TEXTURE_CUBE) {
+ z0 = z1 = r; /* cube face */
+ r_fpart = NULL;
+ }
+ else {
+ z0 = z1 = NULL;
+ r_fpart = NULL;
+ }
+ }
+ else {
+ y0 = y1 = t_fpart = NULL;
+ z0 = z1 = r_fpart = NULL;
+ }
- lp_build_sample_texel_soa(bld, width, height, x0, y0, stride, data_ptr, neighbors[0][0]);
- lp_build_sample_texel_soa(bld, width, height, x1, y0, stride, data_ptr, neighbors[0][1]);
- lp_build_sample_texel_soa(bld, width, height, x0, y1, stride, data_ptr, neighbors[1][0]);
- lp_build_sample_texel_soa(bld, width, height, x1, y1, stride, data_ptr, neighbors[1][1]);
+ /*
+ * Get texture colors.
+ */
+ /* get x0/x1 texels */
+ lp_build_sample_texel_soa(bld, width_vec, height_vec, depth_vec,
+ x0, y0, z0,
+ row_stride_vec, img_stride_vec,
+ data_ptr, neighbors[0][0]);
+ lp_build_sample_texel_soa(bld, width_vec, height_vec, depth_vec,
+ x1, y0, z0,
+ row_stride_vec, img_stride_vec,
+ data_ptr, neighbors[0][1]);
+
+ if (dims == 1) {
+ /* Interpolate two samples from 1D image to produce one color */
+ for (chan = 0; chan < 4; chan++) {
+ colors_out[chan] = lp_build_lerp(&bld->texel_bld, s_fpart,
+ neighbors[0][0][chan],
+ neighbors[0][1][chan]);
+ }
+ }
+ else {
+ /* 2D/3D texture */
+ LLVMValueRef colors0[4];
+
+ /* get x0/x1 texels at y1 */
+ lp_build_sample_texel_soa(bld, width_vec, height_vec, depth_vec,
+ x0, y1, z0,
+ row_stride_vec, img_stride_vec,
+ data_ptr, neighbors[1][0]);
+ lp_build_sample_texel_soa(bld, width_vec, height_vec, depth_vec,
+ x1, y1, z0,
+ row_stride_vec, img_stride_vec,
+ data_ptr, neighbors[1][1]);
+
+ /* Bilinear interpolate the four samples from the 2D image / 3D slice */
+ for (chan = 0; chan < 4; chan++) {
+ colors0[chan] = lp_build_lerp_2d(&bld->texel_bld,
+ s_fpart, t_fpart,
+ neighbors[0][0][chan],
+ neighbors[0][1][chan],
+ neighbors[1][0][chan],
+ neighbors[1][1][chan]);
+ }
- /* TODO: Don't interpolate missing channels */
- for(chan = 0; chan < 4; ++chan) {
- texel[chan] = lp_build_lerp_2d(&bld->texel_bld,
- s_fpart, t_fpart,
- neighbors[0][0][chan],
- neighbors[0][1][chan],
- neighbors[1][0][chan],
- neighbors[1][1][chan]);
+ if (dims == 3) {
+ LLVMValueRef neighbors1[2][2][4];
+ LLVMValueRef colors1[4];
+
+ /* get x0/x1/y0/y1 texels at z1 */
+ lp_build_sample_texel_soa(bld, width_vec, height_vec, depth_vec,
+ x0, y0, z1,
+ row_stride_vec, img_stride_vec,
+ data_ptr, neighbors1[0][0]);
+ lp_build_sample_texel_soa(bld, width_vec, height_vec, depth_vec,
+ x1, y0, z1,
+ row_stride_vec, img_stride_vec,
+ data_ptr, neighbors1[0][1]);
+ lp_build_sample_texel_soa(bld, width_vec, height_vec, depth_vec,
+ x0, y1, z1,
+ row_stride_vec, img_stride_vec,
+ data_ptr, neighbors1[1][0]);
+ lp_build_sample_texel_soa(bld, width_vec, height_vec, depth_vec,
+ x1, y1, z1,
+ row_stride_vec, img_stride_vec,
+ data_ptr, neighbors1[1][1]);
+
+ /* Bilinear interpolate the four samples from the second Z slice */
+ for (chan = 0; chan < 4; chan++) {
+ colors1[chan] = lp_build_lerp_2d(&bld->texel_bld,
+ s_fpart, t_fpart,
+ neighbors1[0][0][chan],
+ neighbors1[0][1][chan],
+ neighbors1[1][0][chan],
+ neighbors1[1][1][chan]);
+ }
+
+ /* Linearly interpolate the two samples from the two 3D slices */
+ for (chan = 0; chan < 4; chan++) {
+ colors_out[chan] = lp_build_lerp(&bld->texel_bld,
+ r_fpart,
+ colors0[chan], colors1[chan]);
+ }
+ }
+ else {
+ /* 2D tex */
+ for (chan = 0; chan < 4; chan++) {
+ colors_out[chan] = colors0[chan];
+ }
+ }
+ }
+}
+
+
+/** Helper used by lp_build_cube_lookup() */
+static LLVMValueRef
+lp_build_cube_ima(struct lp_build_context *coord_bld, LLVMValueRef coord)
+{
+ /* ima = -0.5 / abs(coord); */
+ LLVMValueRef negHalf = lp_build_const_vec(coord_bld->type, -0.5);
+ LLVMValueRef absCoord = lp_build_abs(coord_bld, coord);
+ LLVMValueRef ima = lp_build_mul(coord_bld, negHalf,
+ lp_build_rcp(coord_bld, absCoord));
+ return ima;
+}
+
+
+/**
+ * Helper used by lp_build_cube_lookup()
+ * \param sign scalar +1 or -1
+ * \param coord float vector
+ * \param ima float vector
+ */
+static LLVMValueRef
+lp_build_cube_coord(struct lp_build_context *coord_bld,
+ LLVMValueRef sign, int negate_coord,
+ LLVMValueRef coord, LLVMValueRef ima)
+{
+ /* return negate(coord) * ima * sign + 0.5; */
+ LLVMValueRef half = lp_build_const_vec(coord_bld->type, 0.5);
+ LLVMValueRef res;
+
+ assert(negate_coord == +1 || negate_coord == -1);
+
+ if (negate_coord == -1) {
+ coord = lp_build_negate(coord_bld, coord);
+ }
+
+ res = lp_build_mul(coord_bld, coord, ima);
+ if (sign) {
+ sign = lp_build_broadcast_scalar(coord_bld, sign);
+ res = lp_build_mul(coord_bld, res, sign);
+ }
+ res = lp_build_add(coord_bld, res, half);
+
+ return res;
+}
+
+
+/** Helper used by lp_build_cube_lookup()
+ * Return (major_coord >= 0) ? pos_face : neg_face;
+ */
+static LLVMValueRef
+lp_build_cube_face(struct lp_build_sample_context *bld,
+ LLVMValueRef major_coord,
+ unsigned pos_face, unsigned neg_face)
+{
+ LLVMValueRef cmp = LLVMBuildFCmp(bld->builder, LLVMRealUGE,
+ major_coord,
+ bld->float_bld.zero, "");
+ LLVMValueRef pos = LLVMConstInt(LLVMInt32Type(), pos_face, 0);
+ LLVMValueRef neg = LLVMConstInt(LLVMInt32Type(), neg_face, 0);
+ LLVMValueRef res = LLVMBuildSelect(bld->builder, cmp, pos, neg, "");
+ return res;
+}
+
+
+
+/**
+ * Generate code to do cube face selection and per-face texcoords.
+ */
+static void
+lp_build_cube_lookup(struct lp_build_sample_context *bld,
+ LLVMValueRef s,
+ LLVMValueRef t,
+ LLVMValueRef r,
+ LLVMValueRef *face,
+ LLVMValueRef *face_s,
+ LLVMValueRef *face_t)
+{
+ struct lp_build_context *float_bld = &bld->float_bld;
+ struct lp_build_context *coord_bld = &bld->coord_bld;
+ LLVMValueRef rx, ry, rz;
+ LLVMValueRef arx, ary, arz;
+ LLVMValueRef c25 = LLVMConstReal(LLVMFloatType(), 0.25);
+ LLVMValueRef arx_ge_ary, arx_ge_arz;
+ LLVMValueRef ary_ge_arx, ary_ge_arz;
+ LLVMValueRef arx_ge_ary_arz, ary_ge_arx_arz;
+ LLVMValueRef rx_pos, ry_pos, rz_pos;
+
+ assert(bld->coord_bld.type.length == 4);
+
+ /*
+ * Use the average of the four pixel's texcoords to choose the face.
+ */
+ rx = lp_build_mul(float_bld, c25,
+ lp_build_sum_vector(&bld->coord_bld, s));
+ ry = lp_build_mul(float_bld, c25,
+ lp_build_sum_vector(&bld->coord_bld, t));
+ rz = lp_build_mul(float_bld, c25,
+ lp_build_sum_vector(&bld->coord_bld, r));
+
+ arx = lp_build_abs(float_bld, rx);
+ ary = lp_build_abs(float_bld, ry);
+ arz = lp_build_abs(float_bld, rz);
+
+ /*
+ * Compare sign/magnitude of rx,ry,rz to determine face
+ */
+ arx_ge_ary = LLVMBuildFCmp(bld->builder, LLVMRealUGE, arx, ary, "");
+ arx_ge_arz = LLVMBuildFCmp(bld->builder, LLVMRealUGE, arx, arz, "");
+ ary_ge_arx = LLVMBuildFCmp(bld->builder, LLVMRealUGE, ary, arx, "");
+ ary_ge_arz = LLVMBuildFCmp(bld->builder, LLVMRealUGE, ary, arz, "");
+
+ arx_ge_ary_arz = LLVMBuildAnd(bld->builder, arx_ge_ary, arx_ge_arz, "");
+ ary_ge_arx_arz = LLVMBuildAnd(bld->builder, ary_ge_arx, ary_ge_arz, "");
+
+ rx_pos = LLVMBuildFCmp(bld->builder, LLVMRealUGE, rx, float_bld->zero, "");
+ ry_pos = LLVMBuildFCmp(bld->builder, LLVMRealUGE, ry, float_bld->zero, "");
+ rz_pos = LLVMBuildFCmp(bld->builder, LLVMRealUGE, rz, float_bld->zero, "");
+
+ {
+ struct lp_build_flow_context *flow_ctx;
+ struct lp_build_if_state if_ctx;
+
+ flow_ctx = lp_build_flow_create(bld->builder);
+ lp_build_flow_scope_begin(flow_ctx);
+
+ *face_s = bld->coord_bld.undef;
+ *face_t = bld->coord_bld.undef;
+ *face = bld->int_bld.undef;
+
+ lp_build_name(*face_s, "face_s");
+ lp_build_name(*face_t, "face_t");
+ lp_build_name(*face, "face");
+
+ lp_build_flow_scope_declare(flow_ctx, face_s);
+ lp_build_flow_scope_declare(flow_ctx, face_t);
+ lp_build_flow_scope_declare(flow_ctx, face);
+
+ lp_build_if(&if_ctx, flow_ctx, bld->builder, arx_ge_ary_arz);
+ {
+ /* +/- X face */
+ LLVMValueRef sign = lp_build_sgn(float_bld, rx);
+ LLVMValueRef ima = lp_build_cube_ima(coord_bld, s);
+ *face_s = lp_build_cube_coord(coord_bld, sign, +1, r, ima);
+ *face_t = lp_build_cube_coord(coord_bld, NULL, +1, t, ima);
+ *face = lp_build_cube_face(bld, rx,
+ PIPE_TEX_FACE_POS_X,
+ PIPE_TEX_FACE_NEG_X);
+ }
+ lp_build_else(&if_ctx);
+ {
+ struct lp_build_flow_context *flow_ctx2;
+ struct lp_build_if_state if_ctx2;
+
+ LLVMValueRef face_s2 = bld->coord_bld.undef;
+ LLVMValueRef face_t2 = bld->coord_bld.undef;
+ LLVMValueRef face2 = bld->int_bld.undef;
+
+ flow_ctx2 = lp_build_flow_create(bld->builder);
+ lp_build_flow_scope_begin(flow_ctx2);
+ lp_build_flow_scope_declare(flow_ctx2, &face_s2);
+ lp_build_flow_scope_declare(flow_ctx2, &face_t2);
+ lp_build_flow_scope_declare(flow_ctx2, &face2);
+
+ ary_ge_arx_arz = LLVMBuildAnd(bld->builder, ary_ge_arx, ary_ge_arz, "");
+
+ lp_build_if(&if_ctx2, flow_ctx2, bld->builder, ary_ge_arx_arz);
+ {
+ /* +/- Y face */
+ LLVMValueRef sign = lp_build_sgn(float_bld, ry);
+ LLVMValueRef ima = lp_build_cube_ima(coord_bld, t);
+ face_s2 = lp_build_cube_coord(coord_bld, NULL, -1, s, ima);
+ face_t2 = lp_build_cube_coord(coord_bld, sign, -1, r, ima);
+ face2 = lp_build_cube_face(bld, ry,
+ PIPE_TEX_FACE_POS_Y,
+ PIPE_TEX_FACE_NEG_Y);
+ }
+ lp_build_else(&if_ctx2);
+ {
+ /* +/- Z face */
+ LLVMValueRef sign = lp_build_sgn(float_bld, rz);
+ LLVMValueRef ima = lp_build_cube_ima(coord_bld, r);
+ face_s2 = lp_build_cube_coord(coord_bld, sign, -1, s, ima);
+ face_t2 = lp_build_cube_coord(coord_bld, NULL, +1, t, ima);
+ face2 = lp_build_cube_face(bld, rz,
+ PIPE_TEX_FACE_POS_Z,
+ PIPE_TEX_FACE_NEG_Z);
+ }
+ lp_build_endif(&if_ctx2);
+ lp_build_flow_scope_end(flow_ctx2);
+ lp_build_flow_destroy(flow_ctx2);
+
+ *face_s = face_s2;
+ *face_t = face_t2;
+ *face = face2;
+ }
+
+ lp_build_endif(&if_ctx);
+ lp_build_flow_scope_end(flow_ctx);
+ lp_build_flow_destroy(flow_ctx);
+ }
+}
+
+
+
+/**
+ * Sample the texture/mipmap using given image filter and mip filter.
+ * data0_ptr and data1_ptr point to the two mipmap levels to sample
+ * from. width0/1_vec, height0/1_vec, depth0/1_vec indicate their sizes.
+ * If we're using nearest miplevel sampling the '1' values will be null/unused.
+ */
+static void
+lp_build_sample_mipmap(struct lp_build_sample_context *bld,
+ unsigned img_filter,
+ unsigned mip_filter,
+ LLVMValueRef s,
+ LLVMValueRef t,
+ LLVMValueRef r,
+ LLVMValueRef lod_fpart,
+ LLVMValueRef width0_vec,
+ LLVMValueRef width1_vec,
+ LLVMValueRef height0_vec,
+ LLVMValueRef height1_vec,
+ LLVMValueRef depth0_vec,
+ LLVMValueRef depth1_vec,
+ LLVMValueRef row_stride0_vec,
+ LLVMValueRef row_stride1_vec,
+ LLVMValueRef img_stride0_vec,
+ LLVMValueRef img_stride1_vec,
+ LLVMValueRef data_ptr0,
+ LLVMValueRef data_ptr1,
+ LLVMValueRef *colors_out)
+{
+ LLVMValueRef colors0[4], colors1[4];
+ int chan;
+
+ if (img_filter == PIPE_TEX_FILTER_NEAREST) {
+ lp_build_sample_image_nearest(bld,
+ width0_vec, height0_vec, depth0_vec,
+ row_stride0_vec, img_stride0_vec,
+ data_ptr0, s, t, r, colors0);
+
+ if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) {
+ /* sample the second mipmap level, and interp */
+ lp_build_sample_image_nearest(bld,
+ width1_vec, height1_vec, depth1_vec,
+ row_stride1_vec, img_stride1_vec,
+ data_ptr1, s, t, r, colors1);
+ }
+ }
+ else {
+ assert(img_filter == PIPE_TEX_FILTER_LINEAR);
+
+ lp_build_sample_image_linear(bld,
+ width0_vec, height0_vec, depth0_vec,
+ row_stride0_vec, img_stride0_vec,
+ data_ptr0, s, t, r, colors0);
+
+ if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) {
+ /* sample the second mipmap level, and interp */
+ lp_build_sample_image_linear(bld,
+ width1_vec, height1_vec, depth1_vec,
+ row_stride1_vec, img_stride1_vec,
+ data_ptr1, s, t, r, colors1);
+ }
+ }
+
+ if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) {
+ /* interpolate samples from the two mipmap levels */
+ for (chan = 0; chan < 4; chan++) {
+ colors_out[chan] = lp_build_lerp(&bld->texel_bld, lod_fpart,
+ colors0[chan], colors1[chan]);
+ }
+ }
+ else {
+ /* use first/only level's colors */
+ for (chan = 0; chan < 4; chan++) {
+ colors_out[chan] = colors0[chan];
+ }
}
}
+
+/**
+ * General texture sampling codegen.
+ * This function handles texture sampling for all texture targets (1D,
+ * 2D, 3D, cube) and all filtering modes.
+ */
+static void
+lp_build_sample_general(struct lp_build_sample_context *bld,
+ unsigned unit,
+ LLVMValueRef s,
+ LLVMValueRef t,
+ LLVMValueRef r,
+ LLVMValueRef width,
+ LLVMValueRef height,
+ LLVMValueRef depth,
+ LLVMValueRef width_vec,
+ LLVMValueRef height_vec,
+ LLVMValueRef depth_vec,
+ LLVMValueRef row_stride_array,
+ LLVMValueRef img_stride_vec,
+ LLVMValueRef data_array,
+ LLVMValueRef *colors_out)
+{
+ struct lp_build_context *float_bld = &bld->float_bld;
+ const unsigned mip_filter = bld->static_state->min_mip_filter;
+ const unsigned min_filter = bld->static_state->min_img_filter;
+ const unsigned mag_filter = bld->static_state->mag_img_filter;
+ const int dims = texture_dims(bld->static_state->target);
+ LLVMValueRef lod, lod_fpart;
+ LLVMValueRef ilevel0, ilevel1, ilevel0_vec, ilevel1_vec;
+ LLVMValueRef width0_vec = NULL, height0_vec = NULL, depth0_vec = NULL;
+ LLVMValueRef width1_vec = NULL, height1_vec = NULL, depth1_vec = NULL;
+ LLVMValueRef row_stride0_vec = NULL, row_stride1_vec = NULL;
+ LLVMValueRef img_stride0_vec = NULL, img_stride1_vec = NULL;
+ LLVMValueRef data_ptr0, data_ptr1;
+
+ /*
+ printf("%s mip %d min %d mag %d\n", __FUNCTION__,
+ mip_filter, min_filter, mag_filter);
+ */
+
+ /*
+ * Compute the level of detail (float).
+ */
+ if (min_filter != mag_filter ||
+ mip_filter != PIPE_TEX_MIPFILTER_NONE) {
+ /* Need to compute lod either to choose mipmap levels or to
+ * distinguish between minification/magnification with one mipmap level.
+ */
+ lod = lp_build_lod_selector(bld, s, t, r, width, height, depth);
+ }
+
+ /*
+ * Compute integer mipmap level(s) to fetch texels from.
+ */
+ if (mip_filter == PIPE_TEX_MIPFILTER_NONE) {
+ /* always use mip level 0 */
+ ilevel0 = LLVMConstInt(LLVMInt32Type(), 0, 0);
+ }
+ else {
+ if (mip_filter == PIPE_TEX_MIPFILTER_NEAREST) {
+ lp_build_nearest_mip_level(bld, unit, lod, &ilevel0);
+ }
+ else {
+ assert(mip_filter == PIPE_TEX_MIPFILTER_LINEAR);
+ lp_build_linear_mip_levels(bld, unit, lod, &ilevel0, &ilevel1,
+ &lod_fpart);
+ lod_fpart = lp_build_broadcast_scalar(&bld->coord_bld, lod_fpart);
+ }
+ }
+
+ /*
+ * Convert scalar integer mipmap levels into vectors.
+ */
+ ilevel0_vec = lp_build_broadcast_scalar(&bld->int_coord_bld, ilevel0);
+ if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR)
+ ilevel1_vec = lp_build_broadcast_scalar(&bld->int_coord_bld, ilevel1);
+
+ /*
+ * Compute width, height at mipmap level 'ilevel0'
+ */
+ width0_vec = lp_build_minify(bld, width_vec, ilevel0_vec);
+ if (dims >= 2) {
+ height0_vec = lp_build_minify(bld, height_vec, ilevel0_vec);
+ row_stride0_vec = lp_build_get_level_stride_vec(bld, row_stride_array,
+ ilevel0);
+ if (dims == 3 || bld->static_state->target == PIPE_TEXTURE_CUBE) {
+ img_stride0_vec = lp_build_mul(&bld->int_coord_bld,
+ row_stride0_vec, height0_vec);
+ if (dims == 3) {
+ depth0_vec = lp_build_minify(bld, depth_vec, ilevel0_vec);
+ }
+ }
+ }
+ if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) {
+ /* compute width, height, depth for second mipmap level at 'ilevel1' */
+ width1_vec = lp_build_minify(bld, width_vec, ilevel1_vec);
+ if (dims >= 2) {
+ height1_vec = lp_build_minify(bld, height_vec, ilevel1_vec);
+ row_stride1_vec = lp_build_get_level_stride_vec(bld, row_stride_array,
+ ilevel1);
+ if (dims == 3 || bld->static_state->target == PIPE_TEXTURE_CUBE) {
+ img_stride1_vec = lp_build_mul(&bld->int_coord_bld,
+ row_stride1_vec, height1_vec);
+ if (dims ==3) {
+ depth1_vec = lp_build_minify(bld, depth_vec, ilevel1_vec);
+ }
+ }
+ }
+ }
+
+ /*
+ * Choose cube face, recompute per-face texcoords.
+ */
+ if (bld->static_state->target == PIPE_TEXTURE_CUBE) {
+ LLVMValueRef face, face_s, face_t;
+ lp_build_cube_lookup(bld, s, t, r, &face, &face_s, &face_t);
+ s = face_s; /* vec */
+ t = face_t; /* vec */
+ /* use 'r' to indicate cube face */
+ r = lp_build_broadcast_scalar(&bld->int_coord_bld, face); /* vec */
+ }
+
+ /*
+ * Get pointer(s) to image data for mipmap level(s).
+ */
+ data_ptr0 = lp_build_get_mipmap_level(bld, data_array, ilevel0);
+ if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) {
+ data_ptr1 = lp_build_get_mipmap_level(bld, data_array, ilevel1);
+ }
+
+ /*
+ * Get/interpolate texture colors.
+ */
+ if (min_filter == mag_filter) {
+ /* no need to distinquish between minification and magnification */
+ lp_build_sample_mipmap(bld, min_filter, mip_filter, s, t, r, lod_fpart,
+ width0_vec, width1_vec,
+ height0_vec, height1_vec,
+ depth0_vec, depth1_vec,
+ row_stride0_vec, row_stride1_vec,
+ img_stride0_vec, img_stride1_vec,
+ data_ptr0, data_ptr1,
+ colors_out);
+ }
+ else {
+ /* Emit conditional to choose min image filter or mag image filter
+ * depending on the lod being >0 or <= 0, respectively.
+ */
+ struct lp_build_flow_context *flow_ctx;
+ struct lp_build_if_state if_ctx;
+ LLVMValueRef minify;
+
+ flow_ctx = lp_build_flow_create(bld->builder);
+ lp_build_flow_scope_begin(flow_ctx);
+
+ lp_build_flow_scope_declare(flow_ctx, &colors_out[0]);
+ lp_build_flow_scope_declare(flow_ctx, &colors_out[1]);
+ lp_build_flow_scope_declare(flow_ctx, &colors_out[2]);
+ lp_build_flow_scope_declare(flow_ctx, &colors_out[3]);
+
+ /* minify = lod > 0.0 */
+ minify = LLVMBuildFCmp(bld->builder, LLVMRealUGE,
+ lod, float_bld->zero, "");
+
+ lp_build_if(&if_ctx, flow_ctx, bld->builder, minify);
+ {
+ /* Use the minification filter */
+ lp_build_sample_mipmap(bld, min_filter, mip_filter,
+ s, t, r, lod_fpart,
+ width0_vec, width1_vec,
+ height0_vec, height1_vec,
+ depth0_vec, depth1_vec,
+ row_stride0_vec, row_stride1_vec,
+ img_stride0_vec, img_stride1_vec,
+ data_ptr0, data_ptr1,
+ colors_out);
+ }
+ lp_build_else(&if_ctx);
+ {
+ /* Use the magnification filter */
+ lp_build_sample_mipmap(bld, mag_filter, mip_filter,
+ s, t, r, lod_fpart,
+ width0_vec, width1_vec,
+ height0_vec, height1_vec,
+ depth0_vec, depth1_vec,
+ row_stride0_vec, row_stride1_vec,
+ img_stride0_vec, img_stride1_vec,
+ data_ptr0, data_ptr1,
+ colors_out);
+ }
+ lp_build_endif(&if_ctx);
+
+ lp_build_flow_scope_end(flow_ctx);
+ lp_build_flow_destroy(flow_ctx);
+ }
+}
+
+
+
static void
lp_build_rgba8_to_f32_soa(LLVMBuilderRef builder,
struct lp_type dst_type,
LLVMValueRef packed,
LLVMValueRef *rgba)
{
- LLVMValueRef mask = lp_build_int_const_scalar(dst_type, 0xff);
+ LLVMValueRef mask = lp_build_const_int_vec(dst_type, 0xff);
unsigned chan;
/* Decode the input vector components */
@@ -799,7 +1720,7 @@ lp_build_rgba8_to_f32_soa(LLVMBuilderRef builder,
input = packed;
if(start)
- input = LLVMBuildLShr(builder, input, lp_build_int_const_scalar(dst_type, start), "");
+ input = LLVMBuildLShr(builder, input, lp_build_const_int_vec(dst_type, start), "");
if(stop < 32)
input = LLVMBuildAnd(builder, input, mask, "");
@@ -817,8 +1738,8 @@ lp_build_sample_2d_linear_aos(struct lp_build_sample_context *bld,
LLVMValueRef t,
LLVMValueRef width,
LLVMValueRef height,
- LLVMValueRef stride,
- LLVMValueRef data_ptr,
+ LLVMValueRef stride_array,
+ LLVMValueRef data_array,
LLVMValueRef *texel)
{
LLVMBuilderRef builder = bld->builder;
@@ -834,8 +1755,9 @@ lp_build_sample_2d_linear_aos(struct lp_build_sample_context *bld,
LLVMValueRef neighbors_hi[2][2];
LLVMValueRef packed, packed_lo, packed_hi;
LLVMValueRef unswizzled[4];
+ LLVMValueRef stride;
- lp_build_context_init(&i32, builder, lp_type_int(32));
+ lp_build_context_init(&i32, builder, lp_type_int_vec(32));
lp_build_context_init(&h16, builder, lp_type_ufixed(16));
lp_build_context_init(&u8n, builder, lp_type_unorm(8));
@@ -860,17 +1782,17 @@ lp_build_sample_2d_linear_aos(struct lp_build_sample_context *bld,
t = LLVMBuildFPToSI(builder, t, i32_vec_type, "");
/* subtract 0.5 (add -128) */
- i32_c128 = lp_build_int_const_scalar(i32.type, -128);
+ i32_c128 = lp_build_const_int_vec(i32.type, -128);
s = LLVMBuildAdd(builder, s, i32_c128, "");
t = LLVMBuildAdd(builder, t, i32_c128, "");
/* compute floor (shift right 8) */
- i32_c8 = lp_build_int_const_scalar(i32.type, 8);
+ i32_c8 = lp_build_const_int_vec(i32.type, 8);
s_ipart = LLVMBuildAShr(builder, s, i32_c8, "");
t_ipart = LLVMBuildAShr(builder, t, i32_c8, "");
/* compute fractional part (AND with 0xff) */
- i32_c255 = lp_build_int_const_scalar(i32.type, 255);
+ i32_c255 = lp_build_const_int_vec(i32.type, 255);
s_fpart = LLVMBuildAnd(builder, s, i32_c255, "");
t_fpart = LLVMBuildAnd(builder, t, i32_c255, "");
@@ -941,6 +1863,8 @@ lp_build_sample_2d_linear_aos(struct lp_build_sample_context *bld,
t_fpart_hi = LLVMBuildShuffleVector(builder, t_fpart, h16.undef, shuffle_hi, "");
}
+ stride = lp_build_get_const_level_stride_vec(bld, stride_array, 0);
+
/*
* Fetch the pixels as 4 x 32bit (rgba order might differ):
*
@@ -958,10 +1882,10 @@ lp_build_sample_2d_linear_aos(struct lp_build_sample_context *bld,
* The higher 8 bits of the resulting elements will be zero.
*/
- neighbors[0][0] = lp_build_sample_packed(bld, x0, y0, stride, data_ptr);
- neighbors[0][1] = lp_build_sample_packed(bld, x1, y0, stride, data_ptr);
- neighbors[1][0] = lp_build_sample_packed(bld, x0, y1, stride, data_ptr);
- neighbors[1][1] = lp_build_sample_packed(bld, x1, y1, stride, data_ptr);
+ neighbors[0][0] = lp_build_sample_packed(bld, x0, y0, stride, data_array);
+ neighbors[0][1] = lp_build_sample_packed(bld, x1, y0, stride, data_array);
+ neighbors[1][0] = lp_build_sample_packed(bld, x0, y1, stride, data_array);
+ neighbors[1][1] = lp_build_sample_packed(bld, x1, y1, stride, data_array);
neighbors[0][0] = LLVMBuildBitCast(builder, neighbors[0][0], u8n_vec_type, "");
neighbors[0][1] = LLVMBuildBitCast(builder, neighbors[0][1], u8n_vec_type, "");
@@ -1035,7 +1959,7 @@ lp_build_sample_compare(struct lp_build_sample_context *bld,
}
assert(res);
- res = lp_build_mul(texel_bld, res, lp_build_const_scalar(texel_bld->type, 0.25));
+ res = lp_build_mul(texel_bld, res, lp_build_const_vec(texel_bld->type, 0.25));
/* XXX returning result for default GL_DEPTH_TEXTURE_MODE = GL_LUMINANCE */
for(chan = 0; chan < 3; ++chan)
@@ -1044,194 +1968,11 @@ lp_build_sample_compare(struct lp_build_sample_context *bld,
}
-static int
-texture_dims(enum pipe_texture_target tex)
-{
- switch (tex) {
- case PIPE_TEXTURE_1D:
- return 1;
- case PIPE_TEXTURE_2D:
- case PIPE_TEXTURE_CUBE:
- return 2;
- case PIPE_TEXTURE_3D:
- return 3;
- default:
- assert(0 && "bad texture target in texture_dims()");
- return 2;
- }
-}
-
-
-/**
- * Generate code to compute texture level of detail (lambda).
- * \param s vector of texcoord s values
- * \param t vector of texcoord t values
- * \param r vector of texcoord r values
- * \param width scalar int texture width
- * \param height scalar int texture height
- * \param depth scalar int texture depth
- */
-static LLVMValueRef
-lp_build_lod_selector(struct lp_build_sample_context *bld,
- LLVMValueRef s,
- LLVMValueRef t,
- LLVMValueRef r,
- LLVMValueRef width,
- LLVMValueRef height,
- LLVMValueRef depth)
-
-{
- const int dims = texture_dims(bld->static_state->target);
- struct lp_build_context *coord_bld = &bld->coord_bld;
-
- LLVMValueRef lod_bias = lp_build_const_scalar(bld->coord_bld.type,
- bld->static_state->lod_bias);
- LLVMValueRef min_lod = lp_build_const_scalar(bld->coord_bld.type,
- bld->static_state->min_lod);
- LLVMValueRef max_lod = lp_build_const_scalar(bld->coord_bld.type,
- bld->static_state->max_lod);
-
- LLVMValueRef index0 = LLVMConstInt(LLVMInt32Type(), 0, 0);
- LLVMValueRef index1 = LLVMConstInt(LLVMInt32Type(), 1, 0);
- LLVMValueRef index2 = LLVMConstInt(LLVMInt32Type(), 2, 0);
-
- LLVMValueRef s0, s1, s2;
- LLVMValueRef t0, t1, t2;
- LLVMValueRef r0, r1, r2;
- LLVMValueRef dsdx, dsdy, dtdx, dtdy, drdx, drdy;
- LLVMValueRef rho, lod;
-
- /*
- * dsdx = abs(s[1] - s[0]);
- * dsdy = abs(s[2] - s[0]);
- * dtdx = abs(t[1] - t[0]);
- * dtdy = abs(t[2] - t[0]);
- * drdx = abs(r[1] - r[0]);
- * drdy = abs(r[2] - r[0]);
- * XXX we're assuming a four-element quad in 2x2 layout here.
- */
- s0 = LLVMBuildExtractElement(bld->builder, s, index0, "s0");
- s1 = LLVMBuildExtractElement(bld->builder, s, index1, "s1");
- s2 = LLVMBuildExtractElement(bld->builder, s, index2, "s2");
- dsdx = lp_build_abs(coord_bld, lp_build_sub(coord_bld, s1, s0));
- dsdy = lp_build_abs(coord_bld, lp_build_sub(coord_bld, s2, s0));
- if (dims > 1) {
- t0 = LLVMBuildExtractElement(bld->builder, t, index0, "t0");
- t1 = LLVMBuildExtractElement(bld->builder, t, index1, "t1");
- t2 = LLVMBuildExtractElement(bld->builder, t, index2, "t2");
- dtdx = lp_build_abs(coord_bld, lp_build_sub(coord_bld, t1, t0));
- dtdy = lp_build_abs(coord_bld, lp_build_sub(coord_bld, t2, t0));
- if (dims > 2) {
- r0 = LLVMBuildExtractElement(bld->builder, r, index0, "r0");
- r1 = LLVMBuildExtractElement(bld->builder, r, index1, "r1");
- r2 = LLVMBuildExtractElement(bld->builder, r, index2, "r2");
- drdx = lp_build_abs(coord_bld, lp_build_sub(coord_bld, r1, r0));
- drdy = lp_build_abs(coord_bld, lp_build_sub(coord_bld, r2, r0));
- }
- }
-
- /* Compute rho = max of all partial derivatives scaled by texture size.
- * XXX this can be vectorized somewhat
- */
- rho = lp_build_mul(coord_bld,
- lp_build_max(coord_bld, dsdx, dsdy),
- lp_build_int_to_float(coord_bld, width));
- if (dims > 1) {
- LLVMValueRef max;
- max = lp_build_mul(coord_bld,
- lp_build_max(coord_bld, dtdx, dtdy),
- lp_build_int_to_float(coord_bld, height));
- rho = lp_build_max(coord_bld, rho, max);
- if (dims > 2) {
- max = lp_build_mul(coord_bld,
- lp_build_max(coord_bld, drdx, drdy),
- lp_build_int_to_float(coord_bld, depth));
- rho = lp_build_max(coord_bld, rho, max);
- }
- }
-
- /* compute lod = log2(rho) */
- lod = lp_build_log2(coord_bld, rho);
-
- /* add lod bias */
- lod = lp_build_add(coord_bld, lod, lod_bias);
-
- /* clamp lod */
- lod = lp_build_clamp(coord_bld, lod, min_lod, max_lod);
-
- return lod;
-}
-
-
-/**
- * For PIPE_TEX_MIPFILTER_NEAREST, convert float LOD to integer
- * mipmap level index.
- * \param lod scalar float texture level of detail
- * \param level_out returns integer
- */
-static void
-lp_build_nearest_mip_level(struct lp_build_sample_context *bld,
- unsigned unit,
- LLVMValueRef lod,
- LLVMValueRef *level_out)
-{
- struct lp_build_context *coord_bld = &bld->coord_bld;
- struct lp_build_context *int_coord_bld = &bld->int_coord_bld;
- LLVMValueRef last_level, level;
-
- last_level = bld->dynamic_state->last_level(bld->dynamic_state,
- bld->builder, unit);
-
- /* convert float lod to integer */
- level = lp_build_iround(coord_bld, lod);
-
- /* clamp level to legal range of levels */
- *level_out = lp_build_clamp(int_coord_bld, level,
- int_coord_bld->zero,
- last_level);
-}
-
-
-/**
- * For PIPE_TEX_MIPFILTER_LINEAR, convert float LOD to integer to
- * two (adjacent) mipmap level indexes. Later, we'll sample from those
- * two mipmap levels and interpolate between them.
- */
-static void
-lp_build_linear_mip_levels(struct lp_build_sample_context *bld,
- unsigned unit,
- LLVMValueRef lod,
- LLVMValueRef *level0_out,
- LLVMValueRef *level1_out,
- LLVMValueRef *weight_out)
-{
- struct lp_build_context *coord_bld = &bld->coord_bld;
- struct lp_build_context *int_coord_bld = &bld->int_coord_bld;
- LLVMValueRef last_level, level;
-
- last_level = bld->dynamic_state->last_level(bld->dynamic_state,
- bld->builder, unit);
-
- /* convert float lod to integer */
- level = lp_build_ifloor(coord_bld, lod);
-
- /* compute level 0 and clamp to legal range of levels */
- *level0_out = lp_build_clamp(int_coord_bld, level,
- int_coord_bld->zero,
- last_level);
- /* compute level 1 and clamp to legal range of levels */
- *level1_out = lp_build_add(int_coord_bld, *level0_out, int_coord_bld->one);
- *level1_out = lp_build_min(int_coord_bld, *level1_out, int_coord_bld->zero);
-
- *weight_out = lp_build_fract(coord_bld, lod);
-}
-
-
-
/**
* Build texture sampling code.
* 'texel' will return a vector of four LLVMValueRefs corresponding to
* R, G, B, A.
+ * \param type vector float type to use for coords, etc.
*/
void
lp_build_sample_soa(LLVMBuilderRef builder,
@@ -1245,10 +1986,11 @@ lp_build_sample_soa(LLVMBuilderRef builder,
LLVMValueRef *texel)
{
struct lp_build_sample_context bld;
- LLVMValueRef width;
- LLVMValueRef height;
- LLVMValueRef stride;
- LLVMValueRef data_ptr;
+ LLVMValueRef width, width_vec;
+ LLVMValueRef height, height_vec;
+ LLVMValueRef depth, depth_vec;
+ LLVMValueRef stride_array;
+ LLVMValueRef data_array;
LLVMValueRef s;
LLVMValueRef t;
LLVMValueRef r;
@@ -1256,6 +1998,7 @@ lp_build_sample_soa(LLVMBuilderRef builder,
(void) lp_build_lod_selector; /* temporary to silence warning */
(void) lp_build_nearest_mip_level;
(void) lp_build_linear_mip_levels;
+ (void) lp_build_minify;
/* Setup our build context */
memset(&bld, 0, sizeof bld);
@@ -1263,10 +2006,16 @@ lp_build_sample_soa(LLVMBuilderRef builder,
bld.static_state = static_state;
bld.dynamic_state = dynamic_state;
bld.format_desc = util_format_description(static_state->format);
+
+ bld.float_type = lp_type_float(32);
+ bld.int_type = lp_type_int(32);
bld.coord_type = type;
bld.uint_coord_type = lp_uint_type(type);
bld.int_coord_type = lp_int_type(type);
bld.texel_type = type;
+
+ lp_build_context_init(&bld.float_bld, builder, bld.float_type);
+ lp_build_context_init(&bld.int_bld, builder, bld.int_type);
lp_build_context_init(&bld.coord_bld, builder, bld.coord_type);
lp_build_context_init(&bld.uint_coord_bld, builder, bld.uint_coord_type);
lp_build_context_init(&bld.int_coord_bld, builder, bld.int_coord_type);
@@ -1275,41 +2024,37 @@ lp_build_sample_soa(LLVMBuilderRef builder,
/* Get the dynamic state */
width = dynamic_state->width(dynamic_state, builder, unit);
height = dynamic_state->height(dynamic_state, builder, unit);
- stride = dynamic_state->stride(dynamic_state, builder, unit);
- data_ptr = dynamic_state->data_ptr(dynamic_state, builder, unit);
+ depth = dynamic_state->depth(dynamic_state, builder, unit);
+ stride_array = dynamic_state->row_stride(dynamic_state, builder, unit);
+ data_array = dynamic_state->data_ptr(dynamic_state, builder, unit);
+ /* Note that data_array is an array[level] of pointers to texture images */
s = coords[0];
t = coords[1];
r = coords[2];
- width = lp_build_broadcast_scalar(&bld.uint_coord_bld, width);
- height = lp_build_broadcast_scalar(&bld.uint_coord_bld, height);
- stride = lp_build_broadcast_scalar(&bld.uint_coord_bld, stride);
-
- if(static_state->target == PIPE_TEXTURE_1D)
- t = bld.coord_bld.zero;
-
- switch (static_state->min_img_filter) {
- case PIPE_TEX_FILTER_NEAREST:
- lp_build_sample_2d_nearest_soa(&bld, s, t, width, height,
- stride, data_ptr, texel);
- break;
- case PIPE_TEX_FILTER_LINEAR:
- if(lp_format_is_rgba8(bld.format_desc) &&
- is_simple_wrap_mode(static_state->wrap_s) &&
- is_simple_wrap_mode(static_state->wrap_t))
- lp_build_sample_2d_linear_aos(&bld, s, t, width, height,
- stride, data_ptr, texel);
- else
- lp_build_sample_2d_linear_soa(&bld, s, t, width, height,
- stride, data_ptr, texel);
- break;
- default:
- assert(0);
+ width_vec = lp_build_broadcast_scalar(&bld.uint_coord_bld, width);
+ height_vec = lp_build_broadcast_scalar(&bld.uint_coord_bld, height);
+ depth_vec = lp_build_broadcast_scalar(&bld.uint_coord_bld, depth);
+
+ if (util_format_is_rgba8_variant(bld.format_desc) &&
+ static_state->target == PIPE_TEXTURE_2D &&
+ static_state->min_img_filter == PIPE_TEX_FILTER_LINEAR &&
+ static_state->mag_img_filter == PIPE_TEX_FILTER_LINEAR &&
+ static_state->min_mip_filter == PIPE_TEX_MIPFILTER_NONE &&
+ is_simple_wrap_mode(static_state->wrap_s) &&
+ is_simple_wrap_mode(static_state->wrap_t)) {
+ /* special case */
+ lp_build_sample_2d_linear_aos(&bld, s, t, width_vec, height_vec,
+ stride_array, data_array, texel);
+ }
+ else {
+ lp_build_sample_general(&bld, unit, s, t, r,
+ width, height, depth,
+ width_vec, height_vec, depth_vec,
+ stride_array, NULL, data_array,
+ texel);
}
-
- /* FIXME: respect static_state->min_mip_filter */;
- /* FIXME: respect static_state->mag_img_filter */;
lp_build_sample_compare(&bld, r, texel);
}
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_struct.h b/src/gallium/auxiliary/gallivm/lp_bld_struct.h
index 740392f561..147336edb4 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_struct.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_struct.h
@@ -37,7 +37,7 @@
#define LP_BLD_STRUCT_H
-#include <llvm-c/Core.h>
+#include "gallivm/lp_bld.h"
#include <llvm-c/Target.h>
#include "util/u_debug.h"
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
index 64e81f7b1f..278c838eac 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
@@ -144,9 +144,9 @@ lp_build_broadcast_aos(struct lp_build_context *bld,
#endif
if(shift > 0)
- tmp = LLVMBuildLShr(bld->builder, a, lp_build_int_const_scalar(type4, shift*type.width), "");
+ tmp = LLVMBuildLShr(bld->builder, a, lp_build_const_int_vec(type4, shift*type.width), "");
if(shift < 0)
- tmp = LLVMBuildShl(bld->builder, a, lp_build_int_const_scalar(type4, -shift*type.width), "");
+ tmp = LLVMBuildShl(bld->builder, a, lp_build_const_int_vec(type4, -shift*type.width), "");
assert(tmp);
if(tmp)
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.h b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.h
index b9472127a6..138ca620e6 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.h
@@ -37,7 +37,7 @@
#define LP_BLD_SWIZZLE_H
-#include <llvm-c/Core.h>
+#include "gallivm/lp_bld.h"
struct lp_type;
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
index eddb7a83fa..63b938bfa9 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
@@ -35,7 +35,7 @@
#ifndef LP_BLD_TGSI_H
#define LP_BLD_TGSI_H
-#include <llvm-c/Core.h>
+#include "gallivm/lp_bld.h"
struct tgsi_token;
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index 5f2c2a54ee..8901e656ae 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -41,6 +41,7 @@
#include "util/u_debug.h"
#include "util/u_math.h"
#include "util/u_memory.h"
+#include "tgsi/tgsi_dump.h"
#include "tgsi/tgsi_info.h"
#include "tgsi/tgsi_parse.h"
#include "tgsi/tgsi_util.h"
@@ -95,6 +96,19 @@ struct lp_exec_mask {
int cond_stack_size;
LLVMValueRef cond_mask;
+ LLVMValueRef break_stack[LP_TGSI_MAX_NESTING];
+ int break_stack_size;
+ LLVMValueRef break_mask;
+
+ LLVMValueRef cont_stack[LP_TGSI_MAX_NESTING];
+ int cont_stack_size;
+ LLVMValueRef cont_mask;
+
+ LLVMBasicBlockRef loop_stack[LP_TGSI_MAX_NESTING];
+ int loop_stack_size;
+ LLVMBasicBlockRef loop_block;
+
+
LLVMValueRef exec_mask;
};
@@ -145,15 +159,33 @@ static void lp_exec_mask_init(struct lp_exec_mask *mask, struct lp_build_context
mask->bld = bld;
mask->has_mask = FALSE;
mask->cond_stack_size = 0;
+ mask->loop_stack_size = 0;
+ mask->break_stack_size = 0;
+ mask->cont_stack_size = 0;
mask->int_vec_type = lp_build_int_vec_type(mask->bld->type);
}
static void lp_exec_mask_update(struct lp_exec_mask *mask)
{
- mask->exec_mask = mask->cond_mask;
- if (mask->cond_stack_size > 0)
- mask->has_mask = TRUE;
+ if (mask->loop_stack_size) {
+ /*for loops we need to update the entire mask at
+ * runtime */
+ LLVMValueRef tmp;
+ tmp = LLVMBuildAnd(mask->bld->builder,
+ mask->cont_mask,
+ mask->break_mask,
+ "maskcb");
+ mask->exec_mask = LLVMBuildAnd(mask->bld->builder,
+ mask->cond_mask,
+ tmp,
+ "maskfull");
+ } else
+ mask->exec_mask = mask->cond_mask;
+
+
+ mask->has_mask = (mask->cond_stack_size > 0 ||
+ mask->loop_stack_size > 0);
}
static void lp_exec_mask_cond_push(struct lp_exec_mask *mask,
@@ -190,6 +222,89 @@ static void lp_exec_mask_cond_pop(struct lp_exec_mask *mask)
lp_exec_mask_update(mask);
}
+static void lp_exec_bgnloop(struct lp_exec_mask *mask)
+{
+
+ if (mask->cont_stack_size == 0)
+ mask->cont_mask = LLVMConstAllOnes(mask->int_vec_type);
+ if (mask->cont_stack_size == 0)
+ mask->break_mask = LLVMConstAllOnes(mask->int_vec_type);
+ if (mask->cond_stack_size == 0)
+ mask->cond_mask = LLVMConstAllOnes(mask->int_vec_type);
+ mask->loop_stack[mask->loop_stack_size++] = mask->loop_block;
+ mask->loop_block = lp_build_insert_new_block(mask->bld->builder, "bgnloop");
+ LLVMBuildBr(mask->bld->builder, mask->loop_block);
+ LLVMPositionBuilderAtEnd(mask->bld->builder, mask->loop_block);
+
+ lp_exec_mask_update(mask);
+}
+
+static void lp_exec_break(struct lp_exec_mask *mask)
+{
+ LLVMValueRef exec_mask = LLVMBuildNot(mask->bld->builder,
+ mask->exec_mask,
+ "break");
+
+ mask->break_stack[mask->break_stack_size++] = mask->break_mask;
+ if (mask->break_stack_size > 1) {
+ mask->break_mask = LLVMBuildAnd(mask->bld->builder,
+ mask->break_mask,
+ exec_mask, "break_full");
+ } else
+ mask->break_mask = exec_mask;
+
+ lp_exec_mask_update(mask);
+}
+
+static void lp_exec_continue(struct lp_exec_mask *mask)
+{
+ LLVMValueRef exec_mask = LLVMBuildNot(mask->bld->builder,
+ mask->exec_mask,
+ "");
+
+ mask->cont_stack[mask->cont_stack_size++] = mask->cont_mask;
+ if (mask->cont_stack_size > 1) {
+ mask->cont_mask = LLVMBuildAnd(mask->bld->builder,
+ mask->cont_mask,
+ exec_mask, "");
+ } else
+ mask->cont_mask = exec_mask;
+
+ lp_exec_mask_update(mask);
+}
+
+
+static void lp_exec_endloop(struct lp_exec_mask *mask)
+{
+ LLVMBasicBlockRef endloop;
+ LLVMTypeRef reg_type = LLVMIntType(mask->bld->type.width*
+ mask->bld->type.length);
+ /* i1cond = (mask == 0) */
+ LLVMValueRef i1cond = LLVMBuildICmp(
+ mask->bld->builder,
+ LLVMIntNE,
+ LLVMBuildBitCast(mask->bld->builder, mask->break_mask, reg_type, ""),
+ LLVMConstNull(reg_type), "");
+
+ endloop = lp_build_insert_new_block(mask->bld->builder, "endloop");
+
+ LLVMBuildCondBr(mask->bld->builder,
+ i1cond, mask->loop_block, endloop);
+
+ LLVMPositionBuilderAtEnd(mask->bld->builder, endloop);
+
+ mask->loop_block = mask->loop_stack[--mask->loop_stack_size];
+ /* pop the break mask */
+ if (mask->cont_stack_size) {
+ mask->cont_mask = mask->cont_stack[--mask->cont_stack_size];
+ }
+ if (mask->break_stack_size) {
+ mask->break_mask = mask->cont_stack[--mask->break_stack_size];
+ }
+
+ lp_exec_mask_update(mask);
+}
+
static void lp_exec_mask_store(struct lp_exec_mask *mask,
LLVMValueRef val,
LLVMValueRef dst)
@@ -360,7 +475,7 @@ emit_store(
break;
case TGSI_SAT_MINUS_PLUS_ONE:
- value = lp_build_max(&bld->base, value, lp_build_const_scalar(bld->base.type, -1.0));
+ value = lp_build_max(&bld->base, value, lp_build_const_vec(bld->base.type, -1.0));
value = lp_build_min(&bld->base, value, bld->base.one);
break;
@@ -384,6 +499,11 @@ emit_store(
assert(0);
break;
+ case TGSI_FILE_PREDICATE:
+ /* FIXME */
+ assert(0);
+ break;
+
default:
assert( 0 );
}
@@ -531,32 +651,40 @@ emit_declaration(
unsigned first = decl->Range.First;
unsigned last = decl->Range.Last;
unsigned idx, i;
+ LLVMBasicBlockRef current_block =
+ LLVMGetInsertBlock(bld->base.builder);
+ LLVMBasicBlockRef first_block =
+ LLVMGetEntryBasicBlock(
+ LLVMGetBasicBlockParent(current_block));
+ LLVMValueRef first_inst =
+ LLVMGetFirstInstruction(first_block);
+
+ /* we want alloca's to be the first instruction
+ * in the function so we need to rewind the builder
+ * to the very beginning */
+ LLVMPositionBuilderBefore(bld->base.builder,
+ first_inst);
for (idx = first; idx <= last; ++idx) {
- boolean ok;
-
switch (decl->Declaration.File) {
case TGSI_FILE_TEMPORARY:
for (i = 0; i < NUM_CHANNELS; i++)
bld->temps[idx][i] = lp_build_alloca(&bld->base);
- ok = TRUE;
break;
case TGSI_FILE_OUTPUT:
for (i = 0; i < NUM_CHANNELS; i++)
bld->outputs[idx][i] = lp_build_alloca(&bld->base);
- ok = TRUE;
break;
default:
/* don't need to declare other vars */
- ok = TRUE;
+ break;
}
-
- if (!ok)
- return FALSE;
}
+ LLVMPositionBuilderAtEnd(bld->base.builder,
+ current_block);
return TRUE;
}
@@ -581,6 +709,17 @@ emit_instruction(
if (indirect_temp_reference(inst))
return FALSE;
+ /*
+ * Stores and write masks are handled in a general fashion after the long
+ * instruction opcode switch statement.
+ *
+ * Although not stricitly necessary, we avoid generating instructions for
+ * channels which won't be stored, in cases where's that easy. For some
+ * complex instructions, like texture sampling, it is more convenient to
+ * assume a full writemask and then let LLVM optimization passes eliminate
+ * redundant code.
+ */
+
assert(info->num_dst <= 1);
if(info->num_dst) {
FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) {
@@ -865,7 +1004,7 @@ emit_instruction(
src0 = emit_fetch( bld, inst, 0, chan_index );
src1 = emit_fetch( bld, inst, 1, chan_index );
src2 = emit_fetch( bld, inst, 2, chan_index );
- tmp1 = lp_build_const_scalar(bld->base.type, 0.5);
+ tmp1 = lp_build_const_vec(bld->base.type, 0.5);
tmp0 = lp_build_cmp( &bld->base, PIPE_FUNC_GREATER, src2, tmp1);
dst0[chan_index] = lp_build_select( &bld->base, tmp0, src0, src1 );
}
@@ -1126,7 +1265,6 @@ emit_instruction(
break;
case TGSI_OPCODE_TEX:
- /* XXX what about dst0 writemask? */
emit_tex( bld, inst, FALSE, FALSE, dst0 );
break;
@@ -1349,14 +1487,15 @@ emit_instruction(
case TGSI_OPCODE_TXP:
emit_tex( bld, inst, FALSE, TRUE, dst0 );
break;
-
+
case TGSI_OPCODE_BRK:
- /* FIXME */
- return 0;
+ lp_exec_break(&bld->exec_mask);
break;
case TGSI_OPCODE_IF:
tmp0 = emit_fetch(bld, inst, 0, CHAN_X);
+ tmp0 = lp_build_cmp(&bld->base, PIPE_FUNC_NOTEQUAL,
+ tmp0, bld->base.zero);
lp_exec_mask_cond_push(&bld->exec_mask, tmp0);
break;
@@ -1366,6 +1505,10 @@ emit_instruction(
return 0;
break;
+ case TGSI_OPCODE_BGNLOOP:
+ lp_exec_bgnloop(&bld->exec_mask);
+ break;
+
case TGSI_OPCODE_REP:
/* deprecated */
assert(0);
@@ -1386,6 +1529,10 @@ emit_instruction(
return 0;
break;
+ case TGSI_OPCODE_ENDLOOP:
+ lp_exec_endloop(&bld->exec_mask);
+ break;
+
case TGSI_OPCODE_ENDREP:
/* deprecated */
assert(0);
@@ -1485,8 +1632,7 @@ emit_instruction(
break;
case TGSI_OPCODE_CONT:
- /* FIXME */
- return 0;
+ lp_exec_continue(&bld->exec_mask);
break;
case TGSI_OPCODE_EMIT:
@@ -1575,7 +1721,7 @@ lp_build_tgsi_soa(LLVMBuilderRef builder,
assert(num_immediates < LP_MAX_IMMEDIATES);
for( i = 0; i < size; ++i )
bld.immediates[num_immediates][i] =
- lp_build_const_scalar(type, parse.FullToken.FullImmediate.u[i].Float);
+ lp_build_const_vec(type, parse.FullToken.FullImmediate.u[i].Float);
for( i = size; i < 4; ++i )
bld.immediates[num_immediates][i] = bld.base.undef;
num_immediates++;
@@ -1589,7 +1735,14 @@ lp_build_tgsi_soa(LLVMBuilderRef builder,
assert( 0 );
}
}
-
+ if (0) {
+ LLVMBasicBlockRef block = LLVMGetInsertBlock(builder);
+ LLVMValueRef function = LLVMGetBasicBlockParent(block);
+ debug_printf("11111111111111111111111111111 \n");
+ tgsi_dump(tokens, 0);
+ LLVMDumpValue(function);
+ debug_printf("2222222222222222222222222222 \n");
+ }
tgsi_parse_free( &parse );
}
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_type.c b/src/gallium/auxiliary/gallivm/lp_bld_type.c
index c327ba045a..796af88caa 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_type.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_type.c
@@ -58,7 +58,10 @@ LLVMTypeRef
lp_build_vec_type(struct lp_type type)
{
LLVMTypeRef elem_type = lp_build_elem_type(type);
- return LLVMVectorType(elem_type, type.length);
+ if (type.length == 1)
+ return elem_type;
+ else
+ return LLVMVectorType(elem_type, type.length);
}
@@ -115,6 +118,9 @@ lp_check_vec_type(struct lp_type type, LLVMTypeRef vec_type)
if(!vec_type)
return FALSE;
+ if (type.length == 1)
+ return lp_check_elem_type(type, vec_type);
+
if(LLVMGetTypeKind(vec_type) != LLVMVectorTypeKind)
return FALSE;
@@ -153,7 +159,10 @@ LLVMTypeRef
lp_build_int_vec_type(struct lp_type type)
{
LLVMTypeRef elem_type = lp_build_int_elem_type(type);
- return LLVMVectorType(elem_type, type.length);
+ if (type.length == 1)
+ return elem_type;
+ else
+ return LLVMVectorType(elem_type, type.length);
}
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_type.h b/src/gallium/auxiliary/gallivm/lp_bld_type.h
index 16946cc28a..cd59d2faa6 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_type.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_type.h
@@ -37,9 +37,9 @@
#define LP_BLD_TYPE_H
-#include <llvm-c/Core.h>
+#include "pipe/p_compiler.h"
+#include "gallivm/lp_bld.h"
-#include <pipe/p_compiler.h>
/**
@@ -103,7 +103,7 @@ struct lp_type {
unsigned width:14;
/**
- * Vector length.
+ * Vector length. If length==1, this is a scalar (float/int) type.
*
* width*length should be a power of two greater or equal to eight.
*
@@ -139,6 +139,7 @@ struct lp_build_context
};
+/** Create scalar float type */
static INLINE struct lp_type
lp_type_float(unsigned width)
{
@@ -148,12 +149,29 @@ lp_type_float(unsigned width)
res_type.floating = TRUE;
res_type.sign = TRUE;
res_type.width = width;
+ res_type.length = 1;
+
+ return res_type;
+}
+
+
+/** Create vector of float type */
+static INLINE struct lp_type
+lp_type_float_vec(unsigned width)
+{
+ struct lp_type res_type;
+
+ memset(&res_type, 0, sizeof res_type);
+ res_type.floating = TRUE;
+ res_type.sign = TRUE;
+ res_type.width = width;
res_type.length = LP_NATIVE_VECTOR_WIDTH / width;
return res_type;
}
+/** Create scalar int type */
static INLINE struct lp_type
lp_type_int(unsigned width)
{
@@ -162,12 +180,28 @@ lp_type_int(unsigned width)
memset(&res_type, 0, sizeof res_type);
res_type.sign = TRUE;
res_type.width = width;
+ res_type.length = 1;
+
+ return res_type;
+}
+
+
+/** Create vector int type */
+static INLINE struct lp_type
+lp_type_int_vec(unsigned width)
+{
+ struct lp_type res_type;
+
+ memset(&res_type, 0, sizeof res_type);
+ res_type.sign = TRUE;
+ res_type.width = width;
res_type.length = LP_NATIVE_VECTOR_WIDTH / width;
return res_type;
}
+/** Create scalar uint type */
static INLINE struct lp_type
lp_type_uint(unsigned width)
{
@@ -175,6 +209,20 @@ lp_type_uint(unsigned width)
memset(&res_type, 0, sizeof res_type);
res_type.width = width;
+ res_type.length = 1;
+
+ return res_type;
+}
+
+
+/** Create vector uint type */
+static INLINE struct lp_type
+lp_type_uint_vec(unsigned width)
+{
+ struct lp_type res_type;
+
+ memset(&res_type, 0, sizeof res_type);
+ res_type.width = width;
res_type.length = LP_NATIVE_VECTOR_WIDTH / width;
return res_type;
diff --git a/src/gallium/auxiliary/os/os_thread.h b/src/gallium/auxiliary/os/os_thread.h
index a04df4106f..004dad6b63 100644
--- a/src/gallium/auxiliary/os/os_thread.h
+++ b/src/gallium/auxiliary/os/os_thread.h
@@ -40,7 +40,7 @@
#include "util/u_debug.h" /* for assert */
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_EMBEDDED)
#include <pthread.h> /* POSIX threads headers */
#include <stdio.h> /* for perror() */
@@ -257,7 +257,7 @@ typedef unsigned pipe_condvar;
* pipe_barrier
*/
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_HAIKU)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_EMBEDDED)
typedef pthread_barrier_t pipe_barrier;
@@ -377,7 +377,7 @@ pipe_semaphore_wait(pipe_semaphore *sema)
*/
typedef struct {
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_EMBEDDED)
pthread_key_t key;
#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
DWORD key;
@@ -392,7 +392,7 @@ typedef struct {
static INLINE void
pipe_tsd_init(pipe_tsd *tsd)
{
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_EMBEDDED)
if (pthread_key_create(&tsd->key, NULL/*free*/) != 0) {
perror("pthread_key_create(): failed to allocate key for thread specific data");
exit(-1);
@@ -409,7 +409,7 @@ pipe_tsd_get(pipe_tsd *tsd)
if (tsd->initMagic != (int) PIPE_TSD_INIT_MAGIC) {
pipe_tsd_init(tsd);
}
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_EMBEDDED)
return pthread_getspecific(tsd->key);
#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
assert(0);
@@ -426,7 +426,7 @@ pipe_tsd_set(pipe_tsd *tsd, void *value)
if (tsd->initMagic != (int) PIPE_TSD_INIT_MAGIC) {
pipe_tsd_init(tsd);
}
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_EMBEDDED)
if (pthread_setspecific(tsd->key, value) != 0) {
perror("pthread_set_specific() failed");
exit(-1);
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
index 86f9266c95..0f2ae05dae 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
@@ -227,6 +227,8 @@ pb_cache_is_buffer_compat(struct pb_cache_buffer *buf,
pb_size size,
const struct pb_desc *desc)
{
+ void *map;
+
if(buf->base.base.size < size)
return FALSE;
@@ -239,6 +241,13 @@ pb_cache_is_buffer_compat(struct pb_cache_buffer *buf,
if(!pb_check_usage(desc->usage, buf->base.base.usage))
return FALSE;
+
+ map = pb_map(buf->buffer, PIPE_BUFFER_USAGE_DONTBLOCK);
+ if (!map) {
+ return FALSE;
+ }
+
+ pb_unmap(buf->buffer);
return TRUE;
}
diff --git a/src/gallium/auxiliary/rtasm/rtasm_x86sse.c b/src/gallium/auxiliary/rtasm/rtasm_x86sse.c
index f675427d98..7595214bdf 100644
--- a/src/gallium/auxiliary/rtasm/rtasm_x86sse.c
+++ b/src/gallium/auxiliary/rtasm/rtasm_x86sse.c
@@ -87,7 +87,7 @@ void x86_print_reg( struct x86_reg reg )
foo++; \
if (*foo) \
foo++; \
- debug_printf( "\n% 4x% 15s ", p->csr - p->store, foo ); \
+ debug_printf( "\n%4x %14s ", p->csr - p->store, foo ); \
} while (0)
#define DUMP_I( I ) do { \
diff --git a/src/gallium/auxiliary/rtasm/rtasm_x86sse.h b/src/gallium/auxiliary/rtasm/rtasm_x86sse.h
index f7612d416a..319b836ffb 100644
--- a/src/gallium/auxiliary/rtasm/rtasm_x86sse.h
+++ b/src/gallium/auxiliary/rtasm/rtasm_x86sse.h
@@ -102,7 +102,7 @@ enum sse_cc {
#define cc_Z cc_E
#define cc_NZ cc_NE
-/* Begin/end/retreive function creation:
+/* Begin/end/retrieve function creation:
*/
@@ -311,8 +311,8 @@ void x87_fucom( struct x86_function *p, struct x86_reg arg );
-/* Retreive a reference to one of the function arguments, taking into
- * account any push/pop activity. Note - doesn't track explict
+/* Retrieve a reference to one of the function arguments, taking into
+ * account any push/pop activity. Note - doesn't track explicit
* manipulation of ESP by other instructions.
*/
struct x86_reg x86_fn_arg( struct x86_function *p, unsigned arg );
diff --git a/src/gallium/auxiliary/target-helpers/wrap_screen.c b/src/gallium/auxiliary/target-helpers/wrap_screen.c
new file mode 100644
index 0000000000..5fe3013938
--- /dev/null
+++ b/src/gallium/auxiliary/target-helpers/wrap_screen.c
@@ -0,0 +1,65 @@
+/**************************************************************************
+ *
+ * Copyright 2007 Tungsten Graphics, Inc., Bismarck, ND., USA
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ *
+ **************************************************************************/
+
+/*
+ * Authors:
+ * Keith Whitwell
+ */
+
+#include "target-helpers/wrap_screen.h"
+#include "trace/tr_public.h"
+#include "identity/id_public.h"
+#include "util/u_debug.h"
+
+
+/* Centralized code to inject common wrapping layers:
+ */
+struct pipe_screen *
+gallium_wrap_screen( struct pipe_screen *screen )
+{
+ /* Screen wrapping functions are required not to fail. If it is
+ * impossible to wrap a screen, the unwrapped screen should be
+ * returned instead. Any failure condition should be returned in
+ * an OUT argument.
+ *
+ * Otherwise it is really messy trying to clean up in this code.
+ */
+ if (debug_get_bool_option("GALLIUM_WRAP", FALSE)) {
+ screen = identity_screen_create(screen);
+ }
+
+ if (debug_get_bool_option("GALLIUM_TRACE", FALSE)) {
+ screen = trace_screen_create( screen );
+ }
+
+ return screen;
+}
+
+
+
+
diff --git a/src/gallium/auxiliary/target-helpers/wrap_screen.h b/src/gallium/auxiliary/target-helpers/wrap_screen.h
new file mode 100644
index 0000000000..7e76beb7c5
--- /dev/null
+++ b/src/gallium/auxiliary/target-helpers/wrap_screen.h
@@ -0,0 +1,16 @@
+#ifndef WRAP_SCREEN_HELPER_H
+#define WRAP_SCREEN_HELPER_H
+
+#include "pipe/p_compiler.h"
+
+struct pipe_screen;
+
+/* Centralized code to inject common wrapping layers. Other layers
+ * can be introduced by specific targets, but these are the generally
+ * helpful ones we probably want everywhere.
+ */
+struct pipe_screen *
+gallium_wrap_screen( struct pipe_screen *screen );
+
+
+#endif
diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c
index f918151daa..0b468a9184 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_text.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
@@ -55,7 +55,7 @@ static boolean is_digit_alpha_underscore( const char *cur )
return is_digit( cur ) || is_alpha_underscore( cur );
}
-static boolean uprcase( char c )
+static char uprcase( char c )
{
if (c >= 'a' && c <= 'z')
return c += 'A' - 'a';
@@ -76,7 +76,7 @@ streq_nocase_uprcase(const char *str1,
str1++;
str2++;
}
- return TRUE;
+ return *str1 == 0 && *str2 == 0;
}
static boolean str_match_no_case( const char **pcur, const char *str )
diff --git a/src/gallium/auxiliary/translate/translate_generic.c b/src/gallium/auxiliary/translate/translate_generic.c
index c9ec2b32bf..c3ec9ae3f4 100644
--- a/src/gallium/auxiliary/translate/translate_generic.c
+++ b/src/gallium/auxiliary/translate/translate_generic.c
@@ -393,10 +393,10 @@ static fetch_func get_fetch_func( enum pipe_format format )
return &fetch_R8G8B8A8_SSCALED;
case PIPE_FORMAT_B8G8R8A8_UNORM:
- return &fetch_A8R8G8B8_UNORM;
+ return &fetch_B8G8R8A8_UNORM;
case PIPE_FORMAT_A8R8G8B8_UNORM:
- return &fetch_B8G8R8A8_UNORM;
+ return &fetch_A8R8G8B8_UNORM;
case PIPE_FORMAT_R32_FIXED:
return &fetch_R32_FIXED;
@@ -552,10 +552,10 @@ static emit_func get_emit_func( enum pipe_format format )
return &emit_R8G8B8A8_SSCALED;
case PIPE_FORMAT_B8G8R8A8_UNORM:
- return &emit_A8R8G8B8_UNORM;
+ return &emit_B8G8R8A8_UNORM;
case PIPE_FORMAT_A8R8G8B8_UNORM:
- return &emit_B8G8R8A8_UNORM;
+ return &emit_A8R8G8B8_UNORM;
default:
assert(0);
diff --git a/src/gallium/auxiliary/translate/translate_sse.c b/src/gallium/auxiliary/translate/translate_sse.c
index 03e093c11e..c13e742738 100644
--- a/src/gallium/auxiliary/translate/translate_sse.c
+++ b/src/gallium/auxiliary/translate/translate_sse.c
@@ -336,7 +336,7 @@ static boolean translate_attr( struct translate_sse *p,
case PIPE_FORMAT_R32G32B32A32_FLOAT:
emit_load_R32G32B32A32(p, dataXMM, srcECX);
break;
- case PIPE_FORMAT_A8R8G8B8_UNORM:
+ case PIPE_FORMAT_B8G8R8A8_UNORM:
emit_load_R8G8B8A8_UNORM(p, dataXMM, srcECX);
emit_swizzle(p, dataXMM, dataXMM, SHUF(Z,Y,X,W));
break;
@@ -360,7 +360,7 @@ static boolean translate_attr( struct translate_sse *p,
case PIPE_FORMAT_R32G32B32A32_FLOAT:
emit_store_R32G32B32A32(p, dstEAX, dataXMM);
break;
- case PIPE_FORMAT_A8R8G8B8_UNORM:
+ case PIPE_FORMAT_B8G8R8A8_UNORM:
emit_swizzle(p, dataXMM, dataXMM, SHUF(Z,Y,X,W));
emit_store_R8G8B8A8_UNORM(p, dstEAX, dataXMM);
break;
diff --git a/src/gallium/auxiliary/util/.gitignore b/src/gallium/auxiliary/util/.gitignore
index 448d2f304f..53fe9b8a65 100644
--- a/src/gallium/auxiliary/util/.gitignore
+++ b/src/gallium/auxiliary/util/.gitignore
@@ -1,3 +1 @@
-u_format_access.c
u_format_table.c
-u_format_pack.h
diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c
index 0b263a9db5..cd95f85b63 100644
--- a/src/gallium/auxiliary/util/u_blit.c
+++ b/src/gallium/auxiliary/util/u_blit.c
@@ -45,6 +45,7 @@
#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
+#include "util/u_sampler.h"
#include "util/u_simple_shaders.h"
#include "util/u_surface.h"
#include "util/u_rect.h"
@@ -63,6 +64,7 @@ struct blit_state
struct pipe_sampler_state sampler;
struct pipe_viewport_state viewport;
struct pipe_clip_state clip;
+ struct pipe_vertex_element velem[2];
void *vs;
void *fs[TGSI_WRITEMASK_XYZW + 1];
@@ -114,6 +116,15 @@ util_create_blit(struct pipe_context *pipe, struct cso_context *cso)
ctx->sampler.mag_img_filter = 0; /* set later */
ctx->sampler.normalized_coords = 1;
+ /* vertex elements state */
+ memset(&ctx->velem[0], 0, sizeof(ctx->velem[0]) * 2);
+ for (i = 0; i < 2; i++) {
+ ctx->velem[i].src_offset = i * 4 * sizeof(float);
+ ctx->velem[i].instance_divisor = 0;
+ ctx->velem[i].vertex_buffer_index = 0;
+ ctx->velem[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+ }
+
/* vertex shader - still required to provide the linkage between
* fragment shader input semantics and vertex_element/buffers.
*/
@@ -270,6 +281,7 @@ regions_overlap(int srcX0, int srcY0,
void
util_blit_pixels_writemask(struct blit_state *ctx,
struct pipe_surface *src,
+ struct pipe_sampler_view *src_sampler_view,
int srcX0, int srcY0,
int srcX1, int srcY1,
struct pipe_surface *dst,
@@ -280,7 +292,7 @@ util_blit_pixels_writemask(struct blit_state *ctx,
{
struct pipe_context *pipe = ctx->pipe;
struct pipe_screen *screen = pipe->screen;
- struct pipe_texture *tex = NULL;
+ struct pipe_sampler_view *sampler_view = NULL;
struct pipe_framebuffer_state fb;
const int srcW = abs(srcX1 - srcX0);
const int srcH = abs(srcY1 - srcY0);
@@ -335,6 +347,8 @@ util_blit_pixels_writemask(struct blit_state *ctx,
src->texture->last_level != 0)
{
struct pipe_texture texTemp;
+ struct pipe_texture *tex;
+ struct pipe_sampler_view sv_templ;
struct pipe_surface *texSurf;
const int srcLeft = MIN2(srcX0, srcX1);
const int srcTop = MIN2(srcY0, srcY1);
@@ -366,6 +380,14 @@ util_blit_pixels_writemask(struct blit_state *ctx,
if (!tex)
return;
+ u_sampler_view_default_template(&sv_templ, tex, tex->format);
+
+ sampler_view = ctx->pipe->create_sampler_view(ctx->pipe, tex, &sv_templ);
+ if (!sampler_view) {
+ pipe_texture_reference(&tex, NULL);
+ return;
+ }
+
texSurf = screen->get_tex_surface(screen, tex, 0, 0, 0,
PIPE_BUFFER_USAGE_GPU_WRITE);
@@ -389,33 +411,38 @@ util_blit_pixels_writemask(struct blit_state *ctx,
s1 = 1.0f;
t0 = 0.0f;
t1 = 1.0f;
+
+ pipe_texture_reference(&tex, NULL);
}
else {
- pipe_texture_reference(&tex, src->texture);
- s0 = srcX0 / (float)tex->width0;
- s1 = srcX1 / (float)tex->width0;
- t0 = srcY0 / (float)tex->height0;
- t1 = srcY1 / (float)tex->height0;
+ pipe_sampler_view_reference(&sampler_view, src_sampler_view);
+ s0 = srcX0 / (float)src->texture->width0;
+ s1 = srcX1 / (float)src->texture->width0;
+ t0 = srcY0 / (float)src->texture->height0;
+ t1 = srcY1 / (float)src->texture->height0;
}
+
/* save state (restored below) */
cso_save_blend(ctx->cso);
cso_save_depth_stencil_alpha(ctx->cso);
cso_save_rasterizer(ctx->cso);
cso_save_samplers(ctx->cso);
- cso_save_sampler_textures(ctx->cso);
+ cso_save_fragment_sampler_views(ctx->cso);
cso_save_viewport(ctx->cso);
cso_save_framebuffer(ctx->cso);
cso_save_fragment_shader(ctx->cso);
cso_save_vertex_shader(ctx->cso);
cso_save_clip(ctx->cso);
+ cso_save_vertex_elements(ctx->cso);
/* set misc state we care about */
cso_set_blend(ctx->cso, &ctx->blend);
cso_set_depth_stencil_alpha(ctx->cso, &ctx->depthstencil);
cso_set_rasterizer(ctx->cso, &ctx->rasterizer);
cso_set_clip(ctx->cso, &ctx->clip);
+ cso_set_vertex_elements(ctx->cso, 2, ctx->velem);
/* sampler */
ctx->sampler.min_img_filter = filter;
@@ -435,7 +462,7 @@ util_blit_pixels_writemask(struct blit_state *ctx,
cso_set_viewport(ctx->cso, &ctx->viewport);
/* texture */
- cso_set_sampler_textures(ctx->cso, 1, &tex);
+ cso_set_fragment_sampler_views(ctx->cso, 1, &sampler_view);
if (ctx->fs[writemask] == NULL)
ctx->fs[writemask] =
@@ -474,20 +501,22 @@ util_blit_pixels_writemask(struct blit_state *ctx,
cso_restore_depth_stencil_alpha(ctx->cso);
cso_restore_rasterizer(ctx->cso);
cso_restore_samplers(ctx->cso);
- cso_restore_sampler_textures(ctx->cso);
+ cso_restore_fragment_sampler_views(ctx->cso);
cso_restore_viewport(ctx->cso);
cso_restore_framebuffer(ctx->cso);
cso_restore_fragment_shader(ctx->cso);
cso_restore_vertex_shader(ctx->cso);
cso_restore_clip(ctx->cso);
+ cso_restore_vertex_elements(ctx->cso);
- pipe_texture_reference(&tex, NULL);
+ pipe_sampler_view_reference(&sampler_view, NULL);
}
void
util_blit_pixels(struct blit_state *ctx,
struct pipe_surface *src,
+ struct pipe_sampler_view *src_sampler_view,
int srcX0, int srcY0,
int srcX1, int srcY1,
struct pipe_surface *dst,
@@ -495,7 +524,7 @@ util_blit_pixels(struct blit_state *ctx,
int dstX1, int dstY1,
float z, uint filter )
{
- util_blit_pixels_writemask( ctx, src,
+ util_blit_pixels_writemask( ctx, src, src_sampler_view,
srcX0, srcY0,
srcX1, srcY1,
dst,
@@ -526,21 +555,23 @@ void util_blit_flush( struct blit_state *ctx )
*/
void
util_blit_pixels_tex(struct blit_state *ctx,
- struct pipe_texture *tex,
- int srcX0, int srcY0,
- int srcX1, int srcY1,
- struct pipe_surface *dst,
- int dstX0, int dstY0,
- int dstX1, int dstY1,
- float z, uint filter)
+ struct pipe_sampler_view *src_sampler_view,
+ int srcX0, int srcY0,
+ int srcX1, int srcY1,
+ struct pipe_surface *dst,
+ int dstX0, int dstY0,
+ int dstX1, int dstY1,
+ float z, uint filter)
{
struct pipe_framebuffer_state fb;
float s0, t0, s1, t1;
unsigned offset;
+ struct pipe_texture *tex = src_sampler_view->texture;
assert(filter == PIPE_TEX_MIPFILTER_NEAREST ||
filter == PIPE_TEX_MIPFILTER_LINEAR);
+ assert(tex);
assert(tex->width0 != 0);
assert(tex->height0 != 0);
@@ -559,17 +590,19 @@ util_blit_pixels_tex(struct blit_state *ctx,
cso_save_depth_stencil_alpha(ctx->cso);
cso_save_rasterizer(ctx->cso);
cso_save_samplers(ctx->cso);
- cso_save_sampler_textures(ctx->cso);
+ cso_save_fragment_sampler_views(ctx->cso);
cso_save_framebuffer(ctx->cso);
cso_save_fragment_shader(ctx->cso);
cso_save_vertex_shader(ctx->cso);
cso_save_clip(ctx->cso);
+ cso_save_vertex_elements(ctx->cso);
/* set misc state we care about */
cso_set_blend(ctx->cso, &ctx->blend);
cso_set_depth_stencil_alpha(ctx->cso, &ctx->depthstencil);
cso_set_rasterizer(ctx->cso, &ctx->rasterizer);
cso_set_clip(ctx->cso, &ctx->clip);
+ cso_set_vertex_elements(ctx->cso, 2, ctx->velem);
/* sampler */
ctx->sampler.min_img_filter = filter;
@@ -589,7 +622,7 @@ util_blit_pixels_tex(struct blit_state *ctx,
cso_set_viewport(ctx->cso, &ctx->viewport);
/* texture */
- cso_set_sampler_textures(ctx->cso, 1, &tex);
+ cso_set_fragment_sampler_views(ctx->cso, 1, &src_sampler_view);
/* shaders */
cso_set_fragment_shader_handle(ctx->cso, ctx->fs[TGSI_WRITEMASK_XYZW]);
@@ -623,9 +656,10 @@ util_blit_pixels_tex(struct blit_state *ctx,
cso_restore_depth_stencil_alpha(ctx->cso);
cso_restore_rasterizer(ctx->cso);
cso_restore_samplers(ctx->cso);
- cso_restore_sampler_textures(ctx->cso);
+ cso_restore_fragment_sampler_views(ctx->cso);
cso_restore_framebuffer(ctx->cso);
cso_restore_fragment_shader(ctx->cso);
cso_restore_vertex_shader(ctx->cso);
cso_restore_clip(ctx->cso);
+ cso_restore_vertex_elements(ctx->cso);
}
diff --git a/src/gallium/auxiliary/util/u_blit.h b/src/gallium/auxiliary/util/u_blit.h
index a102021529..1ebe65b455 100644
--- a/src/gallium/auxiliary/util/u_blit.h
+++ b/src/gallium/auxiliary/util/u_blit.h
@@ -53,6 +53,7 @@ util_destroy_blit(struct blit_state *ctx);
extern void
util_blit_pixels(struct blit_state *ctx,
struct pipe_surface *src,
+ struct pipe_sampler_view *src_sampler_view,
int srcX0, int srcY0,
int srcX1, int srcY1,
struct pipe_surface *dst,
@@ -63,6 +64,7 @@ util_blit_pixels(struct blit_state *ctx,
void
util_blit_pixels_writemask(struct blit_state *ctx,
struct pipe_surface *src,
+ struct pipe_sampler_view *src_sampler_view,
int srcX0, int srcY0,
int srcX1, int srcY1,
struct pipe_surface *dst,
@@ -73,7 +75,7 @@ util_blit_pixels_writemask(struct blit_state *ctx,
extern void
util_blit_pixels_tex(struct blit_state *ctx,
- struct pipe_texture *tex,
+ struct pipe_sampler_view *src_sampler_view,
int srcX0, int srcY0,
int srcX1, int srcY1,
struct pipe_surface *dst,
diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
index 0ba09d33bf..1692987e8e 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -45,6 +45,7 @@
#include "util/u_draw_quad.h"
#include "util/u_pack_color.h"
#include "util/u_rect.h"
+#include "util/u_sampler.h"
#include "util/u_simple_shaders.h"
#include "util/u_texture.h"
@@ -88,12 +89,16 @@ struct blitter_context_priv
void *dsa_write_depth_keep_stencil;
void *dsa_keep_depth_stencil;
+ void *velem_state;
+
/* Sampler state for clamping to a miplevel. */
void *sampler_state[PIPE_MAX_TEXTURE_LEVELS];
/* Rasterizer state. */
void *rs_state;
+ struct pipe_sampler_view *sampler_view;
+
/* Viewport state. */
struct pipe_viewport_state viewport;
@@ -104,10 +109,11 @@ struct blitter_context_priv
struct blitter_context *util_blitter_create(struct pipe_context *pipe)
{
struct blitter_context_priv *ctx;
- struct pipe_blend_state blend = { 0 };
- struct pipe_depth_stencil_alpha_state dsa = { { 0 } };
- struct pipe_rasterizer_state rs_state = { 0 };
+ struct pipe_blend_state blend;
+ struct pipe_depth_stencil_alpha_state dsa;
+ struct pipe_rasterizer_state rs_state;
struct pipe_sampler_state *sampler_state;
+ struct pipe_vertex_element velem[2];
unsigned i;
ctx = CALLOC_STRUCT(blitter_context_priv);
@@ -122,17 +128,20 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe)
ctx->blitter.saved_rs_state = INVALID_PTR;
ctx->blitter.saved_fs = INVALID_PTR;
ctx->blitter.saved_vs = INVALID_PTR;
+ ctx->blitter.saved_velem_state = INVALID_PTR;
ctx->blitter.saved_fb_state.nr_cbufs = ~0;
- ctx->blitter.saved_num_textures = ~0;
+ ctx->blitter.saved_num_sampler_views = ~0;
ctx->blitter.saved_num_sampler_states = ~0;
/* blend state objects */
+ memset(&blend, 0, sizeof(blend));
ctx->blend_keep_color = pipe->create_blend_state(pipe, &blend);
blend.rt[0].colormask = PIPE_MASK_RGBA;
ctx->blend_write_color = pipe->create_blend_state(pipe, &blend);
/* depth stencil alpha state objects */
+ memset(&dsa, 0, sizeof(dsa));
ctx->dsa_keep_depth_stencil =
pipe->create_depth_stencil_alpha_state(pipe, &dsa);
@@ -170,6 +179,16 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe)
rs_state.flatshade = 1;
ctx->rs_state = pipe->create_rasterizer_state(pipe, &rs_state);
+ /* vertex elements state */
+ memset(&velem[0], 0, sizeof(velem[0]) * 2);
+ for (i = 0; i < 2; i++) {
+ velem[i].src_offset = i * 4 * sizeof(float);
+ velem[i].instance_divisor = 0;
+ velem[i].vertex_buffer_index = 0;
+ velem[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+ }
+ ctx->velem_state = pipe->create_vertex_elements_state(pipe, 2, &velem[0]);
+
/* fragment shaders are created on-demand */
/* vertex shaders */
@@ -219,6 +238,7 @@ void util_blitter_destroy(struct blitter_context *blitter)
pipe->delete_rasterizer_state(pipe, ctx->rs_state);
pipe->delete_vs_state(pipe, ctx->vs_col);
pipe->delete_vs_state(pipe, ctx->vs_tex);
+ pipe->delete_vertex_elements_state(pipe, ctx->velem_state);
for (i = 0; i < PIPE_MAX_TEXTURE_TYPES; i++) {
if (ctx->fs_texfetch_col[i])
@@ -235,6 +255,10 @@ void util_blitter_destroy(struct blitter_context *blitter)
if (ctx->sampler_state[i])
pipe->delete_sampler_state(pipe, ctx->sampler_state[i]);
+ if (ctx->sampler_view) {
+ pipe_sampler_view_reference(&ctx->sampler_view, NULL);
+ }
+
pipe_buffer_reference(&ctx->vbuf, NULL);
FREE(ctx);
}
@@ -246,7 +270,8 @@ static void blitter_check_saved_CSOs(struct blitter_context_priv *ctx)
ctx->blitter.saved_dsa_state != INVALID_PTR &&
ctx->blitter.saved_rs_state != INVALID_PTR &&
ctx->blitter.saved_fs != INVALID_PTR &&
- ctx->blitter.saved_vs != INVALID_PTR);
+ ctx->blitter.saved_vs != INVALID_PTR &&
+ ctx->blitter.saved_velem_state != INVALID_PTR);
}
static void blitter_restore_CSOs(struct blitter_context_priv *ctx)
@@ -259,12 +284,14 @@ static void blitter_restore_CSOs(struct blitter_context_priv *ctx)
pipe->bind_rasterizer_state(pipe, ctx->blitter.saved_rs_state);
pipe->bind_fs_state(pipe, ctx->blitter.saved_fs);
pipe->bind_vs_state(pipe, ctx->blitter.saved_vs);
+ pipe->bind_vertex_elements_state(pipe, ctx->blitter.saved_velem_state);
ctx->blitter.saved_blend_state = INVALID_PTR;
ctx->blitter.saved_dsa_state = INVALID_PTR;
ctx->blitter.saved_rs_state = INVALID_PTR;
ctx->blitter.saved_fs = INVALID_PTR;
ctx->blitter.saved_vs = INVALID_PTR;
+ ctx->blitter.saved_velem_state = INVALID_PTR;
pipe->set_stencil_ref(pipe, &ctx->blitter.saved_stencil_ref);
@@ -285,11 +312,11 @@ static void blitter_restore_CSOs(struct blitter_context_priv *ctx)
ctx->blitter.saved_num_sampler_states = ~0;
}
- if (ctx->blitter.saved_num_textures != ~0) {
- pipe->set_fragment_sampler_textures(pipe,
- ctx->blitter.saved_num_textures,
- ctx->blitter.saved_textures);
- ctx->blitter.saved_num_textures = ~0;
+ if (ctx->blitter.saved_num_sampler_views != ~0) {
+ pipe->set_fragment_sampler_views(pipe,
+ ctx->blitter.saved_num_sampler_views,
+ ctx->blitter.saved_sampler_views);
+ ctx->blitter.saved_num_sampler_views = ~0;
}
}
@@ -569,6 +596,7 @@ void util_blitter_clear(struct blitter_context *blitter,
pipe->bind_depth_stencil_alpha_state(pipe, ctx->dsa_keep_depth_stencil);
pipe->bind_rasterizer_state(pipe, ctx->rs_state);
+ pipe->bind_vertex_elements_state(pipe, ctx->velem_state);
pipe->bind_fs_state(pipe, blitter_get_fs_col(ctx, num_cbufs));
pipe->bind_vs_state(pipe, ctx->vs_col);
@@ -600,9 +628,10 @@ static void util_blitter_do_copy(struct blitter_context *blitter,
struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter;
struct pipe_context *pipe = ctx->pipe;
struct pipe_framebuffer_state fb_state;
+ struct pipe_sampler_view viewTempl, *view;
assert(blitter->saved_fb_state.nr_cbufs != ~0);
- assert(blitter->saved_num_textures != ~0);
+ assert(blitter->saved_num_sampler_views != ~0);
assert(blitter->saved_num_sampler_states != ~0);
assert(src->texture->target < PIPE_MAX_TEXTURE_TYPES);
@@ -630,11 +659,24 @@ static void util_blitter_do_copy(struct blitter_context *blitter,
fb_state.zsbuf = 0;
}
+ u_sampler_view_default_template(&viewTempl,
+ src->texture,
+ src->texture->format);
+ view = pipe->create_sampler_view(pipe,
+ src->texture,
+ &viewTempl);
+
+ if (ctx->sampler_view) {
+ pipe_sampler_view_reference(&ctx->sampler_view, NULL);
+ }
+ ctx->sampler_view = view;
+
pipe->bind_rasterizer_state(pipe, ctx->rs_state);
pipe->bind_vs_state(pipe, ctx->vs_tex);
pipe->bind_fragment_sampler_states(pipe, 1,
blitter_get_sampler_state(ctx, src->level));
- pipe->set_fragment_sampler_textures(pipe, 1, &src->texture);
+ pipe->bind_vertex_elements_state(pipe, ctx->velem_state);
+ pipe->set_fragment_sampler_views(pipe, 1, &view);
pipe->set_framebuffer_state(pipe, &fb_state);
/* set texture coordinates */
@@ -807,6 +849,7 @@ void util_blitter_fill(struct blitter_context *blitter,
pipe->bind_rasterizer_state(pipe, ctx->rs_state);
pipe->bind_fs_state(pipe, blitter_get_fs_col(ctx, 1));
pipe->bind_vs_state(pipe, ctx->vs_col);
+ pipe->bind_vertex_elements_state(pipe, ctx->velem_state);
/* set a framebuffer state */
fb_state.width = dst->width;
diff --git a/src/gallium/auxiliary/util/u_blitter.h b/src/gallium/auxiliary/util/u_blitter.h
index 92008fce99..2ad7201a29 100644
--- a/src/gallium/auxiliary/util/u_blitter.h
+++ b/src/gallium/auxiliary/util/u_blitter.h
@@ -43,6 +43,7 @@ struct blitter_context
/* Private members, really. */
void *saved_blend_state; /**< blend state */
void *saved_dsa_state; /**< depth stencil alpha state */
+ void *saved_velem_state; /**< vertex elements state */
void *saved_rs_state; /**< rasterizer state */
void *saved_fs, *saved_vs; /**< fragment shader, vertex shader */
@@ -52,10 +53,10 @@ struct blitter_context
struct pipe_clip_state saved_clip;
int saved_num_sampler_states;
- void *saved_sampler_states[32];
+ void *saved_sampler_states[PIPE_MAX_SAMPLERS];
- int saved_num_textures;
- struct pipe_texture *saved_textures[32]; /* is 32 enough? */
+ int saved_num_sampler_views;
+ struct pipe_sampler_view *saved_sampler_views[PIPE_MAX_SAMPLERS];
};
/**
@@ -173,6 +174,13 @@ void util_blitter_save_depth_stencil_alpha(struct blitter_context *blitter,
}
static INLINE
+void util_blitter_save_vertex_elements(struct blitter_context *blitter,
+ void *state)
+{
+ blitter->saved_velem_state = state;
+}
+
+static INLINE
void util_blitter_save_stencil_ref(struct blitter_context *blitter,
const struct pipe_stencil_ref *state)
{
@@ -234,17 +242,17 @@ void util_blitter_save_fragment_sampler_states(
num_sampler_states * sizeof(void *));
}
-static INLINE
-void util_blitter_save_fragment_sampler_textures(
- struct blitter_context *blitter,
- int num_textures,
- struct pipe_texture **textures)
+static INLINE void
+util_blitter_save_fragment_sampler_views(struct blitter_context *blitter,
+ int num_views,
+ struct pipe_sampler_view **views)
{
- assert(num_textures <= Elements(blitter->saved_textures));
+ assert(num_views <= Elements(blitter->saved_sampler_views));
- blitter->saved_num_textures = num_textures;
- memcpy(blitter->saved_textures, textures,
- num_textures * sizeof(struct pipe_texture *));
+ blitter->saved_num_sampler_views = num_views;
+ memcpy(blitter->saved_sampler_views,
+ views,
+ num_views * sizeof(struct pipe_sampler_view *));
}
#ifdef __cplusplus
diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c
index 94be682c4b..e997cfa8a3 100644
--- a/src/gallium/auxiliary/util/u_debug.c
+++ b/src/gallium/auxiliary/util/u_debug.c
@@ -421,26 +421,31 @@ void debug_dump_image(const char *prefix,
#endif
}
-void debug_dump_surface(const char *prefix,
+void debug_dump_surface(struct pipe_context *pipe,
+ const char *prefix,
struct pipe_surface *surface)
{
struct pipe_texture *texture;
- struct pipe_screen *screen;
struct pipe_transfer *transfer;
void *data;
if (!surface)
return;
+ /* XXX: this doesn't necessarily work, as the driver may be using
+ * temporary storage for the surface which hasn't been propagated
+ * back into the texture. Need to nail down the semantics of views
+ * and transfers a bit better before we can say if extra work needs
+ * to be done here:
+ */
texture = surface->texture;
- screen = texture->screen;
- transfer = screen->get_tex_transfer(screen, texture, surface->face,
- surface->level, surface->zslice,
- PIPE_TRANSFER_READ, 0, 0, surface->width,
- surface->height);
+ transfer = pipe->get_tex_transfer(pipe, texture, surface->face,
+ surface->level, surface->zslice,
+ PIPE_TRANSFER_READ, 0, 0, surface->width,
+ surface->height);
- data = screen->transfer_map(screen, transfer);
+ data = pipe->transfer_map(pipe, transfer);
if(!data)
goto error;
@@ -452,13 +457,14 @@ void debug_dump_surface(const char *prefix,
transfer->stride,
data);
- screen->transfer_unmap(screen, transfer);
+ pipe->transfer_unmap(pipe, transfer);
error:
- screen->tex_transfer_destroy(transfer);
+ pipe->tex_transfer_destroy(pipe, transfer);
}
-void debug_dump_texture(const char *prefix,
+void debug_dump_texture(struct pipe_context *pipe,
+ const char *prefix,
struct pipe_texture *texture)
{
struct pipe_surface *surface;
@@ -473,7 +479,7 @@ void debug_dump_texture(const char *prefix,
surface = screen->get_tex_surface(screen, texture, 0, 0, 0,
PIPE_TEXTURE_USAGE_SAMPLER);
if (surface) {
- debug_dump_surface(prefix, surface);
+ debug_dump_surface(pipe, prefix, surface);
screen->tex_surface_destroy(surface);
}
}
@@ -511,27 +517,28 @@ struct bmp_rgb_quad {
};
void
-debug_dump_surface_bmp(const char *filename,
+debug_dump_surface_bmp(struct pipe_context *pipe,
+ const char *filename,
struct pipe_surface *surface)
{
#ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT
struct pipe_transfer *transfer;
struct pipe_texture *texture = surface->texture;
- struct pipe_screen *screen = texture->screen;
- transfer = screen->get_tex_transfer(screen, texture, surface->face,
- surface->level, surface->zslice,
- PIPE_TRANSFER_READ, 0, 0, surface->width,
- surface->height);
+ transfer = pipe->get_tex_transfer(pipe, texture, surface->face,
+ surface->level, surface->zslice,
+ PIPE_TRANSFER_READ, 0, 0, surface->width,
+ surface->height);
- debug_dump_transfer_bmp(filename, transfer);
+ debug_dump_transfer_bmp(pipe, filename, transfer);
- screen->tex_transfer_destroy(transfer);
+ pipe->tex_transfer_destroy(pipe, transfer);
#endif
}
void
-debug_dump_transfer_bmp(const char *filename,
+debug_dump_transfer_bmp(struct pipe_context *pipe,
+ const char *filename,
struct pipe_transfer *transfer)
{
#ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT
@@ -544,7 +551,7 @@ debug_dump_transfer_bmp(const char *filename,
if(!rgba)
goto error1;
- pipe_get_tile_rgba(transfer, 0, 0,
+ pipe_get_tile_rgba(pipe, transfer, 0, 0,
transfer->width, transfer->height,
rgba);
diff --git a/src/gallium/auxiliary/util/u_debug.h b/src/gallium/auxiliary/util/u_debug.h
index 0f4768f344..98addeb372 100644
--- a/src/gallium/auxiliary/util/u_debug.h
+++ b/src/gallium/auxiliary/util/u_debug.h
@@ -312,6 +312,7 @@ debug_memory_end(unsigned long beginning);
#ifdef DEBUG
+struct pipe_context;
struct pipe_surface;
struct pipe_transfer;
struct pipe_texture;
@@ -321,21 +322,25 @@ void debug_dump_image(const char *prefix,
unsigned width, unsigned height,
unsigned stride,
const void *data);
-void debug_dump_surface(const char *prefix,
+void debug_dump_surface(struct pipe_context *pipe,
+ const char *prefix,
struct pipe_surface *surface);
-void debug_dump_texture(const char *prefix,
+void debug_dump_texture(struct pipe_context *pipe,
+ const char *prefix,
struct pipe_texture *texture);
-void debug_dump_surface_bmp(const char *filename,
+void debug_dump_surface_bmp(struct pipe_context *pipe,
+ const char *filename,
struct pipe_surface *surface);
-void debug_dump_transfer_bmp(const char *filename,
+void debug_dump_transfer_bmp(struct pipe_context *pipe,
+ const char *filename,
struct pipe_transfer *transfer);
void debug_dump_float_rgba_bmp(const char *filename,
unsigned width, unsigned height,
float *rgba, unsigned stride);
#else
#define debug_dump_image(prefix, format, cpp, width, height, stride, data) ((void)0)
-#define debug_dump_surface(prefix, surface) ((void)0)
-#define debug_dump_surface_bmp(filename, surface) ((void)0)
+#define debug_dump_surface(pipe, prefix, surface) ((void)0)
+#define debug_dump_surface_bmp(pipe, filename, surface) ((void)0)
#define debug_dump_transfer_bmp(filename, transfer) ((void)0)
#define debug_dump_float_rgba_bmp(filename, width, height, rgba, stride) ((void)0)
#endif
diff --git a/src/gallium/auxiliary/util/u_draw_quad.c b/src/gallium/auxiliary/util/u_draw_quad.c
index 14506e8451..8c194102bf 100644
--- a/src/gallium/auxiliary/util/u_draw_quad.c
+++ b/src/gallium/auxiliary/util/u_draw_quad.c
@@ -45,8 +45,6 @@ util_draw_vertex_buffer(struct pipe_context *pipe,
uint num_attribs)
{
struct pipe_vertex_buffer vbuffer;
- struct pipe_vertex_element velements[PIPE_MAX_ATTRIBS];
- uint i;
assert(num_attribs <= PIPE_MAX_ATTRIBS);
@@ -58,15 +56,7 @@ util_draw_vertex_buffer(struct pipe_context *pipe,
vbuffer.max_index = num_verts - 1;
pipe->set_vertex_buffers(pipe, 1, &vbuffer);
- /* tell pipe about the vertex attributes */
- for (i = 0; i < num_attribs; i++) {
- velements[i].src_offset = i * 4 * sizeof(float);
- velements[i].instance_divisor = 0;
- velements[i].vertex_buffer_index = 0;
- velements[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
- velements[i].nr_components = 4;
- }
- pipe->set_vertex_elements(pipe, num_attribs, velements);
+ /* note: vertex elements already set by caller */
/* draw */
pipe->draw_arrays(pipe, prim_type, 0, num_verts);
diff --git a/src/gallium/auxiliary/util/u_dump_state.c b/src/gallium/auxiliary/util/u_dump_state.c
index ae7afd7311..52cf3ef4ce 100644
--- a/src/gallium/auxiliary/util/u_dump_state.c
+++ b/src/gallium/auxiliary/util/u_dump_state.c
@@ -700,7 +700,6 @@ util_dump_vertex_element(struct os_stream *stream, const struct pipe_vertex_elem
util_dump_member(stream, uint, state, src_offset);
util_dump_member(stream, uint, state, vertex_buffer_index);
- util_dump_member(stream, uint, state, nr_components);
util_dump_member(stream, format, state, src_format);
diff --git a/src/gallium/auxiliary/util/u_format.c b/src/gallium/auxiliary/util/u_format.c
new file mode 100644
index 0000000000..7f16cf7d01
--- /dev/null
+++ b/src/gallium/auxiliary/util/u_format.c
@@ -0,0 +1,118 @@
+/**************************************************************************
+ *
+ * Copyright 2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+/**
+ * @file
+ * Pixel format accessor functions.
+ *
+ * @author Jose Fonseca <jfonseca@vmware.com>
+ */
+
+#include "u_format.h"
+
+
+void
+util_format_read_4f(enum pipe_format format,
+ float *dst, unsigned dst_stride,
+ const void *src, unsigned src_stride,
+ unsigned x, unsigned y, unsigned w, unsigned h)
+{
+ const struct util_format_description *format_desc;
+ const uint8_t *src_row;
+ float *dst_row;
+
+ format_desc = util_format_description(format);
+
+ assert(x % format_desc->block.width == 0);
+ assert(y % format_desc->block.height == 0);
+
+ src_row = (const uint8_t *)src + y*src_stride + x*(format_desc->block.bits/8);
+ dst_row = dst;
+
+ format_desc->unpack_float(dst_row, dst_stride, src_row, src_stride, w, h);
+}
+
+
+void
+util_format_write_4f(enum pipe_format format,
+ const float *src, unsigned src_stride,
+ void *dst, unsigned dst_stride,
+ unsigned x, unsigned y, unsigned w, unsigned h)
+{
+ const struct util_format_description *format_desc;
+ uint8_t *dst_row;
+ const float *src_row;
+
+ format_desc = util_format_description(format);
+
+ assert(x % format_desc->block.width == 0);
+ assert(y % format_desc->block.height == 0);
+
+ dst_row = (uint8_t *)dst + y*dst_stride + x*(format_desc->block.bits/8);
+ src_row = src;
+
+ format_desc->pack_float(dst_row, dst_stride, src_row, src_stride, w, h);
+}
+
+
+void
+util_format_read_4ub(enum pipe_format format, uint8_t *dst, unsigned dst_stride, const void *src, unsigned src_stride, unsigned x, unsigned y, unsigned w, unsigned h)
+{
+ const struct util_format_description *format_desc;
+ const uint8_t *src_row;
+ uint8_t *dst_row;
+
+ format_desc = util_format_description(format);
+
+ assert(x % format_desc->block.width == 0);
+ assert(y % format_desc->block.height == 0);
+
+ src_row = (const uint8_t *)src + y*src_stride + x*(format_desc->block.bits/8);
+ dst_row = dst;
+
+ format_desc->unpack_8unorm(dst_row, dst_stride, src_row, src_stride, w, h);
+}
+
+
+void
+util_format_write_4ub(enum pipe_format format, const uint8_t *src, unsigned src_stride, void *dst, unsigned dst_stride, unsigned x, unsigned y, unsigned w, unsigned h)
+{
+ const struct util_format_description *format_desc;
+ uint8_t *dst_row;
+ const uint8_t *src_row;
+
+ format_desc = util_format_description(format);
+
+ assert(x % format_desc->block.width == 0);
+ assert(y % format_desc->block.height == 0);
+
+ dst_row = (uint8_t *)dst + y*dst_stride + x*(format_desc->block.bits/8);
+ src_row = src;
+
+ format_desc->pack_8unorm(dst_row, dst_stride, src_row, src_stride, w, h);
+}
+
diff --git a/src/gallium/auxiliary/util/u_format.csv b/src/gallium/auxiliary/util/u_format.csv
index 96a0fa6550..0cf539247e 100644
--- a/src/gallium/auxiliary/util/u_format.csv
+++ b/src/gallium/auxiliary/util/u_format.csv
@@ -47,22 +47,27 @@
# - color space: rgb, yub, sz
#
# See also:
-# - http://msdn.microsoft.com/en-us/library/ee416489.aspx (D3D9)
-# - http://msdn.microsoft.com/en-us/library/ee415668.aspx (D3D9 -> D3D10)
-# - http://msdn.microsoft.com/en-us/library/ee418116.aspx (D3D10)
+# - http://msdn.microsoft.com/en-us/library/bb172558.aspx (D3D9)
+# - http://msdn.microsoft.com/en-us/library/bb205073.aspx#mapping_texture_formats (D3D9 -> D3D10)
+# - http://msdn.microsoft.com/en-us/library/bb173059.aspx (D3D10)
#
# Note that GL doesn't really specify the layout of internal formats. See
# OpenGL 2.1 specification, Table 3.16, on the "Correspondence of sized
# internal formats to base in- ternal formats, and desired component
# resolutions for each sized internal format."
+# None
+# Described as regular uint_8 bytes, i.e. PIPE_FORMAT_R8_USCALED
+PIPE_FORMAT_NONE , plain, 1, 1, u8 , , , , x001, rgb
+
# Typical rendertarget formats
PIPE_FORMAT_B8G8R8A8_UNORM , plain, 1, 1, un8 , un8 , un8 , un8 , zyxw, rgb
-PIPE_FORMAT_B8G8R8X8_UNORM , plain, 1, 1, un8 , un8 , un8 , un8 , zyx1, rgb
+PIPE_FORMAT_B8G8R8X8_UNORM , plain, 1, 1, un8 , un8 , un8 , x8 , zyx1, rgb
PIPE_FORMAT_A8R8G8B8_UNORM , plain, 1, 1, un8 , un8 , un8 , un8 , yzwx, rgb
-PIPE_FORMAT_X8R8G8B8_UNORM , plain, 1, 1, un8 , un8 , un8 , un8 , yzw1, rgb
+PIPE_FORMAT_X8R8G8B8_UNORM , plain, 1, 1, x8 , un8 , un8 , un8 , yzw1, rgb
PIPE_FORMAT_A8B8G8R8_UNORM , plain, 1, 1, un8 , un8 , un8 , un8 , wzyx, rgb
-PIPE_FORMAT_X8B8G8R8_UNORM , plain, 1, 1, un8 , un8 , un8 , un8 , wzy1, rgb
+PIPE_FORMAT_X8B8G8R8_UNORM , plain, 1, 1, x8 , un8 , un8 , un8 , wzy1, rgb
+PIPE_FORMAT_B5G5R5X1_UNORM , plain, 1, 1, un5 , un5 , un5 , x1 , zyx1, rgb
PIPE_FORMAT_B5G5R5A1_UNORM , plain, 1, 1, un5 , un5 , un5 , un1 , zyxw, rgb
PIPE_FORMAT_B4G4R4A4_UNORM , plain, 1, 1, un4 , un4 , un4 , un4 , zyxw, rgb
PIPE_FORMAT_B5G6R5_UNORM , plain, 1, 1, un5 , un6 , un5 , , zyx1, rgb
@@ -79,26 +84,28 @@ PIPE_FORMAT_L16_UNORM , plain, 1, 1, un16, , , , xxx1, r
PIPE_FORMAT_L8_SRGB , plain, 1, 1, un8 , , , , xxx1, srgb
PIPE_FORMAT_L8A8_SRGB , plain, 1, 1, un8 , un8 , , , xxxy, srgb
PIPE_FORMAT_R8G8B8_SRGB , plain, 1, 1, un8 , un8 , un8 , , xyz1, srgb
+PIPE_FORMAT_R8G8B8A8_SRGB , plain, 1, 1, un8 , un8 , un8 , un8 , xyzw, srgb
PIPE_FORMAT_A8B8G8R8_SRGB , plain, 1, 1, un8 , un8 , un8 , un8 , wzyx, srgb
-PIPE_FORMAT_X8B8G8R8_SRGB , plain, 1, 1, un8 , un8 , un8 , un8 , wzy1, srgb
+PIPE_FORMAT_X8B8G8R8_SRGB , plain, 1, 1, x8 , un8 , un8 , un8 , wzy1, srgb
PIPE_FORMAT_B8G8R8A8_SRGB , plain, 1, 1, un8 , un8 , un8 , un8 , zyxw, srgb
-PIPE_FORMAT_B8G8R8X8_SRGB , plain, 1, 1, un8 , un8 , un8 , un8 , zyx1, srgb
+PIPE_FORMAT_B8G8R8X8_SRGB , plain, 1, 1, un8 , un8 , un8 , x8 , zyx1, srgb
PIPE_FORMAT_A8R8G8B8_SRGB , plain, 1, 1, un8 , un8 , un8 , un8 , yzwx, srgb
-PIPE_FORMAT_X8R8G8B8_SRGB , plain, 1, 1, un8 , un8 , un8 , un8 , yzw1, srgb
+PIPE_FORMAT_X8R8G8B8_SRGB , plain, 1, 1, x8 , un8 , un8 , un8 , yzw1, srgb
# Mixed-sign formats (typically used for bump map textures)
PIPE_FORMAT_R8SG8SB8UX8U_NORM , plain, 1, 1, sn8 , sn8 , un8 , x8 , xyz1, rgb
PIPE_FORMAT_R5SG5SB6U_NORM , plain, 1, 1, sn5 , sn5 , un6 , , xyz1, rgb
# Depth-stencil formats
-PIPE_FORMAT_S8_UNORM , plain, 1, 1, un8 , , , , _x__, zs
-PIPE_FORMAT_Z16_UNORM , plain, 1, 1, un16, , , , x___, zs
-PIPE_FORMAT_Z32_UNORM , plain, 1, 1, un32, , , , x___, zs
-PIPE_FORMAT_Z32_FLOAT , plain, 1, 1, f32 , , , , x___, zs
-PIPE_FORMAT_Z24S8_UNORM , plain, 1, 1, un24, un8 , , , xy__, zs
-PIPE_FORMAT_S8Z24_UNORM , plain, 1, 1, un8 , un24, , , yx__, zs
-PIPE_FORMAT_Z24X8_UNORM , plain, 1, 1, un24, un8 , , , x___, zs
-PIPE_FORMAT_X8Z24_UNORM , plain, 1, 1, un8 , un24, , , y___, zs
+PIPE_FORMAT_S8_USCALED , plain, 1, 1, u8 , , , , _x__, zs
+PIPE_FORMAT_Z16_UNORM , plain, 1, 1, un16, , , , x___, zs
+PIPE_FORMAT_Z32_UNORM , plain, 1, 1, un32, , , , x___, zs
+PIPE_FORMAT_Z32_FLOAT , plain, 1, 1, f32 , , , , x___, zs
+PIPE_FORMAT_Z24_UNORM_S8_USCALED , plain, 1, 1, un24, u8 , , , xy__, zs
+PIPE_FORMAT_S8_USCALED_Z24_UNORM , plain, 1, 1, u8 , un24, , , yx__, zs
+PIPE_FORMAT_Z24X8_UNORM , plain, 1, 1, un24, x8 , , , x___, zs
+PIPE_FORMAT_X8Z24_UNORM , plain, 1, 1, x8 , un24, , , y___, zs
+PIPE_FORMAT_Z32_FLOAT_S8X24_USCALED , plain, 1, 1, f32, u8 , x24 , , xy__, zs
# YUV formats
# http://www.fourcc.org/yuv.php#UYVY
@@ -107,16 +114,34 @@ PIPE_FORMAT_UYVY , subsampled, 2, 1, x32 , , , , xyz
# XXX: u_tile.c's ycbcr_get_tile_rgba actually interprets it as VYUY but the
# intent should be to match D3DFMT_YUY2
PIPE_FORMAT_YUYV , subsampled, 2, 1, x32 , , , , xyz1, yuv
+# same subsampling but with rgb channels
+PIPE_FORMAT_R8G8_B8G8_UNORM , subsampled, 2, 1, x32 , , , , xyz1, rgb
+PIPE_FORMAT_G8R8_G8B8_UNORM , subsampled, 2, 1, x32 , , , , xyz1, rgb
+
+# some special formats not fitting anywhere else
+PIPE_FORMAT_R10G10B10A2_USCALED , plain, 1, 1, u10 , u10 , u10 , u2 , xyzw, rgb
+PIPE_FORMAT_R11G11B10_FLOAT , plain, 1, 1, f11 , f11 , f10 , , xyz1, rgb
+PIPE_FORMAT_R9G9B9E5_FLOAT , other, 1, 1, x32 , , , , xyz1, rgb
+PIPE_FORMAT_R1_UNORM , other, 8, 1, x8 , , , , x001, rgb
# Compressed formats
-PIPE_FORMAT_DXT1_RGB , compressed, 4, 4, x64 , , , , xyz1, rgb
-PIPE_FORMAT_DXT1_RGBA , compressed, 4, 4, x64 , , , , xyzw, rgb
-PIPE_FORMAT_DXT3_RGBA , compressed, 4, 4, x128, , , , xyzw, rgb
-PIPE_FORMAT_DXT5_RGBA , compressed, 4, 4, x128, , , , xyzw, rgb
-PIPE_FORMAT_DXT1_SRGB , compressed, 4, 4, x64 , , , , xyz1, srgb
-PIPE_FORMAT_DXT1_SRGBA , compressed, 4, 4, x64 , , , , xyzw, srgb
-PIPE_FORMAT_DXT3_SRGBA , compressed, 4, 4, x128, , , , xyzw, srgb
-PIPE_FORMAT_DXT5_SRGBA , compressed, 4, 4, x128, , , , xyzw, srgb
+# - http://en.wikipedia.org/wiki/S3_Texture_Compression
+# - http://www.opengl.org/registry/specs/EXT/texture_compression_s3tc.txt
+# - http://www.opengl.org/registry/specs/ARB/texture_compression_rgtc.txt
+# - http://msdn.microsoft.com/en-us/library/bb694531.aspx
+PIPE_FORMAT_DXT1_RGB , s3tc, 4, 4, x64 , , , , xyz1, rgb
+PIPE_FORMAT_DXT1_RGBA , s3tc, 4, 4, x64 , , , , xyzw, rgb
+PIPE_FORMAT_DXT3_RGBA , s3tc, 4, 4, x128, , , , xyzw, rgb
+PIPE_FORMAT_DXT5_RGBA , s3tc, 4, 4, x128, , , , xyzw, rgb
+PIPE_FORMAT_DXT1_SRGB , s3tc, 4, 4, x64 , , , , xyz1, srgb
+PIPE_FORMAT_DXT1_SRGBA , s3tc, 4, 4, x64 , , , , xyzw, srgb
+PIPE_FORMAT_DXT3_SRGBA , s3tc, 4, 4, x128, , , , xyzw, srgb
+PIPE_FORMAT_DXT5_SRGBA , s3tc, 4, 4, x128, , , , xyzw, srgb
+
+PIPE_FORMAT_RGTC1_UNORM , rgtc, 4, 4, x64, , , , x001, rgb
+PIPE_FORMAT_RGTC1_SNORM , rgtc, 4, 4, x64, , , , x001, rgb
+PIPE_FORMAT_RGTC2_UNORM , rgtc, 4, 4, x128, , , , xy01, rgb
+PIPE_FORMAT_RGTC2_SNORM , rgtc, 4, 4, x128, , , , xy01, rgb
# Straightforward D3D10-like formats (also used for
# vertex buffer element description)
@@ -152,6 +177,10 @@ PIPE_FORMAT_R32_FIXED , plain, 1, 1, h32 , , , , x001, r
PIPE_FORMAT_R32G32_FIXED , plain, 1, 1, h32 , h32 , , , xy01, rgb
PIPE_FORMAT_R32G32B32_FIXED , plain, 1, 1, h32 , h32 , h32 , , xyz1, rgb
PIPE_FORMAT_R32G32B32A32_FIXED , plain, 1, 1, h32 , h32 , h32 , h32 , xyzw, rgb
+PIPE_FORMAT_R16_FLOAT , plain, 1, 1, f16 , , , , x001, rgb
+PIPE_FORMAT_R16G16_FLOAT , plain, 1, 1, f16 , f16 , , , xy01, rgb
+PIPE_FORMAT_R16G16B16_FLOAT , plain, 1, 1, f16 , f16 , f16 , , xyz1, rgb
+PIPE_FORMAT_R16G16B16A16_FLOAT , plain, 1, 1, f16 , f16 , f16 , f16 , xyzw, rgb
PIPE_FORMAT_R16_UNORM , plain, 1, 1, un16, , , , x001, rgb
PIPE_FORMAT_R16G16_UNORM , plain, 1, 1, un16, un16, , , xy01, rgb
PIPE_FORMAT_R16G16B16_UNORM , plain, 1, 1, un16, un16, un16, , xyz1, rgb
diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h
index e8fa0022b5..93818a3161 100644
--- a/src/gallium/auxiliary/util/u_format.h
+++ b/src/gallium/auxiliary/util/u_format.h
@@ -56,15 +56,23 @@ enum util_format_layout {
*
* This is for formats like YV12 where there is less than one sample per
* pixel.
- *
- * XXX: This could actually b
*/
UTIL_FORMAT_LAYOUT_SUBSAMPLED = 3,
/**
- * An unspecified compression algorithm.
+ * S3 Texture Compression formats.
+ */
+ UTIL_FORMAT_LAYOUT_S3TC = 4,
+
+ /**
+ * Red-Green Texture Compression formats.
*/
- UTIL_FORMAT_LAYOUT_COMPRESSED = 4
+ UTIL_FORMAT_LAYOUT_RGTC = 5,
+
+ /**
+ * Everything else that doesn't fit in any of the above layouts.
+ */
+ UTIL_FORMAT_LAYOUT_OTHER = 6
};
@@ -120,9 +128,15 @@ struct util_format_channel_description
struct util_format_description
{
enum pipe_format format;
+
const char *name;
/**
+ * Short name, striped of the prefix, lower case.
+ */
+ const char *short_name;
+
+ /**
* Pixel block dimensions.
*/
struct util_format_block block;
@@ -140,6 +154,15 @@ struct util_format_description
unsigned is_array:1;
/**
+ * Whether the pixel format can be described as a bitfield structure.
+ *
+ * In particular:
+ * - pixel depth must be 8, 16, or 32 bits;
+ * - all channels must be unsigned, signed, or void
+ */
+ unsigned is_bitmask:1;
+
+ /**
* Whether channels have mixed types (ignoring UTIL_FORMAT_TYPE_VOID).
*/
unsigned is_mixed:1;
@@ -166,6 +189,46 @@ struct util_format_description
* Colorspace transformation.
*/
enum util_format_colorspace colorspace;
+
+ /**
+ * Unpack pixel blocks to R8G8B8A8_UNORM.
+ */
+ void
+ (*unpack_8unorm)(uint8_t *dst, unsigned dst_stride,
+ const uint8_t *src, unsigned src_stride,
+ unsigned width, unsigned height);
+
+ /**
+ * Pack pixel blocks from R8G8B8A8_UNORM.
+ */
+ void
+ (*pack_8unorm)(uint8_t *dst, unsigned dst_stride,
+ const uint8_t *src, unsigned src_stride,
+ unsigned width, unsigned height);
+
+ /**
+ * Unpack pixel blocks to R32G32B32A32_FLOAT.
+ */
+ void
+ (*unpack_float)(float *dst, unsigned dst_stride,
+ const uint8_t *src, unsigned src_stride,
+ unsigned width, unsigned height);
+
+ /**
+ * Pack pixel blocks from R32G32B32A32_FLOAT.
+ */
+ void
+ (*pack_float)(uint8_t *dst, unsigned dst_stride,
+ const float *src, unsigned src_stride,
+ unsigned width, unsigned height);
+
+ /**
+ * Fetch a single pixel (i, j) from a block.
+ */
+ void
+ (*fetch_float)(float *dst,
+ const uint8_t *src,
+ unsigned i, unsigned j);
};
@@ -186,8 +249,8 @@ util_format_name(enum pipe_format format)
{
const struct util_format_description *desc = util_format_description(format);
- assert(format);
- if (!format) {
+ assert(desc);
+ if (!desc) {
return "???";
}
@@ -195,16 +258,16 @@ util_format_name(enum pipe_format format)
}
static INLINE boolean
-util_format_is_compressed(enum pipe_format format)
+util_format_is_s3tc(enum pipe_format format)
{
const struct util_format_description *desc = util_format_description(format);
- assert(format);
- if (!format) {
+ assert(desc);
+ if (!desc) {
return FALSE;
}
- return desc->layout == UTIL_FORMAT_LAYOUT_COMPRESSED ? TRUE : FALSE;
+ return desc->layout == UTIL_FORMAT_LAYOUT_S3TC ? TRUE : FALSE;
}
static INLINE boolean
@@ -212,8 +275,8 @@ util_format_is_depth_or_stencil(enum pipe_format format)
{
const struct util_format_description *desc = util_format_description(format);
- assert(format);
- if (!format) {
+ assert(desc);
+ if (!desc) {
return FALSE;
}
@@ -225,8 +288,8 @@ util_format_is_depth_and_stencil(enum pipe_format format)
{
const struct util_format_description *desc = util_format_description(format);
- assert(format);
- if (!format) {
+ assert(desc);
+ if (!desc) {
return FALSE;
}
@@ -238,6 +301,34 @@ util_format_is_depth_and_stencil(enum pipe_format format)
desc->swizzle[1] != UTIL_FORMAT_SWIZZLE_NONE) ? TRUE : FALSE;
}
+/**
+ * Whether this format is a rgab8 variant.
+ *
+ * That is, any format that matches the
+ *
+ * PIPE_FORMAT_?8?8?8?8_UNORM
+ */
+static INLINE boolean
+util_format_is_rgba8_variant(const struct util_format_description *desc)
+{
+ unsigned chan;
+
+ if(desc->block.width != 1 ||
+ desc->block.height != 1 ||
+ desc->block.bits != 32)
+ return FALSE;
+
+ for(chan = 0; chan < 4; ++chan) {
+ if(desc->channel[chan].type != UTIL_FORMAT_TYPE_UNSIGNED &&
+ desc->channel[chan].type != UTIL_FORMAT_TYPE_VOID)
+ return FALSE;
+ if(desc->channel[chan].size != 8)
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
/**
* Return total bits needed for the pixel format per block.
@@ -247,8 +338,8 @@ util_format_get_blocksizebits(enum pipe_format format)
{
const struct util_format_description *desc = util_format_description(format);
- assert(format);
- if (!format) {
+ assert(desc);
+ if (!desc) {
return 0;
}
@@ -273,8 +364,8 @@ util_format_get_blockwidth(enum pipe_format format)
{
const struct util_format_description *desc = util_format_description(format);
- assert(format);
- if (!format) {
+ assert(desc);
+ if (!desc) {
return 1;
}
@@ -286,8 +377,8 @@ util_format_get_blockheight(enum pipe_format format)
{
const struct util_format_description *desc = util_format_description(format);
- assert(format);
- if (!format) {
+ assert(desc);
+ if (!desc) {
return 1;
}
@@ -400,6 +491,16 @@ util_format_has_alpha(enum pipe_format format)
}
}
+/**
+ * Return the number of components stored.
+ * Formats with block size != 1x1 will always have 1 component (the block).
+ */
+static INLINE unsigned
+util_format_get_nr_components(enum pipe_format format)
+{
+ const struct util_format_description *desc = util_format_description(format);
+ return desc->nr_channels;
+}
/*
* Format access functions.
diff --git a/src/gallium/auxiliary/util/u_format_access.py b/src/gallium/auxiliary/util/u_format_access.py
deleted file mode 100644
index 00424779d2..0000000000
--- a/src/gallium/auxiliary/util/u_format_access.py
+++ /dev/null
@@ -1,341 +0,0 @@
-#!/usr/bin/env python
-
-'''
-/**************************************************************************
- *
- * Copyright 2009 VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-/**
- * @file
- * Pixel format accessor functions.
- *
- * @author Jose Fonseca <jfonseca@vmware.com>
- */
-'''
-
-
-import math
-import sys
-
-from u_format_pack import *
-
-
-def is_format_supported(format):
- '''Determines whether we actually have the plumbing necessary to generate the
- to read/write to/from this format.'''
-
- # FIXME: Ideally we would support any format combination here.
-
- # XXX: It should be straightforward to support srgb
- if format.colorspace not in ('rgb', 'zs'):
- return False
-
- if format.layout != PLAIN:
- return False
-
- for i in range(4):
- channel = format.channels[i]
- if channel.type not in (VOID, UNSIGNED, FLOAT):
- return False
-
- # We can only read a color from a depth/stencil format if the depth channel is present
- if format.colorspace == 'zs' and format.swizzles[0] == SWIZZLE_NONE:
- return False
-
- return True
-
-
-def native_type(format):
- '''Get the native appropriate for a format.'''
-
- if format.layout == PLAIN:
- if not format.is_array():
- # For arithmetic pixel formats return the integer type that matches the whole pixel
- return 'uint%u_t' % format.block_size()
- else:
- # For array pixel formats return the integer type that matches the color channel
- channel = format.channels[0]
- if channel.type == UNSIGNED:
- return 'uint%u_t' % channel.size
- elif channel.type == SIGNED:
- return 'int%u_t' % channel.size
- elif channel.type == FLOAT:
- if channel.size == 32:
- return 'float'
- elif channel.size == 64:
- return 'double'
- else:
- assert False
- else:
- assert False
- else:
- assert False
-
-
-def generate_srgb_tables():
- print 'static ubyte srgb_to_linear[256] = {'
- for i in range(256):
- print ' %s,' % (int(math.pow((i / 255.0 + 0.055) / 1.055, 2.4) * 255))
- print '};'
- print
- print 'static ubyte linear_to_srgb[256] = {'
- print ' 0,'
- for i in range(1, 256):
- print ' %s,' % (int((1.055 * math.pow(i / 255.0, 0.41666) - 0.055) * 255))
- print '};'
- print
-
-
-def generate_format_read(format, dst_channel, dst_native_type, dst_suffix):
- '''Generate the function to read pixels from a particular format'''
-
- name = format.short_name()
-
- src_native_type = native_type(format)
-
- print 'static void'
- print 'util_format_%s_read_%s(%s *dst, unsigned dst_stride, const uint8_t *src, unsigned src_stride, unsigned x0, unsigned y0, unsigned w, unsigned h)' % (name, dst_suffix, dst_native_type)
- print '{'
- print ' unsigned x, y;'
- print ' const uint8_t *src_row = src + y0*src_stride;'
- print ' %s *dst_row = dst;' % dst_native_type
- print ' for (y = 0; y < h; ++y) {'
- print ' const %s *src_pixel = (const %s *)(src_row + x0*%u);' % (src_native_type, src_native_type, format.stride())
- print ' %s *dst_pixel = dst_row;' %dst_native_type
- print ' for (x = 0; x < w; ++x) {'
-
- names = ['']*4
- if format.colorspace == 'rgb':
- for i in range(4):
- swizzle = format.swizzles[i]
- if swizzle < 4:
- names[swizzle] += 'rgba'[i]
- elif format.colorspace == 'zs':
- swizzle = format.swizzles[0]
- if swizzle < 4:
- names[swizzle] = 'z'
- else:
- assert False
- else:
- assert False
-
- if format.layout == PLAIN:
- if not format.is_array():
- print ' %s pixel = *src_pixel++;' % src_native_type
- shift = 0;
- for i in range(4):
- src_channel = format.channels[i]
- width = src_channel.size
- if names[i]:
- value = 'pixel'
- mask = (1 << width) - 1
- if shift:
- value = '(%s >> %u)' % (value, shift)
- if shift + width < format.block_size():
- value = '(%s & 0x%x)' % (value, mask)
- value = conversion_expr(src_channel, dst_channel, dst_native_type, value)
- print ' %s %s = %s;' % (dst_native_type, names[i], value)
- shift += width
- else:
- for i in range(4):
- src_channel = format.channels[i]
- if names[i]:
- value = 'src_pixel[%u]' % i
- value = conversion_expr(src_channel, dst_channel, dst_native_type, value)
- print ' %s %s = %s;' % (dst_native_type, names[i], value)
- print ' src_pixel += %u;' % (format.nr_channels())
- else:
- assert False
-
- for i in range(4):
- if format.colorspace == 'rgb':
- swizzle = format.swizzles[i]
- if swizzle < 4:
- value = names[swizzle]
- elif swizzle == SWIZZLE_0:
- value = '0'
- elif swizzle == SWIZZLE_1:
- value = get_one(dst_channel)
- else:
- assert False
- elif format.colorspace == 'zs':
- if i < 3:
- value = 'z'
- else:
- value = get_one(dst_channel)
- else:
- assert False
- print ' *dst_pixel++ = %s; /* %s */' % (value, 'rgba'[i])
-
- print ' }'
- print ' src_row += src_stride;'
- print ' dst_row += dst_stride/sizeof(*dst_row);'
- print ' }'
- print '}'
- print
-
-
-def generate_format_write(format, src_channel, src_native_type, src_suffix):
- '''Generate the function to write pixels to a particular format'''
-
- name = format.short_name()
-
- dst_native_type = native_type(format)
-
- print 'static void'
- print 'util_format_%s_write_%s(const %s *src, unsigned src_stride, uint8_t *dst, unsigned dst_stride, unsigned x0, unsigned y0, unsigned w, unsigned h)' % (name, src_suffix, src_native_type)
- print '{'
- print ' unsigned x, y;'
- print ' uint8_t *dst_row = dst + y0*dst_stride;'
- print ' const %s *src_row = src;' % src_native_type
- print ' for (y = 0; y < h; ++y) {'
- print ' %s *dst_pixel = (%s *)(dst_row + x0*%u);' % (dst_native_type, dst_native_type, format.stride())
- print ' const %s *src_pixel = src_row;' %src_native_type
- print ' for (x = 0; x < w; ++x) {'
-
- inv_swizzle = format.inv_swizzles()
-
- if format.layout == PLAIN:
- if not format.is_array():
- print ' %s pixel = 0;' % dst_native_type
- shift = 0;
- for i in range(4):
- dst_channel = format.channels[i]
- width = dst_channel.size
- if inv_swizzle[i] is not None:
- value = 'src_pixel[%u]' % inv_swizzle[i]
- value = conversion_expr(src_channel, dst_channel, dst_native_type, value)
- if shift:
- value = '(%s << %u)' % (value, shift)
- print ' pixel |= %s;' % value
- shift += width
- print ' *dst_pixel++ = pixel;'
- else:
- for i in range(4):
- dst_channel = format.channels[i]
- if inv_swizzle[i] is not None:
- value = 'src_pixel[%u]' % inv_swizzle[i]
- value = conversion_expr(src_channel, dst_channel, dst_native_type, value)
- print ' *dst_pixel++ = %s;' % value
- else:
- assert False
- print ' src_pixel += 4;'
-
- print ' }'
- print ' dst_row += dst_stride;'
- print ' src_row += src_stride/sizeof(*src_row);'
- print ' }'
- print '}'
- print
-
-
-def generate_read(formats, dst_channel, dst_native_type, dst_suffix):
- '''Generate the dispatch function to read pixels from any format'''
-
- for format in formats:
- if is_format_supported(format):
- generate_format_read(format, dst_channel, dst_native_type, dst_suffix)
-
- print 'void'
- print 'util_format_read_%s(enum pipe_format format, %s *dst, unsigned dst_stride, const void *src, unsigned src_stride, unsigned x, unsigned y, unsigned w, unsigned h)' % (dst_suffix, dst_native_type)
- print '{'
- print ' void (*func)(%s *dst, unsigned dst_stride, const uint8_t *src, unsigned src_stride, unsigned x0, unsigned y0, unsigned w, unsigned h);' % dst_native_type
- print ' switch(format) {'
- for format in formats:
- if is_format_supported(format):
- print ' case %s:' % format.name
- print ' func = &util_format_%s_read_%s;' % (format.short_name(), dst_suffix)
- print ' break;'
- print ' default:'
- print ' debug_printf("unsupported format\\n");'
- print ' return;'
- print ' }'
- print ' func(dst, dst_stride, (const uint8_t *)src, src_stride, x, y, w, h);'
- print '}'
- print
-
-
-def generate_write(formats, src_channel, src_native_type, src_suffix):
- '''Generate the dispatch function to write pixels to any format'''
-
- for format in formats:
- if is_format_supported(format):
- generate_format_write(format, src_channel, src_native_type, src_suffix)
-
- print 'void'
- print 'util_format_write_%s(enum pipe_format format, const %s *src, unsigned src_stride, void *dst, unsigned dst_stride, unsigned x, unsigned y, unsigned w, unsigned h)' % (src_suffix, src_native_type)
-
- print '{'
- print ' void (*func)(const %s *src, unsigned src_stride, uint8_t *dst, unsigned dst_stride, unsigned x0, unsigned y0, unsigned w, unsigned h);' % src_native_type
- print ' switch(format) {'
- for format in formats:
- if is_format_supported(format):
- print ' case %s:' % format.name
- print ' func = &util_format_%s_write_%s;' % (format.short_name(), src_suffix)
- print ' break;'
- print ' default:'
- print ' debug_printf("unsupported format\\n");'
- print ' return;'
- print ' }'
- print ' func(src, src_stride, (uint8_t *)dst, dst_stride, x, y, w, h);'
- print '}'
- print
-
-
-def main():
- formats = []
- for arg in sys.argv[1:]:
- formats.extend(parse(arg))
-
- print '/* This file is autogenerated by u_format_access.py from u_format.csv. Do not edit directly. */'
- print
- # This will print the copyright message on the top of this file
- print __doc__.strip()
- print
- print '#include "pipe/p_compiler.h"'
- print '#include "u_math.h"'
- print '#include "u_format_pack.h"'
- print
-
- generate_srgb_tables()
-
- type = Channel(FLOAT, False, 32)
- native_type = 'float'
- suffix = '4f'
-
- generate_read(formats, type, native_type, suffix)
- generate_write(formats, type, native_type, suffix)
-
- type = Channel(UNSIGNED, True, 8)
- native_type = 'uint8_t'
- suffix = '4ub'
-
- generate_read(formats, type, native_type, suffix)
- generate_write(formats, type, native_type, suffix)
-
-
-if __name__ == '__main__':
- main()
diff --git a/src/gallium/auxiliary/util/u_format_pack.py b/src/gallium/auxiliary/util/u_format_pack.py
index 3f33f7cc02..390be0c3b2 100644
--- a/src/gallium/auxiliary/util/u_format_pack.py
+++ b/src/gallium/auxiliary/util/u_format_pack.py
@@ -38,6 +38,7 @@
import sys
+import math
from u_format_parse import *
@@ -46,11 +47,11 @@ def generate_format_type(format):
'''Generate a structure that describes the format.'''
print 'union util_format_%s {' % format.short_name()
- if format.is_bitmask():
+ if format.is_bitmask() or format.short_name() == "r11g11b10_float":
print ' uint%u_t value;' % (format.block_size(),)
print ' struct {'
for channel in format.channels:
- if format.is_bitmask() and not format.is_array():
+ if (format.is_bitmask() or format.is_mixed()) and not format.is_array() or format.short_name() == "r11g11b10_float":
if channel.type == VOID:
if channel.size:
print ' unsigned %s:%u;' % (channel.name, channel.size)
@@ -58,6 +59,11 @@ def generate_format_type(format):
print ' unsigned %s:%u;' % (channel.name, channel.size)
elif channel.type == SIGNED:
print ' int %s:%u;' % (channel.name, channel.size)
+ elif channel.type == FLOAT:
+ if channel.size == 32:
+ print ' float %s;' % (channel.name)
+ else:
+ print ' unsigned %s:%u;' % (channel.name, channel.size)
else:
assert 0
else:
@@ -85,10 +91,24 @@ def generate_format_type(format):
print
+def generate_srgb_tables():
+ print 'static ubyte srgb_to_linear[256] = {'
+ for i in range(256):
+ print ' %s,' % (int(math.pow((i / 255.0 + 0.055) / 1.055, 2.4) * 255))
+ print '};'
+ print
+ print 'static ubyte linear_to_srgb[256] = {'
+ print ' 0,'
+ for i in range(1, 256):
+ print ' %s,' % (int((1.055 * math.pow(i / 255.0, 0.41666) - 0.055) * 255))
+ print '};'
+ print
+
+
def bswap_format(format):
'''Generate a structure that describes the format.'''
- if format.is_bitmask() and not format.is_array():
+ if format.is_bitmask() and not format.is_array() and format.block_size() > 8:
print '#ifdef PIPE_ARCH_BIG_ENDIAN'
print ' pixel.value = util_bswap%u(pixel.value);' % format.block_size()
print '#endif'
@@ -124,15 +144,17 @@ def native_type(format):
return 'uint%u_t' % format.block_size()
else:
# For array pixel formats return the integer type that matches the color channel
- type = format.channels[0]
- if type.type == UNSIGNED:
- return 'uint%u_t' % type.size
- elif type.type == SIGNED:
- return 'int%u_t' % type.size
- elif type.type == FLOAT:
- if type.size == 32:
+ channel = format.channels[0]
+ if channel.type in (UNSIGNED, VOID):
+ return 'uint%u_t' % channel.size
+ elif channel.type == SIGNED:
+ return 'int%u_t' % channel.size
+ elif channel.type == FLOAT:
+ if channel.size == 16:
+ return 'uint16_t'
+ elif channel.size == 32:
return 'float'
- elif type.size == 64:
+ elif channel.size == 64:
return 'double'
else:
assert False
@@ -179,31 +201,6 @@ def get_one(type):
return (1 << get_one_shift(type)) - 1
-def generate_clamp():
- '''Code generate the clamping functions for each type.
-
- We don't use a macro so that arguments with side effects,
- like *src_pixel++ are correctly handled.
- '''
-
- for suffix, native_type in [
- ('', 'double'),
- ('f', 'float'),
- ('ui', 'unsigned int'),
- ('si', 'int'),
- ]:
- print 'static INLINE %s' % native_type
- print 'clamp%s(%s value, %s lbound, %s ubound)' % (suffix, native_type, native_type, native_type)
- print '{'
- print ' if(value < lbound)'
- print ' return lbound;'
- print ' if(value > ubound)'
- print ' return ubound;'
- print ' return value;'
- print '}'
- print
-
-
def clamp_expr(src_channel, dst_channel, dst_native_type, value):
'''Generate the expression to clamp the value in the source type to the
destination type range.'''
@@ -211,21 +208,6 @@ def clamp_expr(src_channel, dst_channel, dst_native_type, value):
if src_channel == dst_channel:
return value
- # Pick the approriate clamp function
- if src_channel.type == FLOAT:
- if src_channel.size == 32:
- func = 'clampf'
- elif src_channel.size == 64:
- func = 'clamp'
- else:
- assert False
- elif src_channel.type == UNSIGNED:
- func = 'clampui'
- elif src_channel.type == SIGNED:
- func = 'clampsi'
- else:
- assert False
-
src_min = src_channel.min()
src_max = src_channel.max()
dst_min = dst_channel.min()
@@ -249,236 +231,363 @@ def conversion_expr(src_channel, dst_channel, dst_native_type, value, clamp=True
if src_channel == dst_channel:
return value
- if src_channel.type == FLOAT and dst_channel.type == FLOAT:
- return '(%s)%s' % (dst_native_type, value)
-
- if not src_channel.norm and not dst_channel.norm:
- return '(%s)%s' % (dst_native_type, value)
+ src_type = src_channel.type
+ src_size = src_channel.size
+ src_norm = src_channel.norm
- if clamp:
- value = clamp_expr(src_channel, dst_channel, dst_native_type, value)
+ # Promote half to float
+ if src_type == FLOAT and src_size == 16:
+ value = 'util_half_to_float(%s)' % value
+ src_size = 32
- if dst_channel.type == FLOAT:
- if src_channel.norm:
- one = get_one(src_channel)
- if src_channel.size <= 23:
- scale = '(1.0f/0x%x)' % one
- else:
- # bigger than single precision mantissa, use double
- scale = '(1.0/0x%x)' % one
- value = '(%s * %s)' % (value, scale)
- return '(%s)%s' % (dst_native_type, value)
-
- if src_channel.type == FLOAT:
- if dst_channel.norm:
- dst_one = get_one(dst_channel)
- if dst_channel.size <= 23:
- scale = '0x%x' % dst_one
- else:
- # bigger than single precision mantissa, use double
- scale = '(double)0x%x' % dst_one
- value = '(%s * %s)' % (value, scale)
- return '(%s)%s' % (dst_native_type, value)
+ if clamp:
+ if dst_channel.type != FLOAT or src_type != FLOAT:
+ value = clamp_expr(src_channel, dst_channel, dst_native_type, value)
- if not src_channel.norm and not dst_channel.norm:
- # neither is normalized -- just cast
- return '(%s)%s' % (dst_native_type, value)
+ if src_type in (SIGNED, UNSIGNED) and dst_channel.type in (SIGNED, UNSIGNED):
+ if not src_norm and not dst_channel.norm:
+ # neither is normalized -- just cast
+ return '(%s)%s' % (dst_native_type, value)
- if src_channel.type in (SIGNED, UNSIGNED) and dst_channel.type in (SIGNED, UNSIGNED):
src_one = get_one(src_channel)
dst_one = get_one(dst_channel)
- if src_one > dst_one and src_channel.norm:
+ if src_one > dst_one and src_norm and dst_channel.norm:
# We can just bitshift
src_shift = get_one_shift(src_channel)
dst_shift = get_one_shift(dst_channel)
value = '(%s >> %s)' % (value, src_shift - dst_shift)
else:
# We need to rescale using an intermediate type big enough to hold the multiplication of both
- tmp_native_type = intermediate_native_type(src_channel.size + dst_channel.size, src_channel.sign and dst_channel.sign)
- value = '(%s)%s' % (tmp_native_type, value)
+ tmp_native_type = intermediate_native_type(src_size + dst_channel.size, src_channel.sign and dst_channel.sign)
+ value = '((%s)%s)' % (tmp_native_type, value)
value = '(%s * 0x%x / 0x%x)' % (value, dst_one, src_one)
value = '(%s)%s' % (dst_native_type, value)
return value
- assert False
+ # Promote to either float or double
+ if src_type != FLOAT:
+ if src_norm:
+ one = get_one(src_channel)
+ if src_size <= 23:
+ value = '(%s * (1.0f/0x%x))' % (value, one)
+ if dst_channel.size <= 32:
+ value = '(float)%s' % value
+ src_size = 32
+ else:
+ # bigger than single precision mantissa, use double
+ value = '(%s * (1.0/0x%x))' % (value, one)
+ src_size = 64
+ src_norm = False
+ else:
+ if src_size <= 23 or dst_channel.size <= 32:
+ value = '(float)%s' % value
+ src_size = 32
+ else:
+ # bigger than single precision mantissa, use double
+ value = '(double)%s' % value
+ src_size = 64
+ src_type = FLOAT
+ # Convert double or float to non-float
+ if dst_channel.type != FLOAT:
+ if dst_channel.norm:
+ dst_one = get_one(dst_channel)
+ if dst_channel.size <= 23:
+ value = '(%s * 0x%x)' % (value, dst_one)
+ else:
+ # bigger than single precision mantissa, use double
+ value = '(%s * (double)0x%x)' % (value, dst_one)
+ value = '(%s)%s' % (dst_native_type, value)
+ else:
+ # Cast double to float when converting to either half or float
+ if dst_channel.size <= 32 and src_size > 32:
+ value = '(float)%s' % value
+ src_size = 32
-def generate_format_unpack(format, dst_channel, dst_native_type, dst_suffix):
- '''Generate the function to unpack pixels from a particular format'''
+ if dst_channel.size == 16:
+ value = 'util_float_to_half(%s)' % value
+ elif dst_channel.size == 64 and src_size < 64:
+ value = '(double)%s' % value
- name = format.short_name()
+ return value
- src_native_type = native_type(format)
- print 'static INLINE void'
- print 'util_format_%s_unpack_%s(%s *dst, const void *src)' % (name, dst_suffix, dst_native_type)
- print '{'
- print ' union util_format_%s pixel;' % format.short_name()
- print ' memcpy(&pixel, src, sizeof pixel);'
- bswap_format(format)
+def generate_unpack_kernel(format, dst_channel, dst_native_type):
+ if not is_format_supported(format):
+ return
+
assert format.layout == PLAIN
- for i in range(4):
- swizzle = format.swizzles[i]
- if swizzle < 4:
- src_channel = format.channels[swizzle]
- value = 'pixel.chan.%s' % src_channel.name
- value = conversion_expr(src_channel, dst_channel, dst_native_type, value)
- elif swizzle == SWIZZLE_0:
- value = '0'
- elif swizzle == SWIZZLE_1:
- value = get_one(dst_channel)
- elif swizzle == SWIZZLE_NONE:
- value = '0'
- else:
- assert False
- if format.colorspace == ZS:
- if i == 3:
- value = get_one(dst_channel)
- elif i >= 1:
- value = 'dst[0]'
- print ' dst[%u] = %s; /* %s */' % (i, value, 'rgba'[i])
+ src_native_type = native_type(format)
- print '}'
- print
+ if format.is_bitmask():
+ depth = format.block_size()
+ print ' uint%u_t value = *(uint%u_t *)src;' % (depth, depth)
+
+ # Declare the intermediate variables
+ for i in range(format.nr_channels()):
+ src_channel = format.channels[i]
+ if src_channel.type == UNSIGNED:
+ print ' uint%u_t %s;' % (depth, src_channel.name)
+ elif src_channel.type == SIGNED:
+ print ' int%u_t %s;' % (depth, src_channel.name)
+
+ if depth > 8:
+ print '#ifdef PIPE_ARCH_BIG_ENDIAN'
+ print ' value = util_bswap%u(value);' % depth
+ print '#endif'
+
+ # Compute the intermediate unshifted values
+ shift = 0
+ for i in range(format.nr_channels()):
+ src_channel = format.channels[i]
+ value = 'value'
+ if src_channel.type == UNSIGNED:
+ if shift:
+ value = '%s >> %u' % (value, shift)
+ if shift + src_channel.size < depth:
+ value = '(%s) & 0x%x' % (value, (1 << src_channel.size) - 1)
+ elif src_channel.type == SIGNED:
+ if shift + src_channel.size < depth:
+ # Align the sign bit
+ lshift = depth - (shift + src_channel.size)
+ value = '%s << %u' % (value, lshift)
+ # Cast to signed
+ value = '(int%u_t)(%s) ' % (depth, value)
+ if src_channel.size < depth:
+ # Align the LSB bit
+ rshift = depth - src_channel.size
+ value = '(%s) >> %u' % (value, rshift)
+ else:
+ value = None
+
+ if value is not None:
+ print ' %s = %s;' % (src_channel.name, value)
+
+ shift += src_channel.size
+
+ # Convert, swizzle, and store final values
+ for i in range(4):
+ swizzle = format.swizzles[i]
+ if swizzle < 4:
+ src_channel = format.channels[swizzle]
+ value = src_channel.name
+ value = conversion_expr(src_channel, dst_channel, dst_native_type, value)
+ elif swizzle == SWIZZLE_0:
+ value = '0'
+ elif swizzle == SWIZZLE_1:
+ value = get_one(dst_channel)
+ elif swizzle == SWIZZLE_NONE:
+ value = '0'
+ else:
+ assert False
+ if format.colorspace == ZS:
+ if i == 3:
+ value = get_one(dst_channel)
+ elif i >= 1:
+ value = 'dst[0]'
+ print ' dst[%u] = %s; /* %s */' % (i, value, 'rgba'[i])
+
+ else:
+ print ' union util_format_%s pixel;' % format.short_name()
+ print ' memcpy(&pixel, src, sizeof pixel);'
+ bswap_format(format)
+
+ for i in range(4):
+ swizzle = format.swizzles[i]
+ if swizzle < 4:
+ src_channel = format.channels[swizzle]
+ value = 'pixel.chan.%s' % src_channel.name
+ value = conversion_expr(src_channel, dst_channel, dst_native_type, value)
+ elif swizzle == SWIZZLE_0:
+ value = '0'
+ elif swizzle == SWIZZLE_1:
+ value = get_one(dst_channel)
+ elif swizzle == SWIZZLE_NONE:
+ value = '0'
+ else:
+ assert False
+ if format.colorspace == ZS:
+ if i == 3:
+ value = get_one(dst_channel)
+ elif i >= 1:
+ value = 'dst[0]'
+ print ' dst[%u] = %s; /* %s */' % (i, value, 'rgba'[i])
-def generate_format_pack(format, src_channel, src_native_type, src_suffix):
- '''Generate the function to pack pixels to a particular format'''
-
- name = format.short_name()
+def generate_pack_kernel(format, src_channel, src_native_type):
+ if not is_format_supported(format):
+ return
+
dst_native_type = native_type(format)
- print 'static INLINE void'
- print 'util_format_%s_pack_%s(void *dst, %s r, %s g, %s b, %s a)' % (name, src_suffix, src_native_type, src_native_type, src_native_type, src_native_type)
- print '{'
- print ' union util_format_%s pixel;' % format.short_name()
-
assert format.layout == PLAIN
inv_swizzle = format.inv_swizzles()
- for i in range(4):
- dst_channel = format.channels[i]
- width = dst_channel.size
- if inv_swizzle[i] is None:
- continue
- value = 'rgba'[inv_swizzle[i]]
- value = conversion_expr(src_channel, dst_channel, dst_native_type, value)
- if format.colorspace == ZS:
- if i == 3:
- value = get_one(dst_channel)
- elif i >= 1:
- value = '0'
- print ' pixel.chan.%s = %s;' % (dst_channel.name, value)
+ if format.is_bitmask():
+ depth = format.block_size()
+ print ' uint%u_t value = 0;' % depth
+
+ shift = 0
+ for i in range(4):
+ dst_channel = format.channels[i]
+ if inv_swizzle[i] is not None:
+ value ='src[%u]' % inv_swizzle[i]
+ value = conversion_expr(src_channel, dst_channel, dst_native_type, value)
+ if format.colorspace == ZS:
+ if i == 3:
+ value = get_one(dst_channel)
+ elif i >= 1:
+ value = '0'
+ if dst_channel.type in (UNSIGNED, SIGNED):
+ if shift + dst_channel.size < depth:
+ value = '(%s) & 0x%x' % (value, (1 << dst_channel.size) - 1)
+ if shift:
+ value = '(%s) << %u' % (value, shift)
+ if dst_channel.type == SIGNED:
+ # Cast to unsigned
+ value = '(uint%u_t)(%s) ' % (depth, value)
+ else:
+ value = None
+ if value is not None:
+ print ' value |= %s;' % (value)
+
+ shift += dst_channel.size
+
+ if depth > 8:
+ print '#ifdef PIPE_ARCH_BIG_ENDIAN'
+ print ' value = util_bswap%u(value);' % depth
+ print '#endif'
+
+ print ' *(uint%u_t *)dst = value;' % depth
- bswap_format(format)
- print ' memcpy(dst, &pixel, sizeof pixel);'
- print '}'
- print
+ else:
+ print ' union util_format_%s pixel;' % format.short_name()
+
+ for i in range(4):
+ dst_channel = format.channels[i]
+ width = dst_channel.size
+ if inv_swizzle[i] is None:
+ continue
+ value ='src[%u]' % inv_swizzle[i]
+ value = conversion_expr(src_channel, dst_channel, dst_native_type, value)
+ if format.colorspace == ZS:
+ if i == 3:
+ value = get_one(dst_channel)
+ elif i >= 1:
+ value = '0'
+ print ' pixel.chan.%s = %s;' % (dst_channel.name, value)
+
+ bswap_format(format)
+ print ' memcpy(dst, &pixel, sizeof pixel);'
-def generate_unpack(formats, dst_channel, dst_native_type, dst_suffix):
- '''Generate the dispatch function to unpack pixels from any format'''
+def generate_format_unpack(format, dst_channel, dst_native_type, dst_suffix):
+ '''Generate the function to unpack pixels from a particular format'''
- for format in formats:
- if is_format_supported(format):
- generate_format_unpack(format, dst_channel, dst_native_type, dst_suffix)
+ name = format.short_name()
print 'static INLINE void'
- print 'util_format_unpack_%s(enum pipe_format format, %s *dst, const void *src)' % (dst_suffix, dst_native_type)
+ print 'util_format_%s_unpack_%s(%s *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)' % (name, dst_suffix, dst_native_type)
print '{'
- print ' void (*func)(%s *dst, const void *src);' % dst_native_type
- print ' switch(format) {'
- for format in formats:
- if is_format_supported(format):
- print ' case %s:' % format.name
- print ' func = &util_format_%s_unpack_%s;' % (format.short_name(), dst_suffix)
- print ' break;'
- print ' default:'
- print ' debug_printf("unsupported format\\n");'
- print ' return;'
- print ' }'
- print ' func(dst, src);'
+
+ if is_format_supported(format):
+ print ' unsigned x, y;'
+ print ' for(y = 0; y < height; y += %u) {' % (format.block_height,)
+ print ' %s *dst = dst_row;' % (dst_native_type)
+ print ' const uint8_t *src = src_row;'
+ print ' for(x = 0; x < width; x += %u) {' % (format.block_width,)
+
+ generate_unpack_kernel(format, dst_channel, dst_native_type)
+
+ print ' src += %u;' % (format.block_size() / 8,)
+ print ' dst += 4;'
+ print ' }'
+ print ' src_row += src_stride;'
+ print ' dst_row += dst_stride/sizeof(*dst_row);'
+ print ' }'
+
print '}'
print
+
+def generate_format_pack(format, src_channel, src_native_type, src_suffix):
+ '''Generate the function to pack pixels to a particular format'''
-def generate_pack(formats, src_channel, src_native_type, src_suffix):
- '''Generate the dispatch function to pack pixels to any format'''
-
- for format in formats:
- if is_format_supported(format):
- generate_format_pack(format, src_channel, src_native_type, src_suffix)
+ name = format.short_name()
print 'static INLINE void'
- print 'util_format_pack_%s(enum pipe_format format, void *dst, %s r, %s g, %s b, %s a)' % (src_suffix, src_native_type, src_native_type, src_native_type, src_native_type)
+ print 'util_format_%s_pack_%s(uint8_t *dst_row, unsigned dst_stride, const %s *src_row, unsigned src_stride, unsigned width, unsigned height)' % (name, src_suffix, src_native_type)
print '{'
- print ' void (*func)(void *dst, %s r, %s g, %s b, %s a);' % (src_native_type, src_native_type, src_native_type, src_native_type)
- print ' switch(format) {'
- for format in formats:
- if is_format_supported(format):
- print ' case %s:' % format.name
- print ' func = &util_format_%s_pack_%s;' % (format.short_name(), src_suffix)
- print ' break;'
- print ' default:'
- print ' debug_printf("%s: unsupported format\\n", __FUNCTION__);'
- print ' return;'
- print ' }'
- print ' func(dst, r, g, b, a);'
+
+ if is_format_supported(format):
+ print ' unsigned x, y;'
+ print ' for(y = 0; y < height; y += %u) {' % (format.block_height,)
+ print ' const %s *src = src_row;' % (src_native_type)
+ print ' uint8_t *dst = dst_row;'
+ print ' for(x = 0; x < width; x += %u) {' % (format.block_width,)
+
+ generate_pack_kernel(format, src_channel, src_native_type)
+
+ print ' src += 4;'
+ print ' dst += %u;' % (format.block_size() / 8,)
+ print ' }'
+ print ' dst_row += dst_stride;'
+ print ' src_row += src_stride/sizeof(*src_row);'
+ print ' }'
+
print '}'
print
+
+def generate_format_fetch(format, dst_channel, dst_native_type, dst_suffix):
+ '''Generate the function to unpack pixels from a particular format'''
-def main():
- formats = []
- for arg in sys.argv[1:]:
- formats.extend(parse(arg))
+ name = format.short_name()
- print '/* This file is autogenerated by u_format_pack.py from u_format.csv. Do not edit directly. */'
- print
- # This will print the copyright message on the top of this file
- print __doc__.strip()
+ print 'static INLINE void'
+ print 'util_format_%s_fetch_%s(%s *dst, const uint8_t *src, unsigned i, unsigned j)' % (name, dst_suffix, dst_native_type)
+ print '{'
+
+ if is_format_supported(format):
+ generate_unpack_kernel(format, dst_channel, dst_native_type)
+ print '}'
print
- print '#ifndef U_FORMAT_PACK_H'
- print '#define U_FORMAT_PACK_H'
+
+
+def generate(formats):
print
print '#include "pipe/p_compiler.h"'
print '#include "u_math.h"'
print '#include "u_format.h"'
+ print '#include "u_half.h"'
print
- generate_clamp()
-
for format in formats:
- if format.layout == PLAIN:
+ if is_format_supported(format):
generate_format_type(format)
channel = Channel(FLOAT, False, 32)
native_type = 'float'
- suffix = '4f'
+ suffix = 'float'
- generate_unpack(formats, channel, native_type, suffix)
- generate_pack(formats, channel, native_type, suffix)
+ for format in formats:
+ if format.layout != 's3tc':
+ generate_format_unpack(format, channel, native_type, suffix)
+ generate_format_pack(format, channel, native_type, suffix)
+ generate_format_fetch(format, channel, native_type, suffix)
channel = Channel(UNSIGNED, True, 8)
native_type = 'uint8_t'
- suffix = '4ub'
-
- generate_unpack(formats, channel, native_type, suffix)
- generate_pack(formats, channel, native_type, suffix)
-
- print
- print '#ifdef __cplusplus'
- print '}'
- print '#endif'
- print
- print '#endif /* ! U_FORMAT_PACK_H */'
+ suffix = '8unorm'
+ for format in formats:
+ if format.layout != 's3tc':
+ generate_format_unpack(format, channel, native_type, suffix)
+ generate_format_pack(format, channel, native_type, suffix)
-if __name__ == '__main__':
- main()
diff --git a/src/gallium/auxiliary/util/u_format_parse.py b/src/gallium/auxiliary/util/u_format_parse.py
index 250926418e..03dc62d329 100755
--- a/src/gallium/auxiliary/util/u_format_parse.py
+++ b/src/gallium/auxiliary/util/u_format_parse.py
@@ -78,7 +78,7 @@ class Channel:
if self.type == UNSIGNED:
return (1 << self.size) - 1
if self.type == SIGNED:
- return self.size - 1
+ return (1 << (self.size - 1)) - 1
assert False
def min(self):
@@ -142,6 +142,8 @@ class Format:
def is_mixed(self):
ref_channel = self.channels[0]
+ if ref_channel.type == VOID:
+ ref_channel = self.channels[1]
for channel in self.channels[1:]:
if channel.type != VOID:
if channel.type != ref_channel.type:
@@ -166,17 +168,11 @@ class Format:
return True
def is_bitmask(self):
- if self.block_size() > 32:
- return False
- if not self.is_pot():
+ if self.block_size() not in (8, 16, 32):
return False
for channel in self.channels:
- if not is_pot(channel.size):
- return True
if channel.type not in (VOID, UNSIGNED, SIGNED):
return False
- if channel.size >= 32:
- return False
return True
def inv_swizzles(self):
diff --git a/src/gallium/auxiliary/util/u_format_s3tc.c b/src/gallium/auxiliary/util/u_format_s3tc.c
new file mode 100644
index 0000000000..268f0e8dfa
--- /dev/null
+++ b/src/gallium/auxiliary/util/u_format_s3tc.c
@@ -0,0 +1,745 @@
+/**************************************************************************
+ *
+ * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
+ * Copyright (c) 2008 VMware, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#include "u_dl.h"
+#include "u_math.h"
+#include "u_format.h"
+#include "u_format_s3tc.h"
+
+
+#if defined(_WIN32) || defined(WIN32)
+#define DXTN_LIBNAME "dxtn.dll"
+#else
+#define DXTN_LIBNAME "libtxc_dxtn.so"
+#endif
+
+
+boolean util_format_s3tc_enabled = FALSE;
+
+util_format_dxtn_fetch_t util_format_dxt1_rgb_fetch = NULL;
+util_format_dxtn_fetch_t util_format_dxt1_rgba_fetch = NULL;
+util_format_dxtn_fetch_t util_format_dxt3_rgba_fetch = NULL;
+util_format_dxtn_fetch_t util_format_dxt5_rgba_fetch = NULL;
+
+util_format_dxtn_pack_t util_format_dxtn_pack = NULL;
+
+
+void
+util_format_s3tc_init(void)
+{
+ static struct util_dl_library *
+ library = NULL;
+
+ if (util_format_s3tc_enabled)
+ return;
+
+ if (!library) {
+ library = util_dl_open(DXTN_LIBNAME);
+ if (!library) {
+ debug_printf("couldn't open " DXTN_LIBNAME ", software DXTn "
+ "compression/decompression unavailable");
+ }
+ else {
+ util_format_dxt1_rgb_fetch = (util_format_dxtn_fetch_t)
+ util_dl_get_proc_address(library, "fetch_2d_texel_rgb_dxt1");
+ util_format_dxt1_rgba_fetch = (util_format_dxtn_fetch_t)
+ util_dl_get_proc_address(library, "fetch_2d_texel_rgba_dxt1");
+ util_format_dxt3_rgba_fetch = (util_format_dxtn_fetch_t)
+ util_dl_get_proc_address(library, "fetch_2d_texel_rgba_dxt3");
+ util_format_dxt5_rgba_fetch = (util_format_dxtn_fetch_t)
+ util_dl_get_proc_address(library, "fetch_2d_texel_rgba_dxt5");
+ util_format_dxtn_pack = (util_format_dxtn_pack_t)
+ util_dl_get_proc_address(library, "tx_compress_dxtn");
+
+ if (util_format_dxt1_rgb_fetch ||
+ util_format_dxt1_rgba_fetch ||
+ util_format_dxt3_rgba_fetch ||
+ util_format_dxt5_rgba_fetch ||
+ util_format_dxtn_pack) {
+ util_format_s3tc_enabled = TRUE;
+ debug_printf("software DXTn compression/decompression available");
+
+ } else {
+ debug_printf("couldn't reference all symbols in "
+ DXTN_LIBNAME ", software DXTn compression/decompression "
+ "unavailable");
+ }
+ }
+ }
+}
+
+
+/*
+ * Pixel fetch.
+ */
+
+void
+util_format_dxt1_rgb_fetch_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+ if (util_format_dxt1_rgb_fetch) {
+ util_format_dxt1_rgb_fetch(0, src, i, j, dst);
+ }
+}
+
+void
+util_format_dxt1_rgba_fetch_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+ if (util_format_dxt1_rgba_fetch) {
+ util_format_dxt1_rgba_fetch(0, src, i, j, dst);
+ }
+}
+
+void
+util_format_dxt3_rgba_fetch_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+ if (util_format_dxt3_rgba_fetch) {
+ util_format_dxt3_rgba_fetch(0, src, i, j, dst);
+ }
+}
+
+void
+util_format_dxt5_rgba_fetch_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+ if (util_format_dxt5_rgba_fetch) {
+ util_format_dxt5_rgba_fetch(0, src, i, j, dst);
+ }
+}
+
+void
+util_format_dxt1_rgb_fetch_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+ if (util_format_dxt1_rgb_fetch) {
+ uint8_t tmp[4];
+ util_format_dxt1_rgb_fetch(0, src, i, j, tmp);
+ dst[0] = ubyte_to_float(tmp[0]);
+ dst[1] = ubyte_to_float(tmp[1]);
+ dst[2] = ubyte_to_float(tmp[2]);
+ dst[3] = 1.0;
+ }
+}
+
+void
+util_format_dxt1_rgba_fetch_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+ if (util_format_dxt1_rgba_fetch) {
+ uint8_t tmp[4];
+ util_format_dxt1_rgba_fetch(0, src, i, j, tmp);
+ dst[0] = ubyte_to_float(tmp[0]);
+ dst[1] = ubyte_to_float(tmp[1]);
+ dst[2] = ubyte_to_float(tmp[2]);
+ dst[3] = ubyte_to_float(tmp[3]);
+ }
+}
+
+void
+util_format_dxt3_rgba_fetch_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+ if (util_format_dxt3_rgba_fetch) {
+ uint8_t tmp[4];
+ util_format_dxt3_rgba_fetch(0, src, i, j, tmp);
+ dst[0] = ubyte_to_float(tmp[0]);
+ dst[1] = ubyte_to_float(tmp[1]);
+ dst[2] = ubyte_to_float(tmp[2]);
+ dst[3] = ubyte_to_float(tmp[3]);
+ }
+}
+
+void
+util_format_dxt5_rgba_fetch_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+ if (util_format_dxt5_rgba_fetch) {
+ uint8_t tmp[4];
+ util_format_dxt5_rgba_fetch(0, src, i, j, tmp);
+ dst[0] = ubyte_to_float(tmp[0]);
+ dst[1] = ubyte_to_float(tmp[1]);
+ dst[2] = ubyte_to_float(tmp[2]);
+ dst[3] = ubyte_to_float(tmp[3]);
+ }
+}
+
+
+/*
+ * Block decompression.
+ */
+
+void
+util_format_dxt1_rgb_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ if (util_format_dxt1_rgb_fetch) {
+ unsigned x, y, i, j;
+ for(y = 0; y < height; y += 4) {
+ const uint8_t *src = src_row;
+ for(x = 0; x < width; x += 4) {
+ for(j = 0; j < 4; ++j) {
+ for(i = 0; i < 4; ++i) {
+ uint8_t *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
+ util_format_dxt1_rgb_fetch(0, src, i, j, dst);
+ }
+ }
+ src += 8;
+ }
+ src_row += src_stride;
+ }
+ }
+}
+
+void
+util_format_dxt1_rgba_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ if (util_format_dxt1_rgba_fetch) {
+ unsigned x, y, i, j;
+ for(y = 0; y < height; y += 4) {
+ const uint8_t *src = src_row;
+ for(x = 0; x < width; x += 4) {
+ for(j = 0; j < 4; ++j) {
+ for(i = 0; i < 4; ++i) {
+ uint8_t *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
+ util_format_dxt1_rgba_fetch(0, src, i, j, dst);
+ }
+ }
+ src += 8;
+ }
+ src_row += src_stride;
+ }
+ }
+}
+
+void
+util_format_dxt3_rgba_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ if (util_format_dxt3_rgba_fetch) {
+ unsigned x, y, i, j;
+ for(y = 0; y < height; y += 4) {
+ const uint8_t *src = src_row;
+ for(x = 0; x < width; x += 4) {
+ for(j = 0; j < 4; ++j) {
+ for(i = 0; i < 4; ++i) {
+ uint8_t *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
+ util_format_dxt3_rgba_fetch(0, src, i, j, dst);
+ }
+ }
+ src += 16;
+ }
+ src_row += src_stride;
+ }
+ }
+}
+
+void
+util_format_dxt5_rgba_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ if (util_format_dxt5_rgba_fetch) {
+ unsigned x, y, i, j;
+ for(y = 0; y < height; y += 4) {
+ const uint8_t *src = src_row;
+ for(x = 0; x < width; x += 4) {
+ for(j = 0; j < 4; ++j) {
+ for(i = 0; i < 4; ++i) {
+ uint8_t *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
+ util_format_dxt5_rgba_fetch(0, src, i, j, dst);
+ }
+ }
+ src += 16;
+ }
+ src_row += src_stride;
+ }
+ }
+}
+
+void
+util_format_dxt1_rgb_unpack_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ if (util_format_dxt1_rgb_fetch) {
+ unsigned x, y, i, j;
+ for(y = 0; y < height; y += 4) {
+ const uint8_t *src = src_row;
+ for(x = 0; x < width; x += 4) {
+ for(j = 0; j < 4; ++j) {
+ for(i = 0; i < 4; ++i) {
+ float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
+ uint8_t tmp[4];
+ util_format_dxt1_rgb_fetch(0, src, i, j, tmp);
+ dst[0] = ubyte_to_float(tmp[0]);
+ dst[1] = ubyte_to_float(tmp[1]);
+ dst[2] = ubyte_to_float(tmp[2]);
+ dst[3] = 1.0;
+ }
+ }
+ src += 8;
+ }
+ src_row += src_stride;
+ }
+ }
+}
+
+void
+util_format_dxt1_rgba_unpack_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ if (util_format_dxt1_rgba_fetch) {
+ unsigned x, y, i, j;
+ for(y = 0; y < height; y += 4) {
+ const uint8_t *src = src_row;
+ for(x = 0; x < width; x += 4) {
+ for(j = 0; j < 4; ++j) {
+ for(i = 0; i < 4; ++i) {
+ float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
+ uint8_t tmp[4];
+ util_format_dxt1_rgba_fetch(0, src, i, j, tmp);
+ dst[0] = ubyte_to_float(tmp[0]);
+ dst[1] = ubyte_to_float(tmp[1]);
+ dst[2] = ubyte_to_float(tmp[2]);
+ dst[3] = ubyte_to_float(tmp[3]);
+ }
+ }
+ src += 8;
+ }
+ src_row += src_stride;
+ }
+ }
+}
+
+void
+util_format_dxt3_rgba_unpack_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ if (util_format_dxt3_rgba_fetch) {
+ unsigned x, y, i, j;
+ for(y = 0; y < height; y += 4) {
+ const uint8_t *src = src_row;
+ for(x = 0; x < width; x += 4) {
+ for(j = 0; j < 4; ++j) {
+ for(i = 0; i < 4; ++i) {
+ float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
+ uint8_t tmp[4];
+ util_format_dxt3_rgba_fetch(0, src, i, j, tmp);
+ dst[0] = ubyte_to_float(tmp[0]);
+ dst[1] = ubyte_to_float(tmp[1]);
+ dst[2] = ubyte_to_float(tmp[2]);
+ dst[3] = ubyte_to_float(tmp[3]);
+ }
+ }
+ src += 16;
+ }
+ src_row += src_stride;
+ }
+ }
+}
+
+void
+util_format_dxt5_rgba_unpack_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ if (util_format_dxt5_rgba_fetch) {
+ unsigned x, y, i, j;
+ for(y = 0; y < height; y += 4) {
+ const uint8_t *src = src_row;
+ for(x = 0; x < width; x += 4) {
+ for(j = 0; j < 4; ++j) {
+ for(i = 0; i < 4; ++i) {
+ float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
+ uint8_t tmp[4];
+ util_format_dxt5_rgba_fetch(0, src, i, j, tmp);
+ dst[0] = ubyte_to_float(tmp[0]);
+ dst[1] = ubyte_to_float(tmp[1]);
+ dst[2] = ubyte_to_float(tmp[2]);
+ dst[3] = ubyte_to_float(tmp[3]);
+ }
+ }
+ src += 16;
+ }
+ src_row += src_stride;
+ }
+ }
+}
+
+
+/*
+ * Block compression.
+ */
+
+void
+util_format_dxt1_rgb_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ if (util_format_dxtn_pack) {
+ unsigned x, y, i, j, k;
+ for(y = 0; y < height; y += 4) {
+ const uint8_t *src = src_row;
+ uint8_t *dst = dst_row;
+ for(x = 0; x < width; x += 4) {
+ uint8_t tmp[4][4][3];
+ for(j = 0; j < 4; ++j) {
+ for(i = 0; i < 4; ++i) {
+ for(k = 0; k < 3; ++k) {
+ tmp[j][i][k] = src[(y + j)*src_stride/sizeof(*src) + i*4 + k];
+ }
+ }
+ }
+ util_format_dxtn_pack(3, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT1_RGB, dst, dst_stride);
+ src += 4*4;
+ dst += 8;
+ }
+ src_row += src_stride;
+ dst_row += 4*dst_stride/sizeof(*dst_row);
+ }
+ }
+}
+
+void
+util_format_dxt1_rgba_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ if (util_format_dxtn_pack) {
+ unsigned x, y, i, j, k;
+ for(y = 0; y < height; y += 4) {
+ const uint8_t *src = src_row;
+ uint8_t *dst = dst_row;
+ for(x = 0; x < width; x += 4) {
+ uint8_t tmp[4][4][4];
+ for(j = 0; j < 4; ++j) {
+ for(i = 0; i < 4; ++i) {
+ for(k = 0; k < 4; ++k) {
+ tmp[j][i][k] = src[(y + j)*src_stride/sizeof(*src) + i*4 + k];
+ }
+ }
+ }
+ util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT1_RGBA, dst, dst_stride);
+ src += 4*4;
+ dst += 8;
+ }
+ src_row += src_stride;
+ dst_row += 4*dst_stride/sizeof(*dst_row);
+ }
+ }
+}
+
+void
+util_format_dxt3_rgba_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ if (util_format_dxtn_pack) {
+ unsigned x, y, i, j, k;
+ for(y = 0; y < height; y += 4) {
+ const uint8_t *src = src_row;
+ uint8_t *dst = dst_row;
+ for(x = 0; x < width; x += 4) {
+ uint8_t tmp[4][4][4];
+ for(j = 0; j < 4; ++j) {
+ for(i = 0; i < 4; ++i) {
+ for(k = 0; k < 4; ++k) {
+ tmp[j][i][k] = src[(y + j)*src_stride/sizeof(*src) + i*4 + k];
+ }
+ }
+ }
+ util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT3_RGBA, dst, dst_stride);
+ src += 4*4;
+ dst += 16;
+ }
+ src_row += src_stride;
+ dst_row += 4*dst_stride/sizeof(*dst_row);
+ }
+ }
+}
+
+void
+util_format_dxt5_rgba_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ if (util_format_dxtn_pack) {
+ unsigned x, y, i, j, k;
+ for(y = 0; y < height; y += 4) {
+ const uint8_t *src = src_row;
+ uint8_t *dst = dst_row;
+ for(x = 0; x < width; x += 4) {
+ uint8_t tmp[4][4][4];
+ for(j = 0; j < 4; ++j) {
+ for(i = 0; i < 4; ++i) {
+ for(k = 0; k < 4; ++k) {
+ tmp[j][i][k] = src[(y + j)*src_stride/sizeof(*src) + i*4 + k];
+ }
+ }
+ }
+ util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT5_RGBA, dst, dst_stride);
+ src += 4*4;
+ dst += 16;
+ }
+ src_row += src_stride;
+ dst_row += 4*dst_stride/sizeof(*dst_row);
+ }
+ }
+}
+
+void
+util_format_dxt1_rgb_pack_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ if (util_format_dxtn_pack) {
+ unsigned x, y, i, j, k;
+ for(y = 0; y < height; y += 4) {
+ const float *src = src_row;
+ uint8_t *dst = dst_row;
+ for(x = 0; x < width; x += 4) {
+ uint8_t tmp[4][4][3];
+ for(j = 0; j < 4; ++j) {
+ for(i = 0; i < 4; ++i) {
+ for(k = 0; k < 3; ++k) {
+ tmp[j][i][k] = float_to_ubyte(src[(y + j)*src_stride/sizeof(*src) + i*4 + k]);
+ }
+ }
+ }
+ util_format_dxtn_pack(3, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT1_RGB, dst, dst_stride);
+ src += 4*4;
+ dst += 8;
+ }
+ src_row += src_stride;
+ dst_row += 4*dst_stride/sizeof(*dst_row);
+ }
+ }
+}
+
+void
+util_format_dxt1_rgba_pack_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ if (util_format_dxtn_pack) {
+ unsigned x, y, i, j, k;
+ for(y = 0; y < height; y += 4) {
+ const float *src = src_row;
+ uint8_t *dst = dst_row;
+ for(x = 0; x < width; x += 4) {
+ uint8_t tmp[4][4][4];
+ for(j = 0; j < 4; ++j) {
+ for(i = 0; i < 4; ++i) {
+ for(k = 0; k < 4; ++k) {
+ tmp[j][i][k] = float_to_ubyte(src[(y + j)*src_stride/sizeof(*src) + i*4 + k]);
+ }
+ }
+ }
+ util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT1_RGBA, dst, dst_stride);
+ src += 4*4;
+ dst += 8;
+ }
+ src_row += src_stride;
+ dst_row += 4*dst_stride/sizeof(*dst_row);
+ }
+ }
+}
+
+void
+util_format_dxt3_rgba_pack_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ if (util_format_dxtn_pack) {
+ unsigned x, y, i, j, k;
+ for(y = 0; y < height; y += 4) {
+ const float *src = src_row;
+ uint8_t *dst = dst_row;
+ for(x = 0; x < width; x += 4) {
+ uint8_t tmp[4][4][4];
+ for(j = 0; j < 4; ++j) {
+ for(i = 0; i < 4; ++i) {
+ for(k = 0; k < 4; ++k) {
+ tmp[j][i][k] = float_to_ubyte(src[(y + j)*src_stride/sizeof(*src) + i*4 + k]);
+ }
+ }
+ }
+ util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT3_RGBA, dst, dst_stride);
+ src += 4*4;
+ dst += 16;
+ }
+ src_row += src_stride;
+ dst_row += 4*dst_stride/sizeof(*dst_row);
+ }
+ }
+}
+
+void
+util_format_dxt5_rgba_pack_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ if (util_format_dxtn_pack) {
+ unsigned x, y, i, j, k;
+ for(y = 0; y < height; y += 4) {
+ const float *src = src_row;
+ uint8_t *dst = dst_row;
+ for(x = 0; x < width; x += 4) {
+ uint8_t tmp[4][4][4];
+ for(j = 0; j < 4; ++j) {
+ for(i = 0; i < 4; ++i) {
+ for(k = 0; k < 4; ++k) {
+ tmp[j][i][k] = float_to_ubyte(src[(y + j)*src_stride/sizeof(*src) + i*4 + k]);
+ }
+ }
+ }
+ util_format_dxtn_pack(4, 4, 4, &tmp[0][0][0], UTIL_FORMAT_DXT5_RGBA, dst, dst_stride);
+ src += 4*4;
+ dst += 16;
+ }
+ src_row += src_stride;
+ dst_row += 4*dst_stride/sizeof(*dst_row);
+ }
+ }
+}
+
+
+/*
+ * SRGB variants.
+ *
+ * FIXME: shunts to RGB for now
+ */
+
+void
+util_format_dxt1_srgb_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ util_format_dxt1_rgb_unpack_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
+}
+
+void
+util_format_dxt1_srgb_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ util_format_dxt1_rgb_pack_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
+}
+
+void
+util_format_dxt1_srgb_fetch_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+ util_format_dxt1_rgb_fetch_8unorm(dst, src, i, j);
+}
+
+void
+util_format_dxt1_srgba_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ util_format_dxt1_rgba_unpack_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
+}
+
+void
+util_format_dxt1_srgba_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ util_format_dxt1_rgba_pack_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
+}
+
+void
+util_format_dxt1_srgba_fetch_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+ util_format_dxt1_rgba_fetch_8unorm(dst, src, i, j);
+}
+
+void
+util_format_dxt3_srgba_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ util_format_dxt3_rgba_unpack_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
+}
+
+void
+util_format_dxt3_srgba_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ util_format_dxt3_rgba_pack_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
+}
+
+void
+util_format_dxt3_srgba_fetch_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+ util_format_dxt3_rgba_fetch_8unorm(dst, src, i, j);
+}
+
+void
+util_format_dxt5_srgba_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ util_format_dxt5_rgba_unpack_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
+}
+
+void
+util_format_dxt5_srgba_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ util_format_dxt5_rgba_pack_8unorm(dst_row, dst_stride, src_row, src_stride, width, height);
+}
+
+void
+util_format_dxt5_srgba_fetch_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+ util_format_dxt5_rgba_fetch_8unorm(dst, src, i, j);
+}
+
+void
+util_format_dxt1_srgb_unpack_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ util_format_dxt1_rgb_unpack_float(dst_row, dst_stride, src_row, src_stride, width, height);
+}
+
+void
+util_format_dxt1_srgb_pack_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ util_format_dxt1_rgb_pack_float(dst_row, dst_stride, src_row, src_stride, width, height);
+}
+
+void
+util_format_dxt1_srgb_fetch_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+ util_format_dxt1_rgb_fetch_float(dst, src, i, j);
+}
+
+void
+util_format_dxt1_srgba_unpack_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ util_format_dxt1_rgba_unpack_float(dst_row, dst_stride, src_row, src_stride, width, height);
+}
+
+void
+util_format_dxt1_srgba_pack_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ util_format_dxt1_rgba_pack_float(dst_row, dst_stride, src_row, src_stride, width, height);
+}
+
+void
+util_format_dxt1_srgba_fetch_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+ util_format_dxt1_rgba_fetch_float(dst, src, i, j);
+}
+
+void
+util_format_dxt3_srgba_unpack_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ util_format_dxt3_rgba_unpack_float(dst_row, dst_stride, src_row, src_stride, width, height);
+}
+
+void
+util_format_dxt3_srgba_pack_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ util_format_dxt3_rgba_pack_float(dst_row, dst_stride, src_row, src_stride, width, height);
+}
+
+void
+util_format_dxt3_srgba_fetch_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+ util_format_dxt3_rgba_fetch_float(dst, src, i, j);
+}
+
+void
+util_format_dxt5_srgba_unpack_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ util_format_dxt5_rgba_unpack_float(dst_row, dst_stride, src_row, src_stride, width, height);
+}
+
+void
+util_format_dxt5_srgba_pack_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ util_format_dxt5_rgba_pack_float(dst_row, dst_stride, src_row, src_stride, width, height);
+}
+
+void
+util_format_dxt5_srgba_fetch_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+ util_format_dxt5_rgba_fetch_float(dst, src, i, j);
+}
+
diff --git a/src/gallium/auxiliary/util/u_format_s3tc.h b/src/gallium/auxiliary/util/u_format_s3tc.h
new file mode 100644
index 0000000000..5c3a9dd22c
--- /dev/null
+++ b/src/gallium/auxiliary/util/u_format_s3tc.h
@@ -0,0 +1,218 @@
+/**************************************************************************
+ *
+ * Copyright 2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ **************************************************************************/
+
+
+#ifndef U_FORMAT_S3TC_H_
+#define U_FORMAT_S3TC_H_
+
+
+#include "pipe/p_compiler.h"
+
+
+enum util_format_dxtn {
+ UTIL_FORMAT_DXT1_RGB = 0x83F0,
+ UTIL_FORMAT_DXT1_RGBA = 0x83F1,
+ UTIL_FORMAT_DXT3_RGBA = 0x83F2,
+ UTIL_FORMAT_DXT5_RGBA = 0x83F3
+};
+
+
+typedef void
+(*util_format_dxtn_fetch_t)( int src_stride,
+ const uint8_t *src,
+ int col, int row,
+ uint8_t *dst );
+
+typedef void
+(*util_format_dxtn_pack_t)( int src_comps,
+ int width, int height,
+ const uint8_t *src,
+ enum util_format_dxtn dst_format,
+ uint8_t *dst,
+ int dst_stride);
+
+extern boolean util_format_s3tc_enabled;
+
+extern util_format_dxtn_fetch_t util_format_dxt1_rgb_fetch;
+extern util_format_dxtn_fetch_t util_format_dxt1_rgba_fetch;
+extern util_format_dxtn_fetch_t util_format_dxt3_rgba_fetch;
+extern util_format_dxtn_fetch_t util_format_dxt5_rgba_fetch;
+
+extern util_format_dxtn_pack_t util_format_dxtn_pack;
+
+
+void
+util_format_s3tc_init(void);
+
+
+void
+util_format_dxt1_rgb_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt1_rgb_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt1_rgb_fetch_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
+
+void
+util_format_dxt1_rgba_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt1_rgba_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt1_rgba_fetch_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
+
+void
+util_format_dxt3_rgba_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt3_rgba_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt3_rgba_fetch_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
+
+void
+util_format_dxt5_rgba_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt5_rgba_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt5_rgba_fetch_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
+
+void
+util_format_dxt1_srgb_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt1_srgb_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt1_srgb_fetch_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
+
+void
+util_format_dxt1_srgba_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt1_srgba_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt1_srgba_fetch_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
+
+void
+util_format_dxt3_srgba_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt3_srgba_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt3_srgba_fetch_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
+
+void
+util_format_dxt5_srgba_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt5_srgba_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt5_srgba_fetch_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j);
+
+
+void
+util_format_dxt1_rgb_unpack_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt1_rgb_pack_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt1_rgb_fetch_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+
+void
+util_format_dxt1_rgba_unpack_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt1_rgba_pack_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt1_rgba_fetch_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+
+void
+util_format_dxt3_rgba_unpack_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt3_rgba_pack_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt3_rgba_fetch_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+
+void
+util_format_dxt5_rgba_unpack_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt5_rgba_pack_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt5_rgba_fetch_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+
+void
+util_format_dxt1_srgb_unpack_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt1_srgb_pack_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt1_srgb_fetch_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+
+void
+util_format_dxt1_srgba_unpack_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt1_srgba_pack_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt1_srgba_fetch_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+
+void
+util_format_dxt3_srgba_unpack_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt3_srgba_pack_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt3_srgba_fetch_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+
+void
+util_format_dxt5_srgba_unpack_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt5_srgba_pack_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_dxt5_srgba_fetch_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+
+
+#endif /* U_FORMAT_S3TC_H_ */
diff --git a/src/gallium/auxiliary/util/u_format_table.py b/src/gallium/auxiliary/util/u_format_table.py
index 4e29d15f3b..94a4331b15 100755
--- a/src/gallium/auxiliary/util/u_format_table.py
+++ b/src/gallium/auxiliary/util/u_format_table.py
@@ -3,7 +3,7 @@
'''
/**************************************************************************
*
- * Copyright 2009 VMware, Inc.
+ * Copyright 2010 VMware, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -33,6 +33,7 @@
import sys
from u_format_parse import *
+import u_format_pack
def layout_map(layout):
@@ -85,30 +86,22 @@ def write_format_table(formats):
print __doc__.strip()
print
print '#include "u_format.h"'
+ print '#include "u_format_s3tc.h"'
print
- print 'const struct util_format_description'
- print 'util_format_none_description = {'
- print " PIPE_FORMAT_NONE,"
- print " \"PIPE_FORMAT_NONE\","
- print " {0, 0, 0},"
- print " 0,"
- print " 0,"
- print " 0,"
- print " 0,"
- print " {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},"
- print " {0, 0, 0, 0},"
- print " 0"
- print "};"
- print
+
+ u_format_pack.generate(formats)
+
for format in formats:
print 'const struct util_format_description'
print 'util_format_%s_description = {' % (format.short_name(),)
print " %s," % (format.name,)
print " \"%s\"," % (format.name,)
+ print " \"%s\"," % (format.short_name(),)
print " {%u, %u, %u},\t/* block */" % (format.block_width, format.block_height, format.block_size())
print " %s," % (layout_map(format.layout),)
print " %u,\t/* nr_channels */" % (format.nr_channels(),)
print " %s,\t/* is_array */" % (bool_map(format.is_array()),)
+ print " %s,\t/* is_bitmask */" % (bool_map(format.is_bitmask()),)
print " %s,\t/* is_mixed */" % (bool_map(format.is_mixed()),)
print " {"
for i in range(4):
@@ -136,8 +129,14 @@ def write_format_table(formats):
print " %s%s\t/* %s */" % (swizzle_map[swizzle], sep, comment)
print " },"
print " %s," % (colorspace_map(format.colorspace),)
+ print " &util_format_%s_unpack_8unorm," % format.short_name()
+ print " &util_format_%s_pack_8unorm," % format.short_name()
+ print " &util_format_%s_unpack_float," % format.short_name()
+ print " &util_format_%s_pack_float," % format.short_name()
+ print " &util_format_%s_fetch_float" % format.short_name()
print "};"
print
+
print "const struct util_format_description *"
print "util_format_description(enum pipe_format format)"
print "{"
@@ -146,8 +145,6 @@ def write_format_table(formats):
print " }"
print
print " switch (format) {"
- print " case PIPE_FORMAT_NONE:"
- print " return &util_format_none_description;"
for format in formats:
print " case %s:" % format.name
print " return &util_format_%s_description;" % (format.short_name(),)
diff --git a/src/gallium/auxiliary/util/u_format_tests.c b/src/gallium/auxiliary/util/u_format_tests.c
new file mode 100644
index 0000000000..0f81dcb79b
--- /dev/null
+++ b/src/gallium/auxiliary/util/u_format_tests.c
@@ -0,0 +1,718 @@
+/**************************************************************************
+ *
+ * Copyright 2009-2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+
+#include "u_memory.h"
+#include "u_format_tests.h"
+
+
+/*
+ * Helper macros to create the packed bytes for longer words.
+ */
+
+#define PACKED_1x8(x) {x, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+#define PACKED_2x8(x, y) {x, y, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+#define PACKED_3x8(x, y, z) {x, y, z, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+#define PACKED_4x8(x, y, z, w) {x, y, z, w, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+#define PACKED_8x8(a, b, c, d, e, f, g, h) {a, b, c, d, e, f, g, h, 0, 0, 0, 0, 0, 0, 0, 0}
+
+#define PACKED_1x16(x) {(x) & 0xff, (x) >> 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+#define PACKED_2x16(x, y) {(x) & 0xff, (x) >> 8, (y) & 0xff, (y) >> 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+#define PACKED_3x16(x, y, z) {(x) & 0xff, (x) >> 8, (y) & 0xff, (y) >> 8, (z) & 0xff, (z) >> 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+#define PACKED_4x16(x, y, z, w) {(x) & 0xff, (x) >> 8, (y) & 0xff, (y) >> 8, (z) & 0xff, (z) >> 8, (w) & 0xff, (w) >> 8, 0, 0, 0, 0, 0, 0, 0, 0}
+
+#define PACKED_1x32(x) {(x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, (x) >> 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+#define PACKED_2x32(x, y) {(x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, (x) >> 24, (y) & 0xff, ((y) >> 8) & 0xff, ((y) >> 16) & 0xff, (y) >> 24, 0, 0, 0, 0, 0, 0, 0, 0}
+#define PACKED_3x32(x, y, z) {(x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, (x) >> 24, (y) & 0xff, ((y) >> 8) & 0xff, ((y) >> 16) & 0xff, (y) >> 24, (z) & 0xff, ((z) >> 8) & 0xff, ((z) >> 16) & 0xff, (z) >> 24, 0, 0, 0, 0}
+#define PACKED_4x32(x, y, z, w) {(x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, (x) >> 24, (y) & 0xff, ((y) >> 8) & 0xff, ((y) >> 16) & 0xff, (y) >> 24, (z) & 0xff, ((z) >> 8) & 0xff, ((z) >> 16) & 0xff, (z) >> 24, (w) & 0xff, ((w) >> 8) & 0xff, ((w) >> 16) & 0xff, (w) >> 24}
+
+#define UNPACKED_1x1(r, g, b, a) \
+ {{{r, g, b, a}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}, \
+ {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}, \
+ {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}, \
+ {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}}
+
+
+/**
+ * Test cases.
+ *
+ * These were manually entered. We could generate these
+ *
+ * To keep this to a we cover only the corner cases, which should produce
+ * good enough coverage since that pixel format transformations are afine for
+ * non SRGB formats.
+ */
+const struct util_format_test_case
+util_format_test_cases[] =
+{
+
+ /*
+ * 32-bit rendertarget formats
+ */
+
+ {PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
+ {PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000ff00), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
+ {PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00ff0000), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+ {PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
+ {PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x0000ff00), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
+ {PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00ff0000), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0xff000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+ {PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000ff00), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00ff0000), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
+ {PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
+ {PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+ {PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x0000ff00), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x00ff0000), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
+ {PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0xff000000), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
+ {PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+ {PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000ff00), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
+ {PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00ff0000), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
+ {PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+ {PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x000000ff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x0000ff00), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
+ {PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x00ff0000), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
+ {PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0xff000000), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+ {PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000003ff), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000ffc00), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x3ff00000), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
+ {PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xc0000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+ /*
+ * 16-bit rendertarget formats
+ */
+
+ {PIPE_FORMAT_B5G5R5X1_UNORM, PACKED_1x16(0x7fff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_B5G5R5X1_UNORM, PACKED_1x16(0x7fff), PACKED_1x16(0x001f), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
+ {PIPE_FORMAT_B5G5R5X1_UNORM, PACKED_1x16(0x7fff), PACKED_1x16(0x03e0), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
+ {PIPE_FORMAT_B5G5R5X1_UNORM, PACKED_1x16(0x7fff), PACKED_1x16(0x7c00), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_B5G5R5X1_UNORM, PACKED_1x16(0x7fff), PACKED_1x16(0x7fff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+ {PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x001f), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
+ {PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x03e0), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
+ {PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x7c00), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x8000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+ {PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x000f), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
+ {PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x00f0), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
+ {PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0f00), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xf000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+ {PIPE_FORMAT_B5G6R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_B5G6R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x001f), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
+ {PIPE_FORMAT_B5G6R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x07e0), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
+ {PIPE_FORMAT_B5G6R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xf800), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_B5G6R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+ /*
+ * Luminance/intensity/alpha formats
+ */
+
+ {PIPE_FORMAT_L8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_L8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0xff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+ {PIPE_FORMAT_A8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_A8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0xff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+
+ {PIPE_FORMAT_I8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_I8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0xff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+ {PIPE_FORMAT_L8A8_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_L8A8_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x00ff), UNPACKED_1x1(1.0, 1.0, 1.0, 0.0)},
+ {PIPE_FORMAT_L8A8_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xff00), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_L8A8_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+ {PIPE_FORMAT_L16_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_L16_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+ /*
+ * TODO: SRGB formats
+ */
+
+ /*
+ * Mixed-signed formats
+ */
+
+ {PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_4x8(0xff, 0xff, 0xff, 0x00), PACKED_4x8(0x00, 0x00, 0x00, 0x00), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_4x8(0xff, 0xff, 0xff, 0x00), PACKED_4x8(0x7f, 0x00, 0x00, 0x00), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_4x8(0xff, 0xff, 0xff, 0x00), PACKED_4x8(0x81, 0x00, 0x00, 0x00), UNPACKED_1x1(-1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_4x8(0xff, 0xff, 0xff, 0x00), PACKED_4x8(0x00, 0x7f, 0x00, 0x00), UNPACKED_1x1( 0.0, 1.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_4x8(0xff, 0xff, 0xff, 0x00), PACKED_4x8(0x00, 0x81, 0x00, 0x00), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_4x8(0xff, 0xff, 0xff, 0x00), PACKED_4x8(0x00, 0x00, 0xff, 0x00), UNPACKED_1x1( 0.0, 0.0, 1.0, 1.0)},
+
+ {PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0x000f), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0x0011), UNPACKED_1x1(-1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0x01e0), UNPACKED_1x1( 0.0, 1.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0x0220), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0xfc00), UNPACKED_1x1( 0.0, 0.0, 1.0, 1.0)},
+
+ /*
+ * TODO: Depth-stencil formats
+ */
+
+ /*
+ * TODO: YUV formats
+ */
+
+ /*
+ * Compressed formats
+ */
+
+ {
+ PIPE_FORMAT_DXT1_RGB,
+ PACKED_8x8(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff),
+ PACKED_8x8(0xf2, 0xd7, 0xb0, 0x20, 0xae, 0x2c, 0x6f, 0x97),
+ {
+ {
+ {0x99/255.0, 0xb0/255.0, 0x8e/255.0, 0xff/255.0},
+ {0x5d/255.0, 0x62/255.0, 0x89/255.0, 0xff/255.0},
+ {0x99/255.0, 0xb0/255.0, 0x8e/255.0, 0xff/255.0},
+ {0x99/255.0, 0xb0/255.0, 0x8e/255.0, 0xff/255.0}
+ },
+ {
+ {0xd6/255.0, 0xff/255.0, 0x94/255.0, 0xff/255.0},
+ {0x5d/255.0, 0x62/255.0, 0x89/255.0, 0xff/255.0},
+ {0x99/255.0, 0xb0/255.0, 0x8e/255.0, 0xff/255.0},
+ {0xd6/255.0, 0xff/255.0, 0x94/255.0, 0xff/255.0}
+ },
+ {
+ {0x5d/255.0, 0x62/255.0, 0x89/255.0, 0xff/255.0},
+ {0x5d/255.0, 0x62/255.0, 0x89/255.0, 0xff/255.0},
+ {0x99/255.0, 0xb0/255.0, 0x8e/255.0, 0xff/255.0},
+ {0x21/255.0, 0x14/255.0, 0x84/255.0, 0xff/255.0}
+ },
+ {
+ {0x5d/255.0, 0x62/255.0, 0x89/255.0, 0xff/255.0},
+ {0x21/255.0, 0x14/255.0, 0x84/255.0, 0xff/255.0},
+ {0x21/255.0, 0x14/255.0, 0x84/255.0, 0xff/255.0},
+ {0x99/255.0, 0xb0/255.0, 0x8e/255.0, 0xff/255.0}
+ }
+ }
+ },
+ {
+ PIPE_FORMAT_DXT1_RGBA,
+ PACKED_8x8(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff),
+ PACKED_8x8(0xff, 0x2f, 0xa4, 0x72, 0xeb, 0xb2, 0xbd, 0xbe),
+ {
+ {
+ {0x00/255.0, 0x00/255.0, 0x00/255.0, 0x00/255.0},
+ {0x4e/255.0, 0xaa/255.0, 0x90/255.0, 0xff/255.0},
+ {0x4e/255.0, 0xaa/255.0, 0x90/255.0, 0xff/255.0},
+ {0x00/255.0, 0x00/255.0, 0x00/255.0, 0x00/255.0}
+ },
+ {
+ {0x4e/255.0, 0xaa/255.0, 0x90/255.0, 0xff/255.0},
+ {0x29/255.0, 0xff/255.0, 0xff/255.0, 0xff/255.0},
+ {0x00/255.0, 0x00/255.0, 0x00/255.0, 0x00/255.0},
+ {0x4e/255.0, 0xaa/255.0, 0x90/255.0, 0xff/255.0}
+ },
+ {
+ {0x73/255.0, 0x55/255.0, 0x21/255.0, 0xff/255.0},
+ {0x00/255.0, 0x00/255.0, 0x00/255.0, 0x00/255.0},
+ {0x00/255.0, 0x00/255.0, 0x00/255.0, 0x00/255.0},
+ {0x4e/255.0, 0xaa/255.0, 0x90/255.0, 0xff/255.0}
+ },
+ {
+ {0x4e/255.0, 0xaa/255.0, 0x90/255.0, 0xff/255.0},
+ {0x00/255.0, 0x00/255.0, 0x00/255.0, 0x00/255.0},
+ {0x00/255.0, 0x00/255.0, 0x00/255.0, 0x00/255.0},
+ {0x4e/255.0, 0xaa/255.0, 0x90/255.0, 0xff/255.0}
+ }
+ }
+ },
+ {
+ PIPE_FORMAT_DXT3_RGBA,
+ {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
+ {0xe7, 0x4a, 0x8f, 0x96, 0x5b, 0xc1, 0x1c, 0x84, 0xf6, 0x8f, 0xab, 0x32, 0x2a, 0x9a, 0x95, 0x5a},
+ {
+ {
+ {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0x77/255.0},
+ {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xee/255.0},
+ {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xaa/255.0},
+ {0x8c/255.0, 0xff/255.0, 0xb5/255.0, 0x44/255.0}
+ },
+ {
+ {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xff/255.0},
+ {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0x88/255.0},
+ {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x66/255.0},
+ {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0x99/255.0}
+ },
+ {
+ {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0xbb/255.0},
+ {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x55/255.0},
+ {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x11/255.0},
+ {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xcc/255.0}
+ },
+ {
+ {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xcc/255.0},
+ {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0x11/255.0},
+ {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x44/255.0},
+ {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x88/255.0}
+ }
+ }
+ },
+ {
+ PIPE_FORMAT_DXT5_RGBA,
+ {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
+ {0xf8, 0x11, 0xc5, 0x0c, 0x9a, 0x73, 0xb4, 0x9c, 0xf6, 0x8f, 0xab, 0x32, 0x2a, 0x9a, 0x95, 0x5a},
+ {
+ {
+ {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0x74/255.0},
+ {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xf8/255.0},
+ {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xb6/255.0},
+ {0x8c/255.0, 0xff/255.0, 0xb5/255.0, 0x53/255.0}
+ },
+ {
+ {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xf8/255.0},
+ {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0x95/255.0},
+ {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x53/255.0},
+ {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0x95/255.0}
+ },
+ {
+ {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0xb6/255.0},
+ {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x53/255.0},
+ {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x11/255.0},
+ {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xd7/255.0}
+ },
+ {
+ {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0xb6/255.0},
+ {0x6d/255.0, 0xc6/255.0, 0x96/255.0, 0x11/255.0},
+ {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x32/255.0},
+ {0x31/255.0, 0x55/255.0, 0x5a/255.0, 0x95/255.0}
+ }
+ }
+ },
+
+
+ /*
+ * Standard 8-bit integer formats
+ */
+
+ {PIPE_FORMAT_R8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0xff), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+
+ {PIPE_FORMAT_R8G8_UNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8G8_UNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0xff, 0x00), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8G8_UNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0xff), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8G8_UNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0xff, 0xff), UNPACKED_1x1(1.0, 1.0, 0.0, 1.0)},
+
+ {PIPE_FORMAT_R8G8B8_UNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8G8B8_UNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xff, 0x00, 0x00), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8G8B8_UNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0xff, 0x00), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8G8B8_UNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0xff), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
+ {PIPE_FORMAT_R8G8B8_UNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xff, 0xff, 0xff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+ {PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0x00, 0x00, 0x00), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0xff, 0x00, 0x00), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0xff, 0x00), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
+ {PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0xff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0xff, 0xff, 0xff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+ {PIPE_FORMAT_R8_USCALED, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8_USCALED, PACKED_1x8(0xff), PACKED_1x8(0xff), UNPACKED_1x1(255.0, 0.0, 0.0, 1.0)},
+
+ {PIPE_FORMAT_R8G8_USCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x00), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8G8_USCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0xff, 0x00), UNPACKED_1x1(255.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8G8_USCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0xff), UNPACKED_1x1( 0.0, 255.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8G8_USCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0xff, 0xff), UNPACKED_1x1(255.0, 255.0, 0.0, 1.0)},
+
+ {PIPE_FORMAT_R8G8B8_USCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x00), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8G8B8_USCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xff, 0x00, 0x00), UNPACKED_1x1(255.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8G8B8_USCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0xff, 0x00), UNPACKED_1x1( 0.0, 255.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8G8B8_USCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0xff), UNPACKED_1x1( 0.0, 0.0, 255.0, 1.0)},
+ {PIPE_FORMAT_R8G8B8_USCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xff, 0xff, 0xff), UNPACKED_1x1(255.0, 255.0, 255.0, 1.0)},
+
+ {PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), UNPACKED_1x1( 0.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0x00, 0x00, 0x00), UNPACKED_1x1(255.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0xff, 0x00, 0x00), UNPACKED_1x1( 0.0, 255.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0xff, 0x00), UNPACKED_1x1( 0.0, 0.0, 255.0, 0.0)},
+ {PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0xff), UNPACKED_1x1( 0.0, 0.0, 0.0, 255.0)},
+ {PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0xff, 0xff, 0xff), UNPACKED_1x1(255.0, 255.0, 255.0, 255.0)},
+
+ {PIPE_FORMAT_R8_SNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8_SNORM, PACKED_1x8(0xff), PACKED_1x8(0x7f), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8_SNORM, PACKED_1x8(0xff), PACKED_1x8(0x81), UNPACKED_1x1(-1.0, 0.0, 0.0, 1.0)},
+
+ {PIPE_FORMAT_R8G8_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x00), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8G8_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x7f, 0x00), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8G8_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x81, 0x00), UNPACKED_1x1(-1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8G8_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x7f), UNPACKED_1x1( 0.0, 1.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8G8_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x81), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
+
+ {PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x00), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x7f, 0x00, 0x00), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x81, 0x00, 0x00), UNPACKED_1x1(-1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x7f, 0x00), UNPACKED_1x1( 0.0, 1.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x81, 0x00), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x7f), UNPACKED_1x1( 0.0, 0.0, 1.0, 1.0)},
+ {PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x81), UNPACKED_1x1( 0.0, 0.0, -1.0, 1.0)},
+
+ {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), UNPACKED_1x1( 0.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x7f, 0x00, 0x00, 0x00), UNPACKED_1x1( 1.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x81, 0x00, 0x00, 0x00), UNPACKED_1x1(-1.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x7f, 0x00, 0x00), UNPACKED_1x1( 0.0, 1.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x81, 0x00, 0x00), UNPACKED_1x1( 0.0, -1.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x7f, 0x00), UNPACKED_1x1( 0.0, 0.0, 1.0, 0.0)},
+ {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x81, 0x00), UNPACKED_1x1( 0.0, 0.0, -1.0, 0.0)},
+ {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x7f), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x81), UNPACKED_1x1( 0.0, 0.0, 0.0, -1.0)},
+
+ {PIPE_FORMAT_R8_SSCALED, PACKED_1x8(0xff), PACKED_1x8(0x00), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8_SSCALED, PACKED_1x8(0xff), PACKED_1x8(0x7f), UNPACKED_1x1( 127.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8_SSCALED, PACKED_1x8(0xff), PACKED_1x8(0x80), UNPACKED_1x1(-128.0, 0.0, 0.0, 1.0)},
+
+ {PIPE_FORMAT_R8G8_SSCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x00), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8G8_SSCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x7f, 0x00), UNPACKED_1x1( 127.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8G8_SSCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x80, 0x00), UNPACKED_1x1(-128.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8G8_SSCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x7f), UNPACKED_1x1( 0.0, 127.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8G8_SSCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x80), UNPACKED_1x1( 0.0, -128.0, 0.0, 1.0)},
+
+ {PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x00), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x7f, 0x00, 0x00), UNPACKED_1x1( 127.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x80, 0x00, 0x00), UNPACKED_1x1(-128.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x7f, 0x00), UNPACKED_1x1( 0.0, 127.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x80, 0x00), UNPACKED_1x1( 0.0, -128.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x7f), UNPACKED_1x1( 0.0, 0.0, 127.0, 1.0)},
+ {PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x80), UNPACKED_1x1( 0.0, 0.0, -128.0, 1.0)},
+
+ {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), UNPACKED_1x1( 0.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x7f, 0x00, 0x00, 0x00), UNPACKED_1x1( 127.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x80, 0x00, 0x00, 0x00), UNPACKED_1x1(-128.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x7f, 0x00, 0x00), UNPACKED_1x1( 0.0, 127.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x80, 0x00, 0x00), UNPACKED_1x1( 0.0, -128.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x7f, 0x00), UNPACKED_1x1( 0.0, 0.0, 127.0, 0.0)},
+ {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x80, 0x00), UNPACKED_1x1( 0.0, 0.0, -128.0, 0.0)},
+ {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x7f), UNPACKED_1x1( 0.0, 0.0, 0.0, 127.0)},
+ {PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x80), UNPACKED_1x1( 0.0, 0.0, 0.0, -128.0)},
+
+ /*
+ * Standard 16-bit integer formats
+ */
+
+ {PIPE_FORMAT_R16_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+
+ {PIPE_FORMAT_R16G16_UNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16_UNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0xffff, 0x0000), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16_UNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0xffff), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16_UNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0xffff, 0xffff), UNPACKED_1x1(1.0, 1.0, 0.0, 1.0)},
+
+ {PIPE_FORMAT_R16G16B16_UNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16B16_UNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0xffff, 0x0000, 0x0000), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16B16_UNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0xffff, 0x0000), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16B16_UNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0xffff), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
+ {PIPE_FORMAT_R16G16B16_UNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0xffff, 0xffff, 0xffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+ {PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x0000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0xffff, 0x0000, 0x0000, 0x0000), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0xffff, 0x0000, 0x0000), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0xffff, 0x0000), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
+ {PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0xffff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+ {PIPE_FORMAT_R16_USCALED, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16_USCALED, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1(65535.0, 0.0, 0.0, 1.0)},
+
+ {PIPE_FORMAT_R16G16_USCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x0000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16_USCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0xffff, 0x0000), UNPACKED_1x1(65535.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16_USCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0xffff), UNPACKED_1x1( 0.0, 65535.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16_USCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0xffff, 0xffff), UNPACKED_1x1(65535.0, 65535.0, 0.0, 1.0)},
+
+ {PIPE_FORMAT_R16G16B16_USCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x0000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16B16_USCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0xffff, 0x0000, 0x0000), UNPACKED_1x1(65535.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16B16_USCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0xffff, 0x0000), UNPACKED_1x1( 0.0, 65535.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16B16_USCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0xffff), UNPACKED_1x1( 0.0, 0.0, 65535.0, 1.0)},
+ {PIPE_FORMAT_R16G16B16_USCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0xffff, 0xffff, 0xffff), UNPACKED_1x1(65535.0, 65535.0, 65535.0, 1.0)},
+
+ {PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x0000), UNPACKED_1x1( 0.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0xffff, 0x0000, 0x0000, 0x0000), UNPACKED_1x1(65535.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0xffff, 0x0000, 0x0000), UNPACKED_1x1( 0.0, 65535.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0xffff, 0x0000), UNPACKED_1x1( 0.0, 0.0, 65535.0, 0.0)},
+ {PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0xffff), UNPACKED_1x1( 0.0, 0.0, 0.0, 65535.0)},
+ {PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), UNPACKED_1x1(65535.0, 65535.0, 65535.0, 65535.0)},
+
+ {PIPE_FORMAT_R16_SNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16_SNORM, PACKED_1x16(0xffff), PACKED_1x16(0x7fff), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16_SNORM, PACKED_1x16(0xffff), PACKED_1x16(0x8001), UNPACKED_1x1( -1.0, 0.0, 0.0, 1.0)},
+
+ {PIPE_FORMAT_R16G16_SNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x0000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16_SNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x7fff, 0x0000), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16_SNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x8001, 0x0000), UNPACKED_1x1( -1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16_SNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x7fff), UNPACKED_1x1( 0.0, 1.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16_SNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x8001), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
+
+ {PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x0000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x7fff, 0x0000, 0x0000), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x8001, 0x0000, 0x0000), UNPACKED_1x1( -1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x7fff, 0x0000), UNPACKED_1x1( 0.0, 1.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x8001, 0x0000), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x7fff), UNPACKED_1x1( 0.0, 0.0, 1.0, 1.0)},
+ {PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x8001), UNPACKED_1x1( 0.0, 0.0, -1.0, 1.0)},
+
+ {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x0000), UNPACKED_1x1( 0.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x7fff, 0x0000, 0x0000, 0x0000), UNPACKED_1x1( 1.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x8001, 0x0000, 0x0000, 0x0000), UNPACKED_1x1( -1.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x7fff, 0x0000, 0x0000), UNPACKED_1x1( 0.0, 1.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x8001, 0x0000, 0x0000), UNPACKED_1x1( 0.0, -1.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x7fff, 0x0000), UNPACKED_1x1( 0.0, 0.0, 1.0, 0.0)},
+ {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x8001, 0x0000), UNPACKED_1x1( 0.0, 0.0, -1.0, 0.0)},
+ {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x7fff), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x8001), UNPACKED_1x1( 0.0, 0.0, 0.0, -1.0)},
+
+ {PIPE_FORMAT_R16_SSCALED, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16_SSCALED, PACKED_1x16(0xffff), PACKED_1x16(0x7fff), UNPACKED_1x1( 32767.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16_SSCALED, PACKED_1x16(0xffff), PACKED_1x16(0x8000), UNPACKED_1x1(-32768.0, 0.0, 0.0, 1.0)},
+
+ {PIPE_FORMAT_R16G16_SSCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x0000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16_SSCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x7fff, 0x0000), UNPACKED_1x1( 32767.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16_SSCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x8000, 0x0000), UNPACKED_1x1(-32768.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16_SSCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x7fff), UNPACKED_1x1( 0.0, 32767.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16_SSCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x8000), UNPACKED_1x1( 0.0, -32768.0, 0.0, 1.0)},
+
+ {PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x0000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x7fff, 0x0000, 0x0000), UNPACKED_1x1( 32767.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x8000, 0x0000, 0x0000), UNPACKED_1x1(-32768.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x7fff, 0x0000), UNPACKED_1x1( 0.0, 32767.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x8000, 0x0000), UNPACKED_1x1( 0.0, -32768.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x7fff), UNPACKED_1x1( 0.0, 0.0, 32767.0, 1.0)},
+ {PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x8000), UNPACKED_1x1( 0.0, 0.0, -32768.0, 1.0)},
+
+ {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x0000), UNPACKED_1x1( 0.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x7fff, 0x0000, 0x0000, 0x0000), UNPACKED_1x1( 32767.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x8000, 0x0000, 0x0000, 0x0000), UNPACKED_1x1(-32768.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x7fff, 0x0000, 0x0000), UNPACKED_1x1( 0.0, 32767.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x8000, 0x0000, 0x0000), UNPACKED_1x1( 0.0, -32768.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x7fff, 0x0000), UNPACKED_1x1( 0.0, 0.0, 32767.0, 0.0)},
+ {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x8000, 0x0000), UNPACKED_1x1( 0.0, 0.0, -32768.0, 0.0)},
+ {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x7fff), UNPACKED_1x1( 0.0, 0.0, 0.0, 32767.0)},
+ {PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x8000), UNPACKED_1x1( 0.0, 0.0, 0.0, -32768.0)},
+
+ /*
+ * Standard 32-bit integer formats
+ *
+ * NOTE: We can't accurately represent integers larger than +/-0x1000000
+ * with single precision floats, so that's as far as we test.
+ */
+
+ {PIPE_FORMAT_R32_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+
+ {PIPE_FORMAT_R32G32_UNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32_UNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0xffffffff, 0x00000000), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32_UNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0xffffffff), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32_UNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0xffffffff, 0xffffffff), UNPACKED_1x1(1.0, 1.0, 0.0, 1.0)},
+
+ {PIPE_FORMAT_R32G32B32_UNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32B32_UNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0xffffffff, 0x00000000, 0x00000000), UNPACKED_1x1(1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32B32_UNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0xffffffff, 0x00000000), UNPACKED_1x1(0.0, 1.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32B32_UNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0xffffffff), UNPACKED_1x1(0.0, 0.0, 1.0, 1.0)},
+ {PIPE_FORMAT_R32G32B32_UNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+ {PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(0.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0xffffffff, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(1.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0xffffffff, 0x00000000, 0x00000000), UNPACKED_1x1(0.0, 1.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0xffffffff, 0x00000000), UNPACKED_1x1(0.0, 0.0, 1.0, 0.0)},
+ {PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0xffffffff), UNPACKED_1x1(0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), UNPACKED_1x1(1.0, 1.0, 1.0, 1.0)},
+
+ {PIPE_FORMAT_R32_USCALED, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32_USCALED, PACKED_1x32(0xffffffff), PACKED_1x32(0x01000000), UNPACKED_1x1(16777216.0, 0.0, 0.0, 1.0)},
+
+ {PIPE_FORMAT_R32G32_USCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32_USCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x01000000, 0x00000000), UNPACKED_1x1(16777216.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32_USCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x01000000), UNPACKED_1x1( 0.0, 16777216.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32_USCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x01000000, 0x01000000), UNPACKED_1x1(16777216.0, 16777216.0, 0.0, 1.0)},
+
+ {PIPE_FORMAT_R32G32B32_USCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32B32_USCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x01000000, 0x00000000, 0x00000000), UNPACKED_1x1(16777216.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32B32_USCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x01000000, 0x00000000), UNPACKED_1x1( 0.0, 16777216.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32B32_USCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x01000000), UNPACKED_1x1( 0.0, 0.0, 16777216.0, 1.0)},
+ {PIPE_FORMAT_R32G32B32_USCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x01000000, 0x01000000, 0x01000000), UNPACKED_1x1(16777216.0, 16777216.0, 16777216.0, 1.0)},
+
+ {PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x01000000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(16777216.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x01000000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 16777216.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x01000000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 16777216.0, 0.0)},
+ {PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x01000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 16777216.0)},
+ {PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x01000000, 0x01000000, 0x01000000, 0x01000000), UNPACKED_1x1(16777216.0, 16777216.0, 16777216.0, 16777216.0)},
+
+ {PIPE_FORMAT_R32_SNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32_SNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x7fffffff), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32_SNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x80000001), UNPACKED_1x1( -1.0, 0.0, 0.0, 1.0)},
+
+ {PIPE_FORMAT_R32G32_SNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32_SNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x7fffffff, 0x00000000), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32_SNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x80000001, 0x00000000), UNPACKED_1x1( -1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32_SNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x7fffffff), UNPACKED_1x1( 0.0, 1.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32_SNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x80000001), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
+
+ {PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x7fffffff, 0x00000000, 0x00000000), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x80000001, 0x00000000, 0x00000000), UNPACKED_1x1( -1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x7fffffff, 0x00000000), UNPACKED_1x1( 0.0, 1.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x80000001, 0x00000000), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x7fffffff), UNPACKED_1x1( 0.0, 0.0, 1.0, 1.0)},
+ {PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x80000001), UNPACKED_1x1( 0.0, 0.0, -1.0, 1.0)},
+
+ {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x7fffffff, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 1.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x80000001, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( -1.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x7fffffff, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 1.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x80000001, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, -1.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x7fffffff, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 1.0, 0.0)},
+ {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x80000001, 0x00000000), UNPACKED_1x1( 0.0, 0.0, -1.0, 0.0)},
+ {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x7fffffff), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x80000001), UNPACKED_1x1( 0.0, 0.0, 0.0, -1.0)},
+
+ {PIPE_FORMAT_R32_SSCALED, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32_SSCALED, PACKED_1x32(0xffffffff), PACKED_1x32(0x01000000), UNPACKED_1x1( 16777216.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32_SSCALED, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), UNPACKED_1x1(-16777216.0, 0.0, 0.0, 1.0)},
+
+ {PIPE_FORMAT_R32G32_SSCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32_SSCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x01000000, 0x00000000), UNPACKED_1x1( 16777216.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32_SSCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0xff000000, 0x00000000), UNPACKED_1x1(-16777216.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32_SSCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x01000000), UNPACKED_1x1( 0.0, 16777216.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32_SSCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0xff000000), UNPACKED_1x1( 0.0, -16777216.0, 0.0, 1.0)},
+
+ {PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x01000000, 0x00000000, 0x00000000), UNPACKED_1x1( 16777216.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0xff000000, 0x00000000, 0x00000000), UNPACKED_1x1(-16777216.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x01000000, 0x00000000), UNPACKED_1x1( 0.0, 16777216.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0xff000000, 0x00000000), UNPACKED_1x1( 0.0, -16777216.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x01000000), UNPACKED_1x1( 0.0, 0.0, 16777216.0, 1.0)},
+ {PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0xff000000), UNPACKED_1x1( 0.0, 0.0, -16777216.0, 1.0)},
+
+ {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x01000000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 16777216.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0xff000000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(-16777216.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x01000000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 16777216.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0xff000000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, -16777216.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x01000000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 16777216.0, 0.0)},
+ {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0xff000000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, -16777216.0, 0.0)},
+ {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x01000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 16777216.0)},
+ {PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0xff000000), UNPACKED_1x1( 0.0, 0.0, 0.0, -16777216.0)},
+
+ /*
+ * Standard 32-bit float formats
+ */
+
+ {PIPE_FORMAT_R32_FLOAT, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32_FLOAT, PACKED_1x32(0xffffffff), PACKED_1x32(0x3f800000), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32_FLOAT, PACKED_1x32(0xffffffff), PACKED_1x32(0xbf800000), UNPACKED_1x1( -1.0, 0.0, 0.0, 1.0)},
+
+ {PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x3f800000, 0x00000000), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0xbf800000, 0x00000000), UNPACKED_1x1(-1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x3f800000), UNPACKED_1x1( 0.0, 1.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0xbf800000), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x3f800000, 0x3f800000), UNPACKED_1x1( 1.0, 1.0, 0.0, 1.0)},
+
+ {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x3f800000, 0x00000000, 0x00000000), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0xbf800000, 0x00000000, 0x00000000), UNPACKED_1x1(-1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x3f800000, 0x00000000), UNPACKED_1x1( 0.0, 1.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0xbf800000, 0x00000000), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x3f800000), UNPACKED_1x1( 0.0, 0.0, 1.0, 1.0)},
+ {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0xbf800000), UNPACKED_1x1( 0.0, 0.0, -1.0, 1.0)},
+ {PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x3f800000, 0x3f800000, 0x3f800000), UNPACKED_1x1( 1.0, 1.0, 1.0, 1.0)},
+
+ {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x3f800000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1( 1.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0xbf800000, 0x00000000, 0x00000000, 0x00000000), UNPACKED_1x1(-1.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x3f800000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, 1.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0xbf800000, 0x00000000, 0x00000000), UNPACKED_1x1( 0.0, -1.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x3f800000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, 1.0, 0.0)},
+ {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0xbf800000, 0x00000000), UNPACKED_1x1( 0.0, 0.0, -1.0, 0.0)},
+ {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x3f800000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0xbf800000), UNPACKED_1x1( 0.0, 0.0, 0.0, -1.0)},
+ {PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000), UNPACKED_1x1( 1.0, 1.0, 1.0, 1.0)},
+
+ /*
+ * Half float formats
+ */
+
+ {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x0000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x3c00), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0xbc00), UNPACKED_1x1( -1.0, 0.0, 0.0, 1.0)},
+
+ {PIPE_FORMAT_R16G16_FLOAT, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x0000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16_FLOAT, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x3c00, 0x0000), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16_FLOAT, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0xbc00, 0x0000), UNPACKED_1x1(-1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16_FLOAT, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x3c00), UNPACKED_1x1( 0.0, 1.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16_FLOAT, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0xbc00), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16_FLOAT, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x3c00, 0x3c00), UNPACKED_1x1( 1.0, 1.0, 0.0, 1.0)},
+
+ {PIPE_FORMAT_R16G16B16_FLOAT, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x0000), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16B16_FLOAT, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x3c00, 0x0000, 0x0000), UNPACKED_1x1( 1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16B16_FLOAT, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0xbc00, 0x0000, 0x0000), UNPACKED_1x1(-1.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16B16_FLOAT, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x3c00, 0x0000), UNPACKED_1x1( 0.0, 1.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16B16_FLOAT, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0xbc00, 0x0000), UNPACKED_1x1( 0.0, -1.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16B16_FLOAT, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x3c00), UNPACKED_1x1( 0.0, 0.0, 1.0, 1.0)},
+ {PIPE_FORMAT_R16G16B16_FLOAT, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0xbc00), UNPACKED_1x1( 0.0, 0.0, -1.0, 1.0)},
+ {PIPE_FORMAT_R16G16B16_FLOAT, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x3c00, 0x3c00, 0x3c00), UNPACKED_1x1( 1.0, 1.0, 1.0, 1.0)},
+
+ {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x0000), UNPACKED_1x1( 0.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x3c00, 0x0000, 0x0000, 0x0000), UNPACKED_1x1( 1.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0xbc00, 0x0000, 0x0000, 0x0000), UNPACKED_1x1(-1.0, 0.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x3c00, 0x0000, 0x0000), UNPACKED_1x1( 0.0, 1.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0xbc00, 0x0000, 0x0000), UNPACKED_1x1( 0.0, -1.0, 0.0, 0.0)},
+ {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x3c00, 0x0000), UNPACKED_1x1( 0.0, 0.0, 1.0, 0.0)},
+ {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0xbc00, 0x0000), UNPACKED_1x1( 0.0, 0.0, -1.0, 0.0)},
+ {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x3c00), UNPACKED_1x1( 0.0, 0.0, 0.0, 1.0)},
+ {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0xbc00), UNPACKED_1x1( 0.0, 0.0, 0.0, -1.0)},
+ {PIPE_FORMAT_R16G16B16A16_FLOAT, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x3c00, 0x3c00, 0x3c00, 0x3c00), UNPACKED_1x1( 1.0, 1.0, 1.0, 1.0)},
+};
+
+
+const unsigned util_format_nr_test_cases = Elements(util_format_test_cases);
diff --git a/src/gallium/auxiliary/util/u_format_tests.h b/src/gallium/auxiliary/util/u_format_tests.h
new file mode 100644
index 0000000000..f59563f4f4
--- /dev/null
+++ b/src/gallium/auxiliary/util/u_format_tests.h
@@ -0,0 +1,71 @@
+/**************************************************************************
+ *
+ * Copyright 2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ **************************************************************************/
+
+
+#ifndef U_FORMAT_TESTS_H_
+#define U_FORMAT_TESTS_H_
+
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_format.h"
+
+
+#define UTIL_FORMAT_MAX_PACKED_BYTES 16
+#define UTIL_FORMAT_MAX_UNPACKED_WIDTH 4
+#define UTIL_FORMAT_MAX_UNPACKED_HEIGHT 4
+
+
+/**
+ * A (packed, unpacked) color pair.
+ */
+struct util_format_test_case
+{
+ enum pipe_format format;
+
+ /**
+ * Mask of the bits that actually meaningful data. Used to mask out the
+ * "X" channels.
+ */
+ uint8_t mask[UTIL_FORMAT_MAX_PACKED_BYTES];
+
+ uint8_t packed[UTIL_FORMAT_MAX_PACKED_BYTES];
+
+ /**
+ * RGBA.
+ */
+ double unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4];
+};
+
+
+extern const struct util_format_test_case
+util_format_test_cases[];
+
+
+extern const unsigned util_format_nr_test_cases;
+
+
+#endif /* U_FORMAT_TESTS_H_ */
diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c
index fc027e48e4..509d38754f 100644
--- a/src/gallium/auxiliary/util/u_gen_mipmap.c
+++ b/src/gallium/auxiliary/util/u_gen_mipmap.c
@@ -62,6 +62,7 @@ struct gen_mipmap_state
struct pipe_rasterizer_state rasterizer;
struct pipe_sampler_state sampler;
struct pipe_clip_state clip;
+ struct pipe_vertex_element velem[2];
void *vs;
void *fs2d, *fsCube;
@@ -937,6 +938,7 @@ format_to_type_comps(enum pipe_format pformat,
*datatype = DTYPE_UBYTE;
*comps = 4;
return;
+ case PIPE_FORMAT_B5G5R5X1_UNORM:
case PIPE_FORMAT_B5G5R5A1_UNORM:
*datatype = DTYPE_USHORT_1_5_5_5_REV;
*comps = 4;
@@ -1118,7 +1120,6 @@ make_1d_mipmap(struct gen_mipmap_state *ctx,
uint face, uint baseLevel, uint lastLevel)
{
struct pipe_context *pipe = ctx->pipe;
- struct pipe_screen *screen = pipe->screen;
const uint zslice = 0;
uint dstLevel;
@@ -1127,27 +1128,27 @@ make_1d_mipmap(struct gen_mipmap_state *ctx,
struct pipe_transfer *srcTrans, *dstTrans;
void *srcMap, *dstMap;
- srcTrans = screen->get_tex_transfer(screen, pt, face, srcLevel, zslice,
+ srcTrans = pipe->get_tex_transfer(pipe, pt, face, srcLevel, zslice,
PIPE_TRANSFER_READ, 0, 0,
u_minify(pt->width0, srcLevel),
u_minify(pt->height0, srcLevel));
- dstTrans = screen->get_tex_transfer(screen, pt, face, dstLevel, zslice,
+ dstTrans = pipe->get_tex_transfer(pipe, pt, face, dstLevel, zslice,
PIPE_TRANSFER_WRITE, 0, 0,
u_minify(pt->width0, dstLevel),
u_minify(pt->height0, dstLevel));
- srcMap = (ubyte *) screen->transfer_map(screen, srcTrans);
- dstMap = (ubyte *) screen->transfer_map(screen, dstTrans);
+ srcMap = (ubyte *) pipe->transfer_map(pipe, srcTrans);
+ dstMap = (ubyte *) pipe->transfer_map(pipe, dstTrans);
reduce_1d(pt->format,
srcTrans->width, srcMap,
dstTrans->width, dstMap);
- screen->transfer_unmap(screen, srcTrans);
- screen->transfer_unmap(screen, dstTrans);
+ pipe->transfer_unmap(pipe, srcTrans);
+ pipe->transfer_unmap(pipe, dstTrans);
- screen->tex_transfer_destroy(srcTrans);
- screen->tex_transfer_destroy(dstTrans);
+ pipe->tex_transfer_destroy(pipe, srcTrans);
+ pipe->tex_transfer_destroy(pipe, dstTrans);
}
}
@@ -1158,7 +1159,6 @@ make_2d_mipmap(struct gen_mipmap_state *ctx,
uint face, uint baseLevel, uint lastLevel)
{
struct pipe_context *pipe = ctx->pipe;
- struct pipe_screen *screen = pipe->screen;
const uint zslice = 0;
uint dstLevel;
@@ -1170,17 +1170,17 @@ make_2d_mipmap(struct gen_mipmap_state *ctx,
struct pipe_transfer *srcTrans, *dstTrans;
ubyte *srcMap, *dstMap;
- srcTrans = screen->get_tex_transfer(screen, pt, face, srcLevel, zslice,
+ srcTrans = pipe->get_tex_transfer(pipe, pt, face, srcLevel, zslice,
PIPE_TRANSFER_READ, 0, 0,
u_minify(pt->width0, srcLevel),
u_minify(pt->height0, srcLevel));
- dstTrans = screen->get_tex_transfer(screen, pt, face, dstLevel, zslice,
+ dstTrans = pipe->get_tex_transfer(pipe, pt, face, dstLevel, zslice,
PIPE_TRANSFER_WRITE, 0, 0,
u_minify(pt->width0, dstLevel),
u_minify(pt->height0, dstLevel));
- srcMap = (ubyte *) screen->transfer_map(screen, srcTrans);
- dstMap = (ubyte *) screen->transfer_map(screen, dstTrans);
+ srcMap = (ubyte *) pipe->transfer_map(pipe, srcTrans);
+ dstMap = (ubyte *) pipe->transfer_map(pipe, dstTrans);
reduce_2d(pt->format,
srcTrans->width, srcTrans->height,
@@ -1188,11 +1188,11 @@ make_2d_mipmap(struct gen_mipmap_state *ctx,
dstTrans->width, dstTrans->height,
dstTrans->stride, dstMap);
- screen->transfer_unmap(screen, srcTrans);
- screen->transfer_unmap(screen, dstTrans);
+ pipe->transfer_unmap(pipe, srcTrans);
+ pipe->transfer_unmap(pipe, dstTrans);
- screen->tex_transfer_destroy(srcTrans);
- screen->tex_transfer_destroy(dstTrans);
+ pipe->tex_transfer_destroy(pipe, srcTrans);
+ pipe->tex_transfer_destroy(pipe, dstTrans);
}
}
@@ -1215,17 +1215,17 @@ make_3d_mipmap(struct gen_mipmap_state *ctx,
struct pipe_transfer *srcTrans, *dstTrans;
ubyte *srcMap, *dstMap;
- srcTrans = screen->get_tex_transfer(screen, pt, face, srcLevel, zslice,
+ srcTrans = pipe->get_tex_transfer(pipe, pt, face, srcLevel, zslice,
PIPE_TRANSFER_READ, 0, 0,
u_minify(pt->width0, srcLevel),
u_minify(pt->height0, srcLevel));
- dstTrans = screen->get_tex_transfer(screen, pt, face, dstLevel, zslice,
+ dstTrans = pipe->get_tex_transfer(pipe, pt, face, dstLevel, zslice,
PIPE_TRANSFER_WRITE, 0, 0,
u_minify(pt->width0, dstLevel),
u_minify(pt->height0, dstLevel));
- srcMap = (ubyte *) screen->transfer_map(screen, srcTrans);
- dstMap = (ubyte *) screen->transfer_map(screen, dstTrans);
+ srcMap = (ubyte *) pipe->transfer_map(pipe, srcTrans);
+ dstMap = (ubyte *) pipe->transfer_map(pipe, dstTrans);
reduce_3d(pt->format,
srcTrans->width, srcTrans->height,
@@ -1233,11 +1233,11 @@ make_3d_mipmap(struct gen_mipmap_state *ctx,
dstTrans->width, dstTrans->height,
dstTrans->stride, dstMap);
- screen->transfer_unmap(screen, srcTrans);
- screen->transfer_unmap(screen, dstTrans);
+ pipe->transfer_unmap(pipe, srcTrans);
+ pipe->transfer_unmap(pipe, dstTrans);
- screen->tex_transfer_destroy(srcTrans);
- screen->tex_transfer_destroy(dstTrans);
+ pipe->tex_transfer_destroy(pipe, srcTrans);
+ pipe->tex_transfer_destroy(pipe, dstTrans);
}
#else
(void) reduce_3d;
@@ -1307,6 +1307,15 @@ util_create_gen_mipmap(struct pipe_context *pipe,
ctx->sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST;
ctx->sampler.normalized_coords = 1;
+ /* vertex elements state */
+ memset(&ctx->velem[0], 0, sizeof(ctx->velem[0]) * 2);
+ for (i = 0; i < 2; i++) {
+ ctx->velem[i].src_offset = i * 4 * sizeof(float);
+ ctx->velem[i].instance_divisor = 0;
+ ctx->velem[i].vertex_buffer_index = 0;
+ ctx->velem[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+ }
+
/* vertex shader - still needed to specify mapping from fragment
* shader input semantics to vertex elements
*/
@@ -1452,7 +1461,7 @@ void util_gen_mipmap_flush( struct gen_mipmap_state *ctx )
* Generate mipmap images. It's assumed all needed texture memory is
* already allocated.
*
- * \param pt the texture to generate mipmap levels for
+ * \param psv the sampler view to the texture to generate mipmap levels for
* \param face which cube face to generate mipmaps for (0 for non-cube maps)
* \param baseLevel the first mipmap level to use as a src
* \param lastLevel the last mipmap level to generate
@@ -1461,12 +1470,13 @@ void util_gen_mipmap_flush( struct gen_mipmap_state *ctx )
*/
void
util_gen_mipmap(struct gen_mipmap_state *ctx,
- struct pipe_texture *pt,
+ struct pipe_sampler_view *psv,
uint face, uint baseLevel, uint lastLevel, uint filter)
{
struct pipe_context *pipe = ctx->pipe;
struct pipe_screen *screen = pipe->screen;
struct pipe_framebuffer_state fb;
+ struct pipe_texture *pt = psv->texture;
void *fs = (pt->target == PIPE_TEXTURE_CUBE) ? ctx->fsCube : ctx->fs2d;
uint dstLevel;
uint zslice = 0;
@@ -1484,7 +1494,7 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
filter == PIPE_TEX_FILTER_NEAREST);
/* check if we can render in the texture's format */
- if (!screen->is_format_supported(screen, pt->format, PIPE_TEXTURE_2D,
+ if (!screen->is_format_supported(screen, psv->format, PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) {
fallback_gen_mipmap(ctx, pt, face, baseLevel, lastLevel);
return;
@@ -1495,18 +1505,20 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
cso_save_depth_stencil_alpha(ctx->cso);
cso_save_rasterizer(ctx->cso);
cso_save_samplers(ctx->cso);
- cso_save_sampler_textures(ctx->cso);
+ cso_save_fragment_sampler_views(ctx->cso);
cso_save_framebuffer(ctx->cso);
cso_save_fragment_shader(ctx->cso);
cso_save_vertex_shader(ctx->cso);
cso_save_viewport(ctx->cso);
cso_save_clip(ctx->cso);
+ cso_save_vertex_elements(ctx->cso);
/* bind our state */
cso_set_blend(ctx->cso, &ctx->blend);
cso_set_depth_stencil_alpha(ctx->cso, &ctx->depthstencil);
cso_set_rasterizer(ctx->cso, &ctx->rasterizer);
cso_set_clip(ctx->cso, &ctx->clip);
+ cso_set_vertex_elements(ctx->cso, 2, ctx->velem);
cso_set_fragment_shader_handle(ctx->cso, fs);
cso_set_vertex_shader_handle(ctx->cso, ctx->vs);
@@ -1562,7 +1574,7 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
cso_single_sampler(ctx->cso, 0, &ctx->sampler);
cso_single_sampler_done(ctx->cso);
- cso_set_sampler_textures(ctx->cso, 1, &pt);
+ cso_set_fragment_sampler_views(ctx->cso, 1, &psv);
/* quad coords in clip coords */
offset = set_vertex_data(ctx,
@@ -1587,10 +1599,11 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
cso_restore_depth_stencil_alpha(ctx->cso);
cso_restore_rasterizer(ctx->cso);
cso_restore_samplers(ctx->cso);
- cso_restore_sampler_textures(ctx->cso);
+ cso_restore_fragment_sampler_views(ctx->cso);
cso_restore_framebuffer(ctx->cso);
cso_restore_fragment_shader(ctx->cso);
cso_restore_vertex_shader(ctx->cso);
cso_restore_viewport(ctx->cso);
cso_restore_clip(ctx->cso);
+ cso_restore_vertex_elements(ctx->cso);
}
diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.h b/src/gallium/auxiliary/util/u_gen_mipmap.h
index 54608f9466..35ac9daeaa 100644
--- a/src/gallium/auxiliary/util/u_gen_mipmap.h
+++ b/src/gallium/auxiliary/util/u_gen_mipmap.h
@@ -59,7 +59,7 @@ util_gen_mipmap_flush( struct gen_mipmap_state *ctx );
extern void
util_gen_mipmap(struct gen_mipmap_state *ctx,
- struct pipe_texture *pt,
+ struct pipe_sampler_view *psv,
uint face, uint baseLevel, uint lastLevel, uint filter);
diff --git a/src/gallium/auxiliary/util/u_half.h b/src/gallium/auxiliary/util/u_half.h
new file mode 100644
index 0000000000..a28b1fd1d9
--- /dev/null
+++ b/src/gallium/auxiliary/util/u_half.h
@@ -0,0 +1,63 @@
+#ifndef U_HALF_H
+#define U_HALF_H
+
+#include "pipe/p_compiler.h"
+#include "util/u_math.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern uint32_t util_half_to_float_mantissa_table[2048];
+extern uint32_t util_half_to_float_exponent_table[64];
+extern uint32_t util_half_to_float_offset_table[64];
+extern uint16_t util_float_to_half_base_table[512];
+extern uint8_t util_float_to_half_shift_table[512];
+
+/*
+ * Note that if the half float is a signaling NaN, the x87 FPU will turn
+ * it into a quiet NaN immediately upon loading into a float.
+ *
+ * Additionally, denormals may be flushed to zero.
+ *
+ * To avoid this, use the floatui functions instead of the float ones
+ * when just doing conversion rather than computation on the resulting
+ * floats.
+ */
+
+static INLINE uint32_t
+util_half_to_floatui(half h)
+{
+ unsigned exp = h >> 10;
+ return util_half_to_float_mantissa_table[util_half_to_float_offset_table[exp] + (h & 0x3ff)] + util_half_to_float_exponent_table[exp];
+}
+
+static INLINE float
+util_half_to_float(half h)
+{
+ union fi r;
+ r.ui = util_half_to_floatui(h);
+ return r.f;
+}
+
+static INLINE half
+util_floatui_to_half(uint32_t v)
+{
+ unsigned signexp = v >> 23;
+ return util_float_to_half_base_table[signexp] + ((v & 0x007fffff) >> util_float_to_half_shift_table[signexp]);
+}
+
+static INLINE half
+util_float_to_half(float f)
+{
+ union fi i;
+ i.f = f;
+ return util_floatui_to_half(i.ui);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* U_HALF_H */
+
diff --git a/src/gallium/auxiliary/util/u_half.py b/src/gallium/auxiliary/util/u_half.py
new file mode 100644
index 0000000000..a92f758750
--- /dev/null
+++ b/src/gallium/auxiliary/util/u_half.py
@@ -0,0 +1,179 @@
+# Copyright 2010 Luca Barbieri
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice (including the
+# next paragraph) shall be included in all copies or substantial
+# portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# *************************************************************************
+
+# The code is a reimplementation of the algorithm in
+# www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf
+# "Fast Half Float Conversions" by Jeroen van der Zijp, Nov 2008
+#
+# The table contents have been slightly changed so that the exponent
+# bias is now in the exponent table instead of the mantissa table (mostly
+# for cosmetic reasons, and because it theoretically allows a variant
+# that flushes denormal to zero but uses a mantissa table with 24-bit
+# entries).
+#
+# The tables are also constructed slightly differently.
+#
+
+# Note that using a 64K * 4 table is a terrible idea since it will not fit
+# in the L1 cache and will massively pollute the L2 cache as well
+#
+# These should instead fit in the L1 cache.
+#
+# TODO: we could use a denormal bias table instead of the mantissa/offset
+# tables: this would reduce the L1 cache usage from 8704 to 2304 bytes
+# but would involve more computation
+#
+# Note however that if denormals are never encountered, the L1 cache usage
+# is only about 4608 bytes anyway.
+
+table_index = None
+table_length = None
+
+def begin(t, n, l):
+ global table_length
+ global table_index
+ table_index = 0
+ table_length = l
+ print
+ print t + " " + n + "[" + str(l) + "] = {"
+
+def value(v):
+ global table_index
+ table_index += 1
+ print "\t" + hex(v) + ","
+
+def end():
+ global table_length
+ global table_index
+ print "};"
+ assert table_index == table_length
+
+print "/* This file is autogenerated by u_half.py. Do not edit directly. */"
+print "#include \"util/u_half.h\""
+
+begin("uint32_t", "util_half_to_float_mantissa_table", 2048)
+# zero
+value(0)
+
+# denormals
+for i in xrange(1, 1024):
+ m = i << 13
+ e = 0
+
+ # normalize number
+ while (m & 0x00800000) == 0:
+ e -= 0x00800000;
+ m <<= 1;
+
+ m &= ~0x00800000;
+ e += 0x38800000;
+ value(m | e)
+
+# normals
+for i in xrange(1024, 2048):
+ value((i - 1024) << 13)
+end()
+
+begin("uint32_t", "util_half_to_float_exponent_table", 64)
+# positive zero or denormals
+value(0)
+
+# positive numbers
+for i in xrange(1, 31):
+ value(0x38000000 + (i << 23))
+
+# positive infinity/NaN
+value(0x7f800000)
+
+# negative zero or denormals
+value(0x80000000)
+
+# negative numbers
+for i in range(33, 63):
+ value(0xb8000000 + ((i - 32) << 23))
+
+# negative infinity/NaN
+value(0xff800000)
+end()
+
+begin("uint32_t", "util_half_to_float_offset_table", 64)
+# positive zero or denormals
+value(0)
+
+# positive normals
+for i in range(1, 32):
+ value(1024)
+
+# negative zero or denormals
+value(0)
+
+# negative normals
+for i in xrange(33, 64):
+ value(1024)
+end()
+
+begin("uint16_t", "util_float_to_half_base_table", 512)
+for sign in (0, 0x8000):
+ # very small numbers mapping to zero
+ for i in xrange(-127, -24):
+ value(sign | 0)
+
+ # small numbers mapping to denormals
+ for i in xrange(-24, -14):
+ value(sign | (0x400 >> (-14 -i)))
+
+ # normal numbers
+ for i in xrange(-14, 16):
+ value(sign | ((i + 15) << 10))
+
+ # large numbers mapping to infinity
+ for i in xrange(16, 128):
+ value(sign | 0x7c00)
+
+ # infinity and NaNs
+ value(sign | 0x7c00)
+end()
+
+begin("uint8_t", "util_float_to_half_shift_table", 512)
+for sign in (0, 0x8000):
+ # very small numbers mapping to zero
+ for i in xrange(-127, -24):
+ value(24)
+
+ # small numbers mapping to denormals
+ for i in xrange(-24, -14):
+ value(-1 - i)
+
+ # normal numbers
+ for i in xrange(-14, 16):
+ value(13)
+
+ # large numbers mapping to infinity
+ for i in xrange(16, 128):
+ value(24)
+
+ # infinity and NaNs
+ value(13)
+end()
+
diff --git a/src/gallium/auxiliary/util/u_init.h b/src/gallium/auxiliary/util/u_init.h
new file mode 100644
index 0000000000..7bc356a791
--- /dev/null
+++ b/src/gallium/auxiliary/util/u_init.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2010 Luca Barbieri
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef U_INIT_H
+#define U_INIT_H
+
+/* Use UTIL_INIT(f) to have f called at program initialization.
+ Note that it is only guaranteed to be called if any symbol in the
+ .c file it is in sis referenced by the program.
+
+ UTIL_INIT functions are called in arbitrary order.
+*/
+
+#ifdef __cplusplus
+/* use a C++ global constructor */
+#define UTIL_INIT(f) struct f##__gctor_t {f##__gctor_t() {x();}} f##__gctor;
+#elif defined(_MSC_VER)
+/* add a pointer to the section where MSVC stores global constructor pointers */
+/* see http://blogs.msdn.com/vcblog/archive/2006/10/20/crt-initialization.aspx and
+ http://stackoverflow.com/questions/1113409/attribute-constructor-equivalent-in-vc */
+#pragma section(".CRT$XCU",read)
+#define UTIL_INIT(f) static void __cdecl f##__init(void) {f();}; __declspec(allocate(".CRT$XCU")) void (__cdecl* f##__xcu)(void) = f##__init;
+#elif defined(__GNUC__)
+#define UTIL_INIT(f) static void f##__init(void) __attribute__((constructor)); static void f##__init(void) {f();}
+#else
+#error Unsupported compiler: please find out how to implement global initializers in C on it
+#endif
+
+#endif
+
diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h
index 0cb3432c6e..e22ab188e1 100644
--- a/src/gallium/auxiliary/util/u_inlines.h
+++ b/src/gallium/auxiliary/util/u_inlines.h
@@ -120,6 +120,16 @@ pipe_texture_reference(struct pipe_texture **ptr, struct pipe_texture *tex)
*ptr = tex;
}
+static INLINE void
+pipe_sampler_view_reference(struct pipe_sampler_view **ptr, struct pipe_sampler_view *view)
+{
+ struct pipe_sampler_view *old_view = *ptr;
+
+ if (pipe_reference(&(*ptr)->reference, &view->reference))
+ old_view->context->sampler_view_destroy(old_view->context, old_view);
+ *ptr = view;
+}
+
/*
* Convenience wrappers for screen buffer functions.
@@ -264,24 +274,24 @@ pipe_buffer_read(struct pipe_screen *screen,
}
static INLINE void *
-pipe_transfer_map( struct pipe_transfer *transf )
+pipe_transfer_map( struct pipe_context *context,
+ struct pipe_transfer *transf )
{
- struct pipe_screen *screen = transf->texture->screen;
- return screen->transfer_map(screen, transf);
+ return context->transfer_map(context, transf);
}
static INLINE void
-pipe_transfer_unmap( struct pipe_transfer *transf )
+pipe_transfer_unmap( struct pipe_context *context,
+ struct pipe_transfer *transf )
{
- struct pipe_screen *screen = transf->texture->screen;
- screen->transfer_unmap(screen, transf);
+ context->transfer_unmap(context, transf);
}
static INLINE void
-pipe_transfer_destroy( struct pipe_transfer *transf )
+pipe_transfer_destroy( struct pipe_context *context,
+ struct pipe_transfer *transfer )
{
- struct pipe_screen *screen = transf->texture->screen;
- screen->tex_transfer_destroy(transf);
+ context->tex_transfer_destroy(context, transfer);
}
static INLINE unsigned
diff --git a/src/gallium/auxiliary/util/u_memory.h b/src/gallium/auxiliary/util/u_memory.h
index a2fc597356..53d56599fe 100644
--- a/src/gallium/auxiliary/util/u_memory.h
+++ b/src/gallium/auxiliary/util/u_memory.h
@@ -88,7 +88,7 @@ mem_dup(const void *src, uint size)
/**
* Offset of a field in a struct, in bytes.
*/
-#define Offset(TYPE, MEMBER) ((unsigned)&(((TYPE *)NULL)->MEMBER))
+#define Offset(TYPE, MEMBER) ((uintptr_t)&(((TYPE *)NULL)->MEMBER))
diff --git a/src/gallium/auxiliary/util/u_pack_color.h b/src/gallium/auxiliary/util/u_pack_color.h
index 50f1b1670b..ad4a06dc77 100644
--- a/src/gallium/auxiliary/util/u_pack_color.h
+++ b/src/gallium/auxiliary/util/u_pack_color.h
@@ -92,6 +92,11 @@ util_pack_color_ub(ubyte r, ubyte g, ubyte b, ubyte a,
uc->us = ((r & 0xf8) << 8) | ((g & 0xfc) << 3) | (b >> 3);
}
return;
+ case PIPE_FORMAT_B5G5R5X1_UNORM:
+ {
+ uc->us = ((0x80) << 8) | ((r & 0xf8) << 7) | ((g & 0xf8) << 2) | (b >> 3);
+ }
+ return;
case PIPE_FORMAT_B5G5R5A1_UNORM:
{
uc->us = ((a & 0x80) << 8) | ((r & 0xf8) << 7) | ((g & 0xf8) << 2) | (b >> 3);
@@ -216,6 +221,15 @@ util_unpack_color_ub(enum pipe_format format, union util_color *uc,
*a = (ubyte) 0xff;
}
return;
+ case PIPE_FORMAT_B5G5R5X1_UNORM:
+ {
+ ushort p = uc->us;
+ *r = (ubyte) (((p >> 7) & 0xf8) | ((p >> 12) & 0x7));
+ *g = (ubyte) (((p >> 2) & 0xf8) | ((p >> 7) & 0x7));
+ *b = (ubyte) (((p << 3) & 0xf8) | ((p >> 2) & 0x7));
+ *a = (ubyte) 0xff;
+ }
+ return;
case PIPE_FORMAT_B5G5R5A1_UNORM:
{
ushort p = uc->us;
@@ -361,6 +375,11 @@ util_pack_color(const float rgba[4], enum pipe_format format, union util_color *
uc->us = ((r & 0xf8) << 8) | ((g & 0xfc) << 3) | (b >> 3);
}
return;
+ case PIPE_FORMAT_B5G5R5X1_UNORM:
+ {
+ uc->us = ((0x80) << 8) | ((r & 0xf8) << 7) | ((g & 0xf8) << 2) | (b >> 3);
+ }
+ return;
case PIPE_FORMAT_B5G5R5A1_UNORM:
{
uc->us = ((a & 0x80) << 8) | ((r & 0xf8) << 7) | ((g & 0xf8) << 2) | (b >> 3);
@@ -427,17 +446,17 @@ util_pack_z(enum pipe_format format, double z)
return (uint) (z * 0xffffffff);
case PIPE_FORMAT_Z32_FLOAT:
return (uint)z;
- case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
case PIPE_FORMAT_Z24X8_UNORM:
if (z == 1.0)
return 0xffffff;
return (uint) (z * 0xffffff);
- case PIPE_FORMAT_S8Z24_UNORM:
+ case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
case PIPE_FORMAT_X8Z24_UNORM:
if (z == 1.0)
return 0xffffff00;
return ((uint) (z * 0xffffff)) << 8;
- case PIPE_FORMAT_S8_UNORM:
+ case PIPE_FORMAT_S8_USCALED:
/* this case can get it via util_pack_z_stencil() */
return 0;
default:
@@ -458,13 +477,13 @@ util_pack_z_stencil(enum pipe_format format, double z, uint s)
unsigned packed = util_pack_z(format, z);
switch (format) {
- case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
packed |= s << 24;
break;
- case PIPE_FORMAT_S8Z24_UNORM:
+ case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
packed |= s;
break;
- case PIPE_FORMAT_S8_UNORM:
+ case PIPE_FORMAT_S8_USCALED:
packed |= s;
break;
default:
diff --git a/src/gallium/auxiliary/util/u_rect.c b/src/gallium/auxiliary/util/u_rect.c
index 8479161c74..e73797f1b7 100644
--- a/src/gallium/auxiliary/util/u_rect.c
+++ b/src/gallium/auxiliary/util/u_rect.c
@@ -169,7 +169,6 @@ util_surface_copy(struct pipe_context *pipe,
unsigned src_x, unsigned src_y,
unsigned w, unsigned h)
{
- struct pipe_screen *screen = pipe->screen;
struct pipe_transfer *src_trans, *dst_trans;
void *dst_map;
const void *src_map;
@@ -182,7 +181,7 @@ util_surface_copy(struct pipe_context *pipe,
src_format = src->texture->format;
dst_format = dst->texture->format;
- src_trans = screen->get_tex_transfer(screen,
+ src_trans = pipe->get_tex_transfer(pipe,
src->texture,
src->face,
src->level,
@@ -190,7 +189,7 @@ util_surface_copy(struct pipe_context *pipe,
PIPE_TRANSFER_READ,
src_x, src_y, w, h);
- dst_trans = screen->get_tex_transfer(screen,
+ dst_trans = pipe->get_tex_transfer(pipe,
dst->texture,
dst->face,
dst->level,
@@ -202,8 +201,8 @@ util_surface_copy(struct pipe_context *pipe,
assert(util_format_get_blockwidth(dst_format) == util_format_get_blockwidth(src_format));
assert(util_format_get_blockheight(dst_format) == util_format_get_blockheight(src_format));
- src_map = pipe->screen->transfer_map(screen, src_trans);
- dst_map = pipe->screen->transfer_map(screen, dst_trans);
+ src_map = pipe->transfer_map(pipe, src_trans);
+ dst_map = pipe->transfer_map(pipe, dst_trans);
assert(src_map);
assert(dst_map);
@@ -221,11 +220,11 @@ util_surface_copy(struct pipe_context *pipe,
do_flip ? h - 1 : 0);
}
- pipe->screen->transfer_unmap(pipe->screen, src_trans);
- pipe->screen->transfer_unmap(pipe->screen, dst_trans);
+ pipe->transfer_unmap(pipe, src_trans);
+ pipe->transfer_unmap(pipe, dst_trans);
- screen->tex_transfer_destroy(src_trans);
- screen->tex_transfer_destroy(dst_trans);
+ pipe->tex_transfer_destroy(pipe, src_trans);
+ pipe->tex_transfer_destroy(pipe, dst_trans);
}
@@ -243,14 +242,13 @@ util_surface_fill(struct pipe_context *pipe,
unsigned dstx, unsigned dsty,
unsigned width, unsigned height, unsigned value)
{
- struct pipe_screen *screen = pipe->screen;
struct pipe_transfer *dst_trans;
void *dst_map;
assert(dst->texture);
if (!dst->texture)
return;
- dst_trans = screen->get_tex_transfer(screen,
+ dst_trans = pipe->get_tex_transfer(pipe,
dst->texture,
dst->face,
dst->level,
@@ -258,7 +256,7 @@ util_surface_fill(struct pipe_context *pipe,
PIPE_TRANSFER_WRITE,
dstx, dsty, width, height);
- dst_map = pipe->screen->transfer_map(screen, dst_trans);
+ dst_map = pipe->transfer_map(pipe, dst_trans);
assert(dst_map);
@@ -302,6 +300,6 @@ util_surface_fill(struct pipe_context *pipe,
}
}
- pipe->screen->transfer_unmap(pipe->screen, dst_trans);
- screen->tex_transfer_destroy(dst_trans);
+ pipe->transfer_unmap(pipe, dst_trans);
+ pipe->tex_transfer_destroy(pipe, dst_trans);
}
diff --git a/src/gallium/auxiliary/util/u_sampler.c b/src/gallium/auxiliary/util/u_sampler.c
new file mode 100644
index 0000000000..4d8f861ce4
--- /dev/null
+++ b/src/gallium/auxiliary/util/u_sampler.c
@@ -0,0 +1,100 @@
+/**************************************************************************
+ *
+ * Copyright 2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+
+#include "u_format.h"
+#include "u_sampler.h"
+
+
+static void
+default_template(struct pipe_sampler_view *view,
+ const struct pipe_texture *texture,
+ enum pipe_format format,
+ unsigned expand_green_blue)
+{
+ /* XXX: Check if format is compatible with texture->format.
+ */
+
+ view->format = format;
+ view->first_level = 0;
+ view->last_level = texture->last_level;
+ view->swizzle_r = PIPE_SWIZZLE_RED;
+ view->swizzle_g = PIPE_SWIZZLE_GREEN;
+ view->swizzle_b = PIPE_SWIZZLE_BLUE;
+ view->swizzle_a = PIPE_SWIZZLE_ALPHA;
+
+ /* Override default green and blue component expansion to the requested
+ * one.
+ *
+ * Gallium expands nonexistent components to (0,0,0,1), DX9 expands
+ * to (1,1,1,1). Since alpha is always expanded to 1, and red is
+ * always present, we only really care about green and blue
+ * components.
+ *
+ * To make it look less hackish, one would have to add
+ * UTIL_FORMAT_SWIZZLE_EXPAND to indicate components for expansion
+ * and then override without exceptions or favoring one component
+ * over another.
+ */
+ if (format != PIPE_FORMAT_A8_UNORM) {
+ const struct util_format_description *desc = util_format_description(format);
+
+ assert(desc);
+ if (desc) {
+ if (desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_0) {
+ view->swizzle_g = expand_green_blue;
+ }
+ if (desc->swizzle[2] == UTIL_FORMAT_SWIZZLE_0) {
+ view->swizzle_b = expand_green_blue;
+ }
+ }
+ }
+}
+
+void
+u_sampler_view_default_template(struct pipe_sampler_view *view,
+ const struct pipe_texture *texture,
+ enum pipe_format format)
+{
+ /* Expand to (0, 0, 0, 1) */
+ default_template(view,
+ texture,
+ format,
+ PIPE_SWIZZLE_ZERO);
+}
+
+void
+u_sampler_view_default_dx9_template(struct pipe_sampler_view *view,
+ const struct pipe_texture *texture,
+ enum pipe_format format)
+{
+ /* Expand to (1, 1, 1, 1) */
+ default_template(view,
+ texture,
+ format,
+ PIPE_SWIZZLE_ONE);
+}
diff --git a/src/gallium/drivers/softpipe/sp_winsys.h b/src/gallium/auxiliary/util/u_sampler.h
index 6e3920c49b..bdd061c851 100644
--- a/src/gallium/drivers/softpipe/sp_winsys.h
+++ b/src/gallium/auxiliary/util/u_sampler.h
@@ -1,8 +1,8 @@
/**************************************************************************
- *
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
+ *
+ * Copyright 2010 VMware, Inc.
* All Rights Reserved.
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
@@ -10,64 +10,48 @@
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
- *
+ *
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
+ *
**************************************************************************/
-/* This is the interface that softpipe requires any window system
- * hosting it to implement. This is the only include file in softpipe
- * which is public.
- */
+#ifndef U_SAMPLER_H
+#define U_SAMPLER_H
-#ifndef SP_WINSYS_H
-#define SP_WINSYS_H
+
+#include "pipe/p_defines.h"
+#include "pipe/p_format.h"
+#include "pipe/p_state.h"
#ifdef __cplusplus
extern "C" {
#endif
-#include "pipe/p_defines.h"
-
-struct pipe_screen;
-struct pipe_winsys;
-struct pipe_context;
-struct pipe_texture;
-struct pipe_buffer;
-
-
-
-/**
- * Create a softpipe screen that uses the
- * given winsys for allocating buffers.
- */
-struct pipe_screen *softpipe_create_screen( struct pipe_winsys * );
-/**
- * Create a softpipe screen that uses
- * regular malloc to create all its buffers.
- */
-struct pipe_screen *softpipe_create_screen_malloc(void);
+void
+u_sampler_view_default_template(struct pipe_sampler_view *view,
+ const struct pipe_texture *texture,
+ enum pipe_format format);
-boolean
-softpipe_get_texture_buffer( struct pipe_texture *texture,
- struct pipe_buffer **buf,
- unsigned *stride );
+void
+u_sampler_view_default_dx9_template(struct pipe_sampler_view *view,
+ const struct pipe_texture *texture,
+ enum pipe_format format);
#ifdef __cplusplus
-}
+} /* extern "C" { */
#endif
-#endif /* SP_WINSYS_H */
+#endif /* U_SAMPLER_H */
diff --git a/src/gallium/auxiliary/util/u_simple_screen.c b/src/gallium/auxiliary/util/u_simple_screen.c
index 53f3c16dbc..9203cb6580 100644
--- a/src/gallium/auxiliary/util/u_simple_screen.c
+++ b/src/gallium/auxiliary/util/u_simple_screen.c
@@ -59,22 +59,7 @@ pass_user_buffer_create(struct pipe_screen *screen,
return buffer;
}
-static struct pipe_buffer *
-pass_surface_buffer_create(struct pipe_screen *screen,
- unsigned width, unsigned height,
- enum pipe_format format,
- unsigned usage,
- unsigned tex_usage,
- unsigned *stride)
-{
- struct pipe_buffer *buffer =
- screen->winsys->surface_buffer_create(screen->winsys, width, height,
- format, usage, tex_usage, stride);
- buffer->screen = screen;
-
- return buffer;
-}
static void *
pass_buffer_map(struct pipe_screen *screen,
@@ -135,7 +120,6 @@ u_simple_screen_init(struct pipe_screen *screen)
{
screen->buffer_create = pass_buffer_create;
screen->user_buffer_create = pass_user_buffer_create;
- screen->surface_buffer_create = pass_surface_buffer_create;
screen->buffer_map = pass_buffer_map;
screen->buffer_unmap = pass_buffer_unmap;
diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c
index 79481b710b..43b45eb926 100644
--- a/src/gallium/auxiliary/util/u_tile.c
+++ b/src/gallium/auxiliary/util/u_tile.c
@@ -45,11 +45,11 @@
* Move raw block of pixels from transfer object to user memory.
*/
void
-pipe_get_tile_raw(struct pipe_transfer *pt,
+pipe_get_tile_raw(struct pipe_context *pipe,
+ struct pipe_transfer *pt,
uint x, uint y, uint w, uint h,
void *dst, int dst_stride)
{
- struct pipe_screen *screen = pt->texture->screen;
const void *src;
if (dst_stride == 0)
@@ -58,14 +58,14 @@ pipe_get_tile_raw(struct pipe_transfer *pt,
if (pipe_clip_tile(x, y, &w, &h, pt))
return;
- src = screen->transfer_map(screen, pt);
+ src = pipe->transfer_map(pipe, pt);
assert(src);
if(!src)
return;
util_copy_rect(dst, pt->texture->format, dst_stride, 0, 0, w, h, src, pt->stride, x, y);
- screen->transfer_unmap(screen, pt);
+ pipe->transfer_unmap(pipe, pt);
}
@@ -73,11 +73,11 @@ pipe_get_tile_raw(struct pipe_transfer *pt,
* Move raw block of pixels from user memory to transfer object.
*/
void
-pipe_put_tile_raw(struct pipe_transfer *pt,
+pipe_put_tile_raw(struct pipe_context *pipe,
+ struct pipe_transfer *pt,
uint x, uint y, uint w, uint h,
const void *src, int src_stride)
{
- struct pipe_screen *screen = pt->texture->screen;
void *dst;
enum pipe_format format = pt->texture->format;
@@ -87,14 +87,14 @@ pipe_put_tile_raw(struct pipe_transfer *pt,
if (pipe_clip_tile(x, y, &w, &h, pt))
return;
- dst = screen->transfer_map(screen, pt);
+ dst = pipe->transfer_map(pipe, pt);
assert(dst);
if(!dst)
return;
util_copy_rect(dst, format, pt->stride, x, y, w, h, src, src_stride, 0, 0);
- screen->transfer_unmap(screen, pt);
+ pipe->transfer_unmap(pipe, pt);
}
@@ -108,387 +108,6 @@ pipe_put_tile_raw(struct pipe_transfer *pt,
-/*** PIPE_FORMAT_B8G8R8A8_UNORM ***/
-
-static void
-a8r8g8b8_get_tile_rgba(const unsigned *src,
- unsigned w, unsigned h,
- float *p,
- unsigned dst_stride)
-{
- unsigned i, j;
-
- for (i = 0; i < h; i++) {
- float *pRow = p;
- for (j = 0; j < w; j++, pRow += 4) {
- const unsigned pixel = *src++;
- pRow[0] = ubyte_to_float((pixel >> 16) & 0xff);
- pRow[1] = ubyte_to_float((pixel >> 8) & 0xff);
- pRow[2] = ubyte_to_float((pixel >> 0) & 0xff);
- pRow[3] = ubyte_to_float((pixel >> 24) & 0xff);
- }
- p += dst_stride;
- }
-}
-
-
-static void
-a8r8g8b8_put_tile_rgba(unsigned *dst,
- unsigned w, unsigned h,
- const float *p,
- unsigned src_stride)
-{
- unsigned i, j;
-
- for (i = 0; i < h; i++) {
- const float *pRow = p;
- for (j = 0; j < w; j++, pRow += 4) {
- unsigned r, g, b, a;
- r = float_to_ubyte(pRow[0]);
- g = float_to_ubyte(pRow[1]);
- b = float_to_ubyte(pRow[2]);
- a = float_to_ubyte(pRow[3]);
- *dst++ = (a << 24) | (r << 16) | (g << 8) | b;
- }
- p += src_stride;
- }
-}
-
-
-/*** PIPE_FORMAT_B8G8R8X8_UNORM ***/
-
-static void
-x8r8g8b8_get_tile_rgba(const unsigned *src,
- unsigned w, unsigned h,
- float *p,
- unsigned dst_stride)
-{
- unsigned i, j;
-
- for (i = 0; i < h; i++) {
- float *pRow = p;
- for (j = 0; j < w; j++, pRow += 4) {
- const unsigned pixel = *src++;
- pRow[0] = ubyte_to_float((pixel >> 16) & 0xff);
- pRow[1] = ubyte_to_float((pixel >> 8) & 0xff);
- pRow[2] = ubyte_to_float((pixel >> 0) & 0xff);
- pRow[3] = 1.0F;
- }
- p += dst_stride;
- }
-}
-
-
-static void
-x8r8g8b8_put_tile_rgba(unsigned *dst,
- unsigned w, unsigned h,
- const float *p,
- unsigned src_stride)
-{
- unsigned i, j;
-
- for (i = 0; i < h; i++) {
- const float *pRow = p;
- for (j = 0; j < w; j++, pRow += 4) {
- unsigned r, g, b;
- r = float_to_ubyte(pRow[0]);
- g = float_to_ubyte(pRow[1]);
- b = float_to_ubyte(pRow[2]);
- *dst++ = (0xff << 24) | (r << 16) | (g << 8) | b;
- }
- p += src_stride;
- }
-}
-
-
-/*** PIPE_FORMAT_A8R8G8B8_UNORM ***/
-
-static void
-b8g8r8a8_get_tile_rgba(const unsigned *src,
- unsigned w, unsigned h,
- float *p,
- unsigned dst_stride)
-{
- unsigned i, j;
-
- for (i = 0; i < h; i++) {
- float *pRow = p;
- for (j = 0; j < w; j++, pRow += 4) {
- const unsigned pixel = *src++;
- pRow[0] = ubyte_to_float((pixel >> 8) & 0xff);
- pRow[1] = ubyte_to_float((pixel >> 16) & 0xff);
- pRow[2] = ubyte_to_float((pixel >> 24) & 0xff);
- pRow[3] = ubyte_to_float((pixel >> 0) & 0xff);
- }
- p += dst_stride;
- }
-}
-
-
-static void
-b8g8r8a8_put_tile_rgba(unsigned *dst,
- unsigned w, unsigned h,
- const float *p,
- unsigned src_stride)
-{
- unsigned i, j;
-
- for (i = 0; i < h; i++) {
- const float *pRow = p;
- for (j = 0; j < w; j++, pRow += 4) {
- unsigned r, g, b, a;
- r = float_to_ubyte(pRow[0]);
- g = float_to_ubyte(pRow[1]);
- b = float_to_ubyte(pRow[2]);
- a = float_to_ubyte(pRow[3]);
- *dst++ = (b << 24) | (g << 16) | (r << 8) | a;
- }
- p += src_stride;
- }
-}
-
-
-/*** PIPE_FORMAT_A8B8G8R8_UNORM ***/
-
-static void
-r8g8b8a8_get_tile_rgba(const unsigned *src,
- unsigned w, unsigned h,
- float *p,
- unsigned dst_stride)
-{
- unsigned i, j;
-
- for (i = 0; i < h; i++) {
- float *pRow = p;
- for (j = 0; j < w; j++, pRow += 4) {
- const unsigned pixel = *src++;
- pRow[0] = ubyte_to_float((pixel >> 24) & 0xff);
- pRow[1] = ubyte_to_float((pixel >> 16) & 0xff);
- pRow[2] = ubyte_to_float((pixel >> 8) & 0xff);
- pRow[3] = ubyte_to_float((pixel >> 0) & 0xff);
- }
- p += dst_stride;
- }
-}
-
-
-static void
-r8g8b8a8_put_tile_rgba(unsigned *dst,
- unsigned w, unsigned h,
- const float *p,
- unsigned src_stride)
-{
- unsigned i, j;
-
- for (i = 0; i < h; i++) {
- const float *pRow = p;
- for (j = 0; j < w; j++, pRow += 4) {
- unsigned r, g, b, a;
- r = float_to_ubyte(pRow[0]);
- g = float_to_ubyte(pRow[1]);
- b = float_to_ubyte(pRow[2]);
- a = float_to_ubyte(pRow[3]);
- *dst++ = (r << 24) | (g << 16) | (b << 8) | a;
- }
- p += src_stride;
- }
-}
-
-
-/*** PIPE_FORMAT_B5G5R5A1_UNORM ***/
-
-static void
-a1r5g5b5_get_tile_rgba(const ushort *src,
- unsigned w, unsigned h,
- float *p,
- unsigned dst_stride)
-{
- unsigned i, j;
-
- for (i = 0; i < h; i++) {
- float *pRow = p;
- for (j = 0; j < w; j++, pRow += 4) {
- const ushort pixel = *src++;
- pRow[0] = ((pixel >> 10) & 0x1f) * (1.0f / 31.0f);
- pRow[1] = ((pixel >> 5) & 0x1f) * (1.0f / 31.0f);
- pRow[2] = ((pixel ) & 0x1f) * (1.0f / 31.0f);
- pRow[3] = ((pixel >> 15) ) * 1.0f;
- }
- p += dst_stride;
- }
-}
-
-
-static void
-a1r5g5b5_put_tile_rgba(ushort *dst,
- unsigned w, unsigned h,
- const float *p,
- unsigned src_stride)
-{
- unsigned i, j;
-
- for (i = 0; i < h; i++) {
- const float *pRow = p;
- for (j = 0; j < w; j++, pRow += 4) {
- unsigned r, g, b, a;
- r = float_to_ubyte(pRow[0]);
- g = float_to_ubyte(pRow[1]);
- b = float_to_ubyte(pRow[2]);
- a = float_to_ubyte(pRow[3]);
- r = r >> 3; /* 5 bits */
- g = g >> 3; /* 5 bits */
- b = b >> 3; /* 5 bits */
- a = a >> 7; /* 1 bit */
- *dst++ = (a << 15) | (r << 10) | (g << 5) | b;
- }
- p += src_stride;
- }
-}
-
-
-/*** PIPE_FORMAT_B4G4R4A4_UNORM ***/
-
-static void
-a4r4g4b4_get_tile_rgba(const ushort *src,
- unsigned w, unsigned h,
- float *p,
- unsigned dst_stride)
-{
- unsigned i, j;
-
- for (i = 0; i < h; i++) {
- float *pRow = p;
- for (j = 0; j < w; j++, pRow += 4) {
- const ushort pixel = *src++;
- pRow[0] = ((pixel >> 8) & 0xf) * (1.0f / 15.0f);
- pRow[1] = ((pixel >> 4) & 0xf) * (1.0f / 15.0f);
- pRow[2] = ((pixel ) & 0xf) * (1.0f / 15.0f);
- pRow[3] = ((pixel >> 12) ) * (1.0f / 15.0f);
- }
- p += dst_stride;
- }
-}
-
-
-static void
-a4r4g4b4_put_tile_rgba(ushort *dst,
- unsigned w, unsigned h,
- const float *p,
- unsigned src_stride)
-{
- unsigned i, j;
-
- for (i = 0; i < h; i++) {
- const float *pRow = p;
- for (j = 0; j < w; j++, pRow += 4) {
- unsigned r, g, b, a;
- r = float_to_ubyte(pRow[0]);
- g = float_to_ubyte(pRow[1]);
- b = float_to_ubyte(pRow[2]);
- a = float_to_ubyte(pRow[3]);
- r >>= 4;
- g >>= 4;
- b >>= 4;
- a >>= 4;
- *dst++ = (a << 12) | (r << 8) | (g << 4) | b;
- }
- p += src_stride;
- }
-}
-
-
-/*** PIPE_FORMAT_B5G6R5_UNORM ***/
-
-static void
-r5g6b5_get_tile_rgba(const ushort *src,
- unsigned w, unsigned h,
- float *p,
- unsigned dst_stride)
-{
- unsigned i, j;
-
- for (i = 0; i < h; i++) {
- float *pRow = p;
- for (j = 0; j < w; j++, pRow += 4) {
- const ushort pixel = *src++;
- pRow[0] = ((pixel >> 11) & 0x1f) * (1.0f / 31.0f);
- pRow[1] = ((pixel >> 5) & 0x3f) * (1.0f / 63.0f);
- pRow[2] = ((pixel ) & 0x1f) * (1.0f / 31.0f);
- pRow[3] = 1.0f;
- }
- p += dst_stride;
- }
-}
-
-
-static void
-r5g6b5_put_tile_rgba(ushort *dst,
- unsigned w, unsigned h,
- const float *p,
- unsigned src_stride)
-{
- unsigned i, j;
-
- for (i = 0; i < h; i++) {
- const float *pRow = p;
- for (j = 0; j < w; j++, pRow += 4) {
- uint r = (uint) (CLAMP(pRow[0], 0.0, 1.0) * 31.0);
- uint g = (uint) (CLAMP(pRow[1], 0.0, 1.0) * 63.0);
- uint b = (uint) (CLAMP(pRow[2], 0.0, 1.0) * 31.0);
- *dst++ = (r << 11) | (g << 5) | (b);
- }
- p += src_stride;
- }
-}
-
-
-
-/*** PIPE_FORMAT_R8G8B8_UNORM ***/
-
-static void
-r8g8b8_get_tile_rgba(const ubyte *src,
- unsigned w, unsigned h,
- float *p,
- unsigned dst_stride)
-{
- unsigned i, j;
-
- for (i = 0; i < h; i++) {
- float *pRow = p;
- for (j = 0; j < w; j++, pRow += 4) {
- pRow[0] = ubyte_to_float(src[0]);
- pRow[1] = ubyte_to_float(src[1]);
- pRow[2] = ubyte_to_float(src[2]);
- pRow[3] = 1.0f;
- src += 3;
- }
- p += dst_stride;
- }
-}
-
-
-static void
-r8g8b8_put_tile_rgba(ubyte *dst,
- unsigned w, unsigned h,
- const float *p,
- unsigned src_stride)
-{
- unsigned i, j;
-
- for (i = 0; i < h; i++) {
- const float *pRow = p;
- for (j = 0; j < w; j++, pRow += 4) {
- dst[0] = float_to_ubyte(pRow[0]);
- dst[1] = float_to_ubyte(pRow[1]);
- dst[2] = float_to_ubyte(pRow[2]);
- dst += 3;
- }
- p += src_stride;
- }
-}
-
-
-
/*** PIPE_FORMAT_Z16_UNORM ***/
/**
@@ -518,179 +137,6 @@ z16_get_tile_rgba(const ushort *src,
-/*** PIPE_FORMAT_L8_UNORM ***/
-
-static void
-l8_get_tile_rgba(const ubyte *src,
- unsigned w, unsigned h,
- float *p,
- unsigned dst_stride)
-{
- unsigned i, j;
-
- for (i = 0; i < h; i++) {
- float *pRow = p;
- for (j = 0; j < w; j++, src++, pRow += 4) {
- pRow[0] =
- pRow[1] =
- pRow[2] = ubyte_to_float(*src);
- pRow[3] = 1.0;
- }
- p += dst_stride;
- }
-}
-
-
-static void
-l8_put_tile_rgba(ubyte *dst,
- unsigned w, unsigned h,
- const float *p,
- unsigned src_stride)
-{
- unsigned i, j;
-
- for (i = 0; i < h; i++) {
- const float *pRow = p;
- for (j = 0; j < w; j++, pRow += 4) {
- unsigned r;
- r = float_to_ubyte(pRow[0]);
- *dst++ = (ubyte) r;
- }
- p += src_stride;
- }
-}
-
-
-
-/*** PIPE_FORMAT_A8_UNORM ***/
-
-static void
-a8_get_tile_rgba(const ubyte *src,
- unsigned w, unsigned h,
- float *p,
- unsigned dst_stride)
-{
- unsigned i, j;
-
- for (i = 0; i < h; i++) {
- float *pRow = p;
- for (j = 0; j < w; j++, src++, pRow += 4) {
- pRow[0] =
- pRow[1] =
- pRow[2] = 0.0;
- pRow[3] = ubyte_to_float(*src);
- }
- p += dst_stride;
- }
-}
-
-
-static void
-a8_put_tile_rgba(ubyte *dst,
- unsigned w, unsigned h,
- const float *p,
- unsigned src_stride)
-{
- unsigned i, j;
-
- for (i = 0; i < h; i++) {
- const float *pRow = p;
- for (j = 0; j < w; j++, pRow += 4) {
- unsigned a;
- a = float_to_ubyte(pRow[3]);
- *dst++ = (ubyte) a;
- }
- p += src_stride;
- }
-}
-
-
-
-/*** PIPE_FORMAT_R16_SNORM ***/
-
-static void
-r16_get_tile_rgba(const short *src,
- unsigned w, unsigned h,
- float *p,
- unsigned dst_stride)
-{
- unsigned i, j;
-
- for (i = 0; i < h; i++) {
- float *pRow = p;
- for (j = 0; j < w; j++, src++, pRow += 4) {
- pRow[0] = SHORT_TO_FLOAT(src[0]);
- pRow[1] =
- pRow[2] = 0.0;
- pRow[3] = 1.0;
- }
- p += dst_stride;
- }
-}
-
-
-static void
-r16_put_tile_rgba(short *dst,
- unsigned w, unsigned h,
- const float *p,
- unsigned src_stride)
-{
- unsigned i, j;
-
- for (i = 0; i < h; i++) {
- const float *pRow = p;
- for (j = 0; j < w; j++, dst++, pRow += 4) {
- UNCLAMPED_FLOAT_TO_SHORT(dst[0], pRow[0]);
- }
- p += src_stride;
- }
-}
-
-
-/*** PIPE_FORMAT_R16G16B16A16_SNORM ***/
-
-static void
-r16g16b16a16_get_tile_rgba(const short *src,
- unsigned w, unsigned h,
- float *p,
- unsigned dst_stride)
-{
- unsigned i, j;
-
- for (i = 0; i < h; i++) {
- float *pRow = p;
- for (j = 0; j < w; j++, src += 4, pRow += 4) {
- pRow[0] = SHORT_TO_FLOAT(src[0]);
- pRow[1] = SHORT_TO_FLOAT(src[1]);
- pRow[2] = SHORT_TO_FLOAT(src[2]);
- pRow[3] = SHORT_TO_FLOAT(src[3]);
- }
- p += dst_stride;
- }
-}
-
-
-static void
-r16g16b16a16_put_tile_rgba(short *dst,
- unsigned w, unsigned h,
- const float *p,
- unsigned src_stride)
-{
- unsigned i, j;
-
- for (i = 0; i < h; i++) {
- const float *pRow = p;
- for (j = 0; j < w; j++, dst += 4, pRow += 4) {
- UNCLAMPED_FLOAT_TO_SHORT(dst[0], pRow[0]);
- UNCLAMPED_FLOAT_TO_SHORT(dst[1], pRow[1]);
- UNCLAMPED_FLOAT_TO_SHORT(dst[2], pRow[2]);
- UNCLAMPED_FLOAT_TO_SHORT(dst[3], pRow[3]);
- }
- p += src_stride;
- }
-}
-
-
/*** PIPE_FORMAT_A8B8G8R8_SRGB ***/
/**
@@ -870,96 +316,6 @@ l8_srgb_put_tile_rgba(ubyte *dst,
}
-/*** PIPE_FORMAT_I8_UNORM ***/
-
-static void
-i8_get_tile_rgba(const ubyte *src,
- unsigned w, unsigned h,
- float *p,
- unsigned dst_stride)
-{
- unsigned i, j;
-
- for (i = 0; i < h; i++) {
- float *pRow = p;
- for (j = 0; j < w; j++, src++, pRow += 4) {
- pRow[0] =
- pRow[1] =
- pRow[2] =
- pRow[3] = ubyte_to_float(*src);
- }
- p += dst_stride;
- }
-}
-
-
-static void
-i8_put_tile_rgba(ubyte *dst,
- unsigned w, unsigned h,
- const float *p,
- unsigned src_stride)
-{
- unsigned i, j;
-
- for (i = 0; i < h; i++) {
- const float *pRow = p;
- for (j = 0; j < w; j++, pRow += 4) {
- unsigned r;
- r = float_to_ubyte(pRow[0]);
- *dst++ = (ubyte) r;
- }
- p += src_stride;
- }
-}
-
-
-/*** PIPE_FORMAT_L8A8_UNORM ***/
-
-static void
-a8l8_get_tile_rgba(const ushort *src,
- unsigned w, unsigned h,
- float *p,
- unsigned dst_stride)
-{
- unsigned i, j;
-
- for (i = 0; i < h; i++) {
- float *pRow = p;
- for (j = 0; j < w; j++, pRow += 4) {
- ushort p = *src++;
- pRow[0] =
- pRow[1] =
- pRow[2] = ubyte_to_float(p & 0xff);
- pRow[3] = ubyte_to_float(p >> 8);
- }
- p += dst_stride;
- }
-}
-
-
-static void
-a8l8_put_tile_rgba(ushort *dst,
- unsigned w, unsigned h,
- const float *p,
- unsigned src_stride)
-{
- unsigned i, j;
-
- for (i = 0; i < h; i++) {
- const float *pRow = p;
- for (j = 0; j < w; j++, pRow += 4) {
- unsigned r, a;
- r = float_to_ubyte(pRow[0]);
- a = float_to_ubyte(pRow[3]);
- *dst++ = (a << 8) | r;
- }
- p += src_stride;
- }
-}
-
-
-
-
/*** PIPE_FORMAT_Z32_UNORM ***/
/**
@@ -987,7 +343,7 @@ z32_get_tile_rgba(const unsigned *src,
}
-/*** PIPE_FORMAT_Z24S8_UNORM ***/
+/*** PIPE_FORMAT_Z24_UNORM_S8_USCALED ***/
/**
* Return Z component as four float in [0,1]. Stencil part ignored.
@@ -1014,7 +370,7 @@ s8z24_get_tile_rgba(const unsigned *src,
}
-/*** PIPE_FORMAT_S8Z24_UNORM ***/
+/*** PIPE_FORMAT_S8_USCALED_Z24_UNORM ***/
/**
* Return Z component as four float in [0,1]. Stencil part ignored.
@@ -1162,48 +518,6 @@ pipe_tile_raw_to_rgba(enum pipe_format format,
float *dst, unsigned dst_stride)
{
switch (format) {
- case PIPE_FORMAT_B8G8R8A8_UNORM:
- a8r8g8b8_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride);
- break;
- case PIPE_FORMAT_B8G8R8X8_UNORM:
- x8r8g8b8_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride);
- break;
- case PIPE_FORMAT_A8R8G8B8_UNORM:
- b8g8r8a8_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride);
- break;
- case PIPE_FORMAT_A8B8G8R8_UNORM:
- r8g8b8a8_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride);
- break;
- case PIPE_FORMAT_B5G5R5A1_UNORM:
- a1r5g5b5_get_tile_rgba((ushort *) src, w, h, dst, dst_stride);
- break;
- case PIPE_FORMAT_B4G4R4A4_UNORM:
- a4r4g4b4_get_tile_rgba((ushort *) src, w, h, dst, dst_stride);
- break;
- case PIPE_FORMAT_B5G6R5_UNORM:
- r5g6b5_get_tile_rgba((ushort *) src, w, h, dst, dst_stride);
- break;
- case PIPE_FORMAT_R8G8B8_UNORM:
- r8g8b8_get_tile_rgba((ubyte *) src, w, h, dst, dst_stride);
- break;
- case PIPE_FORMAT_L8_UNORM:
- l8_get_tile_rgba((ubyte *) src, w, h, dst, dst_stride);
- break;
- case PIPE_FORMAT_A8_UNORM:
- a8_get_tile_rgba((ubyte *) src, w, h, dst, dst_stride);
- break;
- case PIPE_FORMAT_I8_UNORM:
- i8_get_tile_rgba((ubyte *) src, w, h, dst, dst_stride);
- break;
- case PIPE_FORMAT_L8A8_UNORM:
- a8l8_get_tile_rgba((ushort *) src, w, h, dst, dst_stride);
- break;
- case PIPE_FORMAT_R16_SNORM:
- r16_get_tile_rgba((short *) src, w, h, dst, dst_stride);
- break;
- case PIPE_FORMAT_R16G16B16A16_SNORM:
- r16g16b16a16_get_tile_rgba((short *) src, w, h, dst, dst_stride);
- break;
case PIPE_FORMAT_B8G8R8A8_SRGB:
a8r8g8b8_srgb_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride);
break;
@@ -1219,11 +533,11 @@ pipe_tile_raw_to_rgba(enum pipe_format format,
case PIPE_FORMAT_Z32_UNORM:
z32_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride);
break;
- case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
case PIPE_FORMAT_Z24X8_UNORM:
s8z24_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride);
break;
- case PIPE_FORMAT_S8Z24_UNORM:
+ case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
case PIPE_FORMAT_X8Z24_UNORM:
z24s8_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride);
break;
@@ -1246,7 +560,8 @@ pipe_tile_raw_to_rgba(enum pipe_format format,
void
-pipe_get_tile_rgba(struct pipe_transfer *pt,
+pipe_get_tile_rgba(struct pipe_context *pipe,
+ struct pipe_transfer *pt,
uint x, uint y, uint w, uint h,
float *p)
{
@@ -1265,16 +580,80 @@ pipe_get_tile_rgba(struct pipe_transfer *pt,
if(format == PIPE_FORMAT_UYVY || format == PIPE_FORMAT_YUYV)
assert((x & 1) == 0);
- pipe_get_tile_raw(pt, x, y, w, h, packed, 0);
+ pipe_get_tile_raw(pipe, pt, x, y, w, h, packed, 0);
+
+ pipe_tile_raw_to_rgba(format, packed, w, h, p, dst_stride);
+
+ FREE(packed);
+}
+
+
+void
+pipe_get_tile_swizzle(struct pipe_context *pipe,
+ struct pipe_transfer *pt,
+ uint x,
+ uint y,
+ uint w,
+ uint h,
+ uint swizzle_r,
+ uint swizzle_g,
+ uint swizzle_b,
+ uint swizzle_a,
+ enum pipe_format format,
+ float *p)
+{
+ unsigned dst_stride = w * 4;
+ void *packed;
+ uint i;
+ float rgba01[6];
+
+ if (pipe_clip_tile(x, y, &w, &h, pt)) {
+ return;
+ }
+
+ packed = MALLOC(util_format_get_nblocks(format, w, h) * util_format_get_blocksize(format));
+ if (!packed) {
+ return;
+ }
+
+ if (format == PIPE_FORMAT_UYVY || format == PIPE_FORMAT_YUYV) {
+ assert((x & 1) == 0);
+ }
+
+ pipe_get_tile_raw(pipe, pt, x, y, w, h, packed, 0);
pipe_tile_raw_to_rgba(format, packed, w, h, p, dst_stride);
FREE(packed);
+
+ if (swizzle_r == PIPE_SWIZZLE_RED &&
+ swizzle_g == PIPE_SWIZZLE_GREEN &&
+ swizzle_b == PIPE_SWIZZLE_BLUE &&
+ swizzle_a == PIPE_SWIZZLE_ALPHA) {
+ /* no-op, skip */
+ return;
+ }
+
+ rgba01[PIPE_SWIZZLE_ZERO] = 0.0f;
+ rgba01[PIPE_SWIZZLE_ONE] = 1.0f;
+
+ for (i = 0; i < w * h; i++) {
+ rgba01[PIPE_SWIZZLE_RED] = p[0];
+ rgba01[PIPE_SWIZZLE_GREEN] = p[1];
+ rgba01[PIPE_SWIZZLE_BLUE] = p[2];
+ rgba01[PIPE_SWIZZLE_ALPHA] = p[3];
+
+ *p++ = rgba01[swizzle_r];
+ *p++ = rgba01[swizzle_g];
+ *p++ = rgba01[swizzle_b];
+ *p++ = rgba01[swizzle_a];
+ }
}
void
-pipe_put_tile_rgba(struct pipe_transfer *pt,
+pipe_put_tile_rgba(struct pipe_context *pipe,
+ struct pipe_transfer *pt,
uint x, uint y, uint w, uint h,
const float *p)
{
@@ -1291,48 +670,6 @@ pipe_put_tile_rgba(struct pipe_transfer *pt,
return;
switch (format) {
- case PIPE_FORMAT_B8G8R8A8_UNORM:
- a8r8g8b8_put_tile_rgba((unsigned *) packed, w, h, p, src_stride);
- break;
- case PIPE_FORMAT_B8G8R8X8_UNORM:
- x8r8g8b8_put_tile_rgba((unsigned *) packed, w, h, p, src_stride);
- break;
- case PIPE_FORMAT_A8R8G8B8_UNORM:
- b8g8r8a8_put_tile_rgba((unsigned *) packed, w, h, p, src_stride);
- break;
- case PIPE_FORMAT_A8B8G8R8_UNORM:
- r8g8b8a8_put_tile_rgba((unsigned *) packed, w, h, p, src_stride);
- break;
- case PIPE_FORMAT_B5G5R5A1_UNORM:
- a1r5g5b5_put_tile_rgba((ushort *) packed, w, h, p, src_stride);
- break;
- case PIPE_FORMAT_B5G6R5_UNORM:
- r5g6b5_put_tile_rgba((ushort *) packed, w, h, p, src_stride);
- break;
- case PIPE_FORMAT_R8G8B8_UNORM:
- r8g8b8_put_tile_rgba((ubyte *) packed, w, h, p, src_stride);
- break;
- case PIPE_FORMAT_B4G4R4A4_UNORM:
- a4r4g4b4_put_tile_rgba((ushort *) packed, w, h, p, src_stride);
- break;
- case PIPE_FORMAT_L8_UNORM:
- l8_put_tile_rgba((ubyte *) packed, w, h, p, src_stride);
- break;
- case PIPE_FORMAT_A8_UNORM:
- a8_put_tile_rgba((ubyte *) packed, w, h, p, src_stride);
- break;
- case PIPE_FORMAT_I8_UNORM:
- i8_put_tile_rgba((ubyte *) packed, w, h, p, src_stride);
- break;
- case PIPE_FORMAT_L8A8_UNORM:
- a8l8_put_tile_rgba((ushort *) packed, w, h, p, src_stride);
- break;
- case PIPE_FORMAT_R16_SNORM:
- r16_put_tile_rgba((short *) packed, w, h, p, src_stride);
- break;
- case PIPE_FORMAT_R16G16B16A16_SNORM:
- r16g16b16a16_put_tile_rgba((short *) packed, w, h, p, src_stride);
- break;
case PIPE_FORMAT_B8G8R8A8_SRGB:
a8r8g8b8_srgb_put_tile_rgba((unsigned *) packed, w, h, p, src_stride);
break;
@@ -1348,11 +685,11 @@ pipe_put_tile_rgba(struct pipe_transfer *pt,
case PIPE_FORMAT_Z32_UNORM:
/*z32_put_tile_rgba((unsigned *) packed, w, h, p, src_stride);*/
break;
- case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
case PIPE_FORMAT_Z24X8_UNORM:
/*s8z24_put_tile_rgba((unsigned *) packed, w, h, p, src_stride);*/
break;
- case PIPE_FORMAT_S8Z24_UNORM:
+ case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
case PIPE_FORMAT_X8Z24_UNORM:
/*z24s8_put_tile_rgba((unsigned *) packed, w, h, p, src_stride);*/
break;
@@ -1363,7 +700,7 @@ pipe_put_tile_rgba(struct pipe_transfer *pt,
0, 0, w, h);
}
- pipe_put_tile_raw(pt, x, y, w, h, packed, 0);
+ pipe_put_tile_raw(pipe, pt, x, y, w, h, packed, 0);
FREE(packed);
}
@@ -1373,11 +710,11 @@ pipe_put_tile_rgba(struct pipe_transfer *pt,
* Get a block of Z values, converted to 32-bit range.
*/
void
-pipe_get_tile_z(struct pipe_transfer *pt,
+pipe_get_tile_z(struct pipe_context *pipe,
+ struct pipe_transfer *pt,
uint x, uint y, uint w, uint h,
uint *z)
{
- struct pipe_screen *screen = pt->texture->screen;
const uint dstStride = w;
ubyte *map;
uint *pDest = z;
@@ -1387,7 +724,7 @@ pipe_get_tile_z(struct pipe_transfer *pt,
if (pipe_clip_tile(x, y, &w, &h, pt))
return;
- map = (ubyte *)screen->transfer_map(screen, pt);
+ map = (ubyte *)pipe->transfer_map(pipe, pt);
if (!map) {
assert(0);
return;
@@ -1405,7 +742,7 @@ pipe_get_tile_z(struct pipe_transfer *pt,
}
}
break;
- case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
case PIPE_FORMAT_Z24X8_UNORM:
{
const uint *ptrc
@@ -1420,7 +757,7 @@ pipe_get_tile_z(struct pipe_transfer *pt,
}
}
break;
- case PIPE_FORMAT_S8Z24_UNORM:
+ case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
case PIPE_FORMAT_X8Z24_UNORM:
{
const uint *ptrc
@@ -1453,16 +790,16 @@ pipe_get_tile_z(struct pipe_transfer *pt,
assert(0);
}
- screen->transfer_unmap(screen, pt);
+ pipe->transfer_unmap(pipe, pt);
}
void
-pipe_put_tile_z(struct pipe_transfer *pt,
+pipe_put_tile_z(struct pipe_context *pipe,
+ struct pipe_transfer *pt,
uint x, uint y, uint w, uint h,
const uint *zSrc)
{
- struct pipe_screen *screen = pt->texture->screen;
const uint srcStride = w;
const uint *ptrc = zSrc;
ubyte *map;
@@ -1472,7 +809,7 @@ pipe_put_tile_z(struct pipe_transfer *pt,
if (pipe_clip_tile(x, y, &w, &h, pt))
return;
- map = (ubyte *)screen->transfer_map(screen, pt);
+ map = (ubyte *)pipe->transfer_map(pipe, pt);
if (!map) {
assert(0);
return;
@@ -1489,7 +826,7 @@ pipe_put_tile_z(struct pipe_transfer *pt,
}
}
break;
- case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
{
uint *pDest = (uint *) (map + y * pt->stride + x*4);
assert((pt->usage & PIPE_TRANSFER_READ_WRITE) == PIPE_TRANSFER_READ_WRITE);
@@ -1516,7 +853,7 @@ pipe_put_tile_z(struct pipe_transfer *pt,
}
}
break;
- case PIPE_FORMAT_S8Z24_UNORM:
+ case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
{
uint *pDest = (uint *) (map + y * pt->stride + x*4);
assert((pt->usage & PIPE_TRANSFER_READ_WRITE) == PIPE_TRANSFER_READ_WRITE);
@@ -1560,7 +897,7 @@ pipe_put_tile_z(struct pipe_transfer *pt,
assert(0);
}
- screen->transfer_unmap(screen, pt);
+ pipe->transfer_unmap(pipe, pt);
}
diff --git a/src/gallium/auxiliary/util/u_tile.h b/src/gallium/auxiliary/util/u_tile.h
index 1453af38b8..1d8ce7d8cb 100644
--- a/src/gallium/auxiliary/util/u_tile.h
+++ b/src/gallium/auxiliary/util/u_tile.h
@@ -56,34 +56,54 @@ extern "C" {
#endif
void
-pipe_get_tile_raw(struct pipe_transfer *pt,
+pipe_get_tile_raw(struct pipe_context *pipe,
+ struct pipe_transfer *pt,
uint x, uint y, uint w, uint h,
void *p, int dst_stride);
void
-pipe_put_tile_raw(struct pipe_transfer *pt,
+pipe_put_tile_raw(struct pipe_context *pipe,
+ struct pipe_transfer *pt,
uint x, uint y, uint w, uint h,
const void *p, int src_stride);
void
-pipe_get_tile_rgba(struct pipe_transfer *pt,
+pipe_get_tile_rgba(struct pipe_context *pipe,
+ struct pipe_transfer *pt,
uint x, uint y, uint w, uint h,
float *p);
void
-pipe_put_tile_rgba(struct pipe_transfer *pt,
+pipe_get_tile_swizzle(struct pipe_context *pipe,
+ struct pipe_transfer *pt,
+ uint x,
+ uint y,
+ uint w,
+ uint h,
+ uint swizzle_r,
+ uint swizzle_g,
+ uint swizzle_b,
+ uint swizzle_a,
+ enum pipe_format format,
+ float *p);
+
+void
+pipe_put_tile_rgba(struct pipe_context *pipe,
+ struct pipe_transfer *pt,
uint x, uint y, uint w, uint h,
const float *p);
void
-pipe_get_tile_z(struct pipe_transfer *pt,
+pipe_get_tile_z(struct pipe_context *pipe,
+ struct pipe_transfer *pt,
uint x, uint y, uint w, uint h,
uint *z);
void
-pipe_put_tile_z(struct pipe_transfer *pt,
+pipe_put_tile_z(struct pipe_context *pipe,
+ struct pipe_transfer *pt,
uint x, uint y, uint w, uint h,
const uint *z);
diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c
index ba23435f69..6d461cb880 100644
--- a/src/gallium/auxiliary/vl/vl_compositor.c
+++ b/src/gallium/auxiliary/vl/vl_compositor.c
@@ -230,6 +230,7 @@ static bool
init_pipe_state(struct vl_compositor *c)
{
struct pipe_sampler_state sampler;
+ struct pipe_vertex_element vertex_elems[2];
assert(c);
@@ -251,15 +252,27 @@ init_pipe_state(struct vl_compositor *c)
/*sampler.border_color[i] = ;*/
/*sampler.max_anisotropy = ;*/
c->sampler = c->pipe->create_sampler_state(c->pipe, &sampler);
-
+
+ vertex_elems[0].src_offset = 0;
+ vertex_elems[0].instance_divisor = 0;
+ vertex_elems[0].vertex_buffer_index = 0;
+ vertex_elems[0].src_format = PIPE_FORMAT_R32G32_FLOAT;
+ vertex_elems[1].src_offset = 0;
+ vertex_elems[1].instance_divisor = 0;
+ vertex_elems[1].vertex_buffer_index = 1;
+ vertex_elems[1].src_format = PIPE_FORMAT_R32G32_FLOAT;
+ c->vertex_elems = c->pipe->create_vertex_elements_state(c->pipe, 2, vertex_elems);
+
+
return true;
}
static void cleanup_pipe_state(struct vl_compositor *c)
{
assert(c);
-
+
c->pipe->delete_sampler_state(c->pipe, c->sampler);
+ c->pipe->delete_vertex_elements_state(c->pipe, c->vertex_elems);
}
static bool
@@ -314,12 +327,6 @@ init_buffers(struct vl_compositor *c)
pipe_buffer_unmap(c->pipe->screen, c->vertex_bufs[0].buffer);
- c->vertex_elems[0].src_offset = 0;
- c->vertex_elems[0].instance_divisor = 0;
- c->vertex_elems[0].vertex_buffer_index = 0;
- c->vertex_elems[0].nr_components = 2;
- c->vertex_elems[0].src_format = PIPE_FORMAT_R32G32_FLOAT;
-
/*
* Create our texcoord buffer and texcoord buffer element
* Texcoord buffer contains the TCs for mapping the rendered surface to the 4 vertices
@@ -344,12 +351,6 @@ init_buffers(struct vl_compositor *c)
pipe_buffer_unmap(c->pipe->screen, c->vertex_bufs[1].buffer);
- c->vertex_elems[1].src_offset = 0;
- c->vertex_elems[1].instance_divisor = 0;
- c->vertex_elems[1].vertex_buffer_index = 1;
- c->vertex_elems[1].nr_components = 2;
- c->vertex_elems[1].src_format = PIPE_FORMAT_R32G32_FLOAT;
-
/*
* Create our vertex shader's constant buffer
* Const buffer contains scaling and translation vectors
@@ -483,7 +484,7 @@ void vl_compositor_render(struct vl_compositor *compositor,
compositor->pipe->bind_vs_state(compositor->pipe, compositor->vertex_shader);
compositor->pipe->bind_fs_state(compositor->pipe, compositor->fragment_shader);
compositor->pipe->set_vertex_buffers(compositor->pipe, 2, compositor->vertex_bufs);
- compositor->pipe->set_vertex_elements(compositor->pipe, 2, compositor->vertex_elems);
+ compositor->pipe->bind_vertex_elements_state(compositor->pipe, compositor->vertex_elems);
compositor->pipe->set_constant_buffer(compositor->pipe, PIPE_SHADER_VERTEX, 0, compositor->vs_const_buf);
compositor->pipe->set_constant_buffer(compositor->pipe, PIPE_SHADER_FRAGMENT, 0, compositor->fs_const_buf);
diff --git a/src/gallium/auxiliary/vl/vl_compositor.h b/src/gallium/auxiliary/vl/vl_compositor.h
index 6a9a3fd7af..51755554da 100644
--- a/src/gallium/auxiliary/vl/vl_compositor.h
+++ b/src/gallium/auxiliary/vl/vl_compositor.h
@@ -43,10 +43,10 @@ struct vl_compositor
void *sampler;
void *vertex_shader;
void *fragment_shader;
+ void *vertex_elems;
struct pipe_viewport_state viewport;
struct pipe_scissor_state scissor;
struct pipe_vertex_buffer vertex_bufs[2];
- struct pipe_vertex_element vertex_elems[2];
struct pipe_buffer *vs_const_buf, *fs_const_buf;
};
diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
index f323de0ea5..beb4722901 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
@@ -680,14 +680,14 @@ xfer_buffers_map(struct vl_mpeg12_mc_renderer *r)
assert(r);
for (i = 0; i < 3; ++i) {
- r->tex_transfer[i] = r->pipe->screen->get_tex_transfer
+ r->tex_transfer[i] = r->pipe->get_tex_transfer
(
- r->pipe->screen, r->textures.all[i],
+ r->pipe, r->textures.all[i],
0, 0, 0, PIPE_TRANSFER_WRITE, 0, 0,
r->textures.all[i]->width0, r->textures.all[i]->height0
);
- r->texels[i] = r->pipe->screen->transfer_map(r->pipe->screen, r->tex_transfer[i]);
+ r->texels[i] = r->pipe->transfer_map(r->pipe, r->tex_transfer[i]);
}
}
@@ -699,8 +699,8 @@ xfer_buffers_unmap(struct vl_mpeg12_mc_renderer *r)
assert(r);
for (i = 0; i < 3; ++i) {
- r->pipe->screen->transfer_unmap(r->pipe->screen, r->tex_transfer[i]);
- r->pipe->screen->tex_transfer_destroy(r->tex_transfer[i]);
+ r->pipe->transfer_unmap(r->pipe, r->tex_transfer[i]);
+ r->pipe->tex_transfer_destroy(r->pipe, r->tex_transfer[i]);
}
}
@@ -708,6 +708,7 @@ static bool
init_pipe_state(struct vl_mpeg12_mc_renderer *r)
{
struct pipe_sampler_state sampler;
+ struct pipe_vertex_element vertex_elems[8];
unsigned filters[5];
unsigned i;
@@ -771,6 +772,59 @@ init_pipe_state(struct vl_mpeg12_mc_renderer *r)
r->samplers.all[i] = r->pipe->create_sampler_state(r->pipe, &sampler);
}
+ /* Position element */
+ vertex_elems[0].src_offset = 0;
+ vertex_elems[0].instance_divisor = 0;
+ vertex_elems[0].vertex_buffer_index = 0;
+ vertex_elems[0].src_format = PIPE_FORMAT_R32G32_FLOAT;
+
+ /* Luma, texcoord element */
+ vertex_elems[1].src_offset = sizeof(struct vertex2f);
+ vertex_elems[1].instance_divisor = 0;
+ vertex_elems[1].vertex_buffer_index = 0;
+ vertex_elems[1].src_format = PIPE_FORMAT_R32G32_FLOAT;
+
+ /* Chroma Cr texcoord element */
+ vertex_elems[2].src_offset = sizeof(struct vertex2f) * 2;
+ vertex_elems[2].instance_divisor = 0;
+ vertex_elems[2].vertex_buffer_index = 0;
+ vertex_elems[2].src_format = PIPE_FORMAT_R32G32_FLOAT;
+
+ /* Chroma Cb texcoord element */
+ vertex_elems[3].src_offset = sizeof(struct vertex2f) * 3;
+ vertex_elems[3].instance_divisor = 0;
+ vertex_elems[3].vertex_buffer_index = 0;
+ vertex_elems[3].src_format = PIPE_FORMAT_R32G32_FLOAT;
+
+ /* First ref surface top field texcoord element */
+ vertex_elems[4].src_offset = 0;
+ vertex_elems[4].instance_divisor = 0;
+ vertex_elems[4].vertex_buffer_index = 1;
+ vertex_elems[4].src_format = PIPE_FORMAT_R32G32_FLOAT;
+
+ /* First ref surface bottom field texcoord element */
+ vertex_elems[5].src_offset = sizeof(struct vertex2f);
+ vertex_elems[5].instance_divisor = 0;
+ vertex_elems[5].vertex_buffer_index = 1;
+ vertex_elems[5].src_format = PIPE_FORMAT_R32G32_FLOAT;
+
+ /* Second ref surface top field texcoord element */
+ vertex_elems[6].src_offset = 0;
+ vertex_elems[6].instance_divisor = 0;
+ vertex_elems[6].vertex_buffer_index = 2;
+ vertex_elems[6].src_format = PIPE_FORMAT_R32G32_FLOAT;
+
+ /* Second ref surface bottom field texcoord element */
+ vertex_elems[7].src_offset = sizeof(struct vertex2f);
+ vertex_elems[7].instance_divisor = 0;
+ vertex_elems[7].vertex_buffer_index = 2;
+ vertex_elems[7].src_format = PIPE_FORMAT_R32G32_FLOAT;
+
+ /* need versions with 4,6 and 8 vertex elems */
+ r->vertex_elems[0] = r->pipe->create_vertex_elements_state(r->pipe, 4, vertex_elems);
+ r->vertex_elems[1] = r->pipe->create_vertex_elements_state(r->pipe, 6, vertex_elems);
+ r->vertex_elems[2] = r->pipe->create_vertex_elements_state(r->pipe, 8, vertex_elems);
+
return true;
}
@@ -783,6 +837,8 @@ cleanup_pipe_state(struct vl_mpeg12_mc_renderer *r)
for (i = 0; i < 5; ++i)
r->pipe->delete_sampler_state(r->pipe, r->samplers.all[i]);
+ for (i = 0; i < 3; i++)
+ r->pipe->delete_vertex_elements_state(r->pipe, r->vertex_elems[i]);
}
static bool
@@ -888,62 +944,6 @@ init_buffers(struct vl_mpeg12_mc_renderer *r)
);
}
- /* Position element */
- r->vertex_elems[0].src_offset = 0;
- r->vertex_elems[0].instance_divisor = 0;
- r->vertex_elems[0].vertex_buffer_index = 0;
- r->vertex_elems[0].nr_components = 2;
- r->vertex_elems[0].src_format = PIPE_FORMAT_R32G32_FLOAT;
-
- /* Luma, texcoord element */
- r->vertex_elems[1].src_offset = sizeof(struct vertex2f);
- r->vertex_elems[1].instance_divisor = 0;
- r->vertex_elems[1].vertex_buffer_index = 0;
- r->vertex_elems[1].nr_components = 2;
- r->vertex_elems[1].src_format = PIPE_FORMAT_R32G32_FLOAT;
-
- /* Chroma Cr texcoord element */
- r->vertex_elems[2].src_offset = sizeof(struct vertex2f) * 2;
- r->vertex_elems[2].instance_divisor = 0;
- r->vertex_elems[2].vertex_buffer_index = 0;
- r->vertex_elems[2].nr_components = 2;
- r->vertex_elems[2].src_format = PIPE_FORMAT_R32G32_FLOAT;
-
- /* Chroma Cb texcoord element */
- r->vertex_elems[3].src_offset = sizeof(struct vertex2f) * 3;
- r->vertex_elems[3].instance_divisor = 0;
- r->vertex_elems[3].vertex_buffer_index = 0;
- r->vertex_elems[3].nr_components = 2;
- r->vertex_elems[3].src_format = PIPE_FORMAT_R32G32_FLOAT;
-
- /* First ref surface top field texcoord element */
- r->vertex_elems[4].src_offset = 0;
- r->vertex_elems[4].instance_divisor = 0;
- r->vertex_elems[4].vertex_buffer_index = 1;
- r->vertex_elems[4].nr_components = 2;
- r->vertex_elems[4].src_format = PIPE_FORMAT_R32G32_FLOAT;
-
- /* First ref surface bottom field texcoord element */
- r->vertex_elems[5].src_offset = sizeof(struct vertex2f);
- r->vertex_elems[5].instance_divisor = 0;
- r->vertex_elems[5].vertex_buffer_index = 1;
- r->vertex_elems[5].nr_components = 2;
- r->vertex_elems[5].src_format = PIPE_FORMAT_R32G32_FLOAT;
-
- /* Second ref surface top field texcoord element */
- r->vertex_elems[6].src_offset = 0;
- r->vertex_elems[6].instance_divisor = 0;
- r->vertex_elems[6].vertex_buffer_index = 2;
- r->vertex_elems[6].nr_components = 2;
- r->vertex_elems[6].src_format = PIPE_FORMAT_R32G32_FLOAT;
-
- /* Second ref surface bottom field texcoord element */
- r->vertex_elems[7].src_offset = sizeof(struct vertex2f);
- r->vertex_elems[7].instance_divisor = 0;
- r->vertex_elems[7].vertex_buffer_index = 2;
- r->vertex_elems[7].nr_components = 2;
- r->vertex_elems[7].src_format = PIPE_FORMAT_R32G32_FLOAT;
-
r->vs_const_buf = pipe_buffer_create
(
r->pipe->screen,
@@ -1307,7 +1307,7 @@ flush(struct vl_mpeg12_mc_renderer *r)
if (num_macroblocks[MACROBLOCK_TYPE_INTRA] > 0) {
r->pipe->set_vertex_buffers(r->pipe, 1, r->vertex_bufs.all);
- r->pipe->set_vertex_elements(r->pipe, 4, r->vertex_elems);
+ r->pipe->bind_vertex_elements_state(r->pipe, r->vertex_elems[0]);
r->pipe->set_fragment_sampler_textures(r->pipe, 3, r->textures.all);
r->pipe->bind_fragment_sampler_states(r->pipe, 3, r->samplers.all);
r->pipe->bind_vs_state(r->pipe, r->i_vs);
@@ -1320,7 +1320,7 @@ flush(struct vl_mpeg12_mc_renderer *r)
if (num_macroblocks[MACROBLOCK_TYPE_FWD_FRAME_PRED] > 0) {
r->pipe->set_vertex_buffers(r->pipe, 2, r->vertex_bufs.all);
- r->pipe->set_vertex_elements(r->pipe, 6, r->vertex_elems);
+ r->pipe->bind_vertex_elements_state(r->pipe, r->vertex_elems[1]);
r->textures.individual.ref[0] = r->past;
r->pipe->set_fragment_sampler_textures(r->pipe, 4, r->textures.all);
r->pipe->bind_fragment_sampler_states(r->pipe, 4, r->samplers.all);
@@ -1334,7 +1334,7 @@ flush(struct vl_mpeg12_mc_renderer *r)
if (false /*num_macroblocks[MACROBLOCK_TYPE_FWD_FIELD_PRED] > 0 */ ) {
r->pipe->set_vertex_buffers(r->pipe, 2, r->vertex_bufs.all);
- r->pipe->set_vertex_elements(r->pipe, 6, r->vertex_elems);
+ r->pipe->bind_vertex_elements_state(r->pipe, r->vertex_elems[1]);
r->textures.individual.ref[0] = r->past;
r->pipe->set_fragment_sampler_textures(r->pipe, 4, r->textures.all);
r->pipe->bind_fragment_sampler_states(r->pipe, 4, r->samplers.all);
@@ -1348,7 +1348,7 @@ flush(struct vl_mpeg12_mc_renderer *r)
if (num_macroblocks[MACROBLOCK_TYPE_BKWD_FRAME_PRED] > 0) {
r->pipe->set_vertex_buffers(r->pipe, 2, r->vertex_bufs.all);
- r->pipe->set_vertex_elements(r->pipe, 6, r->vertex_elems);
+ r->pipe->bind_vertex_elements_state(r->pipe, r->vertex_elems[1]);
r->textures.individual.ref[0] = r->future;
r->pipe->set_fragment_sampler_textures(r->pipe, 4, r->textures.all);
r->pipe->bind_fragment_sampler_states(r->pipe, 4, r->samplers.all);
@@ -1362,7 +1362,7 @@ flush(struct vl_mpeg12_mc_renderer *r)
if (false /*num_macroblocks[MACROBLOCK_TYPE_BKWD_FIELD_PRED] > 0 */ ) {
r->pipe->set_vertex_buffers(r->pipe, 2, r->vertex_bufs.all);
- r->pipe->set_vertex_elements(r->pipe, 6, r->vertex_elems);
+ r->pipe->bind_vertex_elements_state(r->pipe, r->vertex_elems[1]);
r->textures.individual.ref[0] = r->future;
r->pipe->set_fragment_sampler_textures(r->pipe, 4, r->textures.all);
r->pipe->bind_fragment_sampler_states(r->pipe, 4, r->samplers.all);
@@ -1376,7 +1376,7 @@ flush(struct vl_mpeg12_mc_renderer *r)
if (num_macroblocks[MACROBLOCK_TYPE_BI_FRAME_PRED] > 0) {
r->pipe->set_vertex_buffers(r->pipe, 3, r->vertex_bufs.all);
- r->pipe->set_vertex_elements(r->pipe, 8, r->vertex_elems);
+ r->pipe->bind_vertex_elements_state(r->pipe, r->vertex_elems[2]);
r->textures.individual.ref[0] = r->past;
r->textures.individual.ref[1] = r->future;
r->pipe->set_fragment_sampler_textures(r->pipe, 5, r->textures.all);
@@ -1391,7 +1391,7 @@ flush(struct vl_mpeg12_mc_renderer *r)
if (false /*num_macroblocks[MACROBLOCK_TYPE_BI_FIELD_PRED] > 0 */ ) {
r->pipe->set_vertex_buffers(r->pipe, 3, r->vertex_bufs.all);
- r->pipe->set_vertex_elements(r->pipe, 8, r->vertex_elems);
+ r->pipe->bind_vertex_elements_state(r->pipe, r->vertex_elems[2]);
r->textures.individual.ref[0] = r->past;
r->textures.individual.ref[1] = r->future;
r->pipe->set_fragment_sampler_textures(r->pipe, 5, r->textures.all);
diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h
index f00b8c7b8b..a11a3e7307 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h
@@ -66,8 +66,8 @@ struct vl_mpeg12_mc_renderer
struct pipe_buffer *vs_const_buf;
struct pipe_buffer *fs_const_buf;
struct pipe_framebuffer_state fb_state;
- struct pipe_vertex_element vertex_elems[8];
-
+ void *vertex_elems[3];
+
union
{
void *all[5];
diff --git a/src/gallium/docs/d3d11ddi.txt b/src/gallium/docs/d3d11ddi.txt
new file mode 100644
index 0000000000..8f2509ce03
--- /dev/null
+++ b/src/gallium/docs/d3d11ddi.txt
@@ -0,0 +1,492 @@
+This document compares the D3D10/D3D11 device driver interface with Gallium.
+It is written from the perspective of a developer implementing a D3D10/D3D11 driver as a Gallium state tracker.
+
+Note that naming and other cosmetic differences are not noted, since they don't really matter and would severely clutter the document.
+Gallium/OpenGL terminology is used in preference to D3D terminology.
+
+NOTE: this document tries to be complete but most likely isn't fully complete and also not fully correct: please submit patches if you spot anything incorrect
+
+Also note that this is specifically for the DirectX 10/11 Windows Vista/7 DDI interfaces.
+DirectX 9 has both user-mode (for Vista) and kernel mode (pre-Vista) interfaces, but they are significantly different from Gallium due to the presence of a lot of fixed function functionality.
+
+The user-visible DirectX 10/11 interfaces are distinct from the kernel DDI, but they match very closely.
+
+* Accessing Microsoft documentation
+
+See http://msdn.microsoft.com/en-us/library/dd445501.aspx ("D3D11DDI_DEVICEFUNCS") for D3D documentation.
+
+Also see http://download.microsoft.com/download/f/2/d/f2d5ee2c-b7ba-4cd0-9686-b6508b5479a1/direct3d10_web.pdf ("The Direct3D 10 System" by David Blythe) for an introduction to Direct3D 10 and the rationale for its design.
+
+The Windows Driver Kit contains the actual headers, as well as shader bytecode documentation.
+
+To get the headers from Linux, run the following, in a dedicated directory:
+wget http://download.microsoft.com/download/4/A/2/4A25C7D5-EFBE-4182-B6A9-AE6850409A78/GRMWDK_EN_7600_1.ISO
+sudo mount -o loop GRMWDK_EN_7600_1.ISO /mnt/tmp
+cabextract -x /mnt/tmp/wdk/headers_cab001.cab
+rename 's/^_(.*)_[0-9]*$/$1/' *
+sudo umount /mnt/tmp
+
+d3d10umddi.h contains the DDI interface analyzed in this document: note that it is much easier to read this online on MSDN.
+d3d{10,11}TokenizedProgramFormat.hpp contains the shader bytecode definitions: this is not available on MSDN.
+d3d9types.h contains DX9 shader bytecode, and DX9 types
+d3dumddi.h contains the DirectX 9 DDI interface
+
+* Glossary
+
+BC1: DXT1
+BC2: DXT3
+BC3: DXT5
+BC5: RGTC
+BC6H: BPTC float
+BC7: BPTC
+CS = compute shader: OpenCL-like shader
+DS = domain shader: tessellation evaluation shader
+HS = hull shader: tessellation control shader
+IA = input assembler: primitive assembly
+Input layout: vertex elements
+OM = output merger: blender
+PS = pixel shader: fragment shader
+Primitive topology: primitive type
+Resource: buffer or texture
+Shader resource (view): sampler view
+SO = stream out: transform feedback
+Unordered access view: view supporting random read/write access (usually from compute shaders)
+
+* Legend
+
+-: features D3D11 has and Gallium lacks
++: features Gallium has and D3D11 lacks
+!: differences between D3D11 and Gallium
+*: possible improvements to Gallium
+>: references to comparisons of special enumerations
+#: comment
+
+* Gallium functions with no direct D3D10/D3D11 equivalent
+
+clear
+ + Gallium supports clearing both render targets and depth/stencil with a single call
+
+draw_range_elements
+ + Gallium supports indexed draw with explicit range
+
+fence_signalled
+fence_finish
+ + D3D10/D3D11 don't appear to support explicit fencing; queries can often substitute though, and flushing is supported
+
+set_clip_state
+ + Gallium supports fixed function user clip planes, D3D10/D3D11 only support using the vertex shader for them
+
+set_polygon_stipple
+ + Gallium supports polygon stipple
+
+surface_fill
+ + Gallium supports subrectangle fills of surfaces, D3D10 only supports full clears of views
+
+* DirectX 10/11 DDI functions and Gallium equivalents
+
+AbandonCommandList (D3D11 only)
+ - Gallium does not support deferred contexts
+
+CalcPrivateBlendStateSize
+CalcPrivateDepthStencilStateSize
+CalcPrivateDepthStencilViewSize
+CalcPrivateElementLayoutSize
+CalcPrivateGeometryShaderWithStreamOutput
+CalcPrivateOpenedResourceSize
+CalcPrivateQuerySize
+CalcPrivateRasterizerStateSize
+CalcPrivateRenderTargetViewSize
+CalcPrivateResourceSize
+CalcPrivateSamplerSize
+CalcPrivateShaderResourceViewSize
+CalcPrivateShaderSize
+CalcDeferredContextHandleSize (D3D11 only)
+CalcPrivateCommandListSize (D3D11 only)
+CalcPrivateDeferredContextSize (D3D11 only)
+CalcPrivateTessellationShaderSize (D3D11 only)
+CalcPrivateUnorderedAccessViewSize (D3D11 only)
+ ! D3D11 allocates private objects itself, using the size computed here
+ * Gallium could do something similar to be able to put the private data inline into state tracker objects: this would allow them to fit in the same cacheline and improve performance
+
+CheckDeferredContextHandleSizes (D3D11 only)
+ - Gallium does not support deferred contexts
+
+CheckFormatSupport -> screen->is_format_supported
+ ! Gallium passes usages to this function, D3D11 returns them
+ - Gallium does not differentiate between blendable and non-blendable render targets
+ - Gallium lacks multisampled-texture and multisampled-render-target usages
+
+CheckMultisampleQualityLevels
+ * could merge this with is_format_supported
+ - Gallium lacks multisampling support
+
+CommandListExecute (D3D11 only)
+ - Gallium does not support command lists
+
+CopyStructureCount (D3D11 only)
+ - Gallium does not support unordered access views (views that can be written to arbitrarily from compute shaders)
+
+ClearDepthStencilView -> clear
+ClearRenderTargetView -> clear
+ # D3D11 is not totally clear about whether this applies to any view or only a "currently-bound view"
+ + Gallium allows to clear both depth/stencil and render target(s) in a single operation
+ + Gallium supports double-precision depth values (but not rgba values!)
+ * May want to also support double-precision rgba or use "float" for "depth"
+
+ClearUnorderedAccessViewFloat (D3D11 only)
+ClearUnorderedAccessViewUint (D3D11 only)
+ - Gallium does not support unordered access views (views that can be written to arbitrarily from compute shaders)
+
+CreateBlendState (extended in D3D10.1) -> create_blend_state
+ # D3D10 does not support per-RT blend modes (but per-RT blending), only D3D10.1 does
+ - Gallium lacks alpha-to-coverage
+ + Gallium supports logic ops
+ + Gallium supports dithering
+ + Gallium supports using the broadcast alpha component of the blend constant color
+
+CreateCommandList (D3D11 only)
+ - Gallium does not support command lists
+
+CreateComputeShader (D3D11 only)
+ - Gallium does not support compute shaders
+
+CreateDeferredContext (D3D11 only)
+ - Gallium does not support deferred contexts
+
+CreateDomainShader (D3D11 only)
+ - Gallium does not support domain shaders
+
+CreateHullShader (D3D11 only)
+ - Gallium does not support hull shaders
+
+CreateUnorderedAccessView (D3D11 only)
+ - Gallium does not support unordered access views
+
+CreateDepthStencilState -> create_depth_stencil_alpha_state
+ ! D3D11 has both a global stencil enable, and front/back enables; Gallium has only front/back enables
+ + Gallium has per-face writemask/valuemasks, D3D11 uses the same value for back and front
+ + Gallium supports the alpha test, which D3D11 lacks
+
+CreateDepthStencilView -> get_tex_surface
+CreateRenderTargetView -> get_tex_surface
+ ! Gallium merges depthstencil and rendertarget views into pipe_surface, which also doubles as a 2D surface abstraction
+ - lack of texture array support
+ - lack of render-to-buffer support
+ + Gallium supports using 3D texture zslices as a depth/stencil buffer (in theory)
+
+CreateElementLayout -> create_vertex_elements_state
+ ! D3D11 allows sparse vertex elements (via InputRegister); in Gallium they must be specified sequentially
+ ! D3D11 has an extra flag (InputSlotClass) that is the same as instance_divisor == 0
+
+CreateGeometryShader -> create_gs_state
+CreateGeometryShaderWithStreamOutput -> create_gs_state
+CreatePixelShader -> create_fs_state
+CreateVertexShader -> create_vs_state
+ > bytecode is different (see D3d10tokenizedprogramformat.hpp)
+ ! D3D11 describes input/outputs separately from bytecode; Gallium has the tgsi_scan.c module to extract it from TGSI
+ @ TODO: look into DirectX 10/11 semantics specification and bytecode
+
+CheckCounter
+CheckCounterInfo
+CreateQuery -> create_query
+ - Gallium only supports occlusion, primitives generated and primitives emitted queries
+ ! D3D11 implements fences with "event" queries
+ * TIMESTAMP could be implemented as an additional fields for other queries: some cards have hardware support for exactly this
+ * OCCLUSIONPREDICATE is required for the OpenGL v2 occlusion query functionality
+ * others are performance counters, we may want them but they are not critical
+
+CreateRasterizerState
+ - Gallium lacks clamping of polygon offset depth biases
+ - Gallium lacks support to disable depth clipping
+ - Gallium lacks multisampling
+ + Gallium, like OpenGL, supports PIPE_POLYGON_MODE_POINT
+ + Gallium, like OpenGL, supports per-face polygon fill modes
+ + Gallium, like OpenGL, supports culling everything
+ + Gallium, like OpenGL, supports two-side lighting; D3D11 only has the facing attribute
+ + Gallium, like OpenGL, supports per-fill-mode polygon offset enables
+ + Gallium, like OpenGL, supports polygon smoothing
+ + Gallium, like OpenGL, supports polygon stipple
+ + Gallium, like OpenGL, supports point smoothing
+ + Gallium, like OpenGL, supports point sprites
+ + Gallium supports specifying point quad rasterization
+ + Gallium, like OpenGL, supports per-point point size
+ + Gallium, like OpenGL, supports line smoothing
+ + Gallium, like OpenGL, supports line stipple
+ + Gallium supports line last pixel rule specification
+ + Gallium, like OpenGL, supports provoking vertex convention
+ + Gallium supports D3D9 rasterization rules
+ + Gallium supports fixed line width
+ + Gallium supports fixed point size
+
+CreateResource -> texture_create or buffer_create
+ ! D3D11 passes the dimensions of all mipmap levels to the create call, while Gallium has an implicit floor(x/2) rule
+ # Note that hardware often has the implicit rule, so the D3D11 interface seems to make little sense
+ # Also, the D3D11 API does not allow the user to specify mipmap sizes, so this really seems a dubious decision on Microsoft's part
+ - D3D11 supports specifying initial data to write in the resource
+ - Gallium lacks support for stream output buffer usage
+ - Gallium does not support unordered access buffers
+ ! D3D11 specifies mapping flags (i.e. read/write/discard);:it's unclear what they are used for here
+ - D3D11 supports odd things in the D3D10_DDI_RESOURCE_MISC_FLAG enum (D3D10_DDI_RESOURCE_MISC_DISCARD_ON_PRESENT, D3D11_DDI_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS, D3D11_DDI_RESOURCE_MISC_BUFFER_STRUCTURED)
+ - Gallium does not support indirect draw call parameter buffers
+ - Gallium lacks multisampling
+ - Gallium lacks array textures
+ ! D3D11 supports specifying hardware modes and other stuff here for scanout resources
+ + Gallium allows specifying minimum buffer alignment
+ ! D3D11 implements cube maps as 2D array textures
+
+CreateSampler
+ - D3D11 supports a monochrome convolution filter for "text filtering"
+ + Gallium supports non-normalized coordinates
+ + Gallium supports CLAMP, MIRROR_CLAMP and MIRROR_CLAMP_TO_BORDER
+ + Gallium supports setting min/max/mip filters and anisotropy independently
+
+CreateShaderResourceView (extended in D3D10.1) -> create_sampler_view
+ - Gallium lacks sampler views over buffers
+ - Gallium lacks texture arrays, and cube map views over texture arrays
+ + Gallium supports specifying a swizzle
+ ! D3D11 implements "cube views" as views into a 2D array texture
+
+CsSetConstantBuffers (D3D11 only)
+CsSetSamplers (D3D11 only)
+CsSetShader (D3D11 only)
+CsSetShaderResources (D3D11 only)
+CsSetShaderWithIfaces (D3D11 only)
+CsSetUnorderedAccessViews (D3D11 only)
+ - Gallium does not support compute shaders
+
+DestroyBlendState
+DestroyCommandList (D3D11 only)
+DestroyDepthStencilState
+DestroyDepthStencilView
+DestroyDevice
+DestroyElementLayout
+DestroyQuery
+DestroyRasterizerState
+DestroyRenderTargetView
+DestroyResource
+DestroySampler
+DestroyShader
+DestroyShaderResourceView
+DestroyUnorderedAccessView (D3D11 only)
+ # these are trivial
+
+Dispatch (D3D11 only)
+ - Gallium does not support compute shaders
+
+DispatchIndirect (D3D11 only)
+ - Gallium does not support compute shaders
+
+Draw -> draw_arrays
+ ! D3D11 sets primitive modes separately with IaSetTopology: it's not obvious which is better
+
+DrawAuto
+ - Gallium lacks stream out and DrawAuto
+
+DrawIndexed -> draw_elements
+ ! D3D11 sets primitive modes separately with IaSetTopology: it's not obvious which is better
+ * may want to add a separate set_index_buffer
+ - Gallium lacks base vertex for indexed draw calls
+ + D3D11 lacks draw_range_elements functionality, which is required for OpenGL
+
+DrawIndexedInstanced -> draw_elements_instanced
+ ! D3D11 sets primitive modes separately with IaSetTopology: it's not obvious which is better
+ * may want to add a separate set_index_buffer
+ - Gallium lacks base vertex for indexed draw calls
+
+DrawIndexedInstancedIndirect (D3D11 only) -> call draw_elements_instanced multiple times in software
+ # this allows to use an hardware buffer to specify the parameters for multiple draw_elements_instanced calls
+ - Gallium does not support draw call parameter buffers and indirect draw
+
+DrawInstanced -> draw_arrays_instanced
+ ! D3D11 sets primitive modes separately with IaSetTopology: it's not obvious which is better
+
+DrawInstancedIndirect (D3D11 only) -> call draw_arrays_instanced multiple times in software
+ # this allows to use an hardware buffer to specify the parameters for multiple draw_arrays_instanced calls
+ - Gallium does not support draw call parameter buffers and indirect draws
+
+DsSetConstantBuffers (D3D11 only)
+DsSetSamplers (D3D11 only)
+DsSetShader (D3D11 only)
+DsSetShaderResources (D3D11 only)
+DsSetShaderWithIfaces (D3D11 only)
+ - Gallium does not support domain shaders
+
+Flush -> flush
+ ! Gallium supports fencing and several kinds of flushing here, D3D11 just has a dumb glFlush-like function
+
+GenMips
+ - Gallium lacks a mipmap generation interface, and does this manually with the 3D engine
+ * it may be useful to add a mipmap generation interface, since the hardware (especially older cards) may have a better way than using the 3D engine
+
+GsSetConstantBuffers -> for(i = StartBuffer; i < NumBuffers; ++i) set_constant_buffer(PIPE_SHADER_GEOMETRY, i, phBuffers[i])
+
+GsSetSamplers
+ - Gallium does not support sampling in geometry shaders
+
+GsSetShader -> bind_gs_state
+
+GsSetShaderWithIfaces (D3D11 only)
+ - Gallium does not support shader interfaces
+
+GsSetShaderResources
+ - Gallium does not support sampling in geometry shaders
+
+HsSetConstantBuffers (D3D11 only)
+HsSetSamplers (D3D11 only)
+HsSetShader (D3D11 only)
+HsSetShaderResources (D3D11 only)
+HsSetShaderWithIfaces (D3D11 only)
+ - Gallium does not support hull shaders
+
+IaSetIndexBuffer
+ ! Gallium passes this to the draw_elements or draw_elements_instanced calls
+ + Gallium supports 8-bit indices
+ ! the D3D11 interface allows index-size-unaligned byte offsets into index buffers; it's not clear whether they actually work
+
+IaSetInputLayout -> bind_vertex_elements_state
+
+IaSetTopology
+ ! Gallium passes the topology = primitive type to the draw calls
+ * may want to add an interface for this
+ - Gallium lacks support for DirectX 11 tessellated primitives
+ + Gallium supports line loops, triangle fans, quads, quad strips and polygons
+
+IaSetVertexBuffers -> set_vertex_buffers
+ + Gallium allows to specify a max_index here
+ - Gallium only allows setting all vertex buffers at once, while D3D11 supports setting a subset
+
+OpenResource -> texture_from_handle
+
+PsSetConstantBuffers -> for(i = StartBuffer; i < NumBuffers; ++i) set_constant_buffer(PIPE_SHADER_FRAGMENT, i, phBuffers[i])
+ * may want to split into fragment/vertex-specific versions
+
+PsSetSamplers -> bind_fragment_sampler_states
+ * may want to allow binding subsets instead of all at once
+
+PsSetShader -> bind_fs_state
+
+PsSetShaderWithIfaces (D3D11 only)
+ - Gallium does not support shader interfaces
+
+PsSetShaderResources -> set_fragment_sampler_views
+ * may want to allow binding subsets instead of all at once
+
+QueryBegin -> begin_query
+
+QueryEnd -> end_query
+
+QueryGetData -> get_query_result
+ - D3D11 supports reading an arbitrary data chunk for query results, Gallium only supports reading a 64-bit integer
+ + D3D11 doesn't seem to support actually waiting for the query result (?!)
+ - D3D11 supports optionally not flushing command buffers here and instead returning DXGI_DDI_ERR_WASSTILLDRAWING
+
+RecycleCommandList (D3D11 only)
+RecycleCreateCommandList (D3D11 only)
+RecycleDestroyCommandList (D3D11 only)
+ - Gallium does not support command lists
+
+RecycleCreateDeferredContext (D3D11 only)
+ - Gallium does not support deferred contexts
+
+RelocateDeviceFuncs
+ - Gallium does not support moving pipe_context, while D3D11 seems to, using this
+
+ResetPrimitiveID (D3D10.1+ only, #ifdef D3D10PSGP)
+ # used to do vertex processing on the GPU on Intel G45 chipsets when it is faster this way (see www.intel.com/Assets/PDF/whitepaper/322931.pdf)
+ # presumably this resets the primitive id system value
+ - Gallium does not support vertex pipeline bypass anymore
+
+ResourceCopy
+ResourceCopyRegion
+ResourceConvert (D3D10.1+ only)
+ResourceConvertRegion (D3D10.1+ only)
+ -> surface_copy
+ - Gallium does not support hardware buffer copies
+ - Gallium does not support copying 3D texture subregions in a single call
+
+ResourceIsStagingBusy -> is_texture_referenced, is_buffer_referenced
+ - Gallium does not support checking reference for a whole texture, but only a specific surface
+
+ResourceReadAfterWriteHazard
+ ! Gallium specifies hides this, except for the render and texture caches
+
+ResourceResolveSubresource
+ - Gallium does not support multisample sample resolution
+
+ResourceMap
+ResourceUnmap
+DynamicConstantBufferMapDiscard
+DynamicConstantBufferUnmap
+DynamicIABufferMapDiscard
+DynamicIABufferMapNoOverwrite
+DynamicIABufferUnmap
+DynamicResourceMapDiscard
+DynamicResourceUnmap
+StagingResourceMap
+StagingResourceUnmap
+ -> buffer_map / buffer_unmap
+ -> transfer functions
+ ! Gallium and D3D have different semantics for transfers
+ * D3D separates vertex/index buffers from constant buffers
+ ! D3D separates some buffer flags into specialized calls
+
+ResourceUpdateSubresourceUP -> transfer functionality, transfer_inline_write in gallium-resources
+DefaultConstantBufferUpdateSubresourceUP -> transfer functionality, transfer_inline_write in gallium-resources
+
+SetBlendState -> bind_blend_state and set_blend_color
+ ! D3D11 fuses bind_blend_state and set_blend_color in a single function
+ - Gallium lacks the sample mask
+
+SetDepthStencilState -> bind_depth_stencil_alpha_state and set_stencil_ref
+ ! D3D11 fuses bind_depth_stencil_alpha_state and set_stencil_ref in a single function
+
+SetPredication -> render_condition
+ # here both D3D11 and Gallium seem very limited (hardware is too, probably though)
+ # ideally, we should support nested conditional rendering, as well as more complex tests (checking for an arbitrary range, after an AND with arbitrary mask )
+ # of couse, hardware support is probably as limited as OpenGL/D3D11
+ + Gallium, like NV_conditional_render, supports by-region and wait flags
+ - D3D11 supports predication conditional on being equal any value (along with occlusion predicates); Gallium only supports on non-zero
+
+SetRasterizerState -> bind_rasterizer_state
+
+SetRenderTargets (extended in D3D11) -> set_framebuffer_state
+ ! Gallium passed a width/height here, D3D11 does not
+ ! Gallium lacks ClearTargets (but this is redundant and the driver can trivially compute this if desired)
+ - Gallium does not support unordered access views
+ - Gallium does not support geometry shader selection of texture array image / 3D texture zslice
+
+SetResourceMinLOD (D3D11 only)
+ - Gallium does not support min lod directly on textures
+
+SetScissorRects
+ - Gallium lacks support for multiple geometry-shader-selectable scissor rectangles D3D11 has
+
+SetTextFilterSize
+ - Gallium lacks support for text filters
+
+SetVertexPipelineOutput (D3D10.1+ only)
+ # used to do vertex processing on the GPU on Intel G45 chipsets when it is faster this way (see www.intel.com/Assets/PDF/whitepaper/322931.pdf)
+ - Gallium does not support vertex pipeline bypass anymore
+
+SetViewports
+ - Gallium lacks support for multiple geometry-shader-selectable viewports D3D11 has
+
+ShaderResourceViewReadAfterWriteHazard -> flush(PIPE_FLUSH_RENDER_CACHE)
+ - Gallium does not support specifying this per-render-target/view
+
+SoSetTargets
+ - Gallium does not support stream out
+
+VsSetConstantBuffers -> for(i = StartBuffer; i < NumBuffers; ++i) set_constant_buffer(PIPE_SHADER_VERTEX, i, phBuffers[i])
+ * may want to split into fragment/vertex-specific versions
+
+VsSetSamplers -> bind_vertex_sampler_states
+ * may want to allow binding subsets instead of all at once
+
+VsSetShader -> bind_vs_state
+
+VsSetShaderWithIfaces (D3D11 only)
+ - Gallium does not support shader interfaces
+
+VsSetShaderResources -> set_fragment_sampler_views
+ * may want to allow binding subsets instead of all at once
diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst
index 9080addba4..2b0941010b 100644
--- a/src/gallium/docs/source/context.rst
+++ b/src/gallium/docs/source/context.rst
@@ -24,6 +24,7 @@ CSO objects handled by the context object:
* :ref:`Depth, Stencil, & Alpha`: ``*_depth_stencil_alpha_state``
* :ref:`Shader`: These have two sets of methods. ``*_fs_state`` is for
fragment shaders, and ``*_vs_state`` is for vertex shaders.
+* :ref:`Vertex Elements`: ``*_vertex_elements_state``
Resource Binding State
@@ -39,8 +40,7 @@ buffers, surfaces) are bound to the driver.
are mostly restricted to the first one right now).
* ``set_framebuffer_state``
-* ``set_fragment_sampler_textures``
-* ``set_vertex_sampler_textures``
+
* ``set_vertex_buffers``
@@ -50,6 +50,7 @@ Non-CSO State
These pieces of state are too small, variable, and/or trivial to have CSO
objects. They all follow simple, one-method binding calls, e.g.
``set_blend_color``.
+
* ``set_stencil_ref`` sets the stencil front and back reference values
which are used as comparison values in stencil test.
* ``set_blend_color``
@@ -60,7 +61,41 @@ objects. They all follow simple, one-method binding calls, e.g.
not have the scissor test enabled, then the scissor bounds never need to
be set since they will not be used.
* ``set_viewport_state``
-* ``set_vertex_elements``
+
+
+Sampler Views
+^^^^^^^^^^^^^
+
+These are the means to bind textures to shader stages. To create one, specify
+its format, swizzle and LOD range in sampler view template.
+
+If texture format is different than template format, it is said the texture
+is being cast to another format. Casting can be done only between compatible
+formats, that is formats that have matching component order and sizes.
+
+Swizzle fields specify they way in which fetched texel components are placed
+in the result register. For example, ``swizzle_r`` specifies what is going to be
+placed in first component of result register.
+
+The ``first_level`` and ``last_level`` fields of sampler view template specify
+the LOD range the texture is going to be constrained to.
+
+* ``set_fragment_sampler_views`` binds an array of sampler views to
+ fragment shader stage. Every binding point acquires a reference
+ to a respective sampler view and releases a reference to the previous
+ sampler view.
+
+* ``set_vertex_sampler_views`` binds an array of sampler views to vertex
+ shader stage. Every binding point acquires a reference to a respective
+ sampler view and releases a reference to the previous sampler view.
+
+* ``create_sampler_view`` creates a new sampler view. ``texture`` is associated
+ with the sampler view which results in sampler view holding a reference
+ to the texture. Format specified in template must be compatible
+ with texture format.
+
+* ``sampler_view_destroy`` destroys a sampler view and releases its reference
+ to associated texture.
Clearing
diff --git a/src/gallium/docs/source/cso/blend.rst b/src/gallium/docs/source/cso/blend.rst
index 55c0f32885..c74396284c 100644
--- a/src/gallium/docs/source/cso/blend.rst
+++ b/src/gallium/docs/source/cso/blend.rst
@@ -28,7 +28,7 @@ logicop_enable
logicop_func
The logic operation to use if logic ops are enabled. One of PIPE_LOGICOP.
dither
- Whether dithering is enabled.
+ Whether dithering is enabled. Note: Dithering is implementation-dependent.
rt
Contains the per-rendertarget blend state.
diff --git a/src/gallium/docs/source/cso/rasterizer.rst b/src/gallium/docs/source/cso/rasterizer.rst
index ccd9136a2e..56a601a8d0 100644
--- a/src/gallium/docs/source/cso/rasterizer.rst
+++ b/src/gallium/docs/source/cso/rasterizer.rst
@@ -7,7 +7,7 @@ The rasterizer state controls the rendering of points, lines and triangles.
Attributes include polygon culling state, line width, line stipple,
multisample state, scissoring and flat/smooth shading.
-Members
+Shading
-------
flatshade
@@ -46,6 +46,49 @@ There are several important exceptions to the specification of this rule.
second vertex, not the first. This permits each segment of the fan to have
a different color.
+Points
+------
+
+sprite_coord_enable
+^^^^^^^^^^^^^^^^^^^
+
+Specifies if a texture unit has its texture coordinates replaced or not. This
+is a packed bitfield containing the enable for all texcoords -- if all bits
+are zero, point sprites are effectively disabled. If any bit is set, then
+point_smooth and point_quad_rasterization are ignored; point smoothing is
+disabled and points are always rasterized as quads. If enabled, the four
+vertices of the resulting quad will be assigned texture coordinates,
+according to sprite_coord_mode.
+
+sprite_coord_mode
+^^^^^^^^^^^^^^^^^
+
+Specifies how the value for each shader output should be computed when drawing
+point sprites. For PIPE_SPRITE_COORD_LOWER_LEFT, the lower-left vertex will
+have coordinates (0,0,0,1). For PIPE_SPRITE_COORD_UPPER_LEFT, the upper-left
+vertex will have coordinates (0,0,0,1).
+This state is used by :ref:`Draw` to generate texcoords.
+
+.. note::
+
+ When geometry shaders are available, a special geometry shader could be
+ used instead of this functionality, to convert incoming points into quads
+ with the proper texture coordinates.
+
+point_quad_rasterization
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+Determines if points should be rasterized as quads or points. Certain APIs,
+like Direct3D, always use quad rasterization for points, regardless of
+whether point sprites are enabled or not. If this state is enabled, point
+smoothing and antialiasing are disabled. If it is disabled, point sprite
+coordinates are not generated.
+
+.. note::
+
+ Some renderers always internally translate points into quads; this state
+ still affects those renderers by overriding other rasterization state.
+
Other Members
^^^^^^^^^^^^^
@@ -107,37 +150,6 @@ point_size_per_vertex
Whether vertices have a point size element.
point_size
The size of points, if not specified per-vertex.
-sprite_coord_enable
- Specifies if a coord has its texture coordinates replaced or not. This
- is a packed bitfield containing the enable for all coords - if all are 0
- point sprites are effectively disabled, though points may still be
- rendered slightly different according to point_quad_rasterization.
- If any coord is non-zero, point_smooth should be disabled, and
- point_quad_rasterization enabled.
- If enabled, the four vertices of the resulting quad will be assigned
- texture coordinates, according to sprite_coord_mode.
-sprite_coord_mode
- Specifies how the value for each shader output should be computed when
- drawing sprites, for each coord which has sprite_coord_enable set.
- For PIPE_SPRITE_COORD_LOWER_LEFT, the lower left vertex will have
- coordinate (0,0,0,1).
- For PIPE_SPRITE_COORD_UPPER_LEFT, the upper-left vertex will have
- coordinate (0,0,0,1).
- This state is needed by :ref:`Draw` because that's where each
- point vertex is converted into four quad vertices. There's no other
- place to emit the new vertex texture coordinates which are required for
- sprite rendering.
- Note that when geometry shaders are available, this state could be
- removed. A special geometry shader defined by the state tracker could
- convert the incoming points into quads with the proper texture coords.
-point_quad_rasterization
- This determines if points should be rasterized as quads or points.
- d3d always uses quad rasterization for points, regardless if point sprites
- are enabled or not, but OGL has different rules. If point_quad_rasterization
- is set, point_smooth should be disabled, and points will be rendered as
- squares even if multisample is enabled.
- sprite_coord_enable should be zero if point_quad_rasterization is not
- enabled.
scissor
Whether the scissor test is enabled.
diff --git a/src/gallium/docs/source/cso/velems.rst b/src/gallium/docs/source/cso/velems.rst
new file mode 100644
index 0000000000..92cde014fb
--- /dev/null
+++ b/src/gallium/docs/source/cso/velems.rst
@@ -0,0 +1,24 @@
+.. _vertexelements:
+
+Vertex Elements
+===============
+
+This state controls format etc. of the input attributes contained
+in the pipe_vertex_buffer(s). There's one pipe_vertex_element array member
+for each input attribute.
+
+Members
+-------
+
+src_offset
+ The byte offset of the attribute in the buffer given by
+ vertex_buffer_index for the first vertex.
+instance_divisor
+ The instance data rate divisor, used for instancing.
+ 0 means this is per-vertex data, n means per-instance data used for
+ n consecutive instances (n > 0).
+vertex_buffer_index
+ The vertex buffer this attribute lives in. Several attributes may
+ live in the same vertex buffer.
+src_format
+ The format of the attribute data. One of the PIPE_FORMAT tokens.
diff --git a/src/gallium/drivers/cell/ppu/Makefile b/src/gallium/drivers/cell/ppu/Makefile
index c92f8e5cba..8769b826b5 100644
--- a/src/gallium/drivers/cell/ppu/Makefile
+++ b/src/gallium/drivers/cell/ppu/Makefile
@@ -21,6 +21,7 @@ SPU_CODE_MODULE = ../spu/g3d_spu.a
SOURCES = \
cell_batch.c \
+ cell_buffer.c \
cell_clear.c \
cell_context.c \
cell_draw_arrays.c \
diff --git a/src/gallium/drivers/cell/ppu/cell_buffer.c b/src/gallium/drivers/cell/ppu/cell_buffer.c
new file mode 100644
index 0000000000..f56a28d62e
--- /dev/null
+++ b/src/gallium/drivers/cell/ppu/cell_buffer.c
@@ -0,0 +1,118 @@
+/**************************************************************************
+ *
+ * Copyright 2009 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+
+#include "util/u_inlines.h"
+#include "util/u_memory.h"
+#include "util/u_math.h"
+
+#include "cell_screen.h"
+#include "cell_buffer.h"
+
+
+static void *
+cell_buffer_map(struct pipe_screen *screen,
+ struct pipe_buffer *buf,
+ unsigned flags)
+{
+ struct cell_buffer *cell_buf = cell_buffer(buf);
+ return cell_buf->data;
+}
+
+
+static void
+cell_buffer_unmap(struct pipe_screen *screen,
+ struct pipe_buffer *buf)
+{
+}
+
+
+static void
+cell_buffer_destroy(struct pipe_buffer *buf)
+{
+ struct cell_buffer *sbuf = cell_buffer(buf);
+
+ if (!sbuf->userBuffer)
+ align_free(sbuf->data);
+
+ FREE(sbuf);
+}
+
+
+static struct pipe_buffer *
+cell_buffer_create(struct pipe_screen *screen,
+ unsigned alignment,
+ unsigned usage,
+ unsigned size)
+{
+ struct cell_buffer *buffer = CALLOC_STRUCT(cell_buffer);
+
+ pipe_reference_init(&buffer->base.reference, 1);
+ buffer->base.screen = screen;
+ buffer->base.alignment = MAX2(alignment, 16);
+ buffer->base.usage = usage;
+ buffer->base.size = size;
+
+ buffer->data = align_malloc(size, alignment);
+
+ return &buffer->base;
+}
+
+
+/**
+ * Create buffer which wraps user-space data.
+ */
+static struct pipe_buffer *
+cell_user_buffer_create(struct pipe_screen *screen,
+ void *ptr,
+ unsigned bytes)
+{
+ struct cell_buffer *buffer;
+
+ buffer = CALLOC_STRUCT(cell_buffer);
+ if(!buffer)
+ return NULL;
+
+ pipe_reference_init(&buffer->base.reference, 1);
+ buffer->base.screen = screen;
+ buffer->base.size = bytes;
+ buffer->userBuffer = TRUE;
+ buffer->data = ptr;
+
+ return &buffer->base;
+}
+
+
+void
+cell_init_screen_buffer_funcs(struct pipe_screen *screen)
+{
+ screen->buffer_create = cell_buffer_create;
+ screen->user_buffer_create = cell_user_buffer_create;
+ screen->buffer_map = cell_buffer_map;
+ screen->buffer_unmap = cell_buffer_unmap;
+ screen->buffer_destroy = cell_buffer_destroy;
+}
diff --git a/src/gallium/drivers/cell/ppu/cell_buffer.h b/src/gallium/drivers/cell/ppu/cell_buffer.h
new file mode 100644
index 0000000000..ef0a8a70e5
--- /dev/null
+++ b/src/gallium/drivers/cell/ppu/cell_buffer.h
@@ -0,0 +1,55 @@
+/**************************************************************************
+ *
+ * Copyright 2009 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef SP_BUFFER_H
+#define SP_BUFFER_H
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_state.h"
+
+
+struct cell_buffer
+{
+ struct pipe_buffer base;
+ boolean userBuffer; /** Is this a user-space buffer? */
+ void *data;
+};
+
+
+/** Cast wrapper */
+static INLINE struct cell_buffer *
+cell_buffer( struct pipe_buffer *buf )
+{
+ return (struct cell_buffer *)buf;
+}
+
+
+void
+cell_init_screen_buffer_funcs(struct pipe_screen *screen);
+
+
+#endif /* SP_BUFFER_H */
diff --git a/src/gallium/drivers/cell/ppu/cell_context.c b/src/gallium/drivers/cell/ppu/cell_context.c
index 5bff9869fd..f6cb1fc9be 100644
--- a/src/gallium/drivers/cell/ppu/cell_context.c
+++ b/src/gallium/drivers/cell/ppu/cell_context.c
@@ -36,7 +36,6 @@
#include "pipe/p_defines.h"
#include "pipe/p_format.h"
#include "util/u_memory.h"
-#include "util/u_simple_screen.h"
#include "pipe/p_screen.h"
#include "draw/draw_context.h"
@@ -137,7 +136,7 @@ cell_create_context(struct pipe_screen *screen,
memset(cell, 0, sizeof(*cell));
cell->winsys = NULL; /* XXX: fixme - get this from screen? */
- cell->pipe.winsys = screen->winsys;
+ cell->pipe.winsys = NULL;
cell->pipe.screen = screen;
cell->pipe.priv = priv;
cell->pipe.destroy = cell_destroy_context;
@@ -159,6 +158,7 @@ cell_create_context(struct pipe_screen *screen,
cell_init_shader_functions(cell);
cell_init_surface_functions(cell);
cell_init_vertex_functions(cell);
+ cell_init_texture_transfer_funcs(cell);
cell->draw = cell_draw_create(cell);
diff --git a/src/gallium/drivers/cell/ppu/cell_context.h b/src/gallium/drivers/cell/ppu/cell_context.h
index a77cc5b906..f7e2284445 100644
--- a/src/gallium/drivers/cell/ppu/cell_context.h
+++ b/src/gallium/drivers/cell/ppu/cell_context.h
@@ -34,7 +34,7 @@
#include "pipe/p_defines.h"
#include "draw/draw_vertex.h"
#include "draw/draw_vbuf.h"
-#include "cell_winsys.h"
+/*#include "cell_winsys.h"*/
#include "cell/common.h"
#include "rtasm/rtasm_ppc_spe.h"
#include "tgsi/tgsi_scan.h"
@@ -93,6 +93,11 @@ struct cell_buffer_list
struct cell_buffer_node *head;
};
+struct cell_velems_state
+{
+ unsigned count;
+ struct pipe_vertex_element velem[PIPE_MAX_ATTRIBS];
+};
/**
* Per-context state, subclass of pipe_context.
@@ -110,6 +115,7 @@ struct cell_context
const struct pipe_rasterizer_state *rasterizer;
const struct cell_vertex_shader_state *vs;
const struct cell_fragment_shader_state *fs;
+ const struct cell_velems_state *velems;
struct spe_function logic_op;
@@ -121,12 +127,11 @@ struct cell_context
struct pipe_poly_stipple poly_stipple;
struct pipe_scissor_state scissor;
struct cell_texture *texture[PIPE_MAX_SAMPLERS];
+ struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS];
uint num_textures;
struct pipe_viewport_state viewport;
struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
uint num_vertex_buffers;
- struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS];
- uint num_vertex_elements;
ubyte *cbuf_map[PIPE_MAX_COLOR_BUFS];
ubyte *zsbuf_map;
diff --git a/src/gallium/drivers/cell/ppu/cell_draw_arrays.c b/src/gallium/drivers/cell/ppu/cell_draw_arrays.c
index bffd0fac6f..15d4e8338f 100644
--- a/src/gallium/drivers/cell/ppu/cell_draw_arrays.c
+++ b/src/gallium/drivers/cell/ppu/cell_draw_arrays.c
@@ -33,48 +33,18 @@
#include "pipe/p_defines.h"
#include "pipe/p_context.h"
-#include "util/u_simple_screen.h"
#include "util/u_inlines.h"
#include "cell_context.h"
#include "cell_draw_arrays.h"
#include "cell_state.h"
#include "cell_flush.h"
+#include "cell_buffer.h"
#include "draw/draw_context.h"
-static void
-cell_map_constant_buffers(struct cell_context *sp)
-{
- struct pipe_winsys *ws = sp->pipe.winsys;
- uint i;
- for (i = 0; i < 2; i++) {
- if (sp->constants[i] && sp->constants[i]->size) {
- sp->mapped_constants[i] = ws->buffer_map(ws, sp->constants[i],
- PIPE_BUFFER_USAGE_CPU_READ);
- cell_flush_buffer_range(sp, sp->mapped_constants[i],
- sp->constants[i]->size);
- }
- }
-
- draw_set_mapped_constant_buffer(sp->draw, PIPE_SHADER_VERTEX, 0,
- sp->mapped_constants[PIPE_SHADER_VERTEX],
- sp->constants[PIPE_SHADER_VERTEX]->size);
-}
-
-static void
-cell_unmap_constant_buffers(struct cell_context *sp)
-{
- struct pipe_winsys *ws = sp->pipe.winsys;
- uint i;
- for (i = 0; i < 2; i++) {
- if (sp->constants[i] && sp->constants[i]->size)
- ws->buffer_unmap(ws, sp->constants[i]);
- sp->mapped_constants[i] = NULL;
- }
-}
@@ -93,33 +63,27 @@ cell_draw_range_elements(struct pipe_context *pipe,
unsigned max_index,
unsigned mode, unsigned start, unsigned count)
{
- struct cell_context *sp = cell_context(pipe);
- struct draw_context *draw = sp->draw;
+ struct cell_context *cell = cell_context(pipe);
+ struct draw_context *draw = cell->draw;
unsigned i;
- if (sp->dirty)
- cell_update_derived( sp );
+ if (cell->dirty)
+ cell_update_derived( cell );
#if 0
- cell_map_surfaces(sp);
+ cell_map_surfaces(cell);
#endif
- cell_map_constant_buffers(sp);
/*
* Map vertex buffers
*/
- for (i = 0; i < sp->num_vertex_buffers; i++) {
- void *buf = pipe_buffer_map(pipe->screen,
- sp->vertex_buffer[i].buffer,
- PIPE_BUFFER_USAGE_CPU_READ);
- cell_flush_buffer_range(sp, buf, sp->vertex_buffer[i].buffer->size);
+ for (i = 0; i < cell->num_vertex_buffers; i++) {
+ void *buf = cell_buffer(cell->vertex_buffer[i].buffer)->data;
draw_set_mapped_vertex_buffer(draw, i, buf);
}
/* Map index buffer, if present */
if (indexBuffer) {
- void *mapped_indexes = pipe_buffer_map(pipe->screen,
- indexBuffer,
- PIPE_BUFFER_USAGE_CPU_READ);
+ void *mapped_indexes = cell_buffer(indexBuffer)->data;
draw_set_mapped_element_buffer(draw, indexSize, mapped_indexes);
}
else {
@@ -134,17 +98,19 @@ cell_draw_range_elements(struct pipe_context *pipe,
/*
* unmap vertex/index buffers - will cause draw module to flush
*/
- for (i = 0; i < sp->num_vertex_buffers; i++) {
+ for (i = 0; i < cell->num_vertex_buffers; i++) {
draw_set_mapped_vertex_buffer(draw, i, NULL);
- pipe_buffer_unmap(pipe->screen, sp->vertex_buffer[i].buffer);
}
if (indexBuffer) {
draw_set_mapped_element_buffer(draw, 0, NULL);
- pipe_buffer_unmap(pipe->screen, indexBuffer);
}
- /* Note: leave drawing surfaces mapped */
- cell_unmap_constant_buffers(sp);
+ /*
+ * TODO: Flush only when a user vertex/index buffer is present
+ * (or even better, modify draw module to do this
+ * internally when this condition is seen?)
+ */
+ draw_flush(draw);
}
diff --git a/src/gallium/drivers/cell/ppu/cell_fence.c b/src/gallium/drivers/cell/ppu/cell_fence.c
index e10071529a..035ef41b89 100644
--- a/src/gallium/drivers/cell/ppu/cell_fence.c
+++ b/src/gallium/drivers/cell/ppu/cell_fence.c
@@ -92,7 +92,6 @@ cell_add_buffer_to_list(struct cell_context *cell,
struct cell_buffer_list *list,
struct pipe_buffer *buffer)
{
- struct pipe_screen *ps = cell->pipe.screen;
struct cell_buffer_node *node = CALLOC_STRUCT(cell_buffer_node);
/* create new list node which references the buffer, insert at head */
if (node) {
@@ -157,8 +156,13 @@ cell_add_fenced_textures(struct cell_context *cell)
printf("Adding texture %p buffer %p to list\n",
ct, ct->tiled_buffer[level]);
#endif
- if (ct->buffer)
+#if 00
+ /* XXX this needs to be fixed/restored!
+ * Maybe keep pointers to textures, not buffers.
+ */
+ if (ct->base.buffer)
cell_add_buffer_to_list(cell, list, ct->buffer);
+#endif
}
}
}
diff --git a/src/gallium/drivers/cell/ppu/cell_gen_fragment.c b/src/gallium/drivers/cell/ppu/cell_gen_fragment.c
index c54576b3c3..628bc1c694 100644
--- a/src/gallium/drivers/cell/ppu/cell_gen_fragment.c
+++ b/src/gallium/drivers/cell/ppu/cell_gen_fragment.c
@@ -1859,7 +1859,7 @@ gen_depth_stencil(struct cell_context *cell,
spe_comment(f, 0, "Fetch Z/stencil quad from tile");
switch(zs_format) {
- case PIPE_FORMAT_Z24S8_UNORM: /* fall through */
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED: /* fall through */
case PIPE_FORMAT_Z24X8_UNORM:
/* prepare mask to extract Z vals from ZS vals */
spe_load_uint(f, zmask_reg, 0x00ffffff);
@@ -1880,7 +1880,7 @@ gen_depth_stencil(struct cell_context *cell,
spe_rotmi(f, fbS_reg, fbZS_reg, -24);
break;
- case PIPE_FORMAT_S8Z24_UNORM: /* fall through */
+ case PIPE_FORMAT_S8_USCALED_Z24_UNORM: /* fall through */
case PIPE_FORMAT_X8Z24_UNORM:
/* convert fragment Z from [0,1] to 32-bit ints */
spe_cfltu(f, fragZ_reg, fragZ_reg, 32);
@@ -1969,12 +1969,12 @@ gen_depth_stencil(struct cell_context *cell,
* fbS_reg has four 8-bit Z values in bits [7..0].
*/
spe_comment(f, 0, "Store quad's depth/stencil values in tile");
- if (zs_format == PIPE_FORMAT_Z24S8_UNORM ||
+ if (zs_format == PIPE_FORMAT_Z24_UNORM_S8_USCALED ||
zs_format == PIPE_FORMAT_Z24X8_UNORM) {
spe_shli(f, fbS_reg, fbS_reg, 24); /* fbS = fbS << 24 */
spe_or(f, fbZS_reg, fbS_reg, fbZ_reg); /* fbZS = fbS | fbZ */
}
- else if (zs_format == PIPE_FORMAT_S8Z24_UNORM ||
+ else if (zs_format == PIPE_FORMAT_S8_USCALED_Z24_UNORM ||
zs_format == PIPE_FORMAT_X8Z24_UNORM) {
spe_shli(f, fbZ_reg, fbZ_reg, 8); /* fbZ = fbZ << 8 */
spe_or(f, fbZS_reg, fbS_reg, fbZ_reg); /* fbZS = fbS | fbZ */
@@ -1985,7 +1985,7 @@ gen_depth_stencil(struct cell_context *cell,
else if (zs_format == PIPE_FORMAT_Z16_UNORM) {
spe_move(f, fbZS_reg, fbZ_reg); /* fbZS = fbZ */
}
- else if (zs_format == PIPE_FORMAT_S8_UNORM) {
+ else if (zs_format == PIPE_FORMAT_S8_USCALED) {
ASSERT(0); /* XXX to do */
}
else {
@@ -2015,7 +2015,7 @@ gen_depth_stencil(struct cell_context *cell,
* code before the fragment shader to cull fragments/quads that are
* totally occluded/discarded.
*
- * XXX we only support PIPE_FORMAT_S8Z24_UNORM z/stencil buffer right now.
+ * XXX we only support PIPE_FORMAT_S8_USCALED_Z24_UNORM z/stencil buffer right now.
*
* See the spu_default_fragment_ops() function to see how the per-fragment
* operations would be done with ordinary C code.
diff --git a/src/gallium/drivers/cell/ppu/cell_pipe_state.c b/src/gallium/drivers/cell/ppu/cell_pipe_state.c
index 3d8b4409c7..059ce8597b 100644
--- a/src/gallium/drivers/cell/ppu/cell_pipe_state.c
+++ b/src/gallium/drivers/cell/ppu/cell_pipe_state.c
@@ -257,8 +257,9 @@ cell_delete_sampler_state(struct pipe_context *pipe,
static void
-cell_set_sampler_textures(struct pipe_context *pipe,
- unsigned num, struct pipe_texture **texture)
+cell_set_fragment_sampler_views(struct pipe_context *pipe,
+ unsigned num,
+ struct pipe_sampler_view **views)
{
struct cell_context *cell = cell_context(pipe);
uint i, changed = 0x0;
@@ -266,10 +267,14 @@ cell_set_sampler_textures(struct pipe_context *pipe,
assert(num <= CELL_MAX_SAMPLERS);
for (i = 0; i < CELL_MAX_SAMPLERS; i++) {
- struct cell_texture *new_tex = cell_texture(i < num ? texture[i] : NULL);
- struct cell_texture *old_tex = cell->texture[i];
- if (old_tex != new_tex) {
+ struct pipe_sampler_view *new_view = i < num ? views[i] : NULL;
+ struct pipe_sampler_view *old_view = cell->fragment_sampler_views[i];
+ if (old_view != new_view) {
+ struct pipe_texture *new_tex = new_view ? new_view->texture : NULL;
+
+ pipe_sampler_view_reference(&cell->fragment_sampler_views[i],
+ views[i]);
pipe_texture_reference((struct pipe_texture **) &cell->texture[i],
(struct pipe_texture *) new_tex);
@@ -286,23 +291,57 @@ cell_set_sampler_textures(struct pipe_context *pipe,
}
+static struct pipe_sampler_view *
+cell_create_sampler_view(struct pipe_context *pipe,
+ struct pipe_texture *texture,
+ const struct pipe_sampler_view *templ)
+{
+ struct pipe_sampler_view *view = CALLOC_STRUCT(pipe_sampler_view);
+
+ if (view) {
+ *view = *templ;
+ view->reference.count = 1;
+ view->texture = NULL;
+ pipe_texture_reference(&view->texture, texture);
+ view->context = pipe;
+ }
+
+ return view;
+}
+
+
+static void
+cell_sampler_view_destroy(struct pipe_context *pipe,
+ struct pipe_sampler_view *view)
+{
+ pipe_texture_reference(&view->texture, NULL);
+ FREE(view);
+}
+
+
/**
* Map color and z/stencil framebuffer surfaces.
*/
static void
cell_map_surfaces(struct cell_context *cell)
{
+#if 0
struct pipe_screen *screen = cell->pipe.screen;
+#endif
uint i;
for (i = 0; i < 1; i++) {
struct pipe_surface *ps = cell->framebuffer.cbufs[i];
if (ps) {
struct cell_texture *ct = cell_texture(ps->texture);
+#if 0
cell->cbuf_map[i] = screen->buffer_map(screen,
ct->buffer,
(PIPE_BUFFER_USAGE_GPU_READ |
PIPE_BUFFER_USAGE_GPU_WRITE));
+#else
+ cell->cbuf_map[i] = ct->data;
+#endif
}
}
@@ -310,10 +349,14 @@ cell_map_surfaces(struct cell_context *cell)
struct pipe_surface *ps = cell->framebuffer.zsbuf;
if (ps) {
struct cell_texture *ct = cell_texture(ps->texture);
+#if 0
cell->zsbuf_map = screen->buffer_map(screen,
ct->buffer,
(PIPE_BUFFER_USAGE_GPU_READ |
PIPE_BUFFER_USAGE_GPU_WRITE));
+#else
+ cell->zsbuf_map = ct->data;
+#endif
}
}
}
@@ -325,17 +368,17 @@ cell_map_surfaces(struct cell_context *cell)
static void
cell_unmap_surfaces(struct cell_context *cell)
{
- struct pipe_screen *screen = cell->pipe.screen;
+ /*struct pipe_screen *screen = cell->pipe.screen;*/
uint i;
for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
struct pipe_surface *ps = cell->framebuffer.cbufs[i];
if (ps && cell->cbuf_map[i]) {
- struct cell_texture *ct = cell_texture(ps->texture);
+ /*struct cell_texture *ct = cell_texture(ps->texture);*/
assert(ps->texture);
- assert(ct->buffer);
+ /*assert(ct->buffer);*/
- screen->buffer_unmap(screen, ct->buffer);
+ /*screen->buffer_unmap(screen, ct->buffer);*/
cell->cbuf_map[i] = NULL;
}
}
@@ -343,8 +386,8 @@ cell_unmap_surfaces(struct cell_context *cell)
{
struct pipe_surface *ps = cell->framebuffer.zsbuf;
if (ps && cell->zsbuf_map) {
- struct cell_texture *ct = cell_texture(ps->texture);
- screen->buffer_unmap(screen, ct->buffer);
+ /*struct cell_texture *ct = cell_texture(ps->texture);*/
+ /*screen->buffer_unmap(screen, ct->buffer);*/
cell->zsbuf_map = NULL;
}
}
@@ -399,7 +442,9 @@ cell_init_state_functions(struct cell_context *cell)
cell->pipe.bind_fragment_sampler_states = cell_bind_sampler_states;
cell->pipe.delete_sampler_state = cell_delete_sampler_state;
- cell->pipe.set_fragment_sampler_textures = cell_set_sampler_textures;
+ cell->pipe.set_fragment_sampler_views = cell_set_fragment_sampler_views;
+ cell->pipe.create_sampler_view = cell_create_sampler_view;
+ cell->pipe.sampler_view_destroy = cell_sampler_view_destroy;
cell->pipe.create_depth_stencil_alpha_state = cell_create_depth_stencil_alpha_state;
cell->pipe.bind_depth_stencil_alpha_state = cell_bind_depth_stencil_alpha_state;
diff --git a/src/gallium/drivers/cell/ppu/cell_public.h b/src/gallium/drivers/cell/ppu/cell_public.h
new file mode 100644
index 0000000000..7e2e093565
--- /dev/null
+++ b/src/gallium/drivers/cell/ppu/cell_public.h
@@ -0,0 +1,10 @@
+#ifndef CELL_PUBLIC_H
+#define CELL_PUBLIC_H
+
+struct pipe_screen;
+struct sw_winsys;
+
+struct pipe_screen *
+cell_create_screen(struct sw_winsys *winsys);
+
+#endif
diff --git a/src/gallium/drivers/cell/ppu/cell_screen.c b/src/gallium/drivers/cell/ppu/cell_screen.c
index 7957e0149d..363d1e65e7 100644
--- a/src/gallium/drivers/cell/ppu/cell_screen.c
+++ b/src/gallium/drivers/cell/ppu/cell_screen.c
@@ -28,7 +28,6 @@
#include "util/u_memory.h"
#include "util/u_simple_screen.h"
-#include "util/u_simple_screen.h"
#include "pipe/p_defines.h"
#include "pipe/p_screen.h"
@@ -36,7 +35,10 @@
#include "cell_context.h"
#include "cell_screen.h"
#include "cell_texture.h"
-#include "cell_winsys.h"
+#include "cell_buffer.h"
+#include "cell_public.h"
+
+#include "state_tracker/sw_winsys.h"
static const char *
@@ -136,9 +138,16 @@ cell_is_format_supported( struct pipe_screen *screen,
unsigned tex_usage,
unsigned geom_flags )
{
+ if (tex_usage & (PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
+ PIPE_TEXTURE_USAGE_SCANOUT |
+ PIPE_TEXTURE_USAGE_SHARED)) {
+ if (!winsys->is_displaytarget_format_supported(winsys, tex_usage, format))
+ return FALSE;
+ }
+
/* only a few formats are known to work at this time */
switch (format) {
- case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
case PIPE_FORMAT_Z24X8_UNORM:
case PIPE_FORMAT_B8G8R8A8_UNORM:
case PIPE_FORMAT_I8_UNORM:
@@ -152,7 +161,8 @@ cell_is_format_supported( struct pipe_screen *screen,
static void
cell_destroy_screen( struct pipe_screen *screen )
{
- struct pipe_winsys *winsys = screen->winsys;
+ struct cell_screen *sp_screen = cell_screen(screen);
+ struct sw_winsys *winsys = sp_screen->winsys;
if(winsys->destroy)
winsys->destroy(winsys);
@@ -161,32 +171,34 @@ cell_destroy_screen( struct pipe_screen *screen )
}
+
/**
* Create a new pipe_screen object
* Note: we're not presently subclassing pipe_screen (no cell_screen) but
* that would be the place to put SPU thread/context info...
*/
struct pipe_screen *
-cell_create_screen(struct pipe_winsys *winsys)
+cell_create_screen(struct sw_winsys *winsys)
{
- struct pipe_screen *screen = CALLOC_STRUCT(pipe_screen);
+ struct cell_screen *screen = CALLOC_STRUCT(cell_screen);
if (!screen)
return NULL;
screen->winsys = winsys;
+ screen->base.winsys = NULL;
- screen->destroy = cell_destroy_screen;
+ screen->base.destroy = cell_destroy_screen;
- screen->get_name = cell_get_name;
- screen->get_vendor = cell_get_vendor;
- screen->get_param = cell_get_param;
- screen->get_paramf = cell_get_paramf;
- screen->is_format_supported = cell_is_format_supported;
- screen->context_create = cell_create_context;
+ screen->base.get_name = cell_get_name;
+ screen->base.get_vendor = cell_get_vendor;
+ screen->base.get_param = cell_get_param;
+ screen->base.get_paramf = cell_get_paramf;
+ screen->base.is_format_supported = cell_is_format_supported;
+ screen->base.context_create = cell_create_context;
- cell_init_screen_texture_funcs(screen);
- u_simple_screen_init(screen);
+ cell_init_screen_texture_funcs(&screen->base);
+ cell_init_screen_buffer_funcs(&screen->base);
- return screen;
+ return &screen->base;
}
diff --git a/src/gallium/drivers/cell/ppu/cell_screen.h b/src/gallium/drivers/cell/ppu/cell_screen.h
index c7e15889d6..baff9d3b7d 100644
--- a/src/gallium/drivers/cell/ppu/cell_screen.h
+++ b/src/gallium/drivers/cell/ppu/cell_screen.h
@@ -30,12 +30,26 @@
#define CELL_SCREEN_H
-struct pipe_screen;
-struct pipe_winsys;
+#include "pipe/p_screen.h"
+struct sw_winsys;
-extern struct pipe_screen *
-cell_create_screen(struct pipe_winsys *winsys);
+struct cell_screen {
+ struct pipe_screen base;
+
+ struct sw_winsys *winsys;
+
+ /* Increments whenever textures are modified. Contexts can track
+ * this.
+ */
+ unsigned timestamp;
+};
+
+static INLINE struct cell_screen *
+cell_screen( struct pipe_screen *pipe )
+{
+ return (struct cell_screen *)pipe;
+}
#endif /* CELL_SCREEN_H */
diff --git a/src/gallium/drivers/cell/ppu/cell_state_emit.c b/src/gallium/drivers/cell/ppu/cell_state_emit.c
index a59c7828ac..424e2628a9 100644
--- a/src/gallium/drivers/cell/ppu/cell_state_emit.c
+++ b/src/gallium/drivers/cell/ppu/cell_state_emit.c
@@ -245,16 +245,13 @@ cell_emit_state(struct cell_context *cell)
uint i, j;
float *buf = cell_batch_alloc16(cell, ROUNDUP16(32 + num_const * sizeof(float)));
uint32_t *ibuf = (uint32_t *) buf;
- const float *constants = pipe_buffer_map(cell->pipe.screen,
- cell->constants[shader],
- PIPE_BUFFER_USAGE_CPU_READ);
+ const float *constants = cell->mapped_constants[shader];
ibuf[0] = CELL_CMD_STATE_FS_CONSTANTS;
ibuf[4] = num_const;
j = 8;
for (i = 0; i < num_const; i++) {
buf[j++] = constants[i];
}
- pipe_buffer_unmap(cell->pipe.screen, cell->constants[shader]);
}
if (cell->dirty & (CELL_NEW_FRAMEBUFFER |
diff --git a/src/gallium/drivers/cell/ppu/cell_state_shader.c b/src/gallium/drivers/cell/ppu/cell_state_shader.c
index 9b2f86fdfb..9e29ddc2d4 100644
--- a/src/gallium/drivers/cell/ppu/cell_state_shader.c
+++ b/src/gallium/drivers/cell/ppu/cell_state_shader.c
@@ -28,13 +28,13 @@
#include "pipe/p_defines.h"
#include "util/u_memory.h"
#include "util/u_inlines.h"
-#include "util/u_simple_screen.h"
#include "draw/draw_context.h"
#include "tgsi/tgsi_parse.h"
#include "cell_context.h"
#include "cell_state.h"
#include "cell_gen_fp.h"
+#include "cell_buffer.h"
/** cast wrapper */
@@ -183,17 +183,29 @@ cell_delete_vs_state(struct pipe_context *pipe, void *vs)
static void
cell_set_constant_buffer(struct pipe_context *pipe,
uint shader, uint index,
- struct pipe_buffer *buf)
+ struct pipe_buffer *constants)
{
struct cell_context *cell = cell_context(pipe);
+ unsigned size = constants ? constants->size : 0;
+ const void *data = constants ? cell_buffer(constants)->data : NULL;
assert(shader < PIPE_SHADER_TYPES);
assert(index == 0);
+ if (cell->constants[shader] == constants)
+ return;
+
draw_flush(cell->draw);
/* note: reference counting */
- pipe_buffer_reference(&cell->constants[shader], buf);
+ pipe_buffer_reference(&cell->constants[shader], constants);
+
+ if(shader == PIPE_SHADER_VERTEX) {
+ draw_set_mapped_constant_buffer(cell->draw, PIPE_SHADER_VERTEX, 0,
+ data, size);
+ }
+
+ cell->mapped_constants[shader] = data;
if (shader == PIPE_SHADER_VERTEX)
cell->dirty |= CELL_NEW_VS_CONSTANTS;
diff --git a/src/gallium/drivers/cell/ppu/cell_state_vertex.c b/src/gallium/drivers/cell/ppu/cell_state_vertex.c
index fbe55c8472..9510ea9ac2 100644
--- a/src/gallium/drivers/cell/ppu/cell_state_vertex.c
+++ b/src/gallium/drivers/cell/ppu/cell_state_vertex.c
@@ -32,24 +32,44 @@
#include "cell_context.h"
#include "cell_state.h"
+#include "util/u_memory.h"
#include "draw/draw_context.h"
-static void
-cell_set_vertex_elements(struct pipe_context *pipe,
- unsigned count,
- const struct pipe_vertex_element *elements)
+void *
+cell_create_vertex_elements_state(struct pipe_context *pipe,
+ unsigned count,
+ const struct pipe_vertex_element *attribs)
{
- struct cell_context *cell = cell_context(pipe);
-
+ struct cell_velems_state *velems;
assert(count <= PIPE_MAX_ATTRIBS);
+ velems = (struct cell_velems_state *) MALLOC(sizeof(struct cell_velems_state));
+ if (velems) {
+ velems->count = count;
+ memcpy(velems->velem, attribs, sizeof(*attribs) * count);
+ }
+ return velems;
+}
+
+void
+cell_bind_vertex_elements_state(struct pipe_context *pipe,
+ void *velems)
+{
+ struct cell_context *cell = cell_context(pipe);
+ struct cell_velems_state *cell_velems = (struct cell_velems_state *) velems;
- memcpy(cell->vertex_element, elements, count * sizeof(elements[0]));
- cell->num_vertex_elements = count;
+ cell->velems = cell_velems;
cell->dirty |= CELL_NEW_VERTEX;
- draw_set_vertex_elements(cell->draw, count, elements);
+ if (cell_velems)
+ draw_set_vertex_elements(cell->draw, cell_velems->count, cell_velems->velem);
+}
+
+void
+cell_delete_vertex_elements_state(struct pipe_context *pipe, void *velems)
+{
+ FREE( velems );
}
@@ -75,5 +95,7 @@ void
cell_init_vertex_functions(struct cell_context *cell)
{
cell->pipe.set_vertex_buffers = cell_set_vertex_buffers;
- cell->pipe.set_vertex_elements = cell_set_vertex_elements;
+ cell->pipe.create_vertex_elements_state = cell_create_vertex_elements_state;
+ cell->pipe.bind_vertex_elements_state = cell_bind_vertex_elements_state;
+ cell->pipe.delete_vertex_elements_state = cell_delete_vertex_elements_state;
}
diff --git a/src/gallium/drivers/cell/ppu/cell_texture.c b/src/gallium/drivers/cell/ppu/cell_texture.c
index fad290dfa0..5b169afaf8 100644
--- a/src/gallium/drivers/cell/ppu/cell_texture.c
+++ b/src/gallium/drivers/cell/ppu/cell_texture.c
@@ -34,20 +34,23 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "util/u_inlines.h"
-#include "util/u_simple_screen.h"
#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
#include "cell_context.h"
+#include "cell_screen.h"
#include "cell_state.h"
#include "cell_texture.h"
+#include "state_tracker/sw_winsys.h"
-static void
-cell_texture_layout(struct cell_texture *ct)
+
+static boolean
+cell_texture_layout(struct pipe_screen *screen,
+ struct cell_texture *ct)
{
struct pipe_texture *pt = &ct->base;
unsigned level;
@@ -83,9 +86,35 @@ cell_texture_layout(struct cell_texture *ct)
height = u_minify(height, 1);
depth = u_minify(depth, 1);
}
+
+ ct->data = align_malloc(ct->buffer_size, 16);
+
+ return ct->data != NULL;
}
+/**
+ * Texture layout for simple color buffers.
+ */
+static boolean
+cell_displaytarget_layout(struct pipe_screen *screen,
+ struct cell_texture * ct)
+{
+ struct sw_winsys *winsys = cell_screen(screen)->winsys;
+
+ /* Round up the surface size to a multiple of the tile size?
+ */
+ ct->dt = winsys->displaytarget_create(winsys,
+ ct->base->tex_usage,
+ ct->base.format,
+ ct->base.width0,
+ ct->base.height0,
+ 16,
+ &ct->dt_stride );
+
+ return ct->dt != NULL;
+}
+
static struct pipe_texture *
cell_texture_create(struct pipe_screen *screen,
const struct pipe_texture *templat)
@@ -98,31 +127,46 @@ cell_texture_create(struct pipe_screen *screen,
pipe_reference_init(&ct->base.reference, 1);
ct->base.screen = screen;
- cell_texture_layout(ct);
+ /* Create both a displaytarget (linear) and regular texture
+ * (twiddled). Convert twiddled->linear at flush_frontbuffer time.
+ */
+ if (ct->base.tex_usage & (PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
+ PIPE_TEXTURE_USAGE_SCANOUT |
+ PIPE_TEXTURE_USAGE_SHARED)) {
+ if (!cell_displaytarget_layout(screen, ct))
+ goto fail;
+ }
- ct->buffer = screen->buffer_create(screen, 32, PIPE_BUFFER_USAGE_PIXEL,
- ct->buffer_size);
+ if (!cell_texture_layout(screen, ct))
+ goto fail;
- if (!ct->buffer) {
- FREE(ct);
- return NULL;
+ return &ct->base;
+
+fail:
+ if (ct->dt) {
+ struct sw_winsys *winsys = cell_screen(screen)->winsys;
+ winsys->displaytarget_destroy(winsys, ct->dt);
}
- return &ct->base;
+ FREE(ct);
+
+ return NULL;
}
static void
cell_texture_destroy(struct pipe_texture *pt)
{
+ struct cell_screen *screen = cell_screen(pt->screen);
+ struct sw_winsys *winsys = screen->winsys;
struct cell_texture *ct = cell_texture(pt);
- if (ct->mapped) {
- pipe_buffer_unmap(ct->buffer->screen, ct->buffer);
- ct->mapped = NULL;
+ if (ct->dt) {
+ /* display target */
+ winsys->displaytarget_destroy(winsys, ct->dt);
}
- pipe_buffer_reference(&ct->buffer, NULL);
+ align_free(ct->data);
FREE(ct);
}
@@ -312,7 +356,7 @@ cell_tex_surface_destroy(struct pipe_surface *surf)
* back out for glGetTexImage).
*/
static struct pipe_transfer *
-cell_get_tex_transfer(struct pipe_screen *screen,
+cell_get_tex_transfer(struct pipe_context *ctx,
struct pipe_texture *texture,
unsigned face, unsigned level, unsigned zslice,
enum pipe_transfer_usage usage,
@@ -359,7 +403,7 @@ cell_get_tex_transfer(struct pipe_screen *screen,
static void
-cell_tex_transfer_destroy(struct pipe_transfer *t)
+cell_tex_transfer_destroy(struct pipe_context *ctx, struct pipe_transfer *t)
{
struct cell_transfer *transfer = cell_transfer(t);
/* Effectively do the texture_update work here - if texture images
@@ -376,7 +420,7 @@ cell_tex_transfer_destroy(struct pipe_transfer *t)
* Return pointer to texture image data in linear layout.
*/
static void *
-cell_transfer_map(struct pipe_screen *screen, struct pipe_transfer *transfer)
+cell_transfer_map(struct pipe_context *ctx, struct pipe_transfer *transfer)
{
struct cell_transfer *ctrans = cell_transfer(transfer);
struct pipe_texture *pt = transfer->texture;
@@ -389,10 +433,8 @@ cell_transfer_map(struct pipe_screen *screen, struct pipe_transfer *transfer)
assert(transfer->texture);
- if (!ct->mapped) {
- /* map now */
- ct->mapped = pipe_buffer_map(screen, ct->buffer,
- pipe_transfer_buffer_flags(transfer));
+ if (ct->mapped == NULL) {
+ ct->mapped = ct->data;
}
/*
@@ -430,7 +472,7 @@ cell_transfer_map(struct pipe_screen *screen, struct pipe_transfer *transfer)
* to tiled data.
*/
static void
-cell_transfer_unmap(struct pipe_screen *screen,
+cell_transfer_unmap(struct pipe_context *ctx,
struct pipe_transfer *transfer)
{
struct cell_transfer *ctrans = cell_transfer(transfer);
@@ -442,9 +484,8 @@ cell_transfer_unmap(struct pipe_screen *screen,
const uint stride = ct->stride[level];
if (!ct->mapped) {
- /* map now */
- ct->mapped = pipe_buffer_map(screen, ct->buffer,
- PIPE_BUFFER_USAGE_CPU_READ);
+ assert(0);
+ return;
}
if (transfer->usage & PIPE_TRANSFER_WRITE) {
@@ -467,6 +508,50 @@ cell_transfer_unmap(struct pipe_screen *screen,
}
+
+/* This used to be overriden by the co-state tracker, but really needs
+ * to be active with sw_winsys.
+ *
+ * Contrasting with llvmpipe and softpipe, this is the only place
+ * where we use the ct->dt display target in any real sense.
+ *
+ * Basically just untwiddle our local data into the linear
+ * displaytarget.
+ */
+static void
+cell_flush_frontbuffer(struct pipe_screen *_screen,
+ struct pipe_surface *surface,
+ void *context_private)
+{
+ struct cell_screen *screen = cell_screen(_screen);
+ struct sw_winsys *winsys = screen->winsys;
+ struct cell_texture *ct = cell_texture(surface->texture);
+
+ if (!ct->dt)
+ return;
+
+ /* Need to untwiddle from our internal representation here:
+ */
+ {
+ unsigned *map = winsys->displaytarget_map(winsys, ct->dt,
+ (PIPE_BUFFER_USAGE_CPU_READ |
+ PIPE_BUFFER_USAGE_CPU_WRITE));
+ unsigned *src = (unsigned *)(ct->data + ct->level_offset[surface->level]);
+
+ untwiddle_image_uint(surface->width,
+ surface->height,
+ TILE_SIZE,
+ map,
+ ct->dt_stride,
+ src);
+
+ winsys->displaytarget_unmap(winsys, ct->dt);
+ }
+
+ winsys->displaytarget_display(winsys, ct->dt, context_private);
+}
+
+
void
cell_init_screen_texture_funcs(struct pipe_screen *screen)
{
@@ -476,9 +561,14 @@ cell_init_screen_texture_funcs(struct pipe_screen *screen)
screen->get_tex_surface = cell_get_tex_surface;
screen->tex_surface_destroy = cell_tex_surface_destroy;
- screen->get_tex_transfer = cell_get_tex_transfer;
- screen->tex_transfer_destroy = cell_tex_transfer_destroy;
+ screen->flush_frontbuffer = cell_flush_frontbuffer;
+}
- screen->transfer_map = cell_transfer_map;
- screen->transfer_unmap = cell_transfer_unmap;
+void
+cell_init_texture_transfer_funcs(struct cell_context *cell)
+{
+ cell->pipe.get_tex_transfer = cell_get_tex_transfer;
+ cell->pipe.tex_transfer_destroy = cell_tex_transfer_destroy;
+ cell->pipe.transfer_map = cell_transfer_map;
+ cell->pipe.transfer_unmap = cell_transfer_unmap;
}
diff --git a/src/gallium/drivers/cell/ppu/cell_texture.h b/src/gallium/drivers/cell/ppu/cell_texture.h
index 3ffc0bfdb5..ac0b916775 100644
--- a/src/gallium/drivers/cell/ppu/cell_texture.h
+++ b/src/gallium/drivers/cell/ppu/cell_texture.h
@@ -28,6 +28,7 @@
#ifndef CELL_TEXTURE_H
#define CELL_TEXTURE_H
+#include "cell/common.h"
struct cell_context;
struct pipe_texture;
@@ -43,8 +44,20 @@ struct cell_texture
unsigned long level_offset[CELL_MAX_TEXTURE_LEVELS];
unsigned long stride[CELL_MAX_TEXTURE_LEVELS];
- /** The tiled texture data is held in this buffer */
- struct pipe_buffer *buffer;
+ /**
+ * Display target, for textures with the PIPE_TEXTURE_USAGE_DISPLAY_TARGET
+ * usage.
+ */
+ struct sw_displaytarget *dt;
+ unsigned dt_stride;
+
+ /**
+ * Malloc'ed data for regular textures, or a mapping to dt above.
+ */
+ void *data;
+
+ /* Size of the linear buffer??
+ */
unsigned long buffer_size;
/** The buffer above, mapped. This is the memory from which the
@@ -82,5 +95,7 @@ cell_transfer(struct pipe_transfer *pt)
extern void
cell_init_screen_texture_funcs(struct pipe_screen *screen);
+extern void
+cell_init_texture_transfer_funcs(struct cell_context *cell);
#endif /* CELL_TEXTURE_H */
diff --git a/src/gallium/drivers/cell/ppu/cell_vertex_shader.c b/src/gallium/drivers/cell/ppu/cell_vertex_shader.c
index cf8cd41159..3d389d6ea3 100644
--- a/src/gallium/drivers/cell/ppu/cell_vertex_shader.c
+++ b/src/gallium/drivers/cell/ppu/cell_vertex_shader.c
@@ -31,7 +31,6 @@
#include "pipe/p_defines.h"
#include "pipe/p_context.h"
-#include "util/u_simple_screen.h"
#include "util/u_math.h"
#include "cell_context.h"
diff --git a/src/gallium/drivers/cell/spu/spu_command.c b/src/gallium/drivers/cell/spu/spu_command.c
index 79f1fb7fb2..f16cabc027 100644
--- a/src/gallium/drivers/cell/spu/spu_command.c
+++ b/src/gallium/drivers/cell/spu/spu_command.c
@@ -337,8 +337,8 @@ cmd_state_framebuffer(const struct cell_command_framebuffer *cmd)
spu.fb.zsize = 4;
spu.fb.zscale = (float) 0xffffffffu;
break;
- case PIPE_FORMAT_S8Z24_UNORM:
- case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
case PIPE_FORMAT_X8Z24_UNORM:
case PIPE_FORMAT_Z24X8_UNORM:
spu.fb.zsize = 4;
diff --git a/src/gallium/drivers/cell/spu/spu_per_fragment_op.c b/src/gallium/drivers/cell/spu/spu_per_fragment_op.c
index 2c9e7458af..3b9566042a 100644
--- a/src/gallium/drivers/cell/spu/spu_per_fragment_op.c
+++ b/src/gallium/drivers/cell/spu/spu_per_fragment_op.c
@@ -138,13 +138,13 @@ spu_fallback_fragment_ops(uint x, uint y,
if (spu.depth_stencil_alpha.stencil[0].enabled) {
/* do stencil test */
- ASSERT(spu.fb.depth_format == PIPE_FORMAT_Z24S8_UNORM);
+ ASSERT(spu.fb.depth_format == PIPE_FORMAT_Z24_UNORM_S8_USCALED);
}
else if (spu.depth_stencil_alpha.depth.enabled) {
/* do depth test */
- ASSERT(spu.fb.depth_format == PIPE_FORMAT_Z24S8_UNORM ||
+ ASSERT(spu.fb.depth_format == PIPE_FORMAT_Z24_UNORM_S8_USCALED ||
spu.fb.depth_format == PIPE_FORMAT_Z24X8_UNORM);
vector unsigned int ifragZ;
diff --git a/src/gallium/drivers/failover/fo_context.c b/src/gallium/drivers/failover/fo_context.c
index 2ccc5d3e60..659e40cbf0 100644
--- a/src/gallium/drivers/failover/fo_context.c
+++ b/src/gallium/drivers/failover/fo_context.c
@@ -27,7 +27,6 @@
#include "pipe/p_defines.h"
-#include "util/u_simple_screen.h"
#include "util/u_memory.h"
#include "pipe/p_context.h"
diff --git a/src/gallium/drivers/failover/fo_context.h b/src/gallium/drivers/failover/fo_context.h
index bb1a168ea7..73031321d9 100644
--- a/src/gallium/drivers/failover/fo_context.h
+++ b/src/gallium/drivers/failover/fo_context.h
@@ -47,7 +47,7 @@
#define FO_NEW_ALPHA_TEST 0x100
#define FO_NEW_DEPTH_STENCIL 0x200
#define FO_NEW_SAMPLER 0x400
-#define FO_NEW_TEXTURE 0x800
+#define FO_NEW_SAMPLER_VIEW 0x800
#define FO_NEW_VERTEX 0x2000
#define FO_NEW_VERTEX_SHADER 0x4000
#define FO_NEW_BLEND_COLOR 0x8000
@@ -65,6 +65,13 @@ struct fo_state {
void *sw_state;
void *hw_state;
};
+
+struct fo_sampler_view {
+ struct pipe_sampler_view base;
+ struct pipe_sampler_view *sw;
+ struct pipe_sampler_view *hw;
+};
+
struct failover_context {
struct pipe_context pipe; /**< base class */
@@ -78,6 +85,7 @@ struct failover_context {
const struct fo_state *rasterizer;
const struct fo_state *fragment_shader;
const struct fo_state *vertex_shader;
+ const struct fo_state *vertex_elements;
struct pipe_blend_color blend_color;
struct pipe_stencil_ref stencil_ref;
@@ -85,26 +93,25 @@ struct failover_context {
struct pipe_framebuffer_state framebuffer;
struct pipe_poly_stipple poly_stipple;
struct pipe_scissor_state scissor;
- struct pipe_texture *texture[PIPE_MAX_SAMPLERS];
- struct pipe_texture *vertex_textures[PIPE_MAX_VERTEX_SAMPLERS];
struct pipe_viewport_state viewport;
struct pipe_vertex_buffer vertex_buffers[PIPE_MAX_ATTRIBS];
- struct pipe_vertex_element vertex_elements[PIPE_MAX_ATTRIBS];
uint num_vertex_buffers;
- uint num_vertex_elements;
void *sw_sampler_state[PIPE_MAX_SAMPLERS];
void *hw_sampler_state[PIPE_MAX_SAMPLERS];
void *sw_vertex_sampler_state[PIPE_MAX_VERTEX_SAMPLERS];
void *hw_vertex_sampler_state[PIPE_MAX_VERTEX_SAMPLERS];
+ struct fo_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS];
+ struct fo_sampler_view *vertex_sampler_views[PIPE_MAX_VERTEX_SAMPLERS];
+ unsigned num_fragment_sampler_views;
+ unsigned num_vertex_sampler_views;
+
unsigned dirty;
unsigned num_samplers;
unsigned num_vertex_samplers;
- unsigned num_textures;
- unsigned num_vertex_textures;
unsigned mode;
struct pipe_context *hw;
diff --git a/src/gallium/drivers/failover/fo_state.c b/src/gallium/drivers/failover/fo_state.c
index 970606a3f5..25c6273570 100644
--- a/src/gallium/drivers/failover/fo_state.c
+++ b/src/gallium/drivers/failover/fo_state.c
@@ -255,9 +255,52 @@ failover_delete_vs_state(struct pipe_context *pipe,
free(state);
}
+
+
+static void *
+failover_create_vertex_elements_state( struct pipe_context *pipe,
+ unsigned count,
+ const struct pipe_vertex_element *velems )
+{
+ struct fo_state *state = malloc(sizeof(struct fo_state));
+ struct failover_context *failover = failover_context(pipe);
+
+ state->sw_state = failover->sw->create_vertex_elements_state(failover->sw, count, velems);
+ state->hw_state = failover->hw->create_vertex_elements_state(failover->hw, count, velems);
+
+ return state;
+}
+
+static void
+failover_bind_vertex_elements_state(struct pipe_context *pipe,
+ void *velems )
+{
+ struct failover_context *failover = failover_context(pipe);
+ struct fo_state *state = (struct fo_state*)velems;
+
+ failover->vertex_elements = state;
+ failover->dirty |= FO_NEW_VERTEX_ELEMENT;
+ failover->sw->bind_vertex_elements_state( failover->sw, velems );
+ failover->hw->bind_vertex_elements_state( failover->hw, velems );
+}
+
+static void
+failover_delete_vertex_elements_state( struct pipe_context *pipe,
+ void *velems )
+{
+ struct fo_state *state = (struct fo_state*)velems;
+ struct failover_context *failover = failover_context(pipe);
+
+ failover->sw->delete_vertex_elements_state(failover->sw, state->sw_state);
+ failover->hw->delete_vertex_elements_state(failover->hw, state->hw_state);
+ state->sw_state = 0;
+ state->hw_state = 0;
+ free(state);
+}
+
static void
failover_set_polygon_stipple( struct pipe_context *pipe,
- const struct pipe_poly_stipple *stipple )
+ const struct pipe_poly_stipple *stipple )
{
struct failover_context *failover = failover_context(pipe);
@@ -404,60 +447,96 @@ failover_delete_sampler_state(struct pipe_context *pipe, void *sampler)
}
+static struct pipe_sampler_view *
+failover_create_sampler_view(struct pipe_context *pipe,
+ struct pipe_texture *texture,
+ const struct pipe_sampler_view *templ)
+{
+ struct fo_sampler_view *view = malloc(sizeof(struct fo_sampler_view));
+ struct failover_context *failover = failover_context(pipe);
+
+ view->sw = failover->sw->create_sampler_view(failover->sw, texture, templ);
+ view->hw = failover->hw->create_sampler_view(failover->hw, texture, templ);
+
+ view->base = *templ;
+ view->base.reference.count = 1;
+ view->base.texture = NULL;
+ pipe_texture_reference(&view->base.texture, texture);
+ view->base.context = pipe;
+
+ return &view->base;
+}
+
+static void
+failover_sampler_view_destroy(struct pipe_context *pipe,
+ struct pipe_sampler_view *view)
+{
+ struct fo_sampler_view *fo_view = (struct fo_sampler_view *)view;
+ struct failover_context *failover = failover_context(pipe);
+
+ failover->sw->sampler_view_destroy(failover->sw, fo_view->sw);
+ failover->hw->sampler_view_destroy(failover->hw, fo_view->hw);
+
+ pipe_texture_reference(&fo_view->base.texture, NULL);
+ free(fo_view);
+}
+
static void
-failover_set_fragment_sampler_textures(struct pipe_context *pipe,
- unsigned num,
- struct pipe_texture **texture)
+failover_set_fragment_sampler_views(struct pipe_context *pipe,
+ unsigned num,
+ struct pipe_sampler_view **views)
{
struct failover_context *failover = failover_context(pipe);
+ struct pipe_sampler_view *hw_views[PIPE_MAX_SAMPLERS];
uint i;
assert(num <= PIPE_MAX_SAMPLERS);
/* Check for no-op */
- if (num == failover->num_textures &&
- !memcmp(failover->texture, texture, num * sizeof(struct pipe_texture *)))
+ if (num == failover->num_fragment_sampler_views &&
+ !memcmp(failover->fragment_sampler_views, views, num * sizeof(struct pipe_sampler_view *)))
return;
- for (i = 0; i < num; i++)
- pipe_texture_reference((struct pipe_texture **) &failover->texture[i],
- texture[i]);
- for (i = num; i < failover->num_textures; i++)
- pipe_texture_reference((struct pipe_texture **) &failover->texture[i],
- NULL);
- failover->dirty |= FO_NEW_TEXTURE;
- failover->num_textures = num;
- failover->sw->set_fragment_sampler_textures( failover->sw, num, texture );
- failover->hw->set_fragment_sampler_textures( failover->hw, num, texture );
+ for (i = 0; i < num; i++) {
+ struct fo_sampler_view *fo_view = (struct fo_sampler_view *)views[i];
+
+ pipe_sampler_view_reference((struct pipe_sampler_view **)&failover->fragment_sampler_views[i], views[i]);
+ hw_views[i] = fo_view->hw;
+ }
+ for (i = num; i < failover->num_fragment_sampler_views; i++)
+ pipe_sampler_view_reference((struct pipe_sampler_view **)&failover->fragment_sampler_views[i], NULL);
+ failover->dirty |= FO_NEW_SAMPLER_VIEW;
+ failover->num_fragment_sampler_views = num;
+ failover->hw->set_fragment_sampler_views(failover->hw, num, hw_views);
}
static void
-failover_set_vertex_sampler_textures(struct pipe_context *pipe,
- unsigned num_textures,
- struct pipe_texture **textures)
+failover_set_vertex_sampler_views(struct pipe_context *pipe,
+ unsigned num,
+ struct pipe_sampler_view **views)
{
struct failover_context *failover = failover_context(pipe);
+ struct pipe_sampler_view *hw_views[PIPE_MAX_VERTEX_SAMPLERS];
uint i;
- assert(num_textures <= PIPE_MAX_VERTEX_SAMPLERS);
+ assert(num <= PIPE_MAX_VERTEX_SAMPLERS);
/* Check for no-op */
- if (num_textures == failover->num_vertex_textures &&
- !memcmp(failover->vertex_textures, textures, num_textures * sizeof(struct pipe_texture *))) {
+ if (num == failover->num_vertex_sampler_views &&
+ !memcmp(failover->vertex_sampler_views, views, num * sizeof(struct pipe_sampler_view *))) {
return;
}
- for (i = 0; i < num_textures; i++) {
- pipe_texture_reference((struct pipe_texture **)&failover->vertex_textures[i],
- textures[i]);
- }
- for (i = num_textures; i < failover->num_vertex_textures; i++) {
- pipe_texture_reference((struct pipe_texture **)&failover->vertex_textures[i],
- NULL);
+ for (i = 0; i < num; i++) {
+ struct fo_sampler_view *fo_view = (struct fo_sampler_view *)views[i];
+
+ pipe_sampler_view_reference((struct pipe_sampler_view **)&failover->vertex_sampler_views[i], views[i]);
+ hw_views[i] = fo_view->hw;
}
- failover->dirty |= FO_NEW_TEXTURE;
- failover->num_vertex_textures = num_textures;
- failover->sw->set_vertex_sampler_textures(failover->sw, num_textures, textures);
- failover->hw->set_vertex_sampler_textures(failover->hw, num_textures, textures);
+ for (i = num; i < failover->num_vertex_sampler_views; i++)
+ pipe_sampler_view_reference((struct pipe_sampler_view **)&failover->vertex_sampler_views[i], NULL);
+ failover->dirty |= FO_NEW_SAMPLER_VIEW;
+ failover->num_vertex_sampler_views = num;
+ failover->hw->set_vertex_sampler_views(failover->hw, num, hw_views);
}
@@ -490,22 +569,6 @@ failover_set_vertex_buffers(struct pipe_context *pipe,
}
-static void
-failover_set_vertex_elements(struct pipe_context *pipe,
- unsigned count,
- const struct pipe_vertex_element *vertex_elements)
-{
- struct failover_context *failover = failover_context(pipe);
-
- memcpy(failover->vertex_elements, vertex_elements,
- count * sizeof(vertex_elements[0]));
-
- failover->dirty |= FO_NEW_VERTEX_ELEMENT;
- failover->num_vertex_elements = count;
- failover->sw->set_vertex_elements( failover->sw, count, vertex_elements );
- failover->hw->set_vertex_elements( failover->hw, count, vertex_elements );
-}
-
void
failover_set_constant_buffer(struct pipe_context *pipe,
uint shader, uint index,
@@ -543,6 +606,9 @@ failover_init_state_functions( struct failover_context *failover )
failover->pipe.create_vs_state = failover_create_vs_state;
failover->pipe.bind_vs_state = failover_bind_vs_state;
failover->pipe.delete_vs_state = failover_delete_vs_state;
+ failover->pipe.create_vertex_elements_state = failover_create_vertex_elements_state;
+ failover->pipe.bind_vertex_elements_state = failover_bind_vertex_elements_state;
+ failover->pipe.delete_vertex_elements_state = failover_delete_vertex_elements_state;
failover->pipe.set_blend_color = failover_set_blend_color;
failover->pipe.set_stencil_ref = failover_set_stencil_ref;
@@ -550,10 +616,11 @@ failover_init_state_functions( struct failover_context *failover )
failover->pipe.set_framebuffer_state = failover_set_framebuffer_state;
failover->pipe.set_polygon_stipple = failover_set_polygon_stipple;
failover->pipe.set_scissor_state = failover_set_scissor_state;
- failover->pipe.set_fragment_sampler_textures = failover_set_fragment_sampler_textures;
- failover->pipe.set_vertex_sampler_textures = failover_set_vertex_sampler_textures;
+ failover->pipe.set_fragment_sampler_views = failover_set_fragment_sampler_views;
+ failover->pipe.set_vertex_sampler_views = failover_set_vertex_sampler_views;
failover->pipe.set_viewport_state = failover_set_viewport_state;
failover->pipe.set_vertex_buffers = failover_set_vertex_buffers;
- failover->pipe.set_vertex_elements = failover_set_vertex_elements;
failover->pipe.set_constant_buffer = failover_set_constant_buffer;
+ failover->pipe.create_sampler_view = failover_create_sampler_view;
+ failover->pipe.sampler_view_destroy = failover_sampler_view_destroy;
}
diff --git a/src/gallium/drivers/failover/fo_state_emit.c b/src/gallium/drivers/failover/fo_state_emit.c
index 5c00080842..42bd6929a7 100644
--- a/src/gallium/drivers/failover/fo_state_emit.c
+++ b/src/gallium/drivers/failover/fo_state_emit.c
@@ -81,6 +81,10 @@ failover_state_emit( struct failover_context *failover )
failover->sw->bind_vs_state( failover->sw,
failover->vertex_shader->sw_state );
+ if (failover->dirty & FO_NEW_VERTEX_ELEMENT)
+ failover->sw->bind_vertex_elements_state( failover->sw,
+ failover->vertex_elements->sw_state );
+
if (failover->dirty & FO_NEW_STIPPLE)
failover->sw->set_polygon_stipple( failover->sw, &failover->poly_stipple );
@@ -102,12 +106,24 @@ failover_state_emit( struct failover_context *failover )
failover->sw_vertex_sampler_state);
}
- if (failover->dirty & FO_NEW_TEXTURE) {
- failover->sw->set_fragment_sampler_textures( failover->sw, failover->num_textures,
- failover->texture );
- failover->sw->set_vertex_sampler_textures(failover->sw,
- failover->num_vertex_textures,
- failover->vertex_textures);
+ if (failover->dirty & FO_NEW_SAMPLER_VIEW) {
+ struct pipe_sampler_view *fragment_views[PIPE_MAX_SAMPLERS];
+ struct pipe_sampler_view *vertex_views[PIPE_MAX_VERTEX_SAMPLERS];
+ uint i;
+
+ for (i = 0; i < failover->num_fragment_sampler_views; i++) {
+ fragment_views[i] = failover->fragment_sampler_views[i]->sw;
+ }
+ failover->sw->set_fragment_sampler_views(failover->sw,
+ failover->num_fragment_sampler_views,
+ fragment_views);
+
+ for (i = 0; i < failover->num_vertex_sampler_views; i++) {
+ vertex_views[i] = failover->vertex_sampler_views[i]->sw;
+ }
+ failover->sw->set_vertex_sampler_views(failover->sw,
+ failover->num_vertex_sampler_views,
+ vertex_views);
}
if (failover->dirty & FO_NEW_VERTEX_BUFFER) {
@@ -116,11 +132,5 @@ failover_state_emit( struct failover_context *failover )
failover->vertex_buffers );
}
- if (failover->dirty & FO_NEW_VERTEX_ELEMENT) {
- failover->sw->set_vertex_elements( failover->sw,
- failover->num_vertex_elements,
- failover->vertex_elements );
- }
-
failover->dirty = 0;
}
diff --git a/src/gallium/drivers/i915/i915_batch.h b/src/gallium/drivers/i915/i915_batch.h
index b813784723..f0086695d1 100644
--- a/src/gallium/drivers/i915/i915_batch.h
+++ b/src/gallium/drivers/i915/i915_batch.h
@@ -28,19 +28,19 @@
#ifndef I915_BATCH_H
#define I915_BATCH_H
-#include "intel_batchbuffer.h"
+#include "i915_batchbuffer.h"
#define BEGIN_BATCH(dwords, relocs) \
- (intel_batchbuffer_check(i915->batch, dwords, relocs))
+ (i915_winsys_batchbuffer_check(i915->batch, dwords, relocs))
#define OUT_BATCH(dword) \
- intel_batchbuffer_dword(i915->batch, dword)
+ i915_winsys_batchbuffer_dword(i915->batch, dword)
#define OUT_RELOC(buf, usage, offset) \
- intel_batchbuffer_reloc(i915->batch, buf, usage, offset)
+ i915_winsys_batchbuffer_reloc(i915->batch, buf, usage, offset)
#define FLUSH_BATCH(fence) do { \
- intel_batchbuffer_flush(i915->batch, fence); \
+ i915_winsys_batchbuffer_flush(i915->batch, fence); \
i915->hardware_dirty = ~0; \
} while (0)
diff --git a/src/gallium/drivers/i915/intel_batchbuffer.h b/src/gallium/drivers/i915/i915_batchbuffer.h
index db12dfd2ac..27ccaa6b1f 100644
--- a/src/gallium/drivers/i915/intel_batchbuffer.h
+++ b/src/gallium/drivers/i915/i915_batchbuffer.h
@@ -1,8 +1,8 @@
/**************************************************************************
- *
+ *
* Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
* All Rights Reserved.
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
@@ -10,11 +10,11 @@
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
- *
+ *
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
@@ -22,34 +22,34 @@
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
+ *
**************************************************************************/
-#ifndef INTEL_BATCH_H
-#define INTEL_BATCH_H
+#ifndef I915_BATCHBUFFER_H
+#define I915_BATCHBUFFER_H
-#include "intel_winsys.h"
+#include "i915_winsys.h"
static INLINE boolean
-intel_batchbuffer_check(struct intel_batchbuffer *batch,
- size_t dwords,
- size_t relocs)
+i915_winsys_batchbuffer_check(struct i915_winsys_batchbuffer *batch,
+ size_t dwords,
+ size_t relocs)
{
return dwords * 4 <= batch->size - (batch->ptr - batch->map) &&
relocs <= (batch->max_relocs - batch->relocs);
}
static INLINE size_t
-intel_batchbuffer_space(struct intel_batchbuffer *batch)
+i915_winsys_batchbuffer_space(struct i915_winsys_batchbuffer *batch)
{
return batch->size - (batch->ptr - batch->map);
}
static INLINE void
-intel_batchbuffer_dword(struct intel_batchbuffer *batch,
- unsigned dword)
+i915_winsys_batchbuffer_dword(struct i915_winsys_batchbuffer *batch,
+ unsigned dword)
{
- if (intel_batchbuffer_space(batch) < 4)
+ if (i915_winsys_batchbuffer_space(batch) < 4)
return;
*(unsigned *)batch->ptr = dword;
@@ -57,11 +57,11 @@ intel_batchbuffer_dword(struct intel_batchbuffer *batch,
}
static INLINE void
-intel_batchbuffer_write(struct intel_batchbuffer *batch,
- void *data,
- size_t size)
+i915_winsys_batchbuffer_write(struct i915_winsys_batchbuffer *batch,
+ void *data,
+ size_t size)
{
- if (intel_batchbuffer_space(batch) < size)
+ if (i915_winsys_batchbuffer_space(batch) < size)
return;
memcpy(data, batch->ptr, size);
@@ -69,17 +69,17 @@ intel_batchbuffer_write(struct intel_batchbuffer *batch,
}
static INLINE int
-intel_batchbuffer_reloc(struct intel_batchbuffer *batch,
- struct intel_buffer *buffer,
- enum intel_buffer_usage usage,
- size_t offset)
+i915_winsys_batchbuffer_reloc(struct i915_winsys_batchbuffer *batch,
+ struct i915_winsys_buffer *buffer,
+ enum i915_winsys_buffer_usage usage,
+ size_t offset)
{
return batch->iws->batchbuffer_reloc(batch, buffer, usage, offset);
}
static INLINE void
-intel_batchbuffer_flush(struct intel_batchbuffer *batch,
- struct pipe_fence_handle **fence)
+i915_winsys_batchbuffer_flush(struct i915_winsys_batchbuffer *batch,
+ struct pipe_fence_handle **fence)
{
batch->iws->batchbuffer_flush(batch, fence);
}
diff --git a/src/gallium/drivers/i915/i915_blit.c b/src/gallium/drivers/i915/i915_blit.c
index 83dfc33528..533fa81219 100644
--- a/src/gallium/drivers/i915/i915_blit.c
+++ b/src/gallium/drivers/i915/i915_blit.c
@@ -37,7 +37,7 @@ void
i915_fill_blit(struct i915_context *i915,
unsigned cpp,
unsigned short dst_pitch,
- struct intel_buffer *dst_buffer,
+ struct i915_winsys_buffer *dst_buffer,
unsigned dst_offset,
short x, short y,
short w, short h,
@@ -77,7 +77,7 @@ i915_fill_blit(struct i915_context *i915,
OUT_BATCH(BR13);
OUT_BATCH((y << 16) | x);
OUT_BATCH(((y + h) << 16) | (x + w));
- OUT_RELOC(dst_buffer, INTEL_USAGE_2D_TARGET, dst_offset);
+ OUT_RELOC(dst_buffer, I915_USAGE_2D_TARGET, dst_offset);
OUT_BATCH(color);
FLUSH_BATCH(NULL);
}
@@ -87,10 +87,10 @@ i915_copy_blit(struct i915_context *i915,
unsigned do_flip,
unsigned cpp,
unsigned short src_pitch,
- struct intel_buffer *src_buffer,
+ struct i915_winsys_buffer *src_buffer,
unsigned src_offset,
unsigned short dst_pitch,
- struct intel_buffer *dst_buffer,
+ struct i915_winsys_buffer *dst_buffer,
unsigned dst_offset,
short src_x, short src_y,
short dst_x, short dst_y,
@@ -143,9 +143,9 @@ i915_copy_blit(struct i915_context *i915,
OUT_BATCH(BR13);
OUT_BATCH((dst_y << 16) | dst_x);
OUT_BATCH((dst_y2 << 16) | dst_x2);
- OUT_RELOC(dst_buffer, INTEL_USAGE_2D_TARGET, dst_offset);
+ OUT_RELOC(dst_buffer, I915_USAGE_2D_TARGET, dst_offset);
OUT_BATCH((src_y << 16) | src_x);
OUT_BATCH(((int) src_pitch & 0xffff));
- OUT_RELOC(src_buffer, INTEL_USAGE_2D_SOURCE, src_offset);
+ OUT_RELOC(src_buffer, I915_USAGE_2D_SOURCE, src_offset);
FLUSH_BATCH(NULL);
}
diff --git a/src/gallium/drivers/i915/i915_blit.h b/src/gallium/drivers/i915/i915_blit.h
index 8ce3220cfd..db576ed4c9 100644
--- a/src/gallium/drivers/i915/i915_blit.h
+++ b/src/gallium/drivers/i915/i915_blit.h
@@ -34,10 +34,10 @@ extern void i915_copy_blit(struct i915_context *i915,
unsigned do_flip,
unsigned cpp,
unsigned short src_pitch,
- struct intel_buffer *src_buffer,
+ struct i915_winsys_buffer *src_buffer,
unsigned src_offset,
unsigned short dst_pitch,
- struct intel_buffer *dst_buffer,
+ struct i915_winsys_buffer *dst_buffer,
unsigned dst_offset,
short srcx, short srcy,
short dstx, short dsty,
@@ -46,7 +46,7 @@ extern void i915_copy_blit(struct i915_context *i915,
extern void i915_fill_blit(struct i915_context *i915,
unsigned cpp,
unsigned short dst_pitch,
- struct intel_buffer *dst_buffer,
+ struct i915_winsys_buffer *dst_buffer,
unsigned dst_offset,
short x, short y,
short w, short h, unsigned color);
diff --git a/src/gallium/drivers/i915/i915_buffer.c b/src/gallium/drivers/i915/i915_buffer.c
index 0f76a59e93..1247de320d 100644
--- a/src/gallium/drivers/i915/i915_buffer.c
+++ b/src/gallium/drivers/i915/i915_buffer.c
@@ -28,13 +28,13 @@
#include "i915_screen.h"
#include "i915_buffer.h"
-struct intel_buffer;
+struct i915_winsys_buffer;
struct i915_buffer
{
struct pipe_buffer base;
- struct intel_buffer *ibuf; /** hw buffer */
+ struct i915_winsys_buffer *ibuf; /** hw buffer */
void *data; /**< user and malloc data */
boolean own; /**< we own the data incase of malloc */
diff --git a/src/gallium/drivers/i915/i915_context.c b/src/gallium/drivers/i915/i915_context.c
index 3d45a22b7e..130519ffa5 100644
--- a/src/gallium/drivers/i915/i915_context.c
+++ b/src/gallium/drivers/i915/i915_context.c
@@ -221,6 +221,7 @@ i915_create_context(struct pipe_screen *screen, void *priv)
i915_init_surface_functions(i915);
i915_init_state_functions(i915);
i915_init_flush_functions(i915);
+ i915_init_texture_functions(i915);
draw_install_aaline_stage(i915->draw, &i915->base);
draw_install_aapoint_stage(i915->draw, &i915->base);
diff --git a/src/gallium/drivers/i915/i915_context.h b/src/gallium/drivers/i915/i915_context.h
index da769e7b29..8df4dce865 100644
--- a/src/gallium/drivers/i915/i915_context.h
+++ b/src/gallium/drivers/i915/i915_context.h
@@ -38,9 +38,9 @@
#include "tgsi/tgsi_scan.h"
-struct intel_winsys;
-struct intel_buffer;
-struct intel_batchbuffer;
+struct i915_winsys;
+struct i915_winsys_buffer;
+struct i915_winsys_batchbuffer;
#define I915_TEX_UNITS 8
@@ -148,7 +148,7 @@ struct i915_state
/** Describes the current hardware vertex layout */
struct vertex_info vertex_info;
-
+
unsigned id; /* track lost context events */
};
@@ -187,6 +187,14 @@ struct i915_sampler_state {
unsigned maxlod;
};
+struct i915_velems_state {
+ unsigned count;
+ struct pipe_vertex_element velem[PIPE_MAX_ATTRIBS];
+};
+
+#define I915_MAX_TEXTURE_2D_LEVELS 11 /* max 1024x1024 */
+#define I915_MAX_TEXTURE_3D_LEVELS 8 /* max 128x128x128 */
+
struct i915_texture {
struct pipe_texture base;
@@ -199,7 +207,7 @@ struct i915_texture {
unsigned sw_tiled; /**< tiled with software flags */
unsigned hw_tiled; /**< tiled with hardware fences */
- unsigned nr_images[PIPE_MAX_TEXTURE_LEVELS];
+ unsigned nr_images[I915_MAX_TEXTURE_2D_LEVELS];
/* Explicitly store the offset of each image for each cube face or
* depth value. Pretty much have to accept that hardware formats
@@ -207,18 +215,18 @@ struct i915_texture {
* compute the offsets of depth/cube images within a mipmap level,
* so have to store them as a lookup table:
*/
- unsigned *image_offset[PIPE_MAX_TEXTURE_LEVELS]; /**< array [depth] of offsets */
+ unsigned *image_offset[I915_MAX_TEXTURE_2D_LEVELS]; /**< array [depth] of offsets */
/* The data is held here:
*/
- struct intel_buffer *buffer;
+ struct i915_winsys_buffer *buffer;
};
struct i915_context
{
struct pipe_context base;
- struct intel_winsys *iws;
+ struct i915_winsys *iws;
struct draw_context *draw;
@@ -239,21 +247,20 @@ struct i915_context
struct pipe_framebuffer_state framebuffer;
struct pipe_poly_stipple poly_stipple;
struct pipe_scissor_state scissor;
- struct i915_texture *texture[PIPE_MAX_SAMPLERS];
+ struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS];
struct pipe_viewport_state viewport;
struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
unsigned dirty;
unsigned num_samplers;
- unsigned num_textures;
- unsigned num_vertex_elements;
+ unsigned num_fragment_sampler_views;
unsigned num_vertex_buffers;
- struct intel_batchbuffer *batch;
+ struct i915_winsys_batchbuffer *batch;
/** Vertex buffer */
- struct intel_buffer *vbo;
+ struct i915_winsys_buffer *vbo;
size_t vbo_offset;
unsigned vbo_flushed;
@@ -276,7 +283,7 @@ struct i915_context
#define I915_NEW_ALPHA_TEST 0x100
#define I915_NEW_DEPTH_STENCIL 0x200
#define I915_NEW_SAMPLER 0x400
-#define I915_NEW_TEXTURE 0x800
+#define I915_NEW_SAMPLER_VIEW 0x800
#define I915_NEW_CONSTANTS 0x1000
#define I915_NEW_VBO 0x2000
#define I915_NEW_VS 0x4000
@@ -343,6 +350,12 @@ struct pipe_context *i915_create_context(struct pipe_screen *screen,
/***********************************************************************
+ * i915_texture.c
+ */
+void i915_init_texture_functions(struct i915_context *i915 );
+
+
+/***********************************************************************
* Inline conversion functions. These are better-typed than the
* macros used previously:
*/
diff --git a/src/gallium/drivers/i915/i915_debug.c b/src/gallium/drivers/i915/i915_debug.c
index 237654d26b..663fac3055 100644
--- a/src/gallium/drivers/i915/i915_debug.c
+++ b/src/gallium/drivers/i915/i915_debug.c
@@ -863,7 +863,7 @@ static boolean i915_debug_packet( struct debug_stream *stream )
void
-i915_dump_batchbuffer( struct intel_batchbuffer *batch )
+i915_dump_batchbuffer( struct i915_winsys_batchbuffer *batch )
{
struct debug_stream stream;
unsigned *start = (unsigned*)batch->map;
diff --git a/src/gallium/drivers/i915/i915_debug.h b/src/gallium/drivers/i915/i915_debug.h
index 8f7484797d..67b8d9c2f6 100644
--- a/src/gallium/drivers/i915/i915_debug.h
+++ b/src/gallium/drivers/i915/i915_debug.h
@@ -104,9 +104,9 @@ I915_DBG(
#endif
-struct intel_batchbuffer;
+struct i915_winsys_batchbuffer;
-void i915_dump_batchbuffer( struct intel_batchbuffer *i915 );
+void i915_dump_batchbuffer( struct i915_winsys_batchbuffer *i915 );
void i915_debug_init( struct i915_context *i915 );
diff --git a/src/gallium/drivers/i915/i915_debug_fp.c b/src/gallium/drivers/i915/i915_debug_fp.c
index 066e7392d1..f41c51f299 100644
--- a/src/gallium/drivers/i915/i915_debug_fp.c
+++ b/src/gallium/drivers/i915/i915_debug_fp.c
@@ -28,7 +28,6 @@
#include "i915_reg.h"
#include "i915_debug.h"
-#include "util/u_simple_screen.h"
#include "util/u_debug.h"
diff --git a/src/gallium/drivers/i915/i915_prim_emit.c b/src/gallium/drivers/i915/i915_prim_emit.c
index d9a5c40ab9..dd997e2cf4 100644
--- a/src/gallium/drivers/i915/i915_prim_emit.c
+++ b/src/gallium/drivers/i915/i915_prim_emit.c
@@ -102,6 +102,13 @@ emit_hw_vertex( struct i915_context *i915,
count += 4;
break;
case EMIT_4UB:
+ OUT_BATCH( pack_ub4(float_to_ubyte( attrib[0] ),
+ float_to_ubyte( attrib[1] ),
+ float_to_ubyte( attrib[2] ),
+ float_to_ubyte( attrib[3] )) );
+ count += 1;
+ break;
+ case EMIT_4UB_BGRA:
OUT_BATCH( pack_ub4(float_to_ubyte( attrib[2] ),
float_to_ubyte( attrib[1] ),
float_to_ubyte( attrib[0] ),
diff --git a/src/gallium/drivers/i915/i915_prim_vbuf.c b/src/gallium/drivers/i915/i915_prim_vbuf.c
index cad4109ee6..df9e68af4f 100644
--- a/src/gallium/drivers/i915/i915_prim_vbuf.c
+++ b/src/gallium/drivers/i915/i915_prim_vbuf.c
@@ -76,7 +76,7 @@ struct i915_vbuf_render {
unsigned fallback;
/* Stuff for the vbo */
- struct intel_buffer *vbo;
+ struct i915_winsys_buffer *vbo;
size_t vbo_size; /**< current size of allocated buffer */
size_t vbo_alloc_size; /**< minimum buffer size to allocate */
size_t vbo_offset;
@@ -141,7 +141,7 @@ static void
i915_vbuf_render_new_buf(struct i915_vbuf_render *i915_render, size_t size)
{
struct i915_context *i915 = i915_render->i915;
- struct intel_winsys *iws = i915->iws;
+ struct i915_winsys *iws = i915->iws;
if (i915_render->vbo) {
#ifdef VBUF_USE_FIFO
@@ -172,7 +172,7 @@ i915_vbuf_render_new_buf(struct i915_vbuf_render *i915_render, size_t size)
if (i915_render->vbo_size != i915_render->pool_buffer_size) {
i915_render->pool_not_used = TRUE;
i915_render->vbo = iws->buffer_create(iws, i915_render->vbo_size, 64,
- INTEL_NEW_VERTEX);
+ I915_NEW_VERTEX);
} else {
i915_render->pool_not_used = FALSE;
@@ -185,7 +185,7 @@ i915_vbuf_render_new_buf(struct i915_vbuf_render *i915_render, size_t size)
}
#else
i915_render->vbo = iws->buffer_create(iws, i915_render->vbo_size,
- 64, INTEL_NEW_VERTEX);
+ 64, I915_NEW_VERTEX);
#endif
}
@@ -225,7 +225,7 @@ i915_vbuf_render_map_vertices(struct vbuf_render *render)
{
struct i915_vbuf_render *i915_render = i915_vbuf_render(render);
struct i915_context *i915 = i915_render->i915;
- struct intel_winsys *iws = i915->iws;
+ struct i915_winsys *iws = i915->iws;
if (i915->vbo_flushed)
debug_printf("%s bad vbo flush occured stalling on hw\n", __FUNCTION__);
@@ -246,7 +246,7 @@ i915_vbuf_render_unmap_vertices(struct vbuf_render *render,
{
struct i915_vbuf_render *i915_render = i915_vbuf_render(render);
struct i915_context *i915 = i915_render->i915;
- struct intel_winsys *iws = i915->iws;
+ struct i915_winsys *iws = i915->iws;
i915_render->vbo_max_used = MAX2(i915_render->vbo_max_used, i915_render->vertex_size * (max_index + 1));
#ifdef VBUF_MAP_BUFFER
@@ -621,7 +621,7 @@ static struct vbuf_render *
i915_vbuf_render_create(struct i915_context *i915)
{
struct i915_vbuf_render *i915_render = CALLOC_STRUCT(i915_vbuf_render);
- struct intel_winsys *iws = i915->iws;
+ struct i915_winsys *iws = i915->iws;
int i;
i915_render->i915 = i915;
@@ -662,7 +662,7 @@ i915_vbuf_render_create(struct i915_context *i915)
for (i = 0; i < 6; i++)
u_fifo_add(i915_render->pool_fifo,
iws->buffer_create(iws, i915_render->pool_buffer_size, 64,
- INTEL_NEW_VERTEX));
+ I915_NEW_VERTEX));
#else
(void)i;
(void)iws;
diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c
index 72bd263550..4ccc66b037 100644
--- a/src/gallium/drivers/i915/i915_screen.c
+++ b/src/gallium/drivers/i915/i915_screen.c
@@ -35,7 +35,7 @@
#include "i915_screen.h"
#include "i915_buffer.h"
#include "i915_texture.h"
-#include "intel_winsys.h"
+#include "i915_winsys.h"
/*
@@ -116,11 +116,11 @@ i915_get_param(struct pipe_screen *screen, int param)
case PIPE_CAP_TEXTURE_SHADOW_MAP:
return 1;
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
- return 11; /* max 1024x1024 */
+ return I915_MAX_TEXTURE_2D_LEVELS;
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
- return 8; /* max 128x128x128 */
+ return I915_MAX_TEXTURE_3D_LEVELS;
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
- return 11; /* max 1024x1024 */
+ return I915_MAX_TEXTURE_2D_LEVELS;
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
return 1;
@@ -165,8 +165,12 @@ i915_is_format_supported(struct pipe_screen *screen,
unsigned geom_flags)
{
static const enum pipe_format tex_supported[] = {
- PIPE_FORMAT_A8B8G8R8_UNORM,
PIPE_FORMAT_B8G8R8A8_UNORM,
+ PIPE_FORMAT_B8G8R8X8_UNORM,
+ PIPE_FORMAT_R8G8B8A8_UNORM,
+#if 0
+ PIPE_FORMAT_R8G8B8X8_UNORM,
+#endif
PIPE_FORMAT_B5G6R5_UNORM,
PIPE_FORMAT_L8_UNORM,
PIPE_FORMAT_A8_UNORM,
@@ -174,13 +178,13 @@ i915_is_format_supported(struct pipe_screen *screen,
PIPE_FORMAT_L8A8_UNORM,
PIPE_FORMAT_UYVY,
PIPE_FORMAT_YUYV,
- PIPE_FORMAT_Z24S8_UNORM,
+ PIPE_FORMAT_Z24_UNORM_S8_USCALED,
PIPE_FORMAT_NONE /* list terminator */
};
static const enum pipe_format surface_supported[] = {
PIPE_FORMAT_B8G8R8A8_UNORM,
PIPE_FORMAT_B5G6R5_UNORM,
- PIPE_FORMAT_Z24S8_UNORM,
+ PIPE_FORMAT_Z24_UNORM_S8_USCALED,
PIPE_FORMAT_NONE /* list terminator */
};
const enum pipe_format *list;
@@ -256,7 +260,7 @@ i915_destroy_screen(struct pipe_screen *screen)
* Create a new i915_screen object
*/
struct pipe_screen *
-i915_create_screen(struct intel_winsys *iws, uint pci_id)
+i915_create_screen(struct i915_winsys *iws, uint pci_id)
{
struct i915_screen *is = CALLOC_STRUCT(i915_screen);
diff --git a/src/gallium/drivers/i915/i915_screen.h b/src/gallium/drivers/i915/i915_screen.h
index 5126485caa..7f9e02fc0f 100644
--- a/src/gallium/drivers/i915/i915_screen.h
+++ b/src/gallium/drivers/i915/i915_screen.h
@@ -32,7 +32,7 @@
#include "pipe/p_screen.h"
-struct intel_winsys;
+struct i915_winsys;
/**
@@ -42,7 +42,7 @@ struct i915_screen
{
struct pipe_screen base;
- struct intel_winsys *iws;
+ struct i915_winsys *iws;
boolean is_i945;
uint pci_id;
diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c
index 62169918e2..0f7395246c 100644
--- a/src/gallium/drivers/i915/i915_state.c
+++ b/src/gallium/drivers/i915/i915_state.c
@@ -560,9 +560,9 @@ static void i915_set_constant_buffer(struct pipe_context *pipe,
}
-static void i915_set_sampler_textures(struct pipe_context *pipe,
- unsigned num,
- struct pipe_texture **texture)
+static void i915_set_fragment_sampler_views(struct pipe_context *pipe,
+ unsigned num,
+ struct pipe_sampler_view **views)
{
struct i915_context *i915 = i915_context(pipe);
uint i;
@@ -570,27 +570,54 @@ static void i915_set_sampler_textures(struct pipe_context *pipe,
assert(num <= PIPE_MAX_SAMPLERS);
/* Check for no-op */
- if (num == i915->num_textures &&
- !memcmp(i915->texture, texture, num * sizeof(struct pipe_texture *)))
+ if (num == i915->num_fragment_sampler_views &&
+ !memcmp(i915->fragment_sampler_views, views, num * sizeof(struct pipe_sampler_view *)))
return;
/* Fixes wrong texture in texobj with VBUF */
draw_flush(i915->draw);
for (i = 0; i < num; i++)
- pipe_texture_reference((struct pipe_texture **) &i915->texture[i],
- texture[i]);
+ pipe_sampler_view_reference(&i915->fragment_sampler_views[i],
+ views[i]);
- for (i = num; i < i915->num_textures; i++)
- pipe_texture_reference((struct pipe_texture **) &i915->texture[i],
- NULL);
+ for (i = num; i < i915->num_fragment_sampler_views; i++)
+ pipe_sampler_view_reference(&i915->fragment_sampler_views[i],
+ NULL);
- i915->num_textures = num;
+ i915->num_fragment_sampler_views = num;
- i915->dirty |= I915_NEW_TEXTURE;
+ i915->dirty |= I915_NEW_SAMPLER_VIEW;
}
+static struct pipe_sampler_view *
+i915_create_sampler_view(struct pipe_context *pipe,
+ struct pipe_texture *texture,
+ const struct pipe_sampler_view *templ)
+{
+ struct pipe_sampler_view *view = CALLOC_STRUCT(pipe_sampler_view);
+
+ if (view) {
+ *view = *templ;
+ view->reference.count = 1;
+ view->texture = NULL;
+ pipe_texture_reference(&view->texture, texture);
+ view->context = pipe;
+ }
+
+ return view;
+}
+
+
+static void
+i915_sampler_view_destroy(struct pipe_context *pipe,
+ struct pipe_sampler_view *view)
+{
+ pipe_texture_reference(&view->texture, NULL);
+ FREE(view);
+}
+
static void i915_set_framebuffer_state(struct pipe_context *pipe,
const struct pipe_framebuffer_state *fb)
@@ -742,21 +769,45 @@ static void i915_set_vertex_buffers(struct pipe_context *pipe,
draw_set_vertex_buffers(i915->draw, count, buffers);
}
-static void i915_set_vertex_elements(struct pipe_context *pipe,
- unsigned count,
- const struct pipe_vertex_element *elements)
+static void *
+i915_create_vertex_elements_state(struct pipe_context *pipe,
+ unsigned count,
+ const struct pipe_vertex_element *attribs)
+{
+ struct i915_velems_state *velems;
+ assert(count <= PIPE_MAX_ATTRIBS);
+ velems = (struct i915_velems_state *) MALLOC(sizeof(struct i915_velems_state));
+ if (velems) {
+ velems->count = count;
+ memcpy(velems->velem, attribs, sizeof(*attribs) * count);
+ }
+ return velems;
+}
+
+static void
+i915_bind_vertex_elements_state(struct pipe_context *pipe,
+ void *velems)
{
struct i915_context *i915 = i915_context(pipe);
+ struct i915_velems_state *i915_velems = (struct i915_velems_state *) velems;
+
/* Because we change state before the draw_set_vertex_buffers call
* we need a flush here, just to be sure.
*/
draw_flush(i915->draw);
- i915->num_vertex_elements = count;
/* pass-through to draw module */
- draw_set_vertex_elements(i915->draw, count, elements);
+ if (i915_velems) {
+ draw_set_vertex_elements(i915->draw,
+ i915_velems->count, i915_velems->velem);
+ }
}
+static void
+i915_delete_vertex_elements_state(struct pipe_context *pipe, void *velems)
+{
+ FREE( velems );
+}
void
i915_init_state_functions( struct i915_context *i915 )
@@ -782,6 +833,9 @@ i915_init_state_functions( struct i915_context *i915 )
i915->base.create_vs_state = i915_create_vs_state;
i915->base.bind_vs_state = i915_bind_vs_state;
i915->base.delete_vs_state = i915_delete_vs_state;
+ i915->base.create_vertex_elements_state = i915_create_vertex_elements_state;
+ i915->base.bind_vertex_elements_state = i915_bind_vertex_elements_state;
+ i915->base.delete_vertex_elements_state = i915_delete_vertex_elements_state;
i915->base.set_blend_color = i915_set_blend_color;
i915->base.set_stencil_ref = i915_set_stencil_ref;
@@ -791,8 +845,9 @@ i915_init_state_functions( struct i915_context *i915 )
i915->base.set_polygon_stipple = i915_set_polygon_stipple;
i915->base.set_scissor_state = i915_set_scissor_state;
- i915->base.set_fragment_sampler_textures = i915_set_sampler_textures;
+ i915->base.set_fragment_sampler_views = i915_set_fragment_sampler_views;
+ i915->base.create_sampler_view = i915_create_sampler_view;
+ i915->base.sampler_view_destroy = i915_sampler_view_destroy;
i915->base.set_viewport_state = i915_set_viewport_state;
i915->base.set_vertex_buffers = i915_set_vertex_buffers;
- i915->base.set_vertex_elements = i915_set_vertex_elements;
}
diff --git a/src/gallium/drivers/i915/i915_state_derived.c b/src/gallium/drivers/i915/i915_state_derived.c
index f5b0e9f011..4da46772b5 100644
--- a/src/gallium/drivers/i915/i915_state_derived.c
+++ b/src/gallium/drivers/i915/i915_state_derived.c
@@ -101,14 +101,14 @@ static void calculate_vertex_layout( struct i915_context *i915 )
/* primary color */
if (colors[0]) {
src = draw_find_shader_output(i915->draw, TGSI_SEMANTIC_COLOR, 0);
- draw_emit_vertex_attr(&vinfo, EMIT_4UB, colorInterp, src);
+ draw_emit_vertex_attr(&vinfo, EMIT_4UB_BGRA, colorInterp, src);
vinfo.hwfmt[0] |= S4_VFMT_COLOR;
}
/* secondary color */
if (colors[1]) {
src = draw_find_shader_output(i915->draw, TGSI_SEMANTIC_COLOR, 1);
- draw_emit_vertex_attr(&vinfo, EMIT_4UB, colorInterp, src);
+ draw_emit_vertex_attr(&vinfo, EMIT_4UB_BGRA, colorInterp, src);
vinfo.hwfmt[0] |= S4_VFMT_SPEC_FOG;
}
@@ -157,10 +157,10 @@ void i915_update_derived( struct i915_context *i915 )
if (i915->dirty & (I915_NEW_RASTERIZER | I915_NEW_FS | I915_NEW_VS))
calculate_vertex_layout( i915 );
- if (i915->dirty & (I915_NEW_SAMPLER | I915_NEW_TEXTURE))
+ if (i915->dirty & (I915_NEW_SAMPLER | I915_NEW_SAMPLER_VIEW))
i915_update_samplers(i915);
- if (i915->dirty & I915_NEW_TEXTURE)
+ if (i915->dirty & I915_NEW_SAMPLER_VIEW)
i915_update_textures(i915);
if (i915->dirty)
diff --git a/src/gallium/drivers/i915/i915_state_emit.c b/src/gallium/drivers/i915/i915_state_emit.c
index 51f0ef12ba..2d212abfb9 100644
--- a/src/gallium/drivers/i915/i915_state_emit.c
+++ b/src/gallium/drivers/i915/i915_state_emit.c
@@ -50,7 +50,7 @@ static unsigned translate_format( enum pipe_format format )
static unsigned translate_depth_format( enum pipe_format zformat )
{
switch (zformat) {
- case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
return DEPTH_FRMT_24_FIXED_8_OTHER;
case PIPE_FORMAT_Z16_UNORM:
return DEPTH_FRMT_16_FIXED;
@@ -182,7 +182,7 @@ i915_emit_hardware_state(struct i915_context *i915 )
if(i915->vbo)
OUT_RELOC(i915->vbo,
- INTEL_USAGE_VERTEX,
+ I915_USAGE_VERTEX,
i915->current.immediate[I915_IMMEDIATE_S0]);
else
/* FIXME: we should not do this */
@@ -226,7 +226,7 @@ i915_emit_hardware_state(struct i915_context *i915 )
ctile);
OUT_RELOC(tex->buffer,
- INTEL_USAGE_RENDER,
+ I915_USAGE_RENDER,
cbuf_surface->offset);
}
@@ -250,7 +250,7 @@ i915_emit_hardware_state(struct i915_context *i915 )
ztile);
OUT_RELOC(tex->buffer,
- INTEL_USAGE_RENDER,
+ I915_USAGE_RENDER,
depth_surface->offset);
}
@@ -290,13 +290,14 @@ i915_emit_hardware_state(struct i915_context *i915 )
OUT_BATCH(enabled);
for (unit = 0; unit < I915_TEX_UNITS; unit++) {
if (enabled & (1 << unit)) {
- struct intel_buffer *buf = i915->texture[unit]->buffer;
+ struct i915_texture *texture = (struct i915_texture *)i915->fragment_sampler_views[unit]->texture;
+ struct i915_winsys_buffer *buf = texture->buffer;
uint offset = 0;
assert(buf);
count++;
- OUT_RELOC(buf, INTEL_USAGE_SAMPLER, offset);
+ OUT_RELOC(buf, I915_USAGE_SAMPLER, offset);
OUT_BATCH(i915->current.texbuffer[unit][0]); /* MS3 */
OUT_BATCH(i915->current.texbuffer[unit][1]); /* MS4 */
}
diff --git a/src/gallium/drivers/i915/i915_state_immediate.c b/src/gallium/drivers/i915/i915_state_immediate.c
index d2c6f15143..8cec699285 100644
--- a/src/gallium/drivers/i915/i915_state_immediate.c
+++ b/src/gallium/drivers/i915/i915_state_immediate.c
@@ -52,11 +52,11 @@ static void upload_S0S1(struct i915_context *i915)
{
unsigned LIS0, LIS1;
- /* INTEL_NEW_VBO */
+ /* I915_NEW_VBO */
/* TODO: re-use vertex buffers here? */
LIS0 = i915->vbo_offset;
- /* INTEL_NEW_VERTEX_SIZE -- do this where the vertex size is calculated!
+ /* I915_NEW_VERTEX_SIZE -- do this where the vertex size is calculated!
*/
{
unsigned vertex_size = i915->current.vertex_info.size;
@@ -65,7 +65,7 @@ static void upload_S0S1(struct i915_context *i915)
(vertex_size << 16));
}
- /* INTEL_NEW_VBO */
+ /* I915_NEW_VBO */
/* TODO: use a vertex generation number to track vbo changes */
if (1 ||
i915->current.immediate[I915_IMMEDIATE_S0] != LIS0 ||
diff --git a/src/gallium/drivers/i915/i915_state_sampler.c b/src/gallium/drivers/i915/i915_state_sampler.c
index 9813290b51..270d4f21e1 100644
--- a/src/gallium/drivers/i915/i915_state_sampler.c
+++ b/src/gallium/drivers/i915/i915_state_sampler.c
@@ -144,20 +144,22 @@ void i915_update_samplers( struct i915_context *i915 )
i915->current.sampler_enable_nr = 0;
i915->current.sampler_enable_flags = 0x0;
- for (unit = 0; unit < i915->num_textures && unit < i915->num_samplers;
+ for (unit = 0; unit < i915->num_fragment_sampler_views && unit < i915->num_samplers;
unit++) {
/* determine unit enable/disable by looking for a bound texture */
/* could also examine the fragment program? */
- if (i915->texture[unit]) {
+ if (i915->fragment_sampler_views[unit]) {
+ struct i915_texture *texture = (struct i915_texture *)i915->fragment_sampler_views[unit]->texture;
+
update_sampler( i915,
unit,
i915->sampler[unit], /* sampler state */
- i915->texture[unit], /* texture */
+ texture, /* texture */
i915->current.sampler[unit] /* the result */
);
i915_update_texture( i915,
unit,
- i915->texture[unit], /* texture */
+ texture, /* texture */
i915->sampler[unit], /* sampler state */
i915->current.texbuffer[unit] );
@@ -190,6 +192,14 @@ translate_texture_format(enum pipe_format pipeFormat)
return MAPSURF_16BIT | MT_16BIT_ARGB4444;
case PIPE_FORMAT_B8G8R8A8_UNORM:
return MAPSURF_32BIT | MT_32BIT_ARGB8888;
+ case PIPE_FORMAT_B8G8R8X8_UNORM:
+ return MAPSURF_32BIT | MT_32BIT_XRGB8888;
+ case PIPE_FORMAT_R8G8B8A8_UNORM:
+ return MAPSURF_32BIT | MT_32BIT_ABGR8888;
+#if 0
+ case PIPE_FORMAT_R8G8B8X8_UNORM:
+ return MAPSURF_32BIT | MT_32BIT_XBGR8888;
+#endif
case PIPE_FORMAT_YUYV:
return (MAPSURF_422 | MT_422_YCRCB_NORMAL);
case PIPE_FORMAT_UYVY:
@@ -210,7 +220,7 @@ translate_texture_format(enum pipe_format pipeFormat)
case PIPE_FORMAT_RGBA_DXT5:
return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT4_5);
#endif
- case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
return (MAPSURF_32BIT | MT_32BIT_xI824);
default:
debug_printf("i915: translate_texture_format() bad image format %x\n",
@@ -281,14 +291,16 @@ i915_update_textures(struct i915_context *i915)
{
uint unit;
- for (unit = 0; unit < i915->num_textures && unit < i915->num_samplers;
+ for (unit = 0; unit < i915->num_fragment_sampler_views && unit < i915->num_samplers;
unit++) {
/* determine unit enable/disable by looking for a bound texture */
/* could also examine the fragment program? */
- if (i915->texture[unit]) {
+ if (i915->fragment_sampler_views[unit]) {
+ struct i915_texture *texture = (struct i915_texture *)i915->fragment_sampler_views[unit]->texture;
+
i915_update_texture( i915,
unit,
- i915->texture[unit], /* texture */
+ texture, /* texture */
i915->sampler[unit], /* sampler state */
i915->current.texbuffer[unit] );
}
diff --git a/src/gallium/drivers/i915/i915_texture.c b/src/gallium/drivers/i915/i915_texture.c
index 7ba222c78b..8c405c2443 100644
--- a/src/gallium/drivers/i915/i915_texture.c
+++ b/src/gallium/drivers/i915/i915_texture.c
@@ -41,7 +41,7 @@
#include "i915_context.h"
#include "i915_texture.h"
#include "i915_screen.h"
-#include "intel_winsys.h"
+#include "i915_winsys.h"
/*
@@ -96,7 +96,7 @@ i915_miptree_set_level_info(struct i915_texture *tex,
unsigned nr_images,
unsigned w, unsigned h, unsigned d)
{
- assert(level < PIPE_MAX_TEXTURE_LEVELS);
+ assert(level < Elements(tex->nr_images));
tex->nr_images[level] = nr_images;
@@ -162,7 +162,7 @@ i915_scanout_layout(struct i915_texture *tex)
if (pt->width0 >= 240) {
tex->stride = power_of_two(util_format_get_stride(pt->format, pt->width0));
tex->total_nblocksy = align(util_format_get_nblocksy(pt->format, pt->height0), 8);
- tex->hw_tiled = INTEL_TILE_X;
+ tex->hw_tiled = I915_TILE_X;
} else if (pt->width0 == 64 && pt->height0 == 64) {
tex->stride = power_of_two(util_format_get_stride(pt->format, pt->width0));
tex->total_nblocksy = align(util_format_get_nblocksy(pt->format, pt->height0), 8);
@@ -200,7 +200,7 @@ i915_display_target_layout(struct i915_texture *tex)
tex->stride = power_of_two(util_format_get_stride(pt->format, pt->width0));
tex->total_nblocksy = align(util_format_get_nblocksy(pt->format, pt->height0), 8);
- tex->hw_tiled = INTEL_TILE_X;
+ tex->hw_tiled = I915_TILE_X;
debug_printf("%s size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__,
pt->width0, pt->height0, util_format_get_blocksize(pt->format),
@@ -219,12 +219,12 @@ i915_miptree_layout_2d(struct i915_texture *tex)
unsigned nblocksy = util_format_get_nblocksy(pt->format, pt->width0);
/* used for scanouts that need special layouts */
- if (pt->tex_usage & PIPE_TEXTURE_USAGE_PRIMARY)
+ if (pt->tex_usage & PIPE_TEXTURE_USAGE_SCANOUT)
if (i915_scanout_layout(tex))
return;
- /* for shared buffers we use something very like scanout */
- if (pt->tex_usage & PIPE_TEXTURE_USAGE_DISPLAY_TARGET)
+ /* shared buffers needs to be compatible with X servers */
+ if (pt->tex_usage & PIPE_TEXTURE_USAGE_SHARED)
if (i915_display_target_layout(tex))
return;
@@ -369,12 +369,12 @@ i945_miptree_layout_2d(struct i915_texture *tex)
unsigned nblocksy = util_format_get_nblocksy(pt->format, pt->height0);
/* used for scanouts that need special layouts */
- if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_PRIMARY)
+ if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_SCANOUT)
if (i915_scanout_layout(tex))
return;
- /* for shared buffers we use some very like scanout */
- if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_DISPLAY_TARGET)
+ /* shared buffers needs to be compatible with X servers */
+ if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_SHARED)
if (i915_display_target_layout(tex))
return;
@@ -617,7 +617,7 @@ i915_texture_create(struct pipe_screen *screen,
const struct pipe_texture *templat)
{
struct i915_screen *is = i915_screen(screen);
- struct intel_winsys *iws = is->iws;
+ struct i915_winsys *iws = is->iws;
struct i915_texture *tex = CALLOC_STRUCT(i915_texture);
size_t tex_size;
unsigned buf_usage = 0;
@@ -642,10 +642,10 @@ i915_texture_create(struct pipe_screen *screen,
/* for scanouts and cursors, cursors arn't scanouts */
- if (templat->tex_usage & PIPE_TEXTURE_USAGE_PRIMARY && templat->width0 != 64)
- buf_usage = INTEL_NEW_SCANOUT;
+ if (templat->tex_usage & PIPE_TEXTURE_USAGE_SCANOUT && templat->width0 != 64)
+ buf_usage = I915_NEW_SCANOUT;
else
- buf_usage = INTEL_NEW_TEXTURE;
+ buf_usage = I915_NEW_TEXTURE;
tex->buffer = iws->buffer_create(iws, tex_size, 64, buf_usage);
if (!tex->buffer)
@@ -653,7 +653,7 @@ i915_texture_create(struct pipe_screen *screen,
/* setup any hw fences */
if (tex->hw_tiled) {
- assert(tex->sw_tiled == INTEL_TILE_NONE);
+ assert(tex->sw_tiled == I915_TILE_NONE);
iws->buffer_set_fence_reg(iws, tex->buffer, tex->stride, tex->hw_tiled);
}
@@ -673,19 +673,24 @@ fail:
}
static struct pipe_texture *
-i915_texture_blanket(struct pipe_screen * screen,
- const struct pipe_texture *base,
- const unsigned *stride,
- struct pipe_buffer *buffer)
+i915_texture_from_handle(struct pipe_screen * screen,
+ const struct pipe_texture *templat,
+ struct winsys_handle *whandle)
{
-#if 0
+ struct i915_screen *is = i915_screen(screen);
struct i915_texture *tex;
+ struct i915_winsys *iws = is->iws;
+ struct i915_winsys_buffer *buffer;
+ unsigned stride;
+
assert(screen);
+ buffer = iws->buffer_from_handle(iws, whandle, &stride);
+
/* Only supports one type */
- if (base->target != PIPE_TEXTURE_2D ||
- base->last_level != 0 ||
- base->depth0 != 1) {
+ if (templat->target != PIPE_TEXTURE_2D ||
+ templat->last_level != 0 ||
+ templat->depth0 != 1) {
return NULL;
}
@@ -693,28 +698,38 @@ i915_texture_blanket(struct pipe_screen * screen,
if (!tex)
return NULL;
- tex->base = *base;
+ tex->base = *templat;
pipe_reference_init(&tex->base.reference, 1);
tex->base.screen = screen;
- tex->stride = stride[0];
+ tex->stride = stride;
- i915_miptree_set_level_info(tex, 0, 1, base->width0, base->height0, 1);
+ i915_miptree_set_level_info(tex, 0, 1, templat->width0, templat->height0, 1);
i915_miptree_set_image_offset(tex, 0, 0, 0, 0);
- pipe_buffer_reference(&tex->buffer, buffer);
+ tex->buffer = buffer;
return &tex->base;
-#else
- return NULL;
-#endif
}
+static boolean
+i915_texture_get_handle(struct pipe_screen * screen,
+ struct pipe_texture *texture,
+ struct winsys_handle *whandle)
+{
+ struct i915_screen *is = i915_screen(screen);
+ struct i915_texture *tex = (struct i915_texture *)texture;
+ struct i915_winsys *iws = is->iws;
+
+ return iws->buffer_get_handle(iws, tex->buffer, whandle, tex->stride);
+}
+
+
static void
i915_texture_destroy(struct pipe_texture *pt)
{
struct i915_texture *tex = (struct i915_texture *)pt;
- struct intel_winsys *iws = i915_screen(pt->screen)->iws;
+ struct i915_winsys *iws = i915_screen(pt->screen)->iws;
uint i;
/*
@@ -723,7 +738,7 @@ i915_texture_destroy(struct pipe_texture *pt)
iws->buffer_destroy(iws, tex->buffer);
- for (i = 0; i < PIPE_MAX_TEXTURE_LEVELS; i++)
+ for (i = 0; i < Elements(tex->image_offset); i++)
if (tex->image_offset[i])
FREE(tex->image_offset[i]);
@@ -780,12 +795,12 @@ i915_tex_surface_destroy(struct pipe_surface *surf)
/*
- * Screen transfer functions
+ * Texture transfer functions
*/
-static struct pipe_transfer*
-i915_get_tex_transfer(struct pipe_screen *screen,
+static struct pipe_transfer *
+i915_get_tex_transfer(struct pipe_context *pipe,
struct pipe_texture *texture,
unsigned face, unsigned level, unsigned zslice,
enum pipe_transfer_usage usage, unsigned x, unsigned y,
@@ -822,11 +837,11 @@ i915_get_tex_transfer(struct pipe_screen *screen,
}
static void *
-i915_transfer_map(struct pipe_screen *screen,
+i915_transfer_map(struct pipe_context *pipe,
struct pipe_transfer *transfer)
{
struct i915_texture *tex = (struct i915_texture *)transfer->texture;
- struct intel_winsys *iws = i915_screen(tex->base.screen)->iws;
+ struct i915_winsys *iws = i915_screen(tex->base.screen)->iws;
char *map;
boolean write = FALSE;
enum pipe_format format = tex->base.format;
@@ -844,16 +859,17 @@ i915_transfer_map(struct pipe_screen *screen,
}
static void
-i915_transfer_unmap(struct pipe_screen *screen,
+i915_transfer_unmap(struct pipe_context *pipe,
struct pipe_transfer *transfer)
{
struct i915_texture *tex = (struct i915_texture *)transfer->texture;
- struct intel_winsys *iws = i915_screen(tex->base.screen)->iws;
+ struct i915_winsys *iws = i915_screen(tex->base.screen)->iws;
iws->buffer_unmap(iws, tex->buffer);
}
static void
-i915_tex_transfer_destroy(struct pipe_transfer *trans)
+i915_tex_transfer_destroy(struct pipe_context *pipe,
+ struct pipe_transfer *trans)
{
pipe_texture_reference(&trans->texture, NULL);
FREE(trans);
@@ -864,67 +880,22 @@ i915_tex_transfer_destroy(struct pipe_transfer *trans)
* Other texture functions
*/
+void
+i915_init_texture_functions(struct i915_context *i915 )
+{
+ i915->base.get_tex_transfer = i915_get_tex_transfer;
+ i915->base.transfer_map = i915_transfer_map;
+ i915->base.transfer_unmap = i915_transfer_unmap;
+ i915->base.tex_transfer_destroy = i915_tex_transfer_destroy;
+}
void
i915_init_screen_texture_functions(struct i915_screen *is)
{
is->base.texture_create = i915_texture_create;
- is->base.texture_blanket = i915_texture_blanket;
+ is->base.texture_from_handle = i915_texture_from_handle;
+ is->base.texture_get_handle = i915_texture_get_handle;
is->base.texture_destroy = i915_texture_destroy;
is->base.get_tex_surface = i915_get_tex_surface;
is->base.tex_surface_destroy = i915_tex_surface_destroy;
- is->base.get_tex_transfer = i915_get_tex_transfer;
- is->base.transfer_map = i915_transfer_map;
- is->base.transfer_unmap = i915_transfer_unmap;
- is->base.tex_transfer_destroy = i915_tex_transfer_destroy;
-}
-
-struct pipe_texture *
-i915_texture_blanket_intel(struct pipe_screen *screen,
- struct pipe_texture *base,
- unsigned stride,
- struct intel_buffer *buffer)
-{
- struct i915_texture *tex;
- assert(screen);
-
- /* Only supports one type */
- if (base->target != PIPE_TEXTURE_2D ||
- base->last_level != 0 ||
- base->depth0 != 1) {
- return NULL;
- }
-
- tex = CALLOC_STRUCT(i915_texture);
- if (!tex)
- return NULL;
-
- tex->base = *base;
- pipe_reference_init(&tex->base.reference, 1);
- tex->base.screen = screen;
-
- tex->stride = stride;
-
- i915_miptree_set_level_info(tex, 0, 1, base->width0, base->height0, 1);
- i915_miptree_set_image_offset(tex, 0, 0, 0, 0);
-
- tex->buffer = buffer;
-
- return &tex->base;
-}
-
-boolean
-i915_get_texture_buffer_intel(struct pipe_texture *texture,
- struct intel_buffer **buffer,
- unsigned *stride)
-{
- struct i915_texture *tex = (struct i915_texture *)texture;
-
- if (!texture)
- return FALSE;
-
- *stride = tex->stride;
- *buffer = tex->buffer;
-
- return TRUE;
}
diff --git a/src/gallium/drivers/i915/intel_winsys.h b/src/gallium/drivers/i915/i915_winsys.h
index b3a802b0e2..246e95b00d 100644
--- a/src/gallium/drivers/i915/intel_winsys.h
+++ b/src/gallium/drivers/i915/i915_winsys.h
@@ -23,45 +23,46 @@
*
**************************************************************************/
-#ifndef INTEL_WINSYS_H
-#define INTEL_WINSYS_H
+#ifndef I915_WINSYS_H
+#define I915_WINSYS_H
#include "pipe/p_compiler.h"
-struct intel_winsys;
-struct intel_buffer;
-struct intel_batchbuffer;
+struct i915_winsys;
+struct i915_winsys_buffer;
+struct i915_winsys_batchbuffer;
struct pipe_texture;
struct pipe_fence_handle;
+struct winsys_handle;
-enum intel_buffer_usage
+enum i915_winsys_buffer_usage
{
/* use on textures */
- INTEL_USAGE_RENDER = 0x01,
- INTEL_USAGE_SAMPLER = 0x02,
- INTEL_USAGE_2D_TARGET = 0x04,
- INTEL_USAGE_2D_SOURCE = 0x08,
+ I915_USAGE_RENDER = 0x01,
+ I915_USAGE_SAMPLER = 0x02,
+ I915_USAGE_2D_TARGET = 0x04,
+ I915_USAGE_2D_SOURCE = 0x08,
/* use on vertex */
- INTEL_USAGE_VERTEX = 0x10
+ I915_USAGE_VERTEX = 0x10
};
-enum intel_buffer_type
+enum i915_winsys_buffer_type
{
- INTEL_NEW_TEXTURE,
- INTEL_NEW_SCANOUT, /**< a texture used for scanning out from */
- INTEL_NEW_VERTEX
+ I915_NEW_TEXTURE,
+ I915_NEW_SCANOUT, /**< a texture used for scanning out from */
+ I915_NEW_VERTEX
};
-enum intel_buffer_tile
+enum i915_winsys_buffer_tile
{
- INTEL_TILE_NONE,
- INTEL_TILE_X,
- INTEL_TILE_Y
+ I915_TILE_NONE,
+ I915_TILE_X,
+ I915_TILE_Y
};
-struct intel_batchbuffer {
+struct i915_winsys_batchbuffer {
- struct intel_winsys *iws;
+ struct i915_winsys *iws;
/**
* Values exported to speed up the writing the batchbuffer,
@@ -78,7 +79,7 @@ struct intel_batchbuffer {
/*@}*/
};
-struct intel_winsys {
+struct i915_winsys {
/**
* Batchbuffer functions.
@@ -87,7 +88,8 @@ struct intel_winsys {
/**
* Create a new batchbuffer.
*/
- struct intel_batchbuffer *(*batchbuffer_create)(struct intel_winsys *iws);
+ struct i915_winsys_batchbuffer *
+ (*batchbuffer_create)(struct i915_winsys *iws);
/**
* Emit a relocation to a buffer.
@@ -99,21 +101,21 @@ struct intel_winsys {
* @offset add this to the reloc buffers address
* @target buffer where to write the address, null for batchbuffer.
*/
- int (*batchbuffer_reloc)(struct intel_batchbuffer *batch,
- struct intel_buffer *reloc,
- enum intel_buffer_usage usage,
+ int (*batchbuffer_reloc)(struct i915_winsys_batchbuffer *batch,
+ struct i915_winsys_buffer *reloc,
+ enum i915_winsys_buffer_usage usage,
unsigned offset);
/**
* Flush a bufferbatch.
*/
- void (*batchbuffer_flush)(struct intel_batchbuffer *batch,
+ void (*batchbuffer_flush)(struct i915_winsys_batchbuffer *batch,
struct pipe_fence_handle **fence);
/**
* Destroy a batchbuffer.
*/
- void (*batchbuffer_destroy)(struct intel_batchbuffer *batch);
+ void (*batchbuffer_destroy)(struct i915_winsys_batchbuffer *batch);
/*@}*/
@@ -124,45 +126,66 @@ struct intel_winsys {
/**
* Create a buffer.
*/
- struct intel_buffer *(*buffer_create)(struct intel_winsys *iws,
- unsigned size, unsigned alignment,
- enum intel_buffer_type type);
+ struct i915_winsys_buffer *
+ (*buffer_create)(struct i915_winsys *iws,
+ unsigned size, unsigned alignment,
+ enum i915_winsys_buffer_type type);
+
+ /**
+ * Creates a buffer from a handle.
+ * Used to implement pipe_screen::texture_from_handle.
+ * Also provides the stride information needed for the
+ * texture via the stride argument.
+ */
+ struct i915_winsys_buffer *
+ (*buffer_from_handle)(struct i915_winsys *iws,
+ struct winsys_handle *whandle,
+ unsigned *stride);
+
+ /**
+ * Used to implement pipe_screen::texture_get_handle.
+ * The winsys might need the stride information.
+ */
+ boolean (*buffer_get_handle)(struct i915_winsys *iws,
+ struct i915_winsys_buffer *buffer,
+ struct winsys_handle *whandle,
+ unsigned stride);
/**
* Fence a buffer with a fence reg.
* Not to be confused with pipe_fence_handle.
*/
- int (*buffer_set_fence_reg)(struct intel_winsys *iws,
- struct intel_buffer *buffer,
+ int (*buffer_set_fence_reg)(struct i915_winsys *iws,
+ struct i915_winsys_buffer *buffer,
unsigned stride,
- enum intel_buffer_tile tile);
+ enum i915_winsys_buffer_tile tile);
/**
* Map a buffer.
*/
- void *(*buffer_map)(struct intel_winsys *iws,
- struct intel_buffer *buffer,
+ void *(*buffer_map)(struct i915_winsys *iws,
+ struct i915_winsys_buffer *buffer,
boolean write);
/**
* Unmap a buffer.
*/
- void (*buffer_unmap)(struct intel_winsys *iws,
- struct intel_buffer *buffer);
+ void (*buffer_unmap)(struct i915_winsys *iws,
+ struct i915_winsys_buffer *buffer);
/**
* Write to a buffer.
*
* Arguments follows pipe_buffer_write.
*/
- int (*buffer_write)(struct intel_winsys *iws,
- struct intel_buffer *dst,
+ int (*buffer_write)(struct i915_winsys *iws,
+ struct i915_winsys_buffer *dst,
size_t offset,
size_t size,
const void *data);
- void (*buffer_destroy)(struct intel_winsys *iws,
- struct intel_buffer *buffer);
+ void (*buffer_destroy)(struct i915_winsys *iws,
+ struct i915_winsys_buffer *buffer);
/*@}*/
@@ -173,20 +196,20 @@ struct intel_winsys {
/**
* Reference fence and set ptr to fence.
*/
- void (*fence_reference)(struct intel_winsys *iws,
+ void (*fence_reference)(struct i915_winsys *iws,
struct pipe_fence_handle **ptr,
struct pipe_fence_handle *fence);
/**
* Check if a fence has finished.
*/
- int (*fence_signalled)(struct intel_winsys *iws,
+ int (*fence_signalled)(struct i915_winsys *iws,
struct pipe_fence_handle *fence);
/**
* Wait on a fence to finish.
*/
- int (*fence_finish)(struct intel_winsys *iws,
+ int (*fence_finish)(struct i915_winsys *iws,
struct pipe_fence_handle *fence);
/*@}*/
@@ -194,33 +217,14 @@ struct intel_winsys {
/**
* Destroy the winsys.
*/
- void (*destroy)(struct intel_winsys *iws);
+ void (*destroy)(struct i915_winsys *iws);
};
/**
* Create i915 pipe_screen.
*/
-struct pipe_screen *i915_create_screen(struct intel_winsys *iws, unsigned pci_id);
-
-
-/**
- * Get the intel_winsys buffer backing the texture.
- *
- * TODO UGLY
- */
-boolean i915_get_texture_buffer_intel(struct pipe_texture *texture,
- struct intel_buffer **buffer,
- unsigned *stride);
+struct pipe_screen *i915_create_screen(struct i915_winsys *iws, unsigned pci_id);
-/**
- * Wrap a intel_winsys buffer with a texture blanket.
- *
- * TODO UGLY
- */
-struct pipe_texture * i915_texture_blanket_intel(struct pipe_screen *screen,
- struct pipe_texture *tmplt,
- unsigned pitch,
- struct intel_buffer *buffer);
#endif
diff --git a/src/gallium/drivers/i965/brw_context.c b/src/gallium/drivers/i965/brw_context.c
index 3dbe2b9130..4bcdcdd17e 100644
--- a/src/gallium/drivers/i965/brw_context.c
+++ b/src/gallium/drivers/i965/brw_context.c
@@ -118,6 +118,7 @@ struct pipe_context *brw_create_context(struct pipe_screen *screen,
brw->sws = brw_screen(screen)->sws;
brw->chipset = brw_screen(screen)->chipset;
+ brw_tex_init( brw );
brw_pipe_blend_init( brw );
brw_pipe_depth_stencil_init( brw );
brw_pipe_framebuffer_init( brw );
diff --git a/src/gallium/drivers/i965/brw_context.h b/src/gallium/drivers/i965/brw_context.h
index 12cfa7b049..dab881fea2 100644
--- a/src/gallium/drivers/i965/brw_context.h
+++ b/src/gallium/drivers/i965/brw_context.h
@@ -351,7 +351,7 @@ struct brw_vs_prog_data {
/* Size == 0 if output either not written, or always [0,0,0,1]
*/
-struct brw_vs_ouput_sizes {
+struct brw_vs_output_sizes {
GLubyte output_size[PIPE_MAX_SHADER_OUTPUTS];
};
@@ -546,15 +546,14 @@ struct brw_context
const struct brw_blend_state *blend;
const struct brw_rasterizer_state *rast;
const struct brw_depth_stencil_state *zstencil;
+ const struct brw_vertex_element_packet *velems;
const struct brw_sampler *sampler[PIPE_MAX_SAMPLERS];
unsigned num_samplers;
- struct pipe_texture *texture[PIPE_MAX_SAMPLERS];
+ struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS];
struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
- struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS];
- unsigned num_vertex_elements;
- unsigned num_textures;
+ unsigned num_fragment_sampler_views;
unsigned num_vertex_buffers;
struct pipe_scissor_state scissor;
diff --git a/src/gallium/drivers/i965/brw_draw_upload.c b/src/gallium/drivers/i965/brw_draw_upload.c
index 9f136eec71..0820ba20a0 100644
--- a/src/gallium/drivers/i965/brw_draw_upload.c
+++ b/src/gallium/drivers/i965/brw_draw_upload.c
@@ -42,141 +42,6 @@
-static unsigned brw_translate_surface_format( unsigned id )
-{
- switch (id) {
- case PIPE_FORMAT_R64_FLOAT:
- return BRW_SURFACEFORMAT_R64_FLOAT;
- case PIPE_FORMAT_R64G64_FLOAT:
- return BRW_SURFACEFORMAT_R64G64_FLOAT;
- case PIPE_FORMAT_R64G64B64_FLOAT:
- return BRW_SURFACEFORMAT_R64G64B64_FLOAT;
- case PIPE_FORMAT_R64G64B64A64_FLOAT:
- return BRW_SURFACEFORMAT_R64G64B64A64_FLOAT;
-
- case PIPE_FORMAT_R32_FLOAT:
- return BRW_SURFACEFORMAT_R32_FLOAT;
- case PIPE_FORMAT_R32G32_FLOAT:
- return BRW_SURFACEFORMAT_R32G32_FLOAT;
- case PIPE_FORMAT_R32G32B32_FLOAT:
- return BRW_SURFACEFORMAT_R32G32B32_FLOAT;
- case PIPE_FORMAT_R32G32B32A32_FLOAT:
- return BRW_SURFACEFORMAT_R32G32B32A32_FLOAT;
-
- case PIPE_FORMAT_R32_UNORM:
- return BRW_SURFACEFORMAT_R32_UNORM;
- case PIPE_FORMAT_R32G32_UNORM:
- return BRW_SURFACEFORMAT_R32G32_UNORM;
- case PIPE_FORMAT_R32G32B32_UNORM:
- return BRW_SURFACEFORMAT_R32G32B32_UNORM;
- case PIPE_FORMAT_R32G32B32A32_UNORM:
- return BRW_SURFACEFORMAT_R32G32B32A32_UNORM;
-
- case PIPE_FORMAT_R32_USCALED:
- return BRW_SURFACEFORMAT_R32_USCALED;
- case PIPE_FORMAT_R32G32_USCALED:
- return BRW_SURFACEFORMAT_R32G32_USCALED;
- case PIPE_FORMAT_R32G32B32_USCALED:
- return BRW_SURFACEFORMAT_R32G32B32_USCALED;
- case PIPE_FORMAT_R32G32B32A32_USCALED:
- return BRW_SURFACEFORMAT_R32G32B32A32_USCALED;
-
- case PIPE_FORMAT_R32_SNORM:
- return BRW_SURFACEFORMAT_R32_SNORM;
- case PIPE_FORMAT_R32G32_SNORM:
- return BRW_SURFACEFORMAT_R32G32_SNORM;
- case PIPE_FORMAT_R32G32B32_SNORM:
- return BRW_SURFACEFORMAT_R32G32B32_SNORM;
- case PIPE_FORMAT_R32G32B32A32_SNORM:
- return BRW_SURFACEFORMAT_R32G32B32A32_SNORM;
-
- case PIPE_FORMAT_R32_SSCALED:
- return BRW_SURFACEFORMAT_R32_SSCALED;
- case PIPE_FORMAT_R32G32_SSCALED:
- return BRW_SURFACEFORMAT_R32G32_SSCALED;
- case PIPE_FORMAT_R32G32B32_SSCALED:
- return BRW_SURFACEFORMAT_R32G32B32_SSCALED;
- case PIPE_FORMAT_R32G32B32A32_SSCALED:
- return BRW_SURFACEFORMAT_R32G32B32A32_SSCALED;
-
- case PIPE_FORMAT_R16_UNORM:
- return BRW_SURFACEFORMAT_R16_UNORM;
- case PIPE_FORMAT_R16G16_UNORM:
- return BRW_SURFACEFORMAT_R16G16_UNORM;
- case PIPE_FORMAT_R16G16B16_UNORM:
- return BRW_SURFACEFORMAT_R16G16B16_UNORM;
- case PIPE_FORMAT_R16G16B16A16_UNORM:
- return BRW_SURFACEFORMAT_R16G16B16A16_UNORM;
-
- case PIPE_FORMAT_R16_USCALED:
- return BRW_SURFACEFORMAT_R16_USCALED;
- case PIPE_FORMAT_R16G16_USCALED:
- return BRW_SURFACEFORMAT_R16G16_USCALED;
- case PIPE_FORMAT_R16G16B16_USCALED:
- return BRW_SURFACEFORMAT_R16G16B16_USCALED;
- case PIPE_FORMAT_R16G16B16A16_USCALED:
- return BRW_SURFACEFORMAT_R16G16B16A16_USCALED;
-
- case PIPE_FORMAT_R16_SNORM:
- return BRW_SURFACEFORMAT_R16_SNORM;
- case PIPE_FORMAT_R16G16_SNORM:
- return BRW_SURFACEFORMAT_R16G16_SNORM;
- case PIPE_FORMAT_R16G16B16_SNORM:
- return BRW_SURFACEFORMAT_R16G16B16_SNORM;
- case PIPE_FORMAT_R16G16B16A16_SNORM:
- return BRW_SURFACEFORMAT_R16G16B16A16_SNORM;
-
- case PIPE_FORMAT_R16_SSCALED:
- return BRW_SURFACEFORMAT_R16_SSCALED;
- case PIPE_FORMAT_R16G16_SSCALED:
- return BRW_SURFACEFORMAT_R16G16_SSCALED;
- case PIPE_FORMAT_R16G16B16_SSCALED:
- return BRW_SURFACEFORMAT_R16G16B16_SSCALED;
- case PIPE_FORMAT_R16G16B16A16_SSCALED:
- return BRW_SURFACEFORMAT_R16G16B16A16_SSCALED;
-
- case PIPE_FORMAT_R8_UNORM:
- return BRW_SURFACEFORMAT_R8_UNORM;
- case PIPE_FORMAT_R8G8_UNORM:
- return BRW_SURFACEFORMAT_R8G8_UNORM;
- case PIPE_FORMAT_R8G8B8_UNORM:
- return BRW_SURFACEFORMAT_R8G8B8_UNORM;
- case PIPE_FORMAT_R8G8B8A8_UNORM:
- return BRW_SURFACEFORMAT_R8G8B8A8_UNORM;
-
- case PIPE_FORMAT_R8_USCALED:
- return BRW_SURFACEFORMAT_R8_USCALED;
- case PIPE_FORMAT_R8G8_USCALED:
- return BRW_SURFACEFORMAT_R8G8_USCALED;
- case PIPE_FORMAT_R8G8B8_USCALED:
- return BRW_SURFACEFORMAT_R8G8B8_USCALED;
- case PIPE_FORMAT_R8G8B8A8_USCALED:
- return BRW_SURFACEFORMAT_R8G8B8A8_USCALED;
-
- case PIPE_FORMAT_R8_SNORM:
- return BRW_SURFACEFORMAT_R8_SNORM;
- case PIPE_FORMAT_R8G8_SNORM:
- return BRW_SURFACEFORMAT_R8G8_SNORM;
- case PIPE_FORMAT_R8G8B8_SNORM:
- return BRW_SURFACEFORMAT_R8G8B8_SNORM;
- case PIPE_FORMAT_R8G8B8A8_SNORM:
- return BRW_SURFACEFORMAT_R8G8B8A8_SNORM;
-
- case PIPE_FORMAT_R8_SSCALED:
- return BRW_SURFACEFORMAT_R8_SSCALED;
- case PIPE_FORMAT_R8G8_SSCALED:
- return BRW_SURFACEFORMAT_R8G8_SSCALED;
- case PIPE_FORMAT_R8G8B8_SSCALED:
- return BRW_SURFACEFORMAT_R8G8B8_SSCALED;
- case PIPE_FORMAT_R8G8B8A8_SSCALED:
- return BRW_SURFACEFORMAT_R8G8B8A8_SSCALED;
-
- default:
- assert(0);
- return 0;
- }
-}
-
static unsigned get_index_type(int type)
{
switch (type) {
@@ -315,75 +180,16 @@ static int brw_emit_vertex_buffers( struct brw_context *brw )
-
static int brw_emit_vertex_elements(struct brw_context *brw)
{
- GLuint nr = brw->curr.num_vertex_elements;
- GLuint i;
+ const struct brw_vertex_element_packet *brw_velems = brw->curr.velems;
+ unsigned size = brw_velems->header.length + 2;
+ /* why is this here */
brw_emit_query_begin(brw);
- /* If the VS doesn't read any inputs (calculating vertex position from
- * a state variable for some reason, for example), emit a single pad
- * VERTEX_ELEMENT struct and bail.
- *
- * The stale VB state stays in place, but they don't do anything unless
- * a VE loads from them.
- */
- if (nr == 0) {
- BEGIN_BATCH(3, IGNORE_CLIPRECTS);
- OUT_BATCH((CMD_VERTEX_ELEMENT << 16) | 1);
- OUT_BATCH((0 << BRW_VE0_INDEX_SHIFT) |
- BRW_VE0_VALID |
- (BRW_SURFACEFORMAT_R32G32B32A32_FLOAT << BRW_VE0_FORMAT_SHIFT) |
- (0 << BRW_VE0_SRC_OFFSET_SHIFT));
- OUT_BATCH((BRW_VE1_COMPONENT_STORE_0 << BRW_VE1_COMPONENT_0_SHIFT) |
- (BRW_VE1_COMPONENT_STORE_0 << BRW_VE1_COMPONENT_1_SHIFT) |
- (BRW_VE1_COMPONENT_STORE_0 << BRW_VE1_COMPONENT_2_SHIFT) |
- (BRW_VE1_COMPONENT_STORE_1_FLT << BRW_VE1_COMPONENT_3_SHIFT));
- ADVANCE_BATCH();
- return 0;
- }
-
- /* Now emit vertex element (VEP) state packets.
- *
- */
- BEGIN_BATCH(1 + nr * 2, IGNORE_CLIPRECTS);
- OUT_BATCH((CMD_VERTEX_ELEMENT << 16) | ((1 + nr * 2) - 2));
- for (i = 0; i < nr; i++) {
- const struct pipe_vertex_element *input = &brw->curr.vertex_element[i];
- uint32_t format = brw_translate_surface_format( input->src_format );
- uint32_t comp0 = BRW_VE1_COMPONENT_STORE_SRC;
- uint32_t comp1 = BRW_VE1_COMPONENT_STORE_SRC;
- uint32_t comp2 = BRW_VE1_COMPONENT_STORE_SRC;
- uint32_t comp3 = BRW_VE1_COMPONENT_STORE_SRC;
-
- switch (input->nr_components) {
- case 0: comp0 = BRW_VE1_COMPONENT_STORE_0; /* fallthrough */
- case 1: comp1 = BRW_VE1_COMPONENT_STORE_0; /* fallthrough */
- case 2: comp2 = BRW_VE1_COMPONENT_STORE_0; /* fallthrough */
- case 3: comp3 = BRW_VE1_COMPONENT_STORE_1_FLT;
- break;
- }
-
- OUT_BATCH((input->vertex_buffer_index << BRW_VE0_INDEX_SHIFT) |
- BRW_VE0_VALID |
- (format << BRW_VE0_FORMAT_SHIFT) |
- (input->src_offset << BRW_VE0_SRC_OFFSET_SHIFT));
+ brw_batchbuffer_data(brw->batch, brw_velems, size * 4, IGNORE_CLIPRECTS);
- if (BRW_IS_IGDNG(brw))
- OUT_BATCH((comp0 << BRW_VE1_COMPONENT_0_SHIFT) |
- (comp1 << BRW_VE1_COMPONENT_1_SHIFT) |
- (comp2 << BRW_VE1_COMPONENT_2_SHIFT) |
- (comp3 << BRW_VE1_COMPONENT_3_SHIFT));
- else
- OUT_BATCH((comp0 << BRW_VE1_COMPONENT_0_SHIFT) |
- (comp1 << BRW_VE1_COMPONENT_1_SHIFT) |
- (comp2 << BRW_VE1_COMPONENT_2_SHIFT) |
- (comp3 << BRW_VE1_COMPONENT_3_SHIFT) |
- ((i * 4) << BRW_VE1_DST_OFFSET_SHIFT));
- }
- ADVANCE_BATCH();
return 0;
}
@@ -396,10 +202,11 @@ static int brw_emit_vertices( struct brw_context *brw )
if (ret)
return ret;
+ /* XXX should separate this? */
ret = brw_emit_vertex_elements( brw );
if (ret)
return ret;
-
+
return 0;
}
@@ -407,7 +214,8 @@ static int brw_emit_vertices( struct brw_context *brw )
const struct brw_tracked_state brw_vertices = {
.dirty = {
.mesa = (PIPE_NEW_INDEX_RANGE |
- PIPE_NEW_VERTEX_BUFFER),
+ PIPE_NEW_VERTEX_BUFFER |
+ PIPE_NEW_VERTEX_ELEMENT),
.brw = BRW_NEW_BATCH,
.cache = 0,
},
diff --git a/src/gallium/drivers/i965/brw_misc_state.c b/src/gallium/drivers/i965/brw_misc_state.c
index e3f25bdf62..b5029ceb69 100644
--- a/src/gallium/drivers/i965/brw_misc_state.c
+++ b/src/gallium/drivers/i965/brw_misc_state.c
@@ -266,7 +266,7 @@ static int emit_depthbuffer(struct brw_context *brw)
cpp = 2;
break;
case PIPE_FORMAT_Z24X8_UNORM:
- case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
format = BRW_DEPTHFORMAT_D24_UNORM_S8_UINT;
cpp = 4;
break;
diff --git a/src/gallium/drivers/i965/brw_pipe_clear.c b/src/gallium/drivers/i965/brw_pipe_clear.c
index d7048f769b..abf507991e 100644
--- a/src/gallium/drivers/i965/brw_pipe_clear.c
+++ b/src/gallium/drivers/i965/brw_pipe_clear.c
@@ -140,7 +140,7 @@ static void zstencil_clear(struct brw_context *brw,
switch (bsurface->base.format) {
case PIPE_FORMAT_Z24X8_UNORM:
- case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
value = ((unsigned)(depth * MASK24) & MASK24);
break;
case PIPE_FORMAT_Z16_UNORM:
@@ -153,7 +153,7 @@ static void zstencil_clear(struct brw_context *brw,
switch (bsurface->base.format) {
case PIPE_FORMAT_Z24X8_UNORM:
- case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
value = value | (stencil << 24);
break;
diff --git a/src/gallium/drivers/i965/brw_pipe_sampler.c b/src/gallium/drivers/i965/brw_pipe_sampler.c
index c7c0e2ae95..d2aa2bc9f3 100644
--- a/src/gallium/drivers/i965/brw_pipe_sampler.c
+++ b/src/gallium/drivers/i965/brw_pipe_sampler.c
@@ -183,26 +183,26 @@ static void brw_delete_sampler_state(struct pipe_context *pipe,
FREE(cso);
}
-static void brw_set_sampler_textures(struct pipe_context *pipe,
- unsigned num,
- struct pipe_texture **texture)
+static void brw_set_fragment_sampler_views(struct pipe_context *pipe,
+ unsigned num,
+ struct pipe_sampler_view **views)
{
struct brw_context *brw = brw_context(pipe);
int i;
for (i = 0; i < num; i++)
- pipe_texture_reference(&brw->curr.texture[i], texture[i]);
+ pipe_sampler_view_reference(&brw->curr.fragment_sampler_views[i], views[i]);
- for (i = num; i < brw->curr.num_textures; i++)
- pipe_texture_reference(&brw->curr.texture[i], NULL);
+ for (i = num; i < brw->curr.num_fragment_sampler_views; i++)
+ pipe_sampler_view_reference(&brw->curr.fragment_sampler_views[i], NULL);
- brw->curr.num_textures = num;
+ brw->curr.num_fragment_sampler_views = num;
brw->state.dirty.mesa |= PIPE_NEW_BOUND_TEXTURES;
}
-static void brw_set_vertex_sampler_textures(struct pipe_context *pipe,
- unsigned num,
- struct pipe_texture **texture)
+static void brw_set_vertex_sampler_views(struct pipe_context *pipe,
+ unsigned num,
+ struct pipe_sampler_view **views)
{
}
@@ -212,17 +212,47 @@ static void brw_bind_vertex_sampler_state(struct pipe_context *pipe,
}
+static struct pipe_sampler_view *
+brw_create_sampler_view(struct pipe_context *pipe,
+ struct pipe_texture *texture,
+ const struct pipe_sampler_view *templ)
+{
+ struct pipe_sampler_view *view = CALLOC_STRUCT(pipe_sampler_view);
+
+ if (view) {
+ *view = *templ;
+ view->reference.count = 1;
+ view->texture = NULL;
+ pipe_texture_reference(&view->texture, texture);
+ view->context = pipe;
+ }
+
+ return view;
+}
+
+
+static void
+brw_sampler_view_destroy(struct pipe_context *pipe,
+ struct pipe_sampler_view *view)
+{
+ pipe_texture_reference(&view->texture, NULL);
+ FREE(view);
+}
+
+
void brw_pipe_sampler_init( struct brw_context *brw )
{
brw->base.create_sampler_state = brw_create_sampler_state;
brw->base.delete_sampler_state = brw_delete_sampler_state;
- brw->base.set_fragment_sampler_textures = brw_set_sampler_textures;
+ brw->base.set_fragment_sampler_views = brw_set_fragment_sampler_views;
brw->base.bind_fragment_sampler_states = brw_bind_sampler_state;
- brw->base.set_vertex_sampler_textures = brw_set_vertex_sampler_textures;
+ brw->base.set_vertex_sampler_views = brw_set_vertex_sampler_views;
brw->base.bind_vertex_sampler_states = brw_bind_vertex_sampler_state;
+ brw->base.create_sampler_view = brw_create_sampler_view;
+ brw->base.sampler_view_destroy = brw_sampler_view_destroy;
}
void brw_pipe_sampler_cleanup( struct brw_context *brw )
{
diff --git a/src/gallium/drivers/i965/brw_pipe_vertex.c b/src/gallium/drivers/i965/brw_pipe_vertex.c
index e3c48e3149..d6a840857e 100644
--- a/src/gallium/drivers/i965/brw_pipe_vertex.c
+++ b/src/gallium/drivers/i965/brw_pipe_vertex.c
@@ -1,22 +1,251 @@
#include "brw_context.h"
+#include "brw_defines.h"
+#include "brw_structs.h"
+#include "util/u_memory.h"
+#include "util/u_format.h"
-static void brw_set_vertex_elements( struct pipe_context *pipe,
- unsigned count,
- const struct pipe_vertex_element *elements )
+
+static unsigned brw_translate_surface_format( unsigned id )
+{
+ switch (id) {
+ case PIPE_FORMAT_R64_FLOAT:
+ return BRW_SURFACEFORMAT_R64_FLOAT;
+ case PIPE_FORMAT_R64G64_FLOAT:
+ return BRW_SURFACEFORMAT_R64G64_FLOAT;
+ case PIPE_FORMAT_R64G64B64_FLOAT:
+ return BRW_SURFACEFORMAT_R64G64B64_FLOAT;
+ case PIPE_FORMAT_R64G64B64A64_FLOAT:
+ return BRW_SURFACEFORMAT_R64G64B64A64_FLOAT;
+
+ case PIPE_FORMAT_R32_FLOAT:
+ return BRW_SURFACEFORMAT_R32_FLOAT;
+ case PIPE_FORMAT_R32G32_FLOAT:
+ return BRW_SURFACEFORMAT_R32G32_FLOAT;
+ case PIPE_FORMAT_R32G32B32_FLOAT:
+ return BRW_SURFACEFORMAT_R32G32B32_FLOAT;
+ case PIPE_FORMAT_R32G32B32A32_FLOAT:
+ return BRW_SURFACEFORMAT_R32G32B32A32_FLOAT;
+
+ case PIPE_FORMAT_R32_UNORM:
+ return BRW_SURFACEFORMAT_R32_UNORM;
+ case PIPE_FORMAT_R32G32_UNORM:
+ return BRW_SURFACEFORMAT_R32G32_UNORM;
+ case PIPE_FORMAT_R32G32B32_UNORM:
+ return BRW_SURFACEFORMAT_R32G32B32_UNORM;
+ case PIPE_FORMAT_R32G32B32A32_UNORM:
+ return BRW_SURFACEFORMAT_R32G32B32A32_UNORM;
+
+ case PIPE_FORMAT_R32_USCALED:
+ return BRW_SURFACEFORMAT_R32_USCALED;
+ case PIPE_FORMAT_R32G32_USCALED:
+ return BRW_SURFACEFORMAT_R32G32_USCALED;
+ case PIPE_FORMAT_R32G32B32_USCALED:
+ return BRW_SURFACEFORMAT_R32G32B32_USCALED;
+ case PIPE_FORMAT_R32G32B32A32_USCALED:
+ return BRW_SURFACEFORMAT_R32G32B32A32_USCALED;
+
+ case PIPE_FORMAT_R32_SNORM:
+ return BRW_SURFACEFORMAT_R32_SNORM;
+ case PIPE_FORMAT_R32G32_SNORM:
+ return BRW_SURFACEFORMAT_R32G32_SNORM;
+ case PIPE_FORMAT_R32G32B32_SNORM:
+ return BRW_SURFACEFORMAT_R32G32B32_SNORM;
+ case PIPE_FORMAT_R32G32B32A32_SNORM:
+ return BRW_SURFACEFORMAT_R32G32B32A32_SNORM;
+
+ case PIPE_FORMAT_R32_SSCALED:
+ return BRW_SURFACEFORMAT_R32_SSCALED;
+ case PIPE_FORMAT_R32G32_SSCALED:
+ return BRW_SURFACEFORMAT_R32G32_SSCALED;
+ case PIPE_FORMAT_R32G32B32_SSCALED:
+ return BRW_SURFACEFORMAT_R32G32B32_SSCALED;
+ case PIPE_FORMAT_R32G32B32A32_SSCALED:
+ return BRW_SURFACEFORMAT_R32G32B32A32_SSCALED;
+
+ case PIPE_FORMAT_R16_UNORM:
+ return BRW_SURFACEFORMAT_R16_UNORM;
+ case PIPE_FORMAT_R16G16_UNORM:
+ return BRW_SURFACEFORMAT_R16G16_UNORM;
+ case PIPE_FORMAT_R16G16B16_UNORM:
+ return BRW_SURFACEFORMAT_R16G16B16_UNORM;
+ case PIPE_FORMAT_R16G16B16A16_UNORM:
+ return BRW_SURFACEFORMAT_R16G16B16A16_UNORM;
+
+ case PIPE_FORMAT_R16_USCALED:
+ return BRW_SURFACEFORMAT_R16_USCALED;
+ case PIPE_FORMAT_R16G16_USCALED:
+ return BRW_SURFACEFORMAT_R16G16_USCALED;
+ case PIPE_FORMAT_R16G16B16_USCALED:
+ return BRW_SURFACEFORMAT_R16G16B16_USCALED;
+ case PIPE_FORMAT_R16G16B16A16_USCALED:
+ return BRW_SURFACEFORMAT_R16G16B16A16_USCALED;
+
+ case PIPE_FORMAT_R16_SNORM:
+ return BRW_SURFACEFORMAT_R16_SNORM;
+ case PIPE_FORMAT_R16G16_SNORM:
+ return BRW_SURFACEFORMAT_R16G16_SNORM;
+ case PIPE_FORMAT_R16G16B16_SNORM:
+ return BRW_SURFACEFORMAT_R16G16B16_SNORM;
+ case PIPE_FORMAT_R16G16B16A16_SNORM:
+ return BRW_SURFACEFORMAT_R16G16B16A16_SNORM;
+
+ case PIPE_FORMAT_R16_SSCALED:
+ return BRW_SURFACEFORMAT_R16_SSCALED;
+ case PIPE_FORMAT_R16G16_SSCALED:
+ return BRW_SURFACEFORMAT_R16G16_SSCALED;
+ case PIPE_FORMAT_R16G16B16_SSCALED:
+ return BRW_SURFACEFORMAT_R16G16B16_SSCALED;
+ case PIPE_FORMAT_R16G16B16A16_SSCALED:
+ return BRW_SURFACEFORMAT_R16G16B16A16_SSCALED;
+
+ case PIPE_FORMAT_R8_UNORM:
+ return BRW_SURFACEFORMAT_R8_UNORM;
+ case PIPE_FORMAT_R8G8_UNORM:
+ return BRW_SURFACEFORMAT_R8G8_UNORM;
+ case PIPE_FORMAT_R8G8B8_UNORM:
+ return BRW_SURFACEFORMAT_R8G8B8_UNORM;
+ case PIPE_FORMAT_R8G8B8A8_UNORM:
+ return BRW_SURFACEFORMAT_R8G8B8A8_UNORM;
+
+ case PIPE_FORMAT_R8_USCALED:
+ return BRW_SURFACEFORMAT_R8_USCALED;
+ case PIPE_FORMAT_R8G8_USCALED:
+ return BRW_SURFACEFORMAT_R8G8_USCALED;
+ case PIPE_FORMAT_R8G8B8_USCALED:
+ return BRW_SURFACEFORMAT_R8G8B8_USCALED;
+ case PIPE_FORMAT_R8G8B8A8_USCALED:
+ return BRW_SURFACEFORMAT_R8G8B8A8_USCALED;
+
+ case PIPE_FORMAT_R8_SNORM:
+ return BRW_SURFACEFORMAT_R8_SNORM;
+ case PIPE_FORMAT_R8G8_SNORM:
+ return BRW_SURFACEFORMAT_R8G8_SNORM;
+ case PIPE_FORMAT_R8G8B8_SNORM:
+ return BRW_SURFACEFORMAT_R8G8B8_SNORM;
+ case PIPE_FORMAT_R8G8B8A8_SNORM:
+ return BRW_SURFACEFORMAT_R8G8B8A8_SNORM;
+
+ case PIPE_FORMAT_R8_SSCALED:
+ return BRW_SURFACEFORMAT_R8_SSCALED;
+ case PIPE_FORMAT_R8G8_SSCALED:
+ return BRW_SURFACEFORMAT_R8G8_SSCALED;
+ case PIPE_FORMAT_R8G8B8_SSCALED:
+ return BRW_SURFACEFORMAT_R8G8B8_SSCALED;
+ case PIPE_FORMAT_R8G8B8A8_SSCALED:
+ return BRW_SURFACEFORMAT_R8G8B8A8_SSCALED;
+
+ default:
+ assert(0);
+ return 0;
+ }
+}
+
+static void brw_translate_vertex_elements(struct brw_context *brw,
+ struct brw_vertex_element_packet *brw_velems,
+ const struct pipe_vertex_element *attribs,
+ unsigned count)
+{
+ unsigned i;
+
+ /* If the VS doesn't read any inputs (calculating vertex position from
+ * a state variable for some reason, for example), emit a single pad
+ * VERTEX_ELEMENT struct and bail.
+ *
+ * The stale VB state stays in place, but they don't do anything unless
+ * a VE loads from them.
+ */
+ brw_velems->header.opcode = CMD_VERTEX_ELEMENT;
+
+ if (count == 0) {
+ brw_velems->header.length = 1;
+ brw_velems->ve[0].ve0.src_offset = 0;
+ brw_velems->ve[0].ve0.src_format = BRW_SURFACEFORMAT_R32G32B32A32_FLOAT;
+ brw_velems->ve[0].ve0.valid = 1;
+ brw_velems->ve[0].ve0.vertex_buffer_index = 0;
+ brw_velems->ve[0].ve1.dst_offset = 0;
+ brw_velems->ve[0].ve1.vfcomponent0 = BRW_VE1_COMPONENT_STORE_0;
+ brw_velems->ve[0].ve1.vfcomponent1 = BRW_VE1_COMPONENT_STORE_0;
+ brw_velems->ve[0].ve1.vfcomponent2 = BRW_VE1_COMPONENT_STORE_0;
+ brw_velems->ve[0].ve1.vfcomponent3 = BRW_VE1_COMPONENT_STORE_1_FLT;
+ return;
+ }
+
+
+ /* Now emit vertex element (VEP) state packets.
+ *
+ */
+ brw_velems->header.length = (1 + count * 2) - 2;
+ for (i = 0; i < count; i++) {
+ const struct pipe_vertex_element *input = &attribs[i];
+ unsigned nr_components = util_format_get_nr_components(input->src_format);
+
+ uint32_t format = brw_translate_surface_format( input->src_format );
+ uint32_t comp0 = BRW_VE1_COMPONENT_STORE_SRC;
+ uint32_t comp1 = BRW_VE1_COMPONENT_STORE_SRC;
+ uint32_t comp2 = BRW_VE1_COMPONENT_STORE_SRC;
+ uint32_t comp3 = BRW_VE1_COMPONENT_STORE_SRC;
+
+ switch (nr_components) {
+ case 0: comp0 = BRW_VE1_COMPONENT_STORE_0; /* fallthrough */
+ case 1: comp1 = BRW_VE1_COMPONENT_STORE_0; /* fallthrough */
+ case 2: comp2 = BRW_VE1_COMPONENT_STORE_0; /* fallthrough */
+ case 3: comp3 = BRW_VE1_COMPONENT_STORE_1_FLT;
+ break;
+ }
+
+ brw_velems->ve[i].ve0.src_offset = input->src_offset;
+ brw_velems->ve[i].ve0.src_format = format;
+ brw_velems->ve[i].ve0.valid = 1;
+ brw_velems->ve[i].ve0.vertex_buffer_index = input->vertex_buffer_index;
+ brw_velems->ve[i].ve1.vfcomponent0 = comp0;
+ brw_velems->ve[i].ve1.vfcomponent1 = comp1;
+ brw_velems->ve[i].ve1.vfcomponent2 = comp2;
+ brw_velems->ve[i].ve1.vfcomponent3 = comp3;
+
+ if (BRW_IS_IGDNG(brw))
+ brw_velems->ve[i].ve1.dst_offset = 0;
+ else
+ brw_velems->ve[i].ve1.dst_offset = i * 4;
+ }
+}
+
+static void* brw_create_vertex_elements_state( struct pipe_context *pipe,
+ unsigned count,
+ const struct pipe_vertex_element *attribs )
{
+ /* note: for the brw_swtnl.c code (if ever we need draw fallback) we'd also need
+ to store the original data */
struct brw_context *brw = brw_context(pipe);
+ struct brw_vertex_element_packet *velems;
+ assert(count <= BRW_VEP_MAX);
+ velems = (struct brw_vertex_element_packet *) MALLOC(sizeof(struct brw_vertex_element_packet));
+ if (velems) {
+ brw_translate_vertex_elements(brw, velems, attribs, count);
+ }
+ return velems;
+}
- memcpy(brw->curr.vertex_element, elements, count * sizeof(elements[0]));
- brw->curr.num_vertex_elements = count;
+static void brw_bind_vertex_elements_state(struct pipe_context *pipe,
+ void *velems)
+{
+ struct brw_context *brw = brw_context(pipe);
+ struct brw_vertex_element_packet *brw_velems = (struct brw_vertex_element_packet *) velems;
+
+ brw->curr.velems = brw_velems;
brw->state.dirty.mesa |= PIPE_NEW_VERTEX_ELEMENT;
}
+static void brw_delete_vertex_elements_state(struct pipe_context *pipe, void *velems)
+{
+ FREE( velems );
+}
+
static void brw_set_vertex_buffers(struct pipe_context *pipe,
- unsigned count,
- const struct pipe_vertex_buffer *buffers)
+ unsigned count,
+ const struct pipe_vertex_buffer *buffers)
{
struct brw_context *brw = brw_context(pipe);
unsigned i;
@@ -49,7 +278,9 @@ void
brw_pipe_vertex_init( struct brw_context *brw )
{
brw->base.set_vertex_buffers = brw_set_vertex_buffers;
- brw->base.set_vertex_elements = brw_set_vertex_elements;
+ brw->base.create_vertex_elements_state = brw_create_vertex_elements_state;
+ brw->base.bind_vertex_elements_state = brw_bind_vertex_elements_state;
+ brw->base.delete_vertex_elements_state = brw_delete_vertex_elements_state;
}
diff --git a/src/gallium/drivers/i965/brw_screen.c b/src/gallium/drivers/i965/brw_screen.c
index 66f3aad8b2..ba30e63f20 100644
--- a/src/gallium/drivers/i965/brw_screen.c
+++ b/src/gallium/drivers/i965/brw_screen.c
@@ -174,11 +174,11 @@ brw_get_param(struct pipe_screen *screen, int param)
case PIPE_CAP_TEXTURE_SHADOW_MAP:
return 1;
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
- return 11; /* max 1024x1024 */
+ return BRW_MAX_TEXTURE_2D_LEVELS;
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
- return 8; /* max 128x128x128 */
+ return BRW_MAX_TEXTURE_3D_LEVELS;
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
- return 11; /* max 1024x1024 */
+ return BRW_MAX_TEXTURE_2D_LEVELS;
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
return 1;
@@ -252,7 +252,7 @@ brw_is_format_supported(struct pipe_screen *screen,
/* depth */
PIPE_FORMAT_Z32_FLOAT,
PIPE_FORMAT_Z24X8_UNORM,
- PIPE_FORMAT_Z24S8_UNORM,
+ PIPE_FORMAT_Z24_UNORM_S8_USCALED,
PIPE_FORMAT_Z16_UNORM,
/* signed */
PIPE_FORMAT_R8G8_SNORM,
@@ -268,7 +268,7 @@ brw_is_format_supported(struct pipe_screen *screen,
static const enum pipe_format depth_supported[] = {
PIPE_FORMAT_Z32_FLOAT,
PIPE_FORMAT_Z24X8_UNORM,
- PIPE_FORMAT_Z24S8_UNORM,
+ PIPE_FORMAT_Z24_UNORM_S8_USCALED,
PIPE_FORMAT_Z16_UNORM,
PIPE_FORMAT_NONE /* list terminator */
};
diff --git a/src/gallium/drivers/i965/brw_screen.h b/src/gallium/drivers/i965/brw_screen.h
index 7226d9228b..e3a7c64d48 100644
--- a/src/gallium/drivers/i965/brw_screen.h
+++ b/src/gallium/drivers/i965/brw_screen.h
@@ -100,6 +100,9 @@ struct brw_surface
};
+#define BRW_MAX_TEXTURE_2D_LEVELS 11 /* max 1024x1024 */
+#define BRW_MAX_TEXTURE_3D_LEVELS 8 /* max 128x128x128 */
+
struct brw_texture
{
@@ -107,9 +110,9 @@ struct brw_texture
struct brw_winsys_buffer *bo;
struct brw_surface_state ss;
- unsigned *image_offset[PIPE_MAX_TEXTURE_LEVELS];
- unsigned nr_images[PIPE_MAX_TEXTURE_LEVELS];
- unsigned level_offset[PIPE_MAX_TEXTURE_LEVELS];
+ unsigned *image_offset[BRW_MAX_TEXTURE_2D_LEVELS];
+ unsigned nr_images[BRW_MAX_TEXTURE_2D_LEVELS];
+ unsigned level_offset[BRW_MAX_TEXTURE_2D_LEVELS];
boolean compressed;
unsigned brw_target;
@@ -178,6 +181,10 @@ void brw_update_texture( struct brw_screen *brw_screen,
struct brw_texture *tex );
+/* brw_screen_texture.h
+ */
+struct brw_context;
+void brw_tex_init( struct brw_context *brw );
void brw_screen_tex_init( struct brw_screen *brw_screen );
void brw_screen_tex_surface_init( struct brw_screen *brw_screen );
diff --git a/src/gallium/drivers/i965/brw_screen_texture.c b/src/gallium/drivers/i965/brw_screen_texture.c
index e38fdf1869..17bf3152dc 100644
--- a/src/gallium/drivers/i965/brw_screen_texture.c
+++ b/src/gallium/drivers/i965/brw_screen_texture.c
@@ -37,6 +37,8 @@
#include "brw_defines.h"
#include "brw_structs.h"
#include "brw_winsys.h"
+#include "brw_context.h"
+
@@ -156,7 +158,7 @@ static GLuint translate_tex_format( enum pipe_format pf )
case PIPE_FORMAT_Z16_UNORM:
return BRW_SURFACEFORMAT_I16_UNORM;
- case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
case PIPE_FORMAT_Z24X8_UNORM:
return BRW_SURFACEFORMAT_I24X8_UNORM;
@@ -204,7 +206,7 @@ static struct pipe_texture *brw_texture_create( struct pipe_screen *screen,
/* XXX: compressed textures need special treatment here
*/
tex->cpp = util_format_get_blocksize(tex->base.format);
- tex->compressed = util_format_is_compressed(tex->base.format);
+ tex->compressed = util_format_is_s3tc(tex->base.format);
make_empty_list(&tex->views[0]);
make_empty_list(&tex->views[1]);
@@ -231,8 +233,8 @@ static struct pipe_texture *brw_texture_create( struct pipe_screen *screen,
goto fail;
- if (templ->tex_usage & (PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
- PIPE_TEXTURE_USAGE_PRIMARY)) {
+ if (templ->tex_usage & (PIPE_TEXTURE_USAGE_SCANOUT |
+ PIPE_TEXTURE_USAGE_SHARED)) {
buffer_type = BRW_BUFFER_TYPE_SCANOUT;
}
else {
@@ -303,14 +305,124 @@ fail:
return NULL;
}
-static struct pipe_texture *brw_texture_blanket(struct pipe_screen *screen,
- const struct pipe_texture *templ,
- const unsigned *stride,
- struct pipe_buffer *buffer)
+static struct pipe_texture *
+brw_texture_from_handle(struct pipe_screen *screen,
+ const struct pipe_texture *templ,
+ struct winsys_handle *whandle)
{
+ struct brw_screen *bscreen = brw_screen(screen);
+ struct brw_texture *tex;
+ struct brw_winsys_buffer *buffer;
+ unsigned tiling;
+ unsigned pitch;
+ GLuint format;
+
+ if (templ->target != PIPE_TEXTURE_2D ||
+ templ->last_level != 0 ||
+ templ->depth0 != 1)
+ return NULL;
+
+ if (util_format_is_s3tc(templ->format))
+ return NULL;
+
+ tex = CALLOC_STRUCT(brw_texture);
+ if (!tex)
+ return NULL;
+
+ if (bscreen->sws->bo_from_handle(bscreen->sws, whandle, &pitch, &tiling, &buffer) != PIPE_OK)
+ goto fail;
+
+ memcpy(&tex->base, templ, sizeof *templ);
+ pipe_reference_init(&tex->base.reference, 1);
+ tex->base.screen = screen;
+
+ /* XXX: cpp vs. blocksize
+ */
+ tex->cpp = util_format_get_blocksize(tex->base.format);
+ tex->tiling = tiling;
+
+ make_empty_list(&tex->views[0]);
+ make_empty_list(&tex->views[1]);
+
+ if (!brw_texture_layout(bscreen, tex))
+ goto fail;
+
+ /* XXX Maybe some more checks? */
+ if ((pitch / tex->cpp) < tex->pitch)
+ goto fail;
+
+ tex->pitch = pitch / tex->cpp;
+
+ tex->bo = buffer;
+
+ /* fix this warning */
+#if 0
+ if (tex->size > buffer->size)
+ goto fail;
+#endif
+
+ tex->ss.ss0.mipmap_layout_mode = BRW_SURFACE_MIPMAPLAYOUT_BELOW;
+ tex->ss.ss0.surface_type = translate_tex_target(tex->base.target);
+
+ format = translate_tex_format(tex->base.format);
+ assert(format != BRW_SURFACEFORMAT_INVALID);
+ tex->ss.ss0.surface_format = format;
+
+ /* This is ok for all textures with channel width 8bit or less:
+ */
+/* tex->ss.ss0.data_return_format = BRW_SURFACERETURNFORMAT_S1; */
+
+
+ /* XXX: what happens when tex->bo->offset changes???
+ */
+ tex->ss.ss1.base_addr = 0; /* reloc */
+ tex->ss.ss2.mip_count = tex->base.last_level;
+ tex->ss.ss2.width = tex->base.width0 - 1;
+ tex->ss.ss2.height = tex->base.height0 - 1;
+
+ switch (tex->tiling) {
+ case BRW_TILING_NONE:
+ tex->ss.ss3.tiled_surface = 0;
+ tex->ss.ss3.tile_walk = 0;
+ break;
+ case BRW_TILING_X:
+ tex->ss.ss3.tiled_surface = 1;
+ tex->ss.ss3.tile_walk = BRW_TILEWALK_XMAJOR;
+ break;
+ case BRW_TILING_Y:
+ tex->ss.ss3.tiled_surface = 1;
+ tex->ss.ss3.tile_walk = BRW_TILEWALK_YMAJOR;
+ break;
+ }
+
+ tex->ss.ss3.pitch = (tex->pitch * tex->cpp) - 1;
+ tex->ss.ss3.depth = tex->base.depth0 - 1;
+
+ tex->ss.ss4.min_lod = 0;
+
+ return &tex->base;
+
+fail:
+ FREE(tex);
return NULL;
}
+static boolean
+brw_texture_get_handle(struct pipe_screen *screen,
+ struct pipe_texture *texture,
+ struct winsys_handle *whandle)
+{
+ struct brw_screen *bscreen = brw_screen(screen);
+ struct brw_texture *tex = brw_texture(texture);
+ unsigned stride;
+
+ stride = tex->pitch * tex->cpp;
+
+ return bscreen->sws->bo_get_handle(tex->bo, whandle, stride);
+}
+
+
+
static void brw_texture_destroy(struct pipe_texture *pt)
{
struct brw_texture *tex = brw_texture(pt);
@@ -372,7 +484,7 @@ boolean brw_is_texture_referenced_by_bo( struct brw_screen *brw_screen,
*/
static struct pipe_transfer*
-brw_get_tex_transfer(struct pipe_screen *screen,
+brw_get_tex_transfer(struct pipe_context *pipe,
struct pipe_texture *texture,
unsigned face, unsigned level, unsigned zslice,
enum pipe_transfer_usage usage, unsigned x, unsigned y,
@@ -407,11 +519,11 @@ brw_get_tex_transfer(struct pipe_screen *screen,
}
static void *
-brw_transfer_map(struct pipe_screen *screen,
+brw_transfer_map(struct pipe_context *pipe,
struct pipe_transfer *transfer)
{
struct brw_texture *tex = brw_texture(transfer->texture);
- struct brw_winsys_screen *sws = brw_screen(screen)->sws;
+ struct brw_winsys_screen *sws = brw_screen(pipe->screen)->sws;
char *map;
unsigned usage = transfer->usage;
@@ -434,146 +546,37 @@ brw_transfer_map(struct pipe_screen *screen,
}
static void
-brw_transfer_unmap(struct pipe_screen *screen,
+brw_transfer_unmap(struct pipe_context *pipe,
struct pipe_transfer *transfer)
{
struct brw_texture *tex = brw_texture(transfer->texture);
- struct brw_winsys_screen *sws = brw_screen(screen)->sws;
+ struct brw_winsys_screen *sws = brw_screen(pipe->screen)->sws;
sws->bo_unmap(tex->bo);
}
static void
-brw_tex_transfer_destroy(struct pipe_transfer *trans)
+brw_tex_transfer_destroy(struct pipe_context *pipe,
+ struct pipe_transfer *trans)
{
pipe_texture_reference(&trans->texture, NULL);
FREE(trans);
}
-/*
- * Functions exported to the winsys
- */
-
-boolean brw_texture_get_winsys_buffer(struct pipe_texture *texture,
- struct brw_winsys_buffer **buffer,
- unsigned *stride)
+void brw_tex_init( struct brw_context *brw )
{
- struct brw_texture *tex = brw_texture(texture);
-
- *buffer = tex->bo;
- if (stride)
- *stride = tex->pitch * tex->cpp;
-
- return TRUE;
-}
-
-struct pipe_texture *
-brw_texture_blanket_winsys_buffer(struct pipe_screen *screen,
- const struct pipe_texture *templ,
- unsigned pitch,
- unsigned tiling,
- struct brw_winsys_buffer *buffer)
-{
- struct brw_screen *bscreen = brw_screen(screen);
- struct brw_texture *tex;
- GLuint format;
-
- if (templ->target != PIPE_TEXTURE_2D ||
- templ->last_level != 0 ||
- templ->depth0 != 1)
- return NULL;
-
- if (util_format_is_compressed(templ->format))
- return NULL;
-
- tex = CALLOC_STRUCT(brw_texture);
- if (!tex)
- return NULL;
-
- memcpy(&tex->base, templ, sizeof *templ);
- pipe_reference_init(&tex->base.reference, 1);
- tex->base.screen = screen;
-
- /* XXX: cpp vs. blocksize
- */
- tex->cpp = util_format_get_blocksize(tex->base.format);
- tex->tiling = tiling;
-
- make_empty_list(&tex->views[0]);
- make_empty_list(&tex->views[1]);
-
- if (!brw_texture_layout(bscreen, tex))
- goto fail;
-
- /* XXX Maybe some more checks? */
- if ((pitch / tex->cpp) < tex->pitch)
- goto fail;
-
- tex->pitch = pitch / tex->cpp;
-
- tex->bo = buffer;
-
- /* fix this warning */
-#if 0
- if (tex->size > buffer->size)
- goto fail;
-#endif
-
- tex->ss.ss0.mipmap_layout_mode = BRW_SURFACE_MIPMAPLAYOUT_BELOW;
- tex->ss.ss0.surface_type = translate_tex_target(tex->base.target);
-
- format = translate_tex_format(tex->base.format);
- assert(format != BRW_SURFACEFORMAT_INVALID);
- tex->ss.ss0.surface_format = format;
-
- /* This is ok for all textures with channel width 8bit or less:
- */
-/* tex->ss.ss0.data_return_format = BRW_SURFACERETURNFORMAT_S1; */
-
-
- /* XXX: what happens when tex->bo->offset changes???
- */
- tex->ss.ss1.base_addr = 0; /* reloc */
- tex->ss.ss2.mip_count = tex->base.last_level;
- tex->ss.ss2.width = tex->base.width0 - 1;
- tex->ss.ss2.height = tex->base.height0 - 1;
-
- switch (tex->tiling) {
- case BRW_TILING_NONE:
- tex->ss.ss3.tiled_surface = 0;
- tex->ss.ss3.tile_walk = 0;
- break;
- case BRW_TILING_X:
- tex->ss.ss3.tiled_surface = 1;
- tex->ss.ss3.tile_walk = BRW_TILEWALK_XMAJOR;
- break;
- case BRW_TILING_Y:
- tex->ss.ss3.tiled_surface = 1;
- tex->ss.ss3.tile_walk = BRW_TILEWALK_YMAJOR;
- break;
- }
-
- tex->ss.ss3.pitch = (tex->pitch * tex->cpp) - 1;
- tex->ss.ss3.depth = tex->base.depth0 - 1;
-
- tex->ss.ss4.min_lod = 0;
-
- return &tex->base;
-
-fail:
- FREE(tex);
- return NULL;
+ brw->base.get_tex_transfer = brw_get_tex_transfer;
+ brw->base.transfer_map = brw_transfer_map;
+ brw->base.transfer_unmap = brw_transfer_unmap;
+ brw->base.tex_transfer_destroy = brw_tex_transfer_destroy;
}
void brw_screen_tex_init( struct brw_screen *brw_screen )
{
brw_screen->base.is_format_supported = brw_is_format_supported;
brw_screen->base.texture_create = brw_texture_create;
+ brw_screen->base.texture_from_handle = brw_texture_from_handle;
+ brw_screen->base.texture_get_handle = brw_texture_get_handle;
brw_screen->base.texture_destroy = brw_texture_destroy;
- brw_screen->base.texture_blanket = brw_texture_blanket;
- brw_screen->base.get_tex_transfer = brw_get_tex_transfer;
- brw_screen->base.transfer_map = brw_transfer_map;
- brw_screen->base.transfer_unmap = brw_transfer_unmap;
- brw_screen->base.tex_transfer_destroy = brw_tex_transfer_destroy;
}
diff --git a/src/gallium/drivers/i965/brw_structs.h b/src/gallium/drivers/i965/brw_structs.h
index bf10bc04de..e97ddeb5e1 100644
--- a/src/gallium/drivers/i965/brw_structs.h
+++ b/src/gallium/drivers/i965/brw_structs.h
@@ -28,7 +28,7 @@
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
*/
-
+
#ifndef BRW_STRUCTS_H
#define BRW_STRUCTS_H
@@ -1149,7 +1149,7 @@ struct brw_vertex_element_state
GLuint valid:1;
GLuint vertex_buffer_index:5;
} ve0;
-
+
struct
{
GLuint dst_offset:8;
diff --git a/src/gallium/drivers/i965/brw_winsys.h b/src/gallium/drivers/i965/brw_winsys.h
index c82d00f4a4..f30c7f1813 100644
--- a/src/gallium/drivers/i965/brw_winsys.h
+++ b/src/gallium/drivers/i965/brw_winsys.h
@@ -162,6 +162,16 @@ struct brw_winsys_screen {
unsigned alignment,
struct brw_winsys_buffer **bo_out);
+ enum pipe_error (*bo_from_handle)(struct brw_winsys_screen *sws,
+ struct winsys_handle *whandle,
+ unsigned *stride,
+ unsigned *tiling,
+ struct brw_winsys_buffer **bo_out);
+
+ enum pipe_error (*bo_get_handle)(struct brw_winsys_buffer *buffer,
+ struct winsys_handle *whandle,
+ unsigned stride);
+
/* Destroy a buffer when our refcount goes to zero:
*/
void (*bo_destroy)(struct brw_winsys_buffer *buffer);
@@ -257,28 +267,6 @@ bo_reference(struct brw_winsys_buffer **ptr, struct brw_winsys_buffer *buf)
struct pipe_screen *brw_create_screen(struct brw_winsys_screen *iws, unsigned pci_id);
-/**
- * Get the brw_winsys buffer backing the texture.
- *
- * TODO UGLY
- */
-struct pipe_texture;
-boolean brw_texture_get_winsys_buffer(struct pipe_texture *texture,
- struct brw_winsys_buffer **buffer,
- unsigned *stride);
-
-/**
- * Wrap a brw_winsys buffer with a texture blanket.
- *
- * TODO UGLY
- */
-struct pipe_texture *
-brw_texture_blanket_winsys_buffer(struct pipe_screen *screen,
- const struct pipe_texture *template,
- unsigned pitch,
- unsigned tiling,
- struct brw_winsys_buffer *buffer);
-
/*************************************************************************
* Cooperative dumping between winsys and driver. TODO: make this
diff --git a/src/gallium/drivers/i965/brw_wm.c b/src/gallium/drivers/i965/brw_wm.c
index dfb718e64f..7ed2378ec0 100644
--- a/src/gallium/drivers/i965/brw_wm.c
+++ b/src/gallium/drivers/i965/brw_wm.c
@@ -251,8 +251,8 @@ static void brw_wm_populate_key( struct brw_context *brw,
/* PIPE_NEW_BOUND_TEXTURES */
- for (i = 0; i < brw->curr.num_textures; i++) {
- const struct brw_texture *tex = brw_texture(brw->curr.texture[i]);
+ for (i = 0; i < brw->curr.num_fragment_sampler_views; i++) {
+ const struct brw_texture *tex = brw_texture(brw->curr.fragment_sampler_views[i]->texture);
if (tex->base.format == PIPE_FORMAT_UYVY)
key->yuvtex_mask |= 1 << i;
diff --git a/src/gallium/drivers/i965/brw_wm_sampler_state.c b/src/gallium/drivers/i965/brw_wm_sampler_state.c
index 6a6086fc51..3f18062c58 100644
--- a/src/gallium/drivers/i965/brw_wm_sampler_state.c
+++ b/src/gallium/drivers/i965/brw_wm_sampler_state.c
@@ -78,11 +78,11 @@ brw_wm_sampler_populate_key(struct brw_context *brw,
memset(key, 0, sizeof(*key));
- key->sampler_count = MIN2(brw->curr.num_textures,
+ key->sampler_count = MIN2(brw->curr.num_fragment_sampler_views,
brw->curr.num_samplers);
for (i = 0; i < key->sampler_count; i++) {
- const struct brw_texture *tex = brw_texture(brw->curr.texture[i]);
+ const struct brw_texture *tex = brw_texture(brw->curr.fragment_sampler_views[i]->texture);
const struct brw_sampler *sampler = brw->curr.sampler[i];
struct brw_sampler_state *entry = &key->sampler[i];
@@ -122,12 +122,12 @@ static enum pipe_error
brw_wm_sampler_update_default_colors(struct brw_context *brw)
{
enum pipe_error ret;
- int nr = MIN2(brw->curr.num_textures,
+ int nr = MIN2(brw->curr.num_fragment_sampler_views,
brw->curr.num_samplers);
int i;
for (i = 0; i < nr; i++) {
- const struct brw_texture *tex = brw_texture(brw->curr.texture[i]);
+ const struct brw_texture *tex = brw_texture(brw->curr.fragment_sampler_views[i]->texture);
const struct brw_sampler *sampler = brw->curr.sampler[i];
const float *bc;
float bordercolor[4] = {
diff --git a/src/gallium/drivers/i965/brw_wm_surface_state.c b/src/gallium/drivers/i965/brw_wm_surface_state.c
index b01a7f194b..2368ae3f80 100644
--- a/src/gallium/drivers/i965/brw_wm_surface_state.c
+++ b/src/gallium/drivers/i965/brw_wm_surface_state.c
@@ -242,9 +242,9 @@ static enum pipe_error prepare_wm_surfaces(struct brw_context *brw )
/* PIPE_NEW_TEXTURE
*/
- for (i = 0; i < brw->curr.num_textures; i++) {
+ for (i = 0; i < brw->curr.num_fragment_sampler_views; i++) {
ret = brw_update_texture_surface(brw,
- brw_texture(brw->curr.texture[i]),
+ brw_texture(brw->curr.fragment_sampler_views[i]->texture),
&brw->wm.surf_bo[BTI_TEXTURE(i)]);
if (ret)
return ret;
@@ -261,7 +261,7 @@ static enum pipe_error prepare_wm_surfaces(struct brw_context *brw )
bo_reference(&brw->wm.surf_bo[BTI_FRAGMENT_CONSTANTS], NULL);
/* XXX: no pipe_max_textures define?? */
- for (i = brw->curr.num_textures; i < PIPE_MAX_SAMPLERS; i++)
+ for (i = brw->curr.num_fragment_sampler_views; i < PIPE_MAX_SAMPLERS; i++)
bo_reference(&brw->wm.surf_bo[BTI_TEXTURE(i)], NULL);
if (brw->wm.nr_surfaces != nr_surfaces) {
diff --git a/src/gallium/drivers/identity/id_context.c b/src/gallium/drivers/identity/id_context.c
index 8248b2a413..00a542215a 100644
--- a/src/gallium/drivers/identity/id_context.c
+++ b/src/gallium/drivers/identity/id_context.c
@@ -377,6 +377,42 @@ identity_delete_vs_state(struct pipe_context *_pipe,
vs);
}
+
+static void *
+identity_create_vertex_elements_state(struct pipe_context *_pipe,
+ unsigned num_elements,
+ const struct pipe_vertex_element *vertex_elements)
+{
+ struct identity_context *id_pipe = identity_context(_pipe);
+ struct pipe_context *pipe = id_pipe->pipe;
+
+ return pipe->create_vertex_elements_state(pipe,
+ num_elements,
+ vertex_elements);
+}
+
+static void
+identity_bind_vertex_elements_state(struct pipe_context *_pipe,
+ void *velems)
+{
+ struct identity_context *id_pipe = identity_context(_pipe);
+ struct pipe_context *pipe = id_pipe->pipe;
+
+ pipe->bind_vertex_elements_state(pipe,
+ velems);
+}
+
+static void
+identity_delete_vertex_elements_state(struct pipe_context *_pipe,
+ void *velems)
+{
+ struct identity_context *id_pipe = identity_context(_pipe);
+ struct pipe_context *pipe = id_pipe->pipe;
+
+ pipe->delete_vertex_elements_state(pipe,
+ velems);
+}
+
static void
identity_set_blend_color(struct pipe_context *_pipe,
const struct pipe_blend_color *blend_color)
@@ -492,53 +528,49 @@ identity_set_viewport_state(struct pipe_context *_pipe,
}
static void
-identity_set_fragment_sampler_textures(struct pipe_context *_pipe,
- unsigned num_textures,
- struct pipe_texture **_textures)
+identity_set_fragment_sampler_views(struct pipe_context *_pipe,
+ unsigned num,
+ struct pipe_sampler_view **_views)
{
struct identity_context *id_pipe = identity_context(_pipe);
struct pipe_context *pipe = id_pipe->pipe;
- struct pipe_texture *unwrapped_textures[PIPE_MAX_SAMPLERS];
- struct pipe_texture **textures = NULL;
+ struct pipe_sampler_view *unwrapped_views[PIPE_MAX_SAMPLERS];
+ struct pipe_sampler_view **views = NULL;
unsigned i;
- if (_textures) {
- for (i = 0; i < num_textures; i++)
- unwrapped_textures[i] = identity_texture_unwrap(_textures[i]);
+ if (_views) {
+ for (i = 0; i < num; i++)
+ unwrapped_views[i] = identity_sampler_view_unwrap(_views[i]);
for (; i < PIPE_MAX_SAMPLERS; i++)
- unwrapped_textures[i] = NULL;
+ unwrapped_views[i] = NULL;
- textures = unwrapped_textures;
+ views = unwrapped_views;
}
- pipe->set_fragment_sampler_textures(pipe,
- num_textures,
- textures);
+ pipe->set_fragment_sampler_views(pipe, num, views);
}
static void
-identity_set_vertex_sampler_textures(struct pipe_context *_pipe,
- unsigned num_textures,
- struct pipe_texture **_textures)
+identity_set_vertex_sampler_views(struct pipe_context *_pipe,
+ unsigned num,
+ struct pipe_sampler_view **_views)
{
struct identity_context *id_pipe = identity_context(_pipe);
struct pipe_context *pipe = id_pipe->pipe;
- struct pipe_texture *unwrapped_textures[PIPE_MAX_VERTEX_SAMPLERS];
- struct pipe_texture **textures = NULL;
+ struct pipe_sampler_view *unwrapped_views[PIPE_MAX_VERTEX_SAMPLERS];
+ struct pipe_sampler_view **views = NULL;
unsigned i;
- if (_textures) {
- for (i = 0; i < num_textures; i++)
- unwrapped_textures[i] = identity_texture_unwrap(_textures[i]);
+ if (_views) {
+ for (i = 0; i < num; i++)
+ unwrapped_views[i] = identity_sampler_view_unwrap(_views[i]);
for (; i < PIPE_MAX_VERTEX_SAMPLERS; i++)
- unwrapped_textures[i] = NULL;
+ unwrapped_views[i] = NULL;
- textures = unwrapped_textures;
+ views = unwrapped_views;
}
- pipe->set_vertex_sampler_textures(pipe,
- num_textures,
- textures);
+ pipe->set_vertex_sampler_views(pipe, num, views);
}
static void
@@ -563,20 +595,6 @@ identity_set_vertex_buffers(struct pipe_context *_pipe,
num_buffers,
buffers);
}
-
-static void
-identity_set_vertex_elements(struct pipe_context *_pipe,
- unsigned num_elements,
- const struct pipe_vertex_element *vertex_elements)
-{
- struct identity_context *id_pipe = identity_context(_pipe);
- struct pipe_context *pipe = id_pipe->pipe;
-
- pipe->set_vertex_elements(pipe,
- num_elements,
- vertex_elements);
-}
-
static void
identity_surface_copy(struct pipe_context *_pipe,
struct pipe_surface *_dst,
@@ -689,6 +707,115 @@ identity_is_buffer_referenced(struct pipe_context *_pipe,
buffer);
}
+static struct pipe_sampler_view *
+identity_create_sampler_view(struct pipe_context *pipe,
+ struct pipe_texture *texture,
+ const struct pipe_sampler_view *templ)
+{
+ struct identity_context *id_pipe = identity_context(pipe);
+ struct identity_texture *id_texture = identity_texture(texture);
+ struct pipe_context *pipe_unwrapped = id_pipe->pipe;
+ struct pipe_texture *texture_unwrapped = id_texture->texture;
+ struct identity_sampler_view *view = malloc(sizeof(struct identity_sampler_view));
+
+ view->sampler_view = pipe_unwrapped->create_sampler_view(pipe_unwrapped,
+ texture_unwrapped,
+ templ);
+
+ view->base = *templ;
+ view->base.reference.count = 1;
+ view->base.texture = NULL;
+ pipe_texture_reference(&view->base.texture, texture);
+ view->base.context = pipe;
+
+ return &view->base;
+}
+
+static void
+identity_sampler_view_destroy(struct pipe_context *pipe,
+ struct pipe_sampler_view *view)
+{
+ struct identity_context *id_pipe = identity_context(pipe);
+ struct identity_sampler_view *id_view = identity_sampler_view(view);
+ struct pipe_context *pipe_unwrapped = id_pipe->pipe;
+ struct pipe_sampler_view *view_unwrapped = id_view->sampler_view;
+
+ pipe_unwrapped->sampler_view_destroy(pipe_unwrapped,
+ view_unwrapped);
+
+ pipe_texture_reference(&view->texture, NULL);
+ free(view);
+}
+
+
+static struct pipe_transfer *
+identity_context_get_tex_transfer(struct pipe_context *_context,
+ struct pipe_texture *_texture,
+ unsigned face,
+ unsigned level,
+ unsigned zslice,
+ enum pipe_transfer_usage usage,
+ unsigned x,
+ unsigned y,
+ unsigned w,
+ unsigned h)
+{
+ struct identity_context *id_context = identity_context(_context);
+ struct identity_texture *id_texture = identity_texture(_texture);
+ struct pipe_context *context = id_context->pipe;
+ struct pipe_texture *texture = id_texture->texture;
+ struct pipe_transfer *result;
+
+ result = context->get_tex_transfer(context,
+ texture,
+ face,
+ level,
+ zslice,
+ usage,
+ x,
+ y,
+ w,
+ h);
+
+ if (result)
+ return identity_transfer_create(id_context, id_texture, result);
+ return NULL;
+}
+
+static void
+identity_context_tex_transfer_destroy(struct pipe_context *_pipe,
+ struct pipe_transfer *_transfer)
+{
+ identity_transfer_destroy(identity_context(_pipe),
+ identity_transfer(_transfer));
+}
+
+static void *
+identity_context_transfer_map(struct pipe_context *_context,
+ struct pipe_transfer *_transfer)
+{
+ struct identity_context *id_context = identity_context(_context);
+ struct identity_transfer *id_transfer = identity_transfer(_transfer);
+ struct pipe_context *context = id_context->pipe;
+ struct pipe_transfer *transfer = id_transfer->transfer;
+
+ return context->transfer_map(context,
+ transfer);
+}
+
+static void
+identity_context_transfer_unmap(struct pipe_context *_context,
+ struct pipe_transfer *_transfer)
+{
+ struct identity_context *id_context = identity_context(_context);
+ struct identity_transfer *id_transfer = identity_transfer(_transfer);
+ struct pipe_context *context = id_context->pipe;
+ struct pipe_transfer *transfer = id_transfer->transfer;
+
+ context->transfer_unmap(context,
+ transfer);
+}
+
struct pipe_context *
identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
{
@@ -733,6 +860,9 @@ identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
id_pipe->base.create_vs_state = identity_create_vs_state;
id_pipe->base.bind_vs_state = identity_bind_vs_state;
id_pipe->base.delete_vs_state = identity_delete_vs_state;
+ id_pipe->base.create_vertex_elements_state = identity_create_vertex_elements_state;
+ id_pipe->base.bind_vertex_elements_state = identity_bind_vertex_elements_state;
+ id_pipe->base.delete_vertex_elements_state = identity_delete_vertex_elements_state;
id_pipe->base.set_blend_color = identity_set_blend_color;
id_pipe->base.set_stencil_ref = identity_set_stencil_ref;
id_pipe->base.set_clip_state = identity_set_clip_state;
@@ -741,16 +871,21 @@ identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe)
id_pipe->base.set_polygon_stipple = identity_set_polygon_stipple;
id_pipe->base.set_scissor_state = identity_set_scissor_state;
id_pipe->base.set_viewport_state = identity_set_viewport_state;
- id_pipe->base.set_fragment_sampler_textures = identity_set_fragment_sampler_textures;
- id_pipe->base.set_vertex_sampler_textures = identity_set_vertex_sampler_textures;
+ id_pipe->base.set_fragment_sampler_views = identity_set_fragment_sampler_views;
+ id_pipe->base.set_vertex_sampler_views = identity_set_vertex_sampler_views;
id_pipe->base.set_vertex_buffers = identity_set_vertex_buffers;
- id_pipe->base.set_vertex_elements = identity_set_vertex_elements;
id_pipe->base.surface_copy = identity_surface_copy;
id_pipe->base.surface_fill = identity_surface_fill;
id_pipe->base.clear = identity_clear;
id_pipe->base.flush = identity_flush;
id_pipe->base.is_texture_referenced = identity_is_texture_referenced;
id_pipe->base.is_buffer_referenced = identity_is_buffer_referenced;
+ id_pipe->base.create_sampler_view = identity_create_sampler_view;
+ id_pipe->base.sampler_view_destroy = identity_sampler_view_destroy;
+ id_pipe->base.get_tex_transfer = identity_context_get_tex_transfer;
+ id_pipe->base.tex_transfer_destroy = identity_context_tex_transfer_destroy;
+ id_pipe->base.transfer_map = identity_context_transfer_map;
+ id_pipe->base.transfer_unmap = identity_context_transfer_unmap;
id_pipe->pipe = pipe;
diff --git a/src/gallium/drivers/identity/id_drm.c b/src/gallium/drivers/identity/id_drm.c
index f258c38cd7..d332c36af2 100644
--- a/src/gallium/drivers/identity/id_drm.c
+++ b/src/gallium/drivers/identity/id_drm.c
@@ -31,8 +31,6 @@
#include "id_drm.h"
#include "id_screen.h"
#include "id_public.h"
-#include "id_screen.h"
-#include "id_objects.h"
struct identity_drm_api
{
@@ -63,62 +61,6 @@ identity_drm_create_screen(struct drm_api *_api, int fd,
return identity_screen_create(screen);
}
-
-static struct pipe_texture *
-identity_drm_texture_from_shared_handle(struct drm_api *_api,
- struct pipe_screen *_screen,
- struct pipe_texture *templ,
- const char *name,
- unsigned stride,
- unsigned handle)
-{
- struct identity_screen *id_screen = identity_screen(_screen);
- struct identity_drm_api *id_api = identity_drm_api(_api);
- struct pipe_screen *screen = id_screen->screen;
- struct drm_api *api = id_api->api;
- struct pipe_texture *result;
-
- result = api->texture_from_shared_handle(api, screen, templ, name, stride, handle);
-
- result = identity_texture_create(identity_screen(_screen), result);
-
- return result;
-}
-
-static boolean
-identity_drm_shared_handle_from_texture(struct drm_api *_api,
- struct pipe_screen *_screen,
- struct pipe_texture *_texture,
- unsigned *stride,
- unsigned *handle)
-{
- struct identity_screen *id_screen = identity_screen(_screen);
- struct identity_texture *id_texture = identity_texture(_texture);
- struct identity_drm_api *id_api = identity_drm_api(_api);
- struct pipe_screen *screen = id_screen->screen;
- struct pipe_texture *texture = id_texture->texture;
- struct drm_api *api = id_api->api;
-
- return api->shared_handle_from_texture(api, screen, texture, stride, handle);
-}
-
-static boolean
-identity_drm_local_handle_from_texture(struct drm_api *_api,
- struct pipe_screen *_screen,
- struct pipe_texture *_texture,
- unsigned *stride,
- unsigned *handle)
-{
- struct identity_screen *id_screen = identity_screen(_screen);
- struct identity_texture *id_texture = identity_texture(_texture);
- struct identity_drm_api *id_api = identity_drm_api(_api);
- struct pipe_screen *screen = id_screen->screen;
- struct pipe_texture *texture = id_texture->texture;
- struct drm_api *api = id_api->api;
-
- return api->local_handle_from_texture(api, screen, texture, stride, handle);
-}
-
static void
identity_drm_destroy(struct drm_api *_api)
{
@@ -145,9 +87,6 @@ identity_drm_create(struct drm_api *api)
id_api->base.name = api->name;
id_api->base.driver_name = api->driver_name;
id_api->base.create_screen = identity_drm_create_screen;
- id_api->base.texture_from_shared_handle = identity_drm_texture_from_shared_handle;
- id_api->base.shared_handle_from_texture = identity_drm_shared_handle_from_texture;
- id_api->base.local_handle_from_texture = identity_drm_local_handle_from_texture;
id_api->base.destroy = identity_drm_destroy;
id_api->api = api;
diff --git a/src/gallium/drivers/identity/id_objects.c b/src/gallium/drivers/identity/id_objects.c
index 2b1a60c1bf..d37fb0042e 100644
--- a/src/gallium/drivers/identity/id_objects.c
+++ b/src/gallium/drivers/identity/id_objects.c
@@ -30,6 +30,7 @@
#include "id_screen.h"
#include "id_objects.h"
+#include "id_context.h"
struct pipe_buffer *
identity_buffer_create(struct identity_screen *id_screen,
@@ -142,7 +143,8 @@ identity_surface_destroy(struct identity_surface *id_surface)
struct pipe_transfer *
-identity_transfer_create(struct identity_texture *id_texture,
+identity_transfer_create(struct identity_context *id_context,
+ struct identity_texture *id_texture,
struct pipe_transfer *transfer)
{
struct identity_transfer *id_transfer;
@@ -159,25 +161,25 @@ identity_transfer_create(struct identity_texture *id_texture,
memcpy(&id_transfer->base, transfer, sizeof(struct pipe_transfer));
id_transfer->base.texture = NULL;
- pipe_texture_reference(&id_transfer->base.texture, &id_texture->base);
id_transfer->transfer = transfer;
+
+ pipe_texture_reference(&id_transfer->base.texture, &id_texture->base);
assert(id_transfer->base.texture == &id_texture->base);
return &id_transfer->base;
error:
- transfer->texture->screen->tex_transfer_destroy(transfer);
+ id_context->pipe->tex_transfer_destroy(id_context->pipe, transfer);
return NULL;
}
void
-identity_transfer_destroy(struct identity_transfer *id_transfer)
+identity_transfer_destroy(struct identity_context *id_context,
+ struct identity_transfer *id_transfer)
{
- struct identity_screen *id_screen = identity_screen(id_transfer->base.texture->screen);
- struct pipe_screen *screen = id_screen->screen;
-
pipe_texture_reference(&id_transfer->base.texture, NULL);
- screen->tex_transfer_destroy(id_transfer->transfer);
+ id_context->pipe->tex_transfer_destroy(id_context->pipe,
+ id_transfer->transfer);
FREE(id_transfer);
}
diff --git a/src/gallium/drivers/identity/id_objects.h b/src/gallium/drivers/identity/id_objects.h
index 77cc719079..9a07ebe8d7 100644
--- a/src/gallium/drivers/identity/id_objects.h
+++ b/src/gallium/drivers/identity/id_objects.h
@@ -35,6 +35,7 @@
#include "id_screen.h"
+struct identity_context;
struct identity_buffer
{
@@ -52,6 +53,14 @@ struct identity_texture
};
+struct identity_sampler_view
+{
+ struct pipe_sampler_view base;
+
+ struct pipe_sampler_view *sampler_view;
+};
+
+
struct identity_surface
{
struct pipe_surface base;
@@ -64,6 +73,7 @@ struct identity_transfer
{
struct pipe_transfer base;
+ struct pipe_context *pipe;
struct pipe_transfer *transfer;
};
@@ -94,6 +104,15 @@ identity_texture(struct pipe_texture *_texture)
return (struct identity_texture *)_texture;
}
+static INLINE struct identity_sampler_view *
+identity_sampler_view(struct pipe_sampler_view *_sampler_view)
+{
+ if (!_sampler_view) {
+ return NULL;
+ }
+ return (struct identity_sampler_view *)_sampler_view;
+}
+
static INLINE struct identity_surface *
identity_surface(struct pipe_surface *_surface)
{
@@ -138,6 +157,15 @@ identity_texture_unwrap(struct pipe_texture *_texture)
return identity_texture(_texture)->texture;
}
+static INLINE struct pipe_sampler_view *
+identity_sampler_view_unwrap(struct pipe_sampler_view *_sampler_view)
+{
+ if (!_sampler_view) {
+ return NULL;
+ }
+ return identity_sampler_view(_sampler_view)->sampler_view;
+}
+
static INLINE struct pipe_surface *
identity_surface_unwrap(struct pipe_surface *_surface)
{
@@ -177,11 +205,13 @@ void
identity_surface_destroy(struct identity_surface *id_surface);
struct pipe_transfer *
-identity_transfer_create(struct identity_texture *id_texture,
+identity_transfer_create(struct identity_context *id_context,
+ struct identity_texture *id_texture,
struct pipe_transfer *transfer);
void
-identity_transfer_destroy(struct identity_transfer *id_transfer);
+identity_transfer_destroy(struct identity_context *id_context,
+ struct identity_transfer *id_transfer);
struct pipe_video_surface *
identity_video_surface_create(struct identity_screen *id_screen,
diff --git a/src/gallium/drivers/identity/id_screen.c b/src/gallium/drivers/identity/id_screen.c
index b85492114a..419b146578 100644
--- a/src/gallium/drivers/identity/id_screen.c
+++ b/src/gallium/drivers/identity/id_screen.c
@@ -135,27 +135,40 @@ identity_screen_texture_create(struct pipe_screen *_screen,
}
static struct pipe_texture *
-identity_screen_texture_blanket(struct pipe_screen *_screen,
- const struct pipe_texture *templat,
- const unsigned *stride,
- struct pipe_buffer *_buffer)
+identity_screen_texture_from_handle(struct pipe_screen *_screen,
+ const struct pipe_texture *templ,
+ struct winsys_handle *handle)
{
struct identity_screen *id_screen = identity_screen(_screen);
- struct identity_buffer *id_buffer = identity_buffer(_buffer);
struct pipe_screen *screen = id_screen->screen;
- struct pipe_buffer *buffer = id_buffer->buffer;
struct pipe_texture *result;
- result = screen->texture_blanket(screen,
- templat,
- stride,
- buffer);
+ /* TODO trace call */
- if (result)
- return identity_texture_create(id_screen, result);
- return NULL;
+ result = screen->texture_from_handle(screen, templ, handle);
+
+ result = identity_texture_create(identity_screen(_screen), result);
+
+ return result;
}
+static boolean
+identity_screen_texture_get_handle(struct pipe_screen *_screen,
+ struct pipe_texture *_texture,
+ struct winsys_handle *handle)
+{
+ struct identity_screen *id_screen = identity_screen(_screen);
+ struct identity_texture *id_texture = identity_texture(_texture);
+ struct pipe_screen *screen = id_screen->screen;
+ struct pipe_texture *texture = id_texture->texture;
+
+ /* TODO trace call */
+
+ return screen->texture_get_handle(screen, texture, handle);
+}
+
+
+
static void
identity_screen_texture_destroy(struct pipe_texture *_texture)
{
@@ -194,71 +207,6 @@ identity_screen_tex_surface_destroy(struct pipe_surface *_surface)
identity_surface_destroy(identity_surface(_surface));
}
-static struct pipe_transfer *
-identity_screen_get_tex_transfer(struct pipe_screen *_screen,
- struct pipe_texture *_texture,
- unsigned face,
- unsigned level,
- unsigned zslice,
- enum pipe_transfer_usage usage,
- unsigned x,
- unsigned y,
- unsigned w,
- unsigned h)
-{
- struct identity_screen *id_screen = identity_screen(_screen);
- struct identity_texture *id_texture = identity_texture(_texture);
- struct pipe_screen *screen = id_screen->screen;
- struct pipe_texture *texture = id_texture->texture;
- struct pipe_transfer *result;
-
- result = screen->get_tex_transfer(screen,
- texture,
- face,
- level,
- zslice,
- usage,
- x,
- y,
- w,
- h);
-
- if (result)
- return identity_transfer_create(id_texture, result);
- return NULL;
-}
-
-static void
-identity_screen_tex_transfer_destroy(struct pipe_transfer *_transfer)
-{
- identity_transfer_destroy(identity_transfer(_transfer));
-}
-
-static void *
-identity_screen_transfer_map(struct pipe_screen *_screen,
- struct pipe_transfer *_transfer)
-{
- struct identity_screen *id_screen = identity_screen(_screen);
- struct identity_transfer *id_transfer = identity_transfer(_transfer);
- struct pipe_screen *screen = id_screen->screen;
- struct pipe_transfer *transfer = id_transfer->transfer;
-
- return screen->transfer_map(screen,
- transfer);
-}
-
-static void
-identity_screen_transfer_unmap(struct pipe_screen *_screen,
- struct pipe_transfer *_transfer)
-{
- struct identity_screen *id_screen = identity_screen(_screen);
- struct identity_transfer *id_transfer = identity_transfer(_transfer);
- struct pipe_screen *screen = id_screen->screen;
- struct pipe_transfer *transfer = id_transfer->transfer;
-
- screen->transfer_unmap(screen,
- transfer);
-}
static struct pipe_buffer *
identity_screen_buffer_create(struct pipe_screen *_screen,
@@ -298,31 +246,6 @@ identity_screen_user_buffer_create(struct pipe_screen *_screen,
return NULL;
}
-static struct pipe_buffer *
-identity_screen_surface_buffer_create(struct pipe_screen *_screen,
- unsigned width,
- unsigned height,
- enum pipe_format format,
- unsigned usage,
- unsigned tex_usage,
- unsigned *stride)
-{
- struct identity_screen *id_screen = identity_screen(_screen);
- struct pipe_screen *screen = id_screen->screen;
- struct pipe_buffer *result;
-
- result = screen->surface_buffer_create(screen,
- width,
- height,
- format,
- usage,
- tex_usage,
- stride);
-
- if (result)
- return identity_buffer_create(id_screen, result);
- return NULL;
-}
static void *
identity_screen_buffer_map(struct pipe_screen *_screen,
@@ -495,17 +418,13 @@ identity_screen_create(struct pipe_screen *screen)
id_screen->base.is_format_supported = identity_screen_is_format_supported;
id_screen->base.context_create = identity_screen_context_create;
id_screen->base.texture_create = identity_screen_texture_create;
- id_screen->base.texture_blanket = identity_screen_texture_blanket;
+ id_screen->base.texture_from_handle = identity_screen_texture_from_handle;
+ id_screen->base.texture_get_handle = identity_screen_texture_get_handle;
id_screen->base.texture_destroy = identity_screen_texture_destroy;
id_screen->base.get_tex_surface = identity_screen_get_tex_surface;
id_screen->base.tex_surface_destroy = identity_screen_tex_surface_destroy;
- id_screen->base.get_tex_transfer = identity_screen_get_tex_transfer;
- id_screen->base.tex_transfer_destroy = identity_screen_tex_transfer_destroy;
- id_screen->base.transfer_map = identity_screen_transfer_map;
- id_screen->base.transfer_unmap = identity_screen_transfer_unmap;
id_screen->base.buffer_create = identity_screen_buffer_create;
id_screen->base.user_buffer_create = identity_screen_user_buffer_create;
- id_screen->base.surface_buffer_create = identity_screen_surface_buffer_create;
if (screen->buffer_map)
id_screen->base.buffer_map = identity_screen_buffer_map;
if (screen->buffer_map_range)
diff --git a/src/gallium/drivers/llvmpipe/Makefile b/src/gallium/drivers/llvmpipe/Makefile
index 41ac1cee72..7bfce15c2e 100644
--- a/src/gallium/drivers/llvmpipe/Makefile
+++ b/src/gallium/drivers/llvmpipe/Makefile
@@ -42,20 +42,19 @@ C_SOURCES = \
CPP_SOURCES = \
+PROGS := \
+ lp_test_blend \
+ lp_test_conv \
+ lp_test_printf
+
include ../../Makefile.template
-lp_tile_soa.c: lp_tile_soa.py ../../auxiliary/util/u_format_parse.py ../../auxiliary/util/u_format_access.py ../../auxiliary/util/u_format.csv
+lp_tile_soa.c: lp_tile_soa.py ../../auxiliary/util/u_format_parse.py ../../auxiliary/util/u_format_pack.py ../../auxiliary/util/u_format.csv
python lp_tile_soa.py ../../auxiliary/util/u_format.csv > $@
-testprogs := lp_test_format \
- lp_test_blend \
- lp_test_conv
-
-LIBS += $(GL_LIB_DEPS) -L. -lllvmpipe -L../../auxiliary/ -lgallium
+LIBS += $(GL_LIB_DEPS) -L../../auxiliary/ -lgallium
-$(testprogs): lp_test_% : lp_test_%.o lp_test_main.o libllvmpipe.a
- $(LD) $(filter %.o,$^) -o $@ -Wl,--start-group $(LIBS) -Wl,--end-group
+$(PROGS): lp_test_main.o
-default: $(testprogs)
diff --git a/src/gallium/drivers/llvmpipe/README b/src/gallium/drivers/llvmpipe/README
index bf4c9a5727..3c3fd386b5 100644
--- a/src/gallium/drivers/llvmpipe/README
+++ b/src/gallium/drivers/llvmpipe/README
@@ -12,7 +12,11 @@ Done so far is:
- depth testing
- - texture sampling (not all state/formats are supported)
+ - texture sampling
+ - 1D/2D/3D/cube maps supported
+ - all texture wrap modes supported
+ - all texture filtering modes supported
+ - perhaps not all texture formats yet supported
- fragment shader TGSI translation
- same level of support as the TGSI SSE2 exec machine, with the exception
@@ -37,8 +41,6 @@ To do (probably by this order):
- code generate stipple and stencil testing
- - translate the remaining bits of texture sampling state
-
- translate TGSI control flow instructions, and all other remaining opcodes
- integrate with the draw module for VS code generation
@@ -57,7 +59,7 @@ Requirements
See /proc/cpuinfo to know what your CPU supports.
- - LLVM 2.6.
+ - LLVM 2.6 (or later)
For Linux, on a recent Debian based distribution do:
@@ -67,6 +69,9 @@ Requirements
http://people.freedesktop.org/~jrfonseca/llvm/ and set the LLVM environment
variable to the extracted path.
+ The version of LLVM from SVN ("2.7svn") from mid-March 2010 seems pretty
+ stable and has some features not in version 2.6.
+
- scons (optional)
- udis86, http://udis86.sourceforge.net/ (optional):
@@ -140,11 +145,13 @@ Development Notes
then skim through the lp_bld_* functions called in there, and the comments
at the top of the lp_bld_*.c functions.
-- All lp_bld_*.[ch] are isolated from the rest of the driver, and could/may be
- put in a stand-alone Gallium state -> LLVM IR translation module.
+- The driver-independent parts of the LLVM / Gallium code are found in
+ src/gallium/auxiliary/gallivm/. The filenames and function prefixes
+ need to be renamed from "lp_bld_" to something else though.
- We use LLVM-C bindings for now. They are not documented, but follow the C++
interfaces very closely, and appear to be complete enough for code
generation. See
http://npcontemplation.blogspot.com/2008/06/secret-of-llvm-c-bindings.html
for a stand-alone example.
+ See the llvm-c/Core.h file for reference.
diff --git a/src/gallium/drivers/llvmpipe/SConscript b/src/gallium/drivers/llvmpipe/SConscript
index 13c1a13e87..07e6ccfce4 100644
--- a/src/gallium/drivers/llvmpipe/SConscript
+++ b/src/gallium/drivers/llvmpipe/SConscript
@@ -22,7 +22,6 @@ env.CodeGenerate(
env.Depends('lp_tile_soa.c', [
'#src/gallium/auxiliary/util/u_format_parse.py',
'#src/gallium/auxiliary/util/u_format_pack.py',
- '#src/gallium/auxiliary/util/u_format_access.py',
])
llvmpipe = env.ConvenienceLibrary(
@@ -70,7 +69,6 @@ if env['platform'] != 'embedded':
env.Prepend(LIBS = [llvmpipe] + gallium)
tests = [
- 'format',
'blend',
'conv',
]
diff --git a/src/gallium/drivers/llvmpipe/lp_buffer.c b/src/gallium/drivers/llvmpipe/lp_buffer.c
index 9eda972081..6e0f37393e 100644
--- a/src/gallium/drivers/llvmpipe/lp_buffer.c
+++ b/src/gallium/drivers/llvmpipe/lp_buffer.c
@@ -30,7 +30,6 @@
#include "util/u_memory.h"
#include "util/u_math.h"
-#include "lp_winsys.h"
#include "lp_screen.h"
#include "lp_buffer.h"
diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c
index e31ae6a3fc..951a695f96 100644
--- a/src/gallium/drivers/llvmpipe/lp_context.c
+++ b/src/gallium/drivers/llvmpipe/lp_context.c
@@ -68,11 +68,11 @@ static void llvmpipe_destroy( struct pipe_context *pipe )
pipe_surface_reference(&llvmpipe->framebuffer.zsbuf, NULL);
for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
- pipe_texture_reference(&llvmpipe->texture[i], NULL);
+ pipe_sampler_view_reference(&llvmpipe->fragment_sampler_views[i], NULL);
}
for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) {
- pipe_texture_reference(&llvmpipe->vertex_textures[i], NULL);
+ pipe_sampler_view_reference(&llvmpipe->vertex_sampler_views[i], NULL);
}
for (i = 0; i < Elements(llvmpipe->constants); i++) {
@@ -145,6 +145,10 @@ llvmpipe_create_context( struct pipe_screen *screen, void *priv )
llvmpipe->pipe.bind_vs_state = llvmpipe_bind_vs_state;
llvmpipe->pipe.delete_vs_state = llvmpipe_delete_vs_state;
+ llvmpipe->pipe.create_vertex_elements_state = llvmpipe_create_vertex_elements_state;
+ llvmpipe->pipe.bind_vertex_elements_state = llvmpipe_bind_vertex_elements_state;
+ llvmpipe->pipe.delete_vertex_elements_state = llvmpipe_delete_vertex_elements_state;
+
llvmpipe->pipe.set_blend_color = llvmpipe_set_blend_color;
llvmpipe->pipe.set_stencil_ref = llvmpipe_set_stencil_ref;
llvmpipe->pipe.set_clip_state = llvmpipe_set_clip_state;
@@ -152,12 +156,13 @@ llvmpipe_create_context( struct pipe_screen *screen, void *priv )
llvmpipe->pipe.set_framebuffer_state = llvmpipe_set_framebuffer_state;
llvmpipe->pipe.set_polygon_stipple = llvmpipe_set_polygon_stipple;
llvmpipe->pipe.set_scissor_state = llvmpipe_set_scissor_state;
- llvmpipe->pipe.set_fragment_sampler_textures = llvmpipe_set_sampler_textures;
- llvmpipe->pipe.set_vertex_sampler_textures = llvmpipe_set_vertex_sampler_textures;
+ llvmpipe->pipe.set_fragment_sampler_views = llvmpipe_set_fragment_sampler_views;
+ llvmpipe->pipe.set_vertex_sampler_views = llvmpipe_set_vertex_sampler_views;
+ llvmpipe->pipe.create_sampler_view = llvmpipe_create_sampler_view;
+ llvmpipe->pipe.sampler_view_destroy = llvmpipe_sampler_view_destroy;
llvmpipe->pipe.set_viewport_state = llvmpipe_set_viewport_state;
llvmpipe->pipe.set_vertex_buffers = llvmpipe_set_vertex_buffers;
- llvmpipe->pipe.set_vertex_elements = llvmpipe_set_vertex_elements;
llvmpipe->pipe.draw_arrays = llvmpipe_draw_arrays;
llvmpipe->pipe.draw_elements = llvmpipe_draw_elements;
@@ -170,6 +175,7 @@ llvmpipe_create_context( struct pipe_screen *screen, void *priv )
llvmpipe->pipe.is_buffer_referenced = llvmpipe_is_buffer_referenced;
llvmpipe_init_query_funcs( llvmpipe );
+ llvmpipe_init_context_texture_funcs( &llvmpipe->pipe );
/*
* Create drawing context and plug our rendering stage into it.
diff --git a/src/gallium/drivers/llvmpipe/lp_context.h b/src/gallium/drivers/llvmpipe/lp_context.h
index 955c7eb8e0..71f991049e 100644
--- a/src/gallium/drivers/llvmpipe/lp_context.h
+++ b/src/gallium/drivers/llvmpipe/lp_context.h
@@ -45,7 +45,8 @@ struct draw_stage;
struct lp_fragment_shader;
struct lp_vertex_shader;
struct lp_blend_state;
-struct setup_context;
+struct lp_setup_context;
+struct lp_velems_state;
struct llvmpipe_context {
struct pipe_context pipe; /**< base class */
@@ -58,6 +59,7 @@ struct llvmpipe_context {
const struct pipe_rasterizer_state *rasterizer;
struct lp_fragment_shader *fs;
const struct lp_vertex_shader *vs;
+ const struct lp_velems_state *velems;
/** Other rendering state */
struct pipe_blend_color blend_color;
@@ -67,17 +69,15 @@ struct llvmpipe_context {
struct pipe_framebuffer_state framebuffer;
struct pipe_poly_stipple poly_stipple;
struct pipe_scissor_state scissor;
- struct pipe_texture *texture[PIPE_MAX_SAMPLERS];
- struct pipe_texture *vertex_textures[PIPE_MAX_VERTEX_SAMPLERS];
+ struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS];
+ struct pipe_sampler_view *vertex_sampler_views[PIPE_MAX_VERTEX_SAMPLERS];
struct pipe_viewport_state viewport;
struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
- struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS];
unsigned num_samplers;
- unsigned num_textures;
+ unsigned num_fragment_sampler_views;
unsigned num_vertex_samplers;
- unsigned num_vertex_textures;
- unsigned num_vertex_elements;
+ unsigned num_vertex_sampler_views;
unsigned num_vertex_buffers;
unsigned dirty; /**< Mask of LP_NEW_x flags */
@@ -98,7 +98,7 @@ struct llvmpipe_context {
int psize_slot;
/** The tiling engine */
- struct setup_context *setup;
+ struct lp_setup_context *setup;
/** The primitive drawing context */
struct draw_context *draw;
diff --git a/src/gallium/drivers/llvmpipe/lp_fence.c b/src/gallium/drivers/llvmpipe/lp_fence.c
index 525c117f31..00dc3eab6b 100644
--- a/src/gallium/drivers/llvmpipe/lp_fence.c
+++ b/src/gallium/drivers/llvmpipe/lp_fence.c
@@ -29,6 +29,7 @@
#include "pipe/p_screen.h"
#include "util/u_memory.h"
#include "util/u_inlines.h"
+#include "lp_debug.h"
#include "lp_fence.h"
@@ -99,6 +100,21 @@ llvmpipe_fence_finish(struct pipe_screen *screen,
}
+void
+lp_fence_signal(struct lp_fence *fence)
+{
+ pipe_mutex_lock(fence->mutex);
+
+ fence->count++;
+ assert(fence->count <= fence->rank);
+
+ LP_DBG(DEBUG_RAST, "%s count=%u rank=%u\n", __FUNCTION__,
+ fence->count, fence->rank);
+
+ pipe_condvar_signal(fence->signalled);
+
+ pipe_mutex_unlock(fence->mutex);
+}
void
diff --git a/src/gallium/drivers/llvmpipe/lp_fence.h b/src/gallium/drivers/llvmpipe/lp_fence.h
index c90e6de423..d9270f5784 100644
--- a/src/gallium/drivers/llvmpipe/lp_fence.h
+++ b/src/gallium/drivers/llvmpipe/lp_fence.h
@@ -54,6 +54,10 @@ lp_fence_create(unsigned rank);
void
+lp_fence_signal(struct lp_fence *fence);
+
+
+void
llvmpipe_init_screen_fence_funcs(struct pipe_screen *screen);
diff --git a/src/gallium/drivers/llvmpipe/lp_flush.c b/src/gallium/drivers/llvmpipe/lp_flush.c
index bf832433be..782669a1e7 100644
--- a/src/gallium/drivers/llvmpipe/lp_flush.c
+++ b/src/gallium/drivers/llvmpipe/lp_flush.c
@@ -79,12 +79,12 @@ llvmpipe_flush( struct pipe_context *pipe,
for (i = 0; i < llvmpipe->framebuffer.nr_cbufs; i++) {
util_snprintf(filename, sizeof(filename), "cbuf%u_%u", i, frame_no);
- debug_dump_surface(filename, llvmpipe->framebuffer.cbufs[i]);
+ debug_dump_surface_bmp(&llvmpipe->pipe, filename, llvmpipe->framebuffer.cbufs[0]);
}
if (0) {
util_snprintf(filename, sizeof(filename), "zsbuf_%u", frame_no);
- debug_dump_surface(filename, llvmpipe->framebuffer.zsbuf);
+ debug_dump_surface_bmp(&llvmpipe->pipe, filename, llvmpipe->framebuffer.zsbuf);
}
++frame_no;
@@ -92,3 +92,67 @@ llvmpipe_flush( struct pipe_context *pipe,
#endif
}
+
+/**
+ * Flush context if necessary.
+ *
+ * TODO: move this logic to an auxiliary library?
+ *
+ * FIXME: We must implement DISCARD/DONTBLOCK/UNSYNCHRONIZED/etc for
+ * textures to avoid blocking.
+ */
+boolean
+llvmpipe_flush_texture(struct pipe_context *pipe,
+ struct pipe_texture *texture,
+ unsigned face,
+ unsigned level,
+ unsigned flush_flags,
+ boolean read_only,
+ boolean cpu_access,
+ boolean do_not_flush)
+{
+ unsigned referenced;
+
+ referenced = pipe->is_texture_referenced(pipe, texture, face, level);
+
+ if ((referenced & PIPE_REFERENCED_FOR_WRITE) ||
+ ((referenced & PIPE_REFERENCED_FOR_READ) && !read_only)) {
+
+ if (do_not_flush)
+ return FALSE;
+
+ /*
+ * TODO: The semantics of these flush flags are too obtuse. They should
+ * disappear and the pipe driver should just ensure that all visible
+ * side-effects happen when they need to happen.
+ */
+ if (referenced & PIPE_REFERENCED_FOR_WRITE)
+ flush_flags |= PIPE_FLUSH_RENDER_CACHE;
+
+ if (referenced & PIPE_REFERENCED_FOR_READ)
+ flush_flags |= PIPE_FLUSH_TEXTURE_CACHE;
+
+ if (cpu_access) {
+ /*
+ * Flush and wait.
+ */
+
+ struct pipe_fence_handle *fence = NULL;
+
+ pipe->flush(pipe, flush_flags, &fence);
+
+ if (fence) {
+ pipe->screen->fence_finish(pipe->screen, fence, 0);
+ pipe->screen->fence_reference(pipe->screen, &fence, NULL);
+ }
+ } else {
+ /*
+ * Just flush.
+ */
+
+ pipe->flush(pipe, flush_flags, NULL);
+ }
+ }
+
+ return TRUE;
+}
diff --git a/src/gallium/drivers/llvmpipe/lp_flush.h b/src/gallium/drivers/llvmpipe/lp_flush.h
index 10b2b52583..e13f57ccec 100644
--- a/src/gallium/drivers/llvmpipe/lp_flush.h
+++ b/src/gallium/drivers/llvmpipe/lp_flush.h
@@ -28,10 +28,22 @@
#ifndef LP_FLUSH_H
#define LP_FLUSH_H
+#include "pipe/p_compiler.h"
+
struct pipe_context;
struct pipe_fence_handle;
void llvmpipe_flush(struct pipe_context *pipe, unsigned flags,
struct pipe_fence_handle **fence);
+boolean
+llvmpipe_flush_texture(struct pipe_context *pipe,
+ struct pipe_texture *texture,
+ unsigned face,
+ unsigned level,
+ unsigned flush_flags,
+ boolean read_only,
+ boolean cpu_access,
+ boolean do_not_flush);
+
#endif
diff --git a/src/gallium/drivers/llvmpipe/lp_jit.c b/src/gallium/drivers/llvmpipe/lp_jit.c
index bacff500d6..927e472ff2 100644
--- a/src/gallium/drivers/llvmpipe/lp_jit.c
+++ b/src/gallium/drivers/llvmpipe/lp_jit.c
@@ -57,8 +57,11 @@ lp_jit_init_globals(struct llvmpipe_screen *screen)
elem_types[LP_JIT_TEXTURE_HEIGHT] = LLVMInt32Type();
elem_types[LP_JIT_TEXTURE_DEPTH] = LLVMInt32Type();
elem_types[LP_JIT_TEXTURE_LAST_LEVEL] = LLVMInt32Type();
- elem_types[LP_JIT_TEXTURE_STRIDE] = LLVMInt32Type();
- elem_types[LP_JIT_TEXTURE_DATA] = LLVMPointerType(LLVMInt8Type(), 0);
+ elem_types[LP_JIT_TEXTURE_ROW_STRIDE] =
+ LLVMArrayType(LLVMInt32Type(), LP_MAX_TEXTURE_2D_LEVELS);
+ elem_types[LP_JIT_TEXTURE_DATA] =
+ LLVMArrayType(LLVMPointerType(LLVMInt8Type(), 0),
+ LP_MAX_TEXTURE_2D_LEVELS);
texture_type = LLVMStructType(elem_types, Elements(elem_types), 0);
@@ -74,9 +77,9 @@ lp_jit_init_globals(struct llvmpipe_screen *screen)
LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, last_level,
screen->target, texture_type,
LP_JIT_TEXTURE_LAST_LEVEL);
- LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, stride,
+ LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, row_stride,
screen->target, texture_type,
- LP_JIT_TEXTURE_STRIDE);
+ LP_JIT_TEXTURE_ROW_STRIDE);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, data,
screen->target, texture_type,
LP_JIT_TEXTURE_DATA);
@@ -88,36 +91,53 @@ lp_jit_init_globals(struct llvmpipe_screen *screen)
/* struct lp_jit_context */
{
- LLVMTypeRef elem_types[8];
+ LLVMTypeRef elem_types[LP_JIT_CTX_COUNT];
LLVMTypeRef context_type;
- elem_types[0] = LLVMPointerType(LLVMFloatType(), 0); /* constants */
- elem_types[1] = LLVMFloatType(); /* alpha_ref_value */ elem_types[2] = LLVMFloatType(); /* scissor_xmin */
- elem_types[3] = LLVMFloatType(); /* scissor_ymin */
- elem_types[4] = LLVMFloatType(); /* scissor_xmax */
- elem_types[5] = LLVMFloatType(); /* scissor_ymax */
- elem_types[6] = LLVMPointerType(LLVMInt8Type(), 0); /* blend_color */
- elem_types[7] = LLVMArrayType(texture_type, PIPE_MAX_SAMPLERS); /* textures */
+ elem_types[LP_JIT_CTX_CONSTANTS] = LLVMPointerType(LLVMFloatType(), 0);
+ elem_types[LP_JIT_CTX_ALPHA_REF] = LLVMFloatType();
+ elem_types[LP_JIT_CTX_STENCIL_REF_FRONT] = LLVMInt32Type();
+ elem_types[LP_JIT_CTX_STENCIL_REF_BACK] = LLVMInt32Type();
+ elem_types[LP_JIT_CTX_SCISSOR_XMIN] = LLVMFloatType();
+ elem_types[LP_JIT_CTX_SCISSOR_YMIN] = LLVMFloatType();
+ elem_types[LP_JIT_CTX_SCISSOR_XMAX] = LLVMFloatType();
+ elem_types[LP_JIT_CTX_SCISSOR_YMAX] = LLVMFloatType();
+ elem_types[LP_JIT_CTX_BLEND_COLOR] = LLVMPointerType(LLVMInt8Type(), 0);
+ elem_types[LP_JIT_CTX_TEXTURES] = LLVMArrayType(texture_type,
+ PIPE_MAX_SAMPLERS);
context_type = LLVMStructType(elem_types, Elements(elem_types), 0);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, constants,
- screen->target, context_type, 0);
+ screen->target, context_type,
+ LP_JIT_CTX_CONSTANTS);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, alpha_ref_value,
- screen->target, context_type, 1);
+ screen->target, context_type,
+ LP_JIT_CTX_ALPHA_REF);
+ LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, stencil_ref_front,
+ screen->target, context_type,
+ LP_JIT_CTX_STENCIL_REF_FRONT);
+ LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, stencil_ref_back,
+ screen->target, context_type,
+ LP_JIT_CTX_STENCIL_REF_BACK);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, scissor_xmin,
- screen->target, context_type, 2);
+ screen->target, context_type,
+ LP_JIT_CTX_SCISSOR_XMIN);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, scissor_ymin,
- screen->target, context_type, 3);
+ screen->target, context_type,
+ LP_JIT_CTX_SCISSOR_YMIN);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, scissor_xmax,
- screen->target, context_type, 4);
+ screen->target, context_type,
+ LP_JIT_CTX_SCISSOR_XMAX);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, scissor_ymax,
- screen->target, context_type, 5);
+ screen->target, context_type,
+ LP_JIT_CTX_SCISSOR_YMAX);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, blend_color,
- screen->target, context_type, 6);
+ screen->target, context_type,
+ LP_JIT_CTX_BLEND_COLOR);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, textures,
screen->target, context_type,
- LP_JIT_CONTEXT_TEXTURES_INDEX);
+ LP_JIT_CTX_TEXTURES);
LP_CHECK_STRUCT_SIZE(struct lp_jit_context,
screen->target, context_type);
diff --git a/src/gallium/drivers/llvmpipe/lp_jit.h b/src/gallium/drivers/llvmpipe/lp_jit.h
index 0ebb2826fa..4930ff02e6 100644
--- a/src/gallium/drivers/llvmpipe/lp_jit.h
+++ b/src/gallium/drivers/llvmpipe/lp_jit.h
@@ -39,6 +39,7 @@
#include "gallivm/lp_bld_struct.h"
#include "pipe/p_state.h"
+#include "lp_texture.h"
struct llvmpipe_screen;
@@ -50,8 +51,8 @@ struct lp_jit_texture
uint32_t height;
uint32_t depth;
uint32_t last_level;
- uint32_t stride;
- const void *data;
+ uint32_t row_stride[LP_MAX_TEXTURE_2D_LEVELS];
+ const void *data[LP_MAX_TEXTURE_2D_LEVELS];
};
@@ -60,7 +61,7 @@ enum {
LP_JIT_TEXTURE_HEIGHT,
LP_JIT_TEXTURE_DEPTH,
LP_JIT_TEXTURE_LAST_LEVEL,
- LP_JIT_TEXTURE_STRIDE,
+ LP_JIT_TEXTURE_ROW_STRIDE,
LP_JIT_TEXTURE_DATA
};
@@ -83,6 +84,8 @@ struct lp_jit_context
float alpha_ref_value;
+ uint32_t stencil_ref_front, stencil_ref_back;
+
/** floats, not ints */
float scissor_xmin, scissor_ymin, scissor_xmax, scissor_ymax;
@@ -93,37 +96,66 @@ struct lp_jit_context
};
+/**
+ * These enum values must match the position of the fields in the
+ * lp_jit_context struct above.
+ */
+enum {
+ LP_JIT_CTX_CONSTANTS = 0,
+ LP_JIT_CTX_ALPHA_REF,
+ LP_JIT_CTX_STENCIL_REF_FRONT,
+ LP_JIT_CTX_STENCIL_REF_BACK,
+ LP_JIT_CTX_SCISSOR_XMIN,
+ LP_JIT_CTX_SCISSOR_YMIN,
+ LP_JIT_CTX_SCISSOR_XMAX,
+ LP_JIT_CTX_SCISSOR_YMAX,
+ LP_JIT_CTX_BLEND_COLOR,
+ LP_JIT_CTX_TEXTURES,
+ LP_JIT_CTX_COUNT
+};
+
+
#define lp_jit_context_constants(_builder, _ptr) \
- lp_build_struct_get(_builder, _ptr, 0, "constants")
+ lp_build_struct_get(_builder, _ptr, LP_JIT_CTX_CONSTANTS, "constants")
#define lp_jit_context_alpha_ref_value(_builder, _ptr) \
- lp_build_struct_get(_builder, _ptr, 1, "alpha_ref_value")
+ lp_build_struct_get(_builder, _ptr, LP_JIT_CTX_ALPHA_REF, "alpha_ref_value")
+
+#define lp_jit_context_stencil_ref_front_value(_builder, _ptr) \
+ lp_build_struct_get(_builder, _ptr, LP_JIT_CTX_STENCIL_REF_FRONT, "stencil_ref_front")
+
+#define lp_jit_context_stencil_ref_back_value(_builder, _ptr) \
+ lp_build_struct_get(_builder, _ptr, LP_JIT_CTX_STENCIL_REF_BACK, "stencil_ref_back")
#define lp_jit_context_scissor_xmin_value(_builder, _ptr) \
- lp_build_struct_get(_builder, _ptr, 2, "scissor_xmin")
+ lp_build_struct_get(_builder, _ptr, LP_JIT_CTX_SCISSOR_XMIN, "scissor_xmin")
#define lp_jit_context_scissor_ymin_value(_builder, _ptr) \
- lp_build_struct_get(_builder, _ptr, 3, "scissor_ymin")
+ lp_build_struct_get(_builder, _ptr, LP_JIT_CTX_SCISSOR_YMIN, "scissor_ymin")
#define lp_jit_context_scissor_xmax_value(_builder, _ptr) \
- lp_build_struct_get(_builder, _ptr, 4, "scissor_xmax")
+ lp_build_struct_get(_builder, _ptr, LP_JIT_CTX_SCISSOR_XMAX, "scissor_xmax")
#define lp_jit_context_scissor_ymax_value(_builder, _ptr) \
- lp_build_struct_get(_builder, _ptr, 5, "scissor_ymax")
+ lp_build_struct_get(_builder, _ptr, LP_JIT_CTX_SCISSOR_YMAX, "scissor_ymax")
#define lp_jit_context_blend_color(_builder, _ptr) \
- lp_build_struct_get(_builder, _ptr, 6, "blend_color")
-
-#define LP_JIT_CONTEXT_TEXTURES_INDEX 7
+ lp_build_struct_get(_builder, _ptr, LP_JIT_CTX_BLEND_COLOR, "blend_color")
#define lp_jit_context_textures(_builder, _ptr) \
- lp_build_struct_get_ptr(_builder, _ptr, LP_JIT_CONTEXT_TEXTURES_INDEX, "textures")
+ lp_build_struct_get_ptr(_builder, _ptr, LP_JIT_CONTEXT_TEXTURES, "textures")
+
+
+/** Indexes into jit_function[] array */
+#define RAST_WHOLE 0
+#define RAST_EDGE_TEST 1
typedef void
(*lp_jit_frag_func)(const struct lp_jit_context *context,
uint32_t x,
uint32_t y,
+ float facing,
const void *a0,
const void *dadx,
const void *dady,
diff --git a/src/gallium/drivers/llvmpipe/lp_public.h b/src/gallium/drivers/llvmpipe/lp_public.h
new file mode 100644
index 0000000000..ec6b660b48
--- /dev/null
+++ b/src/gallium/drivers/llvmpipe/lp_public.h
@@ -0,0 +1,10 @@
+#ifndef LP_PUBLIC_H
+#define LP_PUBLIC_H
+
+struct pipe_screen;
+struct sw_winsys;
+
+struct pipe_screen *
+llvmpipe_create_screen(struct sw_winsys *winsys);
+
+#endif
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c
index dd9a8e8856..e629a3e5f1 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.c
+++ b/src/gallium/drivers/llvmpipe/lp_rast.c
@@ -62,18 +62,20 @@ lp_rast_begin( struct lp_rasterizer *rast,
rast->state.write_color = write_color;
for (i = 0; i < rast->state.nr_cbufs; i++) {
+ struct pipe_surface *cbuf = scene->fb.cbufs[i];
rast->cbuf[i].map = scene->cbuf_map[i];
- rast->cbuf[i].format = scene->cbuf_transfer[i]->texture->format;
- rast->cbuf[i].width = scene->cbuf_transfer[i]->width;
- rast->cbuf[i].height = scene->cbuf_transfer[i]->height;
- rast->cbuf[i].stride = scene->cbuf_transfer[i]->stride;
+ rast->cbuf[i].format = cbuf->texture->format;
+ rast->cbuf[i].width = cbuf->width;
+ rast->cbuf[i].height = cbuf->height;
+ rast->cbuf[i].stride = llvmpipe_texture_stride(cbuf->texture, cbuf->level);
}
if (write_zstencil) {
+ struct pipe_surface *zsbuf = scene->fb.zsbuf;
rast->zsbuf.map = scene->zsbuf_map;
- rast->zsbuf.stride = scene->zsbuf_transfer->stride;
+ rast->zsbuf.stride = llvmpipe_texture_stride(zsbuf->texture, zsbuf->level);
rast->zsbuf.blocksize =
- util_format_get_blocksize(scene->zsbuf_transfer->texture->format);
+ util_format_get_blocksize(zsbuf->texture->format);
}
lp_scene_bin_iter_begin( scene );
@@ -187,7 +189,7 @@ lp_rast_clear_zstencil(struct lp_rasterizer_task *task,
LP_DBG(DEBUG_RAST, "%s 0x%x\n", __FUNCTION__, arg.clear_zstencil);
- assert(rast->zsbuf.map);
+ /*assert(rast->zsbuf.map);*/
if (!rast->zsbuf.map)
return;
@@ -310,15 +312,16 @@ lp_rast_shade_tile(struct lp_rasterizer_task *task,
depth = lp_rast_depth_pointer(rast, tile_x + x, tile_y + y);
/* run shader */
- state->jit_function[0]( &state->jit_context,
- tile_x + x, tile_y + y,
- inputs->a0,
- inputs->dadx,
- inputs->dady,
- color,
- depth,
- INT_MIN, INT_MIN, INT_MIN,
- NULL, NULL, NULL );
+ state->jit_function[RAST_WHOLE]( &state->jit_context,
+ tile_x + x, tile_y + y,
+ inputs->facing,
+ inputs->a0,
+ inputs->dadx,
+ inputs->dady,
+ color,
+ depth,
+ INT_MIN, INT_MIN, INT_MIN,
+ NULL, NULL, NULL );
}
}
}
@@ -373,15 +376,18 @@ void lp_rast_shade_quads( struct lp_rasterizer_task *task,
assert(lp_check_alignment(inputs->step[2], 16));
/* run shader */
- state->jit_function[1]( &state->jit_context,
- x, y,
- inputs->a0,
- inputs->dadx,
- inputs->dady,
- color,
- depth,
- c1, c2, c3,
- inputs->step[0], inputs->step[1], inputs->step[2]);
+ state->jit_function[RAST_EDGE_TEST]( &state->jit_context,
+ x, y,
+ inputs->facing,
+ inputs->a0,
+ inputs->dadx,
+ inputs->dady,
+ color,
+ depth,
+ c1, c2, c3,
+ inputs->step[0],
+ inputs->step[1],
+ inputs->step[2]);
}
@@ -485,18 +491,7 @@ lp_rast_fence(struct lp_rasterizer_task *task,
const union lp_rast_cmd_arg arg)
{
struct lp_fence *fence = arg.fence;
-
- pipe_mutex_lock( fence->mutex );
-
- fence->count++;
- assert(fence->count <= fence->rank);
-
- LP_DBG(DEBUG_RAST, "%s count=%u rank=%u\n", __FUNCTION__,
- fence->count, fence->rank);
-
- pipe_condvar_signal( fence->signalled );
-
- pipe_mutex_unlock( fence->mutex );
+ lp_fence_signal(fence);
}
@@ -774,7 +769,11 @@ create_rast_threads(struct lp_rasterizer *rast)
* properly implemented. */
rast->num_threads = 0;
#else
+#ifdef PIPE_OS_EMBEDDED
+ rast->num_threads = 0;
+#else
rast->num_threads = util_cpu_caps.nr_cpus;
+#endif
rast->num_threads = debug_get_num_option("LP_NUM_THREADS", rast->num_threads);
rast->num_threads = MIN2(rast->num_threads, MAX_THREADS);
#endif
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.h b/src/gallium/drivers/llvmpipe/lp_rast.h
index dc5fc5fc7d..ae838f3fbe 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.h
+++ b/src/gallium/drivers/llvmpipe/lp_rast.h
@@ -82,6 +82,8 @@ struct lp_rast_state {
* These pointers point into the bin data buffer.
*/
struct lp_rast_shader_inputs {
+ float facing; /** Positive for front-facing, negative for back-facing */
+
float (*a0)[4];
float (*dadx)[4];
float (*dady)[4];
@@ -95,7 +97,7 @@ struct lp_rast_shader_inputs {
* Rasterization information for a triangle known to be in this bin,
* plus inputs to run the shader:
* These fields are tile- and bin-independent.
- * Objects of this type are put into the setup_context::data buffer.
+ * Objects of this type are put into the lp_setup_context::data buffer.
*/
struct lp_rast_triangle {
#ifdef DEBUG
diff --git a/src/gallium/drivers/llvmpipe/lp_rast_priv.h b/src/gallium/drivers/llvmpipe/lp_rast_priv.h
index 39bf2c2587..6ee9bcaae3 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast_priv.h
+++ b/src/gallium/drivers/llvmpipe/lp_rast_priv.h
@@ -195,6 +195,7 @@ lp_rast_shade_quads_all( struct lp_rasterizer_task *task,
/* run shader */
state->jit_function[0]( &state->jit_context,
x, y,
+ inputs->facing,
inputs->a0,
inputs->dadx,
inputs->dady,
diff --git a/src/gallium/drivers/llvmpipe/lp_scene.c b/src/gallium/drivers/llvmpipe/lp_scene.c
index 72492c0f0c..0c51b52d17 100644
--- a/src/gallium/drivers/llvmpipe/lp_scene.c
+++ b/src/gallium/drivers/llvmpipe/lp_scene.c
@@ -397,7 +397,6 @@ end:
static boolean
lp_scene_map_buffers( struct lp_scene *scene )
{
- struct pipe_screen *screen = scene->pipe->screen;
struct pipe_surface *cbuf, *zsbuf;
int i;
@@ -409,20 +408,10 @@ lp_scene_map_buffers( struct lp_scene *scene )
for (i = 0; i < scene->fb.nr_cbufs; i++) {
cbuf = scene->fb.cbufs[i];
if (cbuf) {
- scene->cbuf_transfer[i] = screen->get_tex_transfer(screen,
- cbuf->texture,
- cbuf->face,
- cbuf->level,
- cbuf->zslice,
- PIPE_TRANSFER_READ_WRITE,
- 0, 0,
- cbuf->width,
- cbuf->height);
- if (!scene->cbuf_transfer[i])
- goto fail;
-
- scene->cbuf_map[i] = screen->transfer_map(screen,
- scene->cbuf_transfer[i]);
+ scene->cbuf_map[i] = llvmpipe_texture_map(cbuf->texture,
+ cbuf->face,
+ cbuf->level,
+ cbuf->zslice);
if (!scene->cbuf_map[i])
goto fail;
}
@@ -432,20 +421,10 @@ lp_scene_map_buffers( struct lp_scene *scene )
*/
zsbuf = scene->fb.zsbuf;
if (zsbuf) {
- scene->zsbuf_transfer = screen->get_tex_transfer(screen,
- zsbuf->texture,
- zsbuf->face,
- zsbuf->level,
- zsbuf->zslice,
- PIPE_TRANSFER_READ_WRITE,
- 0, 0,
- zsbuf->width,
- zsbuf->height);
- if (!scene->zsbuf_transfer)
- goto fail;
-
- scene->zsbuf_map = screen->transfer_map(screen,
- scene->zsbuf_transfer);
+ scene->zsbuf_map = llvmpipe_texture_map(zsbuf->texture,
+ zsbuf->face,
+ zsbuf->level,
+ zsbuf->zslice);
if (!scene->zsbuf_map)
goto fail;
}
@@ -469,28 +448,27 @@ fail:
static void
lp_scene_unmap_buffers( struct lp_scene *scene )
{
- struct pipe_screen *screen = scene->pipe->screen;
unsigned i;
for (i = 0; i < scene->fb.nr_cbufs; i++) {
- if (scene->cbuf_map[i])
- screen->transfer_unmap(screen, scene->cbuf_transfer[i]);
-
- if (scene->cbuf_transfer[i])
- screen->tex_transfer_destroy(scene->cbuf_transfer[i]);
-
- scene->cbuf_transfer[i] = NULL;
- scene->cbuf_map[i] = NULL;
+ if (scene->cbuf_map[i]) {
+ struct pipe_surface *cbuf = scene->fb.cbufs[i];
+ llvmpipe_texture_unmap(cbuf->texture,
+ cbuf->face,
+ cbuf->level,
+ cbuf->zslice);
+ scene->cbuf_map[i] = NULL;
+ }
}
- if (scene->zsbuf_map)
- screen->transfer_unmap(screen, scene->zsbuf_transfer);
-
- if (scene->zsbuf_transfer)
- screen->tex_transfer_destroy(scene->zsbuf_transfer);
-
- scene->zsbuf_transfer = NULL;
- scene->zsbuf_map = NULL;
+ if (scene->zsbuf_map) {
+ struct pipe_surface *zsbuf = scene->fb.zsbuf;
+ llvmpipe_texture_unmap(zsbuf->texture,
+ zsbuf->face,
+ zsbuf->level,
+ zsbuf->zslice);
+ scene->zsbuf_map = NULL;
+ }
util_unreference_framebuffer_state( &scene->fb );
}
@@ -505,6 +483,9 @@ void lp_scene_begin_binning( struct lp_scene *scene,
scene->tiles_x = align(fb->width, TILE_SIZE) / TILE_SIZE;
scene->tiles_y = align(fb->height, TILE_SIZE) / TILE_SIZE;
+
+ assert(scene->tiles_x <= TILES_X);
+ assert(scene->tiles_y <= TILES_Y);
}
diff --git a/src/gallium/drivers/llvmpipe/lp_scene.h b/src/gallium/drivers/llvmpipe/lp_scene.h
index 739ac22908..b602b1e8a0 100644
--- a/src/gallium/drivers/llvmpipe/lp_scene.h
+++ b/src/gallium/drivers/llvmpipe/lp_scene.h
@@ -114,8 +114,6 @@ struct texture_ref {
*/
struct lp_scene {
struct pipe_context *pipe;
- struct pipe_transfer *cbuf_transfer[PIPE_MAX_COLOR_BUFS];
- struct pipe_transfer *zsbuf_transfer;
/* Scene's buffers are mapped at the time the scene is enqueued:
*/
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
index f84ede675b..625d4092db 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -34,11 +34,13 @@
#include "lp_texture.h"
#include "lp_buffer.h"
#include "lp_fence.h"
-#include "lp_winsys.h"
#include "lp_jit.h"
#include "lp_screen.h"
#include "lp_context.h"
#include "lp_debug.h"
+#include "lp_public.h"
+
+#include "state_tracker/sw_winsys.h"
#ifdef DEBUG
int LP_DEBUG = 0;
@@ -107,11 +109,11 @@ llvmpipe_get_param(struct pipe_screen *screen, int param)
case PIPE_CAP_TEXTURE_SHADOW_MAP:
return 1;
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
- return 13; /* max 4Kx4K */
+ return LP_MAX_TEXTURE_2D_LEVELS;
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
- return 9; /* max 256x256x256 */
+ return LP_MAX_TEXTURE_3D_LEVELS;
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
- return 13; /* max 4Kx4K */
+ return LP_MAX_TEXTURE_2D_LEVELS;
case PIPE_CAP_TGSI_CONT_SUPPORTED:
return 1;
case PIPE_CAP_BLEND_EQUATION_SEPARATE:
@@ -167,7 +169,7 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen,
unsigned geom_flags )
{
struct llvmpipe_screen *screen = llvmpipe_screen(_screen);
- struct llvmpipe_winsys *winsys = screen->winsys;
+ struct sw_winsys *winsys = screen->winsys;
const struct util_format_description *format_desc;
format_desc = util_format_description(format);
@@ -189,21 +191,23 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen,
break;
}
- if(tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET) {
- if(format_desc->block.width != 1 ||
- format_desc->block.height != 1)
- return FALSE;
+ if(format_desc->block.width != 1 ||
+ format_desc->block.height != 1)
+ return FALSE;
- if(format_desc->layout != UTIL_FORMAT_LAYOUT_PLAIN)
- return FALSE;
+ if(format_desc->layout != UTIL_FORMAT_LAYOUT_PLAIN)
+ return FALSE;
+ if(tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET) {
if(format_desc->colorspace != UTIL_FORMAT_COLORSPACE_RGB &&
format_desc->colorspace != UTIL_FORMAT_COLORSPACE_SRGB)
return FALSE;
}
- if(tex_usage & PIPE_TEXTURE_USAGE_DISPLAY_TARGET) {
- if(!winsys->is_displaytarget_format_supported(winsys, format))
+ if(tex_usage & (PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
+ PIPE_TEXTURE_USAGE_SCANOUT |
+ PIPE_TEXTURE_USAGE_SHARED)) {
+ if(!winsys->is_displaytarget_format_supported(winsys, tex_usage, format))
return FALSE;
}
@@ -218,38 +222,19 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen,
/* FIXME: Temporary restrictions. See lp_bld_sample_soa.c */
if(tex_usage & PIPE_TEXTURE_USAGE_SAMPLER) {
- if(format_desc->block.width != 1 ||
- format_desc->block.height != 1)
- return FALSE;
-
- if(format_desc->layout != UTIL_FORMAT_LAYOUT_PLAIN)
+ if(!format_desc->is_bitmask &&
+ format != PIPE_FORMAT_R32_FLOAT)
return FALSE;
if(format_desc->colorspace != UTIL_FORMAT_COLORSPACE_RGB &&
format_desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS)
return FALSE;
-
- /* not supported yet */
- if (format == PIPE_FORMAT_Z16_UNORM)
- return FALSE;
}
return TRUE;
}
-static struct pipe_buffer *
-llvmpipe_surface_buffer_create(struct pipe_screen *screen,
- unsigned width, unsigned height,
- enum pipe_format format,
- unsigned tex_usage,
- unsigned usage,
- unsigned *stride)
-{
- /* This function should never be used */
- assert(0);
- return NULL;
-}
static void
@@ -258,7 +243,7 @@ llvmpipe_flush_frontbuffer(struct pipe_screen *_screen,
void *context_private)
{
struct llvmpipe_screen *screen = llvmpipe_screen(_screen);
- struct llvmpipe_winsys *winsys = screen->winsys;
+ struct sw_winsys *winsys = screen->winsys;
struct llvmpipe_texture *texture = llvmpipe_texture(surface->texture);
assert(texture->dt);
@@ -271,7 +256,7 @@ static void
llvmpipe_destroy_screen( struct pipe_screen *_screen )
{
struct llvmpipe_screen *screen = llvmpipe_screen(_screen);
- struct llvmpipe_winsys *winsys = screen->winsys;
+ struct sw_winsys *winsys = screen->winsys;
lp_jit_screen_cleanup(screen);
@@ -288,7 +273,7 @@ llvmpipe_destroy_screen( struct pipe_screen *_screen )
* Note: we're not presently subclassing pipe_screen (no llvmpipe_screen).
*/
struct pipe_screen *
-llvmpipe_create_screen(struct llvmpipe_winsys *winsys)
+llvmpipe_create_screen(struct sw_winsys *winsys)
{
struct llvmpipe_screen *screen = CALLOC_STRUCT(llvmpipe_screen);
@@ -309,7 +294,6 @@ llvmpipe_create_screen(struct llvmpipe_winsys *winsys)
screen->base.get_paramf = llvmpipe_get_paramf;
screen->base.is_format_supported = llvmpipe_is_format_supported;
- screen->base.surface_buffer_create = llvmpipe_surface_buffer_create;
screen->base.context_create = llvmpipe_create_context;
screen->base.flush_frontbuffer = llvmpipe_flush_frontbuffer;
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.h b/src/gallium/drivers/llvmpipe/lp_screen.h
index 4a1b4d6f3e..af25e043cc 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.h
+++ b/src/gallium/drivers/llvmpipe/lp_screen.h
@@ -34,23 +34,21 @@
#ifndef LP_SCREEN_H
#define LP_SCREEN_H
-#include <llvm-c/Core.h>
-#include <llvm-c/Analysis.h>
-#include <llvm-c/Target.h>
+#include "gallivm/lp_bld.h"
#include <llvm-c/ExecutionEngine.h>
#include "pipe/p_screen.h"
#include "pipe/p_defines.h"
-struct llvmpipe_winsys;
+struct sw_winsys;
struct llvmpipe_screen
{
struct pipe_screen base;
- struct llvmpipe_winsys *winsys;
+ struct sw_winsys *winsys;
LLVMModuleRef module;
LLVMExecutionEngineRef engine;
@@ -76,4 +74,5 @@ llvmpipe_screen( struct pipe_screen *pipe )
}
+
#endif /* LP_SCREEN_H */
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index b0713c3b71..76a8b87a30 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -46,17 +46,17 @@
#include "lp_rast.h"
#include "lp_setup_context.h"
#include "lp_screen.h"
-#include "lp_winsys.h"
+#include "state_tracker/sw_winsys.h"
#include "draw/draw_context.h"
#include "draw/draw_vbuf.h"
-static void set_scene_state( struct setup_context *, unsigned );
+static void set_scene_state( struct lp_setup_context *, unsigned );
struct lp_scene *
-lp_setup_get_current_scene(struct setup_context *setup)
+lp_setup_get_current_scene(struct lp_setup_context *setup)
{
if (!setup->scene) {
@@ -74,7 +74,7 @@ lp_setup_get_current_scene(struct setup_context *setup)
static void
-first_triangle( struct setup_context *setup,
+first_triangle( struct lp_setup_context *setup,
const float (*v0)[4],
const float (*v1)[4],
const float (*v2)[4])
@@ -85,7 +85,7 @@ first_triangle( struct setup_context *setup,
}
static void
-first_line( struct setup_context *setup,
+first_line( struct lp_setup_context *setup,
const float (*v0)[4],
const float (*v1)[4])
{
@@ -95,7 +95,7 @@ first_line( struct setup_context *setup,
}
static void
-first_point( struct setup_context *setup,
+first_point( struct lp_setup_context *setup,
const float (*v0)[4])
{
set_scene_state( setup, SETUP_ACTIVE );
@@ -103,7 +103,7 @@ first_point( struct setup_context *setup,
setup->point( setup, v0 );
}
-static void reset_context( struct setup_context *setup )
+static void reset_context( struct lp_setup_context *setup )
{
LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
@@ -131,7 +131,7 @@ static void reset_context( struct setup_context *setup )
/** Rasterize all scene's bins */
static void
-lp_setup_rasterize_scene( struct setup_context *setup,
+lp_setup_rasterize_scene( struct lp_setup_context *setup,
boolean write_depth )
{
struct lp_scene *scene = lp_setup_get_current_scene(setup);
@@ -148,7 +148,7 @@ lp_setup_rasterize_scene( struct setup_context *setup,
static void
-begin_binning( struct setup_context *setup )
+begin_binning( struct lp_setup_context *setup )
{
struct lp_scene *scene = lp_setup_get_current_scene(setup);
@@ -184,7 +184,7 @@ begin_binning( struct setup_context *setup )
* TODO: fast path for fullscreen clears and no triangles.
*/
static void
-execute_clears( struct setup_context *setup )
+execute_clears( struct lp_setup_context *setup )
{
LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
@@ -194,7 +194,7 @@ execute_clears( struct setup_context *setup )
static void
-set_scene_state( struct setup_context *setup,
+set_scene_state( struct lp_setup_context *setup,
unsigned new_state )
{
unsigned old_state = setup->state;
@@ -229,7 +229,7 @@ set_scene_state( struct setup_context *setup,
void
-lp_setup_flush( struct setup_context *setup,
+lp_setup_flush( struct lp_setup_context *setup,
unsigned flags )
{
LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
@@ -239,7 +239,7 @@ lp_setup_flush( struct setup_context *setup,
void
-lp_setup_bind_framebuffer( struct setup_context *setup,
+lp_setup_bind_framebuffer( struct lp_setup_context *setup,
const struct pipe_framebuffer_state *fb )
{
LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
@@ -256,7 +256,7 @@ lp_setup_bind_framebuffer( struct setup_context *setup,
void
-lp_setup_clear( struct setup_context *setup,
+lp_setup_clear( struct lp_setup_context *setup,
const float *color,
double depth,
unsigned stencil,
@@ -314,7 +314,7 @@ lp_setup_clear( struct setup_context *setup,
* Emit a fence.
*/
struct pipe_fence_handle *
-lp_setup_fence( struct setup_context *setup )
+lp_setup_fence( struct lp_setup_context *setup )
{
struct lp_scene *scene = lp_setup_get_current_scene(setup);
const unsigned rank = lp_scene_get_num_bins( scene ); /* xxx */
@@ -334,10 +334,11 @@ lp_setup_fence( struct setup_context *setup )
void
-lp_setup_set_triangle_state( struct setup_context *setup,
+lp_setup_set_triangle_state( struct lp_setup_context *setup,
unsigned cull_mode,
boolean ccw_is_frontface,
- boolean scissor )
+ boolean scissor,
+ boolean gl_rasterization_rules)
{
LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
@@ -345,12 +346,13 @@ lp_setup_set_triangle_state( struct setup_context *setup,
setup->cullmode = cull_mode;
setup->triangle = first_triangle;
setup->scissor_test = scissor;
+ setup->pixel_offset = gl_rasterization_rules ? 0.5f : 0.0f;
}
void
-lp_setup_set_fs_inputs( struct setup_context *setup,
+lp_setup_set_fs_inputs( struct lp_setup_context *setup,
const struct lp_shader_input *input,
unsigned nr )
{
@@ -361,7 +363,7 @@ lp_setup_set_fs_inputs( struct setup_context *setup,
}
void
-lp_setup_set_fs_functions( struct setup_context *setup,
+lp_setup_set_fs_functions( struct lp_setup_context *setup,
lp_jit_frag_func jit_function0,
lp_jit_frag_func jit_function1,
boolean opaque )
@@ -376,7 +378,7 @@ lp_setup_set_fs_functions( struct setup_context *setup,
}
void
-lp_setup_set_fs_constants(struct setup_context *setup,
+lp_setup_set_fs_constants(struct lp_setup_context *setup,
struct pipe_buffer *buffer)
{
LP_DBG(DEBUG_SETUP, "%s %p\n", __FUNCTION__, (void *) buffer);
@@ -388,7 +390,7 @@ lp_setup_set_fs_constants(struct setup_context *setup,
void
-lp_setup_set_alpha_ref_value( struct setup_context *setup,
+lp_setup_set_alpha_ref_value( struct lp_setup_context *setup,
float alpha_ref_value )
{
LP_DBG(DEBUG_SETUP, "%s %f\n", __FUNCTION__, alpha_ref_value);
@@ -400,7 +402,21 @@ lp_setup_set_alpha_ref_value( struct setup_context *setup,
}
void
-lp_setup_set_blend_color( struct setup_context *setup,
+lp_setup_set_stencil_ref_values( struct lp_setup_context *setup,
+ const ubyte refs[2] )
+{
+ LP_DBG(DEBUG_SETUP, "%s %d %d\n", __FUNCTION__, refs[0], refs[1]);
+
+ if (setup->fs.current.jit_context.stencil_ref_front != refs[0] ||
+ setup->fs.current.jit_context.stencil_ref_back != refs[1]) {
+ setup->fs.current.jit_context.stencil_ref_front = refs[0];
+ setup->fs.current.jit_context.stencil_ref_back = refs[1];
+ setup->dirty |= LP_SETUP_NEW_FS;
+ }
+}
+
+void
+lp_setup_set_blend_color( struct lp_setup_context *setup,
const struct pipe_blend_color *blend_color )
{
LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
@@ -415,7 +431,7 @@ lp_setup_set_blend_color( struct setup_context *setup,
void
-lp_setup_set_scissor( struct setup_context *setup,
+lp_setup_set_scissor( struct lp_setup_context *setup,
const struct pipe_scissor_state *scissor )
{
LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
@@ -430,7 +446,7 @@ lp_setup_set_scissor( struct setup_context *setup,
void
-lp_setup_set_flatshade_first( struct setup_context *setup,
+lp_setup_set_flatshade_first( struct lp_setup_context *setup,
boolean flatshade_first )
{
setup->flatshade_first = flatshade_first;
@@ -438,7 +454,7 @@ lp_setup_set_flatshade_first( struct setup_context *setup,
void
-lp_setup_set_vertex_info( struct setup_context *setup,
+lp_setup_set_vertex_info( struct lp_setup_context *setup,
struct vertex_info *vertex_info )
{
/* XXX: just silently holding onto the pointer:
@@ -448,11 +464,12 @@ lp_setup_set_vertex_info( struct setup_context *setup,
/**
- * Called during state validation when LP_NEW_TEXTURE is set.
+ * Called during state validation when LP_NEW_SAMPLER_VIEW is set.
*/
void
-lp_setup_set_sampler_textures( struct setup_context *setup,
- unsigned num, struct pipe_texture **texture)
+lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup,
+ unsigned num,
+ struct pipe_sampler_view **views)
{
unsigned i;
@@ -461,9 +478,10 @@ lp_setup_set_sampler_textures( struct setup_context *setup,
assert(num <= PIPE_MAX_SAMPLERS);
for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
- struct pipe_texture *tex = i < num ? texture[i] : NULL;
+ struct pipe_sampler_view *view = i < num ? views[i] : NULL;
- if(tex) {
+ if(view) {
+ struct pipe_texture *tex = view->texture;
struct llvmpipe_texture *lp_tex = llvmpipe_texture(tex);
struct lp_jit_texture *jit_tex;
jit_tex = &setup->fs.current.jit_context.textures[i];
@@ -471,26 +489,33 @@ lp_setup_set_sampler_textures( struct setup_context *setup,
jit_tex->height = tex->height0;
jit_tex->depth = tex->depth0;
jit_tex->last_level = tex->last_level;
- jit_tex->stride = lp_tex->stride[0];
- if(!lp_tex->dt) {
- jit_tex->data = lp_tex->data;
+
+ /* We're referencing the texture's internal data, so save a
+ * reference to it.
+ */
+ pipe_texture_reference(&setup->fs.current_tex[i], tex);
+
+ if (!lp_tex->dt) {
+ /* regular texture - setup array of mipmap level pointers */
+ int j;
+ for (j = 0; j <= tex->last_level; j++) {
+ jit_tex->data[j] =
+ (ubyte *) lp_tex->data + lp_tex->level_offset[j];
+ jit_tex->row_stride[j] = lp_tex->stride[j];
+ }
}
else {
+ /* display target texture/surface */
/*
* XXX: Where should this be unmapped?
*/
struct llvmpipe_screen *screen = llvmpipe_screen(tex->screen);
- struct llvmpipe_winsys *winsys = screen->winsys;
- jit_tex->data = winsys->displaytarget_map(winsys, lp_tex->dt,
+ struct sw_winsys *winsys = screen->winsys;
+ jit_tex->data[0] = winsys->displaytarget_map(winsys, lp_tex->dt,
PIPE_BUFFER_USAGE_CPU_READ);
- assert(jit_tex->data);
- }
-
- /* the scene references this texture */
- {
- struct lp_scene *scene = lp_setup_get_current_scene(setup);
- lp_scene_texture_reference(scene, tex);
+ jit_tex->row_stride[0] = lp_tex->stride[0];
+ assert(jit_tex->data[0]);
}
}
}
@@ -505,7 +530,7 @@ lp_setup_set_sampler_textures( struct setup_context *setup,
* being rendered and the current scene being built.
*/
unsigned
-lp_setup_is_texture_referenced( const struct setup_context *setup,
+lp_setup_is_texture_referenced( const struct lp_setup_context *setup,
const struct pipe_texture *texture )
{
unsigned i;
@@ -534,7 +559,7 @@ lp_setup_is_texture_referenced( const struct setup_context *setup,
* Called by vbuf code when we're about to draw something.
*/
void
-lp_setup_update_state( struct setup_context *setup )
+lp_setup_update_state( struct lp_setup_context *setup )
{
struct lp_scene *scene = lp_setup_get_current_scene(setup);
@@ -626,6 +651,7 @@ lp_setup_update_state( struct setup_context *setup )
* the new, current state. So allocate a new lp_rast_state object
* and append it to the bin's setup data buffer.
*/
+ uint i;
struct lp_rast_state *stored =
(struct lp_rast_state *) lp_scene_alloc(scene, sizeof *stored);
if(stored) {
@@ -639,6 +665,14 @@ lp_setup_update_state( struct setup_context *setup )
lp_rast_set_state,
lp_rast_arg_state(setup->fs.stored) );
}
+
+ /* The scene now references the textures in the rasterization
+ * state record. Note that now.
+ */
+ for (i = 0; i < Elements(setup->fs.current_tex); i++) {
+ if (setup->fs.current_tex[i])
+ lp_scene_texture_reference(scene, setup->fs.current_tex[i]);
+ }
}
}
@@ -652,10 +686,16 @@ lp_setup_update_state( struct setup_context *setup )
/* Only caller is lp_setup_vbuf_destroy()
*/
void
-lp_setup_destroy( struct setup_context *setup )
+lp_setup_destroy( struct lp_setup_context *setup )
{
+ uint i;
+
reset_context( setup );
+ for (i = 0; i < Elements(setup->fs.current_tex); i++) {
+ pipe_texture_reference(&setup->fs.current_tex[i], NULL);
+ }
+
pipe_buffer_reference(&setup->constants.current, NULL);
/* free the scenes in the 'empty' queue */
@@ -677,12 +717,12 @@ lp_setup_destroy( struct setup_context *setup )
* the draw module. Currently also creates a rasterizer to use with
* it.
*/
-struct setup_context *
+struct lp_setup_context *
lp_setup_create( struct pipe_context *pipe,
struct draw_context *draw )
{
unsigned i;
- struct setup_context *setup = CALLOC_STRUCT(setup_context);
+ struct lp_setup_context *setup = CALLOC_STRUCT(lp_setup_context);
if (!setup)
return NULL;
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.h b/src/gallium/drivers/llvmpipe/lp_setup.h
index 17c112b528..dbfc1bf8d4 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.h
+++ b/src/gallium/drivers/llvmpipe/lp_setup.h
@@ -61,78 +61,84 @@ struct pipe_framebuffer_state;
struct lp_fragment_shader;
struct lp_jit_context;
-struct setup_context *
+struct lp_setup_context *
lp_setup_create( struct pipe_context *pipe,
struct draw_context *draw );
void
-lp_setup_clear(struct setup_context *setup,
+lp_setup_clear(struct lp_setup_context *setup,
const float *clear_color,
double clear_depth,
unsigned clear_stencil,
unsigned flags);
struct pipe_fence_handle *
-lp_setup_fence( struct setup_context *setup );
+lp_setup_fence( struct lp_setup_context *setup );
void
-lp_setup_flush( struct setup_context *setup,
+lp_setup_flush( struct lp_setup_context *setup,
unsigned flags );
void
-lp_setup_bind_framebuffer( struct setup_context *setup,
+lp_setup_bind_framebuffer( struct lp_setup_context *setup,
const struct pipe_framebuffer_state *fb );
void
-lp_setup_set_triangle_state( struct setup_context *setup,
+lp_setup_set_triangle_state( struct lp_setup_context *setup,
unsigned cullmode,
boolean front_is_ccw,
- boolean scissor );
+ boolean scissor,
+ boolean gl_rasterization_rules );
void
-lp_setup_set_fs_inputs( struct setup_context *setup,
+lp_setup_set_fs_inputs( struct lp_setup_context *setup,
const struct lp_shader_input *interp,
unsigned nr );
void
-lp_setup_set_fs_functions( struct setup_context *setup,
+lp_setup_set_fs_functions( struct lp_setup_context *setup,
lp_jit_frag_func jit_function0,
lp_jit_frag_func jit_function1,
boolean opaque );
void
-lp_setup_set_fs_constants(struct setup_context *setup,
+lp_setup_set_fs_constants(struct lp_setup_context *setup,
struct pipe_buffer *buffer);
void
-lp_setup_set_alpha_ref_value( struct setup_context *setup,
+lp_setup_set_alpha_ref_value( struct lp_setup_context *setup,
float alpha_ref_value );
void
-lp_setup_set_blend_color( struct setup_context *setup,
+lp_setup_set_stencil_ref_values( struct lp_setup_context *setup,
+ const ubyte refs[2] );
+
+void
+lp_setup_set_blend_color( struct lp_setup_context *setup,
const struct pipe_blend_color *blend_color );
void
-lp_setup_set_scissor( struct setup_context *setup,
+lp_setup_set_scissor( struct lp_setup_context *setup,
const struct pipe_scissor_state *scissor );
void
-lp_setup_set_sampler_textures( struct setup_context *setup,
- unsigned num, struct pipe_texture **texture);
+lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup,
+ unsigned num,
+ struct pipe_sampler_view **views);
unsigned
-lp_setup_is_texture_referenced( const struct setup_context *setup,
+lp_setup_is_texture_referenced( const struct lp_setup_context *setup,
const struct pipe_texture *texture );
void
-lp_setup_set_flatshade_first( struct setup_context *setup,
+lp_setup_set_flatshade_first( struct lp_setup_context *setup,
boolean flatshade_first );
void
-lp_setup_set_vertex_info( struct setup_context *setup,
+lp_setup_set_vertex_info( struct lp_setup_context *setup,
struct vertex_info *info );
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_context.h b/src/gallium/drivers/llvmpipe/lp_setup_context.h
index a5fc34e54a..ca0dafab62 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_context.h
+++ b/src/gallium/drivers/llvmpipe/lp_setup_context.h
@@ -65,7 +65,7 @@ struct lp_scene_queue;
* Subclass of vbuf_render, plugged directly into the draw module as
* the rendering backend.
*/
-struct setup_context
+struct lp_setup_context
{
struct vbuf_render base;
@@ -89,6 +89,7 @@ struct setup_context
boolean ccw_is_frontface;
boolean scissor_test;
unsigned cullmode;
+ float pixel_offset;
struct pipe_framebuffer_state fb;
@@ -110,6 +111,7 @@ struct setup_context
const struct lp_rast_state *stored; /**< what's in the scene */
struct lp_rast_state current; /**< currently set state */
+ struct pipe_texture *current_tex[PIPE_MAX_SAMPLERS];
} fs;
/** fragment shader constants */
@@ -131,29 +133,29 @@ struct setup_context
unsigned dirty; /**< bitmask of LP_SETUP_NEW_x bits */
- void (*point)( struct setup_context *,
+ void (*point)( struct lp_setup_context *,
const float (*v0)[4]);
- void (*line)( struct setup_context *,
+ void (*line)( struct lp_setup_context *,
const float (*v0)[4],
const float (*v1)[4]);
- void (*triangle)( struct setup_context *,
+ void (*triangle)( struct lp_setup_context *,
const float (*v0)[4],
const float (*v1)[4],
const float (*v2)[4]);
};
-void lp_setup_choose_triangle( struct setup_context *setup );
-void lp_setup_choose_line( struct setup_context *setup );
-void lp_setup_choose_point( struct setup_context *setup );
+void lp_setup_choose_triangle( struct lp_setup_context *setup );
+void lp_setup_choose_line( struct lp_setup_context *setup );
+void lp_setup_choose_point( struct lp_setup_context *setup );
-struct lp_scene *lp_setup_get_current_scene(struct setup_context *setup);
+struct lp_scene *lp_setup_get_current_scene(struct lp_setup_context *setup);
-void lp_setup_init_vbuf(struct setup_context *setup);
+void lp_setup_init_vbuf(struct lp_setup_context *setup);
-void lp_setup_update_state( struct setup_context *setup );
+void lp_setup_update_state( struct lp_setup_context *setup );
-void lp_setup_destroy( struct setup_context *setup );
+void lp_setup_destroy( struct lp_setup_context *setup );
#endif
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_line.c b/src/gallium/drivers/llvmpipe/lp_setup_line.c
index feea79d394..be41c44e6f 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_line.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_line.c
@@ -31,7 +31,7 @@
#include "lp_setup_context.h"
-static void line_nop( struct setup_context *setup,
+static void line_nop( struct lp_setup_context *setup,
const float (*v0)[4],
const float (*v1)[4] )
{
@@ -39,7 +39,7 @@ static void line_nop( struct setup_context *setup,
void
-lp_setup_choose_line( struct setup_context *setup )
+lp_setup_choose_line( struct lp_setup_context *setup )
{
setup->line = line_nop;
}
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c
index f03ca729b2..9f69e6c5ce 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_point.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c
@@ -31,14 +31,14 @@
#include "lp_setup_context.h"
-static void point_nop( struct setup_context *setup,
+static void point_nop( struct lp_setup_context *setup,
const float (*v0)[4] )
{
}
void
-lp_setup_choose_point( struct setup_context *setup )
+lp_setup_choose_point( struct lp_setup_context *setup )
{
setup->point = point_nop;
}
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
index e75412ac9a..ce689d3d56 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
@@ -41,7 +41,8 @@
/**
* Compute a0 for a constant-valued coefficient (GL_FLAT shading).
*/
-static void constant_coef( struct lp_rast_triangle *tri,
+static void constant_coef( struct lp_setup_context *setup,
+ struct lp_rast_triangle *tri,
unsigned slot,
const float value,
unsigned i )
@@ -56,7 +57,8 @@ static void constant_coef( struct lp_rast_triangle *tri,
* Compute a0, dadx and dady for a linearly interpolated coefficient,
* for a triangle.
*/
-static void linear_coef( struct lp_rast_triangle *tri,
+static void linear_coef( struct lp_setup_context *setup,
+ struct lp_rast_triangle *tri,
float oneoverarea,
unsigned slot,
const float (*v1)[4],
@@ -90,8 +92,8 @@ static void linear_coef( struct lp_rast_triangle *tri,
* instead - i'll switch to this later.
*/
tri->inputs.a0[slot][i] = (a1 -
- (dadx * (v1[0][0] - 0.5f) +
- dady * (v1[0][1] - 0.5f)));
+ (dadx * (v1[0][0] - setup->pixel_offset) +
+ dady * (v1[0][1] - setup->pixel_offset)));
}
@@ -103,7 +105,8 @@ static void linear_coef( struct lp_rast_triangle *tri,
* Later, when we compute the value at a particular fragment position we'll
* divide the interpolated value by the interpolated W at that fragment.
*/
-static void perspective_coef( struct lp_rast_triangle *tri,
+static void perspective_coef( struct lp_setup_context *setup,
+ struct lp_rast_triangle *tri,
float oneoverarea,
unsigned slot,
const float (*v1)[4],
@@ -125,8 +128,8 @@ static void perspective_coef( struct lp_rast_triangle *tri,
tri->inputs.dadx[slot][i] = dadx;
tri->inputs.dady[slot][i] = dady;
tri->inputs.a0[slot][i] = (a1 -
- (dadx * (v1[0][0] - 0.5f) +
- dady * (v1[0][1] - 0.5f)));
+ (dadx * (v1[0][0] - setup->pixel_offset) +
+ dady * (v1[0][1] - setup->pixel_offset)));
}
@@ -137,7 +140,8 @@ static void perspective_coef( struct lp_rast_triangle *tri,
* We could do a bit less work if we'd examine gl_FragCoord's swizzle mask.
*/
static void
-setup_fragcoord_coef(struct lp_rast_triangle *tri,
+setup_fragcoord_coef(struct lp_setup_context *setup,
+ struct lp_rast_triangle *tri,
float oneoverarea,
unsigned slot,
const float (*v1)[4],
@@ -153,27 +157,28 @@ setup_fragcoord_coef(struct lp_rast_triangle *tri,
tri->inputs.dadx[slot][1] = 0.0;
tri->inputs.dady[slot][1] = 1.0;
/*Z*/
- linear_coef(tri, oneoverarea, slot, v1, v2, v3, 0, 2);
+ linear_coef(setup, tri, oneoverarea, slot, v1, v2, v3, 0, 2);
/*W*/
- linear_coef(tri, oneoverarea, slot, v1, v2, v3, 0, 3);
+ linear_coef(setup, tri, oneoverarea, slot, v1, v2, v3, 0, 3);
}
-static void setup_facing_coef( struct lp_rast_triangle *tri,
+static void setup_facing_coef( struct lp_setup_context *setup,
+ struct lp_rast_triangle *tri,
unsigned slot,
boolean frontface )
{
- constant_coef( tri, slot, 1.0f - frontface, 0 );
- constant_coef( tri, slot, 0.0f, 1 ); /* wasted */
- constant_coef( tri, slot, 0.0f, 2 ); /* wasted */
- constant_coef( tri, slot, 0.0f, 3 ); /* wasted */
+ constant_coef( setup, tri, slot, 1.0f - frontface, 0 );
+ constant_coef( setup, tri, slot, 0.0f, 1 ); /* wasted */
+ constant_coef( setup, tri, slot, 0.0f, 2 ); /* wasted */
+ constant_coef( setup, tri, slot, 0.0f, 3 ); /* wasted */
}
/**
* Compute the tri->coef[] array dadx, dady, a0 values.
*/
-static void setup_tri_coefficients( struct setup_context *setup,
+static void setup_tri_coefficients( struct lp_setup_context *setup,
struct lp_rast_triangle *tri,
float oneoverarea,
const float (*v1)[4],
@@ -185,7 +190,7 @@ static void setup_tri_coefficients( struct setup_context *setup,
/* The internal position input is in slot zero:
*/
- setup_fragcoord_coef(tri, oneoverarea, 0, v1, v2, v3);
+ setup_fragcoord_coef(setup, tri, oneoverarea, 0, v1, v2, v3);
/* setup interpolation for all the remaining attributes:
*/
@@ -196,27 +201,27 @@ static void setup_tri_coefficients( struct setup_context *setup,
switch (setup->fs.input[slot].interp) {
case LP_INTERP_CONSTANT:
for (i = 0; i < NUM_CHANNELS; i++)
- constant_coef(tri, slot+1, v3[vert_attr][i], i);
+ constant_coef(setup, tri, slot+1, v3[vert_attr][i], i);
break;
case LP_INTERP_LINEAR:
for (i = 0; i < NUM_CHANNELS; i++)
- linear_coef(tri, oneoverarea, slot+1, v1, v2, v3, vert_attr, i);
+ linear_coef(setup, tri, oneoverarea, slot+1, v1, v2, v3, vert_attr, i);
break;
case LP_INTERP_PERSPECTIVE:
for (i = 0; i < NUM_CHANNELS; i++)
- perspective_coef(tri, oneoverarea, slot+1, v1, v2, v3, vert_attr, i);
+ perspective_coef(setup, tri, oneoverarea, slot+1, v1, v2, v3, vert_attr, i);
break;
case LP_INTERP_POSITION:
/* XXX: fix me - duplicates the values in slot zero.
*/
- setup_fragcoord_coef(tri, oneoverarea, slot+1, v1, v2, v3);
+ setup_fragcoord_coef(setup, tri, oneoverarea, slot+1, v1, v2, v3);
break;
case LP_INTERP_FACING:
- setup_facing_coef(tri, slot+1, frontface);
+ setup_facing_coef(setup, tri, slot+1, frontface);
break;
default:
@@ -274,19 +279,19 @@ alloc_triangle(struct lp_scene *scene, unsigned nr_inputs, unsigned *tri_size)
* bins for the tiles which we overlap.
*/
static void
-do_triangle_ccw(struct setup_context *setup,
+do_triangle_ccw(struct lp_setup_context *setup,
const float (*v1)[4],
const float (*v2)[4],
const float (*v3)[4],
boolean frontfacing )
{
/* x/y positions in fixed point */
- const int x1 = subpixel_snap(v1[0][0]);
- const int x2 = subpixel_snap(v2[0][0]);
- const int x3 = subpixel_snap(v3[0][0]);
- const int y1 = subpixel_snap(v1[0][1]);
- const int y2 = subpixel_snap(v2[0][1]);
- const int y3 = subpixel_snap(v3[0][1]);
+ const int x1 = subpixel_snap(v1[0][0] + 0.5 - setup->pixel_offset);
+ const int x2 = subpixel_snap(v2[0][0] + 0.5 - setup->pixel_offset);
+ const int x3 = subpixel_snap(v3[0][0] + 0.5 - setup->pixel_offset);
+ const int y1 = subpixel_snap(v1[0][1] + 0.5 - setup->pixel_offset);
+ const int y2 = subpixel_snap(v2[0][1] + 0.5 - setup->pixel_offset);
+ const int y3 = subpixel_snap(v3[0][1] + 0.5 - setup->pixel_offset);
struct lp_scene *scene = lp_setup_get_current_scene(setup);
struct lp_rast_triangle *tri;
@@ -356,6 +361,8 @@ do_triangle_ccw(struct setup_context *setup,
*/
setup_tri_coefficients( setup, tri, oneoverarea, v1, v2, v3, frontfacing );
+ tri->inputs.facing = frontfacing ? 1.0F : -1.0F;
+
/* half-edge constants, will be interated over the whole render target.
*/
tri->c1 = tri->dy12 * x1 - tri->dx12 * y1;
@@ -565,7 +572,7 @@ do_triangle_ccw(struct setup_context *setup,
}
-static void triangle_cw( struct setup_context *setup,
+static void triangle_cw( struct lp_setup_context *setup,
const float (*v0)[4],
const float (*v1)[4],
const float (*v2)[4] )
@@ -574,7 +581,7 @@ static void triangle_cw( struct setup_context *setup,
}
-static void triangle_ccw( struct setup_context *setup,
+static void triangle_ccw( struct lp_setup_context *setup,
const float (*v0)[4],
const float (*v1)[4],
const float (*v2)[4] )
@@ -583,7 +590,7 @@ static void triangle_ccw( struct setup_context *setup,
}
-static void triangle_both( struct setup_context *setup,
+static void triangle_both( struct lp_setup_context *setup,
const float (*v0)[4],
const float (*v1)[4],
const float (*v2)[4] )
@@ -602,7 +609,7 @@ static void triangle_both( struct setup_context *setup,
}
-static void triangle_nop( struct setup_context *setup,
+static void triangle_nop( struct lp_setup_context *setup,
const float (*v0)[4],
const float (*v1)[4],
const float (*v2)[4] )
@@ -611,7 +618,7 @@ static void triangle_nop( struct setup_context *setup,
void
-lp_setup_choose_triangle( struct setup_context *setup )
+lp_setup_choose_triangle( struct lp_setup_context *setup )
{
switch (setup->cullmode) {
case PIPE_WINDING_NONE:
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c b/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c
index 24291da91e..d7336d82b2 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c
@@ -48,10 +48,10 @@
/** cast wrapper */
-static struct setup_context *
-setup_context(struct vbuf_render *vbr)
+static struct lp_setup_context *
+lp_setup_context(struct vbuf_render *vbr)
{
- return (struct setup_context *) vbr;
+ return (struct lp_setup_context *) vbr;
}
@@ -59,7 +59,7 @@ setup_context(struct vbuf_render *vbr)
static const struct vertex_info *
lp_setup_get_vertex_info(struct vbuf_render *vbr)
{
- struct setup_context *setup = setup_context(vbr);
+ struct lp_setup_context *setup = lp_setup_context(vbr);
return setup->vertex_info;
}
@@ -68,7 +68,7 @@ static boolean
lp_setup_allocate_vertices(struct vbuf_render *vbr,
ushort vertex_size, ushort nr_vertices)
{
- struct setup_context *setup = setup_context(vbr);
+ struct lp_setup_context *setup = lp_setup_context(vbr);
unsigned size = vertex_size * nr_vertices;
if (setup->vertex_buffer_size < size) {
@@ -92,7 +92,7 @@ lp_setup_release_vertices(struct vbuf_render *vbr)
static void *
lp_setup_map_vertices(struct vbuf_render *vbr)
{
- struct setup_context *setup = setup_context(vbr);
+ struct lp_setup_context *setup = lp_setup_context(vbr);
return setup->vertex_buffer;
}
@@ -101,7 +101,7 @@ lp_setup_unmap_vertices(struct vbuf_render *vbr,
ushort min_index,
ushort max_index )
{
- struct setup_context *setup = setup_context(vbr);
+ struct lp_setup_context *setup = lp_setup_context(vbr);
assert( setup->vertex_buffer_size >= (max_index+1) * setup->vertex_size );
/* do nothing */
}
@@ -110,7 +110,7 @@ lp_setup_unmap_vertices(struct vbuf_render *vbr,
static boolean
lp_setup_set_primitive(struct vbuf_render *vbr, unsigned prim)
{
- setup_context(vbr)->prim = prim;
+ lp_setup_context(vbr)->prim = prim;
return TRUE;
}
@@ -129,7 +129,7 @@ static INLINE const_float4_ptr get_vert( const void *vertex_buffer,
static void
lp_setup_draw(struct vbuf_render *vbr, const ushort *indices, uint nr)
{
- struct setup_context *setup = setup_context(vbr);
+ struct lp_setup_context *setup = lp_setup_context(vbr);
const unsigned stride = setup->vertex_info->size * sizeof(float);
const void *vertex_buffer = setup->vertex_buffer;
unsigned i;
@@ -231,57 +231,29 @@ lp_setup_draw(struct vbuf_render *vbr, const ushort *indices, uint nr)
break;
case PIPE_PRIM_QUADS:
- if (setup->flatshade_first) {
- for (i = 3; i < nr; i += 4) {
- setup->triangle( setup,
- get_vert(vertex_buffer, indices[i-2], stride),
- get_vert(vertex_buffer, indices[i-1], stride),
- get_vert(vertex_buffer, indices[i-3], stride) );
- setup->triangle( setup,
- get_vert(vertex_buffer, indices[i-1], stride),
- get_vert(vertex_buffer, indices[i-0], stride),
- get_vert(vertex_buffer, indices[i-3], stride) );
- }
- }
- else {
- for (i = 3; i < nr; i += 4) {
- setup->triangle( setup,
- get_vert(vertex_buffer, indices[i-3], stride),
- get_vert(vertex_buffer, indices[i-2], stride),
- get_vert(vertex_buffer, indices[i-0], stride) );
+ for (i = 3; i < nr; i += 4) {
+ setup->triangle( setup,
+ get_vert(vertex_buffer, indices[i-3], stride),
+ get_vert(vertex_buffer, indices[i-2], stride),
+ get_vert(vertex_buffer, indices[i-0], stride) );
- setup->triangle( setup,
- get_vert(vertex_buffer, indices[i-2], stride),
- get_vert(vertex_buffer, indices[i-1], stride),
- get_vert(vertex_buffer, indices[i-0], stride) );
- }
+ setup->triangle( setup,
+ get_vert(vertex_buffer, indices[i-2], stride),
+ get_vert(vertex_buffer, indices[i-1], stride),
+ get_vert(vertex_buffer, indices[i-0], stride) );
}
break;
case PIPE_PRIM_QUAD_STRIP:
- if (setup->flatshade_first) {
- for (i = 3; i < nr; i += 2) {
- setup->triangle( setup,
- get_vert(vertex_buffer, indices[i-0], stride),
- get_vert(vertex_buffer, indices[i-1], stride),
- get_vert(vertex_buffer, indices[i-3], stride));
- setup->triangle( setup,
- get_vert(vertex_buffer, indices[i-2], stride),
- get_vert(vertex_buffer, indices[i-0], stride),
- get_vert(vertex_buffer, indices[i-3], stride) );
- }
- }
- else {
- for (i = 3; i < nr; i += 2) {
- setup->triangle( setup,
- get_vert(vertex_buffer, indices[i-3], stride),
- get_vert(vertex_buffer, indices[i-2], stride),
- get_vert(vertex_buffer, indices[i-0], stride) );
- setup->triangle( setup,
- get_vert(vertex_buffer, indices[i-1], stride),
- get_vert(vertex_buffer, indices[i-3], stride),
- get_vert(vertex_buffer, indices[i-0], stride) );
- }
+ for (i = 3; i < nr; i += 2) {
+ setup->triangle( setup,
+ get_vert(vertex_buffer, indices[i-3], stride),
+ get_vert(vertex_buffer, indices[i-2], stride),
+ get_vert(vertex_buffer, indices[i-0], stride) );
+ setup->triangle( setup,
+ get_vert(vertex_buffer, indices[i-1], stride),
+ get_vert(vertex_buffer, indices[i-3], stride),
+ get_vert(vertex_buffer, indices[i-0], stride) );
}
break;
@@ -312,7 +284,7 @@ lp_setup_draw(struct vbuf_render *vbr, const ushort *indices, uint nr)
static void
lp_setup_draw_arrays(struct vbuf_render *vbr, uint start, uint nr)
{
- struct setup_context *setup = setup_context(vbr);
+ struct lp_setup_context *setup = lp_setup_context(vbr);
const unsigned stride = setup->vertex_info->size * sizeof(float);
const void *vertex_buffer =
(void *) get_vert(setup->vertex_buffer, start, stride);
@@ -415,57 +387,28 @@ lp_setup_draw_arrays(struct vbuf_render *vbr, uint start, uint nr)
break;
case PIPE_PRIM_QUADS:
- if (setup->flatshade_first) {
- for (i = 3; i < nr; i += 4) {
- setup->triangle( setup,
- get_vert(vertex_buffer, i-2, stride),
- get_vert(vertex_buffer, i-1, stride),
- get_vert(vertex_buffer, i-3, stride) );
- setup->triangle( setup,
- get_vert(vertex_buffer, i-1, stride),
- get_vert(vertex_buffer, i-0, stride),
- get_vert(vertex_buffer, i-3, stride) );
- }
- }
- else {
- for (i = 3; i < nr; i += 4) {
- setup->triangle( setup,
- get_vert(vertex_buffer, i-3, stride),
- get_vert(vertex_buffer, i-2, stride),
- get_vert(vertex_buffer, i-0, stride) );
- setup->triangle( setup,
- get_vert(vertex_buffer, i-2, stride),
- get_vert(vertex_buffer, i-1, stride),
- get_vert(vertex_buffer, i-0, stride) );
- }
+ for (i = 3; i < nr; i += 4) {
+ setup->triangle( setup,
+ get_vert(vertex_buffer, i-3, stride),
+ get_vert(vertex_buffer, i-2, stride),
+ get_vert(vertex_buffer, i-0, stride) );
+ setup->triangle( setup,
+ get_vert(vertex_buffer, i-2, stride),
+ get_vert(vertex_buffer, i-1, stride),
+ get_vert(vertex_buffer, i-0, stride) );
}
break;
case PIPE_PRIM_QUAD_STRIP:
- if (setup->flatshade_first) {
- for (i = 3; i < nr; i += 2) {
- setup->triangle( setup,
- get_vert(vertex_buffer, i-0, stride),
- get_vert(vertex_buffer, i-1, stride),
- get_vert(vertex_buffer, i-3, stride) );
- setup->triangle( setup,
-
- get_vert(vertex_buffer, i-2, stride),
- get_vert(vertex_buffer, i-0, stride),
- get_vert(vertex_buffer, i-3, stride) );
- }
- }
- else {
- for (i = 3; i < nr; i += 2) {
- setup->triangle( setup,
- get_vert(vertex_buffer, i-3, stride),
- get_vert(vertex_buffer, i-2, stride),
- get_vert(vertex_buffer, i-0, stride) );
- setup->triangle( setup,
- get_vert(vertex_buffer, i-1, stride),
- get_vert(vertex_buffer, i-3, stride),
- get_vert(vertex_buffer, i-0, stride) );
- }
+ for (i = 3; i < nr; i += 2) {
+ setup->triangle( setup,
+ get_vert(vertex_buffer, i-3, stride),
+ get_vert(vertex_buffer, i-2, stride),
+ get_vert(vertex_buffer, i-0, stride) );
+ setup->triangle( setup,
+ get_vert(vertex_buffer, i-1, stride),
+ get_vert(vertex_buffer, i-3, stride),
+ get_vert(vertex_buffer, i-0, stride) );
}
break;
@@ -493,7 +436,7 @@ lp_setup_draw_arrays(struct vbuf_render *vbr, uint start, uint nr)
static void
lp_setup_vbuf_destroy(struct vbuf_render *vbr)
{
- lp_setup_destroy(setup_context(vbr));
+ lp_setup_destroy(lp_setup_context(vbr));
}
@@ -501,7 +444,7 @@ lp_setup_vbuf_destroy(struct vbuf_render *vbr)
* Create the post-transform vertex handler for the given context.
*/
void
-lp_setup_init_vbuf(struct setup_context *setup)
+lp_setup_init_vbuf(struct lp_setup_context *setup)
{
setup->base.max_indices = LP_MAX_VBUF_INDEXES;
setup->base.max_vertex_buffer_bytes = LP_MAX_VBUF_SIZE;
diff --git a/src/gallium/drivers/llvmpipe/lp_state.h b/src/gallium/drivers/llvmpipe/lp_state.h
index 9beba32271..74ebf90d58 100644
--- a/src/gallium/drivers/llvmpipe/lp_state.h
+++ b/src/gallium/drivers/llvmpipe/lp_state.h
@@ -31,7 +31,7 @@
#ifndef LP_STATE_H
#define LP_STATE_H
-#include <llvm-c/Core.h>
+#include "gallivm/lp_bld.h"
#include "pipe/p_state.h"
#include "tgsi/tgsi_scan.h"
@@ -50,7 +50,7 @@
#define LP_NEW_DEPTH_STENCIL_ALPHA 0x100
#define LP_NEW_CONSTANTS 0x200
#define LP_NEW_SAMPLER 0x400
-#define LP_NEW_TEXTURE 0x800
+#define LP_NEW_SAMPLER_VIEW 0x800
#define LP_NEW_VERTEX 0x1000
#define LP_NEW_VS 0x2000
#define LP_NEW_QUERY 0x4000
@@ -67,6 +67,7 @@ struct lp_fragment_shader;
struct lp_fragment_shader_variant_key
{
struct pipe_depth_state depth;
+ struct pipe_stencil_state stencil[2];
struct pipe_alpha_state alpha;
struct pipe_blend_state blend;
enum pipe_format zsbuf_format;
@@ -119,6 +120,10 @@ struct lp_vertex_shader {
struct draw_vertex_shader *draw_data;
};
+struct lp_velems_state {
+ unsigned count;
+ struct pipe_vertex_element velem[PIPE_MAX_ATTRIBS];
+};
void *
@@ -176,28 +181,39 @@ void *llvmpipe_create_vs_state(struct pipe_context *,
void llvmpipe_bind_vs_state(struct pipe_context *, void *);
void llvmpipe_delete_vs_state(struct pipe_context *, void *);
+void *llvmpipe_create_vertex_elements_state(struct pipe_context *,
+ unsigned count,
+ const struct pipe_vertex_element *);
+void llvmpipe_bind_vertex_elements_state(struct pipe_context *, void *);
+void llvmpipe_delete_vertex_elements_state(struct pipe_context *, void *);
+
void llvmpipe_set_polygon_stipple( struct pipe_context *,
- const struct pipe_poly_stipple * );
+ const struct pipe_poly_stipple * );
void llvmpipe_set_scissor_state( struct pipe_context *,
const struct pipe_scissor_state * );
-void llvmpipe_set_sampler_textures( struct pipe_context *,
- unsigned num,
- struct pipe_texture ** );
+void llvmpipe_set_fragment_sampler_views(struct pipe_context *,
+ unsigned num,
+ struct pipe_sampler_view **);
+
+void
+llvmpipe_set_vertex_sampler_views(struct pipe_context *,
+ unsigned num,
+ struct pipe_sampler_view **);
+
+struct pipe_sampler_view *
+llvmpipe_create_sampler_view(struct pipe_context *pipe,
+ struct pipe_texture *texture,
+ const struct pipe_sampler_view *templ);
void
-llvmpipe_set_vertex_sampler_textures(struct pipe_context *,
- unsigned num_textures,
- struct pipe_texture **);
+llvmpipe_sampler_view_destroy(struct pipe_context *pipe,
+ struct pipe_sampler_view *view);
void llvmpipe_set_viewport_state( struct pipe_context *,
const struct pipe_viewport_state * );
-void llvmpipe_set_vertex_elements(struct pipe_context *,
- unsigned count,
- const struct pipe_vertex_element *);
-
void llvmpipe_set_vertex_buffers(struct pipe_context *,
unsigned count,
const struct pipe_vertex_buffer *);
diff --git a/src/gallium/drivers/llvmpipe/lp_state_derived.c b/src/gallium/drivers/llvmpipe/lp_state_derived.c
index bdd906e1a7..777871638f 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_derived.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_derived.c
@@ -150,7 +150,7 @@ void llvmpipe_update_derived( struct llvmpipe_context *llvmpipe )
*/
if (llvmpipe->tex_timestamp != lp_screen->timestamp) {
llvmpipe->tex_timestamp = lp_screen->timestamp;
- llvmpipe->dirty |= LP_NEW_TEXTURE;
+ llvmpipe->dirty |= LP_NEW_SAMPLER_VIEW;
}
if (llvmpipe->dirty & (LP_NEW_RASTERIZER |
@@ -164,7 +164,7 @@ void llvmpipe_update_derived( struct llvmpipe_context *llvmpipe )
LP_NEW_DEPTH_STENCIL_ALPHA |
LP_NEW_RASTERIZER |
LP_NEW_SAMPLER |
- LP_NEW_TEXTURE))
+ LP_NEW_SAMPLER_VIEW))
llvmpipe_update_fs( llvmpipe );
if (llvmpipe->dirty & LP_NEW_BLEND_COLOR)
@@ -174,18 +174,21 @@ void llvmpipe_update_derived( struct llvmpipe_context *llvmpipe )
if (llvmpipe->dirty & LP_NEW_SCISSOR)
lp_setup_set_scissor(llvmpipe->setup, &llvmpipe->scissor);
- if (llvmpipe->dirty & LP_NEW_DEPTH_STENCIL_ALPHA)
+ if (llvmpipe->dirty & LP_NEW_DEPTH_STENCIL_ALPHA) {
lp_setup_set_alpha_ref_value(llvmpipe->setup,
llvmpipe->depth_stencil->alpha.ref_value);
+ lp_setup_set_stencil_ref_values(llvmpipe->setup,
+ llvmpipe->stencil_ref.ref_value);
+ }
if (llvmpipe->dirty & LP_NEW_CONSTANTS)
lp_setup_set_fs_constants(llvmpipe->setup,
llvmpipe->constants[PIPE_SHADER_FRAGMENT]);
- if (llvmpipe->dirty & LP_NEW_TEXTURE)
- lp_setup_set_sampler_textures(llvmpipe->setup,
- llvmpipe->num_textures,
- llvmpipe->texture);
+ if (llvmpipe->dirty & LP_NEW_SAMPLER_VIEW)
+ lp_setup_set_fragment_sampler_views(llvmpipe->setup,
+ llvmpipe->num_fragment_sampler_views,
+ llvmpipe->fragment_sampler_views);
llvmpipe->dirty = 0;
}
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index c4b79dd415..7bbf348e0b 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -40,7 +40,7 @@
* - depth/stencil test (stencil TBI)
* - blending
*
- * This file has only the glue to assembly the fragment pipeline. The actual
+ * This file has only the glue to assemble the fragment pipeline. The actual
* plumbing of converting Gallium state into LLVM IR is done elsewhere, in the
* lp_bld_*.[ch] files, and in a complete generic and reusable way. Here we
* muster the LLVM JIT execution engine to create a function that follows an
@@ -95,6 +95,9 @@
#include "lp_tex_sample.h"
+#include <llvm-c/Analysis.h>
+
+
static const unsigned char quad_offset_x[4] = {0, 1, 0, 1};
static const unsigned char quad_offset_y[4] = {0, 0, 1, 1};
@@ -135,20 +138,22 @@ generate_pos0(LLVMBuilderRef builder,
/**
- * Generate the depth test.
+ * Generate the depth /stencil test code.
*/
static void
-generate_depth(LLVMBuilderRef builder,
- const struct lp_fragment_shader_variant_key *key,
- struct lp_type src_type,
- struct lp_build_mask_context *mask,
- LLVMValueRef src,
- LLVMValueRef dst_ptr)
+generate_depth_stencil(LLVMBuilderRef builder,
+ const struct lp_fragment_shader_variant_key *key,
+ struct lp_type src_type,
+ struct lp_build_mask_context *mask,
+ LLVMValueRef stencil_refs[2],
+ LLVMValueRef src,
+ LLVMValueRef dst_ptr,
+ LLVMValueRef facing)
{
const struct util_format_description *format_desc;
struct lp_type dst_type;
- if(!key->depth.enabled)
+ if (!key->depth.enabled && !key->stencil[0].enabled && !key->stencil[1].enabled)
return;
format_desc = util_format_description(key->zsbuf_format);
@@ -175,19 +180,22 @@ generate_depth(LLVMBuilderRef builder,
assert(dst_type.width == src_type.width);
assert(dst_type.length == src_type.length);
+ /* Convert fragment Z from float to integer */
lp_build_conv(builder, src_type, dst_type, &src, 1, &src, 1);
dst_ptr = LLVMBuildBitCast(builder,
dst_ptr,
LLVMPointerType(lp_build_vec_type(dst_type), 0), "");
-
- lp_build_depth_test(builder,
- &key->depth,
- dst_type,
- format_desc,
- mask,
- src,
- dst_ptr);
+ lp_build_depth_stencil_test(builder,
+ &key->depth,
+ key->stencil,
+ dst_type,
+ format_desc,
+ mask,
+ stencil_refs,
+ src,
+ dst_ptr,
+ facing);
}
@@ -249,7 +257,7 @@ generate_tri_edge_mask(LLVMBuilderRef builder,
LLVMConstInt(LLVMInt32Type(), INT_MIN, 0),
"");
- in_out_mask = lp_build_int_const_scalar(i32_type, ~0);
+ in_out_mask = lp_build_const_int_vec(i32_type, ~0);
lp_build_flow_scope_declare(flow, &in_out_mask);
@@ -364,7 +372,7 @@ build_int32_vec_const(int value)
i32_type.norm = FALSE; /* values are not normalized */
i32_type.width = 32; /* 32-bit int values */
i32_type.length = 4; /* 4 elements per vector */
- return lp_build_int_const_scalar(i32_type, value);
+ return lp_build_const_int_vec(i32_type, value);
}
@@ -387,6 +395,7 @@ generate_fs(struct llvmpipe_context *lp,
LLVMValueRef *pmask,
LLVMValueRef (*color)[4],
LLVMValueRef depth_ptr,
+ LLVMValueRef facing,
unsigned do_tri_test,
LLVMValueRef c0,
LLVMValueRef c1,
@@ -402,15 +411,19 @@ generate_fs(struct llvmpipe_context *lp,
LLVMValueRef consts_ptr;
LLVMValueRef outputs[PIPE_MAX_SHADER_OUTPUTS][NUM_CHANNELS];
LLVMValueRef z = interp->pos[2];
+ LLVMValueRef stencil_refs[2];
struct lp_build_flow_context *flow;
struct lp_build_mask_context mask;
- boolean early_depth_test;
+ boolean early_depth_stencil_test;
unsigned attrib;
unsigned chan;
unsigned cbuf;
assert(i < 4);
+ stencil_refs[0] = lp_jit_context_stencil_ref_front_value(builder, context_ptr);
+ stencil_refs[1] = lp_jit_context_stencil_ref_back_value(builder, context_ptr);
+
elem_type = lp_build_elem_type(type);
vec_type = lp_build_vec_type(type);
int_vec_type = lp_build_int_vec_type(type);
@@ -450,16 +463,16 @@ generate_fs(struct llvmpipe_context *lp,
lp_build_mask_update(&mask, smask);
}
- early_depth_test =
- key->depth.enabled &&
+ early_depth_stencil_test =
+ (key->depth.enabled || key->stencil[0].enabled) &&
!key->alpha.enabled &&
!shader->info.uses_kill &&
!shader->info.writes_z;
- if(early_depth_test)
- generate_depth(builder, key,
- type, &mask,
- z, depth_ptr);
+ if (early_depth_stencil_test)
+ generate_depth_stencil(builder, key,
+ type, &mask,
+ stencil_refs, z, depth_ptr, facing);
lp_build_tgsi_soa(builder, tokens, type, &mask,
consts_ptr, interp->pos, interp->inputs,
@@ -503,10 +516,10 @@ generate_fs(struct llvmpipe_context *lp,
}
}
- if(!early_depth_test)
- generate_depth(builder, key,
- type, &mask,
- z, depth_ptr);
+ if (!early_depth_stencil_test)
+ generate_depth_stencil(builder, key,
+ type, &mask,
+ stencil_refs, z, depth_ptr, facing);
lp_build_mask_end(&mask);
@@ -582,6 +595,20 @@ generate_blend(const struct pipe_blend_state *blend,
}
+/** casting function to avoid compiler warnings */
+static lp_jit_frag_func
+cast_voidptr_to_lp_jit_frag_func(void *p)
+{
+ union {
+ void *v;
+ lp_jit_frag_func f;
+ } tmp;
+ assert(sizeof(tmp.v) == sizeof(tmp.f));
+ tmp.v = p;
+ return tmp.f;
+}
+
+
/**
* Generate the runtime callable function for the whole fragment pipeline.
* Note that the function which we generate operates on a block of 16
@@ -603,7 +630,7 @@ generate_fragment(struct llvmpipe_context *lp,
LLVMTypeRef fs_int_vec_type;
LLVMTypeRef blend_vec_type;
LLVMTypeRef blend_int_vec_type;
- LLVMTypeRef arg_types[14];
+ LLVMTypeRef arg_types[15];
LLVMTypeRef func_type;
LLVMTypeRef int32_vec4_type = lp_build_int32_vec4_type();
LLVMValueRef context_ptr;
@@ -626,6 +653,7 @@ generate_fragment(struct llvmpipe_context *lp,
LLVMValueRef blend_mask;
LLVMValueRef blend_in_color[NUM_CHANNELS];
LLVMValueRef function;
+ LLVMValueRef facing;
unsigned num_fs;
unsigned i;
unsigned chan;
@@ -665,20 +693,21 @@ generate_fragment(struct llvmpipe_context *lp,
arg_types[0] = screen->context_ptr_type; /* context */
arg_types[1] = LLVMInt32Type(); /* x */
arg_types[2] = LLVMInt32Type(); /* y */
- arg_types[3] = LLVMPointerType(fs_elem_type, 0); /* a0 */
- arg_types[4] = LLVMPointerType(fs_elem_type, 0); /* dadx */
- arg_types[5] = LLVMPointerType(fs_elem_type, 0); /* dady */
- arg_types[6] = LLVMPointerType(LLVMPointerType(blend_vec_type, 0), 0); /* color */
- arg_types[7] = LLVMPointerType(fs_int_vec_type, 0); /* depth */
- arg_types[8] = LLVMInt32Type(); /* c0 */
- arg_types[9] = LLVMInt32Type(); /* c1 */
- arg_types[10] = LLVMInt32Type(); /* c2 */
+ arg_types[3] = LLVMFloatType(); /* facing */
+ arg_types[4] = LLVMPointerType(fs_elem_type, 0); /* a0 */
+ arg_types[5] = LLVMPointerType(fs_elem_type, 0); /* dadx */
+ arg_types[6] = LLVMPointerType(fs_elem_type, 0); /* dady */
+ arg_types[7] = LLVMPointerType(LLVMPointerType(blend_vec_type, 0), 0); /* color */
+ arg_types[8] = LLVMPointerType(fs_int_vec_type, 0); /* depth */
+ arg_types[9] = LLVMInt32Type(); /* c0 */
+ arg_types[10] = LLVMInt32Type(); /* c1 */
+ arg_types[11] = LLVMInt32Type(); /* c2 */
/* Note: the step arrays are built as int32[16] but we interpret
* them here as int32_vec4[4].
*/
- arg_types[11] = LLVMPointerType(int32_vec4_type, 0);/* step0 */
- arg_types[12] = LLVMPointerType(int32_vec4_type, 0);/* step1 */
- arg_types[13] = LLVMPointerType(int32_vec4_type, 0);/* step2 */
+ arg_types[12] = LLVMPointerType(int32_vec4_type, 0);/* step0 */
+ arg_types[13] = LLVMPointerType(int32_vec4_type, 0);/* step1 */
+ arg_types[14] = LLVMPointerType(int32_vec4_type, 0);/* step2 */
func_type = LLVMFunctionType(LLVMVoidType(), arg_types, Elements(arg_types), 0);
@@ -698,17 +727,18 @@ generate_fragment(struct llvmpipe_context *lp,
context_ptr = LLVMGetParam(function, 0);
x = LLVMGetParam(function, 1);
y = LLVMGetParam(function, 2);
- a0_ptr = LLVMGetParam(function, 3);
- dadx_ptr = LLVMGetParam(function, 4);
- dady_ptr = LLVMGetParam(function, 5);
- color_ptr_ptr = LLVMGetParam(function, 6);
- depth_ptr = LLVMGetParam(function, 7);
- c0 = LLVMGetParam(function, 8);
- c1 = LLVMGetParam(function, 9);
- c2 = LLVMGetParam(function, 10);
- step0_ptr = LLVMGetParam(function, 11);
- step1_ptr = LLVMGetParam(function, 12);
- step2_ptr = LLVMGetParam(function, 13);
+ facing = LLVMGetParam(function, 3);
+ a0_ptr = LLVMGetParam(function, 4);
+ dadx_ptr = LLVMGetParam(function, 5);
+ dady_ptr = LLVMGetParam(function, 6);
+ color_ptr_ptr = LLVMGetParam(function, 7);
+ depth_ptr = LLVMGetParam(function, 8);
+ c0 = LLVMGetParam(function, 9);
+ c1 = LLVMGetParam(function, 10);
+ c2 = LLVMGetParam(function, 11);
+ step0_ptr = LLVMGetParam(function, 12);
+ step1_ptr = LLVMGetParam(function, 13);
+ step2_ptr = LLVMGetParam(function, 14);
lp_build_name(context_ptr, "context");
lp_build_name(x, "x");
@@ -767,6 +797,7 @@ generate_fragment(struct llvmpipe_context *lp,
&fs_mask[i], /* output */
out_color,
depth_ptr_i,
+ facing,
do_tri_test,
c0, c1, c2,
step0_ptr, step1_ptr, step2_ptr);
@@ -842,10 +873,14 @@ generate_fragment(struct llvmpipe_context *lp,
/*
* Translate the LLVM IR into machine code.
*/
- variant->jit_function[do_tri_test] = (lp_jit_frag_func)LLVMGetPointerToGlobal(screen->engine, function);
+ {
+ void *f = LLVMGetPointerToGlobal(screen->engine, function);
+
+ variant->jit_function[do_tri_test] = cast_voidptr_to_lp_jit_frag_func(f);
- if (LP_DEBUG & DEBUG_ASM)
- lp_disassemble(variant->jit_function[do_tri_test]);
+ if (LP_DEBUG & DEBUG_ASM)
+ lp_disassemble(f);
+ }
}
@@ -1051,10 +1086,15 @@ make_variant_key(struct llvmpipe_context *lp,
memset(key, 0, sizeof *key);
- if(lp->framebuffer.zsbuf &&
- lp->depth_stencil->depth.enabled) {
- key->zsbuf_format = lp->framebuffer.zsbuf->format;
- memcpy(&key->depth, &lp->depth_stencil->depth, sizeof key->depth);
+ if (lp->framebuffer.zsbuf) {
+ if (lp->depth_stencil->depth.enabled) {
+ key->zsbuf_format = lp->framebuffer.zsbuf->format;
+ memcpy(&key->depth, &lp->depth_stencil->depth, sizeof key->depth);
+ }
+ if (lp->depth_stencil->stencil[0].enabled) {
+ key->zsbuf_format = lp->framebuffer.zsbuf->format;
+ memcpy(&key->stencil, &lp->depth_stencil->stencil, sizeof key->stencil);
+ }
}
key->alpha.enabled = lp->depth_stencil->alpha.enabled;
@@ -1091,7 +1131,7 @@ make_variant_key(struct llvmpipe_context *lp,
for(i = 0; i < PIPE_MAX_SAMPLERS; ++i)
if(shader->info.file_mask[TGSI_FILE_SAMPLER] & (1 << i))
- lp_sampler_static_state(&key->sampler[i], lp->texture[i], lp->sampler[i]);
+ lp_sampler_static_state(&key->sampler[i], lp->fragment_sampler_views[i]->texture, lp->sampler[i]);
}
@@ -1137,6 +1177,7 @@ llvmpipe_update_fs(struct llvmpipe_context *lp)
opaque = !key.blend.logicop_enable &&
!key.blend.rt[0].blend_enable &&
key.blend.rt[0].colormask == 0xf &&
+ !key.stencil[0].enabled &&
!key.alpha.enabled &&
!key.depth.enabled &&
!key.scissor &&
@@ -1144,7 +1185,7 @@ llvmpipe_update_fs(struct llvmpipe_context *lp)
? TRUE : FALSE;
lp_setup_set_fs_functions(lp->setup,
- shader->current->jit_function[0],
- shader->current->jit_function[1],
+ shader->current->jit_function[RAST_WHOLE],
+ shader->current->jit_function[RAST_EDGE_TEST],
opaque);
}
diff --git a/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c b/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c
index feb012816c..6df3ef25b0 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c
@@ -62,7 +62,8 @@ void llvmpipe_bind_rasterizer_state(struct pipe_context *pipe,
lp_setup_set_triangle_state( llvmpipe->setup,
llvmpipe->rasterizer->cull_mode,
llvmpipe->rasterizer->front_winding == PIPE_WINDING_CCW,
- llvmpipe->rasterizer->scissor);
+ llvmpipe->rasterizer->scissor,
+ llvmpipe->rasterizer->gl_rasterization_rules);
}
llvmpipe->dirty |= LP_NEW_RASTERIZER;
diff --git a/src/gallium/drivers/llvmpipe/lp_state_sampler.c b/src/gallium/drivers/llvmpipe/lp_state_sampler.c
index b30a075776..2645441b58 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_sampler.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_sampler.c
@@ -105,8 +105,9 @@ llvmpipe_bind_vertex_sampler_states(struct pipe_context *pipe,
void
-llvmpipe_set_sampler_textures(struct pipe_context *pipe,
- unsigned num, struct pipe_texture **texture)
+llvmpipe_set_fragment_sampler_views(struct pipe_context *pipe,
+ unsigned num,
+ struct pipe_sampler_view **views)
{
struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe);
uint i;
@@ -114,51 +115,79 @@ llvmpipe_set_sampler_textures(struct pipe_context *pipe,
assert(num <= PIPE_MAX_SAMPLERS);
/* Check for no-op */
- if (num == llvmpipe->num_textures &&
- !memcmp(llvmpipe->texture, texture, num * sizeof(struct pipe_texture *)))
+ if (num == llvmpipe->num_fragment_sampler_views &&
+ !memcmp(llvmpipe->fragment_sampler_views, views, num * sizeof(struct pipe_sampler_view *)))
return;
draw_flush(llvmpipe->draw);
for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
- struct pipe_texture *tex = i < num ? texture[i] : NULL;
+ struct pipe_sampler_view *view = i < num ? views[i] : NULL;
- pipe_texture_reference(&llvmpipe->texture[i], tex);
+ pipe_sampler_view_reference(&llvmpipe->fragment_sampler_views[i], view);
}
- llvmpipe->num_textures = num;
+ llvmpipe->num_fragment_sampler_views = num;
- llvmpipe->dirty |= LP_NEW_TEXTURE;
+ llvmpipe->dirty |= LP_NEW_SAMPLER_VIEW;
}
void
-llvmpipe_set_vertex_sampler_textures(struct pipe_context *pipe,
- unsigned num_textures,
- struct pipe_texture **textures)
+llvmpipe_set_vertex_sampler_views(struct pipe_context *pipe,
+ unsigned num,
+ struct pipe_sampler_view **views)
{
struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe);
uint i;
- assert(num_textures <= PIPE_MAX_VERTEX_SAMPLERS);
+ assert(num <= PIPE_MAX_VERTEX_SAMPLERS);
/* Check for no-op */
- if (num_textures == llvmpipe->num_vertex_textures &&
- !memcmp(llvmpipe->vertex_textures, textures, num_textures * sizeof(struct pipe_texture *))) {
+ if (num == llvmpipe->num_vertex_sampler_views &&
+ !memcmp(llvmpipe->vertex_sampler_views, views, num * sizeof(struct pipe_sampler_view *))) {
return;
}
draw_flush(llvmpipe->draw);
for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) {
- struct pipe_texture *tex = i < num_textures ? textures[i] : NULL;
+ struct pipe_sampler_view *view = i < num ? views[i] : NULL;
- pipe_texture_reference(&llvmpipe->vertex_textures[i], tex);
+ pipe_sampler_view_reference(&llvmpipe->vertex_sampler_views[i], view);
}
- llvmpipe->num_vertex_textures = num_textures;
+ llvmpipe->num_vertex_sampler_views = num;
- llvmpipe->dirty |= LP_NEW_TEXTURE;
+ llvmpipe->dirty |= LP_NEW_SAMPLER_VIEW;
+}
+
+
+struct pipe_sampler_view *
+llvmpipe_create_sampler_view(struct pipe_context *pipe,
+ struct pipe_texture *texture,
+ const struct pipe_sampler_view *templ)
+{
+ struct pipe_sampler_view *view = CALLOC_STRUCT(pipe_sampler_view);
+
+ if (view) {
+ *view = *templ;
+ view->reference.count = 1;
+ view->texture = NULL;
+ pipe_texture_reference(&view->texture, texture);
+ view->context = pipe;
+ }
+
+ return view;
+}
+
+
+void
+llvmpipe_sampler_view_destroy(struct pipe_context *pipe,
+ struct pipe_sampler_view *view)
+{
+ pipe_texture_reference(&view->texture, NULL);
+ FREE(view);
}
diff --git a/src/gallium/drivers/llvmpipe/lp_state_surface.c b/src/gallium/drivers/llvmpipe/lp_state_surface.c
index 048ac5b968..7d86c5750c 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_surface.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_surface.c
@@ -32,6 +32,7 @@
#include "util/u_inlines.h"
#include "util/u_surface.h"
#include "lp_context.h"
+#include "lp_scene.h"
#include "lp_state.h"
#include "lp_setup.h"
@@ -51,6 +52,9 @@ llvmpipe_set_framebuffer_state(struct pipe_context *pipe,
boolean changed = !util_framebuffer_state_equal(&lp->framebuffer, fb);
+ assert(fb->width <= MAXWIDTH);
+ assert(fb->height <= MAXHEIGHT);
+
if (changed) {
util_copy_framebuffer_state(&lp->framebuffer, fb);
diff --git a/src/gallium/drivers/llvmpipe/lp_state_vertex.c b/src/gallium/drivers/llvmpipe/lp_state_vertex.c
index 57ac25ea0c..f6427aa908 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_vertex.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_vertex.c
@@ -35,24 +35,41 @@
#include "draw/draw_context.h"
+void *
+llvmpipe_create_vertex_elements_state(struct pipe_context *pipe,
+ unsigned count,
+ const struct pipe_vertex_element *attribs)
+{
+ struct lp_velems_state *velems;
+ assert(count <= PIPE_MAX_ATTRIBS);
+ velems = (struct lp_velems_state *) MALLOC(sizeof(struct lp_velems_state));
+ if (velems) {
+ velems->count = count;
+ memcpy(velems->velem, attribs, sizeof(*attribs) * count);
+ }
+ return velems;
+}
+
void
-llvmpipe_set_vertex_elements(struct pipe_context *pipe,
- unsigned count,
- const struct pipe_vertex_element *attribs)
+llvmpipe_bind_vertex_elements_state(struct pipe_context *pipe,
+ void *velems)
{
struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe);
+ struct lp_velems_state *lp_velems = (struct lp_velems_state *) velems;
- assert(count <= PIPE_MAX_ATTRIBS);
-
- memcpy(llvmpipe->vertex_element, attribs,
- count * sizeof(struct pipe_vertex_element));
- llvmpipe->num_vertex_elements = count;
+ llvmpipe->velems = lp_velems;
llvmpipe->dirty |= LP_NEW_VERTEX;
- draw_set_vertex_elements(llvmpipe->draw, count, attribs);
+ if (velems)
+ draw_set_vertex_elements(llvmpipe->draw, lp_velems->count, lp_velems->velem);
}
+void
+llvmpipe_delete_vertex_elements_state(struct pipe_context *pipe, void *velems)
+{
+ FREE( velems );
+}
void
llvmpipe_set_vertex_buffers(struct pipe_context *pipe,
diff --git a/src/gallium/drivers/llvmpipe/lp_surface.c b/src/gallium/drivers/llvmpipe/lp_surface.c
index 6110b0a193..ca3d62c361 100644
--- a/src/gallium/drivers/llvmpipe/lp_surface.c
+++ b/src/gallium/drivers/llvmpipe/lp_surface.c
@@ -27,6 +27,7 @@
#include "util/u_rect.h"
#include "lp_context.h"
+#include "lp_flush.h"
#include "lp_surface.h"
@@ -36,6 +37,20 @@ lp_surface_copy(struct pipe_context *pipe,
struct pipe_surface *src, unsigned srcx, unsigned srcy,
unsigned width, unsigned height)
{
+ llvmpipe_flush_texture(pipe,
+ dest->texture, dest->face, dest->level,
+ 0, /* flush_flags */
+ FALSE, /* read_only */
+ FALSE, /* cpu_access */
+ FALSE); /* do_not_flush */
+
+ llvmpipe_flush_texture(pipe,
+ src->texture, src->face, src->level,
+ 0, /* flush_flags */
+ TRUE, /* read_only */
+ FALSE, /* cpu_access */
+ FALSE); /* do_not_flush */
+
util_surface_copy(pipe, FALSE,
dest, destx, desty,
src, srcx, srcy,
diff --git a/src/gallium/drivers/llvmpipe/lp_test.h b/src/gallium/drivers/llvmpipe/lp_test.h
index a9b99945f9..338a04a487 100644
--- a/src/gallium/drivers/llvmpipe/lp_test.h
+++ b/src/gallium/drivers/llvmpipe/lp_test.h
@@ -41,7 +41,7 @@
#include <stdio.h>
#include <float.h>
-#include <llvm-c/Core.h>
+#include "gallivm/lp_bld.h"
#include <llvm-c/Analysis.h>
#include <llvm-c/ExecutionEngine.h>
#include <llvm-c/Target.h>
diff --git a/src/gallium/drivers/llvmpipe/lp_test_format.c b/src/gallium/drivers/llvmpipe/lp_test_format.c
deleted file mode 100644
index d05157991b..0000000000
--- a/src/gallium/drivers/llvmpipe/lp_test_format.c
+++ /dev/null
@@ -1,314 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2009 VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include <llvm-c/Core.h>
-#include <llvm-c/Analysis.h>
-#include <llvm-c/ExecutionEngine.h>
-#include <llvm-c/Target.h>
-#include <llvm-c/Transforms/Scalar.h>
-
-#include "util/u_cpu_detect.h"
-#include "util/u_format.h"
-
-#include "gallivm/lp_bld_format.h"
-#include "lp_test.h"
-
-
-struct pixel_test_case
-{
- enum pipe_format format;
- uint32_t packed;
- double unpacked[4];
-};
-
-
-struct pixel_test_case test_cases[] =
-{
- {PIPE_FORMAT_B5G6R5_UNORM, 0x0000, {0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_B5G6R5_UNORM, 0x001f, {0.0, 0.0, 1.0, 1.0}},
- {PIPE_FORMAT_B5G6R5_UNORM, 0x07e0, {0.0, 1.0, 0.0, 1.0}},
- {PIPE_FORMAT_B5G6R5_UNORM, 0xf800, {1.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_B5G6R5_UNORM, 0xffff, {1.0, 1.0, 1.0, 1.0}},
-
- {PIPE_FORMAT_B5G5R5A1_UNORM, 0x0000, {0.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_B5G5R5A1_UNORM, 0x001f, {0.0, 0.0, 1.0, 0.0}},
- {PIPE_FORMAT_B5G5R5A1_UNORM, 0x03e0, {0.0, 1.0, 0.0, 0.0}},
- {PIPE_FORMAT_B5G5R5A1_UNORM, 0x7c00, {1.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_B5G5R5A1_UNORM, 0x8000, {0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_B5G5R5A1_UNORM, 0xffff, {1.0, 1.0, 1.0, 1.0}},
-
- {PIPE_FORMAT_B8G8R8A8_UNORM, 0x00000000, {0.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_B8G8R8A8_UNORM, 0x000000ff, {0.0, 0.0, 1.0, 0.0}},
- {PIPE_FORMAT_B8G8R8A8_UNORM, 0x0000ff00, {0.0, 1.0, 0.0, 0.0}},
- {PIPE_FORMAT_B8G8R8A8_UNORM, 0x00ff0000, {1.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_B8G8R8A8_UNORM, 0xff000000, {0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_B8G8R8A8_UNORM, 0xffffffff, {1.0, 1.0, 1.0, 1.0}},
-
-#if 0
- {PIPE_FORMAT_R8G8B8A8_UNORM, 0x00000000, {0.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R8G8B8A8_UNORM, 0x000000ff, {0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_R8G8B8A8_UNORM, 0x0000ff00, {0.0, 0.0, 1.0, 0.0}},
- {PIPE_FORMAT_R8G8B8A8_UNORM, 0x00ff0000, {0.0, 1.0, 0.0, 0.0}},
- {PIPE_FORMAT_R8G8B8A8_UNORM, 0xff000000, {1.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_R8G8B8A8_UNORM, 0xffffffff, {1.0, 1.0, 1.0, 1.0}},
-#endif
-
- {PIPE_FORMAT_A8R8G8B8_UNORM, 0x00000000, {0.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_A8R8G8B8_UNORM, 0x000000ff, {0.0, 0.0, 0.0, 1.0}},
- {PIPE_FORMAT_A8R8G8B8_UNORM, 0x0000ff00, {1.0, 0.0, 0.0, 0.0}},
- {PIPE_FORMAT_A8R8G8B8_UNORM, 0x00ff0000, {0.0, 1.0, 0.0, 0.0}},
- {PIPE_FORMAT_A8R8G8B8_UNORM, 0xff000000, {0.0, 0.0, 1.0, 0.0}},
- {PIPE_FORMAT_A8R8G8B8_UNORM, 0xffffffff, {1.0, 1.0, 1.0, 1.0}},
-};
-
-
-void
-write_tsv_header(FILE *fp)
-{
- fprintf(fp,
- "result\t"
- "format\n");
-
- fflush(fp);
-}
-
-
-static void
-write_tsv_row(FILE *fp,
- const struct util_format_description *desc,
- boolean success)
-{
- fprintf(fp, "%s\t", success ? "pass" : "fail");
-
- fprintf(fp, "%s\n", desc->name);
-
- fflush(fp);
-}
-
-
-typedef void (*load_ptr_t)(const uint32_t packed, float *);
-
-
-static LLVMValueRef
-add_load_rgba_test(LLVMModuleRef module,
- const struct util_format_description *desc)
-{
- LLVMTypeRef args[2];
- LLVMValueRef func;
- LLVMValueRef packed;
- LLVMValueRef rgba_ptr;
- LLVMBasicBlockRef block;
- LLVMBuilderRef builder;
- LLVMValueRef rgba;
-
- args[0] = LLVMInt32Type();
- args[1] = LLVMPointerType(LLVMVectorType(LLVMFloatType(), 4), 0);
-
- func = LLVMAddFunction(module, "load", LLVMFunctionType(LLVMVoidType(), args, 2, 0));
- LLVMSetFunctionCallConv(func, LLVMCCallConv);
- packed = LLVMGetParam(func, 0);
- rgba_ptr = LLVMGetParam(func, 1);
-
- block = LLVMAppendBasicBlock(func, "entry");
- builder = LLVMCreateBuilder();
- LLVMPositionBuilderAtEnd(builder, block);
-
- if(desc->block.bits < 32)
- packed = LLVMBuildTrunc(builder, packed, LLVMIntType(desc->block.bits), "");
-
- rgba = lp_build_unpack_rgba_aos(builder, desc, packed);
-
- LLVMBuildStore(builder, rgba, rgba_ptr);
-
- LLVMBuildRetVoid(builder);
-
- LLVMDisposeBuilder(builder);
- return func;
-}
-
-
-typedef void (*store_ptr_t)(uint32_t *, const float *);
-
-
-static LLVMValueRef
-add_store_rgba_test(LLVMModuleRef module,
- const struct util_format_description *desc)
-{
- LLVMTypeRef args[2];
- LLVMValueRef func;
- LLVMValueRef packed_ptr;
- LLVMValueRef rgba_ptr;
- LLVMBasicBlockRef block;
- LLVMBuilderRef builder;
- LLVMValueRef rgba;
- LLVMValueRef packed;
-
- args[0] = LLVMPointerType(LLVMInt32Type(), 0);
- args[1] = LLVMPointerType(LLVMVectorType(LLVMFloatType(), 4), 0);
-
- func = LLVMAddFunction(module, "store", LLVMFunctionType(LLVMVoidType(), args, 2, 0));
- LLVMSetFunctionCallConv(func, LLVMCCallConv);
- packed_ptr = LLVMGetParam(func, 0);
- rgba_ptr = LLVMGetParam(func, 1);
-
- block = LLVMAppendBasicBlock(func, "entry");
- builder = LLVMCreateBuilder();
- LLVMPositionBuilderAtEnd(builder, block);
-
- rgba = LLVMBuildLoad(builder, rgba_ptr, "");
-
- packed = lp_build_pack_rgba_aos(builder, desc, rgba);
-
- if(desc->block.bits < 32)
- packed = LLVMBuildZExt(builder, packed, LLVMInt32Type(), "");
-
- LLVMBuildStore(builder, packed, packed_ptr);
-
- LLVMBuildRetVoid(builder);
-
- LLVMDisposeBuilder(builder);
- return func;
-}
-
-
-PIPE_ALIGN_STACK
-static boolean
-test_format(unsigned verbose, FILE *fp, const struct pixel_test_case *test)
-{
- LLVMModuleRef module = NULL;
- LLVMValueRef load = NULL;
- LLVMValueRef store = NULL;
- LLVMExecutionEngineRef engine = NULL;
- LLVMModuleProviderRef provider = NULL;
- LLVMPassManagerRef pass = NULL;
- char *error = NULL;
- const struct util_format_description *desc;
- load_ptr_t load_ptr;
- store_ptr_t store_ptr;
- float unpacked[4];
- unsigned packed;
- boolean success;
- unsigned i;
-
- desc = util_format_description(test->format);
- fprintf(stderr, "%s\n", desc->name);
-
- module = LLVMModuleCreateWithName("test");
-
- load = add_load_rgba_test(module, desc);
- store = add_store_rgba_test(module, desc);
-
- if(LLVMVerifyModule(module, LLVMPrintMessageAction, &error)) {
- LLVMDumpModule(module);
- abort();
- }
- LLVMDisposeMessage(error);
-
- provider = LLVMCreateModuleProviderForExistingModule(module);
- if (LLVMCreateJITCompiler(&engine, provider, 1, &error)) {
- fprintf(stderr, "%s\n", error);
- LLVMDisposeMessage(error);
- abort();
- }
-
-#if 0
- pass = LLVMCreatePassManager();
- LLVMAddTargetData(LLVMGetExecutionEngineTargetData(engine), pass);
- /* These are the passes currently listed in llvm-c/Transforms/Scalar.h,
- * but there are more on SVN. */
- LLVMAddConstantPropagationPass(pass);
- LLVMAddInstructionCombiningPass(pass);
- LLVMAddPromoteMemoryToRegisterPass(pass);
- LLVMAddGVNPass(pass);
- LLVMAddCFGSimplificationPass(pass);
- LLVMRunPassManager(pass, module);
-#else
- (void)pass;
-#endif
-
- load_ptr = (load_ptr_t) LLVMGetPointerToGlobal(engine, load);
- store_ptr = (store_ptr_t)LLVMGetPointerToGlobal(engine, store);
-
- memset(unpacked, 0, sizeof unpacked);
- packed = 0;
-
- load_ptr(test->packed, unpacked);
- store_ptr(&packed, unpacked);
-
- success = TRUE;
- if(test->packed != packed)
- success = FALSE;
- for(i = 0; i < 4; ++i)
- if(test->unpacked[i] != unpacked[i])
- success = FALSE;
-
- if (!success) {
- printf("FAILED\n");
- printf(" Packed: %08x\n", test->packed);
- printf(" %08x\n", packed);
- printf(" Unpacked: %f %f %f %f\n", unpacked[0], unpacked[1], unpacked[2], unpacked[3]);
- printf(" %f %f %f %f\n", test->unpacked[0], test->unpacked[1], test->unpacked[2], test->unpacked[3]);
- LLVMDumpModule(module);
- }
-
- LLVMFreeMachineCodeForFunction(engine, store);
- LLVMFreeMachineCodeForFunction(engine, load);
-
- LLVMDisposeExecutionEngine(engine);
- if(pass)
- LLVMDisposePassManager(pass);
-
- if(fp)
- write_tsv_row(fp, desc, success);
-
- return success;
-}
-
-
-boolean
-test_all(unsigned verbose, FILE *fp)
-{
- unsigned i;
- bool success = TRUE;
-
- for (i = 0; i < sizeof(test_cases)/sizeof(test_cases[0]); ++i)
- if(!test_format(verbose, fp, &test_cases[i]))
- success = FALSE;
-
- return success;
-}
-
-
-boolean
-test_some(unsigned verbose, FILE *fp, unsigned long n)
-{
- return test_all(verbose, fp);
-}
diff --git a/src/gallium/drivers/llvmpipe/lp_test_printf.c b/src/gallium/drivers/llvmpipe/lp_test_printf.c
new file mode 100644
index 0000000000..e5e5925012
--- /dev/null
+++ b/src/gallium/drivers/llvmpipe/lp_test_printf.c
@@ -0,0 +1,162 @@
+/**************************************************************************
+ *
+ * Copyright 2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "gallivm/lp_bld.h"
+#include "gallivm/lp_bld_printf.h"
+
+#include <llvm-c/Analysis.h>
+#include <llvm-c/ExecutionEngine.h>
+#include <llvm-c/Target.h>
+#include <llvm-c/Transforms/Scalar.h>
+
+#include "lp_test.h"
+
+
+struct printf_test_case {
+};
+
+void
+write_tsv_header(FILE *fp)
+{
+ fprintf(fp,
+ "result\t"
+ "format\n");
+
+ fflush(fp);
+}
+
+
+
+typedef void (*test_printf_t)(int i);
+
+static LLVMValueRef
+add_printf_test(LLVMModuleRef module)
+{
+ LLVMTypeRef args[1] = { LLVMIntType(32) };
+ LLVMValueRef func = LLVMAddFunction(module, "test_printf", LLVMFunctionType(LLVMVoidType(), args, 1, 0));
+ LLVMBuilderRef builder = LLVMCreateBuilder();
+ LLVMBasicBlockRef block = LLVMAppendBasicBlock(func, "entry");
+
+ LLVMSetFunctionCallConv(func, LLVMCCallConv);
+
+ LLVMPositionBuilderAtEnd(builder, block);
+ lp_build_printf(builder, "hello, world\n");
+ lp_build_printf(builder, "print 5 6: %d %d\n", LLVMConstInt(LLVMInt32Type(), 5, 0),
+ LLVMConstInt(LLVMInt32Type(), 6, 0));
+ LLVMBuildRetVoid(builder);
+ LLVMDisposeBuilder(builder);
+ return func;
+}
+
+
+PIPE_ALIGN_STACK
+static boolean
+test_printf(unsigned verbose, FILE *fp, const struct printf_test_case *testcase)
+{
+ LLVMModuleRef module = NULL;
+ LLVMValueRef test = NULL;
+ LLVMExecutionEngineRef engine = NULL;
+ LLVMModuleProviderRef provider = NULL;
+ LLVMPassManagerRef pass = NULL;
+ char *error = NULL;
+ test_printf_t test_printf;
+ float unpacked[4];
+ unsigned packed;
+ boolean success = TRUE;
+
+ module = LLVMModuleCreateWithName("test");
+
+ test = add_printf_test(module);
+
+ if(LLVMVerifyModule(module, LLVMPrintMessageAction, &error)) {
+ LLVMDumpModule(module);
+ abort();
+ }
+ LLVMDisposeMessage(error);
+
+ provider = LLVMCreateModuleProviderForExistingModule(module);
+ if (LLVMCreateJITCompiler(&engine, provider, 1, &error)) {
+ fprintf(stderr, "%s\n", error);
+ LLVMDisposeMessage(error);
+ abort();
+ }
+
+#if 0
+ pass = LLVMCreatePassManager();
+ LLVMAddTargetData(LLVMGetExecutionEngineTargetData(engine), pass);
+ /* These are the passes currently listed in llvm-c/Transforms/Scalar.h,
+ * but there are more on SVN. */
+ LLVMAddConstantPropagationPass(pass);
+ LLVMAddInstructionCombiningPass(pass);
+ LLVMAddPromoteMemoryToRegisterPass(pass);
+ LLVMAddGVNPass(pass);
+ LLVMAddCFGSimplificationPass(pass);
+ LLVMRunPassManager(pass, module);
+#else
+ (void)pass;
+#endif
+
+ test_printf = (test_printf_t)LLVMGetPointerToGlobal(engine, test);
+
+ memset(unpacked, 0, sizeof unpacked);
+ packed = 0;
+
+
+ // LLVMDumpModule(module);
+
+ test_printf(0);
+
+ LLVMFreeMachineCodeForFunction(engine, test);
+
+ LLVMDisposeExecutionEngine(engine);
+ if(pass)
+ LLVMDisposePassManager(pass);
+
+ return success;
+}
+
+
+boolean
+test_all(unsigned verbose, FILE *fp)
+{
+ bool success = TRUE;
+
+ test_printf(verbose, fp, NULL);
+
+ return success;
+}
+
+
+boolean
+test_some(unsigned verbose, FILE *fp, unsigned long n)
+{
+ return test_all(verbose, fp);
+}
diff --git a/src/gallium/drivers/llvmpipe/lp_tex_sample.h b/src/gallium/drivers/llvmpipe/lp_tex_sample.h
index cb59a94464..1228a831f3 100644
--- a/src/gallium/drivers/llvmpipe/lp_tex_sample.h
+++ b/src/gallium/drivers/llvmpipe/lp_tex_sample.h
@@ -29,7 +29,7 @@
#define LP_TEX_SAMPLE_H
-#include <llvm-c/Core.h>
+#include "gallivm/lp_bld.h"
struct lp_sampler_static_state;
diff --git a/src/gallium/drivers/llvmpipe/lp_tex_sample_llvm.c b/src/gallium/drivers/llvmpipe/lp_tex_sample_llvm.c
index 632462460a..4715cfe4f6 100644
--- a/src/gallium/drivers/llvmpipe/lp_tex_sample_llvm.c
+++ b/src/gallium/drivers/llvmpipe/lp_tex_sample_llvm.c
@@ -51,10 +51,11 @@
/**
- * This provides the bridge between the sampler state store in lp_jit_context
- * and lp_jit_texture and the sampler code generator. It provides the
- * texture layout information required by the texture sampler code generator
- * in terms of the state stored in lp_jit_context and lp_jit_texture in runtime.
+ * This provides the bridge between the sampler state store in
+ * lp_jit_context and lp_jit_texture and the sampler code
+ * generator. It provides the texture layout information required by
+ * the texture sampler code generator in terms of the state stored in
+ * lp_jit_context and lp_jit_texture in runtime.
*/
struct llvmpipe_sampler_dynamic_state
{
@@ -79,6 +80,9 @@ struct lp_llvm_sampler_soa
/**
* Fetch the specified member of the lp_jit_texture structure.
+ * \param emit_load if TRUE, emit the LLVM load instruction to actually
+ * fetch the field's value. Otherwise, just emit the
+ * GEP code to address the field.
*
* @sa http://llvm.org/docs/GetElementPtr.html
*/
@@ -87,9 +91,11 @@ lp_llvm_texture_member(struct lp_sampler_dynamic_state *base,
LLVMBuilderRef builder,
unsigned unit,
unsigned member_index,
- const char *member_name)
+ const char *member_name,
+ boolean emit_load)
{
- struct llvmpipe_sampler_dynamic_state *state = (struct llvmpipe_sampler_dynamic_state *)base;
+ struct llvmpipe_sampler_dynamic_state *state =
+ (struct llvmpipe_sampler_dynamic_state *)base;
LLVMValueRef indices[4];
LLVMValueRef ptr;
LLVMValueRef res;
@@ -99,7 +105,7 @@ lp_llvm_texture_member(struct lp_sampler_dynamic_state *base,
/* context[0] */
indices[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
/* context[0].textures */
- indices[1] = LLVMConstInt(LLVMInt32Type(), LP_JIT_CONTEXT_TEXTURES_INDEX, 0);
+ indices[1] = LLVMConstInt(LLVMInt32Type(), LP_JIT_CTX_TEXTURES, 0);
/* context[0].textures[unit] */
indices[2] = LLVMConstInt(LLVMInt32Type(), unit, 0);
/* context[0].textures[unit].member */
@@ -107,7 +113,10 @@ lp_llvm_texture_member(struct lp_sampler_dynamic_state *base,
ptr = LLVMBuildGEP(builder, state->context_ptr, indices, Elements(indices), "");
- res = LLVMBuildLoad(builder, ptr, "");
+ if (emit_load)
+ res = LLVMBuildLoad(builder, ptr, "");
+ else
+ res = ptr;
lp_build_name(res, "context.texture%u.%s", unit, member_name);
@@ -116,28 +125,30 @@ lp_llvm_texture_member(struct lp_sampler_dynamic_state *base,
/**
- * Helper macro to instantiate the functions that generate the code to fetch
- * the members of lp_jit_texture to fulfill the sampler code generator requests.
+ * Helper macro to instantiate the functions that generate the code to
+ * fetch the members of lp_jit_texture to fulfill the sampler code
+ * generator requests.
*
- * This complexity is the price we have to pay to keep the texture sampler code
- * generator a reusable module without dependencies to llvmpipe internals.
+ * This complexity is the price we have to pay to keep the texture
+ * sampler code generator a reusable module without dependencies to
+ * llvmpipe internals.
*/
-#define LP_LLVM_TEXTURE_MEMBER(_name, _index) \
+#define LP_LLVM_TEXTURE_MEMBER(_name, _index, _emit_load) \
static LLVMValueRef \
lp_llvm_texture_##_name( struct lp_sampler_dynamic_state *base, \
LLVMBuilderRef builder, \
unsigned unit) \
{ \
- return lp_llvm_texture_member(base, builder, unit, _index, #_name ); \
+ return lp_llvm_texture_member(base, builder, unit, _index, #_name, _emit_load ); \
}
-LP_LLVM_TEXTURE_MEMBER(width, LP_JIT_TEXTURE_WIDTH)
-LP_LLVM_TEXTURE_MEMBER(height, LP_JIT_TEXTURE_HEIGHT)
-LP_LLVM_TEXTURE_MEMBER(depth, LP_JIT_TEXTURE_DEPTH)
-LP_LLVM_TEXTURE_MEMBER(last_level, LP_JIT_TEXTURE_LAST_LEVEL)
-LP_LLVM_TEXTURE_MEMBER(stride, LP_JIT_TEXTURE_STRIDE)
-LP_LLVM_TEXTURE_MEMBER(data_ptr, LP_JIT_TEXTURE_DATA)
+LP_LLVM_TEXTURE_MEMBER(width, LP_JIT_TEXTURE_WIDTH, TRUE)
+LP_LLVM_TEXTURE_MEMBER(height, LP_JIT_TEXTURE_HEIGHT, TRUE)
+LP_LLVM_TEXTURE_MEMBER(depth, LP_JIT_TEXTURE_DEPTH, TRUE)
+LP_LLVM_TEXTURE_MEMBER(last_level, LP_JIT_TEXTURE_LAST_LEVEL, TRUE)
+LP_LLVM_TEXTURE_MEMBER(row_stride, LP_JIT_TEXTURE_ROW_STRIDE, FALSE)
+LP_LLVM_TEXTURE_MEMBER(data_ptr, LP_JIT_TEXTURE_DATA, FALSE)
static void
@@ -193,7 +204,7 @@ lp_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state,
sampler->dynamic_state.base.height = lp_llvm_texture_height;
sampler->dynamic_state.base.depth = lp_llvm_texture_depth;
sampler->dynamic_state.base.last_level = lp_llvm_texture_last_level;
- sampler->dynamic_state.base.stride = lp_llvm_texture_stride;
+ sampler->dynamic_state.base.row_stride = lp_llvm_texture_row_stride;
sampler->dynamic_state.base.data_ptr = lp_llvm_texture_data_ptr;
sampler->dynamic_state.static_state = static_state;
sampler->dynamic_state.context_ptr = context_ptr;
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index 7f45635542..8137f29af5 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.c
+++ b/src/gallium/drivers/llvmpipe/lp_texture.c
@@ -40,9 +40,10 @@
#include "lp_context.h"
#include "lp_screen.h"
+#include "lp_flush.h"
#include "lp_texture.h"
#include "lp_tile_size.h"
-#include "lp_winsys.h"
+#include "state_tracker/sw_winsys.h"
/**
@@ -93,7 +94,7 @@ static boolean
llvmpipe_displaytarget_layout(struct llvmpipe_screen *screen,
struct llvmpipe_texture *lpt)
{
- struct llvmpipe_winsys *winsys = screen->winsys;
+ struct sw_winsys *winsys = screen->winsys;
/* Round up the surface size to a multiple of the tile size to
* avoid tile clipping.
@@ -102,6 +103,7 @@ llvmpipe_displaytarget_layout(struct llvmpipe_screen *screen,
unsigned height = align(lpt->base.height0, TILE_SIZE);
lpt->dt = winsys->displaytarget_create(winsys,
+ lpt->base.tex_usage,
lpt->base.format,
width, height,
16,
@@ -125,7 +127,8 @@ llvmpipe_texture_create(struct pipe_screen *_screen,
lpt->base.screen = &screen->base;
if (lpt->base.tex_usage & (PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
- PIPE_TEXTURE_USAGE_PRIMARY)) {
+ PIPE_TEXTURE_USAGE_SCANOUT |
+ PIPE_TEXTURE_USAGE_SHARED)) {
if (!llvmpipe_displaytarget_layout(screen, lpt))
goto fail;
}
@@ -142,60 +145,154 @@ llvmpipe_texture_create(struct pipe_screen *_screen,
}
-static struct pipe_texture *
-llvmpipe_texture_blanket(struct pipe_screen * screen,
- const struct pipe_texture *base,
- const unsigned *stride,
- struct pipe_buffer *buffer)
+static void
+llvmpipe_texture_destroy(struct pipe_texture *pt)
{
- /* FIXME */
-#if 0
- struct llvmpipe_texture *lpt;
- assert(screen);
+ struct llvmpipe_screen *screen = llvmpipe_screen(pt->screen);
+ struct llvmpipe_texture *lpt = llvmpipe_texture(pt);
- /* Only supports one type */
- if (base->target != PIPE_TEXTURE_2D ||
- base->last_level != 0 ||
- base->depth0 != 1) {
- return NULL;
+ if (lpt->dt) {
+ /* display target */
+ struct sw_winsys *winsys = screen->winsys;
+ winsys->displaytarget_destroy(winsys, lpt->dt);
+ }
+ else {
+ /* regular texture */
+ align_free(lpt->data);
+ }
+
+ FREE(lpt);
+}
+
+
+/**
+ * Map a texture. Without any synchronization.
+ */
+void *
+llvmpipe_texture_map(struct pipe_texture *texture,
+ unsigned face,
+ unsigned level,
+ unsigned zslice)
+{
+ struct llvmpipe_texture *lpt = llvmpipe_texture(texture);
+ uint8_t *map;
+
+ if (lpt->dt) {
+ /* display target */
+ struct llvmpipe_screen *screen = llvmpipe_screen(texture->screen);
+ struct sw_winsys *winsys = screen->winsys;
+ const unsigned usage = PIPE_BUFFER_USAGE_CPU_READ_WRITE;
+
+ assert(face == 0);
+ assert(level == 0);
+ assert(zslice == 0);
+
+ /* FIXME: keep map count? */
+ map = winsys->displaytarget_map(winsys, lpt->dt, usage);
}
+ else {
+ /* regular texture */
+ unsigned offset;
+ unsigned stride;
+
+ map = lpt->data;
+
+ assert(level < LP_MAX_TEXTURE_2D_LEVELS);
+
+ offset = lpt->level_offset[level];
+ stride = lpt->stride[level];
+
+ /* XXX shouldn't that rather be
+ tex_height = align(u_minify(texture->height0, level), 2)
+ to account for alignment done in llvmpipe_texture_layout ?
+ */
+ if (texture->target == PIPE_TEXTURE_CUBE) {
+ unsigned tex_height = u_minify(texture->height0, level);
+ offset += face * util_format_get_nblocksy(texture->format, tex_height) * stride;
+ }
+ else if (texture->target == PIPE_TEXTURE_3D) {
+ unsigned tex_height = u_minify(texture->height0, level);
+ offset += zslice * util_format_get_nblocksy(texture->format, tex_height) * stride;
+ }
+ else {
+ assert(face == 0);
+ assert(zslice == 0);
+ }
+
+ map += offset;
+ }
+
+ return map;
+}
+
+
+/**
+ * Unmap a texture. Without any synchronization.
+ */
+void
+llvmpipe_texture_unmap(struct pipe_texture *texture,
+ unsigned face,
+ unsigned level,
+ unsigned zslice)
+{
+ struct llvmpipe_texture *lpt = llvmpipe_texture(texture);
+
+ if (lpt->dt) {
+ /* display target */
+ struct llvmpipe_screen *lp_screen = llvmpipe_screen(texture->screen);
+ struct sw_winsys *winsys = lp_screen->winsys;
+
+ assert(face == 0);
+ assert(level == 0);
+ assert(zslice == 0);
+
+ winsys->displaytarget_unmap(winsys, lpt->dt);
+ }
+}
- lpt = CALLOC_STRUCT(llvmpipe_texture);
+
+static struct pipe_texture *
+llvmpipe_texture_from_handle(struct pipe_screen *screen,
+ const struct pipe_texture *template,
+ struct winsys_handle *whandle)
+{
+ struct sw_winsys *winsys = llvmpipe_screen(screen)->winsys;
+ struct llvmpipe_texture *lpt = CALLOC_STRUCT(llvmpipe_texture);
if (!lpt)
return NULL;
- lpt->base = *base;
+ lpt->base = *template;
pipe_reference_init(&lpt->base.reference, 1);
lpt->base.screen = screen;
- lpt->stride[0] = stride[0];
- pipe_buffer_reference(&lpt->buffer, buffer);
+ lpt->dt = winsys->displaytarget_from_handle(winsys,
+ template,
+ whandle,
+ &lpt->stride[0]);
+ if (!lpt->dt)
+ goto fail;
return &lpt->base;
-#else
- debug_printf("llvmpipe_texture_blanket() not implemented!");
+
+ fail:
+ FREE(lpt);
return NULL;
-#endif
}
-static void
-llvmpipe_texture_destroy(struct pipe_texture *pt)
+static boolean
+llvmpipe_texture_get_handle(struct pipe_screen *screen,
+ struct pipe_texture *pt,
+ struct winsys_handle *whandle)
{
- struct llvmpipe_screen *screen = llvmpipe_screen(pt->screen);
+ struct sw_winsys *winsys = llvmpipe_screen(screen)->winsys;
struct llvmpipe_texture *lpt = llvmpipe_texture(pt);
- if (lpt->dt) {
- /* display target */
- struct llvmpipe_winsys *winsys = screen->winsys;
- winsys->displaytarget_destroy(winsys, lpt->dt);
- }
- else {
- /* regular texture */
- align_free(lpt->data);
- }
+ assert(lpt->dt);
+ if (!lpt->dt)
+ return FALSE;
- FREE(lpt);
+ return winsys->displaytarget_get_handle(winsys, lpt->dt, whandle);
}
@@ -217,7 +314,6 @@ llvmpipe_get_tex_surface(struct pipe_screen *screen,
ps->format = pt->format;
ps->width = u_minify(pt->width0, level);
ps->height = u_minify(pt->height0, level);
- ps->offset = lpt->level_offset[level];
ps->usage = usage;
/* Because we are llvmpipe, anything that the state tracker
@@ -243,23 +339,6 @@ llvmpipe_get_tex_surface(struct pipe_screen *screen,
ps->face = face;
ps->level = level;
ps->zslice = zslice;
-
- /* XXX shouldn't that rather be
- tex_height = align(ps->height, 2);
- to account for alignment done in llvmpipe_texture_layout ?
- */
- if (pt->target == PIPE_TEXTURE_CUBE) {
- unsigned tex_height = ps->height;
- ps->offset += face * util_format_get_nblocksy(pt->format, tex_height) * lpt->stride[level];
- }
- else if (pt->target == PIPE_TEXTURE_3D) {
- unsigned tex_height = ps->height;
- ps->offset += zslice * util_format_get_nblocksy(pt->format, tex_height) * lpt->stride[level];
- }
- else {
- assert(face == 0);
- assert(zslice == 0);
- }
}
return ps;
}
@@ -279,7 +358,7 @@ llvmpipe_tex_surface_destroy(struct pipe_surface *surf)
static struct pipe_transfer *
-llvmpipe_get_tex_transfer(struct pipe_screen *screen,
+llvmpipe_get_tex_transfer(struct pipe_context *pipe,
struct pipe_texture *texture,
unsigned face, unsigned level, unsigned zslice,
enum pipe_transfer_usage usage,
@@ -305,24 +384,6 @@ llvmpipe_get_tex_transfer(struct pipe_screen *screen,
pt->level = level;
pt->zslice = zslice;
- lpt->offset = lptex->level_offset[level];
-
- /* XXX shouldn't that rather be
- tex_height = align(u_minify(texture->height0, level), 2)
- to account for alignment done in llvmpipe_texture_layout ?
- */
- if (texture->target == PIPE_TEXTURE_CUBE) {
- unsigned tex_height = u_minify(texture->height0, level);
- lpt->offset += face * util_format_get_nblocksy(texture->format, tex_height) * pt->stride;
- }
- else if (texture->target == PIPE_TEXTURE_3D) {
- unsigned tex_height = u_minify(texture->height0, level);
- lpt->offset += zslice * util_format_get_nblocksy(texture->format, tex_height) * pt->stride;
- }
- else {
- assert(face == 0);
- assert(zslice == 0);
- }
return pt;
}
return NULL;
@@ -330,7 +391,8 @@ llvmpipe_get_tex_transfer(struct pipe_screen *screen,
static void
-llvmpipe_tex_transfer_destroy(struct pipe_transfer *transfer)
+llvmpipe_tex_transfer_destroy(struct pipe_context *pipe,
+ struct pipe_transfer *transfer)
{
/* Effectively do the texture_update work here - if texture images
* needed post-processing to put them into hardware layout, this is
@@ -343,11 +405,11 @@ llvmpipe_tex_transfer_destroy(struct pipe_transfer *transfer)
static void *
-llvmpipe_transfer_map( struct pipe_screen *_screen,
+llvmpipe_transfer_map( struct pipe_context *pipe,
struct pipe_transfer *transfer )
{
- struct llvmpipe_screen *screen = llvmpipe_screen(_screen);
- ubyte *map, *xfer_map;
+ struct llvmpipe_screen *screen = llvmpipe_screen(pipe->screen);
+ ubyte *map;
struct llvmpipe_texture *lpt;
enum pipe_format format;
@@ -355,52 +417,45 @@ llvmpipe_transfer_map( struct pipe_screen *_screen,
lpt = llvmpipe_texture(transfer->texture);
format = lpt->base.format;
- if (lpt->dt) {
- /* display target */
- struct llvmpipe_winsys *winsys = screen->winsys;
+ /*
+ * Transfers, like other pipe operations, must happen in order, so flush the
+ * context if necessary.
+ */
+ llvmpipe_flush_texture(pipe,
+ transfer->texture, transfer->face, transfer->level,
+ 0, /* flush_flags */
+ !(transfer->usage & PIPE_TRANSFER_WRITE), /* read_only */
+ TRUE, /* cpu_access */
+ FALSE); /* do_not_flush */
- map = winsys->displaytarget_map(winsys, lpt->dt,
- pipe_transfer_buffer_flags(transfer));
- if (map == NULL)
- return NULL;
- }
- else {
- /* regular texture */
- map = lpt->data;
- }
+ map = llvmpipe_texture_map(transfer->texture,
+ transfer->face, transfer->level, transfer->zslice);
/* May want to different things here depending on read/write nature
* of the map:
*/
- if (transfer->texture && (transfer->usage & PIPE_TRANSFER_WRITE)) {
+ if (transfer->usage & PIPE_TRANSFER_WRITE) {
/* Do something to notify sharing contexts of a texture change.
*/
screen->timestamp++;
}
- xfer_map = map + llvmpipe_transfer(transfer)->offset +
+ map +=
transfer->y / util_format_get_blockheight(format) * transfer->stride +
transfer->x / util_format_get_blockwidth(format) * util_format_get_blocksize(format);
- /*printf("map = %p xfer map = %p\n", map, xfer_map);*/
- return xfer_map;
+
+ return map;
}
static void
-llvmpipe_transfer_unmap(struct pipe_screen *screen,
- struct pipe_transfer *transfer)
+llvmpipe_transfer_unmap(struct pipe_context *pipe,
+ struct pipe_transfer *transfer)
{
- struct llvmpipe_screen *lp_screen = llvmpipe_screen(screen);
- struct llvmpipe_texture *lpt;
-
assert(transfer->texture);
- lpt = llvmpipe_texture(transfer->texture);
- if (lpt->dt) {
- /* display target */
- struct llvmpipe_winsys *winsys = lp_screen->winsys;
- winsys->displaytarget_unmap(winsys, lpt->dt);
- }
+ llvmpipe_texture_unmap(transfer->texture,
+ transfer->face, transfer->level, transfer->zslice);
}
@@ -408,14 +463,20 @@ void
llvmpipe_init_screen_texture_funcs(struct pipe_screen *screen)
{
screen->texture_create = llvmpipe_texture_create;
- screen->texture_blanket = llvmpipe_texture_blanket;
screen->texture_destroy = llvmpipe_texture_destroy;
+ screen->texture_from_handle = llvmpipe_texture_from_handle;
+ screen->texture_get_handle = llvmpipe_texture_get_handle;
screen->get_tex_surface = llvmpipe_get_tex_surface;
screen->tex_surface_destroy = llvmpipe_tex_surface_destroy;
+}
+
- screen->get_tex_transfer = llvmpipe_get_tex_transfer;
- screen->tex_transfer_destroy = llvmpipe_tex_transfer_destroy;
- screen->transfer_map = llvmpipe_transfer_map;
- screen->transfer_unmap = llvmpipe_transfer_unmap;
+void
+llvmpipe_init_context_texture_funcs(struct pipe_context *pipe)
+{
+ pipe->get_tex_transfer = llvmpipe_get_tex_transfer;
+ pipe->tex_transfer_destroy = llvmpipe_tex_transfer_destroy;
+ pipe->transfer_map = llvmpipe_transfer_map;
+ pipe->transfer_unmap = llvmpipe_transfer_unmap;
}
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.h b/src/gallium/drivers/llvmpipe/lp_texture.h
index 87c905bc02..49623949bf 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.h
+++ b/src/gallium/drivers/llvmpipe/lp_texture.h
@@ -32,24 +32,29 @@
#include "pipe/p_state.h"
+#define LP_MAX_TEXTURE_2D_LEVELS 12 /* 2K x 2K for now */
+#define LP_MAX_TEXTURE_3D_LEVELS 10 /* 512 x 512 x 512 for now */
+
+
struct pipe_context;
struct pipe_screen;
struct llvmpipe_context;
-struct llvmpipe_displaytarget;
+
+struct sw_displaytarget;
struct llvmpipe_texture
{
struct pipe_texture base;
- unsigned long level_offset[PIPE_MAX_TEXTURE_LEVELS];
- unsigned stride[PIPE_MAX_TEXTURE_LEVELS];
+ unsigned long level_offset[LP_MAX_TEXTURE_2D_LEVELS];
+ unsigned stride[LP_MAX_TEXTURE_2D_LEVELS];
/**
* Display target, for textures with the PIPE_TEXTURE_USAGE_DISPLAY_TARGET
* usage.
*/
- struct llvmpipe_displaytarget *dt;
+ struct sw_displaytarget *dt;
/**
* Malloc'ed data for regular textures, or a mapping to dt above.
@@ -90,8 +95,32 @@ llvmpipe_transfer(struct pipe_transfer *pt)
}
+static INLINE unsigned
+llvmpipe_texture_stride(struct pipe_texture *texture,
+ unsigned level)
+{
+ struct llvmpipe_texture *lpt = llvmpipe_texture(texture);
+ assert(level < LP_MAX_TEXTURE_2D_LEVELS);
+ return lpt->stride[level];
+}
+
+
+void *
+llvmpipe_texture_map(struct pipe_texture *texture,
+ unsigned face,
+ unsigned level,
+ unsigned zslice);
+
+void
+llvmpipe_texture_unmap(struct pipe_texture *texture,
+ unsigned face,
+ unsigned level,
+ unsigned zslice);
+
extern void
llvmpipe_init_screen_texture_funcs(struct pipe_screen *screen);
+extern void
+llvmpipe_init_context_texture_funcs(struct pipe_context *pipe);
#endif /* LP_TEXTURE_H */
diff --git a/src/gallium/drivers/llvmpipe/lp_tile_soa.py b/src/gallium/drivers/llvmpipe/lp_tile_soa.py
index 00b8d4fc38..c1226e499c 100644
--- a/src/gallium/drivers/llvmpipe/lp_tile_soa.py
+++ b/src/gallium/drivers/llvmpipe/lp_tile_soa.py
@@ -42,7 +42,29 @@ import os.path
sys.path.insert(0, os.path.join(os.path.dirname(sys.argv[0]), '../../auxiliary/util'))
-from u_format_access import *
+from u_format_pack import *
+
+
+def is_format_supported(format):
+ '''Determines whether we actually have the plumbing necessary to generate the
+ to read/write to/from this format.'''
+
+ # FIXME: Ideally we would support any format combination here.
+
+ if format.layout != PLAIN:
+ return False
+
+ for i in range(4):
+ channel = format.channels[i]
+ if channel.type not in (VOID, UNSIGNED, SIGNED, FLOAT):
+ return False
+ if channel.type == FLOAT and channel.size not in (32 ,64):
+ return False
+
+ if format.colorspace not in ('rgb', 'srgb'):
+ return False
+
+ return True
def generate_format_read(format, dst_channel, dst_native_type, dst_suffix):
@@ -62,7 +84,7 @@ def generate_format_read(format, dst_channel, dst_native_type, dst_suffix):
print ' for (x = 0; x < w; ++x) {'
names = ['']*4
- if format.colorspace == 'rgb':
+ if format.colorspace in ('rgb', 'srgb'):
for i in range(4):
swizzle = format.swizzles[i]
if swizzle < 4:
@@ -95,16 +117,21 @@ def generate_format_read(format, dst_channel, dst_native_type, dst_suffix):
shift += width
else:
for i in range(4):
+ if names[i]:
+ print ' %s %s;' % (dst_native_type, names[i])
+ for i in range(4):
src_channel = format.channels[i]
if names[i]:
value = '(*src_pixel++)'
value = conversion_expr(src_channel, dst_channel, dst_native_type, value, clamp=False)
- print ' %s %s = %s;' % (dst_native_type, names[i], value)
+ print ' %s = %s;' % (names[i], value)
+ elif src_channel.size:
+ print ' ++src_pixel;'
else:
assert False
for i in range(4):
- if format.colorspace == 'rgb':
+ if format.colorspace in ('rgb', 'srgb'):
swizzle = format.swizzles[i]
if swizzle < 4:
value = names[swizzle]
@@ -134,7 +161,7 @@ def pack_rgba(format, src_channel, r, g, b, a):
"""Return an expression for packing r, g, b, a into a pixel of the
given format. Ex: '(b << 24) | (g << 16) | (r << 8) | (a << 0)'
"""
- assert format.colorspace == 'rgb'
+ assert format.colorspace in ('rgb', 'srgb')
inv_swizzle = format.inv_swizzles()
shift = 0
expr = None
@@ -230,6 +257,8 @@ def emit_tile_pixel_write_code(format, src_channel):
value = 'TILE_PIXEL(src, x, y, %u)' % inv_swizzle[i]
value = conversion_expr(src_channel, dst_channel, dst_native_type, value, clamp=False)
print ' *dst_pixel++ = %s;' % value
+ else:
+ print ' ++dst_pixel;'
else:
assert False
@@ -251,7 +280,8 @@ def generate_format_write(format, src_channel, src_native_type, src_suffix):
and format.block_size() <= 32 \
and format.is_pot() \
and not format.is_mixed() \
- and format.channels[0].type == UNSIGNED:
+ and (format.channels[0].type == UNSIGNED \
+ or format.channels[1].type == UNSIGNED):
emit_unrolled_write_code(format, src_channel)
else:
emit_tile_pixel_write_code(format, src_channel)
@@ -277,7 +307,7 @@ def generate_read(formats, dst_channel, dst_native_type, dst_suffix):
print ' func = &lp_tile_%s_read_%s;' % (format.short_name(), dst_suffix)
print ' break;'
print ' default:'
- print ' debug_printf("unsupported format\\n");'
+ print ' debug_printf("%s: unsupported format %s\\n", __FUNCTION__, util_format_name(format));'
print ' return;'
print ' }'
print ' func(dst, (const uint8_t *)src, src_stride, x, y, w, h);'
@@ -304,7 +334,7 @@ def generate_write(formats, src_channel, src_native_type, src_suffix):
print ' func = &lp_tile_%s_write_%s;' % (format.short_name(), src_suffix)
print ' break;'
print ' default:'
- print ' debug_printf("unsupported format\\n");'
+ print ' debug_printf("%s: unsupported format %s\\n", __FUNCTION__, util_format_name(format));'
print ' return;'
print ' }'
print ' func(src, (uint8_t *)dst, dst_stride, x, y, w, h);'
@@ -325,6 +355,7 @@ def main():
print '#include "pipe/p_compiler.h"'
print '#include "util/u_format.h"'
print '#include "util/u_math.h"'
+ print '#include "util/u_half.h"'
print '#include "lp_tile_soa.h"'
print
print 'const unsigned char'
@@ -349,8 +380,6 @@ def main():
print '};'
print
- generate_clamp()
-
channel = Channel(UNSIGNED, True, 8)
native_type = 'uint8_t'
suffix = '4ub'
diff --git a/src/gallium/drivers/nouveau/Makefile b/src/gallium/drivers/nouveau/Makefile
index 0e02680bc6..0cb66041d5 100644
--- a/src/gallium/drivers/nouveau/Makefile
+++ b/src/gallium/drivers/nouveau/Makefile
@@ -4,7 +4,6 @@ include $(TOP)/configs/current
LIBNAME = nouveau
C_SOURCES = nouveau_screen.c \
- nouveau_context.c \
- nv04_surface_2d.c
+ nouveau_context.c
include ../../Makefile.template
diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c
index 3c2f771b51..b1ad686022 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.c
+++ b/src/gallium/drivers/nouveau/nouveau_screen.c
@@ -4,6 +4,7 @@
#include "util/u_memory.h"
#include "util/u_inlines.h"
+#include "util/u_format.h"
#include <stdio.h>
#include <errno.h>
@@ -12,6 +13,9 @@
#include "nouveau_winsys.h"
#include "nouveau_screen.h"
+/* XXX this should go away */
+#include "state_tracker/drm_api.h"
+
static const char *
nouveau_screen_get_name(struct pipe_screen *pscreen)
{
@@ -120,7 +124,7 @@ nouveau_screen_map_flags(unsigned pipe)
if (pipe & PIPE_BUFFER_USAGE_DONTBLOCK)
flags |= NOUVEAU_BO_NOWAIT;
else
- if (pipe & 0 /*PIPE_BUFFER_USAGE_UNSYNCHRONIZED*/)
+ if (pipe & PIPE_BUFFER_USAGE_UNSYNCHRONIZED)
flags |= NOUVEAU_BO_NOSYNC;
return flags;
@@ -231,6 +235,72 @@ nouveau_screen_fence_finish(struct pipe_screen *screen,
return 0;
}
+
+/*
+ * Both texture_{from|get}_handle use drm api defines directly which they
+ * shouldn't do. The problem is that from|get are pipe functions and as
+ * such they should be defined in the pipe level. If nouveau had a propper
+ * winsys interface we would have added from|get to that interface using
+ * the winsys_handle struct as done with other drivers. However this code
+ * calls directly into the libdrm_nouveau.so functions (nouveau_bo_*). So
+ * we need to translate the handle into something they understand.
+ */
+static struct pipe_texture *
+nouveau_screen_texture_from_handle(struct pipe_screen *pscreen,
+ const struct pipe_texture *templ,
+ struct winsys_handle *whandle)
+{
+ struct nouveau_device *dev = nouveau_screen(pscreen)->device;
+ struct pipe_texture *pt;
+ struct pipe_buffer *pb;
+ int ret;
+
+ pb = CALLOC(1, sizeof(struct pipe_buffer) + sizeof(struct nouveau_bo*));
+ if (!pb)
+ return NULL;
+
+ ret = nouveau_bo_handle_ref(dev, whandle->handle, (struct nouveau_bo**)(pb+1));
+ if (ret) {
+ debug_printf("%s: ref name 0x%08x failed with %d\n",
+ __func__, whandle->handle, ret);
+ FREE(pb);
+ return NULL;
+ }
+
+ pipe_reference_init(&pb->reference, 1);
+ pb->screen = pscreen;
+ pb->alignment = 0;
+ pb->usage = PIPE_BUFFER_USAGE_GPU_READ_WRITE |
+ PIPE_BUFFER_USAGE_CPU_READ_WRITE;
+ pb->size = nouveau_bo(pb)->size;
+ pt = nouveau_screen(pscreen)->texture_blanket(pscreen, templ,
+ &whandle->stride, pb);
+ pipe_buffer_reference(&pb, NULL);
+ return pt;
+}
+
+static boolean
+nouveau_screen_texture_get_handle(struct pipe_screen *pscreen,
+ struct pipe_texture *pt,
+ struct winsys_handle *whandle)
+{
+ struct nouveau_miptree *mt = nouveau_miptree(pt);
+
+ if (!mt || !mt->bo)
+ return false;
+
+ whandle->stride = util_format_get_stride(mt->base.format, mt->base.width0);
+
+ if (whandle->type == DRM_API_HANDLE_TYPE_SHARED) {
+ return nouveau_bo_handle_get(mt->bo, &whandle->handle) == 0;
+ } else if (whandle->type == DRM_API_HANDLE_TYPE_KMS) {
+ whandle->handle = mt->bo->handle;
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
+
int
nouveau_screen_init(struct nouveau_screen *screen, struct nouveau_device *dev)
{
@@ -258,6 +328,9 @@ nouveau_screen_init(struct nouveau_screen *screen, struct nouveau_device *dev)
pscreen->fence_signalled = nouveau_screen_fence_signalled;
pscreen->fence_finish = nouveau_screen_fence_finish;
+ pscreen->texture_from_handle = nouveau_screen_texture_from_handle;
+ pscreen->texture_get_handle = nouveau_screen_texture_get_handle;
+
return 0;
}
diff --git a/src/gallium/drivers/nouveau/nouveau_screen.h b/src/gallium/drivers/nouveau/nouveau_screen.h
index a7927d88df..f4a7a2bc23 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.h
+++ b/src/gallium/drivers/nouveau/nouveau_screen.h
@@ -6,6 +6,18 @@ struct nouveau_screen {
struct nouveau_device *device;
struct nouveau_channel *channel;
+ /**
+ * Create a new texture object, using the given template info, but on top of
+ * existing memory.
+ *
+ * It is assumed that the buffer data is layed out according to the expected
+ * by the hardware. NULL will be returned if any inconsistency is found.
+ */
+ struct pipe_texture * (*texture_blanket)(struct pipe_screen *,
+ const struct pipe_texture *templat,
+ const unsigned *stride,
+ struct pipe_buffer *buffer);
+
int (*pre_pipebuffer_map_callback) (struct pipe_screen *pscreen,
struct pipe_buffer *pb, unsigned usage);
};
diff --git a/src/gallium/drivers/nouveau/nouveau_util.h b/src/gallium/drivers/nouveau/nouveau_util.h
index a10114beab..ab7761a31d 100644
--- a/src/gallium/drivers/nouveau/nouveau_util.h
+++ b/src/gallium/drivers/nouveau/nouveau_util.h
@@ -33,7 +33,7 @@ nouveau_vbuf_split(unsigned remaining, unsigned overhead, unsigned vpp,
max = max - (max % 3);
break;
case PIPE_PRIM_QUADS:
- max = max & 3;
+ max = max & ~3;
break;
case PIPE_PRIM_LINE_LOOP:
case PIPE_PRIM_LINE_STRIP:
@@ -88,4 +88,104 @@ static INLINE unsigned log2i(unsigned i)
return r;
}
+struct u_split_prim {
+ void *priv;
+ void (*emit)(void *priv, unsigned start, unsigned count);
+ void (*edge)(void *priv, boolean enabled);
+
+ unsigned mode;
+ unsigned start;
+ unsigned p_start;
+ unsigned p_end;
+
+ int repeat_first:1;
+ int close_first:1;
+ int edgeflag_off:1;
+};
+
+static inline void
+u_split_prim_init(struct u_split_prim *s,
+ unsigned mode, unsigned start, unsigned count)
+{
+ if (mode == PIPE_PRIM_LINE_LOOP) {
+ s->mode = PIPE_PRIM_LINE_STRIP;
+ s->close_first = 1;
+ } else {
+ s->mode = mode;
+ s->close_first = 0;
+ }
+ s->start = start;
+ s->p_start = start;
+ s->p_end = start + count;
+ s->edgeflag_off = 0;
+ s->repeat_first = 0;
+}
+
+static INLINE boolean
+u_split_prim_next(struct u_split_prim *s, unsigned max_verts)
+{
+ int repeat = 0;
+
+ if (s->repeat_first) {
+ s->emit(s->priv, s->start, 1);
+ max_verts--;
+ if (s->edgeflag_off) {
+ s->edge(s->priv, TRUE);
+ s->edgeflag_off = FALSE;
+ }
+ }
+
+ if (s->p_start + s->close_first + max_verts >= s->p_end) {
+ s->emit(s->priv, s->p_start, s->p_end - s->p_start);
+ if (s->close_first)
+ s->emit(s->priv, s->start, 1);
+ return TRUE;
+ }
+
+ switch (s->mode) {
+ case PIPE_PRIM_LINES:
+ max_verts &= ~1;
+ break;
+ case PIPE_PRIM_LINE_STRIP:
+ repeat = 1;
+ break;
+ case PIPE_PRIM_POLYGON:
+ max_verts--;
+ s->emit(s->priv, s->p_start, max_verts);
+ s->edge(s->priv, FALSE);
+ s->emit(s->priv, s->p_start + max_verts, 1);
+ s->p_start += max_verts;
+ s->repeat_first = TRUE;
+ s->edgeflag_off = TRUE;
+ return FALSE;
+ case PIPE_PRIM_TRIANGLES:
+ max_verts = max_verts - (max_verts % 3);
+ break;
+ case PIPE_PRIM_TRIANGLE_STRIP:
+ /* to ensure winding stays correct, always split
+ * on an even number of generated triangles
+ */
+ max_verts = max_verts & ~1;
+ repeat = 2;
+ break;
+ case PIPE_PRIM_TRIANGLE_FAN:
+ s->repeat_first = TRUE;
+ repeat = 1;
+ break;
+ case PIPE_PRIM_QUADS:
+ max_verts &= ~3;
+ break;
+ case PIPE_PRIM_QUAD_STRIP:
+ max_verts &= ~1;
+ repeat = 2;
+ break;
+ default:
+ break;
+ }
+
+ s->emit (s->priv, s->p_start, max_verts);
+ s->p_start += (max_verts - repeat);
+ return FALSE;
+}
+
#endif
diff --git a/src/gallium/drivers/nouveau/nouveau_winsys.h b/src/gallium/drivers/nouveau/nouveau_winsys.h
index af9ddd558c..bed014b9ce 100644
--- a/src/gallium/drivers/nouveau/nouveau_winsys.h
+++ b/src/gallium/drivers/nouveau/nouveau_winsys.h
@@ -27,10 +27,7 @@
#define NOUVEAU_BUFFER_USAGE_NO_RENDER (1 << 19)
extern struct pipe_screen *
-nv30_screen_create(struct pipe_winsys *ws, struct nouveau_device *);
-
-extern struct pipe_screen *
-nv40_screen_create(struct pipe_winsys *ws, struct nouveau_device *);
+nvfx_screen_create(struct pipe_winsys *ws, struct nouveau_device *);
extern struct pipe_screen *
nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *);
diff --git a/src/gallium/drivers/nv30/Makefile b/src/gallium/drivers/nv30/Makefile
deleted file mode 100644
index 364c80d8f3..0000000000
--- a/src/gallium/drivers/nv30/Makefile
+++ /dev/null
@@ -1,29 +0,0 @@
-TOP = ../../../..
-include $(TOP)/configs/current
-
-LIBNAME = nv30
-
-C_SOURCES = \
- nv30_clear.c \
- nv30_context.c \
- nv30_draw.c \
- nv30_fragprog.c \
- nv30_fragtex.c \
- nv30_miptree.c \
- nv30_query.c \
- nv30_screen.c \
- nv30_state.c \
- nv30_state_blend.c \
- nv30_state_emit.c \
- nv30_state_fb.c \
- nv30_state_rasterizer.c \
- nv30_state_scissor.c \
- nv30_state_stipple.c \
- nv30_state_viewport.c \
- nv30_state_zsa.c \
- nv30_surface.c \
- nv30_transfer.c \
- nv30_vbo.c \
- nv30_vertprog.c
-
-include ../../Makefile.template
diff --git a/src/gallium/drivers/nv30/nv30_context.c b/src/gallium/drivers/nv30/nv30_context.c
deleted file mode 100644
index 279b74445c..0000000000
--- a/src/gallium/drivers/nv30/nv30_context.c
+++ /dev/null
@@ -1,87 +0,0 @@
-#include "draw/draw_context.h"
-#include "pipe/p_defines.h"
-
-#include "nv30_context.h"
-#include "nv30_screen.h"
-
-static void
-nv30_flush(struct pipe_context *pipe, unsigned flags,
- struct pipe_fence_handle **fence)
-{
- struct nv30_context *nv30 = nv30_context(pipe);
- struct nv30_screen *screen = nv30->screen;
- struct nouveau_channel *chan = screen->base.channel;
- struct nouveau_grobj *rankine = screen->rankine;
-
- if (flags & PIPE_FLUSH_TEXTURE_CACHE) {
- BEGIN_RING(chan, rankine, 0x1fd8, 1);
- OUT_RING (chan, 2);
- BEGIN_RING(chan, rankine, 0x1fd8, 1);
- OUT_RING (chan, 1);
- }
-
- FIRE_RING(chan);
- if (fence)
- *fence = NULL;
-}
-
-static void
-nv30_destroy(struct pipe_context *pipe)
-{
- struct nv30_context *nv30 = nv30_context(pipe);
- unsigned i;
-
- for (i = 0; i < NV30_STATE_MAX; i++) {
- if (nv30->state.hw[i])
- so_ref(NULL, &nv30->state.hw[i]);
- }
-
- if (nv30->draw)
- draw_destroy(nv30->draw);
- FREE(nv30);
-}
-
-struct pipe_context *
-nv30_create(struct pipe_screen *pscreen, void *priv)
-{
- struct nv30_screen *screen = nv30_screen(pscreen);
- struct pipe_winsys *ws = pscreen->winsys;
- struct nv30_context *nv30;
- struct nouveau_winsys *nvws = screen->nvws;
-
- nv30 = CALLOC(1, sizeof(struct nv30_context));
- if (!nv30)
- return NULL;
- nv30->screen = screen;
-
- nv30->nvws = nvws;
-
- nv30->pipe.winsys = ws;
- nv30->pipe.screen = pscreen;
- nv30->pipe.priv = priv;
- nv30->pipe.destroy = nv30_destroy;
- nv30->pipe.draw_arrays = nv30_draw_arrays;
- nv30->pipe.draw_elements = nv30_draw_elements;
- nv30->pipe.clear = nv30_clear;
- nv30->pipe.flush = nv30_flush;
-
- nv30->pipe.is_texture_referenced = nouveau_is_texture_referenced;
- nv30->pipe.is_buffer_referenced = nouveau_is_buffer_referenced;
-
- screen->base.channel->user_private = nv30;
- screen->base.channel->flush_notify = nv30_state_flush_notify;
-
- nv30_init_query_functions(nv30);
- nv30_init_surface_functions(nv30);
- nv30_init_state_functions(nv30);
-
- /* Create, configure, and install fallback swtnl path */
- nv30->draw = draw_create();
- draw_wide_point_threshold(nv30->draw, 9999999.0);
- draw_wide_line_threshold(nv30->draw, 9999999.0);
- draw_enable_line_stipple(nv30->draw, FALSE);
- draw_enable_point_sprites(nv30->draw, FALSE);
- draw_set_rasterize_stage(nv30->draw, nv30_draw_render_stage(nv30));
-
- return &nv30->pipe;
-}
diff --git a/src/gallium/drivers/nv30/nv30_context.h b/src/gallium/drivers/nv30/nv30_context.h
deleted file mode 100644
index ea259aadf3..0000000000
--- a/src/gallium/drivers/nv30/nv30_context.h
+++ /dev/null
@@ -1,218 +0,0 @@
-#ifndef __NV30_CONTEXT_H__
-#define __NV30_CONTEXT_H__
-
-#include <stdio.h>
-
-#include "pipe/p_context.h"
-#include "pipe/p_defines.h"
-#include "pipe/p_state.h"
-#include "pipe/p_compiler.h"
-
-#include "util/u_memory.h"
-#include "util/u_math.h"
-#include "util/u_inlines.h"
-
-#include "draw/draw_vertex.h"
-
-#include "nouveau/nouveau_winsys.h"
-#include "nouveau/nouveau_gldefs.h"
-#include "nouveau/nouveau_context.h"
-#include "nouveau/nouveau_stateobj.h"
-
-#include "nv30_state.h"
-
-#define NOUVEAU_ERR(fmt, args...) \
- fprintf(stderr, "%s:%d - "fmt, __func__, __LINE__, ##args);
-#define NOUVEAU_MSG(fmt, args...) \
- fprintf(stderr, "nouveau: "fmt, ##args);
-
-enum nv30_state_index {
- NV30_STATE_FB = 0,
- NV30_STATE_VIEWPORT = 1,
- NV30_STATE_BLEND = 2,
- NV30_STATE_RAST = 3,
- NV30_STATE_ZSA = 4,
- NV30_STATE_BCOL = 5,
- NV30_STATE_CLIP = 6,
- NV30_STATE_SCISSOR = 7,
- NV30_STATE_STIPPLE = 8,
- NV30_STATE_FRAGPROG = 9,
- NV30_STATE_VERTPROG = 10,
- NV30_STATE_FRAGTEX0 = 11,
- NV30_STATE_FRAGTEX1 = 12,
- NV30_STATE_FRAGTEX2 = 13,
- NV30_STATE_FRAGTEX3 = 14,
- NV30_STATE_FRAGTEX4 = 15,
- NV30_STATE_FRAGTEX5 = 16,
- NV30_STATE_FRAGTEX6 = 17,
- NV30_STATE_FRAGTEX7 = 18,
- NV30_STATE_FRAGTEX8 = 19,
- NV30_STATE_FRAGTEX9 = 20,
- NV30_STATE_FRAGTEX10 = 21,
- NV30_STATE_FRAGTEX11 = 22,
- NV30_STATE_FRAGTEX12 = 23,
- NV30_STATE_FRAGTEX13 = 24,
- NV30_STATE_FRAGTEX14 = 25,
- NV30_STATE_FRAGTEX15 = 26,
- NV30_STATE_VERTTEX0 = 27,
- NV30_STATE_VERTTEX1 = 28,
- NV30_STATE_VERTTEX2 = 29,
- NV30_STATE_VERTTEX3 = 30,
- NV30_STATE_VTXBUF = 31,
- NV30_STATE_VTXFMT = 32,
- NV30_STATE_VTXATTR = 33,
- NV30_STATE_SR = 34,
- NV30_STATE_MAX = 35
-};
-
-#include "nv30_screen.h"
-
-#define NV30_NEW_BLEND (1 << 0)
-#define NV30_NEW_RAST (1 << 1)
-#define NV30_NEW_ZSA (1 << 2)
-#define NV30_NEW_SAMPLER (1 << 3)
-#define NV30_NEW_FB (1 << 4)
-#define NV30_NEW_STIPPLE (1 << 5)
-#define NV30_NEW_SCISSOR (1 << 6)
-#define NV30_NEW_VIEWPORT (1 << 7)
-#define NV30_NEW_BCOL (1 << 8)
-#define NV30_NEW_VERTPROG (1 << 9)
-#define NV30_NEW_FRAGPROG (1 << 10)
-#define NV30_NEW_ARRAYS (1 << 11)
-#define NV30_NEW_UCP (1 << 12)
-#define NV30_NEW_SR (1 << 13)
-
-struct nv30_rasterizer_state {
- struct pipe_rasterizer_state pipe;
- struct nouveau_stateobj *so;
-};
-
-struct nv30_zsa_state {
- struct pipe_depth_stencil_alpha_state pipe;
- struct nouveau_stateobj *so;
-};
-
-struct nv30_blend_state {
- struct pipe_blend_state pipe;
- struct nouveau_stateobj *so;
-};
-
-
-struct nv30_state {
- unsigned scissor_enabled;
- unsigned stipple_enabled;
- unsigned fp_samplers;
-
- uint64_t dirty;
- struct nouveau_stateobj *hw[NV30_STATE_MAX];
-};
-
-struct nv30_context {
- struct pipe_context pipe;
-
- struct nouveau_winsys *nvws;
- struct nv30_screen *screen;
-
- struct draw_context *draw;
-
- /* HW state derived from pipe states */
- struct nv30_state state;
-
- /* Context state */
- unsigned dirty;
- struct pipe_scissor_state scissor;
- unsigned stipple[32];
- struct nv30_vertex_program *vertprog;
- struct nv30_fragment_program *fragprog;
- struct pipe_buffer *constbuf[PIPE_SHADER_TYPES];
- unsigned constbuf_nr[PIPE_SHADER_TYPES];
- struct nv30_rasterizer_state *rasterizer;
- struct nv30_zsa_state *zsa;
- struct nv30_blend_state *blend;
- struct pipe_blend_color blend_colour;
- struct pipe_stencil_ref stencil_ref;
- struct pipe_viewport_state viewport;
- struct pipe_framebuffer_state framebuffer;
- struct pipe_buffer *idxbuf;
- unsigned idxbuf_format;
- struct nv30_sampler_state *tex_sampler[PIPE_MAX_SAMPLERS];
- struct nv30_miptree *tex_miptree[PIPE_MAX_SAMPLERS];
- unsigned nr_samplers;
- unsigned nr_textures;
- unsigned dirty_samplers;
- struct pipe_vertex_buffer vtxbuf[PIPE_MAX_ATTRIBS];
- unsigned vtxbuf_nr;
- struct pipe_vertex_element vtxelt[PIPE_MAX_ATTRIBS];
- unsigned vtxelt_nr;
-};
-
-static INLINE struct nv30_context *
-nv30_context(struct pipe_context *pipe)
-{
- return (struct nv30_context *)pipe;
-}
-
-struct nv30_state_entry {
- boolean (*validate)(struct nv30_context *nv30);
- struct {
- unsigned pipe;
- unsigned hw;
- } dirty;
-};
-
-extern void nv30_init_state_functions(struct nv30_context *nv30);
-extern void nv30_init_surface_functions(struct nv30_context *nv30);
-extern void nv30_init_query_functions(struct nv30_context *nv30);
-
-extern void nv30_screen_init_miptree_functions(struct pipe_screen *pscreen);
-
-/* nv30_draw.c */
-extern struct draw_stage *nv30_draw_render_stage(struct nv30_context *nv30);
-
-/* nv30_vertprog.c */
-extern void nv30_vertprog_destroy(struct nv30_context *,
- struct nv30_vertex_program *);
-
-/* nv30_fragprog.c */
-extern void nv30_fragprog_destroy(struct nv30_context *,
- struct nv30_fragment_program *);
-
-/* nv30_fragtex.c */
-extern void nv30_fragtex_bind(struct nv30_context *);
-
-/* nv30_state.c and friends */
-extern boolean nv30_state_validate(struct nv30_context *nv30);
-extern void nv30_state_emit(struct nv30_context *nv30);
-extern void nv30_state_flush_notify(struct nouveau_channel *chan);
-extern struct nv30_state_entry nv30_state_rasterizer;
-extern struct nv30_state_entry nv30_state_scissor;
-extern struct nv30_state_entry nv30_state_stipple;
-extern struct nv30_state_entry nv30_state_fragprog;
-extern struct nv30_state_entry nv30_state_vertprog;
-extern struct nv30_state_entry nv30_state_blend;
-extern struct nv30_state_entry nv30_state_blend_colour;
-extern struct nv30_state_entry nv30_state_zsa;
-extern struct nv30_state_entry nv30_state_viewport;
-extern struct nv30_state_entry nv30_state_framebuffer;
-extern struct nv30_state_entry nv30_state_fragtex;
-extern struct nv30_state_entry nv30_state_vbo;
-extern struct nv30_state_entry nv30_state_sr;
-
-/* nv30_vbo.c */
-extern void nv30_draw_arrays(struct pipe_context *, unsigned mode,
- unsigned start, unsigned count);
-extern void nv30_draw_elements(struct pipe_context *pipe,
- struct pipe_buffer *indexBuffer,
- unsigned indexSize,
- unsigned mode, unsigned start,
- unsigned count);
-
-/* nv30_clear.c */
-extern void nv30_clear(struct pipe_context *pipe, unsigned buffers,
- const float *rgba, double depth, unsigned stencil);
-
-/* nv30_context.c */
-struct pipe_context *
-nv30_create(struct pipe_screen *pscreen, void *priv);
-
-#endif
diff --git a/src/gallium/drivers/nv30/nv30_draw.c b/src/gallium/drivers/nv30/nv30_draw.c
deleted file mode 100644
index 74fc138c05..0000000000
--- a/src/gallium/drivers/nv30/nv30_draw.c
+++ /dev/null
@@ -1,61 +0,0 @@
-#include "draw/draw_pipe.h"
-
-#include "nv30_context.h"
-
-struct nv30_draw_stage {
- struct draw_stage draw;
- struct nv30_context *nv30;
-};
-
-static void
-nv30_draw_point(struct draw_stage *draw, struct prim_header *prim)
-{
- NOUVEAU_ERR("\n");
-}
-
-static void
-nv30_draw_line(struct draw_stage *draw, struct prim_header *prim)
-{
- NOUVEAU_ERR("\n");
-}
-
-static void
-nv30_draw_tri(struct draw_stage *draw, struct prim_header *prim)
-{
- NOUVEAU_ERR("\n");
-}
-
-static void
-nv30_draw_flush(struct draw_stage *draw, unsigned flags)
-{
-}
-
-static void
-nv30_draw_reset_stipple_counter(struct draw_stage *draw)
-{
- NOUVEAU_ERR("\n");
-}
-
-static void
-nv30_draw_destroy(struct draw_stage *draw)
-{
- FREE(draw);
-}
-
-struct draw_stage *
-nv30_draw_render_stage(struct nv30_context *nv30)
-{
- struct nv30_draw_stage *nv30draw = CALLOC_STRUCT(nv30_draw_stage);
-
- nv30draw->nv30 = nv30;
- nv30draw->draw.draw = nv30->draw;
- nv30draw->draw.point = nv30_draw_point;
- nv30draw->draw.line = nv30_draw_line;
- nv30draw->draw.tri = nv30_draw_tri;
- nv30draw->draw.flush = nv30_draw_flush;
- nv30draw->draw.reset_stipple_counter = nv30_draw_reset_stipple_counter;
- nv30draw->draw.destroy = nv30_draw_destroy;
-
- return &nv30draw->draw;
-}
-
diff --git a/src/gallium/drivers/nv30/nv30_fragprog.c b/src/gallium/drivers/nv30/nv30_fragprog.c
deleted file mode 100644
index 2c432c6dfa..0000000000
--- a/src/gallium/drivers/nv30/nv30_fragprog.c
+++ /dev/null
@@ -1,905 +0,0 @@
-#include "pipe/p_context.h"
-#include "pipe/p_defines.h"
-#include "pipe/p_state.h"
-#include "util/u_inlines.h"
-
-#include "pipe/p_shader_tokens.h"
-#include "tgsi/tgsi_dump.h"
-#include "tgsi/tgsi_parse.h"
-#include "tgsi/tgsi_util.h"
-
-#include "nv30_context.h"
-
-#define SWZ_X 0
-#define SWZ_Y 1
-#define SWZ_Z 2
-#define SWZ_W 3
-#define MASK_X 1
-#define MASK_Y 2
-#define MASK_Z 4
-#define MASK_W 8
-#define MASK_ALL (MASK_X|MASK_Y|MASK_Z|MASK_W)
-#define DEF_SCALE NV30_FP_OP_DST_SCALE_1X
-#define DEF_CTEST NV30_FP_OP_COND_TR
-#include "nv30_shader.h"
-
-#define swz(s,x,y,z,w) nv30_sr_swz((s), SWZ_##x, SWZ_##y, SWZ_##z, SWZ_##w)
-#define neg(s) nv30_sr_neg((s))
-#define abs(s) nv30_sr_abs((s))
-#define scale(s,v) nv30_sr_scale((s), NV30_FP_OP_DST_SCALE_##v)
-
-#define MAX_CONSTS 128
-#define MAX_IMM 32
-struct nv30_fpc {
- struct nv30_fragment_program *fp;
-
- uint attrib_map[PIPE_MAX_SHADER_INPUTS];
-
- int high_temp;
- int temp_temp_count;
- int num_regs;
-
- uint depth_id;
- uint colour_id;
-
- unsigned inst_offset;
-
- struct {
- int pipe;
- float vals[4];
- } consts[MAX_CONSTS];
- int nr_consts;
-
- struct nv30_sreg imm[MAX_IMM];
- unsigned nr_imm;
-};
-
-static INLINE struct nv30_sreg
-temp(struct nv30_fpc *fpc)
-{
- int idx;
-
- idx = fpc->temp_temp_count++;
- idx += fpc->high_temp + 1;
- return nv30_sr(NV30SR_TEMP, idx);
-}
-
-static INLINE struct nv30_sreg
-constant(struct nv30_fpc *fpc, int pipe, float vals[4])
-{
- int idx;
-
- if (fpc->nr_consts == MAX_CONSTS)
- assert(0);
- idx = fpc->nr_consts++;
-
- fpc->consts[idx].pipe = pipe;
- if (pipe == -1)
- memcpy(fpc->consts[idx].vals, vals, 4 * sizeof(float));
- return nv30_sr(NV30SR_CONST, idx);
-}
-
-#define arith(cc,s,o,d,m,s0,s1,s2) \
- nv30_fp_arith((cc), (s), NV30_FP_OP_OPCODE_##o, \
- (d), (m), (s0), (s1), (s2))
-#define tex(cc,s,o,u,d,m,s0,s1,s2) \
- nv30_fp_tex((cc), (s), NV30_FP_OP_OPCODE_##o, (u), \
- (d), (m), (s0), none, none)
-
-static void
-grow_insns(struct nv30_fpc *fpc, int size)
-{
- struct nv30_fragment_program *fp = fpc->fp;
-
- fp->insn_len += size;
- fp->insn = realloc(fp->insn, sizeof(uint32_t) * fp->insn_len);
-}
-
-static void
-emit_src(struct nv30_fpc *fpc, int pos, struct nv30_sreg src)
-{
- struct nv30_fragment_program *fp = fpc->fp;
- uint32_t *hw = &fp->insn[fpc->inst_offset];
- uint32_t sr = 0;
-
- switch (src.type) {
- case NV30SR_INPUT:
- sr |= (NV30_FP_REG_TYPE_INPUT << NV30_FP_REG_TYPE_SHIFT);
- hw[0] |= (src.index << NV30_FP_OP_INPUT_SRC_SHIFT);
- break;
- case NV30SR_OUTPUT:
- sr |= NV30_FP_REG_SRC_HALF;
- /* fall-through */
- case NV30SR_TEMP:
- sr |= (NV30_FP_REG_TYPE_TEMP << NV30_FP_REG_TYPE_SHIFT);
- sr |= (src.index << NV30_FP_REG_SRC_SHIFT);
- break;
- case NV30SR_CONST:
- grow_insns(fpc, 4);
- hw = &fp->insn[fpc->inst_offset];
- if (fpc->consts[src.index].pipe >= 0) {
- struct nv30_fragment_program_data *fpd;
-
- fp->consts = realloc(fp->consts, ++fp->nr_consts *
- sizeof(*fpd));
- fpd = &fp->consts[fp->nr_consts - 1];
- fpd->offset = fpc->inst_offset + 4;
- fpd->index = fpc->consts[src.index].pipe;
- memset(&fp->insn[fpd->offset], 0, sizeof(uint32_t) * 4);
- } else {
- memcpy(&fp->insn[fpc->inst_offset + 4],
- fpc->consts[src.index].vals,
- sizeof(uint32_t) * 4);
- }
-
- sr |= (NV30_FP_REG_TYPE_CONST << NV30_FP_REG_TYPE_SHIFT);
- break;
- case NV30SR_NONE:
- sr |= (NV30_FP_REG_TYPE_INPUT << NV30_FP_REG_TYPE_SHIFT);
- break;
- default:
- assert(0);
- }
-
- if (src.negate)
- sr |= NV30_FP_REG_NEGATE;
-
- if (src.abs)
- hw[1] |= (1 << (29 + pos));
-
- sr |= ((src.swz[0] << NV30_FP_REG_SWZ_X_SHIFT) |
- (src.swz[1] << NV30_FP_REG_SWZ_Y_SHIFT) |
- (src.swz[2] << NV30_FP_REG_SWZ_Z_SHIFT) |
- (src.swz[3] << NV30_FP_REG_SWZ_W_SHIFT));
-
- hw[pos + 1] |= sr;
-}
-
-static void
-emit_dst(struct nv30_fpc *fpc, struct nv30_sreg dst)
-{
- struct nv30_fragment_program *fp = fpc->fp;
- uint32_t *hw = &fp->insn[fpc->inst_offset];
-
- switch (dst.type) {
- case NV30SR_TEMP:
- if (fpc->num_regs < (dst.index + 1))
- fpc->num_regs = dst.index + 1;
- break;
- case NV30SR_OUTPUT:
- if (dst.index == 1) {
- fp->fp_control |= 0xe;
- } else {
- hw[0] |= NV30_FP_OP_OUT_REG_HALF;
- }
- break;
- case NV30SR_NONE:
- hw[0] |= (1 << 30);
- break;
- default:
- assert(0);
- }
-
- hw[0] |= (dst.index << NV30_FP_OP_OUT_REG_SHIFT);
-}
-
-static void
-nv30_fp_arith(struct nv30_fpc *fpc, int sat, int op,
- struct nv30_sreg dst, int mask,
- struct nv30_sreg s0, struct nv30_sreg s1, struct nv30_sreg s2)
-{
- struct nv30_fragment_program *fp = fpc->fp;
- uint32_t *hw;
-
- fpc->inst_offset = fp->insn_len;
- grow_insns(fpc, 4);
- hw = &fp->insn[fpc->inst_offset];
- memset(hw, 0, sizeof(uint32_t) * 4);
-
- if (op == NV30_FP_OP_OPCODE_KIL)
- fp->fp_control |= NV34TCL_FP_CONTROL_USES_KIL;
- hw[0] |= (op << NV30_FP_OP_OPCODE_SHIFT);
- hw[0] |= (mask << NV30_FP_OP_OUTMASK_SHIFT);
- hw[2] |= (dst.dst_scale << NV30_FP_OP_DST_SCALE_SHIFT);
-
- if (sat)
- hw[0] |= NV30_FP_OP_OUT_SAT;
-
- if (dst.cc_update)
- hw[0] |= NV30_FP_OP_COND_WRITE_ENABLE;
- hw[1] |= (dst.cc_test << NV30_FP_OP_COND_SHIFT);
- hw[1] |= ((dst.cc_swz[0] << NV30_FP_OP_COND_SWZ_X_SHIFT) |
- (dst.cc_swz[1] << NV30_FP_OP_COND_SWZ_Y_SHIFT) |
- (dst.cc_swz[2] << NV30_FP_OP_COND_SWZ_Z_SHIFT) |
- (dst.cc_swz[3] << NV30_FP_OP_COND_SWZ_W_SHIFT));
-
- emit_dst(fpc, dst);
- emit_src(fpc, 0, s0);
- emit_src(fpc, 1, s1);
- emit_src(fpc, 2, s2);
-}
-
-static void
-nv30_fp_tex(struct nv30_fpc *fpc, int sat, int op, int unit,
- struct nv30_sreg dst, int mask,
- struct nv30_sreg s0, struct nv30_sreg s1, struct nv30_sreg s2)
-{
- struct nv30_fragment_program *fp = fpc->fp;
-
- nv30_fp_arith(fpc, sat, op, dst, mask, s0, s1, s2);
-
- fp->insn[fpc->inst_offset] |= (unit << NV30_FP_OP_TEX_UNIT_SHIFT);
- fp->samplers |= (1 << unit);
-}
-
-static INLINE struct nv30_sreg
-tgsi_src(struct nv30_fpc *fpc, const struct tgsi_full_src_register *fsrc)
-{
- struct nv30_sreg src;
-
- switch (fsrc->Register.File) {
- case TGSI_FILE_INPUT:
- src = nv30_sr(NV30SR_INPUT,
- fpc->attrib_map[fsrc->Register.Index]);
- break;
- case TGSI_FILE_CONSTANT:
- src = constant(fpc, fsrc->Register.Index, NULL);
- break;
- case TGSI_FILE_IMMEDIATE:
- assert(fsrc->Register.Index < fpc->nr_imm);
- src = fpc->imm[fsrc->Register.Index];
- break;
- case TGSI_FILE_TEMPORARY:
- src = nv30_sr(NV30SR_TEMP, fsrc->Register.Index + 1);
- if (fpc->high_temp < src.index)
- fpc->high_temp = src.index;
- break;
- /* This is clearly insane, but gallium hands us shaders like this.
- * Luckily fragprog results are just temp regs..
- */
- case TGSI_FILE_OUTPUT:
- if (fsrc->Register.Index == fpc->colour_id)
- return nv30_sr(NV30SR_OUTPUT, 0);
- else
- return nv30_sr(NV30SR_OUTPUT, 1);
- break;
- default:
- NOUVEAU_ERR("bad src file\n");
- break;
- }
-
- src.abs = fsrc->Register.Absolute;
- src.negate = fsrc->Register.Negate;
- src.swz[0] = fsrc->Register.SwizzleX;
- src.swz[1] = fsrc->Register.SwizzleY;
- src.swz[2] = fsrc->Register.SwizzleZ;
- src.swz[3] = fsrc->Register.SwizzleW;
- return src;
-}
-
-static INLINE struct nv30_sreg
-tgsi_dst(struct nv30_fpc *fpc, const struct tgsi_full_dst_register *fdst) {
- int idx;
-
- switch (fdst->Register.File) {
- case TGSI_FILE_OUTPUT:
- if (fdst->Register.Index == fpc->colour_id)
- return nv30_sr(NV30SR_OUTPUT, 0);
- else
- return nv30_sr(NV30SR_OUTPUT, 1);
- break;
- case TGSI_FILE_TEMPORARY:
- idx = fdst->Register.Index + 1;
- if (fpc->high_temp < idx)
- fpc->high_temp = idx;
- return nv30_sr(NV30SR_TEMP, idx);
- case TGSI_FILE_NULL:
- return nv30_sr(NV30SR_NONE, 0);
- default:
- NOUVEAU_ERR("bad dst file %d\n", fdst->Register.File);
- return nv30_sr(NV30SR_NONE, 0);
- }
-}
-
-static INLINE int
-tgsi_mask(uint tgsi)
-{
- int mask = 0;
-
- if (tgsi & TGSI_WRITEMASK_X) mask |= MASK_X;
- if (tgsi & TGSI_WRITEMASK_Y) mask |= MASK_Y;
- if (tgsi & TGSI_WRITEMASK_Z) mask |= MASK_Z;
- if (tgsi & TGSI_WRITEMASK_W) mask |= MASK_W;
- return mask;
-}
-
-static boolean
-src_native_swz(struct nv30_fpc *fpc, const struct tgsi_full_src_register *fsrc,
- struct nv30_sreg *src)
-{
- const struct nv30_sreg none = nv30_sr(NV30SR_NONE, 0);
- struct nv30_sreg tgsi = tgsi_src(fpc, fsrc);
- uint mask = 0;
- uint c;
-
- for (c = 0; c < 4; c++) {
- switch (tgsi_util_get_full_src_register_swizzle(fsrc, c)) {
- case TGSI_SWIZZLE_X:
- case TGSI_SWIZZLE_Y:
- case TGSI_SWIZZLE_Z:
- case TGSI_SWIZZLE_W:
- mask |= (1 << c);
- break;
- default:
- assert(0);
- }
- }
-
- if (mask == MASK_ALL)
- return TRUE;
-
- *src = temp(fpc);
-
- if (mask)
- arith(fpc, 0, MOV, *src, mask, tgsi, none, none);
-
- return FALSE;
-}
-
-static boolean
-nv30_fragprog_parse_instruction(struct nv30_fpc *fpc,
- const struct tgsi_full_instruction *finst)
-{
- const struct nv30_sreg none = nv30_sr(NV30SR_NONE, 0);
- struct nv30_sreg src[3], dst, tmp;
- int mask, sat, unit = 0;
- int ai = -1, ci = -1;
- int i;
-
- if (finst->Instruction.Opcode == TGSI_OPCODE_END)
- return TRUE;
-
- fpc->temp_temp_count = 0;
- for (i = 0; i < finst->Instruction.NumSrcRegs; i++) {
- const struct tgsi_full_src_register *fsrc;
-
- fsrc = &finst->Src[i];
- if (fsrc->Register.File == TGSI_FILE_TEMPORARY) {
- src[i] = tgsi_src(fpc, fsrc);
- }
- }
-
- for (i = 0; i < finst->Instruction.NumSrcRegs; i++) {
- const struct tgsi_full_src_register *fsrc;
-
- fsrc = &finst->Src[i];
-
- switch (fsrc->Register.File) {
- case TGSI_FILE_INPUT:
- case TGSI_FILE_CONSTANT:
- case TGSI_FILE_TEMPORARY:
- if (!src_native_swz(fpc, fsrc, &src[i]))
- continue;
- break;
- default:
- break;
- }
-
- switch (fsrc->Register.File) {
- case TGSI_FILE_INPUT:
- if (ai == -1 || ai == fsrc->Register.Index) {
- ai = fsrc->Register.Index;
- src[i] = tgsi_src(fpc, fsrc);
- } else {
- NOUVEAU_MSG("extra src attr %d\n",
- fsrc->Register.Index);
- src[i] = temp(fpc);
- arith(fpc, 0, MOV, src[i], MASK_ALL,
- tgsi_src(fpc, fsrc), none, none);
- }
- break;
- case TGSI_FILE_CONSTANT:
- case TGSI_FILE_IMMEDIATE:
- if (ci == -1 || ci == fsrc->Register.Index) {
- ci = fsrc->Register.Index;
- src[i] = tgsi_src(fpc, fsrc);
- } else {
- src[i] = temp(fpc);
- arith(fpc, 0, MOV, src[i], MASK_ALL,
- tgsi_src(fpc, fsrc), none, none);
- }
- break;
- case TGSI_FILE_TEMPORARY:
- /* handled above */
- break;
- case TGSI_FILE_SAMPLER:
- unit = fsrc->Register.Index;
- break;
- case TGSI_FILE_OUTPUT:
- break;
- default:
- NOUVEAU_ERR("bad src file\n");
- return FALSE;
- }
- }
-
- dst = tgsi_dst(fpc, &finst->Dst[0]);
- mask = tgsi_mask(finst->Dst[0].Register.WriteMask);
- sat = (finst->Instruction.Saturate == TGSI_SAT_ZERO_ONE);
-
- switch (finst->Instruction.Opcode) {
- case TGSI_OPCODE_ABS:
- arith(fpc, sat, MOV, dst, mask, abs(src[0]), none, none);
- break;
- case TGSI_OPCODE_ADD:
- arith(fpc, sat, ADD, dst, mask, src[0], src[1], none);
- break;
- case TGSI_OPCODE_CMP:
- tmp = nv30_sr(NV30SR_NONE, 0);
- tmp.cc_update = 1;
- arith(fpc, 0, MOV, tmp, 0xf, src[0], none, none);
- dst.cc_test = NV30_VP_INST_COND_GE;
- arith(fpc, sat, MOV, dst, mask, src[2], none, none);
- dst.cc_test = NV30_VP_INST_COND_LT;
- arith(fpc, sat, MOV, dst, mask, src[1], none, none);
- break;
- case TGSI_OPCODE_COS:
- arith(fpc, sat, COS, dst, mask, src[0], none, none);
- break;
- case TGSI_OPCODE_DP3:
- arith(fpc, sat, DP3, dst, mask, src[0], src[1], none);
- break;
- case TGSI_OPCODE_DP4:
- arith(fpc, sat, DP4, dst, mask, src[0], src[1], none);
- break;
- case TGSI_OPCODE_DPH:
- tmp = temp(fpc);
- arith(fpc, 0, DP3, tmp, MASK_X, src[0], src[1], none);
- arith(fpc, sat, ADD, dst, mask, swz(tmp, X, X, X, X),
- swz(src[1], W, W, W, W), none);
- break;
- case TGSI_OPCODE_DST:
- arith(fpc, sat, DST, dst, mask, src[0], src[1], none);
- break;
- case TGSI_OPCODE_EX2:
- arith(fpc, sat, EX2, dst, mask, src[0], none, none);
- break;
- case TGSI_OPCODE_FLR:
- arith(fpc, sat, FLR, dst, mask, src[0], none, none);
- break;
- case TGSI_OPCODE_FRC:
- arith(fpc, sat, FRC, dst, mask, src[0], none, none);
- break;
- case TGSI_OPCODE_KILP:
- arith(fpc, 0, KIL, none, 0, none, none, none);
- break;
- case TGSI_OPCODE_KIL:
- dst = nv30_sr(NV30SR_NONE, 0);
- dst.cc_update = 1;
- arith(fpc, 0, MOV, dst, MASK_ALL, src[0], none, none);
- dst.cc_update = 0; dst.cc_test = NV30_FP_OP_COND_LT;
- arith(fpc, 0, KIL, dst, 0, none, none, none);
- break;
- case TGSI_OPCODE_LG2:
- arith(fpc, sat, LG2, dst, mask, src[0], none, none);
- break;
-// case TGSI_OPCODE_LIT:
- case TGSI_OPCODE_LRP:
- arith(fpc, sat, LRP, dst, mask, src[0], src[1], src[2]);
- break;
- case TGSI_OPCODE_MAD:
- arith(fpc, sat, MAD, dst, mask, src[0], src[1], src[2]);
- break;
- case TGSI_OPCODE_MAX:
- arith(fpc, sat, MAX, dst, mask, src[0], src[1], none);
- break;
- case TGSI_OPCODE_MIN:
- arith(fpc, sat, MIN, dst, mask, src[0], src[1], none);
- break;
- case TGSI_OPCODE_MOV:
- arith(fpc, sat, MOV, dst, mask, src[0], none, none);
- break;
- case TGSI_OPCODE_MUL:
- arith(fpc, sat, MUL, dst, mask, src[0], src[1], none);
- break;
- case TGSI_OPCODE_POW:
- arith(fpc, sat, POW, dst, mask, src[0], src[1], none);
- break;
- case TGSI_OPCODE_RCP:
- arith(fpc, sat, RCP, dst, mask, src[0], none, none);
- break;
- case TGSI_OPCODE_RET:
- assert(0);
- break;
- case TGSI_OPCODE_RFL:
- arith(fpc, 0, RFL, dst, mask, src[0], src[1], none);
- break;
- case TGSI_OPCODE_RSQ:
- arith(fpc, sat, RSQ, dst, mask, abs(swz(src[0], X, X, X, X)), none, none);
- break;
- case TGSI_OPCODE_SCS:
- /* avoid overwriting the source */
- if(src[0].swz[SWZ_X] != SWZ_X)
- {
- if (mask & MASK_X) {
- arith(fpc, sat, COS, dst, MASK_X,
- swz(src[0], X, X, X, X), none, none);
- }
- if (mask & MASK_Y) {
- arith(fpc, sat, SIN, dst, MASK_Y,
- swz(src[0], X, X, X, X), none, none);
- }
- }
- else
- {
- if (mask & MASK_Y) {
- arith(fpc, sat, SIN, dst, MASK_Y,
- swz(src[0], X, X, X, X), none, none);
- }
- if (mask & MASK_X) {
- arith(fpc, sat, COS, dst, MASK_X,
- swz(src[0], X, X, X, X), none, none);
- }
- }
- break;
- case TGSI_OPCODE_SIN:
- arith(fpc, sat, SIN, dst, mask, src[0], none, none);
- break;
- case TGSI_OPCODE_SGE:
- arith(fpc, sat, SGE, dst, mask, src[0], src[1], none);
- break;
- case TGSI_OPCODE_SGT:
- arith(fpc, sat, SGT, dst, mask, src[0], src[1], none);
- break;
- case TGSI_OPCODE_SLT:
- arith(fpc, sat, SLT, dst, mask, src[0], src[1], none);
- break;
- case TGSI_OPCODE_SUB:
- arith(fpc, sat, ADD, dst, mask, src[0], neg(src[1]), none);
- break;
- case TGSI_OPCODE_TEX:
- tex(fpc, sat, TEX, unit, dst, mask, src[0], none, none);
- break;
- case TGSI_OPCODE_TXB:
- tex(fpc, sat, TXB, unit, dst, mask, src[0], none, none);
- break;
- case TGSI_OPCODE_TXP:
- tex(fpc, sat, TXP, unit, dst, mask, src[0], none, none);
- break;
- case TGSI_OPCODE_XPD:
- tmp = temp(fpc);
- arith(fpc, 0, MUL, tmp, mask,
- swz(src[0], Z, X, Y, Y), swz(src[1], Y, Z, X, X), none);
- arith(fpc, sat, MAD, dst, (mask & ~MASK_W),
- swz(src[0], Y, Z, X, X), swz(src[1], Z, X, Y, Y),
- neg(tmp));
- break;
- default:
- NOUVEAU_ERR("invalid opcode %d\n", finst->Instruction.Opcode);
- return FALSE;
- }
-
- return TRUE;
-}
-
-static boolean
-nv30_fragprog_parse_decl_attrib(struct nv30_fpc *fpc,
- const struct tgsi_full_declaration *fdec)
-{
- int hw;
-
- switch (fdec->Semantic.Name) {
- case TGSI_SEMANTIC_POSITION:
- hw = NV30_FP_OP_INPUT_SRC_POSITION;
- break;
- case TGSI_SEMANTIC_COLOR:
- if (fdec->Semantic.Index == 0) {
- hw = NV30_FP_OP_INPUT_SRC_COL0;
- } else
- if (fdec->Semantic.Index == 1) {
- hw = NV30_FP_OP_INPUT_SRC_COL1;
- } else {
- NOUVEAU_ERR("bad colour semantic index\n");
- return FALSE;
- }
- break;
- case TGSI_SEMANTIC_FOG:
- hw = NV30_FP_OP_INPUT_SRC_FOGC;
- break;
- case TGSI_SEMANTIC_GENERIC:
- if (fdec->Semantic.Index <= 7) {
- hw = NV30_FP_OP_INPUT_SRC_TC(fdec->Semantic.
- Index);
- } else {
- NOUVEAU_ERR("bad generic semantic index\n");
- return FALSE;
- }
- break;
- default:
- NOUVEAU_ERR("bad input semantic\n");
- return FALSE;
- }
-
- fpc->attrib_map[fdec->Range.First] = hw;
- return TRUE;
-}
-
-static boolean
-nv30_fragprog_parse_decl_output(struct nv30_fpc *fpc,
- const struct tgsi_full_declaration *fdec)
-{
- switch (fdec->Semantic.Name) {
- case TGSI_SEMANTIC_POSITION:
- fpc->depth_id = fdec->Range.First;
- break;
- case TGSI_SEMANTIC_COLOR:
- fpc->colour_id = fdec->Range.First;
- break;
- default:
- NOUVEAU_ERR("bad output semantic\n");
- return FALSE;
- }
-
- return TRUE;
-}
-
-static boolean
-nv30_fragprog_prepare(struct nv30_fpc *fpc)
-{
- struct tgsi_parse_context p;
- /*int high_temp = -1, i;*/
-
- tgsi_parse_init(&p, fpc->fp->pipe.tokens);
- while (!tgsi_parse_end_of_tokens(&p)) {
- const union tgsi_full_token *tok = &p.FullToken;
-
- tgsi_parse_token(&p);
- switch(tok->Token.Type) {
- case TGSI_TOKEN_TYPE_DECLARATION:
- {
- const struct tgsi_full_declaration *fdec;
- fdec = &p.FullToken.FullDeclaration;
- switch (fdec->Declaration.File) {
- case TGSI_FILE_INPUT:
- if (!nv30_fragprog_parse_decl_attrib(fpc, fdec))
- goto out_err;
- break;
- case TGSI_FILE_OUTPUT:
- if (!nv30_fragprog_parse_decl_output(fpc, fdec))
- goto out_err;
- break;
- /*case TGSI_FILE_TEMPORARY:
- if (fdec->Range.Last > high_temp) {
- high_temp =
- fdec->Range.Last;
- }
- break;*/
- default:
- break;
- }
- }
- break;
- case TGSI_TOKEN_TYPE_IMMEDIATE:
- {
- struct tgsi_full_immediate *imm;
- float vals[4];
-
- imm = &p.FullToken.FullImmediate;
- assert(imm->Immediate.DataType == TGSI_IMM_FLOAT32);
- assert(fpc->nr_imm < MAX_IMM);
-
- vals[0] = imm->u[0].Float;
- vals[1] = imm->u[1].Float;
- vals[2] = imm->u[2].Float;
- vals[3] = imm->u[3].Float;
- fpc->imm[fpc->nr_imm++] = constant(fpc, -1, vals);
- }
- break;
- default:
- break;
- }
- }
- tgsi_parse_free(&p);
-
- /*if (++high_temp) {
- fpc->r_temp = CALLOC(high_temp, sizeof(struct nv30_sreg));
- for (i = 0; i < high_temp; i++)
- fpc->r_temp[i] = temp(fpc);
- fpc->r_temps_discard = 0;
- }*/
-
- return TRUE;
-
-out_err:
- /*if (fpc->r_temp)
- FREE(fpc->r_temp);*/
- tgsi_parse_free(&p);
- return FALSE;
-}
-
-static void
-nv30_fragprog_translate(struct nv30_context *nv30,
- struct nv30_fragment_program *fp)
-{
- struct tgsi_parse_context parse;
- struct nv30_fpc *fpc = NULL;
-
- tgsi_dump(fp->pipe.tokens,0);
-
- fpc = CALLOC(1, sizeof(struct nv30_fpc));
- if (!fpc)
- return;
- fpc->fp = fp;
- fpc->high_temp = -1;
- fpc->num_regs = 2;
-
- if (!nv30_fragprog_prepare(fpc)) {
- FREE(fpc);
- return;
- }
-
- tgsi_parse_init(&parse, fp->pipe.tokens);
-
- while (!tgsi_parse_end_of_tokens(&parse)) {
- tgsi_parse_token(&parse);
-
- switch (parse.FullToken.Token.Type) {
- case TGSI_TOKEN_TYPE_INSTRUCTION:
- {
- const struct tgsi_full_instruction *finst;
-
- finst = &parse.FullToken.FullInstruction;
- if (!nv30_fragprog_parse_instruction(fpc, finst))
- goto out_err;
- }
- break;
- default:
- break;
- }
- }
-
- fp->fp_control |= (fpc->num_regs-1)/2;
- fp->fp_reg_control = (1<<16)|0x4;
-
- /* Terminate final instruction */
- fp->insn[fpc->inst_offset] |= 0x00000001;
-
- /* Append NOP + END instruction, may or may not be necessary. */
- fpc->inst_offset = fp->insn_len;
- grow_insns(fpc, 4);
- fp->insn[fpc->inst_offset + 0] = 0x00000001;
- fp->insn[fpc->inst_offset + 1] = 0x00000000;
- fp->insn[fpc->inst_offset + 2] = 0x00000000;
- fp->insn[fpc->inst_offset + 3] = 0x00000000;
-
- fp->translated = TRUE;
- fp->on_hw = FALSE;
-out_err:
- tgsi_parse_free(&parse);
- FREE(fpc);
-}
-
-static void
-nv30_fragprog_upload(struct nv30_context *nv30,
- struct nv30_fragment_program *fp)
-{
- struct pipe_screen *pscreen = nv30->pipe.screen;
- const uint32_t le = 1;
- uint32_t *map;
- int i;
-
- map = pipe_buffer_map(pscreen, fp->buffer, PIPE_BUFFER_USAGE_CPU_WRITE);
-
-#if 0
- for (i = 0; i < fp->insn_len; i++) {
- fflush(stdout); fflush(stderr);
- NOUVEAU_ERR("%d 0x%08x\n", i, fp->insn[i]);
- fflush(stdout); fflush(stderr);
- }
-#endif
-
- if ((*(const uint8_t *)&le)) {
- for (i = 0; i < fp->insn_len; i++) {
- map[i] = fp->insn[i];
- }
- } else {
- /* Weird swapping for big-endian chips */
- for (i = 0; i < fp->insn_len; i++) {
- map[i] = ((fp->insn[i] & 0xffff) << 16) |
- ((fp->insn[i] >> 16) & 0xffff);
- }
- }
-
- pipe_buffer_unmap(pscreen, fp->buffer);
-}
-
-static boolean
-nv30_fragprog_validate(struct nv30_context *nv30)
-{
- struct nv30_fragment_program *fp = nv30->fragprog;
- struct pipe_buffer *constbuf =
- nv30->constbuf[PIPE_SHADER_FRAGMENT];
- struct pipe_screen *pscreen = nv30->pipe.screen;
- struct nouveau_stateobj *so;
- boolean new_consts = FALSE;
- int i;
-
- if (fp->translated)
- goto update_constants;
-
- /*nv30->fallback_swrast &= ~NV30_NEW_FRAGPROG;*/
- nv30_fragprog_translate(nv30, fp);
- if (!fp->translated) {
- /*nv30->fallback_swrast |= NV30_NEW_FRAGPROG;*/
- return FALSE;
- }
-
- fp->buffer = pscreen->buffer_create(pscreen, 0x100, 0, fp->insn_len * 4);
- nv30_fragprog_upload(nv30, fp);
-
- so = so_new(4, 4, 1);
- so_method(so, nv30->screen->rankine, NV34TCL_FP_ACTIVE_PROGRAM, 1);
- so_reloc (so, nouveau_bo(fp->buffer), 0, NOUVEAU_BO_VRAM |
- NOUVEAU_BO_GART | NOUVEAU_BO_RD | NOUVEAU_BO_LOW |
- NOUVEAU_BO_OR, NV34TCL_FP_ACTIVE_PROGRAM_DMA0,
- NV34TCL_FP_ACTIVE_PROGRAM_DMA1);
- so_method(so, nv30->screen->rankine, NV34TCL_FP_CONTROL, 1);
- so_data (so, fp->fp_control);
- so_method(so, nv30->screen->rankine, NV34TCL_FP_REG_CONTROL, 1);
- so_data (so, fp->fp_reg_control);
- so_method(so, nv30->screen->rankine, NV34TCL_TX_UNITS_ENABLE, 1);
- so_data (so, fp->samplers);
- so_ref(so, &fp->so);
- so_ref(NULL, &so);
-
-update_constants:
- if (fp->nr_consts) {
- float *map;
-
- map = pipe_buffer_map(pscreen, constbuf,
- PIPE_BUFFER_USAGE_CPU_READ);
- for (i = 0; i < fp->nr_consts; i++) {
- struct nv30_fragment_program_data *fpd = &fp->consts[i];
- uint32_t *p = &fp->insn[fpd->offset];
- uint32_t *cb = (uint32_t *)&map[fpd->index * 4];
-
- if (!memcmp(p, cb, 4 * sizeof(float)))
- continue;
- memcpy(p, cb, 4 * sizeof(float));
- new_consts = TRUE;
- }
- pipe_buffer_unmap(pscreen, constbuf);
-
- if (new_consts)
- nv30_fragprog_upload(nv30, fp);
- }
-
- if (new_consts || fp->so != nv30->state.hw[NV30_STATE_FRAGPROG]) {
- so_ref(fp->so, &nv30->state.hw[NV30_STATE_FRAGPROG]);
- return TRUE;
- }
-
- return FALSE;
-}
-
-void
-nv30_fragprog_destroy(struct nv30_context *nv30,
- struct nv30_fragment_program *fp)
-{
- if (fp->buffer)
- pipe_buffer_reference(&fp->buffer, NULL);
-
- if (fp->so)
- so_ref(NULL, &fp->so);
-
- if (fp->insn_len)
- FREE(fp->insn);
-}
-
-struct nv30_state_entry nv30_state_fragprog = {
- .validate = nv30_fragprog_validate,
- .dirty = {
- .pipe = NV30_NEW_FRAGPROG,
- .hw = NV30_STATE_FRAGPROG
- }
-};
diff --git a/src/gallium/drivers/nv30/nv30_miptree.c b/src/gallium/drivers/nv30/nv30_miptree.c
deleted file mode 100644
index 697b1b92ff..0000000000
--- a/src/gallium/drivers/nv30/nv30_miptree.c
+++ /dev/null
@@ -1,239 +0,0 @@
-#include "pipe/p_state.h"
-#include "pipe/p_defines.h"
-#include "util/u_inlines.h"
-#include "util/u_format.h"
-#include "util/u_math.h"
-
-#include "nv30_context.h"
-#include "../nouveau/nv04_surface_2d.h"
-
-static void
-nv30_miptree_layout(struct nv30_miptree *nv30mt)
-{
- struct pipe_texture *pt = &nv30mt->base;
- uint width = pt->width0;
- uint offset = 0;
- int nr_faces, l, f;
- uint wide_pitch = pt->tex_usage & (PIPE_TEXTURE_USAGE_SAMPLER |
- PIPE_TEXTURE_USAGE_DEPTH_STENCIL |
- PIPE_TEXTURE_USAGE_RENDER_TARGET |
- PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
- PIPE_TEXTURE_USAGE_PRIMARY);
-
- if (pt->target == PIPE_TEXTURE_CUBE) {
- nr_faces = 6;
- } else
- if (pt->target == PIPE_TEXTURE_3D) {
- nr_faces = pt->depth0;
- } else {
- nr_faces = 1;
- }
-
- for (l = 0; l <= pt->last_level; l++) {
- if (wide_pitch && (pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR))
- nv30mt->level[l].pitch = align(util_format_get_stride(pt->format, pt->width0), 64);
- else
- nv30mt->level[l].pitch = util_format_get_stride(pt->format, width);
-
- nv30mt->level[l].image_offset =
- CALLOC(nr_faces, sizeof(unsigned));
-
- width = u_minify(width, 1);
- }
-
- for (f = 0; f < nr_faces; f++) {
- for (l = 0; l < pt->last_level; l++) {
- nv30mt->level[l].image_offset[f] = offset;
-
- if (!(pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR) &&
- u_minify(pt->width0, l + 1) > 1 && u_minify(pt->height0, l + 1) > 1)
- offset += align(nv30mt->level[l].pitch * u_minify(pt->height0, l), 64);
- else
- offset += nv30mt->level[l].pitch * u_minify(pt->height0, l);
- }
-
- nv30mt->level[l].image_offset[f] = offset;
- offset += nv30mt->level[l].pitch * u_minify(pt->height0, l);
- }
-
- nv30mt->total_size = offset;
-}
-
-static struct pipe_texture *
-nv30_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)
-{
- struct nv30_miptree *mt;
- unsigned buf_usage = PIPE_BUFFER_USAGE_PIXEL |
- NOUVEAU_BUFFER_USAGE_TEXTURE;
-
- mt = MALLOC(sizeof(struct nv30_miptree));
- if (!mt)
- return NULL;
- mt->base = *pt;
- pipe_reference_init(&mt->base.reference, 1);
- mt->base.screen = pscreen;
-
- /* Swizzled textures must be POT */
- if (pt->width0 & (pt->width0 - 1) ||
- pt->height0 & (pt->height0 - 1))
- mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
- else
- if (pt->tex_usage & (PIPE_TEXTURE_USAGE_PRIMARY |
- PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
- PIPE_TEXTURE_USAGE_DEPTH_STENCIL))
- mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
- else
- if (pt->tex_usage & PIPE_TEXTURE_USAGE_DYNAMIC)
- mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
- else {
- switch (pt->format) {
- /* TODO: Figure out which formats can be swizzled */
- case PIPE_FORMAT_B8G8R8A8_UNORM:
- case PIPE_FORMAT_B8G8R8X8_UNORM:
- case PIPE_FORMAT_R16_SNORM:
- case PIPE_FORMAT_B5G6R5_UNORM:
- case PIPE_FORMAT_L8A8_UNORM:
- case PIPE_FORMAT_A8_UNORM:
- case PIPE_FORMAT_L8_UNORM:
- case PIPE_FORMAT_I8_UNORM:
- {
- if (debug_get_bool_option("NOUVEAU_NO_SWIZZLE", FALSE))
- mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
- break;
- }
- default:
- mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
- }
- }
-
- if (pt->tex_usage & PIPE_TEXTURE_USAGE_DYNAMIC)
- buf_usage |= PIPE_BUFFER_USAGE_CPU_READ_WRITE;
-
- /* apparently we can't render to swizzled surfaces smaller than 64 bytes, so make them linear.
- * If the user did not ask for a render target, they can still render to it, but it will cost them an extra copy.
- * This also happens for small mipmaps of large textures. */
- if (pt->tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET && util_format_get_stride(pt->format, pt->width0) < 64)
- mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
-
- nv30_miptree_layout(mt);
-
- mt->buffer = pscreen->buffer_create(pscreen, 256, buf_usage,
- mt->total_size);
- if (!mt->buffer) {
- FREE(mt);
- return NULL;
- }
- mt->bo = nouveau_bo(mt->buffer);
-
- return &mt->base;
-}
-
-static struct pipe_texture *
-nv30_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt,
- const unsigned *stride, struct pipe_buffer *pb)
-{
- struct nv30_miptree *mt;
-
- /* Only supports 2D, non-mipmapped textures for the moment */
- if (pt->target != PIPE_TEXTURE_2D || pt->last_level != 0 ||
- pt->depth0 != 1)
- return NULL;
-
- mt = CALLOC_STRUCT(nv30_miptree);
- if (!mt)
- return NULL;
-
- mt->base = *pt;
- pipe_reference_init(&mt->base.reference, 1);
- mt->base.screen = pscreen;
- mt->level[0].pitch = stride[0];
- mt->level[0].image_offset = CALLOC(1, sizeof(unsigned));
-
- /* Assume whoever created this buffer expects it to be linear for now */
- mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
-
- pipe_buffer_reference(&mt->buffer, pb);
- mt->bo = nouveau_bo(mt->buffer);
- return &mt->base;
-}
-
-static void
-nv30_miptree_destroy(struct pipe_texture *pt)
-{
- struct nv30_miptree *mt = (struct nv30_miptree *)pt;
- int l;
-
- pipe_buffer_reference(&mt->buffer, NULL);
- for (l = 0; l <= pt->last_level; l++) {
- if (mt->level[l].image_offset)
- FREE(mt->level[l].image_offset);
- }
-
- FREE(mt);
-}
-
-static struct pipe_surface *
-nv30_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
- unsigned face, unsigned level, unsigned zslice,
- unsigned flags)
-{
- struct nv30_miptree *nv30mt = (struct nv30_miptree *)pt;
- struct nv04_surface *ns;
-
- ns = CALLOC_STRUCT(nv04_surface);
- if (!ns)
- return NULL;
- pipe_texture_reference(&ns->base.texture, pt);
- ns->base.format = pt->format;
- ns->base.width = u_minify(pt->width0, level);
- ns->base.height = u_minify(pt->height0, level);
- ns->base.usage = flags;
- pipe_reference_init(&ns->base.reference, 1);
- ns->base.face = face;
- ns->base.level = level;
- ns->base.zslice = zslice;
- ns->pitch = nv30mt->level[level].pitch;
-
- if (pt->target == PIPE_TEXTURE_CUBE) {
- ns->base.offset = nv30mt->level[level].image_offset[face];
- } else
- if (pt->target == PIPE_TEXTURE_3D) {
- ns->base.offset = nv30mt->level[level].image_offset[zslice];
- } else {
- ns->base.offset = nv30mt->level[level].image_offset[0];
- }
-
- /* create a linear temporary that we can render into if necessary.
- * Note that ns->pitch is always a multiple of 64 for linear surfaces and swizzled surfaces are POT, so
- * ns->pitch & 63 is equivalent to (ns->pitch < 64 && swizzled)*/
- if((ns->pitch & 63) && (ns->base.usage & (PIPE_BUFFER_USAGE_GPU_WRITE | NOUVEAU_BUFFER_USAGE_NO_RENDER)) == PIPE_BUFFER_USAGE_GPU_WRITE)
- return &nv04_surface_wrap_for_render(pscreen, ((struct nv30_screen*)pscreen)->eng2d, ns)->base;
-
- return &ns->base;
-}
-
-static void
-nv30_miptree_surface_del(struct pipe_surface *ps)
-{
- struct nv04_surface* ns = (struct nv04_surface*)ps;
- if(ns->backing)
- {
- struct nv30_screen* screen = (struct nv30_screen*)ps->texture->screen;
- if(ns->backing->base.usage & PIPE_BUFFER_USAGE_GPU_WRITE)
- screen->eng2d->copy(screen->eng2d, &ns->backing->base, 0, 0, ps, 0, 0, ns->base.width, ns->base.height);
- nv30_miptree_surface_del(&ns->backing->base);
- }
-
- pipe_texture_reference(&ps->texture, NULL);
- FREE(ps);
-}
-
-void
-nv30_screen_init_miptree_functions(struct pipe_screen *pscreen)
-{
- pscreen->texture_create = nv30_miptree_create;
- pscreen->texture_blanket = nv30_miptree_blanket;
- pscreen->texture_destroy = nv30_miptree_destroy;
- pscreen->get_tex_surface = nv30_miptree_surface_new;
- pscreen->tex_surface_destroy = nv30_miptree_surface_del;
-}
diff --git a/src/gallium/drivers/nv30/nv30_query.c b/src/gallium/drivers/nv30/nv30_query.c
deleted file mode 100644
index e27e9ccbf6..0000000000
--- a/src/gallium/drivers/nv30/nv30_query.c
+++ /dev/null
@@ -1,127 +0,0 @@
-#include "pipe/p_context.h"
-
-#include "nv30_context.h"
-
-struct nv30_query {
- struct nouveau_resource *object;
- unsigned type;
- boolean ready;
- uint64_t result;
-};
-
-static INLINE struct nv30_query *
-nv30_query(struct pipe_query *pipe)
-{
- return (struct nv30_query *)pipe;
-}
-
-static struct pipe_query *
-nv30_query_create(struct pipe_context *pipe, unsigned query_type)
-{
- struct nv30_query *q;
-
- q = CALLOC(1, sizeof(struct nv30_query));
- q->type = query_type;
-
- return (struct pipe_query *)q;
-}
-
-static void
-nv30_query_destroy(struct pipe_context *pipe, struct pipe_query *pq)
-{
- struct nv30_query *q = nv30_query(pq);
-
- if (q->object)
- nouveau_resource_free(&q->object);
- FREE(q);
-}
-
-static void
-nv30_query_begin(struct pipe_context *pipe, struct pipe_query *pq)
-{
- struct nv30_context *nv30 = nv30_context(pipe);
- struct nv30_query *q = nv30_query(pq);
- struct nv30_screen *screen = nv30->screen;
- struct nouveau_channel *chan = screen->base.channel;
- struct nouveau_grobj *rankine = screen->rankine;
-
- assert(q->type == PIPE_QUERY_OCCLUSION_COUNTER);
-
- /* Happens when end_query() is called, then another begin_query()
- * without querying the result in-between. For now we'll wait for
- * the existing query to notify completion, but it could be better.
- */
- if (q->object) {
- uint64_t tmp;
- pipe->get_query_result(pipe, pq, 1, &tmp);
- }
-
- if (nouveau_resource_alloc(nv30->screen->query_heap, 1, NULL, &q->object))
- assert(0);
- nouveau_notifier_reset(nv30->screen->query, q->object->start);
-
- BEGIN_RING(chan, rankine, NV34TCL_QUERY_RESET, 1);
- OUT_RING (chan, 1);
- BEGIN_RING(chan, rankine, NV34TCL_QUERY_UNK17CC, 1);
- OUT_RING (chan, 1);
-
- q->ready = FALSE;
-}
-
-static void
-nv30_query_end(struct pipe_context *pipe, struct pipe_query *pq)
-{
- struct nv30_context *nv30 = nv30_context(pipe);
- struct nv30_screen *screen = nv30->screen;
- struct nouveau_channel *chan = screen->base.channel;
- struct nouveau_grobj *rankine = screen->rankine;
- struct nv30_query *q = nv30_query(pq);
-
- BEGIN_RING(chan, rankine, NV34TCL_QUERY_GET, 1);
- OUT_RING (chan, (0x01 << NV34TCL_QUERY_GET_UNK24_SHIFT) |
- ((q->object->start * 32) << NV34TCL_QUERY_GET_OFFSET_SHIFT));
- FIRE_RING(chan);
-}
-
-static boolean
-nv30_query_result(struct pipe_context *pipe, struct pipe_query *pq,
- boolean wait, uint64_t *result)
-{
- struct nv30_context *nv30 = nv30_context(pipe);
- struct nv30_query *q = nv30_query(pq);
-
- assert(q->object && q->type == PIPE_QUERY_OCCLUSION_COUNTER);
-
- if (!q->ready) {
- unsigned status;
-
- status = nouveau_notifier_status(nv30->screen->query,
- q->object->start);
- if (status != NV_NOTIFY_STATE_STATUS_COMPLETED) {
- if (wait == FALSE)
- return FALSE;
-
- nouveau_notifier_wait_status(nv30->screen->query,
- q->object->start,
- NV_NOTIFY_STATE_STATUS_COMPLETED, 0);
- }
-
- q->result = nouveau_notifier_return_val(nv30->screen->query,
- q->object->start);
- q->ready = TRUE;
- nouveau_resource_free(&q->object);
- }
-
- *result = q->result;
- return TRUE;
-}
-
-void
-nv30_init_query_functions(struct nv30_context *nv30)
-{
- nv30->pipe.create_query = nv30_query_create;
- nv30->pipe.destroy_query = nv30_query_destroy;
- nv30->pipe.begin_query = nv30_query_begin;
- nv30->pipe.end_query = nv30_query_end;
- nv30->pipe.get_query_result = nv30_query_result;
-}
diff --git a/src/gallium/drivers/nv30/nv30_screen.c b/src/gallium/drivers/nv30/nv30_screen.c
deleted file mode 100644
index 85433d2095..0000000000
--- a/src/gallium/drivers/nv30/nv30_screen.c
+++ /dev/null
@@ -1,362 +0,0 @@
-#include "pipe/p_screen.h"
-#include "pipe/p_state.h"
-
-#include "nouveau/nouveau_screen.h"
-
-#include "nv30_context.h"
-#include "nv30_screen.h"
-
-#define NV30TCL_CHIPSET_3X_MASK 0x00000003
-#define NV34TCL_CHIPSET_3X_MASK 0x00000010
-#define NV35TCL_CHIPSET_3X_MASK 0x000001e0
-
-/* FIXME: It seems I should not include directly ../../winsys/drm/nouveau/drm/nouveau_drm_api.h
- * to get the pointer to the context front buffer, so I copied nouveau_winsys here.
- * nv30_screen_surface_format_supported() can then use it to enforce creating fbo
- * with same number of bits everywhere.
- */
-struct nouveau_winsys {
- struct pipe_winsys base;
-
- struct pipe_screen *pscreen;
-
- struct pipe_surface *front;
-};
-
-static int
-nv30_screen_get_param(struct pipe_screen *pscreen, int param)
-{
- switch (param) {
- case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
- return 8;
- case PIPE_CAP_NPOT_TEXTURES:
- return 0;
- case PIPE_CAP_TWO_SIDED_STENCIL:
- return 1;
- case PIPE_CAP_GLSL:
- return 0;
- case PIPE_CAP_ANISOTROPIC_FILTER:
- return 1;
- case PIPE_CAP_POINT_SPRITE:
- return 1;
- case PIPE_CAP_MAX_RENDER_TARGETS:
- return 2;
- case PIPE_CAP_OCCLUSION_QUERY:
- return 1;
- case PIPE_CAP_TEXTURE_SHADOW_MAP:
- return 1;
- case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
- return 13;
- case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
- return 10;
- case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
- return 13;
- case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
- return 0;
- case PIPE_CAP_TEXTURE_MIRROR_REPEAT:
- return 1;
- case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS:
- return 0;
- case PIPE_CAP_TGSI_CONT_SUPPORTED:
- return 0;
- case PIPE_CAP_BLEND_EQUATION_SEPARATE:
- return 0;
- case NOUVEAU_CAP_HW_VTXBUF:
- case NOUVEAU_CAP_HW_IDXBUF:
- return 1;
- case PIPE_CAP_MAX_COMBINED_SAMPLERS:
- return 16;
- case PIPE_CAP_INDEP_BLEND_ENABLE:
- return 0;
- case PIPE_CAP_INDEP_BLEND_FUNC:
- return 0;
- case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
- case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
- return 1;
- case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
- case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
- return 0;
- default:
- NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
- return 0;
- }
-}
-
-static float
-nv30_screen_get_paramf(struct pipe_screen *pscreen, int param)
-{
- switch (param) {
- case PIPE_CAP_MAX_LINE_WIDTH:
- case PIPE_CAP_MAX_LINE_WIDTH_AA:
- return 10.0;
- case PIPE_CAP_MAX_POINT_WIDTH:
- case PIPE_CAP_MAX_POINT_WIDTH_AA:
- return 64.0;
- case PIPE_CAP_MAX_TEXTURE_ANISOTROPY:
- return 8.0;
- case PIPE_CAP_MAX_TEXTURE_LOD_BIAS:
- return 4.0;
- default:
- NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
- return 0.0;
- }
-}
-
-static boolean
-nv30_screen_surface_format_supported(struct pipe_screen *pscreen,
- enum pipe_format format,
- enum pipe_texture_target target,
- unsigned tex_usage, unsigned geom_flags)
-{
- struct pipe_surface *front = ((struct nouveau_winsys *) pscreen->winsys)->front;
-
- if (tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET) {
- switch (format) {
- case PIPE_FORMAT_B8G8R8A8_UNORM:
- case PIPE_FORMAT_B5G6R5_UNORM:
- return TRUE;
- default:
- break;
- }
- } else
- if (tex_usage & PIPE_TEXTURE_USAGE_DEPTH_STENCIL) {
- switch (format) {
- case PIPE_FORMAT_S8Z24_UNORM:
- case PIPE_FORMAT_X8Z24_UNORM:
- return TRUE;
- case PIPE_FORMAT_Z16_UNORM:
- if (front) {
- return (front->format == PIPE_FORMAT_B5G6R5_UNORM);
- }
- return TRUE;
- default:
- break;
- }
- } else {
- switch (format) {
- case PIPE_FORMAT_B8G8R8A8_UNORM:
- case PIPE_FORMAT_B5G5R5A1_UNORM:
- case PIPE_FORMAT_B4G4R4A4_UNORM:
- case PIPE_FORMAT_B5G6R5_UNORM:
- case PIPE_FORMAT_L8_UNORM:
- case PIPE_FORMAT_A8_UNORM:
- case PIPE_FORMAT_I8_UNORM:
- case PIPE_FORMAT_L8A8_UNORM:
- case PIPE_FORMAT_Z16_UNORM:
- case PIPE_FORMAT_S8Z24_UNORM:
- return TRUE;
- default:
- break;
- }
- }
-
- return FALSE;
-}
-
-static struct pipe_buffer *
-nv30_surface_buffer(struct pipe_surface *surf)
-{
- struct nv30_miptree *mt = (struct nv30_miptree *)surf->texture;
-
- return mt->buffer;
-}
-
-static void
-nv30_screen_destroy(struct pipe_screen *pscreen)
-{
- struct nv30_screen *screen = nv30_screen(pscreen);
- unsigned i;
-
- for (i = 0; i < NV30_STATE_MAX; i++) {
- if (screen->state[i])
- so_ref(NULL, &screen->state[i]);
- }
-
- nouveau_resource_destroy(&screen->vp_exec_heap);
- nouveau_resource_destroy(&screen->vp_data_heap);
- nouveau_resource_destroy(&screen->query_heap);
- nouveau_notifier_free(&screen->query);
- nouveau_notifier_free(&screen->sync);
- nouveau_grobj_free(&screen->rankine);
- nv04_surface_2d_takedown(&screen->eng2d);
-
- nouveau_screen_fini(&screen->base);
-
- FREE(pscreen);
-}
-
-struct pipe_screen *
-nv30_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
-{
- struct nv30_screen *screen = CALLOC_STRUCT(nv30_screen);
- struct nouveau_channel *chan;
- struct pipe_screen *pscreen;
- struct nouveau_stateobj *so;
- unsigned rankine_class = 0;
- int ret, i;
-
- if (!screen)
- return NULL;
- pscreen = &screen->base.base;
-
- ret = nouveau_screen_init(&screen->base, dev);
- if (ret) {
- nv30_screen_destroy(pscreen);
- return NULL;
- }
- chan = screen->base.channel;
-
- pscreen->winsys = ws;
- pscreen->destroy = nv30_screen_destroy;
- pscreen->get_param = nv30_screen_get_param;
- pscreen->get_paramf = nv30_screen_get_paramf;
- pscreen->is_format_supported = nv30_screen_surface_format_supported;
- pscreen->context_create = nv30_create;
-
- nv30_screen_init_miptree_functions(pscreen);
- nv30_screen_init_transfer_functions(pscreen);
-
- /* 3D object */
- switch (dev->chipset & 0xf0) {
- case 0x30:
- if (NV30TCL_CHIPSET_3X_MASK & (1 << (dev->chipset & 0x0f)))
- rankine_class = 0x0397;
- else
- if (NV34TCL_CHIPSET_3X_MASK & (1 << (dev->chipset & 0x0f)))
- rankine_class = 0x0697;
- else
- if (NV35TCL_CHIPSET_3X_MASK & (1 << (dev->chipset & 0x0f)))
- rankine_class = 0x0497;
- break;
- default:
- break;
- }
-
- if (!rankine_class) {
- NOUVEAU_ERR("Unknown nv3x chipset: nv%02x\n", dev->chipset);
- return NULL;
- }
-
- ret = nouveau_grobj_alloc(chan, 0xbeef3097, rankine_class,
- &screen->rankine);
- if (ret) {
- NOUVEAU_ERR("Error creating 3D object: %d\n", ret);
- return FALSE;
- }
-
- /* 2D engine setup */
- screen->eng2d = nv04_surface_2d_init(&screen->base);
- screen->eng2d->buf = nv30_surface_buffer;
-
- /* Notifier for sync purposes */
- ret = nouveau_notifier_alloc(chan, 0xbeef0301, 1, &screen->sync);
- if (ret) {
- NOUVEAU_ERR("Error creating notifier object: %d\n", ret);
- nv30_screen_destroy(pscreen);
- return NULL;
- }
-
- /* Query objects */
- ret = nouveau_notifier_alloc(chan, 0xbeef0302, 32, &screen->query);
- if (ret) {
- NOUVEAU_ERR("Error initialising query objects: %d\n", ret);
- nv30_screen_destroy(pscreen);
- return NULL;
- }
-
- ret = nouveau_resource_init(&screen->query_heap, 0, 32);
- if (ret) {
- NOUVEAU_ERR("Error initialising query object heap: %d\n", ret);
- nv30_screen_destroy(pscreen);
- return NULL;
- }
-
- /* Vtxprog resources */
- if (nouveau_resource_init(&screen->vp_exec_heap, 0, 256) ||
- nouveau_resource_init(&screen->vp_data_heap, 0, 256)) {
- nv30_screen_destroy(pscreen);
- return NULL;
- }
-
- /* Static rankine initialisation */
- so = so_new(36, 60, 0);
- so_method(so, screen->rankine, NV34TCL_DMA_NOTIFY, 1);
- so_data (so, screen->sync->handle);
- so_method(so, screen->rankine, NV34TCL_DMA_TEXTURE0, 2);
- so_data (so, chan->vram->handle);
- so_data (so, chan->gart->handle);
- so_method(so, screen->rankine, NV34TCL_DMA_COLOR1, 1);
- so_data (so, chan->vram->handle);
- so_method(so, screen->rankine, NV34TCL_DMA_COLOR0, 2);
- so_data (so, chan->vram->handle);
- so_data (so, chan->vram->handle);
- so_method(so, screen->rankine, NV34TCL_DMA_VTXBUF0, 2);
- so_data (so, chan->vram->handle);
- so_data (so, chan->gart->handle);
-/* so_method(so, screen->rankine, NV34TCL_DMA_FENCE, 2);
- so_data (so, 0);
- so_data (so, screen->query->handle);*/
- so_method(so, screen->rankine, NV34TCL_DMA_IN_MEMORY7, 1);
- so_data (so, chan->vram->handle);
- so_method(so, screen->rankine, NV34TCL_DMA_IN_MEMORY8, 1);
- so_data (so, chan->vram->handle);
-
- for (i=1; i<8; i++) {
- so_method(so, screen->rankine, NV34TCL_VIEWPORT_CLIP_HORIZ(i), 1);
- so_data (so, 0);
- so_method(so, screen->rankine, NV34TCL_VIEWPORT_CLIP_VERT(i), 1);
- so_data (so, 0);
- }
-
- so_method(so, screen->rankine, 0x220, 1);
- so_data (so, 1);
-
- so_method(so, screen->rankine, 0x03b0, 1);
- so_data (so, 0x00100000);
- so_method(so, screen->rankine, 0x1454, 1);
- so_data (so, 0);
- so_method(so, screen->rankine, 0x1d80, 1);
- so_data (so, 3);
- so_method(so, screen->rankine, 0x1450, 1);
- so_data (so, 0x00030004);
-
- /* NEW */
- so_method(so, screen->rankine, 0x1e98, 1);
- so_data (so, 0);
- so_method(so, screen->rankine, 0x17e0, 3);
- so_data (so, fui(0.0));
- so_data (so, fui(0.0));
- so_data (so, fui(1.0));
- so_method(so, screen->rankine, 0x1f80, 16);
- for (i=0; i<16; i++) {
- so_data (so, (i==8) ? 0x0000ffff : 0);
- }
-
- so_method(so, screen->rankine, 0x120, 3);
- so_data (so, 0);
- so_data (so, 1);
- so_data (so, 2);
-
- so_method(so, screen->rankine, 0x1d88, 1);
- so_data (so, 0x00001200);
-
- so_method(so, screen->rankine, NV34TCL_RC_ENABLE, 1);
- so_data (so, 0);
-
- so_method(so, screen->rankine, NV34TCL_DEPTH_RANGE_NEAR, 2);
- so_data (so, fui(0.0));
- so_data (so, fui(1.0));
-
- so_method(so, screen->rankine, NV34TCL_MULTISAMPLE_CONTROL, 1);
- so_data (so, 0xffff0000);
-
- /* enables use of vp rather than fixed-function somehow */
- so_method(so, screen->rankine, 0x1e94, 1);
- so_data (so, 0x13);
-
- so_emit(chan, so);
- so_ref(NULL, &so);
- nouveau_pushbuf_flush(chan, 0);
-
- return pscreen;
-}
diff --git a/src/gallium/drivers/nv30/nv30_screen.h b/src/gallium/drivers/nv30/nv30_screen.h
deleted file mode 100644
index 8591cd31ca..0000000000
--- a/src/gallium/drivers/nv30/nv30_screen.h
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifndef __NV30_SCREEN_H__
-#define __NV30_SCREEN_H__
-
-#include "nouveau/nouveau_screen.h"
-
-#include "nouveau/nv04_surface_2d.h"
-
-struct nv30_screen {
- struct nouveau_screen base;
-
- struct nouveau_winsys *nvws;
-
- struct nv30_context *cur_ctx;
-
- /* HW graphics objects */
- struct nv04_surface_2d *eng2d;
- struct nouveau_grobj *rankine;
- struct nouveau_notifier *sync;
-
- /* Query object resources */
- struct nouveau_notifier *query;
- struct nouveau_resource *query_heap;
-
- /* Vtxprog resources */
- struct nouveau_resource *vp_exec_heap;
- struct nouveau_resource *vp_data_heap;
-
- /* Current 3D state of channel */
- struct nouveau_stateobj *state[NV30_STATE_MAX];
-};
-
-static INLINE struct nv30_screen *
-nv30_screen(struct pipe_screen *screen)
-{
- return (struct nv30_screen *)screen;
-}
-
-void
-nv30_screen_init_transfer_functions(struct pipe_screen *pscreen);
-
-#endif
diff --git a/src/gallium/drivers/nv30/nv30_shader.h b/src/gallium/drivers/nv30/nv30_shader.h
deleted file mode 100644
index dd3a36f78f..0000000000
--- a/src/gallium/drivers/nv30/nv30_shader.h
+++ /dev/null
@@ -1,490 +0,0 @@
-#ifndef __NV30_SHADER_H__
-#define __NV30_SHADER_H__
-
-/* Vertex programs instruction set
- *
- * 128bit opcodes, split into 4 32-bit ones for ease of use.
- *
- * Non-native instructions
- * ABS - MOV + NV40_VP_INST0_DEST_ABS
- * POW - EX2 + MUL + LG2
- * SUB - ADD, second source negated
- * SWZ - MOV
- * XPD -
- *
- * Register access
- * - Only one INPUT can be accessed per-instruction (move extras into TEMPs)
- * - Only one CONST can be accessed per-instruction (move extras into TEMPs)
- *
- * Relative Addressing
- * According to the value returned for
- * MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB
- *
- * there are only two address registers available. The destination in the
- * ARL instruction is set to TEMP <n> (The temp isn't actually written).
- *
- * When using vanilla ARB_v_p, the proprietary driver will squish both the
- * available ADDRESS regs into the first hardware reg in the X and Y
- * components.
- *
- * To use an address reg as an index into consts, the CONST_SRC is set to
- * (const_base + offset) and INDEX_CONST is set.
- *
- * To access the second address reg use ADDR_REG_SELECT_1. A particular
- * component of the address regs is selected with ADDR_SWZ.
- *
- * Only one address register can be accessed per instruction.
- *
- * Conditional execution (see NV_vertex_program{2,3} for details) Conditional
- * execution of an instruction is enabled by setting COND_TEST_ENABLE, and
- * selecting the condition which will allow the test to pass with
- * COND_{FL,LT,...}. It is possible to swizzle the values in the condition
- * register, which allows for testing against an individual component.
- *
- * Branching:
- *
- * The BRA/CAL instructions seem to follow a slightly different opcode
- * layout. The destination instruction ID (IADDR) overlaps a source field.
- * Instruction ID's seem to be numbered based on the UPLOAD_FROM_ID FIFO
- * command, and is incremented automatically on each UPLOAD_INST FIFO
- * command.
- *
- * Conditional branching is achieved by using the condition tests described
- * above. There doesn't appear to be dedicated looping instructions, but
- * this can be done using a temp reg + conditional branching.
- *
- * Subroutines may be uploaded before the main program itself, but the first
- * executed instruction is determined by the PROGRAM_START_ID FIFO command.
- *
- */
-
-/* DWORD 0 */
-
-#define NV30_VP_INST_ADDR_REG_SELECT_1 (1 << 24)
-#define NV30_VP_INST_SRC2_ABS (1 << 23) /* guess */
-#define NV30_VP_INST_SRC1_ABS (1 << 22) /* guess */
-#define NV30_VP_INST_SRC0_ABS (1 << 21) /* guess */
-#define NV30_VP_INST_VEC_RESULT (1 << 20)
-#define NV30_VP_INST_DEST_TEMP_ID_SHIFT 16
-#define NV30_VP_INST_DEST_TEMP_ID_MASK (0x0F << 16)
-#define NV30_VP_INST_COND_UPDATE_ENABLE (1<<15)
-#define NV30_VP_INST_VEC_DEST_TEMP_MASK (0xF << 16)
-#define NV30_VP_INST_COND_TEST_ENABLE (1<<14)
-#define NV30_VP_INST_COND_SHIFT 11
-#define NV30_VP_INST_COND_MASK (0x07 << 11)
-# define NV30_VP_INST_COND_FL 0 /* guess */
-# define NV30_VP_INST_COND_LT 1
-# define NV30_VP_INST_COND_EQ 2
-# define NV30_VP_INST_COND_LE 3
-# define NV30_VP_INST_COND_GT 4
-# define NV30_VP_INST_COND_NE 5
-# define NV30_VP_INST_COND_GE 6
-# define NV30_VP_INST_COND_TR 7 /* guess */
-#define NV30_VP_INST_COND_SWZ_X_SHIFT 9
-#define NV30_VP_INST_COND_SWZ_X_MASK (0x03 << 9)
-#define NV30_VP_INST_COND_SWZ_Y_SHIFT 7
-#define NV30_VP_INST_COND_SWZ_Y_MASK (0x03 << 7)
-#define NV30_VP_INST_COND_SWZ_Z_SHIFT 5
-#define NV30_VP_INST_COND_SWZ_Z_MASK (0x03 << 5)
-#define NV30_VP_INST_COND_SWZ_W_SHIFT 3
-#define NV30_VP_INST_COND_SWZ_W_MASK (0x03 << 3)
-#define NV30_VP_INST_COND_SWZ_ALL_SHIFT 3
-#define NV30_VP_INST_COND_SWZ_ALL_MASK (0xFF << 3)
-#define NV30_VP_INST_ADDR_SWZ_SHIFT 1
-#define NV30_VP_INST_ADDR_SWZ_MASK (0x03 << 1)
-#define NV30_VP_INST_SCA_OPCODEH_SHIFT 0
-#define NV30_VP_INST_SCA_OPCODEH_MASK (0x01 << 0)
-
-/* DWORD 1 */
-#define NV30_VP_INST_SCA_OPCODEL_SHIFT 28
-#define NV30_VP_INST_SCA_OPCODEL_MASK (0x0F << 28)
-# define NV30_VP_INST_OP_NOP 0x00
-# define NV30_VP_INST_OP_RCP 0x02
-# define NV30_VP_INST_OP_RCC 0x03
-# define NV30_VP_INST_OP_RSQ 0x04
-# define NV30_VP_INST_OP_EXP 0x05
-# define NV30_VP_INST_OP_LOG 0x06
-# define NV30_VP_INST_OP_LIT 0x07
-# define NV30_VP_INST_OP_BRA 0x09
-# define NV30_VP_INST_OP_CAL 0x0B
-# define NV30_VP_INST_OP_RET 0x0C
-# define NV30_VP_INST_OP_LG2 0x0D
-# define NV30_VP_INST_OP_EX2 0x0E
-# define NV30_VP_INST_OP_SIN 0x0F
-# define NV30_VP_INST_OP_COS 0x10
-#define NV30_VP_INST_VEC_OPCODE_SHIFT 23
-#define NV30_VP_INST_VEC_OPCODE_MASK (0x1F << 23)
-# define NV30_VP_INST_OP_NOPV 0x00
-# define NV30_VP_INST_OP_MOV 0x01
-# define NV30_VP_INST_OP_MUL 0x02
-# define NV30_VP_INST_OP_ADD 0x03
-# define NV30_VP_INST_OP_MAD 0x04
-# define NV30_VP_INST_OP_DP3 0x05
-# define NV30_VP_INST_OP_DP4 0x07
-# define NV30_VP_INST_OP_DPH 0x06
-# define NV30_VP_INST_OP_DST 0x08
-# define NV30_VP_INST_OP_MIN 0x09
-# define NV30_VP_INST_OP_MAX 0x0A
-# define NV30_VP_INST_OP_SLT 0x0B
-# define NV30_VP_INST_OP_SGE 0x0C
-# define NV30_VP_INST_OP_ARL 0x0D
-# define NV30_VP_INST_OP_FRC 0x0E
-# define NV30_VP_INST_OP_FLR 0x0F
-# define NV30_VP_INST_OP_SEQ 0x10
-# define NV30_VP_INST_OP_SFL 0x11
-# define NV30_VP_INST_OP_SGT 0x12
-# define NV30_VP_INST_OP_SLE 0x13
-# define NV30_VP_INST_OP_SNE 0x14
-# define NV30_VP_INST_OP_STR 0x15
-# define NV30_VP_INST_OP_SSG 0x16
-# define NV30_VP_INST_OP_ARR 0x17
-# define NV30_VP_INST_OP_ARA 0x18
-#define NV30_VP_INST_CONST_SRC_SHIFT 14
-#define NV30_VP_INST_CONST_SRC_MASK (0xFF << 14)
-#define NV30_VP_INST_INPUT_SRC_SHIFT 9 /*NV20*/
-#define NV30_VP_INST_INPUT_SRC_MASK (0x0F << 9) /*NV20*/
-# define NV30_VP_INST_IN_POS 0 /* These seem to match the bindings specified in */
-# define NV30_VP_INST_IN_WEIGHT 1 /* the ARB_v_p spec (2.14.3.1) */
-# define NV30_VP_INST_IN_NORMAL 2
-# define NV30_VP_INST_IN_COL0 3 /* Should probably confirm them all though */
-# define NV30_VP_INST_IN_COL1 4
-# define NV30_VP_INST_IN_FOGC 5
-# define NV30_VP_INST_IN_TC0 8
-# define NV30_VP_INST_IN_TC(n) (8+n)
-#define NV30_VP_INST_SRC0H_SHIFT 0 /*NV20*/
-#define NV30_VP_INST_SRC0H_MASK (0x1FF << 0) /*NV20*/
-
-/* Please note: the IADDR fields overlap other fields because they are used
- * only for branch instructions. See Branching: label above
- *
- * DWORD 2
- */
-#define NV30_VP_INST_SRC0L_SHIFT 26 /*NV20*/
-#define NV30_VP_INST_SRC0L_MASK (0x3F <<26) /* NV30_VP_SRC0_LOW_MASK << 26 */
-#define NV30_VP_INST_SRC1_SHIFT 11 /*NV20*/
-#define NV30_VP_INST_SRC1_MASK (0x7FFF<<11) /*NV20*/
-#define NV30_VP_INST_SRC2H_SHIFT 0 /*NV20*/
-#define NV30_VP_INST_SRC2H_MASK (0x7FF << 0) /* NV30_VP_SRC2_HIGH_MASK >> 4*/
-#define NV30_VP_INST_IADDR_SHIFT 2
-#define NV30_VP_INST_IADDR_MASK (0xF << 28) /* NV30_VP_SRC2_LOW_MASK << 28 */
-
-/* DWORD 3 */
-#define NV30_VP_INST_SRC2L_SHIFT 28 /*NV20*/
-#define NV30_VP_INST_SRC2L_MASK (0x0F <<28) /*NV20*/
-#define NV30_VP_INST_STEMP_WRITEMASK_SHIFT 24
-#define NV30_VP_INST_STEMP_WRITEMASK_MASK (0x0F << 24)
-#define NV30_VP_INST_VTEMP_WRITEMASK_SHIFT 20
-#define NV30_VP_INST_VTEMP_WRITEMASK_MASK (0x0F << 20)
-#define NV30_VP_INST_SDEST_WRITEMASK_SHIFT 16
-#define NV30_VP_INST_SDEST_WRITEMASK_MASK (0x0F << 16)
-#define NV30_VP_INST_VDEST_WRITEMASK_SHIFT 12 /*NV20*/
-#define NV30_VP_INST_VDEST_WRITEMASK_MASK (0x0F << 12) /*NV20*/
-#define NV30_VP_INST_DEST_SHIFT 2
-#define NV30_VP_INST_DEST_MASK (0x0F << 2)
-# define NV30_VP_INST_DEST_POS 0
-# define NV30_VP_INST_DEST_BFC0 1
-# define NV30_VP_INST_DEST_BFC1 2
-# define NV30_VP_INST_DEST_COL0 3
-# define NV30_VP_INST_DEST_COL1 4
-# define NV30_VP_INST_DEST_FOGC 5
-# define NV30_VP_INST_DEST_PSZ 6
-# define NV30_VP_INST_DEST_TC(n) (8+n)
-
-#define NV30_VP_INST_LAST (1 << 0)
-
-/* Useful to split the source selection regs into their pieces */
-#define NV30_VP_SRC0_HIGH_SHIFT 6
-#define NV30_VP_SRC0_HIGH_MASK 0x00007FC0
-#define NV30_VP_SRC0_LOW_MASK 0x0000003F
-#define NV30_VP_SRC2_HIGH_SHIFT 4
-#define NV30_VP_SRC2_HIGH_MASK 0x00007FF0
-#define NV30_VP_SRC2_LOW_MASK 0x0000000F
-
-
-/* Source-register definition - matches NV20 exactly */
-#define NV30_VP_SRC_NEGATE (1<<14)
-#define NV30_VP_SRC_SWZ_X_SHIFT 12
-#define NV30_VP_SRC_REG_SWZ_X_MASK (0x03 <<12)
-#define NV30_VP_SRC_SWZ_Y_SHIFT 10
-#define NV30_VP_SRC_REG_SWZ_Y_MASK (0x03 <<10)
-#define NV30_VP_SRC_SWZ_Z_SHIFT 8
-#define NV30_VP_SRC_REG_SWZ_Z_MASK (0x03 << 8)
-#define NV30_VP_SRC_SWZ_W_SHIFT 6
-#define NV30_VP_SRC_REG_SWZ_W_MASK (0x03 << 6)
-#define NV30_VP_SRC_REG_SWZ_ALL_SHIFT 6
-#define NV30_VP_SRC_REG_SWZ_ALL_MASK (0xFF << 6)
-#define NV30_VP_SRC_TEMP_SRC_SHIFT 2
-#define NV30_VP_SRC_REG_TEMP_ID_MASK (0x0F << 0)
-#define NV30_VP_SRC_REG_TYPE_SHIFT 0
-#define NV30_VP_SRC_REG_TYPE_MASK (0x03 << 0)
-#define NV30_VP_SRC_REG_TYPE_TEMP 1
-#define NV30_VP_SRC_REG_TYPE_INPUT 2
-#define NV30_VP_SRC_REG_TYPE_CONST 3 /* guess */
-
-/*
- * Each fragment program opcode appears to be comprised of 4 32-bit values.
- *
- * 0 - Opcode, output reg/mask, ATTRIB source
- * 1 - Source 0
- * 2 - Source 1
- * 3 - Source 2
- *
- * There appears to be no special difference between result regs and temp regs.
- * result.color == R0.xyzw
- * result.depth == R1.z
- * When the fragprog contains instructions to write depth, NV30_TCL_PRIMITIVE_3D_UNK1D78=0
- * otherwise it is set to 1.
- *
- * Constants are inserted directly after the instruction that uses them.
- *
- * It appears that it's not possible to use two input registers in one
- * instruction as the input sourcing is done in the instruction dword
- * and not the source selection dwords. As such instructions such as:
- *
- * ADD result.color, fragment.color, fragment.texcoord[0];
- *
- * must be split into two MOV's and then an ADD (nvidia does this) but
- * I'm not sure why it's not just one MOV and then source the second input
- * in the ADD instruction..
- *
- * Negation of the full source is done with NV30_FP_REG_NEGATE, arbitrary
- * negation requires multiplication with a const.
- *
- * Arbitrary swizzling is supported with the exception of SWIZZLE_ZERO/SWIZZLE_ONE
- * The temp/result regs appear to be initialised to (0.0, 0.0, 0.0, 0.0) as SWIZZLE_ZERO
- * is implemented simply by not writing to the relevant components of the destination.
- *
- * Conditional execution
- * TODO
- *
- * Non-native instructions:
- * LIT
- * LRP - MAD+MAD
- * SUB - ADD, negate second source
- * RSQ - LG2 + EX2
- * POW - LG2 + MUL + EX2
- * SCS - COS + SIN
- * XPD
- */
-
-//== Opcode / Destination selection ==
-#define NV30_FP_OP_PROGRAM_END (1 << 0)
-#define NV30_FP_OP_OUT_REG_SHIFT 1
-#define NV30_FP_OP_OUT_REG_MASK (31 << 1) /* uncertain */
-/* Needs to be set when writing outputs to get expected result.. */
-#define NV30_FP_OP_OUT_REG_HALF (1 << 7)
-#define NV30_FP_OP_COND_WRITE_ENABLE (1 << 8)
-#define NV30_FP_OP_OUTMASK_SHIFT 9
-#define NV30_FP_OP_OUTMASK_MASK (0xF << 9)
-# define NV30_FP_OP_OUT_X (1<<9)
-# define NV30_FP_OP_OUT_Y (1<<10)
-# define NV30_FP_OP_OUT_Z (1<<11)
-# define NV30_FP_OP_OUT_W (1<<12)
-/* Uncertain about these, especially the input_src values.. it's possible that
- * they can be dynamically changed.
- */
-#define NV30_FP_OP_INPUT_SRC_SHIFT 13
-#define NV30_FP_OP_INPUT_SRC_MASK (15 << 13)
-# define NV30_FP_OP_INPUT_SRC_POSITION 0x0
-# define NV30_FP_OP_INPUT_SRC_COL0 0x1
-# define NV30_FP_OP_INPUT_SRC_COL1 0x2
-# define NV30_FP_OP_INPUT_SRC_FOGC 0x3
-# define NV30_FP_OP_INPUT_SRC_TC0 0x4
-# define NV30_FP_OP_INPUT_SRC_TC(n) (0x4 + n)
-#define NV30_FP_OP_TEX_UNIT_SHIFT 17
-#define NV30_FP_OP_TEX_UNIT_MASK (0xF << 17) /* guess */
-#define NV30_FP_OP_PRECISION_SHIFT 22
-#define NV30_FP_OP_PRECISION_MASK (3 << 22)
-# define NV30_FP_PRECISION_FP32 0
-# define NV30_FP_PRECISION_FP16 1
-# define NV30_FP_PRECISION_FX12 2
-#define NV30_FP_OP_OPCODE_SHIFT 24
-#define NV30_FP_OP_OPCODE_MASK (0x3F << 24)
-# define NV30_FP_OP_OPCODE_NOP 0x00
-# define NV30_FP_OP_OPCODE_MOV 0x01
-# define NV30_FP_OP_OPCODE_MUL 0x02
-# define NV30_FP_OP_OPCODE_ADD 0x03
-# define NV30_FP_OP_OPCODE_MAD 0x04
-# define NV30_FP_OP_OPCODE_DP3 0x05
-# define NV30_FP_OP_OPCODE_DP4 0x06
-# define NV30_FP_OP_OPCODE_DST 0x07
-# define NV30_FP_OP_OPCODE_MIN 0x08
-# define NV30_FP_OP_OPCODE_MAX 0x09
-# define NV30_FP_OP_OPCODE_SLT 0x0A
-# define NV30_FP_OP_OPCODE_SGE 0x0B
-# define NV30_FP_OP_OPCODE_SLE 0x0C
-# define NV30_FP_OP_OPCODE_SGT 0x0D
-# define NV30_FP_OP_OPCODE_SNE 0x0E
-# define NV30_FP_OP_OPCODE_SEQ 0x0F
-# define NV30_FP_OP_OPCODE_FRC 0x10
-# define NV30_FP_OP_OPCODE_FLR 0x11
-# define NV30_FP_OP_OPCODE_KIL 0x12
-# define NV30_FP_OP_OPCODE_PK4B 0x13
-# define NV30_FP_OP_OPCODE_UP4B 0x14
-# define NV30_FP_OP_OPCODE_DDX 0x15 /* can only write XY */
-# define NV30_FP_OP_OPCODE_DDY 0x16 /* can only write XY */
-# define NV30_FP_OP_OPCODE_TEX 0x17
-# define NV30_FP_OP_OPCODE_TXP 0x18
-# define NV30_FP_OP_OPCODE_TXD 0x19
-# define NV30_FP_OP_OPCODE_RCP 0x1A
-# define NV30_FP_OP_OPCODE_RSQ 0x1B
-# define NV30_FP_OP_OPCODE_EX2 0x1C
-# define NV30_FP_OP_OPCODE_LG2 0x1D
-# define NV30_FP_OP_OPCODE_LIT 0x1E
-# define NV30_FP_OP_OPCODE_LRP 0x1F
-# define NV30_FP_OP_OPCODE_STR 0x20
-# define NV30_FP_OP_OPCODE_SFL 0x21
-# define NV30_FP_OP_OPCODE_COS 0x22
-# define NV30_FP_OP_OPCODE_SIN 0x23
-# define NV30_FP_OP_OPCODE_PK2H 0x24
-# define NV30_FP_OP_OPCODE_UP2H 0x25
-# define NV30_FP_OP_OPCODE_POW 0x26
-# define NV30_FP_OP_OPCODE_PK4UB 0x27
-# define NV30_FP_OP_OPCODE_UP4UB 0x28
-# define NV30_FP_OP_OPCODE_PK2US 0x29
-# define NV30_FP_OP_OPCODE_UP2US 0x2A
-# define NV30_FP_OP_OPCODE_DP2A 0x2E
-# define NV30_FP_OP_OPCODE_TXB 0x31
-# define NV30_FP_OP_OPCODE_RFL 0x36
-# define NV30_FP_OP_OPCODE_DIV 0x3A
-#define NV30_FP_OP_OUT_SAT (1 << 31)
-
-/* high order bits of SRC0 */
-#define NV30_FP_OP_OUT_ABS (1 << 29)
-#define NV30_FP_OP_COND_SWZ_W_SHIFT 27
-#define NV30_FP_OP_COND_SWZ_W_MASK (3 << 27)
-#define NV30_FP_OP_COND_SWZ_Z_SHIFT 25
-#define NV30_FP_OP_COND_SWZ_Z_MASK (3 << 25)
-#define NV30_FP_OP_COND_SWZ_Y_SHIFT 23
-#define NV30_FP_OP_COND_SWZ_Y_MASK (3 << 23)
-#define NV30_FP_OP_COND_SWZ_X_SHIFT 21
-#define NV30_FP_OP_COND_SWZ_X_MASK (3 << 21)
-#define NV30_FP_OP_COND_SWZ_ALL_SHIFT 21
-#define NV30_FP_OP_COND_SWZ_ALL_MASK (0xFF << 21)
-#define NV30_FP_OP_COND_SHIFT 18
-#define NV30_FP_OP_COND_MASK (0x07 << 18)
-# define NV30_FP_OP_COND_FL 0
-# define NV30_FP_OP_COND_LT 1
-# define NV30_FP_OP_COND_EQ 2
-# define NV30_FP_OP_COND_LE 3
-# define NV30_FP_OP_COND_GT 4
-# define NV30_FP_OP_COND_NE 5
-# define NV30_FP_OP_COND_GE 6
-# define NV30_FP_OP_COND_TR 7
-
-/* high order bits of SRC1 */
-#define NV30_FP_OP_DST_SCALE_SHIFT 28
-#define NV30_FP_OP_DST_SCALE_MASK (3 << 28)
-#define NV30_FP_OP_DST_SCALE_1X 0
-#define NV30_FP_OP_DST_SCALE_2X 1
-#define NV30_FP_OP_DST_SCALE_4X 2
-#define NV30_FP_OP_DST_SCALE_8X 3
-#define NV30_FP_OP_DST_SCALE_INV_2X 5
-#define NV30_FP_OP_DST_SCALE_INV_4X 6
-#define NV30_FP_OP_DST_SCALE_INV_8X 7
-
-
-/* high order bits of SRC2 */
-#define NV30_FP_OP_INDEX_INPUT (1 << 30)
-
-//== Register selection ==
-#define NV30_FP_REG_TYPE_SHIFT 0
-#define NV30_FP_REG_TYPE_MASK (3 << 0)
-# define NV30_FP_REG_TYPE_TEMP 0
-# define NV30_FP_REG_TYPE_INPUT 1
-# define NV30_FP_REG_TYPE_CONST 2
-#define NV30_FP_REG_SRC_SHIFT 2 /* uncertain */
-#define NV30_FP_REG_SRC_MASK (31 << 2)
-#define NV30_FP_REG_SRC_HALF (1 << 8)
-#define NV30_FP_REG_SWZ_ALL_SHIFT 9
-#define NV30_FP_REG_SWZ_ALL_MASK (255 << 9)
-#define NV30_FP_REG_SWZ_X_SHIFT 9
-#define NV30_FP_REG_SWZ_X_MASK (3 << 9)
-#define NV30_FP_REG_SWZ_Y_SHIFT 11
-#define NV30_FP_REG_SWZ_Y_MASK (3 << 11)
-#define NV30_FP_REG_SWZ_Z_SHIFT 13
-#define NV30_FP_REG_SWZ_Z_MASK (3 << 13)
-#define NV30_FP_REG_SWZ_W_SHIFT 15
-#define NV30_FP_REG_SWZ_W_MASK (3 << 15)
-# define NV30_FP_SWIZZLE_X 0
-# define NV30_FP_SWIZZLE_Y 1
-# define NV30_FP_SWIZZLE_Z 2
-# define NV30_FP_SWIZZLE_W 3
-#define NV30_FP_REG_NEGATE (1 << 17)
-
-#define NV30SR_NONE 0
-#define NV30SR_OUTPUT 1
-#define NV30SR_INPUT 2
-#define NV30SR_TEMP 3
-#define NV30SR_CONST 4
-
-struct nv30_sreg {
- int type;
- int index;
-
- int dst_scale;
-
- int negate;
- int abs;
- int swz[4];
-
- int cc_update;
- int cc_update_reg;
- int cc_test;
- int cc_test_reg;
- int cc_swz[4];
-};
-
-static INLINE struct nv30_sreg
-nv30_sr(int type, int index)
-{
- struct nv30_sreg temp = {
- .type = type,
- .index = index,
- .dst_scale = DEF_SCALE,
- .abs = 0,
- .negate = 0,
- .swz = { 0, 1, 2, 3 },
- .cc_update = 0,
- .cc_update_reg = 0,
- .cc_test = DEF_CTEST,
- .cc_test_reg = 0,
- .cc_swz = { 0, 1, 2, 3 },
- };
- return temp;
-}
-
-static INLINE struct nv30_sreg
-nv30_sr_swz(struct nv30_sreg src, int x, int y, int z, int w)
-{
- struct nv30_sreg dst = src;
-
- dst.swz[SWZ_X] = src.swz[x];
- dst.swz[SWZ_Y] = src.swz[y];
- dst.swz[SWZ_Z] = src.swz[z];
- dst.swz[SWZ_W] = src.swz[w];
- return dst;
-}
-
-static INLINE struct nv30_sreg
-nv30_sr_neg(struct nv30_sreg src)
-{
- src.negate = !src.negate;
- return src;
-}
-
-static INLINE struct nv30_sreg
-nv30_sr_abs(struct nv30_sreg src)
-{
- src.abs = 1;
- return src;
-}
-
-static INLINE struct nv30_sreg
-nv30_sr_scale(struct nv30_sreg src, int scale)
-{
- src.dst_scale = scale;
- return src;
-}
-
-#endif
diff --git a/src/gallium/drivers/nv30/nv30_state.c b/src/gallium/drivers/nv30/nv30_state.c
deleted file mode 100644
index d911c80707..0000000000
--- a/src/gallium/drivers/nv30/nv30_state.c
+++ /dev/null
@@ -1,728 +0,0 @@
-#include "pipe/p_state.h"
-#include "pipe/p_defines.h"
-#include "util/u_inlines.h"
-
-#include "tgsi/tgsi_parse.h"
-
-#include "nv30_context.h"
-#include "nv30_state.h"
-
-static void *
-nv30_blend_state_create(struct pipe_context *pipe,
- const struct pipe_blend_state *cso)
-{
- struct nv30_context *nv30 = nv30_context(pipe);
- struct nouveau_grobj *rankine = nv30->screen->rankine;
- struct nv30_blend_state *bso = CALLOC(1, sizeof(*bso));
- struct nouveau_stateobj *so = so_new(5, 8, 0);
-
- if (cso->rt[0].blend_enable) {
- so_method(so, rankine, NV34TCL_BLEND_FUNC_ENABLE, 3);
- so_data (so, 1);
- so_data (so, (nvgl_blend_func(cso->rt[0].alpha_src_factor) << 16) |
- nvgl_blend_func(cso->rt[0].rgb_src_factor));
- so_data (so, nvgl_blend_func(cso->rt[0].alpha_dst_factor) << 16 |
- nvgl_blend_func(cso->rt[0].rgb_dst_factor));
- /* FIXME: Gallium assumes GL_EXT_blend_func_separate.
- It is not the case for NV30 */
- so_method(so, rankine, NV34TCL_BLEND_EQUATION, 1);
- so_data (so, nvgl_blend_eqn(cso->rt[0].rgb_func));
- } else {
- so_method(so, rankine, NV34TCL_BLEND_FUNC_ENABLE, 1);
- so_data (so, 0);
- }
-
- so_method(so, rankine, NV34TCL_COLOR_MASK, 1);
- so_data (so, (((cso->rt[0].colormask & PIPE_MASK_A) ? (0x01 << 24) : 0) |
- ((cso->rt[0].colormask & PIPE_MASK_R) ? (0x01 << 16) : 0) |
- ((cso->rt[0].colormask & PIPE_MASK_G) ? (0x01 << 8) : 0) |
- ((cso->rt[0].colormask & PIPE_MASK_B) ? (0x01 << 0) : 0)));
-
- if (cso->logicop_enable) {
- so_method(so, rankine, NV34TCL_COLOR_LOGIC_OP_ENABLE, 2);
- so_data (so, 1);
- so_data (so, nvgl_logicop_func(cso->logicop_func));
- } else {
- so_method(so, rankine, NV34TCL_COLOR_LOGIC_OP_ENABLE, 1);
- so_data (so, 0);
- }
-
- so_method(so, rankine, NV34TCL_DITHER_ENABLE, 1);
- so_data (so, cso->dither ? 1 : 0);
-
- so_ref(so, &bso->so);
- so_ref(NULL, &so);
- bso->pipe = *cso;
- return (void *)bso;
-}
-
-static void
-nv30_blend_state_bind(struct pipe_context *pipe, void *hwcso)
-{
- struct nv30_context *nv30 = nv30_context(pipe);
-
- nv30->blend = hwcso;
- nv30->dirty |= NV30_NEW_BLEND;
-}
-
-static void
-nv30_blend_state_delete(struct pipe_context *pipe, void *hwcso)
-{
- struct nv30_blend_state *bso = hwcso;
-
- so_ref(NULL, &bso->so);
- FREE(bso);
-}
-
-
-static INLINE unsigned
-wrap_mode(unsigned wrap) {
- unsigned ret;
-
- switch (wrap) {
- case PIPE_TEX_WRAP_REPEAT:
- ret = NV34TCL_TX_WRAP_S_REPEAT;
- break;
- case PIPE_TEX_WRAP_MIRROR_REPEAT:
- ret = NV34TCL_TX_WRAP_S_MIRRORED_REPEAT;
- break;
- case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
- ret = NV34TCL_TX_WRAP_S_CLAMP_TO_EDGE;
- break;
- case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
- ret = NV34TCL_TX_WRAP_S_CLAMP_TO_BORDER;
- break;
- case PIPE_TEX_WRAP_CLAMP:
- ret = NV34TCL_TX_WRAP_S_CLAMP;
- break;
-/* case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE:
- ret = NV34TCL_TX_WRAP_S_MIRROR_CLAMP_TO_EDGE;
- break;
- case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER:
- ret = NV34TCL_TX_WRAP_S_MIRROR_CLAMP_TO_BORDER;
- break;
- case PIPE_TEX_WRAP_MIRROR_CLAMP:
- ret = NV34TCL_TX_WRAP_S_MIRROR_CLAMP;
- break;*/
- default:
- NOUVEAU_ERR("unknown wrap mode: %d\n", wrap);
- ret = NV34TCL_TX_WRAP_S_REPEAT;
- break;
- }
-
- return ret >> NV34TCL_TX_WRAP_S_SHIFT;
-}
-
-static void *
-nv30_sampler_state_create(struct pipe_context *pipe,
- const struct pipe_sampler_state *cso)
-{
- struct nv30_sampler_state *ps;
- uint32_t filter = 0;
-
- ps = MALLOC(sizeof(struct nv30_sampler_state));
-
- ps->fmt = 0;
- /* TODO: Not all RECTs formats have this bit set, bits 15-8 of format
- are the tx format to use. We should store normalized coord flag
- in sampler state structure, and set appropriate format in
- nvxx_fragtex_build()
- */
- /*NV34TCL_TX_FORMAT_RECT*/
- /*if (!cso->normalized_coords) {
- ps->fmt |= (1<<14) ;
- }*/
-
- ps->wrap = ((wrap_mode(cso->wrap_s) << NV34TCL_TX_WRAP_S_SHIFT) |
- (wrap_mode(cso->wrap_t) << NV34TCL_TX_WRAP_T_SHIFT) |
- (wrap_mode(cso->wrap_r) << NV34TCL_TX_WRAP_R_SHIFT));
-
- ps->en = 0;
-
- if (cso->max_anisotropy >= 8) {
- ps->en |= NV34TCL_TX_ENABLE_ANISO_8X;
- } else
- if (cso->max_anisotropy >= 4) {
- ps->en |= NV34TCL_TX_ENABLE_ANISO_4X;
- } else
- if (cso->max_anisotropy >= 2) {
- ps->en |= NV34TCL_TX_ENABLE_ANISO_2X;
- }
-
- switch (cso->mag_img_filter) {
- case PIPE_TEX_FILTER_LINEAR:
- filter |= NV34TCL_TX_FILTER_MAGNIFY_LINEAR;
- break;
- case PIPE_TEX_FILTER_NEAREST:
- default:
- filter |= NV34TCL_TX_FILTER_MAGNIFY_NEAREST;
- break;
- }
-
- switch (cso->min_img_filter) {
- case PIPE_TEX_FILTER_LINEAR:
- switch (cso->min_mip_filter) {
- case PIPE_TEX_MIPFILTER_NEAREST:
- filter |= NV34TCL_TX_FILTER_MINIFY_LINEAR_MIPMAP_NEAREST;
- break;
- case PIPE_TEX_MIPFILTER_LINEAR:
- filter |= NV34TCL_TX_FILTER_MINIFY_LINEAR_MIPMAP_LINEAR;
- break;
- case PIPE_TEX_MIPFILTER_NONE:
- default:
- filter |= NV34TCL_TX_FILTER_MINIFY_LINEAR;
- break;
- }
- break;
- case PIPE_TEX_FILTER_NEAREST:
- default:
- switch (cso->min_mip_filter) {
- case PIPE_TEX_MIPFILTER_NEAREST:
- filter |= NV34TCL_TX_FILTER_MINIFY_NEAREST_MIPMAP_NEAREST;
- break;
- case PIPE_TEX_MIPFILTER_LINEAR:
- filter |= NV34TCL_TX_FILTER_MINIFY_NEAREST_MIPMAP_LINEAR;
- break;
- case PIPE_TEX_MIPFILTER_NONE:
- default:
- filter |= NV34TCL_TX_FILTER_MINIFY_NEAREST;
- break;
- }
- break;
- }
-
- ps->filt = filter;
-
- {
- float limit;
-
- limit = CLAMP(cso->lod_bias, -16.0, 15.0);
- ps->filt |= (int)(cso->lod_bias * 256.0) & 0x1fff;
-
- limit = CLAMP(cso->max_lod, 0.0, 15.0);
- ps->en |= (int)(limit) << 14 /*NV34TCL_TX_ENABLE_MIPMAP_MAX_LOD_SHIFT*/;
-
- limit = CLAMP(cso->min_lod, 0.0, 15.0);
- ps->en |= (int)(limit) << 26 /*NV34TCL_TX_ENABLE_MIPMAP_MIN_LOD_SHIFT*/;
- }
-
- if (cso->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) {
- switch (cso->compare_func) {
- case PIPE_FUNC_NEVER:
- ps->wrap |= NV34TCL_TX_WRAP_RCOMP_NEVER;
- break;
- case PIPE_FUNC_GREATER:
- ps->wrap |= NV34TCL_TX_WRAP_RCOMP_GREATER;
- break;
- case PIPE_FUNC_EQUAL:
- ps->wrap |= NV34TCL_TX_WRAP_RCOMP_EQUAL;
- break;
- case PIPE_FUNC_GEQUAL:
- ps->wrap |= NV34TCL_TX_WRAP_RCOMP_GEQUAL;
- break;
- case PIPE_FUNC_LESS:
- ps->wrap |= NV34TCL_TX_WRAP_RCOMP_LESS;
- break;
- case PIPE_FUNC_NOTEQUAL:
- ps->wrap |= NV34TCL_TX_WRAP_RCOMP_NOTEQUAL;
- break;
- case PIPE_FUNC_LEQUAL:
- ps->wrap |= NV34TCL_TX_WRAP_RCOMP_LEQUAL;
- break;
- case PIPE_FUNC_ALWAYS:
- ps->wrap |= NV34TCL_TX_WRAP_RCOMP_ALWAYS;
- break;
- default:
- break;
- }
- }
-
- ps->bcol = ((float_to_ubyte(cso->border_color[3]) << 24) |
- (float_to_ubyte(cso->border_color[0]) << 16) |
- (float_to_ubyte(cso->border_color[1]) << 8) |
- (float_to_ubyte(cso->border_color[2]) << 0));
-
- return (void *)ps;
-}
-
-static void
-nv30_sampler_state_bind(struct pipe_context *pipe, unsigned nr, void **sampler)
-{
- struct nv30_context *nv30 = nv30_context(pipe);
- unsigned unit;
-
- for (unit = 0; unit < nr; unit++) {
- nv30->tex_sampler[unit] = sampler[unit];
- nv30->dirty_samplers |= (1 << unit);
- }
-
- for (unit = nr; unit < nv30->nr_samplers; unit++) {
- nv30->tex_sampler[unit] = NULL;
- nv30->dirty_samplers |= (1 << unit);
- }
-
- nv30->nr_samplers = nr;
- nv30->dirty |= NV30_NEW_SAMPLER;
-}
-
-static void
-nv30_sampler_state_delete(struct pipe_context *pipe, void *hwcso)
-{
- FREE(hwcso);
-}
-
-static void
-nv30_set_sampler_texture(struct pipe_context *pipe, unsigned nr,
- struct pipe_texture **miptree)
-{
- struct nv30_context *nv30 = nv30_context(pipe);
- unsigned unit;
-
- for (unit = 0; unit < nr; unit++) {
- pipe_texture_reference((struct pipe_texture **)
- &nv30->tex_miptree[unit], miptree[unit]);
- nv30->dirty_samplers |= (1 << unit);
- }
-
- for (unit = nr; unit < nv30->nr_textures; unit++) {
- pipe_texture_reference((struct pipe_texture **)
- &nv30->tex_miptree[unit], NULL);
- nv30->dirty_samplers |= (1 << unit);
- }
-
- nv30->nr_textures = nr;
- nv30->dirty |= NV30_NEW_SAMPLER;
-}
-
-static void *
-nv30_rasterizer_state_create(struct pipe_context *pipe,
- const struct pipe_rasterizer_state *cso)
-{
- struct nv30_context *nv30 = nv30_context(pipe);
- struct nv30_rasterizer_state *rsso = CALLOC(1, sizeof(*rsso));
- struct nouveau_stateobj *so = so_new(9, 19, 0);
- struct nouveau_grobj *rankine = nv30->screen->rankine;
-
- /*XXX: ignored:
- * light_twoside
- * point_smooth -nohw
- * multisample
- */
-
- so_method(so, rankine, NV34TCL_SHADE_MODEL, 1);
- so_data (so, cso->flatshade ? NV34TCL_SHADE_MODEL_FLAT :
- NV34TCL_SHADE_MODEL_SMOOTH);
-
- so_method(so, rankine, NV34TCL_LINE_WIDTH, 2);
- so_data (so, (unsigned char)(cso->line_width * 8.0) & 0xff);
- so_data (so, cso->line_smooth ? 1 : 0);
- so_method(so, rankine, NV34TCL_LINE_STIPPLE_ENABLE, 2);
- so_data (so, cso->line_stipple_enable ? 1 : 0);
- so_data (so, (cso->line_stipple_pattern << 16) |
- cso->line_stipple_factor);
-
- so_method(so, rankine, NV34TCL_POINT_SIZE, 1);
- so_data (so, fui(cso->point_size));
-
- so_method(so, rankine, NV34TCL_POLYGON_MODE_FRONT, 6);
- if (cso->front_winding == PIPE_WINDING_CCW) {
- so_data(so, nvgl_polygon_mode(cso->fill_ccw));
- so_data(so, nvgl_polygon_mode(cso->fill_cw));
- switch (cso->cull_mode) {
- case PIPE_WINDING_CCW:
- so_data(so, NV34TCL_CULL_FACE_FRONT);
- break;
- case PIPE_WINDING_CW:
- so_data(so, NV34TCL_CULL_FACE_BACK);
- break;
- case PIPE_WINDING_BOTH:
- so_data(so, NV34TCL_CULL_FACE_FRONT_AND_BACK);
- break;
- default:
- so_data(so, NV34TCL_CULL_FACE_BACK);
- break;
- }
- so_data(so, NV34TCL_FRONT_FACE_CCW);
- } else {
- so_data(so, nvgl_polygon_mode(cso->fill_cw));
- so_data(so, nvgl_polygon_mode(cso->fill_ccw));
- switch (cso->cull_mode) {
- case PIPE_WINDING_CCW:
- so_data(so, NV34TCL_CULL_FACE_BACK);
- break;
- case PIPE_WINDING_CW:
- so_data(so, NV34TCL_CULL_FACE_FRONT);
- break;
- case PIPE_WINDING_BOTH:
- so_data(so, NV34TCL_CULL_FACE_FRONT_AND_BACK);
- break;
- default:
- so_data(so, NV34TCL_CULL_FACE_BACK);
- break;
- }
- so_data(so, NV34TCL_FRONT_FACE_CW);
- }
- so_data(so, cso->poly_smooth ? 1 : 0);
- so_data(so, (cso->cull_mode != PIPE_WINDING_NONE) ? 1 : 0);
-
- so_method(so, rankine, NV34TCL_POLYGON_STIPPLE_ENABLE, 1);
- so_data (so, cso->poly_stipple_enable ? 1 : 0);
-
- so_method(so, rankine, NV34TCL_POLYGON_OFFSET_POINT_ENABLE, 3);
- if ((cso->offset_cw && cso->fill_cw == PIPE_POLYGON_MODE_POINT) ||
- (cso->offset_ccw && cso->fill_ccw == PIPE_POLYGON_MODE_POINT))
- so_data(so, 1);
- else
- so_data(so, 0);
- if ((cso->offset_cw && cso->fill_cw == PIPE_POLYGON_MODE_LINE) ||
- (cso->offset_ccw && cso->fill_ccw == PIPE_POLYGON_MODE_LINE))
- so_data(so, 1);
- else
- so_data(so, 0);
- if ((cso->offset_cw && cso->fill_cw == PIPE_POLYGON_MODE_FILL) ||
- (cso->offset_ccw && cso->fill_ccw == PIPE_POLYGON_MODE_FILL))
- so_data(so, 1);
- else
- so_data(so, 0);
- if (cso->offset_cw || cso->offset_ccw) {
- so_method(so, rankine, NV34TCL_POLYGON_OFFSET_FACTOR, 2);
- so_data (so, fui(cso->offset_scale));
- so_data (so, fui(cso->offset_units * 2));
- }
-
- so_method(so, rankine, NV34TCL_POINT_SPRITE, 1);
- if (cso->point_quad_rasterization) {
- unsigned psctl = (1 << 0), i;
-
- for (i = 0; i < 8; i++) {
- if ((cso->sprite_coord_enable >> i) & 1)
- psctl |= (1 << (8 + i));
- }
-
- so_data(so, psctl);
- } else {
- so_data(so, 0);
- }
-
- so_ref(so, &rsso->so);
- so_ref(NULL, &so);
- rsso->pipe = *cso;
- return (void *)rsso;
-}
-
-static void
-nv30_rasterizer_state_bind(struct pipe_context *pipe, void *hwcso)
-{
- struct nv30_context *nv30 = nv30_context(pipe);
-
- nv30->rasterizer = hwcso;
- nv30->dirty |= NV30_NEW_RAST;
- /*nv30->draw_dirty |= NV30_NEW_RAST;*/
-}
-
-static void
-nv30_rasterizer_state_delete(struct pipe_context *pipe, void *hwcso)
-{
- struct nv30_rasterizer_state *rsso = hwcso;
-
- so_ref(NULL, &rsso->so);
- FREE(rsso);
-}
-
-static void *
-nv30_depth_stencil_alpha_state_create(struct pipe_context *pipe,
- const struct pipe_depth_stencil_alpha_state *cso)
-{
- struct nv30_context *nv30 = nv30_context(pipe);
- struct nv30_zsa_state *zsaso = CALLOC(1, sizeof(*zsaso));
- struct nouveau_stateobj *so = so_new(6, 20, 0);
- struct nouveau_grobj *rankine = nv30->screen->rankine;
-
- so_method(so, rankine, NV34TCL_DEPTH_FUNC, 3);
- so_data (so, nvgl_comparison_op(cso->depth.func));
- so_data (so, cso->depth.writemask ? 1 : 0);
- so_data (so, cso->depth.enabled ? 1 : 0);
-
- so_method(so, rankine, NV34TCL_ALPHA_FUNC_ENABLE, 3);
- so_data (so, cso->alpha.enabled ? 1 : 0);
- so_data (so, nvgl_comparison_op(cso->alpha.func));
- so_data (so, float_to_ubyte(cso->alpha.ref_value));
-
- if (cso->stencil[0].enabled) {
- so_method(so, rankine, NV34TCL_STENCIL_FRONT_ENABLE, 3);
- so_data (so, cso->stencil[0].enabled ? 1 : 0);
- so_data (so, cso->stencil[0].writemask);
- so_data (so, nvgl_comparison_op(cso->stencil[0].func));
- so_method(so, rankine, NV34TCL_STENCIL_FRONT_FUNC_MASK, 4);
- so_data (so, cso->stencil[0].valuemask);
- so_data (so, nvgl_stencil_op(cso->stencil[0].fail_op));
- so_data (so, nvgl_stencil_op(cso->stencil[0].zfail_op));
- so_data (so, nvgl_stencil_op(cso->stencil[0].zpass_op));
- } else {
- so_method(so, rankine, NV34TCL_STENCIL_FRONT_ENABLE, 1);
- so_data (so, 0);
- }
-
- if (cso->stencil[1].enabled) {
- so_method(so, rankine, NV34TCL_STENCIL_BACK_ENABLE, 3);
- so_data (so, cso->stencil[1].enabled ? 1 : 0);
- so_data (so, cso->stencil[1].writemask);
- so_data (so, nvgl_comparison_op(cso->stencil[1].func));
- so_method(so, rankine, NV34TCL_STENCIL_BACK_FUNC_MASK, 4);
- so_data (so, cso->stencil[1].valuemask);
- so_data (so, nvgl_stencil_op(cso->stencil[1].fail_op));
- so_data (so, nvgl_stencil_op(cso->stencil[1].zfail_op));
- so_data (so, nvgl_stencil_op(cso->stencil[1].zpass_op));
- } else {
- so_method(so, rankine, NV34TCL_STENCIL_BACK_ENABLE, 1);
- so_data (so, 0);
- }
-
- so_ref(so, &zsaso->so);
- so_ref(NULL, &so);
- zsaso->pipe = *cso;
- return (void *)zsaso;
-}
-
-static void
-nv30_depth_stencil_alpha_state_bind(struct pipe_context *pipe, void *hwcso)
-{
- struct nv30_context *nv30 = nv30_context(pipe);
-
- nv30->zsa = hwcso;
- nv30->dirty |= NV30_NEW_ZSA;
-}
-
-static void
-nv30_depth_stencil_alpha_state_delete(struct pipe_context *pipe, void *hwcso)
-{
- struct nv30_zsa_state *zsaso = hwcso;
-
- so_ref(NULL, &zsaso->so);
- FREE(zsaso);
-}
-
-static void *
-nv30_vp_state_create(struct pipe_context *pipe,
- const struct pipe_shader_state *cso)
-{
- /*struct nv30_context *nv30 = nv30_context(pipe);*/
- struct nv30_vertex_program *vp;
-
- vp = CALLOC(1, sizeof(struct nv30_vertex_program));
- vp->pipe.tokens = tgsi_dup_tokens(cso->tokens);
- /*vp->draw = draw_create_vertex_shader(nv30->draw, &vp->pipe);*/
-
- return (void *)vp;
-}
-
-static void
-nv30_vp_state_bind(struct pipe_context *pipe, void *hwcso)
-{
- struct nv30_context *nv30 = nv30_context(pipe);
-
- nv30->vertprog = hwcso;
- nv30->dirty |= NV30_NEW_VERTPROG;
- /*nv30->draw_dirty |= NV30_NEW_VERTPROG;*/
-}
-
-static void
-nv30_vp_state_delete(struct pipe_context *pipe, void *hwcso)
-{
- struct nv30_context *nv30 = nv30_context(pipe);
- struct nv30_vertex_program *vp = hwcso;
-
- /*draw_delete_vertex_shader(nv30->draw, vp->draw);*/
- nv30_vertprog_destroy(nv30, vp);
- FREE((void*)vp->pipe.tokens);
- FREE(vp);
-}
-
-static void *
-nv30_fp_state_create(struct pipe_context *pipe,
- const struct pipe_shader_state *cso)
-{
- struct nv30_fragment_program *fp;
-
- fp = CALLOC(1, sizeof(struct nv30_fragment_program));
- fp->pipe.tokens = tgsi_dup_tokens(cso->tokens);
-
- tgsi_scan_shader(fp->pipe.tokens, &fp->info);
-
- return (void *)fp;
-}
-
-static void
-nv30_fp_state_bind(struct pipe_context *pipe, void *hwcso)
-{
- struct nv30_context *nv30 = nv30_context(pipe);
-
- nv30->fragprog = hwcso;
- nv30->dirty |= NV30_NEW_FRAGPROG;
-}
-
-static void
-nv30_fp_state_delete(struct pipe_context *pipe, void *hwcso)
-{
- struct nv30_context *nv30 = nv30_context(pipe);
- struct nv30_fragment_program *fp = hwcso;
-
- nv30_fragprog_destroy(nv30, fp);
- FREE((void*)fp->pipe.tokens);
- FREE(fp);
-}
-
-static void
-nv30_set_blend_color(struct pipe_context *pipe,
- const struct pipe_blend_color *bcol)
-{
- struct nv30_context *nv30 = nv30_context(pipe);
-
- nv30->blend_colour = *bcol;
- nv30->dirty |= NV30_NEW_BCOL;
-}
-
-static void
-nv30_set_stencil_ref(struct pipe_context *pipe,
- const struct pipe_stencil_ref *sr)
-{
- struct nv30_context *nv30 = nv30_context(pipe);
-
- nv30->stencil_ref = *sr;
- nv30->dirty |= NV30_NEW_SR;
-}
-
-static void
-nv30_set_clip_state(struct pipe_context *pipe,
- const struct pipe_clip_state *clip)
-{
-}
-
-static void
-nv30_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
- struct pipe_buffer *buf )
-{
- struct nv30_context *nv30 = nv30_context(pipe);
-
- nv30->constbuf[shader] = buf;
- nv30->constbuf_nr[shader] = buf->size / (4 * sizeof(float));
-
- if (shader == PIPE_SHADER_VERTEX) {
- nv30->dirty |= NV30_NEW_VERTPROG;
- } else
- if (shader == PIPE_SHADER_FRAGMENT) {
- nv30->dirty |= NV30_NEW_FRAGPROG;
- }
-}
-
-static void
-nv30_set_framebuffer_state(struct pipe_context *pipe,
- const struct pipe_framebuffer_state *fb)
-{
- struct nv30_context *nv30 = nv30_context(pipe);
-
- nv30->framebuffer = *fb;
- nv30->dirty |= NV30_NEW_FB;
-}
-
-static void
-nv30_set_polygon_stipple(struct pipe_context *pipe,
- const struct pipe_poly_stipple *stipple)
-{
- struct nv30_context *nv30 = nv30_context(pipe);
-
- memcpy(nv30->stipple, stipple->stipple, 4 * 32);
- nv30->dirty |= NV30_NEW_STIPPLE;
-}
-
-static void
-nv30_set_scissor_state(struct pipe_context *pipe,
- const struct pipe_scissor_state *s)
-{
- struct nv30_context *nv30 = nv30_context(pipe);
-
- nv30->scissor = *s;
- nv30->dirty |= NV30_NEW_SCISSOR;
-}
-
-static void
-nv30_set_viewport_state(struct pipe_context *pipe,
- const struct pipe_viewport_state *vpt)
-{
- struct nv30_context *nv30 = nv30_context(pipe);
-
- nv30->viewport = *vpt;
- nv30->dirty |= NV30_NEW_VIEWPORT;
- /*nv30->draw_dirty |= NV30_NEW_VIEWPORT;*/
-}
-
-static void
-nv30_set_vertex_buffers(struct pipe_context *pipe, unsigned count,
- const struct pipe_vertex_buffer *vb)
-{
- struct nv30_context *nv30 = nv30_context(pipe);
-
- memcpy(nv30->vtxbuf, vb, sizeof(*vb) * count);
- nv30->vtxbuf_nr = count;
-
- nv30->dirty |= NV30_NEW_ARRAYS;
- /*nv30->draw_dirty |= NV30_NEW_ARRAYS;*/
-}
-
-static void
-nv30_set_vertex_elements(struct pipe_context *pipe, unsigned count,
- const struct pipe_vertex_element *ve)
-{
- struct nv30_context *nv30 = nv30_context(pipe);
-
- memcpy(nv30->vtxelt, ve, sizeof(*ve) * count);
- nv30->vtxelt_nr = count;
-
- nv30->dirty |= NV30_NEW_ARRAYS;
- /*nv30->draw_dirty |= NV30_NEW_ARRAYS;*/
-}
-
-void
-nv30_init_state_functions(struct nv30_context *nv30)
-{
- nv30->pipe.create_blend_state = nv30_blend_state_create;
- nv30->pipe.bind_blend_state = nv30_blend_state_bind;
- nv30->pipe.delete_blend_state = nv30_blend_state_delete;
-
- nv30->pipe.create_sampler_state = nv30_sampler_state_create;
- nv30->pipe.bind_fragment_sampler_states = nv30_sampler_state_bind;
- nv30->pipe.delete_sampler_state = nv30_sampler_state_delete;
- nv30->pipe.set_fragment_sampler_textures = nv30_set_sampler_texture;
-
- nv30->pipe.create_rasterizer_state = nv30_rasterizer_state_create;
- nv30->pipe.bind_rasterizer_state = nv30_rasterizer_state_bind;
- nv30->pipe.delete_rasterizer_state = nv30_rasterizer_state_delete;
-
- nv30->pipe.create_depth_stencil_alpha_state =
- nv30_depth_stencil_alpha_state_create;
- nv30->pipe.bind_depth_stencil_alpha_state =
- nv30_depth_stencil_alpha_state_bind;
- nv30->pipe.delete_depth_stencil_alpha_state =
- nv30_depth_stencil_alpha_state_delete;
-
- nv30->pipe.create_vs_state = nv30_vp_state_create;
- nv30->pipe.bind_vs_state = nv30_vp_state_bind;
- nv30->pipe.delete_vs_state = nv30_vp_state_delete;
-
- nv30->pipe.create_fs_state = nv30_fp_state_create;
- nv30->pipe.bind_fs_state = nv30_fp_state_bind;
- nv30->pipe.delete_fs_state = nv30_fp_state_delete;
-
- nv30->pipe.set_blend_color = nv30_set_blend_color;
- nv30->pipe.set_stencil_ref = nv30_set_stencil_ref;
- nv30->pipe.set_clip_state = nv30_set_clip_state;
- nv30->pipe.set_constant_buffer = nv30_set_constant_buffer;
- nv30->pipe.set_framebuffer_state = nv30_set_framebuffer_state;
- nv30->pipe.set_polygon_stipple = nv30_set_polygon_stipple;
- nv30->pipe.set_scissor_state = nv30_set_scissor_state;
- nv30->pipe.set_viewport_state = nv30_set_viewport_state;
-
- nv30->pipe.set_vertex_buffers = nv30_set_vertex_buffers;
- nv30->pipe.set_vertex_elements = nv30_set_vertex_elements;
-}
-
diff --git a/src/gallium/drivers/nv30/nv30_state.h b/src/gallium/drivers/nv30/nv30_state.h
deleted file mode 100644
index e42e872de7..0000000000
--- a/src/gallium/drivers/nv30/nv30_state.h
+++ /dev/null
@@ -1,86 +0,0 @@
-#ifndef __NV30_STATE_H__
-#define __NV30_STATE_H__
-
-#include "pipe/p_state.h"
-#include "tgsi/tgsi_scan.h"
-
-struct nv30_sampler_state {
- uint32_t fmt;
- uint32_t wrap;
- uint32_t en;
- uint32_t filt;
- uint32_t bcol;
-};
-
-struct nv30_vertex_program_exec {
- uint32_t data[4];
- boolean has_branch_offset;
- int const_index;
-};
-
-struct nv30_vertex_program_data {
- int index; /* immediates == -1 */
- float value[4];
-};
-
-struct nv30_vertex_program {
- struct pipe_shader_state pipe;
-
- boolean translated;
-
- struct nv30_vertex_program_exec *insns;
- unsigned nr_insns;
- struct nv30_vertex_program_data *consts;
- unsigned nr_consts;
-
- struct nouveau_resource *exec;
- unsigned exec_start;
- struct nouveau_resource *data;
- unsigned data_start;
- unsigned data_start_min;
-
- uint32_t ir;
- uint32_t or;
- struct nouveau_stateobj *so;
-};
-
-struct nv30_fragment_program_data {
- unsigned offset;
- unsigned index;
-};
-
-struct nv30_fragment_program {
- struct pipe_shader_state pipe;
- struct tgsi_shader_info info;
-
- boolean translated;
- boolean on_hw;
- unsigned samplers;
-
- uint32_t *insn;
- int insn_len;
-
- struct nv30_fragment_program_data *consts;
- unsigned nr_consts;
-
- struct pipe_buffer *buffer;
-
- uint32_t fp_control;
- uint32_t fp_reg_control;
- struct nouveau_stateobj *so;
-};
-
-struct nv30_miptree {
- struct pipe_texture base;
- struct nouveau_bo *bo;
-
- struct pipe_buffer *buffer;
- uint total_size;
-
- struct {
- uint pitch;
- uint *image_offset;
- } level[PIPE_MAX_TEXTURE_LEVELS];
-};
-
-#endif
diff --git a/src/gallium/drivers/nv30/nv30_state_blend.c b/src/gallium/drivers/nv30/nv30_state_blend.c
deleted file mode 100644
index c36d58c040..0000000000
--- a/src/gallium/drivers/nv30/nv30_state_blend.c
+++ /dev/null
@@ -1,41 +0,0 @@
-#include "nv30_context.h"
-
-static boolean
-nv30_state_blend_validate(struct nv30_context *nv30)
-{
- so_ref(nv30->blend->so, &nv30->state.hw[NV30_STATE_BLEND]);
- return TRUE;
-}
-
-struct nv30_state_entry nv30_state_blend = {
- .validate = nv30_state_blend_validate,
- .dirty = {
- .pipe = NV30_NEW_BLEND,
- .hw = NV30_STATE_BLEND
- }
-};
-
-static boolean
-nv30_state_blend_colour_validate(struct nv30_context *nv30)
-{
- struct nouveau_stateobj *so = so_new(1, 1, 0);
- struct pipe_blend_color *bcol = &nv30->blend_colour;
-
- so_method(so, nv30->screen->rankine, NV34TCL_BLEND_COLOR, 1);
- so_data (so, ((float_to_ubyte(bcol->color[3]) << 24) |
- (float_to_ubyte(bcol->color[0]) << 16) |
- (float_to_ubyte(bcol->color[1]) << 8) |
- (float_to_ubyte(bcol->color[2]) << 0)));
-
- so_ref(so, &nv30->state.hw[NV30_STATE_BCOL]);
- so_ref(NULL, &so);
- return TRUE;
-}
-
-struct nv30_state_entry nv30_state_blend_colour = {
- .validate = nv30_state_blend_colour_validate,
- .dirty = {
- .pipe = NV30_NEW_BCOL,
- .hw = NV30_STATE_BCOL
- }
-};
diff --git a/src/gallium/drivers/nv30/nv30_state_emit.c b/src/gallium/drivers/nv30/nv30_state_emit.c
deleted file mode 100644
index deefe7fd8d..0000000000
--- a/src/gallium/drivers/nv30/nv30_state_emit.c
+++ /dev/null
@@ -1,122 +0,0 @@
-#include "nv30_context.h"
-#include "nv30_state.h"
-
-static struct nv30_state_entry *render_states[] = {
- &nv30_state_framebuffer,
- &nv30_state_rasterizer,
- &nv30_state_scissor,
- &nv30_state_stipple,
- &nv30_state_fragprog,
- &nv30_state_fragtex,
- &nv30_state_vertprog,
- &nv30_state_blend,
- &nv30_state_blend_colour,
- &nv30_state_zsa,
- &nv30_state_sr,
- &nv30_state_viewport,
- &nv30_state_vbo,
- NULL
-};
-
-static void
-nv30_state_do_validate(struct nv30_context *nv30,
- struct nv30_state_entry **states)
-{
- while (*states) {
- struct nv30_state_entry *e = *states;
-
- if (nv30->dirty & e->dirty.pipe) {
- if (e->validate(nv30)) {
- nv30->state.dirty |= (1ULL << e->dirty.hw);
- }
- }
-
- states++;
- }
- nv30->dirty = 0;
-}
-
-void
-nv30_state_emit(struct nv30_context *nv30)
-{
- struct nouveau_channel *chan = nv30->screen->base.channel;
- struct nv30_state *state = &nv30->state;
- struct nv30_screen *screen = nv30->screen;
- unsigned i;
- uint64_t states;
-
- /* XXX: racy!
- */
- if (nv30 != screen->cur_ctx) {
- for (i = 0; i < NV30_STATE_MAX; i++) {
- if (state->hw[i] && screen->state[i] != state->hw[i])
- state->dirty |= (1ULL << i);
- }
-
- screen->cur_ctx = nv30;
- }
-
- for (i = 0, states = state->dirty; states; i++) {
- if (!(states & (1ULL << i)))
- continue;
- so_ref (state->hw[i], &nv30->screen->state[i]);
- if (state->hw[i])
- so_emit(chan, nv30->screen->state[i]);
- states &= ~(1ULL << i);
- }
-
- state->dirty = 0;
-}
-
-void
-nv30_state_flush_notify(struct nouveau_channel *chan)
-{
- struct nv30_context *nv30 = chan->user_private;
- struct nv30_state *state = &nv30->state;
- unsigned i, samplers;
-
- so_emit_reloc_markers(chan, state->hw[NV30_STATE_FB]);
- for (i = 0, samplers = state->fp_samplers; i < 16 && samplers; i++) {
- if (!(samplers & (1 << i)))
- continue;
- so_emit_reloc_markers(chan,
- state->hw[NV30_STATE_FRAGTEX0+i]);
- samplers &= ~(1ULL << i);
- }
- so_emit_reloc_markers(chan, state->hw[NV30_STATE_FRAGPROG]);
- if (state->hw[NV30_STATE_VTXBUF] /*&& nv30->render_mode == HW*/)
- so_emit_reloc_markers(chan, state->hw[NV30_STATE_VTXBUF]);
-}
-
-boolean
-nv30_state_validate(struct nv30_context *nv30)
-{
-#if 0
- boolean was_sw = nv30->fallback_swtnl ? TRUE : FALSE;
-
- if (nv30->render_mode != HW) {
- /* Don't even bother trying to go back to hw if none
- * of the states that caused swtnl previously have changed.
- */
- if ((nv30->fallback_swtnl & nv30->dirty)
- != nv30->fallback_swtnl)
- return FALSE;
-
- /* Attempt to go to hwtnl again */
- nv30->pipe.flush(&nv30->pipe, 0, NULL);
- nv30->dirty |= (NV30_NEW_VIEWPORT |
- NV30_NEW_VERTPROG |
- NV30_NEW_ARRAYS);
- nv30->render_mode = HW;
- }
-#endif
- nv30_state_do_validate(nv30, render_states);
-#if 0
- if (nv30->fallback_swtnl || nv30->fallback_swrast)
- return FALSE;
-
- if (was_sw)
- NOUVEAU_ERR("swtnl->hw\n");
-#endif
- return TRUE;
-}
diff --git a/src/gallium/drivers/nv30/nv30_state_fb.c b/src/gallium/drivers/nv30/nv30_state_fb.c
deleted file mode 100644
index f7fe9833c7..0000000000
--- a/src/gallium/drivers/nv30/nv30_state_fb.c
+++ /dev/null
@@ -1,173 +0,0 @@
-#include "nv30_context.h"
-#include "nouveau/nouveau_util.h"
-
-static boolean
-nv30_state_framebuffer_validate(struct nv30_context *nv30)
-{
- struct pipe_framebuffer_state *fb = &nv30->framebuffer;
- struct nouveau_channel *chan = nv30->screen->base.channel;
- struct nouveau_grobj *rankine = nv30->screen->rankine;
- struct nv04_surface *rt[2], *zeta = NULL;
- uint32_t rt_enable = 0, rt_format = 0;
- int i, colour_format = 0, zeta_format = 0, depth_only = 0;
- struct nouveau_stateobj *so = so_new(12, 18, 10);
- unsigned rt_flags = NOUVEAU_BO_RDWR | NOUVEAU_BO_VRAM;
- unsigned w = fb->width;
- unsigned h = fb->height;
- struct nv30_miptree *nv30mt;
- int colour_bits = 32, zeta_bits = 32;
-
- for (i = 0; i < fb->nr_cbufs; i++) {
- if (colour_format) {
- assert(colour_format == fb->cbufs[i]->format);
- } else {
- colour_format = fb->cbufs[i]->format;
- rt_enable |= (NV34TCL_RT_ENABLE_COLOR0 << i);
- rt[i] = (struct nv04_surface *)fb->cbufs[i];
- }
- }
-
- if (rt_enable & NV34TCL_RT_ENABLE_COLOR1)
- rt_enable |= NV34TCL_RT_ENABLE_MRT;
-
- if (fb->zsbuf) {
- zeta_format = fb->zsbuf->format;
- zeta = (struct nv04_surface *)fb->zsbuf;
- }
-
- if (rt_enable & (NV34TCL_RT_ENABLE_COLOR0|NV34TCL_RT_ENABLE_COLOR1)) {
- /* Render to at least a colour buffer */
- if (!(rt[0]->base.texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) {
- assert(!(fb->width & (fb->width - 1)) && !(fb->height & (fb->height - 1)));
- for (i = 1; i < fb->nr_cbufs; i++)
- assert(!(rt[i]->base.texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR));
-
- rt_format = NV34TCL_RT_FORMAT_TYPE_SWIZZLED |
- (log2i(rt[0]->base.width) << NV34TCL_RT_FORMAT_LOG2_WIDTH_SHIFT) |
- (log2i(rt[0]->base.height) << NV34TCL_RT_FORMAT_LOG2_HEIGHT_SHIFT);
- }
- else
- rt_format = NV34TCL_RT_FORMAT_TYPE_LINEAR;
- } else if (fb->zsbuf) {
- depth_only = 1;
-
- /* Render to depth buffer only */
- if (!(zeta->base.texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) {
- assert(!(fb->width & (fb->width - 1)) && !(fb->height & (fb->height - 1)));
-
- rt_format = NV34TCL_RT_FORMAT_TYPE_SWIZZLED |
- (log2i(zeta->base.width) << NV34TCL_RT_FORMAT_LOG2_WIDTH_SHIFT) |
- (log2i(zeta->base.height) << NV34TCL_RT_FORMAT_LOG2_HEIGHT_SHIFT);
- }
- else
- rt_format = NV34TCL_RT_FORMAT_TYPE_LINEAR;
- } else {
- return FALSE;
- }
-
- switch (colour_format) {
- case PIPE_FORMAT_B8G8R8X8_UNORM:
- rt_format |= NV34TCL_RT_FORMAT_COLOR_X8R8G8B8;
- break;
- case PIPE_FORMAT_B8G8R8A8_UNORM:
- case 0:
- rt_format |= NV34TCL_RT_FORMAT_COLOR_A8R8G8B8;
- break;
- case PIPE_FORMAT_B5G6R5_UNORM:
- rt_format |= NV34TCL_RT_FORMAT_COLOR_R5G6B5;
- colour_bits = 16;
- break;
- default:
- assert(0);
- }
-
- switch (zeta_format) {
- case PIPE_FORMAT_Z16_UNORM:
- rt_format |= NV34TCL_RT_FORMAT_ZETA_Z16;
- zeta_bits = 16;
- break;
- case PIPE_FORMAT_S8Z24_UNORM:
- case PIPE_FORMAT_X8Z24_UNORM:
- case 0:
- rt_format |= NV34TCL_RT_FORMAT_ZETA_Z24S8;
- break;
- default:
- assert(0);
- }
-
- if (colour_bits > zeta_bits) {
- return FALSE;
- }
-
- if (depth_only || (rt_enable & NV34TCL_RT_ENABLE_COLOR0)) {
- struct nv04_surface *rt0 = (depth_only ? zeta : rt[0]);
- uint32_t pitch = rt0->pitch;
-
- if (zeta) {
- pitch |= (zeta->pitch << 16);
- } else {
- pitch |= (pitch << 16);
- }
-
- nv30mt = (struct nv30_miptree *) rt0->base.texture;
- so_method(so, rankine, NV34TCL_DMA_COLOR0, 1);
- so_reloc (so, nouveau_bo(nv30mt->buffer), 0, rt_flags | NOUVEAU_BO_OR,
- chan->vram->handle, chan->gart->handle);
- so_method(so, rankine, NV34TCL_COLOR0_PITCH, 2);
- so_data (so, pitch);
- so_reloc (so, nouveau_bo(nv30mt->buffer), rt0->base.offset,
- rt_flags | NOUVEAU_BO_LOW, 0, 0);
- }
-
- if (rt_enable & NV34TCL_RT_ENABLE_COLOR1) {
- nv30mt = (struct nv30_miptree *)rt[1]->base.texture;
- so_method(so, rankine, NV34TCL_DMA_COLOR1, 1);
- so_reloc (so, nouveau_bo(nv30mt->buffer), 0, rt_flags | NOUVEAU_BO_OR,
- chan->vram->handle, chan->gart->handle);
- so_method(so, rankine, NV34TCL_COLOR1_OFFSET, 2);
- so_reloc (so, nouveau_bo(nv30mt->buffer), rt[1]->base.offset,
- rt_flags | NOUVEAU_BO_LOW, 0, 0);
- so_data (so, rt[1]->pitch);
- }
-
- if (zeta_format) {
- nv30mt = (struct nv30_miptree *)zeta->base.texture;
- so_method(so, rankine, NV34TCL_DMA_ZETA, 1);
- so_reloc (so, nouveau_bo(nv30mt->buffer), 0, rt_flags | NOUVEAU_BO_OR,
- chan->vram->handle, chan->gart->handle);
- so_method(so, rankine, NV34TCL_ZETA_OFFSET, 1);
- so_reloc (so, nouveau_bo(nv30mt->buffer), zeta->base.offset,
- rt_flags | NOUVEAU_BO_LOW, 0, 0);
- /* TODO: allocate LMA depth buffer */
- }
-
- so_method(so, rankine, NV34TCL_RT_ENABLE, 1);
- so_data (so, rt_enable);
- so_method(so, rankine, NV34TCL_RT_HORIZ, 3);
- so_data (so, (w << 16) | 0);
- so_data (so, (h << 16) | 0);
- so_data (so, rt_format);
- so_method(so, rankine, NV34TCL_VIEWPORT_HORIZ, 2);
- so_data (so, (w << 16) | 0);
- so_data (so, (h << 16) | 0);
- so_method(so, rankine, NV34TCL_VIEWPORT_CLIP_HORIZ(0), 2);
- so_data (so, ((w - 1) << 16) | 0);
- so_data (so, ((h - 1) << 16) | 0);
- so_method(so, rankine, 0x1d88, 1);
- so_data (so, (1 << 12) | h);
- /* Wonder why this is needed, context should all be set to zero on init */
- so_method(so, rankine, NV34TCL_VIEWPORT_TX_ORIGIN, 1);
- so_data (so, 0);
-
- so_ref(so, &nv30->state.hw[NV30_STATE_FB]);
- so_ref(NULL, &so);
- return TRUE;
-}
-
-struct nv30_state_entry nv30_state_framebuffer = {
- .validate = nv30_state_framebuffer_validate,
- .dirty = {
- .pipe = NV30_NEW_FB,
- .hw = NV30_STATE_FB
- }
-};
diff --git a/src/gallium/drivers/nv30/nv30_state_rasterizer.c b/src/gallium/drivers/nv30/nv30_state_rasterizer.c
deleted file mode 100644
index 6d1b60e043..0000000000
--- a/src/gallium/drivers/nv30/nv30_state_rasterizer.c
+++ /dev/null
@@ -1,17 +0,0 @@
-#include "nv30_context.h"
-
-static boolean
-nv30_state_rasterizer_validate(struct nv30_context *nv30)
-{
- so_ref(nv30->rasterizer->so,
- &nv30->state.hw[NV30_STATE_RAST]);
- return TRUE;
-}
-
-struct nv30_state_entry nv30_state_rasterizer = {
- .validate = nv30_state_rasterizer_validate,
- .dirty = {
- .pipe = NV30_NEW_RAST,
- .hw = NV30_STATE_RAST
- }
-};
diff --git a/src/gallium/drivers/nv30/nv30_state_scissor.c b/src/gallium/drivers/nv30/nv30_state_scissor.c
deleted file mode 100644
index ba61a9e24a..0000000000
--- a/src/gallium/drivers/nv30/nv30_state_scissor.c
+++ /dev/null
@@ -1,36 +0,0 @@
-#include "nv30_context.h"
-
-static boolean
-nv30_state_scissor_validate(struct nv30_context *nv30)
-{
- struct pipe_rasterizer_state *rast = &nv30->rasterizer->pipe;
- struct pipe_scissor_state *s = &nv30->scissor;
- struct nouveau_stateobj *so;
-
- if (nv30->state.hw[NV30_STATE_SCISSOR] &&
- (rast->scissor == 0 && nv30->state.scissor_enabled == 0))
- return FALSE;
- nv30->state.scissor_enabled = rast->scissor;
-
- so = so_new(1, 2, 0);
- so_method(so, nv30->screen->rankine, NV34TCL_SCISSOR_HORIZ, 2);
- if (nv30->state.scissor_enabled) {
- so_data (so, ((s->maxx - s->minx) << 16) | s->minx);
- so_data (so, ((s->maxy - s->miny) << 16) | s->miny);
- } else {
- so_data (so, 4096 << 16);
- so_data (so, 4096 << 16);
- }
-
- so_ref(so, &nv30->state.hw[NV30_STATE_SCISSOR]);
- so_ref(NULL, &so);
- return TRUE;
-}
-
-struct nv30_state_entry nv30_state_scissor = {
- .validate = nv30_state_scissor_validate,
- .dirty = {
- .pipe = NV30_NEW_SCISSOR | NV30_NEW_RAST,
- .hw = NV30_STATE_SCISSOR
- }
-};
diff --git a/src/gallium/drivers/nv30/nv30_state_stipple.c b/src/gallium/drivers/nv30/nv30_state_stipple.c
deleted file mode 100644
index ed520a4f43..0000000000
--- a/src/gallium/drivers/nv30/nv30_state_stipple.c
+++ /dev/null
@@ -1,40 +0,0 @@
-#include "nv30_context.h"
-
-static boolean
-nv30_state_stipple_validate(struct nv30_context *nv30)
-{
- struct pipe_rasterizer_state *rast = &nv30->rasterizer->pipe;
- struct nouveau_grobj *rankine = nv30->screen->rankine;
- struct nouveau_stateobj *so;
-
- if (nv30->state.hw[NV30_STATE_STIPPLE] &&
- (rast->poly_stipple_enable == 0 && nv30->state.stipple_enabled == 0))
- return FALSE;
-
- if (rast->poly_stipple_enable) {
- unsigned i;
-
- so = so_new(2, 33, 0);
- so_method(so, rankine, NV34TCL_POLYGON_STIPPLE_ENABLE, 1);
- so_data (so, 1);
- so_method(so, rankine, NV34TCL_POLYGON_STIPPLE_PATTERN(0), 32);
- for (i = 0; i < 32; i++)
- so_data(so, nv30->stipple[i]);
- } else {
- so = so_new(1, 1, 0);
- so_method(so, rankine, NV34TCL_POLYGON_STIPPLE_ENABLE, 1);
- so_data (so, 0);
- }
-
- so_ref(so, &nv30->state.hw[NV30_STATE_STIPPLE]);
- so_ref(NULL, &so);
- return TRUE;
-}
-
-struct nv30_state_entry nv30_state_stipple = {
- .validate = nv30_state_stipple_validate,
- .dirty = {
- .pipe = NV30_NEW_STIPPLE | NV30_NEW_RAST,
- .hw = NV30_STATE_STIPPLE,
- }
-};
diff --git a/src/gallium/drivers/nv30/nv30_state_viewport.c b/src/gallium/drivers/nv30/nv30_state_viewport.c
deleted file mode 100644
index 6fccd6b60e..0000000000
--- a/src/gallium/drivers/nv30/nv30_state_viewport.c
+++ /dev/null
@@ -1,42 +0,0 @@
-#include "nv30_context.h"
-
-static boolean
-nv30_state_viewport_validate(struct nv30_context *nv30)
-{
- struct pipe_viewport_state *vpt = &nv30->viewport;
- struct nouveau_stateobj *so;
-
- if (nv30->state.hw[NV30_STATE_VIEWPORT] &&
- !(nv30->dirty & NV30_NEW_VIEWPORT))
- return FALSE;
-
- so = so_new(3, 10, 0);
- so_method(so, nv30->screen->rankine,
- NV34TCL_VIEWPORT_TRANSLATE_X, 8);
- so_data (so, fui(vpt->translate[0]));
- so_data (so, fui(vpt->translate[1]));
- so_data (so, fui(vpt->translate[2]));
- so_data (so, fui(vpt->translate[3]));
- so_data (so, fui(vpt->scale[0]));
- so_data (so, fui(vpt->scale[1]));
- so_data (so, fui(vpt->scale[2]));
- so_data (so, fui(vpt->scale[3]));
-/* so_method(so, nv30->screen->rankine, 0x1d78, 1);
- so_data (so, 1);
-*/
- /* TODO/FIXME: never saw value 0x0110 in renouveau dumps, only 0x0001 */
- so_method(so, nv30->screen->rankine, 0x1d78, 1);
- so_data (so, 1);
-
- so_ref(so, &nv30->state.hw[NV30_STATE_VIEWPORT]);
- so_ref(NULL, &so);
- return TRUE;
-}
-
-struct nv30_state_entry nv30_state_viewport = {
- .validate = nv30_state_viewport_validate,
- .dirty = {
- .pipe = NV30_NEW_VIEWPORT | NV30_NEW_RAST,
- .hw = NV30_STATE_VIEWPORT
- }
-};
diff --git a/src/gallium/drivers/nv30/nv30_state_zsa.c b/src/gallium/drivers/nv30/nv30_state_zsa.c
deleted file mode 100644
index 88cd74f180..0000000000
--- a/src/gallium/drivers/nv30/nv30_state_zsa.c
+++ /dev/null
@@ -1,41 +0,0 @@
-#include "nv30_context.h"
-
-static boolean
-nv30_state_zsa_validate(struct nv30_context *nv30)
-{
- so_ref(nv30->zsa->so,
- &nv30->state.hw[NV30_STATE_ZSA]);
- return TRUE;
-}
-
-struct nv30_state_entry nv30_state_zsa = {
- .validate = nv30_state_zsa_validate,
- .dirty = {
- .pipe = NV30_NEW_ZSA,
- .hw = NV30_STATE_ZSA
- }
-};
-
-static boolean
-nv30_state_sr_validate(struct nv30_context *nv30)
-{
- struct nouveau_stateobj *so = so_new(2, 2, 0);
- struct pipe_stencil_ref *sr = &nv30->stencil_ref;
-
- so_method(so, nv30->screen->rankine, NV34TCL_STENCIL_FRONT_FUNC_REF, 1);
- so_data (so, sr->ref_value[0]);
- so_method(so, nv30->screen->rankine, NV34TCL_STENCIL_BACK_FUNC_REF, 1);
- so_data (so, sr->ref_value[1]);
-
- so_ref(so, &nv30->state.hw[NV30_STATE_SR]);
- so_ref(NULL, &so);
- return TRUE;
-}
-
-struct nv30_state_entry nv30_state_sr = {
- .validate = nv30_state_sr_validate,
- .dirty = {
- .pipe = NV30_NEW_SR,
- .hw = NV30_STATE_SR
- }
-};
diff --git a/src/gallium/drivers/nv30/nv30_transfer.c b/src/gallium/drivers/nv30/nv30_transfer.c
deleted file mode 100644
index 3aeda51ea1..0000000000
--- a/src/gallium/drivers/nv30/nv30_transfer.c
+++ /dev/null
@@ -1,178 +0,0 @@
-#include "pipe/p_state.h"
-#include "pipe/p_defines.h"
-#include "util/u_inlines.h"
-#include "util/u_format.h"
-#include "util/u_memory.h"
-#include "util/u_math.h"
-#include "nouveau/nouveau_winsys.h"
-#include "nv30_context.h"
-#include "nv30_screen.h"
-#include "nv30_state.h"
-
-struct nv30_transfer {
- struct pipe_transfer base;
- struct pipe_surface *surface;
- boolean direct;
-};
-
-static void
-nv30_compatible_transfer_tex(struct pipe_texture *pt, unsigned width, unsigned height,
- struct pipe_texture *template)
-{
- memset(template, 0, sizeof(struct pipe_texture));
- template->target = pt->target;
- template->format = pt->format;
- template->width0 = width;
- template->height0 = height;
- template->depth0 = 1;
- template->last_level = 0;
- template->nr_samples = pt->nr_samples;
-
- template->tex_usage = PIPE_TEXTURE_USAGE_DYNAMIC |
- NOUVEAU_TEXTURE_USAGE_LINEAR;
-}
-
-static struct pipe_transfer *
-nv30_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
- unsigned face, unsigned level, unsigned zslice,
- enum pipe_transfer_usage usage,
- unsigned x, unsigned y, unsigned w, unsigned h)
-{
- struct nv30_miptree *mt = (struct nv30_miptree *)pt;
- struct nv30_transfer *tx;
- struct pipe_texture tx_tex_template, *tx_tex;
-
- tx = CALLOC_STRUCT(nv30_transfer);
- if (!tx)
- return NULL;
-
- pipe_texture_reference(&tx->base.texture, pt);
- tx->base.x = x;
- tx->base.y = y;
- tx->base.width = w;
- tx->base.height = h;
- tx->base.stride = mt->level[level].pitch;
- tx->base.usage = usage;
- tx->base.face = face;
- tx->base.level = level;
- tx->base.zslice = zslice;
-
- /* Direct access to texture */
- if ((pt->tex_usage & PIPE_TEXTURE_USAGE_DYNAMIC ||
- debug_get_bool_option("NOUVEAU_NO_TRANSFER", TRUE/*XXX:FALSE*/)) &&
- pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)
- {
- tx->direct = true;
- tx->surface = pscreen->get_tex_surface(pscreen, pt,
- face, level, zslice,
- pipe_transfer_buffer_flags(&tx->base));
- return &tx->base;
- }
-
- tx->direct = false;
-
- nv30_compatible_transfer_tex(pt, w, h, &tx_tex_template);
-
- tx_tex = pscreen->texture_create(pscreen, &tx_tex_template);
- if (!tx_tex)
- {
- FREE(tx);
- return NULL;
- }
-
- tx->base.stride = ((struct nv30_miptree*)tx_tex)->level[0].pitch;
-
- tx->surface = pscreen->get_tex_surface(pscreen, tx_tex,
- 0, 0, 0,
- pipe_transfer_buffer_flags(&tx->base));
-
- pipe_texture_reference(&tx_tex, NULL);
-
- if (!tx->surface)
- {
- pipe_surface_reference(&tx->surface, NULL);
- FREE(tx);
- return NULL;
- }
-
- if (usage & PIPE_TRANSFER_READ) {
- struct nv30_screen *nvscreen = nv30_screen(pscreen);
- struct pipe_surface *src;
-
- src = pscreen->get_tex_surface(pscreen, pt,
- face, level, zslice,
- PIPE_BUFFER_USAGE_GPU_READ);
-
- /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */
- /* TODO: Check if SIFM can un-swizzle */
- nvscreen->eng2d->copy(nvscreen->eng2d,
- tx->surface, 0, 0,
- src, x, y,
- w, h);
-
- pipe_surface_reference(&src, NULL);
- }
-
- return &tx->base;
-}
-
-static void
-nv30_transfer_del(struct pipe_transfer *ptx)
-{
- struct nv30_transfer *tx = (struct nv30_transfer *)ptx;
-
- if (!tx->direct && (ptx->usage & PIPE_TRANSFER_WRITE)) {
- struct pipe_screen *pscreen = ptx->texture->screen;
- struct nv30_screen *nvscreen = nv30_screen(pscreen);
- struct pipe_surface *dst;
-
- dst = pscreen->get_tex_surface(pscreen, ptx->texture,
- ptx->face, ptx->level, ptx->zslice,
- PIPE_BUFFER_USAGE_GPU_WRITE | NOUVEAU_BUFFER_USAGE_NO_RENDER);
-
- /* TODO: Check if SIFM can deal with x,y,w,h when swizzling */
- nvscreen->eng2d->copy(nvscreen->eng2d,
- dst, tx->base.x, tx->base.y,
- tx->surface, 0, 0,
- tx->base.width, tx->base.height);
-
- pipe_surface_reference(&dst, NULL);
- }
-
- pipe_surface_reference(&tx->surface, NULL);
- pipe_texture_reference(&ptx->texture, NULL);
- FREE(ptx);
-}
-
-static void *
-nv30_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
-{
- struct nv30_transfer *tx = (struct nv30_transfer *)ptx;
- struct nv04_surface *ns = (struct nv04_surface *)tx->surface;
- struct nv30_miptree *mt = (struct nv30_miptree *)tx->surface->texture;
- void *map = pipe_buffer_map(pscreen, mt->buffer,
- pipe_transfer_buffer_flags(ptx));
-
- if(!tx->direct)
- return map + ns->base.offset;
- else
- return map + ns->base.offset + ptx->y * ns->pitch + ptx->x * util_format_get_blocksize(ptx->texture->format);
-}
-
-static void
-nv30_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
-{
- struct nv30_transfer *tx = (struct nv30_transfer *)ptx;
- struct nv30_miptree *mt = (struct nv30_miptree *)tx->surface->texture;
-
- pipe_buffer_unmap(pscreen, mt->buffer);
-}
-
-void
-nv30_screen_init_transfer_functions(struct pipe_screen *pscreen)
-{
- pscreen->get_tex_transfer = nv30_transfer_new;
- pscreen->tex_transfer_destroy = nv30_transfer_del;
- pscreen->transfer_map = nv30_transfer_map;
- pscreen->transfer_unmap = nv30_transfer_unmap;
-}
diff --git a/src/gallium/drivers/nv30/nv30_vertprog.c b/src/gallium/drivers/nv30/nv30_vertprog.c
deleted file mode 100644
index 809be3712d..0000000000
--- a/src/gallium/drivers/nv30/nv30_vertprog.c
+++ /dev/null
@@ -1,842 +0,0 @@
-#include "pipe/p_context.h"
-#include "pipe/p_defines.h"
-#include "pipe/p_state.h"
-#include "util/u_inlines.h"
-
-#include "pipe/p_shader_tokens.h"
-#include "tgsi/tgsi_parse.h"
-#include "tgsi/tgsi_dump.h"
-
-#include "nv30_context.h"
-#include "nv30_state.h"
-
-/* TODO (at least...):
- * 1. Indexed consts + ARL
- * 2. Arb. swz/negation
- * 3. NV_vp11, NV_vp2, NV_vp3 features
- * - extra arith opcodes
- * - branching
- * - texture sampling
- * - indexed attribs
- * - indexed results
- * 4. bugs
- */
-
-#define SWZ_X 0
-#define SWZ_Y 1
-#define SWZ_Z 2
-#define SWZ_W 3
-#define MASK_X 8
-#define MASK_Y 4
-#define MASK_Z 2
-#define MASK_W 1
-#define MASK_ALL (MASK_X|MASK_Y|MASK_Z|MASK_W)
-#define DEF_SCALE 0
-#define DEF_CTEST 0
-#include "nv30_shader.h"
-
-#define swz(s,x,y,z,w) nv30_sr_swz((s), SWZ_##x, SWZ_##y, SWZ_##z, SWZ_##w)
-#define neg(s) nv30_sr_neg((s))
-#define abs(s) nv30_sr_abs((s))
-
-struct nv30_vpc {
- struct nv30_vertex_program *vp;
-
- struct nv30_vertex_program_exec *vpi;
-
- unsigned output_map[PIPE_MAX_SHADER_OUTPUTS];
-
- int high_temp;
- int temp_temp_count;
-
- struct nv30_sreg *imm;
- unsigned nr_imm;
-};
-
-static struct nv30_sreg
-temp(struct nv30_vpc *vpc)
-{
- int idx;
-
- idx = vpc->temp_temp_count++;
- idx += vpc->high_temp + 1;
- return nv30_sr(NV30SR_TEMP, idx);
-}
-
-static struct nv30_sreg
-constant(struct nv30_vpc *vpc, int pipe, float x, float y, float z, float w)
-{
- struct nv30_vertex_program *vp = vpc->vp;
- struct nv30_vertex_program_data *vpd;
- int idx;
-
- if (pipe >= 0) {
- for (idx = 0; idx < vp->nr_consts; idx++) {
- if (vp->consts[idx].index == pipe)
- return nv30_sr(NV30SR_CONST, idx);
- }
- }
-
- idx = vp->nr_consts++;
- vp->consts = realloc(vp->consts, sizeof(*vpd) * vp->nr_consts);
- vpd = &vp->consts[idx];
-
- vpd->index = pipe;
- vpd->value[0] = x;
- vpd->value[1] = y;
- vpd->value[2] = z;
- vpd->value[3] = w;
- return nv30_sr(NV30SR_CONST, idx);
-}
-
-#define arith(cc,s,o,d,m,s0,s1,s2) \
- nv30_vp_arith((cc), (s), NV30_VP_INST_##o, (d), (m), (s0), (s1), (s2))
-
-static void
-emit_src(struct nv30_vpc *vpc, uint32_t *hw, int pos, struct nv30_sreg src)
-{
- struct nv30_vertex_program *vp = vpc->vp;
- uint32_t sr = 0;
-
- switch (src.type) {
- case NV30SR_TEMP:
- sr |= (NV30_VP_SRC_REG_TYPE_TEMP << NV30_VP_SRC_REG_TYPE_SHIFT);
- sr |= (src.index << NV30_VP_SRC_TEMP_SRC_SHIFT);
- break;
- case NV30SR_INPUT:
- sr |= (NV30_VP_SRC_REG_TYPE_INPUT <<
- NV30_VP_SRC_REG_TYPE_SHIFT);
- vp->ir |= (1 << src.index);
- hw[1] |= (src.index << NV30_VP_INST_INPUT_SRC_SHIFT);
- break;
- case NV30SR_CONST:
- sr |= (NV30_VP_SRC_REG_TYPE_CONST <<
- NV30_VP_SRC_REG_TYPE_SHIFT);
- assert(vpc->vpi->const_index == -1 ||
- vpc->vpi->const_index == src.index);
- vpc->vpi->const_index = src.index;
- break;
- case NV30SR_NONE:
- sr |= (NV30_VP_SRC_REG_TYPE_INPUT <<
- NV30_VP_SRC_REG_TYPE_SHIFT);
- break;
- default:
- assert(0);
- }
-
- if (src.negate)
- sr |= NV30_VP_SRC_NEGATE;
-
- if (src.abs)
- hw[0] |= (1 << (21 + pos));
-
- sr |= ((src.swz[0] << NV30_VP_SRC_SWZ_X_SHIFT) |
- (src.swz[1] << NV30_VP_SRC_SWZ_Y_SHIFT) |
- (src.swz[2] << NV30_VP_SRC_SWZ_Z_SHIFT) |
- (src.swz[3] << NV30_VP_SRC_SWZ_W_SHIFT));
-
-/*
- * |VVV|
- * d�.�b
- * \u/
- *
- */
-
- switch (pos) {
- case 0:
- hw[1] |= ((sr & NV30_VP_SRC0_HIGH_MASK) >>
- NV30_VP_SRC0_HIGH_SHIFT) << NV30_VP_INST_SRC0H_SHIFT;
- hw[2] |= (sr & NV30_VP_SRC0_LOW_MASK) <<
- NV30_VP_INST_SRC0L_SHIFT;
- break;
- case 1:
- hw[2] |= sr << NV30_VP_INST_SRC1_SHIFT;
- break;
- case 2:
- hw[2] |= ((sr & NV30_VP_SRC2_HIGH_MASK) >>
- NV30_VP_SRC2_HIGH_SHIFT) << NV30_VP_INST_SRC2H_SHIFT;
- hw[3] |= (sr & NV30_VP_SRC2_LOW_MASK) <<
- NV30_VP_INST_SRC2L_SHIFT;
- break;
- default:
- assert(0);
- }
-}
-
-static void
-emit_dst(struct nv30_vpc *vpc, uint32_t *hw, int slot, struct nv30_sreg dst)
-{
- struct nv30_vertex_program *vp = vpc->vp;
-
- switch (dst.type) {
- case NV30SR_TEMP:
- hw[0] |= (dst.index << NV30_VP_INST_DEST_TEMP_ID_SHIFT);
- break;
- case NV30SR_OUTPUT:
- switch (dst.index) {
- case NV30_VP_INST_DEST_COL0 : vp->or |= (1 << 0); break;
- case NV30_VP_INST_DEST_COL1 : vp->or |= (1 << 1); break;
- case NV30_VP_INST_DEST_BFC0 : vp->or |= (1 << 2); break;
- case NV30_VP_INST_DEST_BFC1 : vp->or |= (1 << 3); break;
- case NV30_VP_INST_DEST_FOGC : vp->or |= (1 << 4); break;
- case NV30_VP_INST_DEST_PSZ : vp->or |= (1 << 5); break;
- case NV30_VP_INST_DEST_TC(0): vp->or |= (1 << 14); break;
- case NV30_VP_INST_DEST_TC(1): vp->or |= (1 << 15); break;
- case NV30_VP_INST_DEST_TC(2): vp->or |= (1 << 16); break;
- case NV30_VP_INST_DEST_TC(3): vp->or |= (1 << 17); break;
- case NV30_VP_INST_DEST_TC(4): vp->or |= (1 << 18); break;
- case NV30_VP_INST_DEST_TC(5): vp->or |= (1 << 19); break;
- case NV30_VP_INST_DEST_TC(6): vp->or |= (1 << 20); break;
- case NV30_VP_INST_DEST_TC(7): vp->or |= (1 << 21); break;
- default:
- break;
- }
-
- hw[3] |= (dst.index << NV30_VP_INST_DEST_SHIFT);
- hw[0] |= NV30_VP_INST_VEC_DEST_TEMP_MASK | (1<<20);
-
- /*XXX: no way this is entirely correct, someone needs to
- * figure out what exactly it is.
- */
- hw[3] |= 0x800;
- break;
- default:
- assert(0);
- }
-}
-
-static void
-nv30_vp_arith(struct nv30_vpc *vpc, int slot, int op,
- struct nv30_sreg dst, int mask,
- struct nv30_sreg s0, struct nv30_sreg s1,
- struct nv30_sreg s2)
-{
- struct nv30_vertex_program *vp = vpc->vp;
- uint32_t *hw;
-
- vp->insns = realloc(vp->insns, ++vp->nr_insns * sizeof(*vpc->vpi));
- vpc->vpi = &vp->insns[vp->nr_insns - 1];
- memset(vpc->vpi, 0, sizeof(*vpc->vpi));
- vpc->vpi->const_index = -1;
-
- hw = vpc->vpi->data;
-
- hw[0] |= (NV30_VP_INST_COND_TR << NV30_VP_INST_COND_SHIFT);
- hw[0] |= ((0 << NV30_VP_INST_COND_SWZ_X_SHIFT) |
- (1 << NV30_VP_INST_COND_SWZ_Y_SHIFT) |
- (2 << NV30_VP_INST_COND_SWZ_Z_SHIFT) |
- (3 << NV30_VP_INST_COND_SWZ_W_SHIFT));
-
- hw[1] |= (op << NV30_VP_INST_VEC_OPCODE_SHIFT);
-// hw[3] |= NV30_VP_INST_SCA_DEST_TEMP_MASK;
-// hw[3] |= (mask << NV30_VP_INST_VEC_WRITEMASK_SHIFT);
-
- if (dst.type == NV30SR_OUTPUT) {
- if (slot)
- hw[3] |= (mask << NV30_VP_INST_SDEST_WRITEMASK_SHIFT);
- else
- hw[3] |= (mask << NV30_VP_INST_VDEST_WRITEMASK_SHIFT);
- } else {
- if (slot)
- hw[3] |= (mask << NV30_VP_INST_STEMP_WRITEMASK_SHIFT);
- else
- hw[3] |= (mask << NV30_VP_INST_VTEMP_WRITEMASK_SHIFT);
- }
-
- emit_dst(vpc, hw, slot, dst);
- emit_src(vpc, hw, 0, s0);
- emit_src(vpc, hw, 1, s1);
- emit_src(vpc, hw, 2, s2);
-}
-
-static INLINE struct nv30_sreg
-tgsi_src(struct nv30_vpc *vpc, const struct tgsi_full_src_register *fsrc) {
- struct nv30_sreg src;
-
- switch (fsrc->Register.File) {
- case TGSI_FILE_INPUT:
- src = nv30_sr(NV30SR_INPUT, fsrc->Register.Index);
- break;
- case TGSI_FILE_CONSTANT:
- src = constant(vpc, fsrc->Register.Index, 0, 0, 0, 0);
- break;
- case TGSI_FILE_IMMEDIATE:
- src = vpc->imm[fsrc->Register.Index];
- break;
- case TGSI_FILE_TEMPORARY:
- if (vpc->high_temp < fsrc->Register.Index)
- vpc->high_temp = fsrc->Register.Index;
- src = nv30_sr(NV30SR_TEMP, fsrc->Register.Index);
- break;
- default:
- NOUVEAU_ERR("bad src file\n");
- break;
- }
-
- src.abs = fsrc->Register.Absolute;
- src.negate = fsrc->Register.Negate;
- src.swz[0] = fsrc->Register.SwizzleX;
- src.swz[1] = fsrc->Register.SwizzleY;
- src.swz[2] = fsrc->Register.SwizzleZ;
- src.swz[3] = fsrc->Register.SwizzleW;
- return src;
-}
-
-static INLINE struct nv30_sreg
-tgsi_dst(struct nv30_vpc *vpc, const struct tgsi_full_dst_register *fdst) {
- struct nv30_sreg dst;
-
- switch (fdst->Register.File) {
- case TGSI_FILE_OUTPUT:
- dst = nv30_sr(NV30SR_OUTPUT,
- vpc->output_map[fdst->Register.Index]);
-
- break;
- case TGSI_FILE_TEMPORARY:
- dst = nv30_sr(NV30SR_TEMP, fdst->Register.Index);
- if (vpc->high_temp < dst.index)
- vpc->high_temp = dst.index;
- break;
- default:
- NOUVEAU_ERR("bad dst file\n");
- break;
- }
-
- return dst;
-}
-
-static INLINE int
-tgsi_mask(uint tgsi)
-{
- int mask = 0;
-
- if (tgsi & TGSI_WRITEMASK_X) mask |= MASK_X;
- if (tgsi & TGSI_WRITEMASK_Y) mask |= MASK_Y;
- if (tgsi & TGSI_WRITEMASK_Z) mask |= MASK_Z;
- if (tgsi & TGSI_WRITEMASK_W) mask |= MASK_W;
- return mask;
-}
-
-static boolean
-nv30_vertprog_parse_instruction(struct nv30_vpc *vpc,
- const struct tgsi_full_instruction *finst)
-{
- struct nv30_sreg src[3], dst, tmp;
- struct nv30_sreg none = nv30_sr(NV30SR_NONE, 0);
- int mask;
- int ai = -1, ci = -1;
- int i;
-
- if (finst->Instruction.Opcode == TGSI_OPCODE_END)
- return TRUE;
-
- vpc->temp_temp_count = 0;
- for (i = 0; i < finst->Instruction.NumSrcRegs; i++) {
- const struct tgsi_full_src_register *fsrc;
-
- fsrc = &finst->Src[i];
- if (fsrc->Register.File == TGSI_FILE_TEMPORARY) {
- src[i] = tgsi_src(vpc, fsrc);
- }
- }
-
- for (i = 0; i < finst->Instruction.NumSrcRegs; i++) {
- const struct tgsi_full_src_register *fsrc;
-
- fsrc = &finst->Src[i];
- switch (fsrc->Register.File) {
- case TGSI_FILE_INPUT:
- if (ai == -1 || ai == fsrc->Register.Index) {
- ai = fsrc->Register.Index;
- src[i] = tgsi_src(vpc, fsrc);
- } else {
- src[i] = temp(vpc);
- arith(vpc, 0, OP_MOV, src[i], MASK_ALL,
- tgsi_src(vpc, fsrc), none, none);
- }
- break;
- /*XXX: index comparison is broken now that consts come from
- * two different register files.
- */
- case TGSI_FILE_CONSTANT:
- case TGSI_FILE_IMMEDIATE:
- if (ci == -1 || ci == fsrc->Register.Index) {
- ci = fsrc->Register.Index;
- src[i] = tgsi_src(vpc, fsrc);
- } else {
- src[i] = temp(vpc);
- arith(vpc, 0, OP_MOV, src[i], MASK_ALL,
- tgsi_src(vpc, fsrc), none, none);
- }
- break;
- case TGSI_FILE_TEMPORARY:
- /* handled above */
- break;
- default:
- NOUVEAU_ERR("bad src file\n");
- return FALSE;
- }
- }
-
- dst = tgsi_dst(vpc, &finst->Dst[0]);
- mask = tgsi_mask(finst->Dst[0].Register.WriteMask);
-
- switch (finst->Instruction.Opcode) {
- case TGSI_OPCODE_ABS:
- arith(vpc, 0, OP_MOV, dst, mask, abs(src[0]), none, none);
- break;
- case TGSI_OPCODE_ADD:
- arith(vpc, 0, OP_ADD, dst, mask, src[0], none, src[1]);
- break;
- case TGSI_OPCODE_ARL:
- arith(vpc, 0, OP_ARL, dst, mask, src[0], none, none);
- break;
- case TGSI_OPCODE_DP3:
- arith(vpc, 0, OP_DP3, dst, mask, src[0], src[1], none);
- break;
- case TGSI_OPCODE_DP4:
- arith(vpc, 0, OP_DP4, dst, mask, src[0], src[1], none);
- break;
- case TGSI_OPCODE_DPH:
- arith(vpc, 0, OP_DPH, dst, mask, src[0], src[1], none);
- break;
- case TGSI_OPCODE_DST:
- arith(vpc, 0, OP_DST, dst, mask, src[0], src[1], none);
- break;
- case TGSI_OPCODE_EX2:
- arith(vpc, 1, OP_EX2, dst, mask, none, none, src[0]);
- break;
- case TGSI_OPCODE_EXP:
- arith(vpc, 1, OP_EXP, dst, mask, none, none, src[0]);
- break;
- case TGSI_OPCODE_FLR:
- arith(vpc, 0, OP_FLR, dst, mask, src[0], none, none);
- break;
- case TGSI_OPCODE_FRC:
- arith(vpc, 0, OP_FRC, dst, mask, src[0], none, none);
- break;
- case TGSI_OPCODE_LG2:
- arith(vpc, 1, OP_LG2, dst, mask, none, none, src[0]);
- break;
- case TGSI_OPCODE_LIT:
- arith(vpc, 1, OP_LIT, dst, mask, none, none, src[0]);
- break;
- case TGSI_OPCODE_LOG:
- arith(vpc, 1, OP_LOG, dst, mask, none, none, src[0]);
- break;
- case TGSI_OPCODE_MAD:
- arith(vpc, 0, OP_MAD, dst, mask, src[0], src[1], src[2]);
- break;
- case TGSI_OPCODE_MAX:
- arith(vpc, 0, OP_MAX, dst, mask, src[0], src[1], none);
- break;
- case TGSI_OPCODE_MIN:
- arith(vpc, 0, OP_MIN, dst, mask, src[0], src[1], none);
- break;
- case TGSI_OPCODE_MOV:
- arith(vpc, 0, OP_MOV, dst, mask, src[0], none, none);
- break;
- case TGSI_OPCODE_MUL:
- arith(vpc, 0, OP_MUL, dst, mask, src[0], src[1], none);
- break;
- case TGSI_OPCODE_POW:
- tmp = temp(vpc);
- arith(vpc, 1, OP_LG2, tmp, MASK_X, none, none,
- swz(src[0], X, X, X, X));
- arith(vpc, 0, OP_MUL, tmp, MASK_X, swz(tmp, X, X, X, X),
- swz(src[1], X, X, X, X), none);
- arith(vpc, 1, OP_EX2, dst, mask, none, none,
- swz(tmp, X, X, X, X));
- break;
- case TGSI_OPCODE_RCP:
- arith(vpc, 1, OP_RCP, dst, mask, none, none, src[0]);
- break;
- case TGSI_OPCODE_RET:
- break;
- case TGSI_OPCODE_RSQ:
- arith(vpc, 1, OP_RSQ, dst, mask, none, none, src[0]);
- break;
- case TGSI_OPCODE_SGE:
- arith(vpc, 0, OP_SGE, dst, mask, src[0], src[1], none);
- break;
- case TGSI_OPCODE_SGT:
- arith(vpc, 0, OP_SGT, dst, mask, src[0], src[1], none);
- break;
- case TGSI_OPCODE_SLT:
- arith(vpc, 0, OP_SLT, dst, mask, src[0], src[1], none);
- break;
- case TGSI_OPCODE_SUB:
- arith(vpc, 0, OP_ADD, dst, mask, src[0], none, neg(src[1]));
- break;
- case TGSI_OPCODE_XPD:
- tmp = temp(vpc);
- arith(vpc, 0, OP_MUL, tmp, mask,
- swz(src[0], Z, X, Y, Y), swz(src[1], Y, Z, X, X), none);
- arith(vpc, 0, OP_MAD, dst, (mask & ~MASK_W),
- swz(src[0], Y, Z, X, X), swz(src[1], Z, X, Y, Y),
- neg(tmp));
- break;
- default:
- NOUVEAU_ERR("invalid opcode %d\n", finst->Instruction.Opcode);
- return FALSE;
- }
-
- return TRUE;
-}
-
-static boolean
-nv30_vertprog_parse_decl_output(struct nv30_vpc *vpc,
- const struct tgsi_full_declaration *fdec)
-{
- int hw;
-
- switch (fdec->Semantic.Name) {
- case TGSI_SEMANTIC_POSITION:
- hw = NV30_VP_INST_DEST_POS;
- break;
- case TGSI_SEMANTIC_COLOR:
- if (fdec->Semantic.Index == 0) {
- hw = NV30_VP_INST_DEST_COL0;
- } else
- if (fdec->Semantic.Index == 1) {
- hw = NV30_VP_INST_DEST_COL1;
- } else {
- NOUVEAU_ERR("bad colour semantic index\n");
- return FALSE;
- }
- break;
- case TGSI_SEMANTIC_BCOLOR:
- if (fdec->Semantic.Index == 0) {
- hw = NV30_VP_INST_DEST_BFC0;
- } else
- if (fdec->Semantic.Index == 1) {
- hw = NV30_VP_INST_DEST_BFC1;
- } else {
- NOUVEAU_ERR("bad bcolour semantic index\n");
- return FALSE;
- }
- break;
- case TGSI_SEMANTIC_FOG:
- hw = NV30_VP_INST_DEST_FOGC;
- break;
- case TGSI_SEMANTIC_PSIZE:
- hw = NV30_VP_INST_DEST_PSZ;
- break;
- case TGSI_SEMANTIC_GENERIC:
- if (fdec->Semantic.Index <= 7) {
- hw = NV30_VP_INST_DEST_TC(fdec->Semantic.Index);
- } else {
- NOUVEAU_ERR("bad generic semantic index\n");
- return FALSE;
- }
- break;
- case TGSI_SEMANTIC_EDGEFLAG:
- NOUVEAU_ERR("cannot handle edgeflag output\n");
- return FALSE;
- default:
- NOUVEAU_ERR("bad output semantic\n");
- return FALSE;
- }
-
- vpc->output_map[fdec->Range.First] = hw;
- return TRUE;
-}
-
-static boolean
-nv30_vertprog_prepare(struct nv30_vpc *vpc)
-{
- struct tgsi_parse_context p;
- int nr_imm = 0;
-
- tgsi_parse_init(&p, vpc->vp->pipe.tokens);
- while (!tgsi_parse_end_of_tokens(&p)) {
- const union tgsi_full_token *tok = &p.FullToken;
-
- tgsi_parse_token(&p);
- switch(tok->Token.Type) {
- case TGSI_TOKEN_TYPE_IMMEDIATE:
- nr_imm++;
- break;
- default:
- break;
- }
- }
- tgsi_parse_free(&p);
-
- if (nr_imm) {
- vpc->imm = CALLOC(nr_imm, sizeof(struct nv30_sreg));
- assert(vpc->imm);
- }
-
- return TRUE;
-}
-
-static void
-nv30_vertprog_translate(struct nv30_context *nv30,
- struct nv30_vertex_program *vp)
-{
- struct tgsi_parse_context parse;
- struct nv30_vpc *vpc = NULL;
-
- tgsi_dump(vp->pipe.tokens,0);
-
- vpc = CALLOC(1, sizeof(struct nv30_vpc));
- if (!vpc)
- return;
- vpc->vp = vp;
- vpc->high_temp = -1;
-
- if (!nv30_vertprog_prepare(vpc)) {
- FREE(vpc);
- return;
- }
-
- tgsi_parse_init(&parse, vp->pipe.tokens);
-
- while (!tgsi_parse_end_of_tokens(&parse)) {
- tgsi_parse_token(&parse);
-
- switch (parse.FullToken.Token.Type) {
- case TGSI_TOKEN_TYPE_DECLARATION:
- {
- const struct tgsi_full_declaration *fdec;
- fdec = &parse.FullToken.FullDeclaration;
- switch (fdec->Declaration.File) {
- case TGSI_FILE_OUTPUT:
- if (!nv30_vertprog_parse_decl_output(vpc, fdec))
- goto out_err;
- break;
- default:
- break;
- }
- }
- break;
- case TGSI_TOKEN_TYPE_IMMEDIATE:
- {
- const struct tgsi_full_immediate *imm;
-
- imm = &parse.FullToken.FullImmediate;
- assert(imm->Immediate.DataType == TGSI_IMM_FLOAT32);
- assert(imm->Immediate.NrTokens == 4 + 1);
- vpc->imm[vpc->nr_imm++] =
- constant(vpc, -1,
- imm->u[0].Float,
- imm->u[1].Float,
- imm->u[2].Float,
- imm->u[3].Float);
- }
- break;
- case TGSI_TOKEN_TYPE_INSTRUCTION:
- {
- const struct tgsi_full_instruction *finst;
- finst = &parse.FullToken.FullInstruction;
- if (!nv30_vertprog_parse_instruction(vpc, finst))
- goto out_err;
- }
- break;
- default:
- break;
- }
- }
-
- vp->insns[vp->nr_insns - 1].data[3] |= NV30_VP_INST_LAST;
- vp->translated = TRUE;
-out_err:
- tgsi_parse_free(&parse);
- FREE(vpc);
-}
-
-static boolean
-nv30_vertprog_validate(struct nv30_context *nv30)
-{
- struct pipe_screen *pscreen = nv30->pipe.screen;
- struct nv30_screen *screen = nv30->screen;
- struct nouveau_channel *chan = screen->base.channel;
- struct nouveau_grobj *rankine = screen->rankine;
- struct nv30_vertex_program *vp;
- struct pipe_buffer *constbuf;
- boolean upload_code = FALSE, upload_data = FALSE;
- int i;
-
- vp = nv30->vertprog;
- constbuf = nv30->constbuf[PIPE_SHADER_VERTEX];
-
- /* Translate TGSI shader into hw bytecode */
- if (!vp->translated) {
- nv30_vertprog_translate(nv30, vp);
- if (!vp->translated)
- return FALSE;
- }
-
- /* Allocate hw vtxprog exec slots */
- if (!vp->exec) {
- struct nouveau_resource *heap = nv30->screen->vp_exec_heap;
- struct nouveau_stateobj *so;
- uint vplen = vp->nr_insns;
-
- if (nouveau_resource_alloc(heap, vplen, vp, &vp->exec)) {
- while (heap->next && heap->size < vplen) {
- struct nv30_vertex_program *evict;
-
- evict = heap->next->priv;
- nouveau_resource_free(&evict->exec);
- }
-
- if (nouveau_resource_alloc(heap, vplen, vp, &vp->exec))
- assert(0);
- }
-
- so = so_new(1, 1, 0);
- so_method(so, rankine, NV34TCL_VP_START_FROM_ID, 1);
- so_data (so, vp->exec->start);
- so_ref(so, &vp->so);
- so_ref(NULL, &so);
-
- upload_code = TRUE;
- }
-
- /* Allocate hw vtxprog const slots */
- if (vp->nr_consts && !vp->data) {
- struct nouveau_resource *heap = nv30->screen->vp_data_heap;
-
- if (nouveau_resource_alloc(heap, vp->nr_consts, vp, &vp->data)) {
- while (heap->next && heap->size < vp->nr_consts) {
- struct nv30_vertex_program *evict;
-
- evict = heap->next->priv;
- nouveau_resource_free(&evict->data);
- }
-
- if (nouveau_resource_alloc(heap, vp->nr_consts, vp,
- &vp->data))
- assert(0);
- }
-
- /*XXX: handle this some day */
- assert(vp->data->start >= vp->data_start_min);
-
- upload_data = TRUE;
- if (vp->data_start != vp->data->start)
- upload_code = TRUE;
- }
-
- /* If exec or data segments moved we need to patch the program to
- * fixup offsets and register IDs.
- */
- if (vp->exec_start != vp->exec->start) {
- for (i = 0; i < vp->nr_insns; i++) {
- struct nv30_vertex_program_exec *vpi = &vp->insns[i];
-
- if (vpi->has_branch_offset) {
- assert(0);
- }
- }
-
- vp->exec_start = vp->exec->start;
- }
-
- if (vp->nr_consts && vp->data_start != vp->data->start) {
- for (i = 0; i < vp->nr_insns; i++) {
- struct nv30_vertex_program_exec *vpi = &vp->insns[i];
-
- if (vpi->const_index >= 0) {
- vpi->data[1] &= ~NV30_VP_INST_CONST_SRC_MASK;
- vpi->data[1] |=
- (vpi->const_index + vp->data->start) <<
- NV30_VP_INST_CONST_SRC_SHIFT;
-
- }
- }
-
- vp->data_start = vp->data->start;
- }
-
- /* Update + Upload constant values */
- if (vp->nr_consts) {
- float *map = NULL;
-
- if (constbuf) {
- map = pipe_buffer_map(pscreen, constbuf,
- PIPE_BUFFER_USAGE_CPU_READ);
- }
-
- for (i = 0; i < vp->nr_consts; i++) {
- struct nv30_vertex_program_data *vpd = &vp->consts[i];
-
- if (vpd->index >= 0) {
- if (!upload_data &&
- !memcmp(vpd->value, &map[vpd->index * 4],
- 4 * sizeof(float)))
- continue;
- memcpy(vpd->value, &map[vpd->index * 4],
- 4 * sizeof(float));
- }
-
- BEGIN_RING(chan, rankine, NV34TCL_VP_UPLOAD_CONST_ID, 5);
- OUT_RING (chan, i + vp->data->start);
- OUT_RINGp (chan, (uint32_t *)vpd->value, 4);
- }
-
- if (constbuf)
- pipe_buffer_unmap(pscreen, constbuf);
- }
-
- /* Upload vtxprog */
- if (upload_code) {
-#if 0
- for (i = 0; i < vp->nr_insns; i++) {
- NOUVEAU_MSG("VP inst %d: 0x%08x 0x%08x 0x%08x 0x%08x\n",
- i, vp->insns[i].data[0], vp->insns[i].data[1],
- vp->insns[i].data[2], vp->insns[i].data[3]);
- }
-#endif
- BEGIN_RING(chan, rankine, NV34TCL_VP_UPLOAD_FROM_ID, 1);
- OUT_RING (chan, vp->exec->start);
- for (i = 0; i < vp->nr_insns; i++) {
- BEGIN_RING(chan, rankine, NV34TCL_VP_UPLOAD_INST(0), 4);
- OUT_RINGp (chan, vp->insns[i].data, 4);
- }
- }
-
- if (vp->so != nv30->state.hw[NV30_STATE_VERTPROG]) {
- so_ref(vp->so, &nv30->state.hw[NV30_STATE_VERTPROG]);
- return TRUE;
- }
-
- return FALSE;
-}
-
-void
-nv30_vertprog_destroy(struct nv30_context *nv30, struct nv30_vertex_program *vp)
-{
- vp->translated = FALSE;
-
- if (vp->nr_insns) {
- FREE(vp->insns);
- vp->insns = NULL;
- vp->nr_insns = 0;
- }
-
- if (vp->nr_consts) {
- FREE(vp->consts);
- vp->consts = NULL;
- vp->nr_consts = 0;
- }
-
- nouveau_resource_free(&vp->exec);
- vp->exec_start = 0;
- nouveau_resource_free(&vp->data);
- vp->data_start = 0;
- vp->data_start_min = 0;
-
- vp->ir = vp->or = 0;
- so_ref(NULL, &vp->so);
-}
-
-struct nv30_state_entry nv30_state_vertprog = {
- .validate = nv30_vertprog_validate,
- .dirty = {
- .pipe = NV30_NEW_VERTPROG /*| NV30_NEW_UCP*/,
- .hw = NV30_STATE_VERTPROG,
- }
-};
diff --git a/src/gallium/drivers/nv40/Makefile b/src/gallium/drivers/nv40/Makefile
deleted file mode 100644
index 0ecae2b491..0000000000
--- a/src/gallium/drivers/nv40/Makefile
+++ /dev/null
@@ -1,29 +0,0 @@
-TOP = ../../../..
-include $(TOP)/configs/current
-
-LIBNAME = nv40
-
-C_SOURCES = \
- nv40_clear.c \
- nv40_context.c \
- nv40_draw.c \
- nv40_fragprog.c \
- nv40_fragtex.c \
- nv40_miptree.c \
- nv40_query.c \
- nv40_screen.c \
- nv40_state.c \
- nv40_state_blend.c \
- nv40_state_emit.c \
- nv40_state_fb.c \
- nv40_state_rasterizer.c \
- nv40_state_scissor.c \
- nv40_state_stipple.c \
- nv40_state_viewport.c \
- nv40_state_zsa.c \
- nv40_surface.c \
- nv40_transfer.c \
- nv40_vbo.c \
- nv40_vertprog.c
-
-include ../../Makefile.template
diff --git a/src/gallium/drivers/nv40/nv40_clear.c b/src/gallium/drivers/nv40/nv40_clear.c
deleted file mode 100644
index ddf13addf3..0000000000
--- a/src/gallium/drivers/nv40/nv40_clear.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include "pipe/p_context.h"
-#include "pipe/p_defines.h"
-#include "pipe/p_state.h"
-#include "util/u_clear.h"
-
-#include "nv40_context.h"
-
-void
-nv40_clear(struct pipe_context *pipe, unsigned buffers,
- const float *rgba, double depth, unsigned stencil)
-{
- util_clear(pipe, &nv40_context(pipe)->framebuffer, buffers, rgba, depth,
- stencil);
-}
diff --git a/src/gallium/drivers/nv40/nv40_context.c b/src/gallium/drivers/nv40/nv40_context.c
deleted file mode 100644
index 65dc73e88b..0000000000
--- a/src/gallium/drivers/nv40/nv40_context.c
+++ /dev/null
@@ -1,87 +0,0 @@
-#include "draw/draw_context.h"
-#include "pipe/p_defines.h"
-
-#include "nv40_context.h"
-#include "nv40_screen.h"
-
-static void
-nv40_flush(struct pipe_context *pipe, unsigned flags,
- struct pipe_fence_handle **fence)
-{
- struct nv40_context *nv40 = nv40_context(pipe);
- struct nv40_screen *screen = nv40->screen;
- struct nouveau_channel *chan = screen->base.channel;
- struct nouveau_grobj *curie = screen->curie;
-
- if (flags & PIPE_FLUSH_TEXTURE_CACHE) {
- BEGIN_RING(chan, curie, 0x1fd8, 1);
- OUT_RING (chan, 2);
- BEGIN_RING(chan, curie, 0x1fd8, 1);
- OUT_RING (chan, 1);
- }
-
- FIRE_RING(chan);
- if (fence)
- *fence = NULL;
-}
-
-static void
-nv40_destroy(struct pipe_context *pipe)
-{
- struct nv40_context *nv40 = nv40_context(pipe);
- unsigned i;
-
- for (i = 0; i < NV40_STATE_MAX; i++) {
- if (nv40->state.hw[i])
- so_ref(NULL, &nv40->state.hw[i]);
- }
-
- if (nv40->draw)
- draw_destroy(nv40->draw);
- FREE(nv40);
-}
-
-struct pipe_context *
-nv40_create(struct pipe_screen *pscreen, void *priv)
-{
- struct nv40_screen *screen = nv40_screen(pscreen);
- struct pipe_winsys *ws = pscreen->winsys;
- struct nv40_context *nv40;
- struct nouveau_winsys *nvws = screen->nvws;
-
- nv40 = CALLOC(1, sizeof(struct nv40_context));
- if (!nv40)
- return NULL;
- nv40->screen = screen;
-
- nv40->nvws = nvws;
-
- nv40->pipe.winsys = ws;
- nv40->pipe.priv = priv;
- nv40->pipe.screen = pscreen;
- nv40->pipe.destroy = nv40_destroy;
- nv40->pipe.draw_arrays = nv40_draw_arrays;
- nv40->pipe.draw_elements = nv40_draw_elements;
- nv40->pipe.clear = nv40_clear;
- nv40->pipe.flush = nv40_flush;
-
- nv40->pipe.is_texture_referenced = nouveau_is_texture_referenced;
- nv40->pipe.is_buffer_referenced = nouveau_is_buffer_referenced;
-
- screen->base.channel->user_private = nv40;
- screen->base.channel->flush_notify = nv40_state_flush_notify;
-
- nv40_init_query_functions(nv40);
- nv40_init_surface_functions(nv40);
- nv40_init_state_functions(nv40);
-
- /* Create, configure, and install fallback swtnl path */
- nv40->draw = draw_create();
- draw_wide_point_threshold(nv40->draw, 9999999.0);
- draw_wide_line_threshold(nv40->draw, 9999999.0);
- draw_enable_line_stipple(nv40->draw, FALSE);
- draw_enable_point_sprites(nv40->draw, FALSE);
- draw_set_rasterize_stage(nv40->draw, nv40_draw_render_stage(nv40));
-
- return &nv40->pipe;
-}
diff --git a/src/gallium/drivers/nv40/nv40_context.h b/src/gallium/drivers/nv40/nv40_context.h
deleted file mode 100644
index 97fb6a2ef9..0000000000
--- a/src/gallium/drivers/nv40/nv40_context.h
+++ /dev/null
@@ -1,239 +0,0 @@
-#ifndef __NV40_CONTEXT_H__
-#define __NV40_CONTEXT_H__
-
-#include <stdio.h>
-
-#include "pipe/p_context.h"
-#include "pipe/p_defines.h"
-#include "pipe/p_state.h"
-#include "pipe/p_compiler.h"
-
-#include "util/u_memory.h"
-#include "util/u_math.h"
-#include "util/u_inlines.h"
-
-#include "draw/draw_vertex.h"
-
-#include "nouveau/nouveau_winsys.h"
-#include "nouveau/nouveau_gldefs.h"
-#include "nouveau/nouveau_context.h"
-#include "nouveau/nouveau_stateobj.h"
-
-#include "nv40_state.h"
-
-#define NOUVEAU_ERR(fmt, args...) \
- fprintf(stderr, "%s:%d - "fmt, __func__, __LINE__, ##args);
-#define NOUVEAU_MSG(fmt, args...) \
- fprintf(stderr, "nouveau: "fmt, ##args);
-
-enum nv40_state_index {
- NV40_STATE_FB = 0,
- NV40_STATE_VIEWPORT = 1,
- NV40_STATE_BLEND = 2,
- NV40_STATE_RAST = 3,
- NV40_STATE_ZSA = 4,
- NV40_STATE_BCOL = 5,
- NV40_STATE_CLIP = 6,
- NV40_STATE_SCISSOR = 7,
- NV40_STATE_STIPPLE = 8,
- NV40_STATE_FRAGPROG = 9,
- NV40_STATE_VERTPROG = 10,
- NV40_STATE_FRAGTEX0 = 11,
- NV40_STATE_FRAGTEX1 = 12,
- NV40_STATE_FRAGTEX2 = 13,
- NV40_STATE_FRAGTEX3 = 14,
- NV40_STATE_FRAGTEX4 = 15,
- NV40_STATE_FRAGTEX5 = 16,
- NV40_STATE_FRAGTEX6 = 17,
- NV40_STATE_FRAGTEX7 = 18,
- NV40_STATE_FRAGTEX8 = 19,
- NV40_STATE_FRAGTEX9 = 20,
- NV40_STATE_FRAGTEX10 = 21,
- NV40_STATE_FRAGTEX11 = 22,
- NV40_STATE_FRAGTEX12 = 23,
- NV40_STATE_FRAGTEX13 = 24,
- NV40_STATE_FRAGTEX14 = 25,
- NV40_STATE_FRAGTEX15 = 26,
- NV40_STATE_VERTTEX0 = 27,
- NV40_STATE_VERTTEX1 = 28,
- NV40_STATE_VERTTEX2 = 29,
- NV40_STATE_VERTTEX3 = 30,
- NV40_STATE_VTXBUF = 31,
- NV40_STATE_VTXFMT = 32,
- NV40_STATE_VTXATTR = 33,
- NV40_STATE_SR = 34,
- NV40_STATE_MAX = 35
-};
-
-#include "nv40_screen.h"
-
-#define NV40_NEW_BLEND (1 << 0)
-#define NV40_NEW_RAST (1 << 1)
-#define NV40_NEW_ZSA (1 << 2)
-#define NV40_NEW_SAMPLER (1 << 3)
-#define NV40_NEW_FB (1 << 4)
-#define NV40_NEW_STIPPLE (1 << 5)
-#define NV40_NEW_SCISSOR (1 << 6)
-#define NV40_NEW_VIEWPORT (1 << 7)
-#define NV40_NEW_BCOL (1 << 8)
-#define NV40_NEW_VERTPROG (1 << 9)
-#define NV40_NEW_FRAGPROG (1 << 10)
-#define NV40_NEW_ARRAYS (1 << 11)
-#define NV40_NEW_UCP (1 << 12)
-#define NV40_NEW_SR (1 << 13)
-
-struct nv40_rasterizer_state {
- struct pipe_rasterizer_state pipe;
- struct nouveau_stateobj *so;
-};
-
-struct nv40_zsa_state {
- struct pipe_depth_stencil_alpha_state pipe;
- struct nouveau_stateobj *so;
-};
-
-struct nv40_blend_state {
- struct pipe_blend_state pipe;
- struct nouveau_stateobj *so;
-};
-
-
-struct nv40_state {
- unsigned scissor_enabled;
- unsigned stipple_enabled;
- unsigned fp_samplers;
-
- uint64_t dirty;
- struct nouveau_stateobj *hw[NV40_STATE_MAX];
-};
-
-struct nv40_context {
- struct pipe_context pipe;
-
- struct nouveau_winsys *nvws;
- struct nv40_screen *screen;
-
- struct draw_context *draw;
-
- /* HW state derived from pipe states */
- struct nv40_state state;
- struct {
- struct nv40_vertex_program *vertprog;
-
- unsigned nr_attribs;
- unsigned hw[PIPE_MAX_SHADER_INPUTS];
- unsigned draw[PIPE_MAX_SHADER_INPUTS];
- unsigned emit[PIPE_MAX_SHADER_INPUTS];
- } swtnl;
-
- enum {
- HW, SWTNL, SWRAST
- } render_mode;
- unsigned fallback_swtnl;
- unsigned fallback_swrast;
-
- /* Context state */
- unsigned dirty, draw_dirty;
- struct pipe_scissor_state scissor;
- unsigned stipple[32];
- struct pipe_clip_state clip;
- struct nv40_vertex_program *vertprog;
- struct nv40_fragment_program *fragprog;
- struct pipe_buffer *constbuf[PIPE_SHADER_TYPES];
- unsigned constbuf_nr[PIPE_SHADER_TYPES];
- struct nv40_rasterizer_state *rasterizer;
- struct nv40_zsa_state *zsa;
- struct nv40_blend_state *blend;
- struct pipe_blend_color blend_colour;
- struct pipe_stencil_ref stencil_ref;
- struct pipe_viewport_state viewport;
- struct pipe_framebuffer_state framebuffer;
- struct pipe_buffer *idxbuf;
- unsigned idxbuf_format;
- struct nv40_sampler_state *tex_sampler[PIPE_MAX_SAMPLERS];
- struct nv40_miptree *tex_miptree[PIPE_MAX_SAMPLERS];
- unsigned nr_samplers;
- unsigned nr_textures;
- unsigned dirty_samplers;
- struct pipe_vertex_buffer vtxbuf[PIPE_MAX_ATTRIBS];
- unsigned vtxbuf_nr;
- struct pipe_vertex_element vtxelt[PIPE_MAX_ATTRIBS];
- unsigned vtxelt_nr;
-};
-
-static INLINE struct nv40_context *
-nv40_context(struct pipe_context *pipe)
-{
- return (struct nv40_context *)pipe;
-}
-
-struct nv40_state_entry {
- boolean (*validate)(struct nv40_context *nv40);
- struct {
- unsigned pipe;
- unsigned hw;
- } dirty;
-};
-
-extern void nv40_init_state_functions(struct nv40_context *nv40);
-extern void nv40_init_surface_functions(struct nv40_context *nv40);
-extern void nv40_init_query_functions(struct nv40_context *nv40);
-
-extern void nv40_screen_init_miptree_functions(struct pipe_screen *pscreen);
-
-/* nv40_draw.c */
-extern struct draw_stage *nv40_draw_render_stage(struct nv40_context *nv40);
-extern void nv40_draw_elements_swtnl(struct pipe_context *pipe,
- struct pipe_buffer *idxbuf,
- unsigned ib_size, unsigned mode,
- unsigned start, unsigned count);
-
-/* nv40_vertprog.c */
-extern void nv40_vertprog_destroy(struct nv40_context *,
- struct nv40_vertex_program *);
-
-/* nv40_fragprog.c */
-extern void nv40_fragprog_destroy(struct nv40_context *,
- struct nv40_fragment_program *);
-
-/* nv40_fragtex.c */
-extern void nv40_fragtex_bind(struct nv40_context *);
-
-/* nv40_state.c and friends */
-extern boolean nv40_state_validate(struct nv40_context *nv40);
-extern boolean nv40_state_validate_swtnl(struct nv40_context *nv40);
-extern void nv40_state_emit(struct nv40_context *nv40);
-extern void nv40_state_flush_notify(struct nouveau_channel *chan);
-extern struct nv40_state_entry nv40_state_rasterizer;
-extern struct nv40_state_entry nv40_state_scissor;
-extern struct nv40_state_entry nv40_state_stipple;
-extern struct nv40_state_entry nv40_state_fragprog;
-extern struct nv40_state_entry nv40_state_vertprog;
-extern struct nv40_state_entry nv40_state_blend;
-extern struct nv40_state_entry nv40_state_blend_colour;
-extern struct nv40_state_entry nv40_state_zsa;
-extern struct nv40_state_entry nv40_state_viewport;
-extern struct nv40_state_entry nv40_state_framebuffer;
-extern struct nv40_state_entry nv40_state_fragtex;
-extern struct nv40_state_entry nv40_state_vbo;
-extern struct nv40_state_entry nv40_state_vtxfmt;
-extern struct nv40_state_entry nv40_state_sr;
-
-/* nv40_vbo.c */
-extern void nv40_draw_arrays(struct pipe_context *, unsigned mode,
- unsigned start, unsigned count);
-extern void nv40_draw_elements(struct pipe_context *pipe,
- struct pipe_buffer *indexBuffer,
- unsigned indexSize,
- unsigned mode, unsigned start,
- unsigned count);
-
-/* nv40_clear.c */
-extern void nv40_clear(struct pipe_context *pipe, unsigned buffers,
- const float *rgba, double depth, unsigned stencil);
-
-/* nv40_context.c */
-struct pipe_context *
-nv40_create(struct pipe_screen *pscreen, void *priv);
-
-#endif
diff --git a/src/gallium/drivers/nv40/nv40_draw.c b/src/gallium/drivers/nv40/nv40_draw.c
deleted file mode 100644
index 48bd84d16c..0000000000
--- a/src/gallium/drivers/nv40/nv40_draw.c
+++ /dev/null
@@ -1,360 +0,0 @@
-#include "pipe/p_shader_tokens.h"
-#include "util/u_inlines.h"
-
-#include "util/u_pack_color.h"
-
-#include "draw/draw_context.h"
-#include "draw/draw_vertex.h"
-#include "draw/draw_pipe.h"
-
-#include "nv40_context.h"
-#define NV40_SHADER_NO_FUCKEDNESS
-#include "nv40_shader.h"
-
-/* Simple, but crappy, swtnl path, hopefully we wont need to hit this very
- * often at all. Uses "quadro style" vertex submission + a fixed vertex
- * layout to avoid the need to generate a vertex program or vtxfmt.
- */
-
-struct nv40_render_stage {
- struct draw_stage stage;
- struct nv40_context *nv40;
- unsigned prim;
-};
-
-static INLINE struct nv40_render_stage *
-nv40_render_stage(struct draw_stage *stage)
-{
- return (struct nv40_render_stage *)stage;
-}
-
-static INLINE void
-nv40_render_vertex(struct nv40_context *nv40, const struct vertex_header *v)
-{
- struct nv40_screen *screen = nv40->screen;
- struct nouveau_channel *chan = screen->base.channel;
- struct nouveau_grobj *curie = screen->curie;
- unsigned i;
-
- for (i = 0; i < nv40->swtnl.nr_attribs; i++) {
- unsigned idx = nv40->swtnl.draw[i];
- unsigned hw = nv40->swtnl.hw[i];
-
- switch (nv40->swtnl.emit[i]) {
- case EMIT_OMIT:
- break;
- case EMIT_1F:
- BEGIN_RING(chan, curie, NV40TCL_VTX_ATTR_1F(hw), 1);
- OUT_RING (chan, fui(v->data[idx][0]));
- break;
- case EMIT_2F:
- BEGIN_RING(chan, curie, NV40TCL_VTX_ATTR_2F_X(hw), 2);
- OUT_RING (chan, fui(v->data[idx][0]));
- OUT_RING (chan, fui(v->data[idx][1]));
- break;
- case EMIT_3F:
- BEGIN_RING(chan, curie, NV40TCL_VTX_ATTR_3F_X(hw), 3);
- OUT_RING (chan, fui(v->data[idx][0]));
- OUT_RING (chan, fui(v->data[idx][1]));
- OUT_RING (chan, fui(v->data[idx][2]));
- break;
- case EMIT_4F:
- BEGIN_RING(chan, curie, NV40TCL_VTX_ATTR_4F_X(hw), 4);
- OUT_RING (chan, fui(v->data[idx][0]));
- OUT_RING (chan, fui(v->data[idx][1]));
- OUT_RING (chan, fui(v->data[idx][2]));
- OUT_RING (chan, fui(v->data[idx][3]));
- break;
- case EMIT_4UB:
- BEGIN_RING(chan, curie, NV40TCL_VTX_ATTR_4UB(hw), 1);
- OUT_RING (chan, pack_ub4(float_to_ubyte(v->data[idx][0]),
- float_to_ubyte(v->data[idx][1]),
- float_to_ubyte(v->data[idx][2]),
- float_to_ubyte(v->data[idx][3])));
- break;
- default:
- assert(0);
- break;
- }
- }
-}
-
-static INLINE void
-nv40_render_prim(struct draw_stage *stage, struct prim_header *prim,
- unsigned mode, unsigned count)
-{
- struct nv40_render_stage *rs = nv40_render_stage(stage);
- struct nv40_context *nv40 = rs->nv40;
-
- struct nv40_screen *screen = nv40->screen;
- struct nouveau_channel *chan = screen->base.channel;
- struct nouveau_grobj *curie = screen->curie;
- unsigned i;
-
- /* Ensure there's room for 4xfloat32 + potentially 3 begin/end */
- if (AVAIL_RING(chan) < ((count * 20) + 6)) {
- if (rs->prim != NV40TCL_BEGIN_END_STOP) {
- NOUVEAU_ERR("AIII, missed flush\n");
- assert(0);
- }
- FIRE_RING(chan);
- nv40_state_emit(nv40);
- }
-
- /* Switch primitive modes if necessary */
- if (rs->prim != mode) {
- if (rs->prim != NV40TCL_BEGIN_END_STOP) {
- BEGIN_RING(chan, curie, NV40TCL_BEGIN_END, 1);
- OUT_RING (chan, NV40TCL_BEGIN_END_STOP);
- }
-
- BEGIN_RING(chan, curie, NV40TCL_BEGIN_END, 1);
- OUT_RING (chan, mode);
- rs->prim = mode;
- }
-
- /* Emit vertex data */
- for (i = 0; i < count; i++)
- nv40_render_vertex(nv40, prim->v[i]);
-
- /* If it's likely we'll need to empty the push buffer soon, finish
- * off the primitive now.
- */
- if (AVAIL_RING(chan) < ((count * 20) + 6)) {
- BEGIN_RING(chan, curie, NV40TCL_BEGIN_END, 1);
- OUT_RING (chan, NV40TCL_BEGIN_END_STOP);
- rs->prim = NV40TCL_BEGIN_END_STOP;
- }
-}
-
-static void
-nv40_render_point(struct draw_stage *draw, struct prim_header *prim)
-{
- nv40_render_prim(draw, prim, NV40TCL_BEGIN_END_POINTS, 1);
-}
-
-static void
-nv40_render_line(struct draw_stage *draw, struct prim_header *prim)
-{
- nv40_render_prim(draw, prim, NV40TCL_BEGIN_END_LINES, 2);
-}
-
-static void
-nv40_render_tri(struct draw_stage *draw, struct prim_header *prim)
-{
- nv40_render_prim(draw, prim, NV40TCL_BEGIN_END_TRIANGLES, 3);
-}
-
-static void
-nv40_render_flush(struct draw_stage *draw, unsigned flags)
-{
- struct nv40_render_stage *rs = nv40_render_stage(draw);
- struct nv40_context *nv40 = rs->nv40;
- struct nv40_screen *screen = nv40->screen;
- struct nouveau_channel *chan = screen->base.channel;
- struct nouveau_grobj *curie = screen->curie;
-
- if (rs->prim != NV40TCL_BEGIN_END_STOP) {
- BEGIN_RING(chan, curie, NV40TCL_BEGIN_END, 1);
- OUT_RING (chan, NV40TCL_BEGIN_END_STOP);
- rs->prim = NV40TCL_BEGIN_END_STOP;
- }
-}
-
-static void
-nv40_render_reset_stipple_counter(struct draw_stage *draw)
-{
-}
-
-static void
-nv40_render_destroy(struct draw_stage *draw)
-{
- FREE(draw);
-}
-
-static INLINE void
-emit_mov(struct nv40_vertex_program *vp,
- unsigned dst, unsigned src, unsigned vor, unsigned mask)
-{
- struct nv40_vertex_program_exec *inst;
-
- vp->insns = realloc(vp->insns,
- sizeof(struct nv40_vertex_program_exec) *
- ++vp->nr_insns);
- inst = &vp->insns[vp->nr_insns - 1];
-
- inst->data[0] = 0x401f9c6c;
- inst->data[1] = 0x0040000d | (src << 8);
- inst->data[2] = 0x8106c083;
- inst->data[3] = 0x6041ff80 | (dst << 2) | (mask << 13);
- inst->const_index = -1;
- inst->has_branch_offset = FALSE;
-
- vp->ir |= (1 << src);
- if (vor != ~0)
- vp->or |= (1 << vor);
-}
-
-static struct nv40_vertex_program *
-create_drawvp(struct nv40_context *nv40)
-{
- struct nv40_vertex_program *vp = CALLOC_STRUCT(nv40_vertex_program);
- unsigned i;
-
- emit_mov(vp, NV40_VP_INST_DEST_POS, 0, ~0, 0xf);
- emit_mov(vp, NV40_VP_INST_DEST_COL0, 3, 0, 0xf);
- emit_mov(vp, NV40_VP_INST_DEST_COL1, 4, 1, 0xf);
- emit_mov(vp, NV40_VP_INST_DEST_BFC0, 3, 2, 0xf);
- emit_mov(vp, NV40_VP_INST_DEST_BFC1, 4, 3, 0xf);
- emit_mov(vp, NV40_VP_INST_DEST_FOGC, 5, 4, 0x8);
- for (i = 0; i < 8; i++)
- emit_mov(vp, NV40_VP_INST_DEST_TC(i), 8 + i, 14 + i, 0xf);
-
- vp->insns[vp->nr_insns - 1].data[3] |= 1;
- vp->translated = TRUE;
- return vp;
-}
-
-struct draw_stage *
-nv40_draw_render_stage(struct nv40_context *nv40)
-{
- struct nv40_render_stage *render = CALLOC_STRUCT(nv40_render_stage);
-
- if (!nv40->swtnl.vertprog)
- nv40->swtnl.vertprog = create_drawvp(nv40);
-
- render->nv40 = nv40;
- render->stage.draw = nv40->draw;
- render->stage.point = nv40_render_point;
- render->stage.line = nv40_render_line;
- render->stage.tri = nv40_render_tri;
- render->stage.flush = nv40_render_flush;
- render->stage.reset_stipple_counter = nv40_render_reset_stipple_counter;
- render->stage.destroy = nv40_render_destroy;
-
- return &render->stage;
-}
-
-void
-nv40_draw_elements_swtnl(struct pipe_context *pipe,
- struct pipe_buffer *idxbuf, unsigned idxbuf_size,
- unsigned mode, unsigned start, unsigned count)
-{
- struct nv40_context *nv40 = nv40_context(pipe);
- struct pipe_screen *pscreen = pipe->screen;
- unsigned i;
- void *map;
-
- if (!nv40_state_validate_swtnl(nv40))
- return;
- nv40->state.dirty &= ~(1ULL << NV40_STATE_VTXBUF);
- nv40_state_emit(nv40);
-
- for (i = 0; i < nv40->vtxbuf_nr; i++) {
- map = pipe_buffer_map(pscreen, nv40->vtxbuf[i].buffer,
- PIPE_BUFFER_USAGE_CPU_READ);
- draw_set_mapped_vertex_buffer(nv40->draw, i, map);
- }
-
- if (idxbuf) {
- map = pipe_buffer_map(pscreen, idxbuf,
- PIPE_BUFFER_USAGE_CPU_READ);
- draw_set_mapped_element_buffer(nv40->draw, idxbuf_size, map);
- } else {
- draw_set_mapped_element_buffer(nv40->draw, 0, NULL);
- }
-
- if (nv40->constbuf[PIPE_SHADER_VERTEX]) {
- const unsigned nr = nv40->constbuf_nr[PIPE_SHADER_VERTEX];
-
- map = pipe_buffer_map(pscreen,
- nv40->constbuf[PIPE_SHADER_VERTEX],
- PIPE_BUFFER_USAGE_CPU_READ);
- draw_set_mapped_constant_buffer(nv40->draw, PIPE_SHADER_VERTEX, 0,
- map, nr);
- }
-
- draw_arrays(nv40->draw, mode, start, count);
-
- for (i = 0; i < nv40->vtxbuf_nr; i++)
- pipe_buffer_unmap(pscreen, nv40->vtxbuf[i].buffer);
-
- if (idxbuf)
- pipe_buffer_unmap(pscreen, idxbuf);
-
- if (nv40->constbuf[PIPE_SHADER_VERTEX])
- pipe_buffer_unmap(pscreen, nv40->constbuf[PIPE_SHADER_VERTEX]);
-
- draw_flush(nv40->draw);
- pipe->flush(pipe, 0, NULL);
-}
-
-static INLINE void
-emit_attrib(struct nv40_context *nv40, unsigned hw, unsigned emit,
- unsigned semantic, unsigned index)
-{
- unsigned draw_out = draw_find_shader_output(nv40->draw, semantic, index);
- unsigned a = nv40->swtnl.nr_attribs++;
-
- nv40->swtnl.hw[a] = hw;
- nv40->swtnl.emit[a] = emit;
- nv40->swtnl.draw[a] = draw_out;
-}
-
-static boolean
-nv40_state_vtxfmt_validate(struct nv40_context *nv40)
-{
- struct nv40_fragment_program *fp = nv40->fragprog;
- unsigned colour = 0, texcoords = 0, fog = 0, i;
-
- /* Determine needed fragprog inputs */
- for (i = 0; i < fp->info.num_inputs; i++) {
- switch (fp->info.input_semantic_name[i]) {
- case TGSI_SEMANTIC_POSITION:
- break;
- case TGSI_SEMANTIC_COLOR:
- colour |= (1 << fp->info.input_semantic_index[i]);
- break;
- case TGSI_SEMANTIC_GENERIC:
- texcoords |= (1 << fp->info.input_semantic_index[i]);
- break;
- case TGSI_SEMANTIC_FOG:
- fog = 1;
- break;
- default:
- assert(0);
- }
- }
-
- nv40->swtnl.nr_attribs = 0;
-
- /* Map draw vtxprog output to hw attribute IDs */
- for (i = 0; i < 2; i++) {
- if (!(colour & (1 << i)))
- continue;
- emit_attrib(nv40, 3 + i, EMIT_4UB, TGSI_SEMANTIC_COLOR, i);
- }
-
- for (i = 0; i < 8; i++) {
- if (!(texcoords & (1 << i)))
- continue;
- emit_attrib(nv40, 8 + i, EMIT_4F, TGSI_SEMANTIC_GENERIC, i);
- }
-
- if (fog) {
- emit_attrib(nv40, 5, EMIT_1F, TGSI_SEMANTIC_FOG, 0);
- }
-
- emit_attrib(nv40, 0, EMIT_3F, TGSI_SEMANTIC_POSITION, 0);
-
- return FALSE;
-}
-
-struct nv40_state_entry nv40_state_vtxfmt = {
- .validate = nv40_state_vtxfmt_validate,
- .dirty = {
- .pipe = NV40_NEW_ARRAYS | NV40_NEW_FRAGPROG,
- .hw = 0
- }
-};
-
diff --git a/src/gallium/drivers/nv40/nv40_query.c b/src/gallium/drivers/nv40/nv40_query.c
deleted file mode 100644
index 8ed4a67dd0..0000000000
--- a/src/gallium/drivers/nv40/nv40_query.c
+++ /dev/null
@@ -1,127 +0,0 @@
-#include "pipe/p_context.h"
-
-#include "nv40_context.h"
-
-struct nv40_query {
- struct nouveau_resource *object;
- unsigned type;
- boolean ready;
- uint64_t result;
-};
-
-static INLINE struct nv40_query *
-nv40_query(struct pipe_query *pipe)
-{
- return (struct nv40_query *)pipe;
-}
-
-static struct pipe_query *
-nv40_query_create(struct pipe_context *pipe, unsigned query_type)
-{
- struct nv40_query *q;
-
- q = CALLOC(1, sizeof(struct nv40_query));
- q->type = query_type;
-
- return (struct pipe_query *)q;
-}
-
-static void
-nv40_query_destroy(struct pipe_context *pipe, struct pipe_query *pq)
-{
- struct nv40_query *q = nv40_query(pq);
-
- if (q->object)
- nouveau_resource_free(&q->object);
- FREE(q);
-}
-
-static void
-nv40_query_begin(struct pipe_context *pipe, struct pipe_query *pq)
-{
- struct nv40_context *nv40 = nv40_context(pipe);
- struct nv40_query *q = nv40_query(pq);
- struct nv40_screen *screen = nv40->screen;
- struct nouveau_channel *chan = screen->base.channel;
- struct nouveau_grobj *curie = screen->curie;
-
- assert(q->type == PIPE_QUERY_OCCLUSION_COUNTER);
-
- /* Happens when end_query() is called, then another begin_query()
- * without querying the result in-between. For now we'll wait for
- * the existing query to notify completion, but it could be better.
- */
- if (q->object) {
- uint64_t tmp;
- pipe->get_query_result(pipe, pq, 1, &tmp);
- }
-
- if (nouveau_resource_alloc(nv40->screen->query_heap, 1, NULL, &q->object))
- assert(0);
- nouveau_notifier_reset(nv40->screen->query, q->object->start);
-
- BEGIN_RING(chan, curie, NV40TCL_QUERY_RESET, 1);
- OUT_RING (chan, 1);
- BEGIN_RING(chan, curie, NV40TCL_QUERY_UNK17CC, 1);
- OUT_RING (chan, 1);
-
- q->ready = FALSE;
-}
-
-static void
-nv40_query_end(struct pipe_context *pipe, struct pipe_query *pq)
-{
- struct nv40_context *nv40 = nv40_context(pipe);
- struct nv40_query *q = nv40_query(pq);
- struct nv40_screen *screen = nv40->screen;
- struct nouveau_channel *chan = screen->base.channel;
- struct nouveau_grobj *curie = screen->curie;
-
- BEGIN_RING(chan, curie, NV40TCL_QUERY_GET, 1);
- OUT_RING (chan, (0x01 << NV40TCL_QUERY_GET_UNK24_SHIFT) |
- ((q->object->start * 32) << NV40TCL_QUERY_GET_OFFSET_SHIFT));
- FIRE_RING(chan);
-}
-
-static boolean
-nv40_query_result(struct pipe_context *pipe, struct pipe_query *pq,
- boolean wait, uint64_t *result)
-{
- struct nv40_context *nv40 = nv40_context(pipe);
- struct nv40_query *q = nv40_query(pq);
-
- assert(q->object && q->type == PIPE_QUERY_OCCLUSION_COUNTER);
-
- if (!q->ready) {
- unsigned status;
-
- status = nouveau_notifier_status(nv40->screen->query,
- q->object->start);
- if (status != NV_NOTIFY_STATE_STATUS_COMPLETED) {
- if (wait == FALSE)
- return FALSE;
- nouveau_notifier_wait_status(nv40->screen->query,
- q->object->start,
- NV_NOTIFY_STATE_STATUS_COMPLETED,
- 0);
- }
-
- q->result = nouveau_notifier_return_val(nv40->screen->query,
- q->object->start);
- q->ready = TRUE;
- nouveau_resource_free(&q->object);
- }
-
- *result = q->result;
- return TRUE;
-}
-
-void
-nv40_init_query_functions(struct nv40_context *nv40)
-{
- nv40->pipe.create_query = nv40_query_create;
- nv40->pipe.destroy_query = nv40_query_destroy;
- nv40->pipe.begin_query = nv40_query_begin;
- nv40->pipe.end_query = nv40_query_end;
- nv40->pipe.get_query_result = nv40_query_result;
-}
diff --git a/src/gallium/drivers/nv40/nv40_screen.c b/src/gallium/drivers/nv40/nv40_screen.c
deleted file mode 100644
index b216c5e38c..0000000000
--- a/src/gallium/drivers/nv40/nv40_screen.c
+++ /dev/null
@@ -1,320 +0,0 @@
-#include "pipe/p_screen.h"
-
-#include "nv40_context.h"
-#include "nv40_screen.h"
-
-#define NV4X_GRCLASS4097_CHIPSETS 0x00000baf
-#define NV4X_GRCLASS4497_CHIPSETS 0x00005450
-#define NV6X_GRCLASS4497_CHIPSETS 0x00000088
-
-static int
-nv40_screen_get_param(struct pipe_screen *pscreen, int param)
-{
- struct nv40_screen *screen = nv40_screen(pscreen);
-
- switch (param) {
- case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
- return 16;
- case PIPE_CAP_NPOT_TEXTURES:
- return 1;
- case PIPE_CAP_TWO_SIDED_STENCIL:
- return 1;
- case PIPE_CAP_GLSL:
- return 0;
- case PIPE_CAP_ANISOTROPIC_FILTER:
- return 1;
- case PIPE_CAP_POINT_SPRITE:
- return 1;
- case PIPE_CAP_MAX_RENDER_TARGETS:
- return 4;
- case PIPE_CAP_OCCLUSION_QUERY:
- return 1;
- case PIPE_CAP_TEXTURE_SHADOW_MAP:
- return 1;
- case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
- return 13;
- case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
- return 10;
- case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
- return 13;
- case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
- case PIPE_CAP_TEXTURE_MIRROR_REPEAT:
- return 1;
- case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS:
- return 0; /* We have 4 - but unsupported currently */
- case PIPE_CAP_TGSI_CONT_SUPPORTED:
- return 0;
- case PIPE_CAP_BLEND_EQUATION_SEPARATE:
- return 1;
- case NOUVEAU_CAP_HW_VTXBUF:
- return 1;
- case NOUVEAU_CAP_HW_IDXBUF:
- if (screen->curie->grclass == NV40TCL)
- return 1;
- return 0;
- case PIPE_CAP_INDEP_BLEND_ENABLE:
- return 0;
- case PIPE_CAP_INDEP_BLEND_FUNC:
- return 0;
- case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
- case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
- return 1;
- case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
- case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
- return 0;
- case PIPE_CAP_MAX_COMBINED_SAMPLERS:
- return 16;
- default:
- NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
- return 0;
- }
-}
-
-static float
-nv40_screen_get_paramf(struct pipe_screen *pscreen, int param)
-{
- switch (param) {
- case PIPE_CAP_MAX_LINE_WIDTH:
- case PIPE_CAP_MAX_LINE_WIDTH_AA:
- return 10.0;
- case PIPE_CAP_MAX_POINT_WIDTH:
- case PIPE_CAP_MAX_POINT_WIDTH_AA:
- return 64.0;
- case PIPE_CAP_MAX_TEXTURE_ANISOTROPY:
- return 16.0;
- case PIPE_CAP_MAX_TEXTURE_LOD_BIAS:
- return 16.0;
- default:
- NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
- return 0.0;
- }
-}
-
-static boolean
-nv40_screen_surface_format_supported(struct pipe_screen *pscreen,
- enum pipe_format format,
- enum pipe_texture_target target,
- unsigned tex_usage, unsigned geom_flags)
-{
- if (tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET) {
- switch (format) {
- case PIPE_FORMAT_B8G8R8A8_UNORM:
- case PIPE_FORMAT_B5G6R5_UNORM:
- return TRUE;
- default:
- break;
- }
- } else
- if (tex_usage & PIPE_TEXTURE_USAGE_DEPTH_STENCIL) {
- switch (format) {
- case PIPE_FORMAT_S8Z24_UNORM:
- case PIPE_FORMAT_X8Z24_UNORM:
- case PIPE_FORMAT_Z16_UNORM:
- return TRUE;
- default:
- break;
- }
- } else {
- switch (format) {
- case PIPE_FORMAT_B8G8R8A8_UNORM:
- case PIPE_FORMAT_B5G5R5A1_UNORM:
- case PIPE_FORMAT_B4G4R4A4_UNORM:
- case PIPE_FORMAT_B5G6R5_UNORM:
- case PIPE_FORMAT_R16_SNORM:
- case PIPE_FORMAT_L8_UNORM:
- case PIPE_FORMAT_A8_UNORM:
- case PIPE_FORMAT_I8_UNORM:
- case PIPE_FORMAT_L8A8_UNORM:
- case PIPE_FORMAT_Z16_UNORM:
- case PIPE_FORMAT_S8Z24_UNORM:
- case PIPE_FORMAT_DXT1_RGB:
- case PIPE_FORMAT_DXT1_RGBA:
- case PIPE_FORMAT_DXT3_RGBA:
- case PIPE_FORMAT_DXT5_RGBA:
- return TRUE;
- default:
- break;
- }
- }
-
- return FALSE;
-}
-
-static struct pipe_buffer *
-nv40_surface_buffer(struct pipe_surface *surf)
-{
- struct nv40_miptree *mt = (struct nv40_miptree *)surf->texture;
-
- return mt->buffer;
-}
-
-static void
-nv40_screen_destroy(struct pipe_screen *pscreen)
-{
- struct nv40_screen *screen = nv40_screen(pscreen);
- unsigned i;
-
- for (i = 0; i < NV40_STATE_MAX; i++) {
- if (screen->state[i])
- so_ref(NULL, &screen->state[i]);
- }
-
- nouveau_resource_destroy(&screen->vp_exec_heap);
- nouveau_resource_destroy(&screen->vp_data_heap);
- nouveau_resource_destroy(&screen->query_heap);
- nouveau_notifier_free(&screen->query);
- nouveau_notifier_free(&screen->sync);
- nouveau_grobj_free(&screen->curie);
- nv04_surface_2d_takedown(&screen->eng2d);
-
- nouveau_screen_fini(&screen->base);
-
- FREE(pscreen);
-}
-
-struct pipe_screen *
-nv40_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
-{
- struct nv40_screen *screen = CALLOC_STRUCT(nv40_screen);
- struct nouveau_channel *chan;
- struct pipe_screen *pscreen;
- struct nouveau_stateobj *so;
- unsigned curie_class = 0;
- int ret;
-
- if (!screen)
- return NULL;
- pscreen = &screen->base.base;
-
- ret = nouveau_screen_init(&screen->base, dev);
- if (ret) {
- nv40_screen_destroy(pscreen);
- return NULL;
- }
- chan = screen->base.channel;
-
- pscreen->winsys = ws;
- pscreen->destroy = nv40_screen_destroy;
- pscreen->get_param = nv40_screen_get_param;
- pscreen->get_paramf = nv40_screen_get_paramf;
- pscreen->is_format_supported = nv40_screen_surface_format_supported;
- pscreen->context_create = nv40_create;
-
- nv40_screen_init_miptree_functions(pscreen);
- nv40_screen_init_transfer_functions(pscreen);
-
- /* 3D object */
- switch (dev->chipset & 0xf0) {
- case 0x40:
- if (NV4X_GRCLASS4097_CHIPSETS & (1 << (dev->chipset & 0x0f)))
- curie_class = NV40TCL;
- else
- if (NV4X_GRCLASS4497_CHIPSETS & (1 << (dev->chipset & 0x0f)))
- curie_class = NV44TCL;
- break;
- case 0x60:
- if (NV6X_GRCLASS4497_CHIPSETS & (1 << (dev->chipset & 0x0f)))
- curie_class = NV44TCL;
- break;
- }
-
- if (!curie_class) {
- NOUVEAU_ERR("Unknown nv4x chipset: nv%02x\n", dev->chipset);
- return NULL;
- }
-
- ret = nouveau_grobj_alloc(chan, 0xbeef3097, curie_class, &screen->curie);
- if (ret) {
- NOUVEAU_ERR("Error creating 3D object: %d\n", ret);
- return FALSE;
- }
-
- /* 2D engine setup */
- screen->eng2d = nv04_surface_2d_init(&screen->base);
- screen->eng2d->buf = nv40_surface_buffer;
-
- /* Notifier for sync purposes */
- ret = nouveau_notifier_alloc(chan, 0xbeef0301, 1, &screen->sync);
- if (ret) {
- NOUVEAU_ERR("Error creating notifier object: %d\n", ret);
- nv40_screen_destroy(pscreen);
- return NULL;
- }
-
- /* Query objects */
- ret = nouveau_notifier_alloc(chan, 0xbeef0302, 32, &screen->query);
- if (ret) {
- NOUVEAU_ERR("Error initialising query objects: %d\n", ret);
- nv40_screen_destroy(pscreen);
- return NULL;
- }
-
- nouveau_resource_init(&screen->query_heap, 0, 32);
- if (ret) {
- NOUVEAU_ERR("Error initialising query object heap: %d\n", ret);
- nv40_screen_destroy(pscreen);
- return NULL;
- }
-
- /* Vtxprog resources */
- if (nouveau_resource_init(&screen->vp_exec_heap, 0, 512) ||
- nouveau_resource_init(&screen->vp_data_heap, 0, 256)) {
- nv40_screen_destroy(pscreen);
- return NULL;
- }
-
- /* Static curie initialisation */
- so = so_new(16, 25, 0);
- so_method(so, screen->curie, NV40TCL_DMA_NOTIFY, 1);
- so_data (so, screen->sync->handle);
- so_method(so, screen->curie, NV40TCL_DMA_TEXTURE0, 2);
- so_data (so, chan->vram->handle);
- so_data (so, chan->gart->handle);
- so_method(so, screen->curie, NV40TCL_DMA_COLOR1, 1);
- so_data (so, chan->vram->handle);
- so_method(so, screen->curie, NV40TCL_DMA_COLOR0, 2);
- so_data (so, chan->vram->handle);
- so_data (so, chan->vram->handle);
- so_method(so, screen->curie, NV40TCL_DMA_VTXBUF0, 2);
- so_data (so, chan->vram->handle);
- so_data (so, chan->gart->handle);
- so_method(so, screen->curie, NV40TCL_DMA_FENCE, 2);
- so_data (so, 0);
- so_data (so, screen->query->handle);
- so_method(so, screen->curie, NV40TCL_DMA_UNK01AC, 2);
- so_data (so, chan->vram->handle);
- so_data (so, chan->vram->handle);
- so_method(so, screen->curie, NV40TCL_DMA_COLOR2, 2);
- so_data (so, chan->vram->handle);
- so_data (so, chan->vram->handle);
-
- so_method(so, screen->curie, 0x1ea4, 3);
- so_data (so, 0x00000010);
- so_data (so, 0x01000100);
- so_data (so, 0xff800006);
-
- /* vtxprog output routing */
- so_method(so, screen->curie, 0x1fc4, 1);
- so_data (so, 0x06144321);
- so_method(so, screen->curie, 0x1fc8, 2);
- so_data (so, 0xedcba987);
- so_data (so, 0x00000021);
- so_method(so, screen->curie, 0x1fd0, 1);
- so_data (so, 0x00171615);
- so_method(so, screen->curie, 0x1fd4, 1);
- so_data (so, 0x001b1a19);
-
- so_method(so, screen->curie, 0x1ef8, 1);
- so_data (so, 0x0020ffff);
- so_method(so, screen->curie, 0x1d64, 1);
- so_data (so, 0x00d30000);
- so_method(so, screen->curie, 0x1e94, 1);
- so_data (so, 0x00000001);
-
- so_emit(chan, so);
- so_ref(NULL, &so);
- nouveau_pushbuf_flush(chan, 0);
-
- return pscreen;
-}
-
diff --git a/src/gallium/drivers/nv40/nv40_shader.h b/src/gallium/drivers/nv40/nv40_shader.h
deleted file mode 100644
index 854dccf548..0000000000
--- a/src/gallium/drivers/nv40/nv40_shader.h
+++ /dev/null
@@ -1,556 +0,0 @@
-#ifndef __NV40_SHADER_H__
-#define __NV40_SHADER_H__
-
-/* Vertex programs instruction set
- *
- * The NV40 instruction set is very similar to NV30. Most fields are in
- * a slightly different position in the instruction however.
- *
- * Merged instructions
- * In some cases it is possible to put two instructions into one opcode
- * slot. The rules for when this is OK is not entirely clear to me yet.
- *
- * There are separate writemasks and dest temp register fields for each
- * grouping of instructions. There is however only one field with the
- * ID of a result register. Writing to temp/result regs is selected by
- * setting VEC_RESULT/SCA_RESULT.
- *
- * Temporary registers
- * The source/dest temp register fields have been extended by 1 bit, to
- * give a total of 32 temporary registers.
- *
- * Relative Addressing
- * NV40 can use an address register to index into vertex attribute regs.
- * This is done by putting the offset value into INPUT_SRC and setting
- * the INDEX_INPUT flag.
- *
- * Conditional execution (see NV_vertex_program{2,3} for details)
- * There is a second condition code register on NV40, it's use is enabled
- * by setting the COND_REG_SELECT_1 flag.
- *
- * Texture lookup
- * TODO
- */
-
-/* ---- OPCODE BITS 127:96 / data DWORD 0 --- */
-#define NV40_VP_INST_VEC_RESULT (1 << 30)
-/* uncertain.. */
-#define NV40_VP_INST_COND_UPDATE_ENABLE ((1 << 14)|1<<29)
-/* use address reg as index into attribs */
-#define NV40_VP_INST_INDEX_INPUT (1 << 27)
-#define NV40_VP_INST_COND_REG_SELECT_1 (1 << 25)
-#define NV40_VP_INST_ADDR_REG_SELECT_1 (1 << 24)
-#define NV40_VP_INST_SRC2_ABS (1 << 23)
-#define NV40_VP_INST_SRC1_ABS (1 << 22)
-#define NV40_VP_INST_SRC0_ABS (1 << 21)
-#define NV40_VP_INST_VEC_DEST_TEMP_SHIFT 15
-#define NV40_VP_INST_VEC_DEST_TEMP_MASK (0x1F << 15)
-#define NV40_VP_INST_COND_TEST_ENABLE (1 << 13)
-#define NV40_VP_INST_COND_SHIFT 10
-#define NV40_VP_INST_COND_MASK (0x7 << 10)
-# define NV40_VP_INST_COND_FL 0
-# define NV40_VP_INST_COND_LT 1
-# define NV40_VP_INST_COND_EQ 2
-# define NV40_VP_INST_COND_LE 3
-# define NV40_VP_INST_COND_GT 4
-# define NV40_VP_INST_COND_NE 5
-# define NV40_VP_INST_COND_GE 6
-# define NV40_VP_INST_COND_TR 7
-#define NV40_VP_INST_COND_SWZ_X_SHIFT 8
-#define NV40_VP_INST_COND_SWZ_X_MASK (3 << 8)
-#define NV40_VP_INST_COND_SWZ_Y_SHIFT 6
-#define NV40_VP_INST_COND_SWZ_Y_MASK (3 << 6)
-#define NV40_VP_INST_COND_SWZ_Z_SHIFT 4
-#define NV40_VP_INST_COND_SWZ_Z_MASK (3 << 4)
-#define NV40_VP_INST_COND_SWZ_W_SHIFT 2
-#define NV40_VP_INST_COND_SWZ_W_MASK (3 << 2)
-#define NV40_VP_INST_COND_SWZ_ALL_SHIFT 2
-#define NV40_VP_INST_COND_SWZ_ALL_MASK (0xFF << 2)
-#define NV40_VP_INST_ADDR_SWZ_SHIFT 0
-#define NV40_VP_INST_ADDR_SWZ_MASK (0x03 << 0)
-#define NV40_VP_INST0_KNOWN ( \
- NV40_VP_INST_INDEX_INPUT | \
- NV40_VP_INST_COND_REG_SELECT_1 | \
- NV40_VP_INST_ADDR_REG_SELECT_1 | \
- NV40_VP_INST_SRC2_ABS | \
- NV40_VP_INST_SRC1_ABS | \
- NV40_VP_INST_SRC0_ABS | \
- NV40_VP_INST_VEC_DEST_TEMP_MASK | \
- NV40_VP_INST_COND_TEST_ENABLE | \
- NV40_VP_INST_COND_MASK | \
- NV40_VP_INST_COND_SWZ_ALL_MASK | \
- NV40_VP_INST_ADDR_SWZ_MASK)
-
-/* ---- OPCODE BITS 95:64 / data DWORD 1 --- */
-#define NV40_VP_INST_VEC_OPCODE_SHIFT 22
-#define NV40_VP_INST_VEC_OPCODE_MASK (0x1F << 22)
-# define NV40_VP_INST_OP_NOP 0x00
-# define NV40_VP_INST_OP_MOV 0x01
-# define NV40_VP_INST_OP_MUL 0x02
-# define NV40_VP_INST_OP_ADD 0x03
-# define NV40_VP_INST_OP_MAD 0x04
-# define NV40_VP_INST_OP_DP3 0x05
-# define NV40_VP_INST_OP_DPH 0x06
-# define NV40_VP_INST_OP_DP4 0x07
-# define NV40_VP_INST_OP_DST 0x08
-# define NV40_VP_INST_OP_MIN 0x09
-# define NV40_VP_INST_OP_MAX 0x0A
-# define NV40_VP_INST_OP_SLT 0x0B
-# define NV40_VP_INST_OP_SGE 0x0C
-# define NV40_VP_INST_OP_ARL 0x0D
-# define NV40_VP_INST_OP_FRC 0x0E
-# define NV40_VP_INST_OP_FLR 0x0F
-# define NV40_VP_INST_OP_SEQ 0x10
-# define NV40_VP_INST_OP_SFL 0x11
-# define NV40_VP_INST_OP_SGT 0x12
-# define NV40_VP_INST_OP_SLE 0x13
-# define NV40_VP_INST_OP_SNE 0x14
-# define NV40_VP_INST_OP_STR 0x15
-# define NV40_VP_INST_OP_SSG 0x16
-# define NV40_VP_INST_OP_ARR 0x17
-# define NV40_VP_INST_OP_ARA 0x18
-# define NV40_VP_INST_OP_TXL 0x19
-#define NV40_VP_INST_SCA_OPCODE_SHIFT 27
-#define NV40_VP_INST_SCA_OPCODE_MASK (0x1F << 27)
-# define NV40_VP_INST_OP_NOP 0x00
-# define NV40_VP_INST_OP_MOV 0x01
-# define NV40_VP_INST_OP_RCP 0x02
-# define NV40_VP_INST_OP_RCC 0x03
-# define NV40_VP_INST_OP_RSQ 0x04
-# define NV40_VP_INST_OP_EXP 0x05
-# define NV40_VP_INST_OP_LOG 0x06
-# define NV40_VP_INST_OP_LIT 0x07
-# define NV40_VP_INST_OP_BRA 0x09
-# define NV40_VP_INST_OP_CAL 0x0B
-# define NV40_VP_INST_OP_RET 0x0C
-# define NV40_VP_INST_OP_LG2 0x0D
-# define NV40_VP_INST_OP_EX2 0x0E
-# define NV40_VP_INST_OP_SIN 0x0F
-# define NV40_VP_INST_OP_COS 0x10
-# define NV40_VP_INST_OP_PUSHA 0x13
-# define NV40_VP_INST_OP_POPA 0x14
-#define NV40_VP_INST_CONST_SRC_SHIFT 12
-#define NV40_VP_INST_CONST_SRC_MASK (0xFF << 12)
-#define NV40_VP_INST_INPUT_SRC_SHIFT 8
-#define NV40_VP_INST_INPUT_SRC_MASK (0x0F << 8)
-# define NV40_VP_INST_IN_POS 0
-# define NV40_VP_INST_IN_WEIGHT 1
-# define NV40_VP_INST_IN_NORMAL 2
-# define NV40_VP_INST_IN_COL0 3
-# define NV40_VP_INST_IN_COL1 4
-# define NV40_VP_INST_IN_FOGC 5
-# define NV40_VP_INST_IN_TC0 8
-# define NV40_VP_INST_IN_TC(n) (8+n)
-#define NV40_VP_INST_SRC0H_SHIFT 0
-#define NV40_VP_INST_SRC0H_MASK (0xFF << 0)
-#define NV40_VP_INST1_KNOWN ( \
- NV40_VP_INST_VEC_OPCODE_MASK | \
- NV40_VP_INST_SCA_OPCODE_MASK | \
- NV40_VP_INST_CONST_SRC_MASK | \
- NV40_VP_INST_INPUT_SRC_MASK | \
- NV40_VP_INST_SRC0H_MASK \
- )
-
-/* ---- OPCODE BITS 63:32 / data DWORD 2 --- */
-#define NV40_VP_INST_SRC0L_SHIFT 23
-#define NV40_VP_INST_SRC0L_MASK (0x1FF << 23)
-#define NV40_VP_INST_SRC1_SHIFT 6
-#define NV40_VP_INST_SRC1_MASK (0x1FFFF << 6)
-#define NV40_VP_INST_SRC2H_SHIFT 0
-#define NV40_VP_INST_SRC2H_MASK (0x3F << 0)
-#define NV40_VP_INST_IADDRH_SHIFT 0
-#define NV40_VP_INST_IADDRH_MASK (0x1F << 0)
-
-/* ---- OPCODE BITS 31:0 / data DWORD 3 --- */
-#define NV40_VP_INST_IADDRL_SHIFT 29
-#define NV40_VP_INST_IADDRL_MASK (7 << 29)
-#define NV40_VP_INST_SRC2L_SHIFT 21
-#define NV40_VP_INST_SRC2L_MASK (0x7FF << 21)
-#define NV40_VP_INST_SCA_WRITEMASK_SHIFT 17
-#define NV40_VP_INST_SCA_WRITEMASK_MASK (0xF << 17)
-# define NV40_VP_INST_SCA_WRITEMASK_X (1 << 20)
-# define NV40_VP_INST_SCA_WRITEMASK_Y (1 << 19)
-# define NV40_VP_INST_SCA_WRITEMASK_Z (1 << 18)
-# define NV40_VP_INST_SCA_WRITEMASK_W (1 << 17)
-#define NV40_VP_INST_VEC_WRITEMASK_SHIFT 13
-#define NV40_VP_INST_VEC_WRITEMASK_MASK (0xF << 13)
-# define NV40_VP_INST_VEC_WRITEMASK_X (1 << 16)
-# define NV40_VP_INST_VEC_WRITEMASK_Y (1 << 15)
-# define NV40_VP_INST_VEC_WRITEMASK_Z (1 << 14)
-# define NV40_VP_INST_VEC_WRITEMASK_W (1 << 13)
-#define NV40_VP_INST_SCA_RESULT (1 << 12)
-#define NV40_VP_INST_SCA_DEST_TEMP_SHIFT 7
-#define NV40_VP_INST_SCA_DEST_TEMP_MASK (0x1F << 7)
-#define NV40_VP_INST_DEST_SHIFT 2
-#define NV40_VP_INST_DEST_MASK (31 << 2)
-# define NV40_VP_INST_DEST_POS 0
-# define NV40_VP_INST_DEST_COL0 1
-# define NV40_VP_INST_DEST_COL1 2
-# define NV40_VP_INST_DEST_BFC0 3
-# define NV40_VP_INST_DEST_BFC1 4
-# define NV40_VP_INST_DEST_FOGC 5
-# define NV40_VP_INST_DEST_PSZ 6
-# define NV40_VP_INST_DEST_TC0 7
-# define NV40_VP_INST_DEST_TC(n) (7+n)
-# define NV40_VP_INST_DEST_TEMP 0x1F
-#define NV40_VP_INST_INDEX_CONST (1 << 1)
-#define NV40_VP_INST_LAST (1 << 0)
-#define NV40_VP_INST3_KNOWN ( \
- NV40_VP_INST_SRC2L_MASK |\
- NV40_VP_INST_SCA_WRITEMASK_MASK |\
- NV40_VP_INST_VEC_WRITEMASK_MASK |\
- NV40_VP_INST_SCA_DEST_TEMP_MASK |\
- NV40_VP_INST_DEST_MASK |\
- NV40_VP_INST_INDEX_CONST)
-
-/* Useful to split the source selection regs into their pieces */
-#define NV40_VP_SRC0_HIGH_SHIFT 9
-#define NV40_VP_SRC0_HIGH_MASK 0x0001FE00
-#define NV40_VP_SRC0_LOW_MASK 0x000001FF
-#define NV40_VP_SRC2_HIGH_SHIFT 11
-#define NV40_VP_SRC2_HIGH_MASK 0x0001F800
-#define NV40_VP_SRC2_LOW_MASK 0x000007FF
-
-/* Source selection - these are the bits you fill NV40_VP_INST_SRCn with */
-#define NV40_VP_SRC_NEGATE (1 << 16)
-#define NV40_VP_SRC_SWZ_X_SHIFT 14
-#define NV40_VP_SRC_SWZ_X_MASK (3 << 14)
-#define NV40_VP_SRC_SWZ_Y_SHIFT 12
-#define NV40_VP_SRC_SWZ_Y_MASK (3 << 12)
-#define NV40_VP_SRC_SWZ_Z_SHIFT 10
-#define NV40_VP_SRC_SWZ_Z_MASK (3 << 10)
-#define NV40_VP_SRC_SWZ_W_SHIFT 8
-#define NV40_VP_SRC_SWZ_W_MASK (3 << 8)
-#define NV40_VP_SRC_SWZ_ALL_SHIFT 8
-#define NV40_VP_SRC_SWZ_ALL_MASK (0xFF << 8)
-#define NV40_VP_SRC_TEMP_SRC_SHIFT 2
-#define NV40_VP_SRC_TEMP_SRC_MASK (0x1F << 2)
-#define NV40_VP_SRC_REG_TYPE_SHIFT 0
-#define NV40_VP_SRC_REG_TYPE_MASK (3 << 0)
-# define NV40_VP_SRC_REG_TYPE_UNK0 0
-# define NV40_VP_SRC_REG_TYPE_TEMP 1
-# define NV40_VP_SRC_REG_TYPE_INPUT 2
-# define NV40_VP_SRC_REG_TYPE_CONST 3
-
-
-/*
- * Each fragment program opcode appears to be comprised of 4 32-bit values.
- *
- * 0 - Opcode, output reg/mask, ATTRIB source
- * 1 - Source 0
- * 2 - Source 1
- * 3 - Source 2
- *
- * There appears to be no special difference between result regs and temp regs.
- * result.color == R0.xyzw
- * result.depth == R1.z
- * When the fragprog contains instructions to write depth,
- * NV30_TCL_PRIMITIVE_3D_UNK1D78=0 otherwise it is set to 1.
- *
- * Constants are inserted directly after the instruction that uses them.
- *
- * It appears that it's not possible to use two input registers in one
- * instruction as the input sourcing is done in the instruction dword
- * and not the source selection dwords. As such instructions such as:
- *
- * ADD result.color, fragment.color, fragment.texcoord[0];
- *
- * must be split into two MOV's and then an ADD (nvidia does this) but
- * I'm not sure why it's not just one MOV and then source the second input
- * in the ADD instruction..
- *
- * Negation of the full source is done with NV30_FP_REG_NEGATE, arbitrary
- * negation requires multiplication with a const.
- *
- * Arbitrary swizzling is supported with the exception of SWIZZLE_ZERO and
- * SWIZZLE_ONE.
- *
- * The temp/result regs appear to be initialised to (0.0, 0.0, 0.0, 0.0) as
- * SWIZZLE_ZERO is implemented simply by not writing to the relevant components
- * of the destination.
- *
- * Looping
- * Loops appear to be fairly expensive on NV40 at least, the proprietary
- * driver goes to a lot of effort to avoid using the native looping
- * instructions. If the total number of *executed* instructions between
- * REP/ENDREP or LOOP/ENDLOOP is <=500, the driver will unroll the loop.
- * The maximum loop count is 255.
- *
- * Conditional execution
- * TODO
- *
- * Non-native instructions:
- * LIT
- * LRP - MAD+MAD
- * SUB - ADD, negate second source
- * RSQ - LG2 + EX2
- * POW - LG2 + MUL + EX2
- * SCS - COS + SIN
- * XPD
- * DP2 - MUL + ADD
- * NRM
- */
-
-//== Opcode / Destination selection ==
-#define NV40_FP_OP_PROGRAM_END (1 << 0)
-#define NV40_FP_OP_OUT_REG_SHIFT 1
-#define NV40_FP_OP_OUT_REG_MASK (63 << 1)
-/* Needs to be set when writing outputs to get expected result.. */
-#define NV40_FP_OP_OUT_REG_HALF (1 << 7)
-#define NV40_FP_OP_COND_WRITE_ENABLE (1 << 8)
-#define NV40_FP_OP_OUTMASK_SHIFT 9
-#define NV40_FP_OP_OUTMASK_MASK (0xF << 9)
-# define NV40_FP_OP_OUT_X (1 << 9)
-# define NV40_FP_OP_OUT_Y (1 <<10)
-# define NV40_FP_OP_OUT_Z (1 <<11)
-# define NV40_FP_OP_OUT_W (1 <<12)
-/* Uncertain about these, especially the input_src values.. it's possible that
- * they can be dynamically changed.
- */
-#define NV40_FP_OP_INPUT_SRC_SHIFT 13
-#define NV40_FP_OP_INPUT_SRC_MASK (15 << 13)
-# define NV40_FP_OP_INPUT_SRC_POSITION 0x0
-# define NV40_FP_OP_INPUT_SRC_COL0 0x1
-# define NV40_FP_OP_INPUT_SRC_COL1 0x2
-# define NV40_FP_OP_INPUT_SRC_FOGC 0x3
-# define NV40_FP_OP_INPUT_SRC_TC0 0x4
-# define NV40_FP_OP_INPUT_SRC_TC(n) (0x4 + n)
-# define NV40_FP_OP_INPUT_SRC_FACING 0xE
-#define NV40_FP_OP_TEX_UNIT_SHIFT 17
-#define NV40_FP_OP_TEX_UNIT_MASK (0xF << 17)
-#define NV40_FP_OP_PRECISION_SHIFT 22
-#define NV40_FP_OP_PRECISION_MASK (3 << 22)
-# define NV40_FP_PRECISION_FP32 0
-# define NV40_FP_PRECISION_FP16 1
-# define NV40_FP_PRECISION_FX12 2
-#define NV40_FP_OP_OPCODE_SHIFT 24
-#define NV40_FP_OP_OPCODE_MASK (0x3F << 24)
-# define NV40_FP_OP_OPCODE_NOP 0x00
-# define NV40_FP_OP_OPCODE_MOV 0x01
-# define NV40_FP_OP_OPCODE_MUL 0x02
-# define NV40_FP_OP_OPCODE_ADD 0x03
-# define NV40_FP_OP_OPCODE_MAD 0x04
-# define NV40_FP_OP_OPCODE_DP3 0x05
-# define NV40_FP_OP_OPCODE_DP4 0x06
-# define NV40_FP_OP_OPCODE_DST 0x07
-# define NV40_FP_OP_OPCODE_MIN 0x08
-# define NV40_FP_OP_OPCODE_MAX 0x09
-# define NV40_FP_OP_OPCODE_SLT 0x0A
-# define NV40_FP_OP_OPCODE_SGE 0x0B
-# define NV40_FP_OP_OPCODE_SLE 0x0C
-# define NV40_FP_OP_OPCODE_SGT 0x0D
-# define NV40_FP_OP_OPCODE_SNE 0x0E
-# define NV40_FP_OP_OPCODE_SEQ 0x0F
-# define NV40_FP_OP_OPCODE_FRC 0x10
-# define NV40_FP_OP_OPCODE_FLR 0x11
-# define NV40_FP_OP_OPCODE_KIL 0x12
-# define NV40_FP_OP_OPCODE_PK4B 0x13
-# define NV40_FP_OP_OPCODE_UP4B 0x14
-/* DDX/DDY can only write to XY */
-# define NV40_FP_OP_OPCODE_DDX 0x15
-# define NV40_FP_OP_OPCODE_DDY 0x16
-# define NV40_FP_OP_OPCODE_TEX 0x17
-# define NV40_FP_OP_OPCODE_TXP 0x18
-# define NV40_FP_OP_OPCODE_TXD 0x19
-# define NV40_FP_OP_OPCODE_RCP 0x1A
-# define NV40_FP_OP_OPCODE_EX2 0x1C
-# define NV40_FP_OP_OPCODE_LG2 0x1D
-# define NV40_FP_OP_OPCODE_STR 0x20
-# define NV40_FP_OP_OPCODE_SFL 0x21
-# define NV40_FP_OP_OPCODE_COS 0x22
-# define NV40_FP_OP_OPCODE_SIN 0x23
-# define NV40_FP_OP_OPCODE_PK2H 0x24
-# define NV40_FP_OP_OPCODE_UP2H 0x25
-# define NV40_FP_OP_OPCODE_PK4UB 0x27
-# define NV40_FP_OP_OPCODE_UP4UB 0x28
-# define NV40_FP_OP_OPCODE_PK2US 0x29
-# define NV40_FP_OP_OPCODE_UP2US 0x2A
-# define NV40_FP_OP_OPCODE_DP2A 0x2E
-# define NV40_FP_OP_OPCODE_TXL 0x2F
-# define NV40_FP_OP_OPCODE_TXB 0x31
-# define NV40_FP_OP_OPCODE_DIV 0x3A
-# define NV40_FP_OP_OPCODE_UNK_LIT 0x3C
-/* The use of these instructions appears to be indicated by bit 31 of DWORD 2.*/
-# define NV40_FP_OP_BRA_OPCODE_BRK 0x0
-# define NV40_FP_OP_BRA_OPCODE_CAL 0x1
-# define NV40_FP_OP_BRA_OPCODE_IF 0x2
-# define NV40_FP_OP_BRA_OPCODE_LOOP 0x3
-# define NV40_FP_OP_BRA_OPCODE_REP 0x4
-# define NV40_FP_OP_BRA_OPCODE_RET 0x5
-#define NV40_FP_OP_OUT_SAT (1 << 31)
-
-/* high order bits of SRC0 */
-#define NV40_FP_OP_OUT_ABS (1 << 29)
-#define NV40_FP_OP_COND_SWZ_W_SHIFT 27
-#define NV40_FP_OP_COND_SWZ_W_MASK (3 << 27)
-#define NV40_FP_OP_COND_SWZ_Z_SHIFT 25
-#define NV40_FP_OP_COND_SWZ_Z_MASK (3 << 25)
-#define NV40_FP_OP_COND_SWZ_Y_SHIFT 23
-#define NV40_FP_OP_COND_SWZ_Y_MASK (3 << 23)
-#define NV40_FP_OP_COND_SWZ_X_SHIFT 21
-#define NV40_FP_OP_COND_SWZ_X_MASK (3 << 21)
-#define NV40_FP_OP_COND_SWZ_ALL_SHIFT 21
-#define NV40_FP_OP_COND_SWZ_ALL_MASK (0xFF << 21)
-#define NV40_FP_OP_COND_SHIFT 18
-#define NV40_FP_OP_COND_MASK (0x07 << 18)
-# define NV40_FP_OP_COND_FL 0
-# define NV40_FP_OP_COND_LT 1
-# define NV40_FP_OP_COND_EQ 2
-# define NV40_FP_OP_COND_LE 3
-# define NV40_FP_OP_COND_GT 4
-# define NV40_FP_OP_COND_NE 5
-# define NV40_FP_OP_COND_GE 6
-# define NV40_FP_OP_COND_TR 7
-
-/* high order bits of SRC1 */
-#define NV40_FP_OP_OPCODE_IS_BRANCH (1<<31)
-#define NV40_FP_OP_DST_SCALE_SHIFT 28
-#define NV40_FP_OP_DST_SCALE_MASK (3 << 28)
-#define NV40_FP_OP_DST_SCALE_1X 0
-#define NV40_FP_OP_DST_SCALE_2X 1
-#define NV40_FP_OP_DST_SCALE_4X 2
-#define NV40_FP_OP_DST_SCALE_8X 3
-#define NV40_FP_OP_DST_SCALE_INV_2X 5
-#define NV40_FP_OP_DST_SCALE_INV_4X 6
-#define NV40_FP_OP_DST_SCALE_INV_8X 7
-
-/* SRC1 LOOP */
-#define NV40_FP_OP_LOOP_INCR_SHIFT 19
-#define NV40_FP_OP_LOOP_INCR_MASK (0xFF << 19)
-#define NV40_FP_OP_LOOP_INDEX_SHIFT 10
-#define NV40_FP_OP_LOOP_INDEX_MASK (0xFF << 10)
-#define NV40_FP_OP_LOOP_COUNT_SHIFT 2
-#define NV40_FP_OP_LOOP_COUNT_MASK (0xFF << 2)
-
-/* SRC1 IF */
-#define NV40_FP_OP_ELSE_ID_SHIFT 2
-#define NV40_FP_OP_ELSE_ID_MASK (0xFF << 2)
-
-/* SRC1 CAL */
-#define NV40_FP_OP_IADDR_SHIFT 2
-#define NV40_FP_OP_IADDR_MASK (0xFF << 2)
-
-/* SRC1 REP
- * I have no idea why there are 3 count values here.. but they
- * have always been filled with the same value in my tests so
- * far..
- */
-#define NV40_FP_OP_REP_COUNT1_SHIFT 2
-#define NV40_FP_OP_REP_COUNT1_MASK (0xFF << 2)
-#define NV40_FP_OP_REP_COUNT2_SHIFT 10
-#define NV40_FP_OP_REP_COUNT2_MASK (0xFF << 10)
-#define NV40_FP_OP_REP_COUNT3_SHIFT 19
-#define NV40_FP_OP_REP_COUNT3_MASK (0xFF << 19)
-
-/* SRC2 REP/IF */
-#define NV40_FP_OP_END_ID_SHIFT 2
-#define NV40_FP_OP_END_ID_MASK (0xFF << 2)
-
-// SRC2 high-order
-#define NV40_FP_OP_INDEX_INPUT (1 << 30)
-#define NV40_FP_OP_ADDR_INDEX_SHIFT 19
-#define NV40_FP_OP_ADDR_INDEX_MASK (0xF << 19)
-
-//== Register selection ==
-#define NV40_FP_REG_TYPE_SHIFT 0
-#define NV40_FP_REG_TYPE_MASK (3 << 0)
-# define NV40_FP_REG_TYPE_TEMP 0
-# define NV40_FP_REG_TYPE_INPUT 1
-# define NV40_FP_REG_TYPE_CONST 2
-#define NV40_FP_REG_SRC_SHIFT 2
-#define NV40_FP_REG_SRC_MASK (63 << 2)
-#define NV40_FP_REG_SRC_HALF (1 << 8)
-#define NV40_FP_REG_SWZ_ALL_SHIFT 9
-#define NV40_FP_REG_SWZ_ALL_MASK (255 << 9)
-#define NV40_FP_REG_SWZ_X_SHIFT 9
-#define NV40_FP_REG_SWZ_X_MASK (3 << 9)
-#define NV40_FP_REG_SWZ_Y_SHIFT 11
-#define NV40_FP_REG_SWZ_Y_MASK (3 << 11)
-#define NV40_FP_REG_SWZ_Z_SHIFT 13
-#define NV40_FP_REG_SWZ_Z_MASK (3 << 13)
-#define NV40_FP_REG_SWZ_W_SHIFT 15
-#define NV40_FP_REG_SWZ_W_MASK (3 << 15)
-# define NV40_FP_SWIZZLE_X 0
-# define NV40_FP_SWIZZLE_Y 1
-# define NV40_FP_SWIZZLE_Z 2
-# define NV40_FP_SWIZZLE_W 3
-#define NV40_FP_REG_NEGATE (1 << 17)
-
-#ifndef NV40_SHADER_NO_FUCKEDNESS
-#define NV40SR_NONE 0
-#define NV40SR_OUTPUT 1
-#define NV40SR_INPUT 2
-#define NV40SR_TEMP 3
-#define NV40SR_CONST 4
-
-struct nv40_sreg {
- int type;
- int index;
-
- int dst_scale;
-
- int negate;
- int abs;
- int swz[4];
-
- int cc_update;
- int cc_update_reg;
- int cc_test;
- int cc_test_reg;
- int cc_swz[4];
-};
-
-static INLINE struct nv40_sreg
-nv40_sr(int type, int index)
-{
- struct nv40_sreg temp = {
- .type = type,
- .index = index,
- .dst_scale = DEF_SCALE,
- .abs = 0,
- .negate = 0,
- .swz = { 0, 1, 2, 3 },
- .cc_update = 0,
- .cc_update_reg = 0,
- .cc_test = DEF_CTEST,
- .cc_test_reg = 0,
- .cc_swz = { 0, 1, 2, 3 },
- };
- return temp;
-}
-
-static INLINE struct nv40_sreg
-nv40_sr_swz(struct nv40_sreg src, int x, int y, int z, int w)
-{
- struct nv40_sreg dst = src;
-
- dst.swz[SWZ_X] = src.swz[x];
- dst.swz[SWZ_Y] = src.swz[y];
- dst.swz[SWZ_Z] = src.swz[z];
- dst.swz[SWZ_W] = src.swz[w];
- return dst;
-}
-
-static INLINE struct nv40_sreg
-nv40_sr_neg(struct nv40_sreg src)
-{
- src.negate = !src.negate;
- return src;
-}
-
-static INLINE struct nv40_sreg
-nv40_sr_abs(struct nv40_sreg src)
-{
- src.abs = 1;
- return src;
-}
-
-static INLINE struct nv40_sreg
-nv40_sr_scale(struct nv40_sreg src, int scale)
-{
- src.dst_scale = scale;
- return src;
-}
-#endif
-
-#endif
diff --git a/src/gallium/drivers/nv40/nv40_state.c b/src/gallium/drivers/nv40/nv40_state.c
deleted file mode 100644
index 4f28675e64..0000000000
--- a/src/gallium/drivers/nv40/nv40_state.c
+++ /dev/null
@@ -1,743 +0,0 @@
-#include "pipe/p_state.h"
-#include "pipe/p_defines.h"
-#include "util/u_inlines.h"
-
-#include "draw/draw_context.h"
-
-#include "tgsi/tgsi_parse.h"
-
-#include "nv40_context.h"
-#include "nv40_state.h"
-
-static void *
-nv40_blend_state_create(struct pipe_context *pipe,
- const struct pipe_blend_state *cso)
-{
- struct nv40_context *nv40 = nv40_context(pipe);
- struct nouveau_grobj *curie = nv40->screen->curie;
- struct nv40_blend_state *bso = CALLOC(1, sizeof(*bso));
- struct nouveau_stateobj *so = so_new(5, 8, 0);
-
- if (cso->rt[0].blend_enable) {
- so_method(so, curie, NV40TCL_BLEND_ENABLE, 3);
- so_data (so, 1);
- so_data (so, (nvgl_blend_func(cso->rt[0].alpha_src_factor) << 16) |
- nvgl_blend_func(cso->rt[0].rgb_src_factor));
- so_data (so, nvgl_blend_func(cso->rt[0].alpha_dst_factor) << 16 |
- nvgl_blend_func(cso->rt[0].rgb_dst_factor));
- so_method(so, curie, NV40TCL_BLEND_EQUATION, 1);
- so_data (so, nvgl_blend_eqn(cso->rt[0].alpha_func) << 16 |
- nvgl_blend_eqn(cso->rt[0].rgb_func));
- } else {
- so_method(so, curie, NV40TCL_BLEND_ENABLE, 1);
- so_data (so, 0);
- }
-
- so_method(so, curie, NV40TCL_COLOR_MASK, 1);
- so_data (so, (((cso->rt[0].colormask & PIPE_MASK_A) ? (0x01 << 24) : 0) |
- ((cso->rt[0].colormask & PIPE_MASK_R) ? (0x01 << 16) : 0) |
- ((cso->rt[0].colormask & PIPE_MASK_G) ? (0x01 << 8) : 0) |
- ((cso->rt[0].colormask & PIPE_MASK_B) ? (0x01 << 0) : 0)));
-
- if (cso->logicop_enable) {
- so_method(so, curie, NV40TCL_COLOR_LOGIC_OP_ENABLE, 2);
- so_data (so, 1);
- so_data (so, nvgl_logicop_func(cso->logicop_func));
- } else {
- so_method(so, curie, NV40TCL_COLOR_LOGIC_OP_ENABLE, 1);
- so_data (so, 0);
- }
-
- so_method(so, curie, NV40TCL_DITHER_ENABLE, 1);
- so_data (so, cso->dither ? 1 : 0);
-
- so_ref(so, &bso->so);
- so_ref(NULL, &so);
- bso->pipe = *cso;
- return (void *)bso;
-}
-
-static void
-nv40_blend_state_bind(struct pipe_context *pipe, void *hwcso)
-{
- struct nv40_context *nv40 = nv40_context(pipe);
-
- nv40->blend = hwcso;
- nv40->dirty |= NV40_NEW_BLEND;
-}
-
-static void
-nv40_blend_state_delete(struct pipe_context *pipe, void *hwcso)
-{
- struct nv40_blend_state *bso = hwcso;
-
- so_ref(NULL, &bso->so);
- FREE(bso);
-}
-
-
-static INLINE unsigned
-wrap_mode(unsigned wrap) {
- unsigned ret;
-
- switch (wrap) {
- case PIPE_TEX_WRAP_REPEAT:
- ret = NV40TCL_TEX_WRAP_S_REPEAT;
- break;
- case PIPE_TEX_WRAP_MIRROR_REPEAT:
- ret = NV40TCL_TEX_WRAP_S_MIRRORED_REPEAT;
- break;
- case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
- ret = NV40TCL_TEX_WRAP_S_CLAMP_TO_EDGE;
- break;
- case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
- ret = NV40TCL_TEX_WRAP_S_CLAMP_TO_BORDER;
- break;
- case PIPE_TEX_WRAP_CLAMP:
- ret = NV40TCL_TEX_WRAP_S_CLAMP;
- break;
- case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE:
- ret = NV40TCL_TEX_WRAP_S_MIRROR_CLAMP_TO_EDGE;
- break;
- case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER:
- ret = NV40TCL_TEX_WRAP_S_MIRROR_CLAMP_TO_BORDER;
- break;
- case PIPE_TEX_WRAP_MIRROR_CLAMP:
- ret = NV40TCL_TEX_WRAP_S_MIRROR_CLAMP;
- break;
- default:
- NOUVEAU_ERR("unknown wrap mode: %d\n", wrap);
- ret = NV40TCL_TEX_WRAP_S_REPEAT;
- break;
- }
-
- return ret >> NV40TCL_TEX_WRAP_S_SHIFT;
-}
-
-static void *
-nv40_sampler_state_create(struct pipe_context *pipe,
- const struct pipe_sampler_state *cso)
-{
- struct nv40_sampler_state *ps;
- uint32_t filter = 0;
-
- ps = MALLOC(sizeof(struct nv40_sampler_state));
-
- ps->fmt = 0;
- if (!cso->normalized_coords)
- ps->fmt |= NV40TCL_TEX_FORMAT_RECT;
-
- ps->wrap = ((wrap_mode(cso->wrap_s) << NV40TCL_TEX_WRAP_S_SHIFT) |
- (wrap_mode(cso->wrap_t) << NV40TCL_TEX_WRAP_T_SHIFT) |
- (wrap_mode(cso->wrap_r) << NV40TCL_TEX_WRAP_R_SHIFT));
-
- ps->en = 0;
- if (cso->max_anisotropy >= 2) {
- /* no idea, binary driver sets it, works without it.. meh.. */
- ps->wrap |= (1 << 5);
-
- if (cso->max_anisotropy >= 16) {
- ps->en |= NV40TCL_TEX_ENABLE_ANISO_16X;
- } else
- if (cso->max_anisotropy >= 12) {
- ps->en |= NV40TCL_TEX_ENABLE_ANISO_12X;
- } else
- if (cso->max_anisotropy >= 10) {
- ps->en |= NV40TCL_TEX_ENABLE_ANISO_10X;
- } else
- if (cso->max_anisotropy >= 8) {
- ps->en |= NV40TCL_TEX_ENABLE_ANISO_8X;
- } else
- if (cso->max_anisotropy >= 6) {
- ps->en |= NV40TCL_TEX_ENABLE_ANISO_6X;
- } else
- if (cso->max_anisotropy >= 4) {
- ps->en |= NV40TCL_TEX_ENABLE_ANISO_4X;
- } else {
- ps->en |= NV40TCL_TEX_ENABLE_ANISO_2X;
- }
- }
-
- switch (cso->mag_img_filter) {
- case PIPE_TEX_FILTER_LINEAR:
- filter |= NV40TCL_TEX_FILTER_MAG_LINEAR;
- break;
- case PIPE_TEX_FILTER_NEAREST:
- default:
- filter |= NV40TCL_TEX_FILTER_MAG_NEAREST;
- break;
- }
-
- switch (cso->min_img_filter) {
- case PIPE_TEX_FILTER_LINEAR:
- switch (cso->min_mip_filter) {
- case PIPE_TEX_MIPFILTER_NEAREST:
- filter |= NV40TCL_TEX_FILTER_MIN_LINEAR_MIPMAP_NEAREST;
- break;
- case PIPE_TEX_MIPFILTER_LINEAR:
- filter |= NV40TCL_TEX_FILTER_MIN_LINEAR_MIPMAP_LINEAR;
- break;
- case PIPE_TEX_MIPFILTER_NONE:
- default:
- filter |= NV40TCL_TEX_FILTER_MIN_LINEAR;
- break;
- }
- break;
- case PIPE_TEX_FILTER_NEAREST:
- default:
- switch (cso->min_mip_filter) {
- case PIPE_TEX_MIPFILTER_NEAREST:
- filter |= NV40TCL_TEX_FILTER_MIN_NEAREST_MIPMAP_NEAREST;
- break;
- case PIPE_TEX_MIPFILTER_LINEAR:
- filter |= NV40TCL_TEX_FILTER_MIN_NEAREST_MIPMAP_LINEAR;
- break;
- case PIPE_TEX_MIPFILTER_NONE:
- default:
- filter |= NV40TCL_TEX_FILTER_MIN_NEAREST;
- break;
- }
- break;
- }
-
- ps->filt = filter;
-
- {
- float limit;
-
- limit = CLAMP(cso->lod_bias, -16.0, 15.0);
- ps->filt |= (int)(cso->lod_bias * 256.0) & 0x1fff;
-
- limit = CLAMP(cso->max_lod, 0.0, 15.0);
- ps->en |= (int)(limit * 256.0) << 7;
-
- limit = CLAMP(cso->min_lod, 0.0, 15.0);
- ps->en |= (int)(limit * 256.0) << 19;
- }
-
-
- if (cso->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) {
- switch (cso->compare_func) {
- case PIPE_FUNC_NEVER:
- ps->wrap |= NV40TCL_TEX_WRAP_RCOMP_NEVER;
- break;
- case PIPE_FUNC_GREATER:
- ps->wrap |= NV40TCL_TEX_WRAP_RCOMP_GREATER;
- break;
- case PIPE_FUNC_EQUAL:
- ps->wrap |= NV40TCL_TEX_WRAP_RCOMP_EQUAL;
- break;
- case PIPE_FUNC_GEQUAL:
- ps->wrap |= NV40TCL_TEX_WRAP_RCOMP_GEQUAL;
- break;
- case PIPE_FUNC_LESS:
- ps->wrap |= NV40TCL_TEX_WRAP_RCOMP_LESS;
- break;
- case PIPE_FUNC_NOTEQUAL:
- ps->wrap |= NV40TCL_TEX_WRAP_RCOMP_NOTEQUAL;
- break;
- case PIPE_FUNC_LEQUAL:
- ps->wrap |= NV40TCL_TEX_WRAP_RCOMP_LEQUAL;
- break;
- case PIPE_FUNC_ALWAYS:
- ps->wrap |= NV40TCL_TEX_WRAP_RCOMP_ALWAYS;
- break;
- default:
- break;
- }
- }
-
- ps->bcol = ((float_to_ubyte(cso->border_color[3]) << 24) |
- (float_to_ubyte(cso->border_color[0]) << 16) |
- (float_to_ubyte(cso->border_color[1]) << 8) |
- (float_to_ubyte(cso->border_color[2]) << 0));
-
- return (void *)ps;
-}
-
-static void
-nv40_sampler_state_bind(struct pipe_context *pipe, unsigned nr, void **sampler)
-{
- struct nv40_context *nv40 = nv40_context(pipe);
- unsigned unit;
-
- for (unit = 0; unit < nr; unit++) {
- nv40->tex_sampler[unit] = sampler[unit];
- nv40->dirty_samplers |= (1 << unit);
- }
-
- for (unit = nr; unit < nv40->nr_samplers; unit++) {
- nv40->tex_sampler[unit] = NULL;
- nv40->dirty_samplers |= (1 << unit);
- }
-
- nv40->nr_samplers = nr;
- nv40->dirty |= NV40_NEW_SAMPLER;
-}
-
-static void
-nv40_sampler_state_delete(struct pipe_context *pipe, void *hwcso)
-{
- FREE(hwcso);
-}
-
-static void
-nv40_set_sampler_texture(struct pipe_context *pipe, unsigned nr,
- struct pipe_texture **miptree)
-{
- struct nv40_context *nv40 = nv40_context(pipe);
- unsigned unit;
-
- for (unit = 0; unit < nr; unit++) {
- pipe_texture_reference((struct pipe_texture **)
- &nv40->tex_miptree[unit], miptree[unit]);
- nv40->dirty_samplers |= (1 << unit);
- }
-
- for (unit = nr; unit < nv40->nr_textures; unit++) {
- pipe_texture_reference((struct pipe_texture **)
- &nv40->tex_miptree[unit], NULL);
- nv40->dirty_samplers |= (1 << unit);
- }
-
- nv40->nr_textures = nr;
- nv40->dirty |= NV40_NEW_SAMPLER;
-}
-
-static void *
-nv40_rasterizer_state_create(struct pipe_context *pipe,
- const struct pipe_rasterizer_state *cso)
-{
- struct nv40_context *nv40 = nv40_context(pipe);
- struct nv40_rasterizer_state *rsso = CALLOC(1, sizeof(*rsso));
- struct nouveau_stateobj *so = so_new(9, 19, 0);
- struct nouveau_grobj *curie = nv40->screen->curie;
-
- /*XXX: ignored:
- * light_twoside
- * point_smooth -nohw
- * multisample
- */
-
- so_method(so, curie, NV40TCL_SHADE_MODEL, 1);
- so_data (so, cso->flatshade ? NV40TCL_SHADE_MODEL_FLAT :
- NV40TCL_SHADE_MODEL_SMOOTH);
-
- so_method(so, curie, NV40TCL_LINE_WIDTH, 2);
- so_data (so, (unsigned char)(cso->line_width * 8.0) & 0xff);
- so_data (so, cso->line_smooth ? 1 : 0);
- so_method(so, curie, NV40TCL_LINE_STIPPLE_ENABLE, 2);
- so_data (so, cso->line_stipple_enable ? 1 : 0);
- so_data (so, (cso->line_stipple_pattern << 16) |
- cso->line_stipple_factor);
-
- so_method(so, curie, NV40TCL_POINT_SIZE, 1);
- so_data (so, fui(cso->point_size));
-
- so_method(so, curie, NV40TCL_POLYGON_MODE_FRONT, 6);
- if (cso->front_winding == PIPE_WINDING_CCW) {
- so_data(so, nvgl_polygon_mode(cso->fill_ccw));
- so_data(so, nvgl_polygon_mode(cso->fill_cw));
- switch (cso->cull_mode) {
- case PIPE_WINDING_CCW:
- so_data(so, NV40TCL_CULL_FACE_FRONT);
- break;
- case PIPE_WINDING_CW:
- so_data(so, NV40TCL_CULL_FACE_BACK);
- break;
- case PIPE_WINDING_BOTH:
- so_data(so, NV40TCL_CULL_FACE_FRONT_AND_BACK);
- break;
- default:
- so_data(so, NV40TCL_CULL_FACE_BACK);
- break;
- }
- so_data(so, NV40TCL_FRONT_FACE_CCW);
- } else {
- so_data(so, nvgl_polygon_mode(cso->fill_cw));
- so_data(so, nvgl_polygon_mode(cso->fill_ccw));
- switch (cso->cull_mode) {
- case PIPE_WINDING_CCW:
- so_data(so, NV40TCL_CULL_FACE_BACK);
- break;
- case PIPE_WINDING_CW:
- so_data(so, NV40TCL_CULL_FACE_FRONT);
- break;
- case PIPE_WINDING_BOTH:
- so_data(so, NV40TCL_CULL_FACE_FRONT_AND_BACK);
- break;
- default:
- so_data(so, NV40TCL_CULL_FACE_BACK);
- break;
- }
- so_data(so, NV40TCL_FRONT_FACE_CW);
- }
- so_data(so, cso->poly_smooth ? 1 : 0);
- so_data(so, (cso->cull_mode != PIPE_WINDING_NONE) ? 1 : 0);
-
- so_method(so, curie, NV40TCL_POLYGON_STIPPLE_ENABLE, 1);
- so_data (so, cso->poly_stipple_enable ? 1 : 0);
-
- so_method(so, curie, NV40TCL_POLYGON_OFFSET_POINT_ENABLE, 3);
- if ((cso->offset_cw && cso->fill_cw == PIPE_POLYGON_MODE_POINT) ||
- (cso->offset_ccw && cso->fill_ccw == PIPE_POLYGON_MODE_POINT))
- so_data(so, 1);
- else
- so_data(so, 0);
- if ((cso->offset_cw && cso->fill_cw == PIPE_POLYGON_MODE_LINE) ||
- (cso->offset_ccw && cso->fill_ccw == PIPE_POLYGON_MODE_LINE))
- so_data(so, 1);
- else
- so_data(so, 0);
- if ((cso->offset_cw && cso->fill_cw == PIPE_POLYGON_MODE_FILL) ||
- (cso->offset_ccw && cso->fill_ccw == PIPE_POLYGON_MODE_FILL))
- so_data(so, 1);
- else
- so_data(so, 0);
- if (cso->offset_cw || cso->offset_ccw) {
- so_method(so, curie, NV40TCL_POLYGON_OFFSET_FACTOR, 2);
- so_data (so, fui(cso->offset_scale));
- so_data (so, fui(cso->offset_units * 2));
- }
-
- so_method(so, curie, NV40TCL_POINT_SPRITE, 1);
- if (cso->point_quad_rasterization) {
- unsigned psctl = (1 << 0), i;
-
- for (i = 0; i < 8; i++) {
- if ((cso->sprite_coord_enable >> i) & 1)
- psctl |= (1 << (8 + i));
- }
-
- so_data(so, psctl);
- } else {
- so_data(so, 0);
- }
-
- so_ref(so, &rsso->so);
- so_ref(NULL, &so);
- rsso->pipe = *cso;
- return (void *)rsso;
-}
-
-static void
-nv40_rasterizer_state_bind(struct pipe_context *pipe, void *hwcso)
-{
- struct nv40_context *nv40 = nv40_context(pipe);
-
- nv40->rasterizer = hwcso;
- nv40->dirty |= NV40_NEW_RAST;
- nv40->draw_dirty |= NV40_NEW_RAST;
-}
-
-static void
-nv40_rasterizer_state_delete(struct pipe_context *pipe, void *hwcso)
-{
- struct nv40_rasterizer_state *rsso = hwcso;
-
- so_ref(NULL, &rsso->so);
- FREE(rsso);
-}
-
-static void *
-nv40_depth_stencil_alpha_state_create(struct pipe_context *pipe,
- const struct pipe_depth_stencil_alpha_state *cso)
-{
- struct nv40_context *nv40 = nv40_context(pipe);
- struct nv40_zsa_state *zsaso = CALLOC(1, sizeof(*zsaso));
- struct nouveau_stateobj *so = so_new(6, 20, 0);
- struct nouveau_grobj *curie = nv40->screen->curie;
-
- so_method(so, curie, NV40TCL_DEPTH_FUNC, 3);
- so_data (so, nvgl_comparison_op(cso->depth.func));
- so_data (so, cso->depth.writemask ? 1 : 0);
- so_data (so, cso->depth.enabled ? 1 : 0);
-
- so_method(so, curie, NV40TCL_ALPHA_TEST_ENABLE, 3);
- so_data (so, cso->alpha.enabled ? 1 : 0);
- so_data (so, nvgl_comparison_op(cso->alpha.func));
- so_data (so, float_to_ubyte(cso->alpha.ref_value));
-
- if (cso->stencil[0].enabled) {
- so_method(so, curie, NV40TCL_STENCIL_FRONT_ENABLE, 3);
- so_data (so, cso->stencil[0].enabled ? 1 : 0);
- so_data (so, cso->stencil[0].writemask);
- so_data (so, nvgl_comparison_op(cso->stencil[0].func));
- so_method(so, curie, NV40TCL_STENCIL_FRONT_FUNC_MASK, 4);
- so_data (so, cso->stencil[0].valuemask);
- so_data (so, nvgl_stencil_op(cso->stencil[0].fail_op));
- so_data (so, nvgl_stencil_op(cso->stencil[0].zfail_op));
- so_data (so, nvgl_stencil_op(cso->stencil[0].zpass_op));
- } else {
- so_method(so, curie, NV40TCL_STENCIL_FRONT_ENABLE, 1);
- so_data (so, 0);
- }
-
- if (cso->stencil[1].enabled) {
- so_method(so, curie, NV40TCL_STENCIL_BACK_ENABLE, 3);
- so_data (so, cso->stencil[1].enabled ? 1 : 0);
- so_data (so, cso->stencil[1].writemask);
- so_data (so, nvgl_comparison_op(cso->stencil[1].func));
- so_method(so, curie, NV40TCL_STENCIL_BACK_FUNC_MASK, 4);
- so_data (so, cso->stencil[1].valuemask);
- so_data (so, nvgl_stencil_op(cso->stencil[1].fail_op));
- so_data (so, nvgl_stencil_op(cso->stencil[1].zfail_op));
- so_data (so, nvgl_stencil_op(cso->stencil[1].zpass_op));
- } else {
- so_method(so, curie, NV40TCL_STENCIL_BACK_ENABLE, 1);
- so_data (so, 0);
- }
-
- so_ref(so, &zsaso->so);
- so_ref(NULL, &so);
- zsaso->pipe = *cso;
- return (void *)zsaso;
-}
-
-static void
-nv40_depth_stencil_alpha_state_bind(struct pipe_context *pipe, void *hwcso)
-{
- struct nv40_context *nv40 = nv40_context(pipe);
-
- nv40->zsa = hwcso;
- nv40->dirty |= NV40_NEW_ZSA;
-}
-
-static void
-nv40_depth_stencil_alpha_state_delete(struct pipe_context *pipe, void *hwcso)
-{
- struct nv40_zsa_state *zsaso = hwcso;
-
- so_ref(NULL, &zsaso->so);
- FREE(zsaso);
-}
-
-static void *
-nv40_vp_state_create(struct pipe_context *pipe,
- const struct pipe_shader_state *cso)
-{
- struct nv40_context *nv40 = nv40_context(pipe);
- struct nv40_vertex_program *vp;
-
- vp = CALLOC(1, sizeof(struct nv40_vertex_program));
- vp->pipe.tokens = tgsi_dup_tokens(cso->tokens);
- vp->draw = draw_create_vertex_shader(nv40->draw, &vp->pipe);
-
- return (void *)vp;
-}
-
-static void
-nv40_vp_state_bind(struct pipe_context *pipe, void *hwcso)
-{
- struct nv40_context *nv40 = nv40_context(pipe);
-
- nv40->vertprog = hwcso;
- nv40->dirty |= NV40_NEW_VERTPROG;
- nv40->draw_dirty |= NV40_NEW_VERTPROG;
-}
-
-static void
-nv40_vp_state_delete(struct pipe_context *pipe, void *hwcso)
-{
- struct nv40_context *nv40 = nv40_context(pipe);
- struct nv40_vertex_program *vp = hwcso;
-
- draw_delete_vertex_shader(nv40->draw, vp->draw);
- nv40_vertprog_destroy(nv40, vp);
- FREE((void*)vp->pipe.tokens);
- FREE(vp);
-}
-
-static void *
-nv40_fp_state_create(struct pipe_context *pipe,
- const struct pipe_shader_state *cso)
-{
- struct nv40_fragment_program *fp;
-
- fp = CALLOC(1, sizeof(struct nv40_fragment_program));
- fp->pipe.tokens = tgsi_dup_tokens(cso->tokens);
-
- tgsi_scan_shader(fp->pipe.tokens, &fp->info);
-
- return (void *)fp;
-}
-
-static void
-nv40_fp_state_bind(struct pipe_context *pipe, void *hwcso)
-{
- struct nv40_context *nv40 = nv40_context(pipe);
-
- nv40->fragprog = hwcso;
- nv40->dirty |= NV40_NEW_FRAGPROG;
-}
-
-static void
-nv40_fp_state_delete(struct pipe_context *pipe, void *hwcso)
-{
- struct nv40_context *nv40 = nv40_context(pipe);
- struct nv40_fragment_program *fp = hwcso;
-
- nv40_fragprog_destroy(nv40, fp);
- FREE((void*)fp->pipe.tokens);
- FREE(fp);
-}
-
-static void
-nv40_set_blend_color(struct pipe_context *pipe,
- const struct pipe_blend_color *bcol)
-{
- struct nv40_context *nv40 = nv40_context(pipe);
-
- nv40->blend_colour = *bcol;
- nv40->dirty |= NV40_NEW_BCOL;
-}
-
- static void
-nv40_set_stencil_ref(struct pipe_context *pipe,
- const struct pipe_stencil_ref *sr)
-{
- struct nv40_context *nv40 = nv40_context(pipe);
-
- nv40->stencil_ref = *sr;
- nv40->dirty |= NV40_NEW_SR;
-}
-
-static void
-nv40_set_clip_state(struct pipe_context *pipe,
- const struct pipe_clip_state *clip)
-{
- struct nv40_context *nv40 = nv40_context(pipe);
-
- nv40->clip = *clip;
- nv40->dirty |= NV40_NEW_UCP;
- nv40->draw_dirty |= NV40_NEW_UCP;
-}
-
-static void
-nv40_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
- struct pipe_buffer *buf )
-{
- struct nv40_context *nv40 = nv40_context(pipe);
-
- nv40->constbuf[shader] = buf;
- nv40->constbuf_nr[shader] = buf->size / (4 * sizeof(float));
-
- if (shader == PIPE_SHADER_VERTEX) {
- nv40->dirty |= NV40_NEW_VERTPROG;
- } else
- if (shader == PIPE_SHADER_FRAGMENT) {
- nv40->dirty |= NV40_NEW_FRAGPROG;
- }
-}
-
-static void
-nv40_set_framebuffer_state(struct pipe_context *pipe,
- const struct pipe_framebuffer_state *fb)
-{
- struct nv40_context *nv40 = nv40_context(pipe);
-
- nv40->framebuffer = *fb;
- nv40->dirty |= NV40_NEW_FB;
-}
-
-static void
-nv40_set_polygon_stipple(struct pipe_context *pipe,
- const struct pipe_poly_stipple *stipple)
-{
- struct nv40_context *nv40 = nv40_context(pipe);
-
- memcpy(nv40->stipple, stipple->stipple, 4 * 32);
- nv40->dirty |= NV40_NEW_STIPPLE;
-}
-
-static void
-nv40_set_scissor_state(struct pipe_context *pipe,
- const struct pipe_scissor_state *s)
-{
- struct nv40_context *nv40 = nv40_context(pipe);
-
- nv40->scissor = *s;
- nv40->dirty |= NV40_NEW_SCISSOR;
-}
-
-static void
-nv40_set_viewport_state(struct pipe_context *pipe,
- const struct pipe_viewport_state *vpt)
-{
- struct nv40_context *nv40 = nv40_context(pipe);
-
- nv40->viewport = *vpt;
- nv40->dirty |= NV40_NEW_VIEWPORT;
- nv40->draw_dirty |= NV40_NEW_VIEWPORT;
-}
-
-static void
-nv40_set_vertex_buffers(struct pipe_context *pipe, unsigned count,
- const struct pipe_vertex_buffer *vb)
-{
- struct nv40_context *nv40 = nv40_context(pipe);
-
- memcpy(nv40->vtxbuf, vb, sizeof(*vb) * count);
- nv40->vtxbuf_nr = count;
-
- nv40->dirty |= NV40_NEW_ARRAYS;
- nv40->draw_dirty |= NV40_NEW_ARRAYS;
-}
-
-static void
-nv40_set_vertex_elements(struct pipe_context *pipe, unsigned count,
- const struct pipe_vertex_element *ve)
-{
- struct nv40_context *nv40 = nv40_context(pipe);
-
- memcpy(nv40->vtxelt, ve, sizeof(*ve) * count);
- nv40->vtxelt_nr = count;
-
- nv40->dirty |= NV40_NEW_ARRAYS;
- nv40->draw_dirty |= NV40_NEW_ARRAYS;
-}
-
-void
-nv40_init_state_functions(struct nv40_context *nv40)
-{
- nv40->pipe.create_blend_state = nv40_blend_state_create;
- nv40->pipe.bind_blend_state = nv40_blend_state_bind;
- nv40->pipe.delete_blend_state = nv40_blend_state_delete;
-
- nv40->pipe.create_sampler_state = nv40_sampler_state_create;
- nv40->pipe.bind_fragment_sampler_states = nv40_sampler_state_bind;
- nv40->pipe.delete_sampler_state = nv40_sampler_state_delete;
- nv40->pipe.set_fragment_sampler_textures = nv40_set_sampler_texture;
-
- nv40->pipe.create_rasterizer_state = nv40_rasterizer_state_create;
- nv40->pipe.bind_rasterizer_state = nv40_rasterizer_state_bind;
- nv40->pipe.delete_rasterizer_state = nv40_rasterizer_state_delete;
-
- nv40->pipe.create_depth_stencil_alpha_state =
- nv40_depth_stencil_alpha_state_create;
- nv40->pipe.bind_depth_stencil_alpha_state =
- nv40_depth_stencil_alpha_state_bind;
- nv40->pipe.delete_depth_stencil_alpha_state =
- nv40_depth_stencil_alpha_state_delete;
-
- nv40->pipe.create_vs_state = nv40_vp_state_create;
- nv40->pipe.bind_vs_state = nv40_vp_state_bind;
- nv40->pipe.delete_vs_state = nv40_vp_state_delete;
-
- nv40->pipe.create_fs_state = nv40_fp_state_create;
- nv40->pipe.bind_fs_state = nv40_fp_state_bind;
- nv40->pipe.delete_fs_state = nv40_fp_state_delete;
-
- nv40->pipe.set_blend_color = nv40_set_blend_color;
- nv40->pipe.set_stencil_ref = nv40_set_stencil_ref;
- nv40->pipe.set_clip_state = nv40_set_clip_state;
- nv40->pipe.set_constant_buffer = nv40_set_constant_buffer;
- nv40->pipe.set_framebuffer_state = nv40_set_framebuffer_state;
- nv40->pipe.set_polygon_stipple = nv40_set_polygon_stipple;
- nv40->pipe.set_scissor_state = nv40_set_scissor_state;
- nv40->pipe.set_viewport_state = nv40_set_viewport_state;
-
- nv40->pipe.set_vertex_buffers = nv40_set_vertex_buffers;
- nv40->pipe.set_vertex_elements = nv40_set_vertex_elements;
-}
-
diff --git a/src/gallium/drivers/nv40/nv40_state_blend.c b/src/gallium/drivers/nv40/nv40_state_blend.c
deleted file mode 100644
index 3ff00a37f6..0000000000
--- a/src/gallium/drivers/nv40/nv40_state_blend.c
+++ /dev/null
@@ -1,41 +0,0 @@
-#include "nv40_context.h"
-
-static boolean
-nv40_state_blend_validate(struct nv40_context *nv40)
-{
- so_ref(nv40->blend->so, &nv40->state.hw[NV40_STATE_BLEND]);
- return TRUE;
-}
-
-struct nv40_state_entry nv40_state_blend = {
- .validate = nv40_state_blend_validate,
- .dirty = {
- .pipe = NV40_NEW_BLEND,
- .hw = NV40_STATE_BLEND
- }
-};
-
-static boolean
-nv40_state_blend_colour_validate(struct nv40_context *nv40)
-{
- struct nouveau_stateobj *so = so_new(1, 1, 0);
- struct pipe_blend_color *bcol = &nv40->blend_colour;
-
- so_method(so, nv40->screen->curie, NV40TCL_BLEND_COLOR, 1);
- so_data (so, ((float_to_ubyte(bcol->color[3]) << 24) |
- (float_to_ubyte(bcol->color[0]) << 16) |
- (float_to_ubyte(bcol->color[1]) << 8) |
- (float_to_ubyte(bcol->color[2]) << 0)));
-
- so_ref(so, &nv40->state.hw[NV40_STATE_BCOL]);
- so_ref(NULL, &so);
- return TRUE;
-}
-
-struct nv40_state_entry nv40_state_blend_colour = {
- .validate = nv40_state_blend_colour_validate,
- .dirty = {
- .pipe = NV40_NEW_BCOL,
- .hw = NV40_STATE_BCOL
- }
-};
diff --git a/src/gallium/drivers/nv40/nv40_state_emit.c b/src/gallium/drivers/nv40/nv40_state_emit.c
deleted file mode 100644
index 8990f303ce..0000000000
--- a/src/gallium/drivers/nv40/nv40_state_emit.c
+++ /dev/null
@@ -1,189 +0,0 @@
-#include "nv40_context.h"
-#include "nv40_state.h"
-#include "draw/draw_context.h"
-
-static struct nv40_state_entry *render_states[] = {
- &nv40_state_framebuffer,
- &nv40_state_rasterizer,
- &nv40_state_scissor,
- &nv40_state_stipple,
- &nv40_state_fragprog,
- &nv40_state_fragtex,
- &nv40_state_vertprog,
- &nv40_state_blend,
- &nv40_state_blend_colour,
- &nv40_state_zsa,
- &nv40_state_sr,
- &nv40_state_viewport,
- &nv40_state_vbo,
- NULL
-};
-
-static struct nv40_state_entry *swtnl_states[] = {
- &nv40_state_framebuffer,
- &nv40_state_rasterizer,
- &nv40_state_scissor,
- &nv40_state_stipple,
- &nv40_state_fragprog,
- &nv40_state_fragtex,
- &nv40_state_vertprog,
- &nv40_state_blend,
- &nv40_state_blend_colour,
- &nv40_state_zsa,
- &nv40_state_sr,
- &nv40_state_viewport,
- &nv40_state_vtxfmt,
- NULL
-};
-
-static void
-nv40_state_do_validate(struct nv40_context *nv40,
- struct nv40_state_entry **states)
-{
- while (*states) {
- struct nv40_state_entry *e = *states;
-
- if (nv40->dirty & e->dirty.pipe) {
- if (e->validate(nv40))
- nv40->state.dirty |= (1ULL << e->dirty.hw);
- }
-
- states++;
- }
- nv40->dirty = 0;
-}
-
-void
-nv40_state_emit(struct nv40_context *nv40)
-{
- struct nv40_state *state = &nv40->state;
- struct nv40_screen *screen = nv40->screen;
- struct nouveau_channel *chan = screen->base.channel;
- struct nouveau_grobj *curie = screen->curie;
- unsigned i;
- uint64_t states;
-
- /* XXX: race conditions
- */
- if (nv40 != screen->cur_ctx) {
- for (i = 0; i < NV40_STATE_MAX; i++) {
- if (state->hw[i] && screen->state[i] != state->hw[i])
- state->dirty |= (1ULL << i);
- }
-
- screen->cur_ctx = nv40;
- }
-
- for (i = 0, states = state->dirty; states; i++) {
- if (!(states & (1ULL << i)))
- continue;
- so_ref (state->hw[i], &nv40->screen->state[i]);
- if (state->hw[i])
- so_emit(chan, nv40->screen->state[i]);
- states &= ~(1ULL << i);
- }
-
- if (state->dirty & ((1ULL << NV40_STATE_FRAGPROG) |
- (1ULL << NV40_STATE_FRAGTEX0))) {
- BEGIN_RING(chan, curie, NV40TCL_TEX_CACHE_CTL, 1);
- OUT_RING (chan, 2);
- BEGIN_RING(chan, curie, NV40TCL_TEX_CACHE_CTL, 1);
- OUT_RING (chan, 1);
- }
-
- state->dirty = 0;
-}
-
-void
-nv40_state_flush_notify(struct nouveau_channel *chan)
-{
- struct nv40_context *nv40 = chan->user_private;
- struct nv40_state *state = &nv40->state;
- unsigned i, samplers;
-
- so_emit_reloc_markers(chan, state->hw[NV40_STATE_FB]);
- for (i = 0, samplers = state->fp_samplers; i < 16 && samplers; i++) {
- if (!(samplers & (1 << i)))
- continue;
- so_emit_reloc_markers(chan,
- state->hw[NV40_STATE_FRAGTEX0+i]);
- samplers &= ~(1ULL << i);
- }
- so_emit_reloc_markers(chan, state->hw[NV40_STATE_FRAGPROG]);
- if (state->hw[NV40_STATE_VTXBUF] && nv40->render_mode == HW)
- so_emit_reloc_markers(chan, state->hw[NV40_STATE_VTXBUF]);
-}
-
-boolean
-nv40_state_validate(struct nv40_context *nv40)
-{
- boolean was_sw = nv40->fallback_swtnl ? TRUE : FALSE;
-
- if (nv40->render_mode != HW) {
- /* Don't even bother trying to go back to hw if none
- * of the states that caused swtnl previously have changed.
- */
- if ((nv40->fallback_swtnl & nv40->dirty)
- != nv40->fallback_swtnl)
- return FALSE;
-
- /* Attempt to go to hwtnl again */
- nv40->pipe.flush(&nv40->pipe, 0, NULL);
- nv40->dirty |= (NV40_NEW_VIEWPORT |
- NV40_NEW_VERTPROG |
- NV40_NEW_ARRAYS);
- nv40->render_mode = HW;
- }
-
- nv40_state_do_validate(nv40, render_states);
- if (nv40->fallback_swtnl || nv40->fallback_swrast)
- return FALSE;
-
- if (was_sw)
- NOUVEAU_ERR("swtnl->hw\n");
-
- return TRUE;
-}
-
-boolean
-nv40_state_validate_swtnl(struct nv40_context *nv40)
-{
- struct draw_context *draw = nv40->draw;
-
- /* Setup for swtnl */
- if (nv40->render_mode == HW) {
- NOUVEAU_ERR("hw->swtnl 0x%08x\n", nv40->fallback_swtnl);
- nv40->pipe.flush(&nv40->pipe, 0, NULL);
- nv40->dirty |= (NV40_NEW_VIEWPORT |
- NV40_NEW_VERTPROG |
- NV40_NEW_ARRAYS);
- nv40->render_mode = SWTNL;
- }
-
- if (nv40->draw_dirty & NV40_NEW_VERTPROG)
- draw_bind_vertex_shader(draw, nv40->vertprog->draw);
-
- if (nv40->draw_dirty & NV40_NEW_RAST)
- draw_set_rasterizer_state(draw, &nv40->rasterizer->pipe);
-
- if (nv40->draw_dirty & NV40_NEW_UCP)
- draw_set_clip_state(draw, &nv40->clip);
-
- if (nv40->draw_dirty & NV40_NEW_VIEWPORT)
- draw_set_viewport_state(draw, &nv40->viewport);
-
- if (nv40->draw_dirty & NV40_NEW_ARRAYS) {
- draw_set_vertex_buffers(draw, nv40->vtxbuf_nr, nv40->vtxbuf);
- draw_set_vertex_elements(draw, nv40->vtxelt_nr, nv40->vtxelt);
- }
-
- nv40_state_do_validate(nv40, swtnl_states);
- if (nv40->fallback_swrast) {
- NOUVEAU_ERR("swtnl->swrast 0x%08x\n", nv40->fallback_swrast);
- return FALSE;
- }
-
- nv40->draw_dirty = 0;
- return TRUE;
-}
-
diff --git a/src/gallium/drivers/nv40/nv40_state_fb.c b/src/gallium/drivers/nv40/nv40_state_fb.c
deleted file mode 100644
index fd3fdfddc0..0000000000
--- a/src/gallium/drivers/nv40/nv40_state_fb.c
+++ /dev/null
@@ -1,175 +0,0 @@
-#include "nv40_context.h"
-#include "nouveau/nouveau_util.h"
-
-static struct pipe_buffer *
-nv40_do_surface_buffer(struct pipe_surface *surface)
-{
- struct nv40_miptree *mt = (struct nv40_miptree *)surface->texture;
- return mt->buffer;
-}
-
-#define nv40_surface_buffer(ps) nouveau_bo(nv40_do_surface_buffer(ps))
-
-static boolean
-nv40_state_framebuffer_validate(struct nv40_context *nv40)
-{
- struct nouveau_channel *chan = nv40->screen->base.channel;
- struct nouveau_grobj *curie = nv40->screen->curie;
- struct pipe_framebuffer_state *fb = &nv40->framebuffer;
- struct nv04_surface *rt[4], *zeta;
- uint32_t rt_enable, rt_format;
- int i, colour_format = 0, zeta_format = 0;
- struct nouveau_stateobj *so = so_new(18, 24, 10);
- unsigned rt_flags = NOUVEAU_BO_RDWR | NOUVEAU_BO_VRAM;
- unsigned w = fb->width;
- unsigned h = fb->height;
-
- rt_enable = 0;
- for (i = 0; i < fb->nr_cbufs; i++) {
- if (colour_format) {
- assert(colour_format == fb->cbufs[i]->format);
- } else {
- colour_format = fb->cbufs[i]->format;
- rt_enable |= (NV40TCL_RT_ENABLE_COLOR0 << i);
- rt[i] = (struct nv04_surface *)fb->cbufs[i];
- }
- }
-
- if (rt_enable & (NV40TCL_RT_ENABLE_COLOR1 | NV40TCL_RT_ENABLE_COLOR2 |
- NV40TCL_RT_ENABLE_COLOR3))
- rt_enable |= NV40TCL_RT_ENABLE_MRT;
-
- if (fb->zsbuf) {
- zeta_format = fb->zsbuf->format;
- zeta = (struct nv04_surface *)fb->zsbuf;
- }
-
- if (!(rt[0]->base.texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) {
- assert(!(fb->width & (fb->width - 1)) && !(fb->height & (fb->height - 1)));
- for (i = 1; i < fb->nr_cbufs; i++)
- assert(!(rt[i]->base.texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR));
-
- rt_format = NV40TCL_RT_FORMAT_TYPE_SWIZZLED |
- log2i(fb->width) << NV40TCL_RT_FORMAT_LOG2_WIDTH_SHIFT |
- log2i(fb->height) << NV40TCL_RT_FORMAT_LOG2_HEIGHT_SHIFT;
- }
- else
- rt_format = NV40TCL_RT_FORMAT_TYPE_LINEAR;
-
- switch (colour_format) {
- case PIPE_FORMAT_B8G8R8X8_UNORM:
- rt_format |= NV40TCL_RT_FORMAT_COLOR_X8R8G8B8;
- break;
- case PIPE_FORMAT_B8G8R8A8_UNORM:
- case 0:
- rt_format |= NV40TCL_RT_FORMAT_COLOR_A8R8G8B8;
- break;
- case PIPE_FORMAT_B5G6R5_UNORM:
- rt_format |= NV40TCL_RT_FORMAT_COLOR_R5G6B5;
- break;
- default:
- assert(0);
- }
-
- switch (zeta_format) {
- case PIPE_FORMAT_Z16_UNORM:
- rt_format |= NV40TCL_RT_FORMAT_ZETA_Z16;
- break;
- case PIPE_FORMAT_S8Z24_UNORM:
- case PIPE_FORMAT_X8Z24_UNORM:
- case 0:
- rt_format |= NV40TCL_RT_FORMAT_ZETA_Z24S8;
- break;
- default:
- assert(0);
- }
-
- if (rt_enable & NV40TCL_RT_ENABLE_COLOR0) {
- so_method(so, curie, NV40TCL_DMA_COLOR0, 1);
- so_reloc (so, nv40_surface_buffer(&rt[0]->base), 0,
- rt_flags | NOUVEAU_BO_OR,
- chan->vram->handle, chan->gart->handle);
- so_method(so, curie, NV40TCL_COLOR0_PITCH, 2);
- so_data (so, rt[0]->pitch);
- so_reloc (so, nv40_surface_buffer(&rt[0]->base),
- rt[0]->base.offset, rt_flags | NOUVEAU_BO_LOW,
- 0, 0);
- }
-
- if (rt_enable & NV40TCL_RT_ENABLE_COLOR1) {
- so_method(so, curie, NV40TCL_DMA_COLOR1, 1);
- so_reloc (so, nv40_surface_buffer(&rt[1]->base), 0,
- rt_flags | NOUVEAU_BO_OR,
- chan->vram->handle, chan->gart->handle);
- so_method(so, curie, NV40TCL_COLOR1_OFFSET, 2);
- so_reloc (so, nv40_surface_buffer(&rt[1]->base),
- rt[1]->base.offset, rt_flags | NOUVEAU_BO_LOW,
- 0, 0);
- so_data (so, rt[1]->pitch);
- }
-
- if (rt_enable & NV40TCL_RT_ENABLE_COLOR2) {
- so_method(so, curie, NV40TCL_DMA_COLOR2, 1);
- so_reloc (so, nv40_surface_buffer(&rt[2]->base), 0,
- rt_flags | NOUVEAU_BO_OR,
- chan->vram->handle, chan->gart->handle);
- so_method(so, curie, NV40TCL_COLOR2_OFFSET, 1);
- so_reloc (so, nv40_surface_buffer(&rt[2]->base),
- rt[2]->base.offset, rt_flags | NOUVEAU_BO_LOW,
- 0, 0);
- so_method(so, curie, NV40TCL_COLOR2_PITCH, 1);
- so_data (so, rt[2]->pitch);
- }
-
- if (rt_enable & NV40TCL_RT_ENABLE_COLOR3) {
- so_method(so, curie, NV40TCL_DMA_COLOR3, 1);
- so_reloc (so, nv40_surface_buffer(&rt[3]->base), 0,
- rt_flags | NOUVEAU_BO_OR,
- chan->vram->handle, chan->gart->handle);
- so_method(so, curie, NV40TCL_COLOR3_OFFSET, 1);
- so_reloc (so, nv40_surface_buffer(&rt[3]->base),
- rt[3]->base.offset, rt_flags | NOUVEAU_BO_LOW,
- 0, 0);
- so_method(so, curie, NV40TCL_COLOR3_PITCH, 1);
- so_data (so, rt[3]->pitch);
- }
-
- if (zeta_format) {
- so_method(so, curie, NV40TCL_DMA_ZETA, 1);
- so_reloc (so, nv40_surface_buffer(&zeta->base), 0,
- rt_flags | NOUVEAU_BO_OR,
- chan->vram->handle, chan->gart->handle);
- so_method(so, curie, NV40TCL_ZETA_OFFSET, 1);
- so_reloc (so, nv40_surface_buffer(&zeta->base),
- zeta->base.offset, rt_flags | NOUVEAU_BO_LOW, 0, 0);
- so_method(so, curie, NV40TCL_ZETA_PITCH, 1);
- so_data (so, zeta->pitch);
- }
-
- so_method(so, curie, NV40TCL_RT_ENABLE, 1);
- so_data (so, rt_enable);
- so_method(so, curie, NV40TCL_RT_HORIZ, 3);
- so_data (so, (w << 16) | 0);
- so_data (so, (h << 16) | 0);
- so_data (so, rt_format);
- so_method(so, curie, NV40TCL_VIEWPORT_HORIZ, 2);
- so_data (so, (w << 16) | 0);
- so_data (so, (h << 16) | 0);
- so_method(so, curie, NV40TCL_VIEWPORT_CLIP_HORIZ(0), 2);
- so_data (so, ((w - 1) << 16) | 0);
- so_data (so, ((h - 1) << 16) | 0);
- so_method(so, curie, 0x1d88, 1);
- so_data (so, (1 << 12) | h);
-
- so_ref(so, &nv40->state.hw[NV40_STATE_FB]);
- so_ref(NULL, &so);
- return TRUE;
-}
-
-struct nv40_state_entry nv40_state_framebuffer = {
- .validate = nv40_state_framebuffer_validate,
- .dirty = {
- .pipe = NV40_NEW_FB,
- .hw = NV40_STATE_FB
- }
-};
diff --git a/src/gallium/drivers/nv40/nv40_state_rasterizer.c b/src/gallium/drivers/nv40/nv40_state_rasterizer.c
deleted file mode 100644
index 9ecda5990f..0000000000
--- a/src/gallium/drivers/nv40/nv40_state_rasterizer.c
+++ /dev/null
@@ -1,17 +0,0 @@
-#include "nv40_context.h"
-
-static boolean
-nv40_state_rasterizer_validate(struct nv40_context *nv40)
-{
- so_ref(nv40->rasterizer->so,
- &nv40->state.hw[NV40_STATE_RAST]);
- return TRUE;
-}
-
-struct nv40_state_entry nv40_state_rasterizer = {
- .validate = nv40_state_rasterizer_validate,
- .dirty = {
- .pipe = NV40_NEW_RAST,
- .hw = NV40_STATE_RAST
- }
-};
diff --git a/src/gallium/drivers/nv40/nv40_state_scissor.c b/src/gallium/drivers/nv40/nv40_state_scissor.c
deleted file mode 100644
index 753a505e93..0000000000
--- a/src/gallium/drivers/nv40/nv40_state_scissor.c
+++ /dev/null
@@ -1,36 +0,0 @@
-#include "nv40_context.h"
-
-static boolean
-nv40_state_scissor_validate(struct nv40_context *nv40)
-{
- struct pipe_rasterizer_state *rast = &nv40->rasterizer->pipe;
- struct pipe_scissor_state *s = &nv40->scissor;
- struct nouveau_stateobj *so;
-
- if (nv40->state.hw[NV40_STATE_SCISSOR] &&
- (rast->scissor == 0 && nv40->state.scissor_enabled == 0))
- return FALSE;
- nv40->state.scissor_enabled = rast->scissor;
-
- so = so_new(1, 2, 0);
- so_method(so, nv40->screen->curie, NV40TCL_SCISSOR_HORIZ, 2);
- if (nv40->state.scissor_enabled) {
- so_data (so, ((s->maxx - s->minx) << 16) | s->minx);
- so_data (so, ((s->maxy - s->miny) << 16) | s->miny);
- } else {
- so_data (so, 4096 << 16);
- so_data (so, 4096 << 16);
- }
-
- so_ref(so, &nv40->state.hw[NV40_STATE_SCISSOR]);
- so_ref(NULL, &so);
- return TRUE;
-}
-
-struct nv40_state_entry nv40_state_scissor = {
- .validate = nv40_state_scissor_validate,
- .dirty = {
- .pipe = NV40_NEW_SCISSOR | NV40_NEW_RAST,
- .hw = NV40_STATE_SCISSOR
- }
-};
diff --git a/src/gallium/drivers/nv40/nv40_state_stipple.c b/src/gallium/drivers/nv40/nv40_state_stipple.c
deleted file mode 100644
index 2b371ebfec..0000000000
--- a/src/gallium/drivers/nv40/nv40_state_stipple.c
+++ /dev/null
@@ -1,39 +0,0 @@
-#include "nv40_context.h"
-
-static boolean
-nv40_state_stipple_validate(struct nv40_context *nv40)
-{
- struct pipe_rasterizer_state *rast = &nv40->rasterizer->pipe;
- struct nouveau_grobj *curie = nv40->screen->curie;
- struct nouveau_stateobj *so;
-
- if (nv40->state.hw[NV40_STATE_STIPPLE] &&
- (rast->poly_stipple_enable == 0 && nv40->state.stipple_enabled == 0))
- return FALSE;
-
- if (rast->poly_stipple_enable) {
- unsigned i;
-
- so = so_new(2, 33, 0);
- so_method(so, curie, NV40TCL_POLYGON_STIPPLE_ENABLE, 1);
- so_data (so, 1);
- so_method(so, curie, NV40TCL_POLYGON_STIPPLE_PATTERN(0), 32);
- for (i = 0; i < 32; i++)
- so_data(so, nv40->stipple[i]);
- } else {
- so = so_new(1, 1, 0);
- so_method(so, curie, NV40TCL_POLYGON_STIPPLE_ENABLE, 1);
- so_data (so, 0);
- }
-
- so_ref(so, &nv40->state.hw[NV40_STATE_STIPPLE]);
- return TRUE;
-}
-
-struct nv40_state_entry nv40_state_stipple = {
- .validate = nv40_state_stipple_validate,
- .dirty = {
- .pipe = NV40_NEW_STIPPLE | NV40_NEW_RAST,
- .hw = NV40_STATE_STIPPLE,
- }
-};
diff --git a/src/gallium/drivers/nv40/nv40_state_viewport.c b/src/gallium/drivers/nv40/nv40_state_viewport.c
deleted file mode 100644
index 3aacb00f99..0000000000
--- a/src/gallium/drivers/nv40/nv40_state_viewport.c
+++ /dev/null
@@ -1,38 +0,0 @@
-#include "nv40_context.h"
-
-static boolean
-nv40_state_viewport_validate(struct nv40_context *nv40)
-{
- struct pipe_viewport_state *vpt = &nv40->viewport;
- struct nouveau_stateobj *so;
-
- if (nv40->state.hw[NV40_STATE_VIEWPORT] &&
- !(nv40->dirty & NV40_NEW_VIEWPORT))
- return FALSE;
-
- so = so_new(2, 9, 0);
- so_method(so, nv40->screen->curie,
- NV40TCL_VIEWPORT_TRANSLATE_X, 8);
- so_data (so, fui(vpt->translate[0]));
- so_data (so, fui(vpt->translate[1]));
- so_data (so, fui(vpt->translate[2]));
- so_data (so, fui(vpt->translate[3]));
- so_data (so, fui(vpt->scale[0]));
- so_data (so, fui(vpt->scale[1]));
- so_data (so, fui(vpt->scale[2]));
- so_data (so, fui(vpt->scale[3]));
- so_method(so, nv40->screen->curie, 0x1d78, 1);
- so_data (so, 1);
-
- so_ref(so, &nv40->state.hw[NV40_STATE_VIEWPORT]);
- so_ref(NULL, &so);
- return TRUE;
-}
-
-struct nv40_state_entry nv40_state_viewport = {
- .validate = nv40_state_viewport_validate,
- .dirty = {
- .pipe = NV40_NEW_VIEWPORT | NV40_NEW_RAST,
- .hw = NV40_STATE_VIEWPORT
- }
-};
diff --git a/src/gallium/drivers/nv40/nv40_state_zsa.c b/src/gallium/drivers/nv40/nv40_state_zsa.c
deleted file mode 100644
index 9cbe7da6db..0000000000
--- a/src/gallium/drivers/nv40/nv40_state_zsa.c
+++ /dev/null
@@ -1,41 +0,0 @@
-#include "nv40_context.h"
-
-static boolean
-nv40_state_zsa_validate(struct nv40_context *nv40)
-{
- so_ref(nv40->zsa->so,
- &nv40->state.hw[NV40_STATE_ZSA]);
- return TRUE;
-}
-
-struct nv40_state_entry nv40_state_zsa = {
- .validate = nv40_state_zsa_validate,
- .dirty = {
- .pipe = NV40_NEW_ZSA,
- .hw = NV40_STATE_ZSA
- }
-};
-
-static boolean
-nv40_state_sr_validate(struct nv40_context *nv40)
-{
- struct nouveau_stateobj *so = so_new(2, 2, 0);
- struct pipe_stencil_ref *sr = &nv40->stencil_ref;
-
- so_method(so, nv40->screen->curie, NV40TCL_STENCIL_FRONT_FUNC_REF, 1);
- so_data (so, sr->ref_value[0]);
- so_method(so, nv40->screen->curie, NV40TCL_STENCIL_BACK_FUNC_REF, 1);
- so_data (so, sr->ref_value[1]);
-
- so_ref(so, &nv40->state.hw[NV40_STATE_SR]);
- so_ref(NULL, &so);
- return TRUE;
-}
-
-struct nv40_state_entry nv40_state_sr = {
- .validate = nv40_state_sr_validate,
- .dirty = {
- .pipe = NV40_NEW_SR,
- .hw = NV40_STATE_SR
- }
-};
diff --git a/src/gallium/drivers/nv40/nv40_surface.c b/src/gallium/drivers/nv40/nv40_surface.c
deleted file mode 100644
index 02ecfd7bbb..0000000000
--- a/src/gallium/drivers/nv40/nv40_surface.c
+++ /dev/null
@@ -1,64 +0,0 @@
-
-/**************************************************************************
- *
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#include "pipe/p_defines.h"
-#include "util/u_inlines.h"
-
-#include "util/u_tile.h"
-
-#include "nv40_context.h"
-
-static void
-nv40_surface_copy(struct pipe_context *pipe,
- struct pipe_surface *dest, unsigned destx, unsigned desty,
- struct pipe_surface *src, unsigned srcx, unsigned srcy,
- unsigned width, unsigned height)
-{
- struct nv40_context *nv40 = nv40_context(pipe);
- struct nv04_surface_2d *eng2d = nv40->screen->eng2d;
-
- eng2d->copy(eng2d, dest, destx, desty, src, srcx, srcy, width, height);
-}
-
-static void
-nv40_surface_fill(struct pipe_context *pipe, struct pipe_surface *dest,
- unsigned destx, unsigned desty, unsigned width,
- unsigned height, unsigned value)
-{
- struct nv40_context *nv40 = nv40_context(pipe);
- struct nv04_surface_2d *eng2d = nv40->screen->eng2d;
-
- eng2d->fill(eng2d, dest, destx, desty, width, height, value);
-}
-
-void
-nv40_init_surface_functions(struct nv40_context *nv40)
-{
- nv40->pipe.surface_copy = nv40_surface_copy;
- nv40->pipe.surface_fill = nv40_surface_fill;
-}
diff --git a/src/gallium/drivers/nv40/nv40_vbo.c b/src/gallium/drivers/nv40/nv40_vbo.c
deleted file mode 100644
index 7812460d2e..0000000000
--- a/src/gallium/drivers/nv40/nv40_vbo.c
+++ /dev/null
@@ -1,565 +0,0 @@
-#include "pipe/p_context.h"
-#include "pipe/p_state.h"
-#include "util/u_inlines.h"
-#include "util/u_format.h"
-
-#include "nv40_context.h"
-#include "nv40_state.h"
-
-#include "nouveau/nouveau_channel.h"
-#include "nouveau/nouveau_pushbuf.h"
-#include "nouveau/nouveau_util.h"
-
-#define FORCE_SWTNL 0
-
-static INLINE int
-nv40_vbo_format_to_hw(enum pipe_format pipe, unsigned *fmt, unsigned *ncomp)
-{
- switch (pipe) {
- case PIPE_FORMAT_R32_FLOAT:
- case PIPE_FORMAT_R32G32_FLOAT:
- case PIPE_FORMAT_R32G32B32_FLOAT:
- case PIPE_FORMAT_R32G32B32A32_FLOAT:
- *fmt = NV40TCL_VTXFMT_TYPE_FLOAT;
- break;
- case PIPE_FORMAT_R8_UNORM:
- case PIPE_FORMAT_R8G8_UNORM:
- case PIPE_FORMAT_R8G8B8_UNORM:
- case PIPE_FORMAT_R8G8B8A8_UNORM:
- *fmt = NV40TCL_VTXFMT_TYPE_UBYTE;
- break;
- case PIPE_FORMAT_R16_SSCALED:
- case PIPE_FORMAT_R16G16_SSCALED:
- case PIPE_FORMAT_R16G16B16_SSCALED:
- case PIPE_FORMAT_R16G16B16A16_SSCALED:
- *fmt = NV40TCL_VTXFMT_TYPE_USHORT;
- break;
- default:
- NOUVEAU_ERR("Unknown format %s\n", util_format_name(pipe));
- return 1;
- }
-
- switch (pipe) {
- case PIPE_FORMAT_R8_UNORM:
- case PIPE_FORMAT_R32_FLOAT:
- case PIPE_FORMAT_R16_SSCALED:
- *ncomp = 1;
- break;
- case PIPE_FORMAT_R8G8_UNORM:
- case PIPE_FORMAT_R32G32_FLOAT:
- case PIPE_FORMAT_R16G16_SSCALED:
- *ncomp = 2;
- break;
- case PIPE_FORMAT_R8G8B8_UNORM:
- case PIPE_FORMAT_R32G32B32_FLOAT:
- case PIPE_FORMAT_R16G16B16_SSCALED:
- *ncomp = 3;
- break;
- case PIPE_FORMAT_R8G8B8A8_UNORM:
- case PIPE_FORMAT_R32G32B32A32_FLOAT:
- case PIPE_FORMAT_R16G16B16A16_SSCALED:
- *ncomp = 4;
- break;
- default:
- NOUVEAU_ERR("Unknown format %s\n", util_format_name(pipe));
- return 1;
- }
-
- return 0;
-}
-
-static boolean
-nv40_vbo_set_idxbuf(struct nv40_context *nv40, struct pipe_buffer *ib,
- unsigned ib_size)
-{
- struct pipe_screen *pscreen = &nv40->screen->base.base;
- unsigned type;
-
- if (!ib) {
- nv40->idxbuf = NULL;
- nv40->idxbuf_format = 0xdeadbeef;
- return FALSE;
- }
-
- if (!pscreen->get_param(pscreen, NOUVEAU_CAP_HW_IDXBUF) || ib_size == 1)
- return FALSE;
-
- switch (ib_size) {
- case 2:
- type = NV40TCL_IDXBUF_FORMAT_TYPE_U16;
- break;
- case 4:
- type = NV40TCL_IDXBUF_FORMAT_TYPE_U32;
- break;
- default:
- return FALSE;
- }
-
- if (ib != nv40->idxbuf ||
- type != nv40->idxbuf_format) {
- nv40->dirty |= NV40_NEW_ARRAYS;
- nv40->idxbuf = ib;
- nv40->idxbuf_format = type;
- }
-
- return TRUE;
-}
-
-static boolean
-nv40_vbo_static_attrib(struct nv40_context *nv40, struct nouveau_stateobj *so,
- int attrib, struct pipe_vertex_element *ve,
- struct pipe_vertex_buffer *vb)
-{
- struct pipe_screen *pscreen = nv40->pipe.screen;
- struct nouveau_grobj *curie = nv40->screen->curie;
- unsigned type, ncomp;
- void *map;
-
- if (nv40_vbo_format_to_hw(ve->src_format, &type, &ncomp))
- return FALSE;
-
- map = pipe_buffer_map(pscreen, vb->buffer, PIPE_BUFFER_USAGE_CPU_READ);
- map += vb->buffer_offset + ve->src_offset;
-
- switch (type) {
- case NV40TCL_VTXFMT_TYPE_FLOAT:
- {
- float *v = map;
-
- switch (ncomp) {
- case 4:
- so_method(so, curie, NV40TCL_VTX_ATTR_4F_X(attrib), 4);
- so_data (so, fui(v[0]));
- so_data (so, fui(v[1]));
- so_data (so, fui(v[2]));
- so_data (so, fui(v[3]));
- break;
- case 3:
- so_method(so, curie, NV40TCL_VTX_ATTR_3F_X(attrib), 3);
- so_data (so, fui(v[0]));
- so_data (so, fui(v[1]));
- so_data (so, fui(v[2]));
- break;
- case 2:
- so_method(so, curie, NV40TCL_VTX_ATTR_2F_X(attrib), 2);
- so_data (so, fui(v[0]));
- so_data (so, fui(v[1]));
- break;
- case 1:
- so_method(so, curie, NV40TCL_VTX_ATTR_1F(attrib), 1);
- so_data (so, fui(v[0]));
- break;
- default:
- pipe_buffer_unmap(pscreen, vb->buffer);
- return FALSE;
- }
- }
- break;
- default:
- pipe_buffer_unmap(pscreen, vb->buffer);
- return FALSE;
- }
-
- pipe_buffer_unmap(pscreen, vb->buffer);
-
- return TRUE;
-}
-
-void
-nv40_draw_arrays(struct pipe_context *pipe,
- unsigned mode, unsigned start, unsigned count)
-{
- struct nv40_context *nv40 = nv40_context(pipe);
- struct nv40_screen *screen = nv40->screen;
- struct nouveau_channel *chan = screen->base.channel;
- struct nouveau_grobj *curie = screen->curie;
- unsigned restart;
-
- nv40_vbo_set_idxbuf(nv40, NULL, 0);
- if (FORCE_SWTNL || !nv40_state_validate(nv40)) {
- nv40_draw_elements_swtnl(pipe, NULL, 0,
- mode, start, count);
- return;
- }
-
- while (count) {
- unsigned vc, nr;
-
- nv40_state_emit(nv40);
-
- vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 256,
- mode, start, count, &restart);
- if (!vc) {
- FIRE_RING(chan);
- continue;
- }
-
- BEGIN_RING(chan, curie, NV40TCL_BEGIN_END, 1);
- OUT_RING (chan, nvgl_primitive(mode));
-
- nr = (vc & 0xff);
- if (nr) {
- BEGIN_RING(chan, curie, NV40TCL_VB_VERTEX_BATCH, 1);
- OUT_RING (chan, ((nr - 1) << 24) | start);
- start += nr;
- }
-
- nr = vc >> 8;
- while (nr) {
- unsigned push = nr > 2047 ? 2047 : nr;
-
- nr -= push;
-
- BEGIN_RING_NI(chan, curie, NV40TCL_VB_VERTEX_BATCH, push);
- while (push--) {
- OUT_RING(chan, ((0x100 - 1) << 24) | start);
- start += 0x100;
- }
- }
-
- BEGIN_RING(chan, curie, NV40TCL_BEGIN_END, 1);
- OUT_RING (chan, 0);
-
- count -= vc;
- start = restart;
- }
-
- pipe->flush(pipe, 0, NULL);
-}
-
-static INLINE void
-nv40_draw_elements_u08(struct nv40_context *nv40, void *ib,
- unsigned mode, unsigned start, unsigned count)
-{
- struct nv40_screen *screen = nv40->screen;
- struct nouveau_channel *chan = screen->base.channel;
- struct nouveau_grobj *curie = screen->curie;
-
- while (count) {
- uint8_t *elts = (uint8_t *)ib + start;
- unsigned vc, push, restart;
-
- nv40_state_emit(nv40);
-
- vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 2,
- mode, start, count, &restart);
- if (vc == 0) {
- FIRE_RING(chan);
- continue;
- }
- count -= vc;
-
- BEGIN_RING(chan, curie, NV40TCL_BEGIN_END, 1);
- OUT_RING (chan, nvgl_primitive(mode));
-
- if (vc & 1) {
- BEGIN_RING(chan, curie, NV40TCL_VB_ELEMENT_U32, 1);
- OUT_RING (chan, elts[0]);
- elts++; vc--;
- }
-
- while (vc) {
- unsigned i;
-
- push = MIN2(vc, 2047 * 2);
-
- BEGIN_RING_NI(chan, curie, NV40TCL_VB_ELEMENT_U16, push >> 1);
- for (i = 0; i < push; i+=2)
- OUT_RING(chan, (elts[i+1] << 16) | elts[i]);
-
- vc -= push;
- elts += push;
- }
-
- BEGIN_RING(chan, curie, NV40TCL_BEGIN_END, 1);
- OUT_RING (chan, 0);
-
- start = restart;
- }
-}
-
-static INLINE void
-nv40_draw_elements_u16(struct nv40_context *nv40, void *ib,
- unsigned mode, unsigned start, unsigned count)
-{
- struct nv40_screen *screen = nv40->screen;
- struct nouveau_channel *chan = screen->base.channel;
- struct nouveau_grobj *curie = screen->curie;
-
- while (count) {
- uint16_t *elts = (uint16_t *)ib + start;
- unsigned vc, push, restart;
-
- nv40_state_emit(nv40);
-
- vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 2,
- mode, start, count, &restart);
- if (vc == 0) {
- FIRE_RING(chan);
- continue;
- }
- count -= vc;
-
- BEGIN_RING(chan, curie, NV40TCL_BEGIN_END, 1);
- OUT_RING (chan, nvgl_primitive(mode));
-
- if (vc & 1) {
- BEGIN_RING(chan, curie, NV40TCL_VB_ELEMENT_U32, 1);
- OUT_RING (chan, elts[0]);
- elts++; vc--;
- }
-
- while (vc) {
- unsigned i;
-
- push = MIN2(vc, 2047 * 2);
-
- BEGIN_RING_NI(chan, curie, NV40TCL_VB_ELEMENT_U16, push >> 1);
- for (i = 0; i < push; i+=2)
- OUT_RING(chan, (elts[i+1] << 16) | elts[i]);
-
- vc -= push;
- elts += push;
- }
-
- BEGIN_RING(chan, curie, NV40TCL_BEGIN_END, 1);
- OUT_RING (chan, 0);
-
- start = restart;
- }
-}
-
-static INLINE void
-nv40_draw_elements_u32(struct nv40_context *nv40, void *ib,
- unsigned mode, unsigned start, unsigned count)
-{
- struct nv40_screen *screen = nv40->screen;
- struct nouveau_channel *chan = screen->base.channel;
- struct nouveau_grobj *curie = screen->curie;
-
- while (count) {
- uint32_t *elts = (uint32_t *)ib + start;
- unsigned vc, push, restart;
-
- nv40_state_emit(nv40);
-
- vc = nouveau_vbuf_split(AVAIL_RING(chan), 5, 1,
- mode, start, count, &restart);
- if (vc == 0) {
- FIRE_RING(chan);
- continue;
- }
- count -= vc;
-
- BEGIN_RING(chan, curie, NV40TCL_BEGIN_END, 1);
- OUT_RING (chan, nvgl_primitive(mode));
-
- while (vc) {
- push = MIN2(vc, 2047);
-
- BEGIN_RING_NI(chan, curie, NV40TCL_VB_ELEMENT_U32, push);
- OUT_RINGp (chan, elts, push);
-
- vc -= push;
- elts += push;
- }
-
- BEGIN_RING(chan, curie, NV40TCL_BEGIN_END, 1);
- OUT_RING (chan, 0);
-
- start = restart;
- }
-}
-
-static void
-nv40_draw_elements_inline(struct pipe_context *pipe,
- struct pipe_buffer *ib, unsigned ib_size,
- unsigned mode, unsigned start, unsigned count)
-{
- struct nv40_context *nv40 = nv40_context(pipe);
- struct pipe_screen *pscreen = pipe->screen;
- void *map;
-
- map = pipe_buffer_map(pscreen, ib, PIPE_BUFFER_USAGE_CPU_READ);
- if (!ib) {
- NOUVEAU_ERR("failed mapping ib\n");
- return;
- }
-
- switch (ib_size) {
- case 1:
- nv40_draw_elements_u08(nv40, map, mode, start, count);
- break;
- case 2:
- nv40_draw_elements_u16(nv40, map, mode, start, count);
- break;
- case 4:
- nv40_draw_elements_u32(nv40, map, mode, start, count);
- break;
- default:
- NOUVEAU_ERR("invalid idxbuf fmt %d\n", ib_size);
- break;
- }
-
- pipe_buffer_unmap(pscreen, ib);
-}
-
-static void
-nv40_draw_elements_vbo(struct pipe_context *pipe,
- unsigned mode, unsigned start, unsigned count)
-{
- struct nv40_context *nv40 = nv40_context(pipe);
- struct nv40_screen *screen = nv40->screen;
- struct nouveau_channel *chan = screen->base.channel;
- struct nouveau_grobj *curie = screen->curie;
- unsigned restart;
-
- while (count) {
- unsigned nr, vc;
-
- nv40_state_emit(nv40);
-
- vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 256,
- mode, start, count, &restart);
- if (!vc) {
- FIRE_RING(chan);
- continue;
- }
-
- BEGIN_RING(chan, curie, NV40TCL_BEGIN_END, 1);
- OUT_RING (chan, nvgl_primitive(mode));
-
- nr = (vc & 0xff);
- if (nr) {
- BEGIN_RING(chan, curie, NV40TCL_VB_INDEX_BATCH, 1);
- OUT_RING (chan, ((nr - 1) << 24) | start);
- start += nr;
- }
-
- nr = vc >> 8;
- while (nr) {
- unsigned push = nr > 2047 ? 2047 : nr;
-
- nr -= push;
-
- BEGIN_RING_NI(chan, curie, NV40TCL_VB_INDEX_BATCH, push);
- while (push--) {
- OUT_RING(chan, ((0x100 - 1) << 24) | start);
- start += 0x100;
- }
- }
-
- BEGIN_RING(chan, curie, NV40TCL_BEGIN_END, 1);
- OUT_RING (chan, 0);
-
- count -= vc;
- start = restart;
- }
-}
-
-void
-nv40_draw_elements(struct pipe_context *pipe,
- struct pipe_buffer *indexBuffer, unsigned indexSize,
- unsigned mode, unsigned start, unsigned count)
-{
- struct nv40_context *nv40 = nv40_context(pipe);
- boolean idxbuf;
-
- idxbuf = nv40_vbo_set_idxbuf(nv40, indexBuffer, indexSize);
- if (FORCE_SWTNL || !nv40_state_validate(nv40)) {
- nv40_draw_elements_swtnl(pipe, NULL, 0,
- mode, start, count);
- return;
- }
-
- if (idxbuf) {
- nv40_draw_elements_vbo(pipe, mode, start, count);
- } else {
- nv40_draw_elements_inline(pipe, indexBuffer, indexSize,
- mode, start, count);
- }
-
- pipe->flush(pipe, 0, NULL);
-}
-
-static boolean
-nv40_vbo_validate(struct nv40_context *nv40)
-{
- struct nouveau_stateobj *vtxbuf, *vtxfmt, *sattr = NULL;
- struct nouveau_grobj *curie = nv40->screen->curie;
- struct pipe_buffer *ib = nv40->idxbuf;
- unsigned ib_format = nv40->idxbuf_format;
- unsigned vb_flags = NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_RD;
- int hw;
-
- vtxbuf = so_new(3, 17, 18);
- so_method(vtxbuf, curie, NV40TCL_VTXBUF_ADDRESS(0), nv40->vtxelt_nr);
- vtxfmt = so_new(1, 16, 0);
- so_method(vtxfmt, curie, NV40TCL_VTXFMT(0), nv40->vtxelt_nr);
-
- for (hw = 0; hw < nv40->vtxelt_nr; hw++) {
- struct pipe_vertex_element *ve;
- struct pipe_vertex_buffer *vb;
- unsigned type, ncomp;
-
- ve = &nv40->vtxelt[hw];
- vb = &nv40->vtxbuf[ve->vertex_buffer_index];
-
- if (!vb->stride) {
- if (!sattr)
- sattr = so_new(16, 16 * 4, 0);
-
- if (nv40_vbo_static_attrib(nv40, sattr, hw, ve, vb)) {
- so_data(vtxbuf, 0);
- so_data(vtxfmt, NV40TCL_VTXFMT_TYPE_FLOAT);
- continue;
- }
- }
-
- if (nv40_vbo_format_to_hw(ve->src_format, &type, &ncomp)) {
- nv40->fallback_swtnl |= NV40_NEW_ARRAYS;
- so_ref(NULL, &vtxbuf);
- so_ref(NULL, &vtxfmt);
- return FALSE;
- }
-
- so_reloc(vtxbuf, nouveau_bo(vb->buffer),
- vb->buffer_offset + ve->src_offset,
- vb_flags | NOUVEAU_BO_LOW | NOUVEAU_BO_OR,
- 0, NV40TCL_VTXBUF_ADDRESS_DMA1);
- so_data (vtxfmt, ((vb->stride << NV40TCL_VTXFMT_STRIDE_SHIFT) |
- (ncomp << NV40TCL_VTXFMT_SIZE_SHIFT) | type));
- }
-
- if (ib) {
- struct nouveau_bo *bo = nouveau_bo(ib);
-
- so_method(vtxbuf, curie, NV40TCL_IDXBUF_ADDRESS, 2);
- so_reloc (vtxbuf, bo, 0, vb_flags | NOUVEAU_BO_LOW, 0, 0);
- so_reloc (vtxbuf, bo, ib_format, vb_flags | NOUVEAU_BO_OR,
- 0, NV40TCL_IDXBUF_FORMAT_DMA1);
- }
-
- so_method(vtxbuf, curie, 0x1710, 1);
- so_data (vtxbuf, 0);
-
- so_ref(vtxbuf, &nv40->state.hw[NV40_STATE_VTXBUF]);
- so_ref(NULL, &vtxbuf);
- nv40->state.dirty |= (1ULL << NV40_STATE_VTXBUF);
- so_ref(vtxfmt, &nv40->state.hw[NV40_STATE_VTXFMT]);
- so_ref(NULL, &vtxfmt);
- nv40->state.dirty |= (1ULL << NV40_STATE_VTXFMT);
- so_ref(sattr, &nv40->state.hw[NV40_STATE_VTXATTR]);
- so_ref(NULL, &sattr);
- nv40->state.dirty |= (1ULL << NV40_STATE_VTXATTR);
- return FALSE;
-}
-
-struct nv40_state_entry nv40_state_vbo = {
- .validate = nv40_vbo_validate,
- .dirty = {
- .pipe = NV40_NEW_ARRAYS,
- .hw = 0,
- }
-};
-
diff --git a/src/gallium/drivers/nv50/Makefile b/src/gallium/drivers/nv50/Makefile
index 612aea28a3..5d622e1c13 100644
--- a/src/gallium/drivers/nv50/Makefile
+++ b/src/gallium/drivers/nv50/Makefile
@@ -16,6 +16,7 @@ C_SOURCES = \
nv50_surface.c \
nv50_tex.c \
nv50_transfer.c \
- nv50_vbo.c
+ nv50_vbo.c \
+ nv50_push.c
include ../../Makefile.template
diff --git a/src/gallium/drivers/nv50/nv50_clear.c b/src/gallium/drivers/nv50/nv50_clear.c
index e0b2d2880b..5447904e9c 100644
--- a/src/gallium/drivers/nv50/nv50_clear.c
+++ b/src/gallium/drivers/nv50/nv50_clear.c
@@ -35,8 +35,11 @@ nv50_clear(struct pipe_context *pipe, unsigned buffers,
struct nouveau_grobj *tesla = nv50->screen->tesla;
struct pipe_framebuffer_state *fb = &nv50->framebuffer;
unsigned mode = 0, i;
+ const unsigned dirty = nv50->dirty;
- if (!nv50_state_validate(nv50))
+ /* don't need NEW_BLEND, NV50TCL_COLOR_MASK doesn't affect CLEAR_BUFFERS */
+ nv50->dirty &= NV50_NEW_FRAMEBUFFER | NV50_NEW_SCISSOR;
+ if (!nv50_state_validate(nv50, 64))
return;
if (buffers & PIPE_CLEAR_COLOR && fb->nr_cbufs) {
@@ -64,5 +67,6 @@ nv50_clear(struct pipe_context *pipe, unsigned buffers,
BEGIN_RING(chan, tesla, NV50TCL_CLEAR_BUFFERS, 1);
OUT_RING (chan, (i << 6) | 0x3c);
}
+ nv50->dirty = dirty;
}
diff --git a/src/gallium/drivers/nv50/nv50_context.c b/src/gallium/drivers/nv50/nv50_context.c
index 7be12fcdef..aa14e17872 100644
--- a/src/gallium/drivers/nv50/nv50_context.c
+++ b/src/gallium/drivers/nv50/nv50_context.c
@@ -46,43 +46,13 @@ static void
nv50_destroy(struct pipe_context *pipe)
{
struct nv50_context *nv50 = nv50_context(pipe);
+ int i;
- if (nv50->state.fb)
- so_ref(NULL, &nv50->state.fb);
- if (nv50->state.blend)
- so_ref(NULL, &nv50->state.blend);
- if (nv50->state.blend_colour)
- so_ref(NULL, &nv50->state.blend_colour);
- if (nv50->state.zsa)
- so_ref(NULL, &nv50->state.zsa);
- if (nv50->state.rast)
- so_ref(NULL, &nv50->state.rast);
- if (nv50->state.stipple)
- so_ref(NULL, &nv50->state.stipple);
- if (nv50->state.scissor)
- so_ref(NULL, &nv50->state.scissor);
- if (nv50->state.viewport)
- so_ref(NULL, &nv50->state.viewport);
- if (nv50->state.tsc_upload)
- so_ref(NULL, &nv50->state.tsc_upload);
- if (nv50->state.tic_upload)
- so_ref(NULL, &nv50->state.tic_upload);
- if (nv50->state.vertprog)
- so_ref(NULL, &nv50->state.vertprog);
- if (nv50->state.fragprog)
- so_ref(NULL, &nv50->state.fragprog);
- if (nv50->state.geomprog)
- so_ref(NULL, &nv50->state.geomprog);
- if (nv50->state.fp_linkage)
- so_ref(NULL, &nv50->state.fp_linkage);
- if (nv50->state.gp_linkage)
- so_ref(NULL, &nv50->state.gp_linkage);
- if (nv50->state.vtxfmt)
- so_ref(NULL, &nv50->state.vtxfmt);
- if (nv50->state.vtxbuf)
- so_ref(NULL, &nv50->state.vtxbuf);
- if (nv50->state.vtxattr)
- so_ref(NULL, &nv50->state.vtxattr);
+ for (i = 0; i < 64; i++) {
+ if (!nv50->state.hw[i])
+ continue;
+ so_ref(NULL, &nv50->state.hw[i]);
+ }
draw_destroy(nv50->draw);
@@ -123,11 +93,11 @@ nv50_create(struct pipe_screen *pscreen, void *priv)
nv50->pipe.is_buffer_referenced = nouveau_is_buffer_referenced;
screen->base.channel->user_private = nv50;
- screen->base.channel->flush_notify = nv50_state_flush_notify;
nv50_init_surface_functions(nv50);
nv50_init_state_functions(nv50);
nv50_init_query_functions(nv50);
+ nv50_init_transfer_functions(nv50);
nv50->draw = draw_create();
assert(nv50->draw);
diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h
index c540594b94..bc7831d9ac 100644
--- a/src/gallium/drivers/nv50/nv50_context.h
+++ b/src/gallium/drivers/nv50/nv50_context.h
@@ -72,6 +72,23 @@ struct nv50_sampler_stateobj {
unsigned tsc[8];
};
+struct nv50_sampler_view {
+ struct pipe_sampler_view pipe;
+ uint32_t tic[8];
+};
+
+struct nv50_vtxelt_stateobj {
+ struct pipe_vertex_element pipe[16];
+ unsigned num_elements;
+ uint32_t hw[16];
+};
+
+static INLINE struct nv50_sampler_view *
+nv50_sampler_view(struct pipe_sampler_view *view)
+{
+ return (struct nv50_sampler_view *)view;
+}
+
static INLINE unsigned
get_tile_height(uint32_t tile_mode)
{
@@ -90,10 +107,12 @@ struct nv50_miptree_level {
unsigned tile_mode;
};
+#define NV50_MAX_TEXTURE_LEVELS 16
+
struct nv50_miptree {
struct nouveau_miptree base;
- struct nv50_miptree_level level[PIPE_MAX_TEXTURE_LEVELS];
+ struct nv50_miptree_level level[NV50_MAX_TEXTURE_LEVELS];
int image_nr;
int total_size;
};
@@ -115,30 +134,12 @@ nv50_surface(struct pipe_surface *pt)
}
struct nv50_state {
- unsigned dirty;
+ struct nouveau_stateobj *hw[64];
+ uint64_t hw_dirty;
- struct nouveau_stateobj *fb;
- struct nouveau_stateobj *blend;
- struct nouveau_stateobj *blend_colour;
- struct nouveau_stateobj *zsa;
- struct nouveau_stateobj *stencil_ref;
- struct nouveau_stateobj *rast;
- struct nouveau_stateobj *stipple;
- struct nouveau_stateobj *scissor;
- unsigned scissor_enabled;
- struct nouveau_stateobj *viewport;
- struct nouveau_stateobj *tsc_upload;
- struct nouveau_stateobj *tic_upload;
- unsigned miptree_nr[PIPE_SHADER_TYPES];
- struct nouveau_stateobj *vertprog;
- struct nouveau_stateobj *fragprog;
- struct nouveau_stateobj *geomprog;
- struct nouveau_stateobj *fp_linkage;
- struct nouveau_stateobj *gp_linkage;
- struct nouveau_stateobj *vtxfmt;
+ unsigned sampler_view_nr[3];
struct nouveau_stateobj *vtxbuf;
struct nouveau_stateobj *vtxattr;
- struct nouveau_stateobj *instbuf;
unsigned vtxelt_nr;
};
@@ -167,14 +168,13 @@ struct nv50_context {
struct pipe_buffer *constbuf[PIPE_SHADER_TYPES];
struct pipe_vertex_buffer vtxbuf[PIPE_MAX_ATTRIBS];
unsigned vtxbuf_nr;
- struct pipe_vertex_element vtxelt[PIPE_MAX_ATTRIBS];
- unsigned vtxelt_nr;
- struct nv50_sampler_stateobj *sampler[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS];
- unsigned sampler_nr[PIPE_SHADER_TYPES];
- struct nv50_miptree *miptree[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS];
- unsigned miptree_nr[PIPE_SHADER_TYPES];
+ struct nv50_vtxelt_stateobj *vtxelt;
+ struct nv50_sampler_stateobj *sampler[3][PIPE_MAX_SAMPLERS];
+ unsigned sampler_nr[3];
+ struct pipe_sampler_view *sampler_views[3][PIPE_MAX_SAMPLERS];
+ unsigned sampler_view_nr[3];
- uint16_t vbo_fifo;
+ unsigned vbo_fifo;
};
static INLINE struct nv50_context *
@@ -186,6 +186,7 @@ nv50_context(struct pipe_context *pipe)
extern void nv50_init_surface_functions(struct nv50_context *nv50);
extern void nv50_init_state_functions(struct nv50_context *nv50);
extern void nv50_init_query_functions(struct nv50_context *nv50);
+extern void nv50_init_transfer_functions(struct nv50_context *nv50);
extern void nv50_screen_init_miptree_functions(struct pipe_screen *pscreen);
@@ -216,24 +217,36 @@ extern void nv50_draw_elements_instanced(struct pipe_context *pipe,
unsigned count,
unsigned startInstance,
unsigned instanceCount);
-extern void nv50_vbo_validate(struct nv50_context *nv50);
+extern void nv50_vtxelt_construct(struct nv50_vtxelt_stateobj *cso);
+extern struct nouveau_stateobj *nv50_vbo_validate(struct nv50_context *nv50);
+
+/* nv50_push.c */
+extern void
+nv50_push_elements_instanced(struct pipe_context *, struct pipe_buffer *,
+ unsigned idxsize, unsigned mode, unsigned start,
+ unsigned count, unsigned i_start,
+ unsigned i_count);
/* nv50_clear.c */
extern void nv50_clear(struct pipe_context *pipe, unsigned buffers,
const float *rgba, double depth, unsigned stencil);
/* nv50_program.c */
-extern void nv50_vertprog_validate(struct nv50_context *nv50);
-extern void nv50_fragprog_validate(struct nv50_context *nv50);
-extern void nv50_geomprog_validate(struct nv50_context *nv50);
-extern void nv50_fp_linkage_validate(struct nv50_context *nv50);
-extern void nv50_gp_linkage_validate(struct nv50_context *nv50);
+extern struct nouveau_stateobj *
+nv50_vertprog_validate(struct nv50_context *nv50);
+extern struct nouveau_stateobj *
+nv50_fragprog_validate(struct nv50_context *nv50);
+extern struct nouveau_stateobj *
+nv50_geomprog_validate(struct nv50_context *nv50);
+extern struct nouveau_stateobj *
+nv50_fp_linkage_validate(struct nv50_context *nv50);
+extern struct nouveau_stateobj *
+nv50_gp_linkage_validate(struct nv50_context *nv50);
extern void nv50_program_destroy(struct nv50_context *nv50,
struct nv50_program *p);
/* nv50_state_validate.c */
-extern boolean nv50_state_validate(struct nv50_context *nv50);
-extern void nv50_state_flush_notify(struct nouveau_channel *chan);
+extern boolean nv50_state_validate(struct nv50_context *nv50, unsigned dwords);
extern void nv50_so_init_sifc(struct nv50_context *nv50,
struct nouveau_stateobj *so,
@@ -241,7 +254,9 @@ extern void nv50_so_init_sifc(struct nv50_context *nv50,
unsigned offset, unsigned size);
/* nv50_tex.c */
-extern void nv50_tex_validate(struct nv50_context *);
+extern boolean nv50_tex_construct(struct nv50_sampler_view *view);
+extern void nv50_tex_relocs(struct nv50_context *);
+extern struct nouveau_stateobj *nv50_tex_validate(struct nv50_context *);
/* nv50_transfer.c */
extern void
@@ -255,4 +270,35 @@ nv50_upload_sifc(struct nv50_context *nv50,
struct pipe_context *
nv50_create(struct pipe_screen *pscreen, void *priv);
+static INLINE unsigned
+nv50_prim(unsigned mode)
+{
+ switch (mode) {
+ case PIPE_PRIM_POINTS: return NV50TCL_VERTEX_BEGIN_POINTS;
+ case PIPE_PRIM_LINES: return NV50TCL_VERTEX_BEGIN_LINES;
+ case PIPE_PRIM_LINE_LOOP: return NV50TCL_VERTEX_BEGIN_LINE_LOOP;
+ case PIPE_PRIM_LINE_STRIP: return NV50TCL_VERTEX_BEGIN_LINE_STRIP;
+ case PIPE_PRIM_TRIANGLES: return NV50TCL_VERTEX_BEGIN_TRIANGLES;
+ case PIPE_PRIM_TRIANGLE_STRIP:
+ return NV50TCL_VERTEX_BEGIN_TRIANGLE_STRIP;
+ case PIPE_PRIM_TRIANGLE_FAN: return NV50TCL_VERTEX_BEGIN_TRIANGLE_FAN;
+ case PIPE_PRIM_QUADS: return NV50TCL_VERTEX_BEGIN_QUADS;
+ case PIPE_PRIM_QUAD_STRIP: return NV50TCL_VERTEX_BEGIN_QUAD_STRIP;
+ case PIPE_PRIM_POLYGON: return NV50TCL_VERTEX_BEGIN_POLYGON;
+ case PIPE_PRIM_LINES_ADJACENCY:
+ return NV50TCL_VERTEX_BEGIN_LINES_ADJACENCY;
+ case PIPE_PRIM_LINE_STRIP_ADJACENCY:
+ return NV50TCL_VERTEX_BEGIN_LINE_STRIP_ADJACENCY;
+ case PIPE_PRIM_TRIANGLES_ADJACENCY:
+ return NV50TCL_VERTEX_BEGIN_TRIANGLES_ADJACENCY;
+ case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY:
+ return NV50TCL_VERTEX_BEGIN_TRIANGLE_STRIP_ADJACENCY;
+ default:
+ break;
+ }
+
+ NOUVEAU_ERR("invalid primitive type %d\n", mode);
+ return NV50TCL_VERTEX_BEGIN_POINTS;
+}
+
#endif
diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c
index 3f9d869d7a..85b0aef20c 100644
--- a/src/gallium/drivers/nv50/nv50_miptree.c
+++ b/src/gallium/drivers/nv50/nv50_miptree.c
@@ -89,14 +89,14 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp)
case PIPE_FORMAT_Z32_FLOAT:
tile_flags = 0x4800;
break;
- case PIPE_FORMAT_S8Z24_UNORM:
+ case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
tile_flags = 0x1800;
break;
case PIPE_FORMAT_Z16_UNORM:
tile_flags = 0x6c00;
break;
case PIPE_FORMAT_Z24X8_UNORM:
- case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
tile_flags = 0x2800;
break;
case PIPE_FORMAT_R32G32B32A32_FLOAT:
@@ -104,7 +104,7 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp)
tile_flags = 0x7400;
break;
default:
- if ((pt->tex_usage & PIPE_TEXTURE_USAGE_PRIMARY) &&
+ if ((pt->tex_usage & PIPE_TEXTURE_USAGE_SCANOUT) &&
util_format_get_blocksizebits(pt->format) == 32)
tile_flags = 0x7a00;
else
@@ -255,9 +255,10 @@ void
nv50_screen_init_miptree_functions(struct pipe_screen *pscreen)
{
pscreen->texture_create = nv50_miptree_create;
- pscreen->texture_blanket = nv50_miptree_blanket;
pscreen->texture_destroy = nv50_miptree_destroy;
pscreen->get_tex_surface = nv50_miptree_surface_new;
pscreen->tex_surface_destroy = nv50_miptree_surface_del;
+
+ nouveau_screen(pscreen)->texture_blanket = nv50_miptree_blanket;
}
diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c
index 2372cbbef6..d7e06c9327 100644
--- a/src/gallium/drivers/nv50/nv50_program.c
+++ b/src/gallium/drivers/nv50/nv50_program.c
@@ -3762,7 +3762,7 @@ nv50_program_tx_prep(struct nv50_pc *pc)
p->cfg.in[n].hw = rid = aid;
i = p->cfg.in[n].id;
- if (p->info.input_semantic_name[n] ==
+ if (p->info.input_semantic_name[i] ==
TGSI_SEMANTIC_FACE) {
load_frontfacing(pc, &pc->attr[i * 4]);
continue;
@@ -4270,7 +4270,7 @@ nv50_program_validate_code(struct nv50_context *nv50, struct nv50_program *p)
FREE(up);
}
-void
+struct nouveau_stateobj *
nv50_vertprog_validate(struct nv50_context *nv50)
{
struct nouveau_grobj *tesla = nv50->screen->tesla;
@@ -4286,6 +4286,9 @@ nv50_vertprog_validate(struct nv50_context *nv50)
nv50_program_validate_data(nv50, p);
nv50_program_validate_code(nv50, p);
+ if (!(nv50->dirty & NV50_NEW_VERTPROG))
+ return NULL;
+
so = so_new(5, 7, 2);
so_method(so, tesla, NV50TCL_VP_ADDRESS_HIGH, 2);
so_reloc (so, p->bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD |
@@ -4301,11 +4304,10 @@ nv50_vertprog_validate(struct nv50_context *nv50)
so_data (so, p->cfg.high_temp);
so_method(so, tesla, NV50TCL_VP_START_ID, 1);
so_data (so, 0); /* program start offset */
- so_ref(so, &nv50->state.vertprog);
- so_ref(NULL, &so);
+ return so;
}
-void
+struct nouveau_stateobj *
nv50_fragprog_validate(struct nv50_context *nv50)
{
struct nouveau_grobj *tesla = nv50->screen->tesla;
@@ -4321,6 +4323,9 @@ nv50_fragprog_validate(struct nv50_context *nv50)
nv50_program_validate_data(nv50, p);
nv50_program_validate_code(nv50, p);
+ if (!(nv50->dirty & NV50_NEW_FRAGPROG))
+ return NULL;
+
so = so_new(6, 7, 2);
so_method(so, tesla, NV50TCL_FP_ADDRESS_HIGH, 2);
so_reloc (so, p->bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD |
@@ -4337,11 +4342,10 @@ nv50_fragprog_validate(struct nv50_context *nv50)
so_data (so, p->cfg.regs[3]);
so_method(so, tesla, NV50TCL_FP_START_ID, 1);
so_data (so, 0); /* program start offset */
- so_ref(so, &nv50->state.fragprog);
- so_ref(NULL, &so);
+ return so;
}
-void
+struct nouveau_stateobj *
nv50_geomprog_validate(struct nv50_context *nv50)
{
struct nouveau_grobj *tesla = nv50->screen->tesla;
@@ -4357,6 +4361,9 @@ nv50_geomprog_validate(struct nv50_context *nv50)
nv50_program_validate_data(nv50, p);
nv50_program_validate_code(nv50, p);
+ if (!(nv50->dirty & NV50_NEW_GEOMPROG))
+ return NULL;
+
so = so_new(6, 7, 2);
so_method(so, tesla, NV50TCL_GP_ADDRESS_HIGH, 2);
so_reloc (so, p->bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD |
@@ -4373,8 +4380,7 @@ nv50_geomprog_validate(struct nv50_context *nv50)
so_data (so, p->cfg.vert_count);
so_method(so, tesla, NV50TCL_GP_START_ID, 1);
so_data (so, 0);
- so_ref(so, &nv50->state.geomprog);
- so_ref(NULL, &so);
+ return so;
}
static uint32_t
@@ -4454,7 +4460,7 @@ nv50_vec4_map(uint32_t *map32, int mid, uint8_t zval, uint32_t lin[4],
return mid;
}
-void
+struct nouveau_stateobj *
nv50_fp_linkage_validate(struct nv50_context *nv50)
{
struct nouveau_grobj *tesla = nv50->screen->tesla;
@@ -4580,8 +4586,7 @@ nv50_fp_linkage_validate(struct nv50_context *nv50)
so_method(so, tesla, NV50TCL_GP_ENABLE, 1);
so_data (so, (vp->type == PIPE_SHADER_GEOMETRY) ? 1 : 0);
- so_ref(so, &nv50->state.fp_linkage);
- so_ref(NULL, &so);
+ return so;
}
static int
@@ -4615,7 +4620,7 @@ construct_vp_gp_mapping(uint32_t *map32, int m,
return m;
}
-void
+struct nouveau_stateobj *
nv50_gp_linkage_validate(struct nv50_context *nv50)
{
struct nouveau_grobj *tesla = nv50->screen->tesla;
@@ -4625,10 +4630,8 @@ nv50_gp_linkage_validate(struct nv50_context *nv50)
uint32_t map[16];
int m = 0;
- if (!gp) {
- so_ref(NULL, &nv50->state.gp_linkage);
- return;
- }
+ if (!gp)
+ return NULL;
memset(map, 0, sizeof(map));
m = construct_vp_gp_mapping(map, m, vp, gp);
@@ -4646,8 +4649,7 @@ nv50_gp_linkage_validate(struct nv50_context *nv50)
so_method(so, tesla, NV50TCL_VP_RESULT_MAP(0), m);
so_datap (so, map, m);
- so_ref(so, &nv50->state.gp_linkage);
- so_ref(NULL, &so);
+ return so;
}
void
diff --git a/src/gallium/drivers/nv50/nv50_push.c b/src/gallium/drivers/nv50/nv50_push.c
new file mode 100644
index 0000000000..96a1f32d30
--- /dev/null
+++ b/src/gallium/drivers/nv50/nv50_push.c
@@ -0,0 +1,326 @@
+#include "pipe/p_context.h"
+#include "pipe/p_state.h"
+#include "util/u_inlines.h"
+#include "util/u_format.h"
+
+#include "nouveau/nouveau_util.h"
+#include "nv50_context.h"
+
+struct push_context {
+ struct nv50_context *nv50;
+
+ unsigned vtx_size;
+
+ void *idxbuf;
+ unsigned idxsize;
+
+ float edgeflag;
+ int edgeflag_attr;
+
+ struct {
+ void *map;
+ unsigned stride;
+ unsigned divisor;
+ unsigned step;
+ void (*push)(struct nouveau_channel *, void *);
+ } attr[16];
+ unsigned attr_nr;
+};
+
+static void
+emit_b32_1(struct nouveau_channel *chan, void *data)
+{
+ uint32_t *v = data;
+
+ OUT_RING(chan, v[0]);
+}
+
+static void
+emit_b32_2(struct nouveau_channel *chan, void *data)
+{
+ uint32_t *v = data;
+
+ OUT_RING(chan, v[0]);
+ OUT_RING(chan, v[1]);
+}
+
+static void
+emit_b32_3(struct nouveau_channel *chan, void *data)
+{
+ uint32_t *v = data;
+
+ OUT_RING(chan, v[0]);
+ OUT_RING(chan, v[1]);
+ OUT_RING(chan, v[2]);
+}
+
+static void
+emit_b32_4(struct nouveau_channel *chan, void *data)
+{
+ uint32_t *v = data;
+
+ OUT_RING(chan, v[0]);
+ OUT_RING(chan, v[1]);
+ OUT_RING(chan, v[2]);
+ OUT_RING(chan, v[3]);
+}
+
+static void
+emit_b16_1(struct nouveau_channel *chan, void *data)
+{
+ uint16_t *v = data;
+
+ OUT_RING(chan, v[0]);
+}
+
+static void
+emit_b16_3(struct nouveau_channel *chan, void *data)
+{
+ uint16_t *v = data;
+
+ OUT_RING(chan, (v[1] << 16) | v[0]);
+ OUT_RING(chan, v[2]);
+}
+
+static void
+emit_b08_1(struct nouveau_channel *chan, void *data)
+{
+ uint8_t *v = data;
+
+ OUT_RING(chan, v[0]);
+}
+
+static void
+emit_b08_3(struct nouveau_channel *chan, void *data)
+{
+ uint8_t *v = data;
+
+ OUT_RING(chan, (v[2] << 16) | (v[1] << 8) | v[0]);
+}
+
+static INLINE void
+emit_vertex(struct push_context *ctx, unsigned n)
+{
+ struct nouveau_grobj *tesla = ctx->nv50->screen->tesla;
+ struct nouveau_channel *chan = tesla->channel;
+ int i;
+
+ if (ctx->edgeflag_attr < 16) {
+ float *edgeflag = ctx->attr[ctx->edgeflag_attr].map +
+ ctx->attr[ctx->edgeflag_attr].stride * n;
+
+ if (*edgeflag != ctx->edgeflag) {
+ BEGIN_RING(chan, tesla, NV50TCL_EDGEFLAG_ENABLE, 1);
+ OUT_RING (chan, *edgeflag ? 1 : 0);
+ ctx->edgeflag = *edgeflag;
+ }
+ }
+
+ BEGIN_RING_NI(chan, tesla, NV50TCL_VERTEX_DATA, ctx->vtx_size);
+ for (i = 0; i < ctx->attr_nr; i++)
+ ctx->attr[i].push(chan, ctx->attr[i].map + ctx->attr[i].stride * n);
+}
+
+static void
+emit_edgeflag(void *priv, boolean enabled)
+{
+ struct push_context *ctx = priv;
+ struct nouveau_grobj *tesla = ctx->nv50->screen->tesla;
+ struct nouveau_channel *chan = tesla->channel;
+
+ BEGIN_RING(chan, tesla, NV50TCL_EDGEFLAG_ENABLE, 1);
+ OUT_RING (chan, enabled ? 1 : 0);
+}
+
+static void
+emit_elt08(void *priv, unsigned start, unsigned count)
+{
+ struct push_context *ctx = priv;
+ uint8_t *idxbuf = ctx->idxbuf;
+
+ while (count--)
+ emit_vertex(ctx, idxbuf[start++]);
+}
+
+static void
+emit_elt16(void *priv, unsigned start, unsigned count)
+{
+ struct push_context *ctx = priv;
+ uint16_t *idxbuf = ctx->idxbuf;
+
+ while (count--)
+ emit_vertex(ctx, idxbuf[start++]);
+}
+
+static void
+emit_elt32(void *priv, unsigned start, unsigned count)
+{
+ struct push_context *ctx = priv;
+ uint32_t *idxbuf = ctx->idxbuf;
+
+ while (count--)
+ emit_vertex(ctx, idxbuf[start++]);
+}
+
+static void
+emit_verts(void *priv, unsigned start, unsigned count)
+{
+ while (count--)
+ emit_vertex(priv, start++);
+}
+
+void
+nv50_push_elements_instanced(struct pipe_context *pipe,
+ struct pipe_buffer *idxbuf, unsigned idxsize,
+ unsigned mode, unsigned start, unsigned count,
+ unsigned i_start, unsigned i_count)
+{
+ struct nv50_context *nv50 = nv50_context(pipe);
+ struct nouveau_grobj *tesla = nv50->screen->tesla;
+ struct nouveau_channel *chan = tesla->channel;
+ struct push_context ctx;
+ const unsigned p_overhead = 4 + /* begin/end */
+ 4; /* potential edgeflag enable/disable */
+ const unsigned v_overhead = 1 + /* VERTEX_DATA packet header */
+ 2; /* potential edgeflag modification */
+ struct u_split_prim s;
+ unsigned vtx_size;
+ boolean nzi = FALSE;
+ int i;
+
+ ctx.nv50 = nv50;
+ ctx.attr_nr = 0;
+ ctx.idxbuf = NULL;
+ ctx.vtx_size = 0;
+ ctx.edgeflag = 0.5f;
+ ctx.edgeflag_attr = nv50->vertprog->cfg.edgeflag_in;
+
+ /* map vertex buffers, determine vertex size */
+ for (i = 0; i < nv50->vtxelt->num_elements; i++) {
+ struct pipe_vertex_element *ve = &nv50->vtxelt->pipe[i];
+ struct pipe_vertex_buffer *vb = &nv50->vtxbuf[ve->vertex_buffer_index];
+ struct nouveau_bo *bo = nouveau_bo(vb->buffer);
+ unsigned size, nr_components, n;
+
+ if (!(nv50->vbo_fifo & (1 << i)))
+ continue;
+ n = ctx.attr_nr++;
+
+ if (nouveau_bo_map(bo, NOUVEAU_BO_RD)) {
+ assert(bo->map);
+ return;
+ }
+ ctx.attr[n].map = bo->map + vb->buffer_offset + ve->src_offset;
+ nouveau_bo_unmap(bo);
+
+ ctx.attr[n].stride = vb->stride;
+ ctx.attr[n].divisor = ve->instance_divisor;
+ if (ctx.attr[n].divisor) {
+ ctx.attr[n].step = i_start % ve->instance_divisor;
+ ctx.attr[n].map += i_start * vb->stride;
+ }
+
+ size = util_format_get_component_bits(ve->src_format,
+ UTIL_FORMAT_COLORSPACE_RGB, 0);
+ nr_components = util_format_get_nr_components(ve->src_format);
+ switch (size) {
+ case 8:
+ switch (nr_components) {
+ case 1: ctx.attr[n].push = emit_b08_1; break;
+ case 2: ctx.attr[n].push = emit_b16_1; break;
+ case 3: ctx.attr[n].push = emit_b08_3; break;
+ case 4: ctx.attr[n].push = emit_b32_1; break;
+ }
+ ctx.vtx_size++;
+ break;
+ case 16:
+ switch (nr_components) {
+ case 1: ctx.attr[n].push = emit_b16_1; break;
+ case 2: ctx.attr[n].push = emit_b32_1; break;
+ case 3: ctx.attr[n].push = emit_b16_3; break;
+ case 4: ctx.attr[n].push = emit_b32_2; break;
+ }
+ ctx.vtx_size += (nr_components + 1) >> 1;
+ break;
+ case 32:
+ switch (nr_components) {
+ case 1: ctx.attr[n].push = emit_b32_1; break;
+ case 2: ctx.attr[n].push = emit_b32_2; break;
+ case 3: ctx.attr[n].push = emit_b32_3; break;
+ case 4: ctx.attr[n].push = emit_b32_4; break;
+ }
+ ctx.vtx_size += nr_components;
+ break;
+ default:
+ assert(0);
+ return;
+ }
+ }
+ vtx_size = ctx.vtx_size + v_overhead;
+
+ /* map index buffer, if present */
+ if (idxbuf) {
+ struct nouveau_bo *bo = nouveau_bo(idxbuf);
+
+ if (nouveau_bo_map(bo, NOUVEAU_BO_RD)) {
+ assert(bo->map);
+ return;
+ }
+ ctx.idxbuf = bo->map;
+ ctx.idxsize = idxsize;
+ nouveau_bo_unmap(bo);
+ }
+
+ s.priv = &ctx;
+ s.edge = emit_edgeflag;
+ if (idxbuf) {
+ if (idxsize == 1)
+ s.emit = emit_elt08;
+ else
+ if (idxsize == 2)
+ s.emit = emit_elt16;
+ else
+ s.emit = emit_elt32;
+ } else
+ s.emit = emit_verts;
+
+ /* per-instance loop */
+ BEGIN_RING(chan, tesla, NV50TCL_CB_ADDR, 2);
+ OUT_RING (chan, NV50_CB_AUX | (24 << 8));
+ OUT_RING (chan, i_start);
+ while (i_count--) {
+ unsigned max_verts;
+ boolean done;
+
+ for (i = 0; i < ctx.attr_nr; i++) {
+ if (!ctx.attr[i].divisor ||
+ ctx.attr[i].divisor != ++ctx.attr[i].step)
+ continue;
+ ctx.attr[i].step = 0;
+ ctx.attr[i].map += ctx.attr[i].stride;
+ }
+
+ u_split_prim_init(&s, mode, start, count);
+ do {
+ if (AVAIL_RING(chan) < p_overhead + (6 * vtx_size)) {
+ FIRE_RING(chan);
+ if (!nv50_state_validate(nv50, p_overhead + (6 * vtx_size))) {
+ assert(0);
+ return;
+ }
+ }
+
+ max_verts = AVAIL_RING(chan);
+ max_verts -= p_overhead;
+ max_verts /= vtx_size;
+
+ BEGIN_RING(chan, tesla, NV50TCL_VERTEX_BEGIN, 1);
+ OUT_RING (chan, nv50_prim(s.mode) | (nzi ? (1 << 28) : 0));
+ done = u_split_prim_next(&s, max_verts);
+ BEGIN_RING(chan, tesla, NV50TCL_VERTEX_END, 1);
+ OUT_RING (chan, 0);
+ } while (!done);
+
+ nzi = TRUE;
+ }
+}
diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c
index eed6031eaf..801548d8a1 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -51,9 +51,9 @@ nv50_screen_is_format_supported(struct pipe_screen *pscreen,
if (tex_usage & PIPE_TEXTURE_USAGE_DEPTH_STENCIL) {
switch (format) {
case PIPE_FORMAT_Z32_FLOAT:
- case PIPE_FORMAT_S8Z24_UNORM:
+ case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
case PIPE_FORMAT_Z24X8_UNORM:
- case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
return TRUE;
default:
break;
@@ -75,8 +75,8 @@ nv50_screen_is_format_supported(struct pipe_screen *pscreen,
case PIPE_FORMAT_DXT1_RGBA:
case PIPE_FORMAT_DXT3_RGBA:
case PIPE_FORMAT_DXT5_RGBA:
- case PIPE_FORMAT_S8Z24_UNORM:
- case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
case PIPE_FORMAT_Z32_FLOAT:
case PIPE_FORMAT_R16G16B16A16_SNORM:
case PIPE_FORMAT_R16G16B16A16_UNORM:
@@ -95,6 +95,8 @@ nv50_screen_is_format_supported(struct pipe_screen *pscreen,
static int
nv50_screen_get_param(struct pipe_screen *pscreen, int param)
{
+ struct nv50_screen *screen = nv50_screen(pscreen);
+
switch (param) {
case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
return 32;
@@ -107,7 +109,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, int param)
case PIPE_CAP_TWO_SIDED_STENCIL:
return 1;
case PIPE_CAP_GLSL:
- return 0;
+ return 1;
case PIPE_CAP_ANISOTROPIC_FILTER:
return 1;
case PIPE_CAP_POINT_SPRITE:
@@ -132,9 +134,9 @@ nv50_screen_get_param(struct pipe_screen *pscreen, int param)
case PIPE_CAP_BLEND_EQUATION_SEPARATE:
return 1;
case NOUVEAU_CAP_HW_VTXBUF:
- return 1;
+ return screen->force_push ? 0 : 1;
case NOUVEAU_CAP_HW_IDXBUF:
- return 1;
+ return screen->force_push ? 0 : 1;
case PIPE_CAP_INDEP_BLEND_ENABLE:
return 1;
case PIPE_CAP_INDEP_BLEND_FUNC:
@@ -188,8 +190,6 @@ nv50_screen_destroy(struct pipe_screen *pscreen)
nouveau_bo_ref(NULL, &screen->tic);
if (screen->tsc)
nouveau_bo_ref(NULL, &screen->tsc);
- if (screen->static_init)
- so_ref(NULL, &screen->static_init);
nouveau_notifier_free(&screen->sync);
nouveau_grobj_free(&screen->tesla);
@@ -202,26 +202,53 @@ nv50_screen_destroy(struct pipe_screen *pscreen)
FREE(screen);
}
-static int
-nv50_pre_pipebuffer_map(struct pipe_screen *pscreen, struct pipe_buffer *pb,
- unsigned usage)
+#define BGN_RELOC(ch, bo, gr, m, n, fl) \
+ OUT_RELOC(ch, bo, (n << 18) | (gr->subc << 13) | m, fl, 0, 0)
+
+void
+nv50_screen_relocs(struct nv50_screen *screen)
{
- struct nv50_screen *screen = nv50_screen(pscreen);
- struct nv50_context *ctx = screen->cur_ctx;
+ struct nouveau_channel *chan = screen->base.channel;
+ struct nouveau_grobj *tesla = screen->tesla;
+ unsigned i;
+ const unsigned rl = NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | NOUVEAU_BO_DUMMY;
- if (!(pb->usage & PIPE_BUFFER_USAGE_VERTEX))
- return 0;
+ MARK_RING (chan, 28, 26);
- /* Our vtxbuf got mapped, it can no longer be considered part of current
- * state, remove it to avoid emitting reloc markers.
- */
- if (ctx && ctx->state.vtxbuf && so_bo_is_reloc(ctx->state.vtxbuf,
- nouveau_bo(pb))) {
- so_ref(NULL, &ctx->state.vtxbuf);
- ctx->dirty |= NV50_NEW_ARRAYS;
- }
+ /* cause grobj autobind */
+ BEGIN_RING(chan, tesla, 0x0100, 1);
+ OUT_RING (chan, 0);
+
+ BGN_RELOC (chan, screen->tic, tesla, NV50TCL_TIC_ADDRESS_HIGH, 2, rl);
+ OUT_RELOCh(chan, screen->tic, 0, rl);
+ OUT_RELOCl(chan, screen->tic, 0, rl);
+
+ BGN_RELOC (chan, screen->tsc, tesla, NV50TCL_TSC_ADDRESS_HIGH, 2, rl);
+ OUT_RELOCh(chan, screen->tsc, 0, rl);
+ OUT_RELOCl(chan, screen->tsc, 0, rl);
- return 0;
+ BGN_RELOC (chan, screen->constbuf_misc[0],
+ tesla, NV50TCL_CB_DEF_ADDRESS_HIGH, 3, rl);
+ OUT_RELOCh(chan, screen->constbuf_misc[0], 0, rl);
+ OUT_RELOCl(chan, screen->constbuf_misc[0], 0, rl);
+ OUT_RELOC (chan, screen->constbuf_misc[0],
+ (NV50_CB_PMISC << 16) | 0x0200, rl, 0, 0);
+
+ BGN_RELOC (chan, screen->constbuf_misc[0],
+ tesla, NV50TCL_CB_DEF_ADDRESS_HIGH, 3, rl);
+ OUT_RELOCh(chan, screen->constbuf_misc[0], 0x200, rl);
+ OUT_RELOCl(chan, screen->constbuf_misc[0], 0x200, rl);
+ OUT_RELOC (chan, screen->constbuf_misc[0],
+ (NV50_CB_AUX << 16) | 0x0200, rl, 0, 0);
+
+ for (i = 0; i < 3; ++i) {
+ BGN_RELOC (chan, screen->constbuf_parm[i],
+ tesla, NV50TCL_CB_DEF_ADDRESS_HIGH, 3, rl);
+ OUT_RELOCh(chan, screen->constbuf_parm[i], 0, rl);
+ OUT_RELOCl(chan, screen->constbuf_parm[i], 0, rl);
+ OUT_RELOC (chan, screen->constbuf_parm[i],
+ ((NV50_CB_PVP + i) << 16) | 0x0800, rl, 0, 0);
+ }
}
struct pipe_screen *
@@ -230,10 +257,10 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
struct nv50_screen *screen = CALLOC_STRUCT(nv50_screen);
struct nouveau_channel *chan;
struct pipe_screen *pscreen;
- struct nouveau_stateobj *so;
unsigned chipset = dev->chipset;
unsigned tesla_class = 0;
int ret, i;
+ const unsigned rl = NOUVEAU_BO_VRAM | NOUVEAU_BO_RD;
if (!screen)
return NULL;
@@ -252,10 +279,8 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
pscreen->get_paramf = nv50_screen_get_paramf;
pscreen->is_format_supported = nv50_screen_is_format_supported;
pscreen->context_create = nv50_create;
- screen->base.pre_pipebuffer_map_callback = nv50_pre_pipebuffer_map;
nv50_screen_init_miptree_functions(pscreen);
- nv50_transfer_init_screen_functions(pscreen);
/* DMA engine object */
ret = nouveau_grobj_alloc(chan, 0xbeef5039,
@@ -318,64 +343,58 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
}
/* Static M2MF init */
- so = so_new(1, 3, 0);
- so_method(so, screen->m2mf, NV04_MEMORY_TO_MEMORY_FORMAT_DMA_NOTIFY, 3);
- so_data (so, screen->sync->handle);
- so_data (so, chan->vram->handle);
- so_data (so, chan->vram->handle);
- so_emit(chan, so);
- so_ref (NULL, &so);
+ BEGIN_RING(chan, screen->m2mf,
+ NV04_MEMORY_TO_MEMORY_FORMAT_DMA_NOTIFY, 3);
+ OUT_RING (chan, screen->sync->handle);
+ OUT_RING (chan, chan->vram->handle);
+ OUT_RING (chan, chan->vram->handle);
/* Static 2D init */
- so = so_new(4, 7, 0);
- so_method(so, screen->eng2d, NV50_2D_DMA_NOTIFY, 4);
- so_data (so, screen->sync->handle);
- so_data (so, chan->vram->handle);
- so_data (so, chan->vram->handle);
- so_data (so, chan->vram->handle);
- so_method(so, screen->eng2d, NV50_2D_OPERATION, 1);
- so_data (so, NV50_2D_OPERATION_SRCCOPY);
- so_method(so, screen->eng2d, NV50_2D_CLIP_ENABLE, 1);
- so_data (so, 0);
- so_method(so, screen->eng2d, 0x0888, 1);
- so_data (so, 1);
- so_emit(chan, so);
- so_ref(NULL, &so);
+ BEGIN_RING(chan, screen->eng2d, NV50_2D_DMA_NOTIFY, 4);
+ OUT_RING (chan, screen->sync->handle);
+ OUT_RING (chan, chan->vram->handle);
+ OUT_RING (chan, chan->vram->handle);
+ OUT_RING (chan, chan->vram->handle);
+ BEGIN_RING(chan, screen->eng2d, NV50_2D_OPERATION, 1);
+ OUT_RING (chan, NV50_2D_OPERATION_SRCCOPY);
+ BEGIN_RING(chan, screen->eng2d, NV50_2D_CLIP_ENABLE, 1);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, screen->eng2d, 0x0888, 1);
+ OUT_RING (chan, 1);
/* Static tesla init */
- so = so_new(47, 95, 24);
-
- so_method(so, screen->tesla, NV50TCL_COND_MODE, 1);
- so_data (so, NV50TCL_COND_MODE_ALWAYS);
- so_method(so, screen->tesla, NV50TCL_DMA_NOTIFY, 1);
- so_data (so, screen->sync->handle);
- so_method(so, screen->tesla, NV50TCL_DMA_ZETA, 11);
+ BEGIN_RING(chan, screen->tesla, NV50TCL_COND_MODE, 1);
+ OUT_RING (chan, NV50TCL_COND_MODE_ALWAYS);
+ BEGIN_RING(chan, screen->tesla, NV50TCL_DMA_NOTIFY, 1);
+ OUT_RING (chan, screen->sync->handle);
+ BEGIN_RING(chan, screen->tesla, NV50TCL_DMA_ZETA, 11);
for (i = 0; i < 11; i++)
- so_data(so, chan->vram->handle);
- so_method(so, screen->tesla, NV50TCL_DMA_COLOR(0),
- NV50TCL_DMA_COLOR__SIZE);
+ OUT_RING (chan, chan->vram->handle);
+ BEGIN_RING(chan, screen->tesla,
+ NV50TCL_DMA_COLOR(0), NV50TCL_DMA_COLOR__SIZE);
for (i = 0; i < NV50TCL_DMA_COLOR__SIZE; i++)
- so_data(so, chan->vram->handle);
- so_method(so, screen->tesla, NV50TCL_RT_CONTROL, 1);
- so_data (so, 1);
+ OUT_RING (chan, chan->vram->handle);
+
+ BEGIN_RING(chan, screen->tesla, NV50TCL_RT_CONTROL, 1);
+ OUT_RING (chan, 1);
/* activate all 32 lanes (threads) in a warp */
- so_method(so, screen->tesla, NV50TCL_WARP_HALVES, 1);
- so_data (so, 0x2);
- so_method(so, screen->tesla, 0x1400, 1);
- so_data (so, 0xf);
+ BEGIN_RING(chan, screen->tesla, NV50TCL_WARP_HALVES, 1);
+ OUT_RING (chan, 2);
+ BEGIN_RING(chan, screen->tesla, 0x1400, 1);
+ OUT_RING (chan, 0xf);
/* max TIC (bits 4:8) & TSC (ignored) bindings, per program type */
for (i = 0; i < 3; ++i) {
- so_method(so, screen->tesla, NV50TCL_TEX_LIMITS(i), 1);
- so_data (so, 0x54);
+ BEGIN_RING(chan, screen->tesla, NV50TCL_TEX_LIMITS(i), 1);
+ OUT_RING (chan, 0x54);
}
/* origin is top left (set to 1 for bottom left) */
- so_method(so, screen->tesla, NV50TCL_Y_ORIGIN_BOTTOM, 1);
- so_data (so, 0);
- so_method(so, screen->tesla, NV50TCL_VP_REG_ALLOC_RESULT, 1);
- so_data (so, 8);
+ BEGIN_RING(chan, screen->tesla, NV50TCL_Y_ORIGIN_BOTTOM, 1);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, screen->tesla, NV50TCL_VP_REG_ALLOC_RESULT, 1);
+ OUT_RING (chan, 8);
/* constant buffers for immediates and VP/FP parameters */
ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, (32 * 4) * 4,
@@ -384,6 +403,14 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
nv50_screen_destroy(pscreen);
return NULL;
}
+ BEGIN_RING(chan, screen->tesla, NV50TCL_CB_DEF_ADDRESS_HIGH, 3);
+ OUT_RELOCh(chan, screen->constbuf_misc[0], 0, rl);
+ OUT_RELOCl(chan, screen->constbuf_misc[0], 0, rl);
+ OUT_RING (chan, (NV50_CB_PMISC << 16) | 0x0200);
+ BEGIN_RING(chan, screen->tesla, NV50TCL_CB_DEF_ADDRESS_HIGH, 3);
+ OUT_RELOCh(chan, screen->constbuf_misc[0], 0x200, rl);
+ OUT_RELOCl(chan, screen->constbuf_misc[0], 0x200, rl);
+ OUT_RING (chan, (NV50_CB_AUX << 16) | 0x0200);
for (i = 0; i < 3; i++) {
ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, (256 * 4) * 4,
@@ -392,6 +419,10 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
nv50_screen_destroy(pscreen);
return NULL;
}
+ BEGIN_RING(chan, screen->tesla, NV50TCL_CB_DEF_ADDRESS_HIGH, 3);
+ OUT_RELOCh(chan, screen->constbuf_parm[i], 0, rl);
+ OUT_RELOCl(chan, screen->constbuf_parm[i], 0, rl);
+ OUT_RING (chan, ((NV50_CB_PVP + i) << 16) | 0x0800);
}
if (nouveau_resource_init(&screen->immd_heap[0], 0, 128) ||
@@ -403,123 +434,69 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
return NULL;
}
- /*
- // map constant buffers:
- // B = buffer ID (maybe more than 1 byte)
- // N = CB index used in shader instruction
- // P = program type (0 = VP, 2 = GP, 3 = FP)
- so_method(so, screen->tesla, NV50TCL_SET_PROGRAM_CB, 1);
- so_data (so, 0x000BBNP1);
- */
-
- so_method(so, screen->tesla, NV50TCL_CB_DEF_ADDRESS_HIGH, 3);
- so_reloc (so, screen->constbuf_misc[0], 0, NOUVEAU_BO_VRAM |
- NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0);
- so_reloc (so, screen->constbuf_misc[0], 0, NOUVEAU_BO_VRAM |
- NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0);
- so_data (so, (NV50_CB_PMISC << 16) | 0x00000200);
- so_method(so, screen->tesla, NV50TCL_SET_PROGRAM_CB, 1);
- so_data (so, 0x00000001 | (NV50_CB_PMISC << 12));
- so_method(so, screen->tesla, NV50TCL_SET_PROGRAM_CB, 1);
- so_data (so, 0x00000021 | (NV50_CB_PMISC << 12));
- so_method(so, screen->tesla, NV50TCL_SET_PROGRAM_CB, 1);
- so_data (so, 0x00000031 | (NV50_CB_PMISC << 12));
-
- /* bind auxiliary constbuf to immediate data bo */
- so_method(so, screen->tesla, NV50TCL_CB_DEF_ADDRESS_HIGH, 3);
- so_reloc (so, screen->constbuf_misc[0], (128 * 4) * 4,
- NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0);
- so_reloc (so, screen->constbuf_misc[0], (128 * 4) * 4,
- NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0);
- so_data (so, (NV50_CB_AUX << 16) | 0x00000200);
- so_method(so, screen->tesla, NV50TCL_SET_PROGRAM_CB, 1);
- so_data (so, 0x00000201 | (NV50_CB_AUX << 12));
- so_method(so, screen->tesla, NV50TCL_SET_PROGRAM_CB, 1);
- so_data (so, 0x00000221 | (NV50_CB_AUX << 12));
-
- so_method(so, screen->tesla, NV50TCL_CB_DEF_ADDRESS_HIGH, 3);
- so_reloc (so, screen->constbuf_parm[PIPE_SHADER_VERTEX], 0,
- NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0);
- so_reloc (so, screen->constbuf_parm[PIPE_SHADER_VERTEX], 0,
- NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0);
- so_data (so, (NV50_CB_PVP << 16) | 0x00000800);
- so_method(so, screen->tesla, NV50TCL_SET_PROGRAM_CB, 1);
- so_data (so, 0x00000101 | (NV50_CB_PVP << 12));
-
- so_method(so, screen->tesla, NV50TCL_CB_DEF_ADDRESS_HIGH, 3);
- so_reloc (so, screen->constbuf_parm[PIPE_SHADER_GEOMETRY], 0,
- NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0);
- so_reloc (so, screen->constbuf_parm[PIPE_SHADER_GEOMETRY], 0,
- NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0);
- so_data (so, (NV50_CB_PGP << 16) | 0x00000800);
- so_method(so, screen->tesla, NV50TCL_SET_PROGRAM_CB, 1);
- so_data (so, 0x00000121 | (NV50_CB_PGP << 12));
-
- so_method(so, screen->tesla, NV50TCL_CB_DEF_ADDRESS_HIGH, 3);
- so_reloc (so, screen->constbuf_parm[PIPE_SHADER_FRAGMENT], 0,
- NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0);
- so_reloc (so, screen->constbuf_parm[PIPE_SHADER_FRAGMENT], 0,
- NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0);
- so_data (so, (NV50_CB_PFP << 16) | 0x00000800);
- so_method(so, screen->tesla, NV50TCL_SET_PROGRAM_CB, 1);
- so_data (so, 0x00000131 | (NV50_CB_PFP << 12));
-
- ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, PIPE_SHADER_TYPES*32*32,
+ ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, 3 * 32 * (8 * 4),
&screen->tic);
if (ret) {
nv50_screen_destroy(pscreen);
return NULL;
}
+ BEGIN_RING(chan, screen->tesla, NV50TCL_TIC_ADDRESS_HIGH, 3);
+ OUT_RELOCh(chan, screen->tic, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
+ OUT_RELOCl(chan, screen->tic, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
+ OUT_RING (chan, 3 * 32 - 1);
- so_method(so, screen->tesla, NV50TCL_TIC_ADDRESS_HIGH, 3);
- so_reloc (so, screen->tic, 0, NOUVEAU_BO_VRAM |
- NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0);
- so_reloc (so, screen->tic, 0, NOUVEAU_BO_VRAM |
- NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0);
- so_data (so, PIPE_SHADER_TYPES * 32 - 1);
-
- ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, PIPE_SHADER_TYPES*32*32,
+ ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, 3 * 32 * (8 * 4),
&screen->tsc);
if (ret) {
nv50_screen_destroy(pscreen);
return NULL;
}
-
- so_method(so, screen->tesla, NV50TCL_TSC_ADDRESS_HIGH, 3);
- so_reloc (so, screen->tsc, 0, NOUVEAU_BO_VRAM |
- NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0);
- so_reloc (so, screen->tsc, 0, NOUVEAU_BO_VRAM |
- NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0);
- so_data (so, 0x00000000); /* ignored if TSC_LINKED (0x1234) = 1 */
-
+ BEGIN_RING(chan, screen->tesla, NV50TCL_TSC_ADDRESS_HIGH, 3);
+ OUT_RELOCh(chan, screen->tsc, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
+ OUT_RELOCl(chan, screen->tsc, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
+ OUT_RING (chan, 0); /* ignored if TSC_LINKED (0x1234) == 1 */
+
+ /* map constant buffers:
+ * B = buffer ID (maybe more than 1 byte)
+ * N = CB index used in shader instruction
+ * P = program type (0 = VP, 2 = GP, 3 = FP)
+ * SET_PROGRAM_CB = 0x000BBNP1
+ */
+ BEGIN_RING_NI(chan, screen->tesla, NV50TCL_SET_PROGRAM_CB, 8);
+ /* bind immediate buffer */
+ OUT_RING (chan, 0x001 | (NV50_CB_PMISC << 12));
+ OUT_RING (chan, 0x021 | (NV50_CB_PMISC << 12));
+ OUT_RING (chan, 0x031 | (NV50_CB_PMISC << 12));
+ /* bind auxiliary constbuf to immediate data bo */
+ OUT_RING (chan, 0x201 | (NV50_CB_AUX << 12));
+ OUT_RING (chan, 0x221 | (NV50_CB_AUX << 12));
+ /* bind parameter buffers */
+ OUT_RING (chan, 0x101 | (NV50_CB_PVP << 12));
+ OUT_RING (chan, 0x121 | (NV50_CB_PGP << 12));
+ OUT_RING (chan, 0x131 | (NV50_CB_PFP << 12));
/* Vertex array limits - max them out */
for (i = 0; i < 16; i++) {
- so_method(so, screen->tesla, NV50TCL_VERTEX_ARRAY_LIMIT_HIGH(i), 2);
- so_data (so, 0x000000ff);
- so_data (so, 0xffffffff);
+ BEGIN_RING(chan, screen->tesla,
+ NV50TCL_VERTEX_ARRAY_LIMIT_HIGH(i), 2);
+ OUT_RING (chan, 0x000000ff);
+ OUT_RING (chan, 0xffffffff);
}
- so_method(so, screen->tesla, NV50TCL_DEPTH_RANGE_NEAR(0), 2);
- so_data (so, fui(0.0));
- so_data (so, fui(1.0));
+ BEGIN_RING(chan, screen->tesla, NV50TCL_DEPTH_RANGE_NEAR(0), 2);
+ OUT_RINGf (chan, 0.0f);
+ OUT_RINGf (chan, 1.0f);
/* no dynamic combination of TIC & TSC entries => only BIND_TIC used */
- so_method(so, screen->tesla, NV50TCL_LINKED_TSC, 1);
- so_data (so, 1);
-
- /* activate first scissor rectangle */
- so_method(so, screen->tesla, NV50TCL_SCISSOR_ENABLE(0), 1);
- so_data (so, 1);
+ BEGIN_RING(chan, screen->tesla, NV50TCL_LINKED_TSC, 1);
+ OUT_RING (chan, 1);
- so_method(so, screen->tesla, NV50TCL_EDGEFLAG_ENABLE, 1);
- so_data (so, 1); /* default edgeflag to TRUE */
+ BEGIN_RING(chan, screen->tesla, NV50TCL_EDGEFLAG_ENABLE, 1);
+ OUT_RING (chan, 1); /* default edgeflag to TRUE */
- so_emit(chan, so);
- so_ref (so, &screen->static_init);
- so_ref (NULL, &so);
- nouveau_pushbuf_flush(chan, 0);
+ FIRE_RING (chan);
+ screen->force_push = debug_get_bool_option("NV50_ALWAYS_PUSH", FALSE);
return pscreen;
}
diff --git a/src/gallium/drivers/nv50/nv50_screen.h b/src/gallium/drivers/nv50/nv50_screen.h
index 2687b72127..15bd4eed39 100644
--- a/src/gallium/drivers/nv50/nv50_screen.h
+++ b/src/gallium/drivers/nv50/nv50_screen.h
@@ -27,7 +27,7 @@ struct nv50_screen {
struct nouveau_bo *tic;
struct nouveau_bo *tsc;
- struct nouveau_stateobj *static_init;
+ boolean force_push;
};
static INLINE struct nv50_screen *
@@ -36,6 +36,6 @@ nv50_screen(struct pipe_screen *screen)
return (struct nv50_screen *)screen;
}
-void nv50_transfer_init_screen_functions(struct pipe_screen *);
+extern void nv50_screen_relocs(struct nv50_screen *);
#endif
diff --git a/src/gallium/drivers/nv50/nv50_state.c b/src/gallium/drivers/nv50/nv50_state.c
index 7d304907b6..c162808928 100644
--- a/src/gallium/drivers/nv50/nv50_state.c
+++ b/src/gallium/drivers/nv50/nv50_state.c
@@ -238,6 +238,9 @@ nv50_sampler_state_create(struct pipe_context *pipe,
return (void *)sso;
}
+/* type == 0 for VPs, 1 for GPs, 2 for FPs, which is how the
+ * relevant tesla methods are indexed (NV50TCL_BIND_TSC etc.)
+ */
static INLINE void
nv50_sampler_state_bind(struct pipe_context *pipe, unsigned type,
unsigned nr, void **sampler)
@@ -253,13 +256,13 @@ nv50_sampler_state_bind(struct pipe_context *pipe, unsigned type,
static void
nv50_vp_sampler_state_bind(struct pipe_context *pipe, unsigned nr, void **s)
{
- nv50_sampler_state_bind(pipe, PIPE_SHADER_VERTEX, nr, s);
+ nv50_sampler_state_bind(pipe, 0, nr, s);
}
static void
nv50_fp_sampler_state_bind(struct pipe_context *pipe, unsigned nr, void **s)
{
- nv50_sampler_state_bind(pipe, PIPE_SHADER_FRAGMENT, nr, s);
+ nv50_sampler_state_bind(pipe, 2, nr, s);
}
static void
@@ -269,40 +272,74 @@ nv50_sampler_state_delete(struct pipe_context *pipe, void *hwcso)
}
static INLINE void
-nv50_set_sampler_texture(struct pipe_context *pipe, unsigned type,
- unsigned nr, struct pipe_texture **pt)
+nv50_set_sampler_views(struct pipe_context *pipe, unsigned p,
+ unsigned nr,
+ struct pipe_sampler_view **views)
{
struct nv50_context *nv50 = nv50_context(pipe);
unsigned i;
for (i = 0; i < nr; i++)
- pipe_texture_reference((void *)&nv50->miptree[type][i], pt[i]);
- for (i = nr; i < nv50->miptree_nr[type]; i++)
- pipe_texture_reference((void *)&nv50->miptree[type][i], NULL);
+ pipe_sampler_view_reference(&nv50->sampler_views[p][i],
+ views[i]);
+
+ for (i = nr; i < nv50->sampler_view_nr[p]; i++)
+ pipe_sampler_view_reference(&nv50->sampler_views[p][i], NULL);
- nv50->miptree_nr[type] = nr;
+ nv50->sampler_view_nr[p] = nr;
nv50->dirty |= NV50_NEW_TEXTURE;
}
static void
-nv50_set_vp_sampler_textures(struct pipe_context *pipe,
- unsigned nr, struct pipe_texture **pt)
+nv50_set_vp_sampler_views(struct pipe_context *pipe,
+ unsigned nr,
+ struct pipe_sampler_view **views)
{
- nv50_set_sampler_texture(pipe, PIPE_SHADER_VERTEX, nr, pt);
+ nv50_set_sampler_views(pipe, 0, nr, views);
}
static void
-nv50_set_fp_sampler_textures(struct pipe_context *pipe,
- unsigned nr, struct pipe_texture **pt)
+nv50_set_fp_sampler_views(struct pipe_context *pipe,
+ unsigned nr,
+ struct pipe_sampler_view **views)
+{
+ nv50_set_sampler_views(pipe, 2, nr, views);
+}
+
+static void
+nv50_sampler_view_destroy(struct pipe_context *pipe,
+ struct pipe_sampler_view *view)
+{
+ pipe_texture_reference(&view->texture, NULL);
+ FREE(nv50_sampler_view(view));
+}
+
+static struct pipe_sampler_view *
+nv50_create_sampler_view(struct pipe_context *pipe,
+ struct pipe_texture *texture,
+ const struct pipe_sampler_view *templ)
{
- nv50_set_sampler_texture(pipe, PIPE_SHADER_FRAGMENT, nr, pt);
+ struct nv50_sampler_view *view = CALLOC_STRUCT(nv50_sampler_view);
+
+ view->pipe = *templ;
+ view->pipe.reference.count = 1;
+ view->pipe.texture = NULL;
+ pipe_texture_reference(&view->pipe.texture, texture);
+ view->pipe.context = pipe;
+
+ if (!nv50_tex_construct(view)) {
+ nv50_sampler_view_destroy(pipe, &view->pipe);
+ return NULL;
+ }
+ return &view->pipe;
}
+
static void *
nv50_rasterizer_state_create(struct pipe_context *pipe,
const struct pipe_rasterizer_state *cso)
{
- struct nouveau_stateobj *so = so_new(15, 21, 0);
+ struct nouveau_stateobj *so = so_new(16, 22, 0);
struct nouveau_grobj *tesla = nv50_context(pipe)->screen->tesla;
struct nv50_rasterizer_stateobj *rso =
CALLOC_STRUCT(nv50_rasterizer_stateobj);
@@ -314,6 +351,9 @@ nv50_rasterizer_state_create(struct pipe_context *pipe,
* - point_sprite / sprite_coord_mode
*/
+ so_method(so, tesla, NV50TCL_SCISSOR_ENABLE(0), 1);
+ so_data (so, cso->scissor);
+
so_method(so, tesla, NV50TCL_SHADE_MODEL, 1);
so_data (so, cso->flatshade ? NV50TCL_SHADE_MODEL_FLAT :
NV50TCL_SHADE_MODEL_SMOOTH);
@@ -720,15 +760,34 @@ nv50_set_vertex_buffers(struct pipe_context *pipe, unsigned count,
nv50->dirty |= NV50_NEW_ARRAYS;
}
+static void *
+nv50_vtxelts_state_create(struct pipe_context *pipe,
+ unsigned num_elements,
+ const struct pipe_vertex_element *elements)
+{
+ struct nv50_vtxelt_stateobj *cso = CALLOC_STRUCT(nv50_vtxelt_stateobj);
+
+ assert(num_elements < 16); /* not doing fallbacks yet */
+ cso->num_elements = num_elements;
+ memcpy(cso->pipe, elements, num_elements * sizeof(*elements));
+
+ nv50_vtxelt_construct(cso);
+
+ return (void *)cso;
+}
+
static void
-nv50_set_vertex_elements(struct pipe_context *pipe, unsigned count,
- const struct pipe_vertex_element *ve)
+nv50_vtxelts_state_delete(struct pipe_context *pipe, void *hwcso)
{
- struct nv50_context *nv50 = nv50_context(pipe);
+ FREE(hwcso);
+}
- memcpy(nv50->vtxelt, ve, sizeof(*ve) * count);
- nv50->vtxelt_nr = count;
+static void
+nv50_vtxelts_state_bind(struct pipe_context *pipe, void *hwcso)
+{
+ struct nv50_context *nv50 = nv50_context(pipe);
+ nv50->vtxelt = hwcso;
nv50->dirty |= NV50_NEW_ARRAYS;
}
@@ -743,8 +802,10 @@ nv50_init_state_functions(struct nv50_context *nv50)
nv50->pipe.delete_sampler_state = nv50_sampler_state_delete;
nv50->pipe.bind_fragment_sampler_states = nv50_fp_sampler_state_bind;
nv50->pipe.bind_vertex_sampler_states = nv50_vp_sampler_state_bind;
- nv50->pipe.set_fragment_sampler_textures = nv50_set_fp_sampler_textures;
- nv50->pipe.set_vertex_sampler_textures = nv50_set_vp_sampler_textures;
+ nv50->pipe.set_fragment_sampler_views = nv50_set_fp_sampler_views;
+ nv50->pipe.set_vertex_sampler_views = nv50_set_vp_sampler_views;
+ nv50->pipe.create_sampler_view = nv50_create_sampler_view;
+ nv50->pipe.sampler_view_destroy = nv50_sampler_view_destroy;
nv50->pipe.create_rasterizer_state = nv50_rasterizer_state_create;
nv50->pipe.bind_rasterizer_state = nv50_rasterizer_state_bind;
@@ -778,7 +839,10 @@ nv50_init_state_functions(struct nv50_context *nv50)
nv50->pipe.set_scissor_state = nv50_set_scissor_state;
nv50->pipe.set_viewport_state = nv50_set_viewport_state;
+ nv50->pipe.create_vertex_elements_state = nv50_vtxelts_state_create;
+ nv50->pipe.delete_vertex_elements_state = nv50_vtxelts_state_delete;
+ nv50->pipe.bind_vertex_elements_state = nv50_vtxelts_state_bind;
+
nv50->pipe.set_vertex_buffers = nv50_set_vertex_buffers;
- nv50->pipe.set_vertex_elements = nv50_set_vertex_elements;
}
diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c
index c974cc92dc..402045416c 100644
--- a/src/gallium/drivers/nv50/nv50_state_validate.c
+++ b/src/gallium/drivers/nv50/nv50_state_validate.c
@@ -25,8 +25,8 @@
#include "nv50_context.h"
#include "nouveau/nouveau_stateobj.h"
-static void
-nv50_state_validate_fb(struct nv50_context *nv50)
+static struct nouveau_stateobj *
+validate_fb(struct nv50_context *nv50)
{
struct nouveau_grobj *tesla = nv50->screen->tesla;
struct nouveau_stateobj *so = so_new(32, 79, 18);
@@ -122,13 +122,13 @@ nv50_state_validate_fb(struct nv50_context *nv50)
so_reloc (so, bo, fb->zsbuf->offset, NOUVEAU_BO_VRAM |
NOUVEAU_BO_LOW | NOUVEAU_BO_RDWR, 0, 0);
switch (fb->zsbuf->format) {
- case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
so_data(so, NV50TCL_ZETA_FORMAT_S8Z24_UNORM);
break;
case PIPE_FORMAT_Z24X8_UNORM:
so_data(so, NV50TCL_ZETA_FORMAT_X8Z24_UNORM);
break;
- case PIPE_FORMAT_S8Z24_UNORM:
+ case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
so_data(so, NV50TCL_ZETA_FORMAT_Z24S8_UNORM);
break;
case PIPE_FORMAT_Z32_FLOAT:
@@ -167,12 +167,7 @@ nv50_state_validate_fb(struct nv50_context *nv50)
so_data (so, w << 16);
so_data (so, h << 16);
- /* we set scissors to framebuffer size when they're 'turned off' */
- nv50->dirty |= NV50_NEW_SCISSOR;
- so_ref(NULL, &nv50->state.scissor);
-
- so_ref(so, &nv50->state.fb);
- so_ref(NULL, &so);
+ return so;
}
static void
@@ -199,263 +194,254 @@ nv50_validate_samplers(struct nv50_context *nv50, struct nouveau_stateobj *so,
}
}
-static void
-nv50_state_emit(struct nv50_context *nv50)
+static struct nouveau_stateobj *
+validate_blend(struct nv50_context *nv50)
{
- struct nv50_screen *screen = nv50->screen;
- struct nouveau_channel *chan = screen->base.channel;
+ struct nouveau_stateobj *so = NULL;
+ so_ref(nv50->blend->so, &so);
+ return so;
+}
- /* XXX: this is racy for multiple contexts active on separate
- * threads.
- */
- if (screen->cur_ctx != nv50) {
- if (nv50->state.fb)
- nv50->state.dirty |= NV50_NEW_FRAMEBUFFER;
- if (nv50->state.blend)
- nv50->state.dirty |= NV50_NEW_BLEND;
- if (nv50->state.zsa)
- nv50->state.dirty |= NV50_NEW_ZSA;
- if (nv50->state.vertprog)
- nv50->state.dirty |= NV50_NEW_VERTPROG;
- if (nv50->state.fragprog)
- nv50->state.dirty |= NV50_NEW_FRAGPROG;
- if (nv50->state.geomprog)
- nv50->state.dirty |= NV50_NEW_GEOMPROG;
- if (nv50->state.rast)
- nv50->state.dirty |= NV50_NEW_RASTERIZER;
- if (nv50->state.blend_colour)
- nv50->state.dirty |= NV50_NEW_BLEND_COLOUR;
- if (nv50->state.stencil_ref)
- nv50->state.dirty |= NV50_NEW_STENCIL_REF;
- if (nv50->state.stipple)
- nv50->state.dirty |= NV50_NEW_STIPPLE;
- if (nv50->state.scissor)
- nv50->state.dirty |= NV50_NEW_SCISSOR;
- if (nv50->state.viewport)
- nv50->state.dirty |= NV50_NEW_VIEWPORT;
- if (nv50->state.tsc_upload)
- nv50->state.dirty |= NV50_NEW_SAMPLER;
- if (nv50->state.tic_upload)
- nv50->state.dirty |= NV50_NEW_TEXTURE;
- if (nv50->state.vtxfmt && nv50->state.vtxbuf)
- nv50->state.dirty |= NV50_NEW_ARRAYS;
- screen->cur_ctx = nv50;
- }
+static struct nouveau_stateobj *
+validate_zsa(struct nv50_context *nv50)
+{
+ struct nouveau_stateobj *so = NULL;
+ so_ref(nv50->zsa->so, &so);
+ return so;
+}
- if (nv50->state.dirty & NV50_NEW_FRAMEBUFFER)
- so_emit(chan, nv50->state.fb);
- if (nv50->state.dirty & NV50_NEW_BLEND)
- so_emit(chan, nv50->state.blend);
- if (nv50->state.dirty & NV50_NEW_ZSA)
- so_emit(chan, nv50->state.zsa);
- if (nv50->state.dirty & NV50_NEW_VERTPROG)
- so_emit(chan, nv50->state.vertprog);
- if (nv50->state.dirty & NV50_NEW_FRAGPROG)
- so_emit(chan, nv50->state.fragprog);
- if (nv50->state.dirty & NV50_NEW_GEOMPROG && nv50->state.geomprog)
- so_emit(chan, nv50->state.geomprog);
- if (nv50->state.dirty & (NV50_NEW_FRAGPROG | NV50_NEW_VERTPROG |
- NV50_NEW_GEOMPROG | NV50_NEW_RASTERIZER))
- so_emit(chan, nv50->state.fp_linkage);
- if ((nv50->state.dirty & (NV50_NEW_VERTPROG | NV50_NEW_GEOMPROG))
- && nv50->state.gp_linkage)
- so_emit(chan, nv50->state.gp_linkage);
- if (nv50->state.dirty & NV50_NEW_RASTERIZER)
- so_emit(chan, nv50->state.rast);
- if (nv50->state.dirty & NV50_NEW_BLEND_COLOUR)
- so_emit(chan, nv50->state.blend_colour);
- if (nv50->state.dirty & NV50_NEW_STENCIL_REF)
- so_emit(chan, nv50->state.stencil_ref);
- if (nv50->state.dirty & NV50_NEW_STIPPLE)
- so_emit(chan, nv50->state.stipple);
- if (nv50->state.dirty & NV50_NEW_SCISSOR)
- so_emit(chan, nv50->state.scissor);
- if (nv50->state.dirty & NV50_NEW_VIEWPORT)
- so_emit(chan, nv50->state.viewport);
- if (nv50->state.dirty & NV50_NEW_SAMPLER)
- so_emit(chan, nv50->state.tsc_upload);
- if (nv50->state.dirty & NV50_NEW_TEXTURE)
- so_emit(chan, nv50->state.tic_upload);
- if (nv50->state.dirty & NV50_NEW_ARRAYS) {
- so_emit(chan, nv50->state.vtxfmt);
- so_emit(chan, nv50->state.vtxbuf);
- if (nv50->state.vtxattr)
- so_emit(chan, nv50->state.vtxattr);
- }
- nv50->state.dirty = 0;
+static struct nouveau_stateobj *
+validate_rast(struct nv50_context *nv50)
+{
+ struct nouveau_stateobj *so = NULL;
+ so_ref(nv50->rasterizer->so, &so);
+ return so;
+}
+
+static struct nouveau_stateobj *
+validate_blend_colour(struct nv50_context *nv50)
+{
+ struct nouveau_grobj *tesla = nv50->screen->tesla;
+ struct nouveau_stateobj *so = so_new(1, 4, 0);
+
+ so_method(so, tesla, NV50TCL_BLEND_COLOR(0), 4);
+ so_data (so, fui(nv50->blend_colour.color[0]));
+ so_data (so, fui(nv50->blend_colour.color[1]));
+ so_data (so, fui(nv50->blend_colour.color[2]));
+ so_data (so, fui(nv50->blend_colour.color[3]));
+ return so;
}
-void
-nv50_state_flush_notify(struct nouveau_channel *chan)
+static struct nouveau_stateobj *
+validate_stencil_ref(struct nv50_context *nv50)
{
- struct nv50_context *nv50 = chan->user_private;
+ struct nouveau_grobj *tesla = nv50->screen->tesla;
+ struct nouveau_stateobj *so = so = so_new(2, 2, 0);
- if (nv50->state.tic_upload && !(nv50->dirty & NV50_NEW_TEXTURE))
- so_emit(chan, nv50->state.tic_upload);
+ so_method(so, tesla, NV50TCL_STENCIL_FRONT_FUNC_REF, 1);
+ so_data (so, nv50->stencil_ref.ref_value[0]);
+ so_method(so, tesla, NV50TCL_STENCIL_BACK_FUNC_REF, 1);
+ so_data (so, nv50->stencil_ref.ref_value[1]);
+ return so;
+}
- so_emit_reloc_markers(chan, nv50->state.fb);
- so_emit_reloc_markers(chan, nv50->state.vertprog);
- so_emit_reloc_markers(chan, nv50->state.fragprog);
- so_emit_reloc_markers(chan, nv50->state.vtxbuf);
- so_emit_reloc_markers(chan, nv50->screen->static_init);
+static struct nouveau_stateobj *
+validate_stipple(struct nv50_context *nv50)
+{
+ struct nouveau_grobj *tesla = nv50->screen->tesla;
+ struct nouveau_stateobj *so = so_new(1, 32, 0);
+ int i;
- if (nv50->state.instbuf)
- so_emit_reloc_markers(chan, nv50->state.instbuf);
+ so_method(so, tesla, NV50TCL_POLYGON_STIPPLE_PATTERN(0), 32);
+ for (i = 0; i < 32; i++)
+ so_data(so, util_bswap32(nv50->stipple.stipple[i]));
+ return so;
}
-boolean
-nv50_state_validate(struct nv50_context *nv50)
+static struct nouveau_stateobj *
+validate_scissor(struct nv50_context *nv50)
{
struct nouveau_grobj *tesla = nv50->screen->tesla;
+ struct pipe_scissor_state *s = &nv50->scissor;
struct nouveau_stateobj *so;
- unsigned i;
-
- if (nv50->dirty & NV50_NEW_FRAMEBUFFER)
- nv50_state_validate_fb(nv50);
- if (nv50->dirty & NV50_NEW_BLEND)
- so_ref(nv50->blend->so, &nv50->state.blend);
+ so = so_new(1, 2, 0);
+ so_method(so, tesla, NV50TCL_SCISSOR_HORIZ(0), 2);
+ so_data (so, (s->maxx << 16) | s->minx);
+ so_data (so, (s->maxy << 16) | s->miny);
+ return so;
+}
- if (nv50->dirty & NV50_NEW_ZSA)
- so_ref(nv50->zsa->so, &nv50->state.zsa);
+static struct nouveau_stateobj *
+validate_viewport(struct nv50_context *nv50)
+{
+ struct nouveau_grobj *tesla = nv50->screen->tesla;
+ struct nouveau_stateobj *so = so_new(5, 9, 0);
+
+ so_method(so, tesla, NV50TCL_VIEWPORT_TRANSLATE_X(0), 3);
+ so_data (so, fui(nv50->viewport.translate[0]));
+ so_data (so, fui(nv50->viewport.translate[1]));
+ so_data (so, fui(nv50->viewport.translate[2]));
+ so_method(so, tesla, NV50TCL_VIEWPORT_SCALE_X(0), 3);
+ so_data (so, fui(nv50->viewport.scale[0]));
+ so_data (so, fui(nv50->viewport.scale[1]));
+ so_data (so, fui(nv50->viewport.scale[2]));
+
+ so_method(so, tesla, NV50TCL_VIEWPORT_TRANSFORM_EN, 1);
+ so_data (so, 1);
+ /* 0x0000 = remove whole primitive only (xyz)
+ * 0x1018 = remove whole primitive only (xy), clamp z
+ * 0x1080 = clip primitive (xyz)
+ * 0x1098 = clip primitive (xy), clamp z
+ */
+ so_method(so, tesla, NV50TCL_VIEW_VOLUME_CLIP_CTRL, 1);
+ so_data (so, 0x1080);
+ /* no idea what 0f90 does */
+ so_method(so, tesla, 0x0f90, 1);
+ so_data (so, 0);
- if (nv50->dirty & (NV50_NEW_VERTPROG | NV50_NEW_VERTPROG_CB))
- nv50_vertprog_validate(nv50);
+ return so;
+}
- if (nv50->dirty & (NV50_NEW_FRAGPROG | NV50_NEW_FRAGPROG_CB))
- nv50_fragprog_validate(nv50);
+static struct nouveau_stateobj *
+validate_sampler(struct nv50_context *nv50)
+{
+ struct nouveau_grobj *tesla = nv50->screen->tesla;
+ struct nouveau_stateobj *so;
+ unsigned nr = 0, i;
- if (nv50->dirty & (NV50_NEW_GEOMPROG | NV50_NEW_GEOMPROG_CB))
- nv50_geomprog_validate(nv50);
+ for (i = 0; i < 3; ++i)
+ nr += nv50->sampler_nr[i];
- if (nv50->dirty & (NV50_NEW_FRAGPROG | NV50_NEW_VERTPROG |
- NV50_NEW_GEOMPROG | NV50_NEW_RASTERIZER))
- nv50_fp_linkage_validate(nv50);
+ so = so_new(1 + 5 * 3, 1 + 19 * 3 + nr * 8, 3 * 2);
- if (nv50->dirty & (NV50_NEW_GEOMPROG | NV50_NEW_VERTPROG))
- nv50_gp_linkage_validate(nv50);
+ nv50_validate_samplers(nv50, so, 0); /* VP */
+ nv50_validate_samplers(nv50, so, 2); /* FP */
- if (nv50->dirty & NV50_NEW_RASTERIZER)
- so_ref(nv50->rasterizer->so, &nv50->state.rast);
+ so_method(so, tesla, 0x1334, 1); /* flush TSC */
+ so_data (so, 0);
- if (nv50->dirty & NV50_NEW_BLEND_COLOUR) {
- so = so_new(1, 4, 0);
- so_method(so, tesla, NV50TCL_BLEND_COLOR(0), 4);
- so_data (so, fui(nv50->blend_colour.color[0]));
- so_data (so, fui(nv50->blend_colour.color[1]));
- so_data (so, fui(nv50->blend_colour.color[2]));
- so_data (so, fui(nv50->blend_colour.color[3]));
- so_ref(so, &nv50->state.blend_colour);
- so_ref(NULL, &so);
- }
+ return so;
+}
- if (nv50->dirty & NV50_NEW_STENCIL_REF) {
- so = so_new(2, 2, 0);
- so_method(so, tesla, NV50TCL_STENCIL_FRONT_FUNC_REF, 1);
- so_data (so, nv50->stencil_ref.ref_value[0]);
- so_method(so, tesla, NV50TCL_STENCIL_BACK_FUNC_REF, 1);
- so_data (so, nv50->stencil_ref.ref_value[1]);
- so_ref(so, &nv50->state.stencil_ref);
- so_ref(NULL, &so);
- }
+static struct nouveau_stateobj *
+validate_vtxbuf(struct nv50_context *nv50)
+{
+ struct nouveau_stateobj *so = NULL;
+ so_ref(nv50->state.vtxbuf, &so);
+ return so;
+}
- if (nv50->dirty & NV50_NEW_STIPPLE) {
- so = so_new(1, 32, 0);
- so_method(so, tesla, NV50TCL_POLYGON_STIPPLE_PATTERN(0), 32);
- for (i = 0; i < 32; i++)
- so_data(so, util_bswap32(nv50->stipple.stipple[i]));
- so_ref(so, &nv50->state.stipple);
- so_ref(NULL, &so);
- }
+static struct nouveau_stateobj *
+validate_vtxattr(struct nv50_context *nv50)
+{
+ struct nouveau_stateobj *so = NULL;
+ so_ref(nv50->state.vtxattr, &so);
+ return so;
+}
- if (nv50->dirty & (NV50_NEW_SCISSOR | NV50_NEW_RASTERIZER)) {
- struct pipe_rasterizer_state *rast = &nv50->rasterizer->pipe;
- struct pipe_scissor_state *s = &nv50->scissor;
+struct state_validate {
+ struct nouveau_stateobj *(*func)(struct nv50_context *nv50);
+ unsigned states;
+} validate_list[] = {
+ { validate_fb , NV50_NEW_FRAMEBUFFER },
+ { validate_blend , NV50_NEW_BLEND },
+ { validate_zsa , NV50_NEW_ZSA },
+ { nv50_vertprog_validate , NV50_NEW_VERTPROG | NV50_NEW_VERTPROG_CB },
+ { nv50_fragprog_validate , NV50_NEW_FRAGPROG | NV50_NEW_FRAGPROG_CB },
+ { nv50_geomprog_validate , NV50_NEW_GEOMPROG | NV50_NEW_GEOMPROG_CB },
+ { nv50_fp_linkage_validate, NV50_NEW_VERTPROG | NV50_NEW_GEOMPROG |
+ NV50_NEW_FRAGPROG | NV50_NEW_RASTERIZER },
+ { nv50_gp_linkage_validate, NV50_NEW_VERTPROG | NV50_NEW_GEOMPROG },
+ { validate_rast , NV50_NEW_RASTERIZER },
+ { validate_blend_colour , NV50_NEW_BLEND_COLOUR },
+ { validate_stencil_ref , NV50_NEW_STENCIL_REF },
+ { validate_stipple , NV50_NEW_STIPPLE },
+ { validate_scissor , NV50_NEW_SCISSOR },
+ { validate_viewport , NV50_NEW_VIEWPORT },
+ { validate_sampler , NV50_NEW_SAMPLER },
+ { nv50_tex_validate , NV50_NEW_TEXTURE | NV50_NEW_SAMPLER },
+ { nv50_vbo_validate , NV50_NEW_ARRAYS },
+ { validate_vtxbuf , NV50_NEW_ARRAYS },
+ { validate_vtxattr , NV50_NEW_ARRAYS },
+ {}
+};
+#define validate_list_len (sizeof(validate_list) / sizeof(validate_list[0]))
- if (nv50->state.scissor &&
- (rast->scissor == 0 && nv50->state.scissor_enabled == 0))
- goto scissor_uptodate;
- nv50->state.scissor_enabled = rast->scissor;
+boolean
+nv50_state_validate(struct nv50_context *nv50, unsigned wait_dwords)
+{
+ struct nouveau_channel *chan = nv50->screen->base.channel;
+ struct nouveau_grobj *tesla = nv50->screen->tesla;
+ unsigned nr_relocs = 128, nr_dwords = wait_dwords + 128 + 4;
+ int ret, i;
- so = so_new(1, 2, 0);
- so_method(so, tesla, NV50TCL_SCISSOR_HORIZ(0), 2);
- if (nv50->state.scissor_enabled) {
- so_data(so, (s->maxx << 16) | s->minx);
- so_data(so, (s->maxy << 16) | s->miny);
- } else {
- so_data(so, (nv50->framebuffer.width << 16));
- so_data(so, (nv50->framebuffer.height << 16));
- }
- so_ref(so, &nv50->state.scissor);
- so_ref(NULL, &so);
- nv50->state.dirty |= NV50_NEW_SCISSOR;
- }
-scissor_uptodate:
-
- if (nv50->dirty & (NV50_NEW_VIEWPORT | NV50_NEW_RASTERIZER)) {
- if (nv50->state.viewport &&
- !(nv50->dirty & NV50_NEW_VIEWPORT))
- goto viewport_uptodate;
-
- so = so_new(5, 9, 0);
- so_method(so, tesla, NV50TCL_VIEWPORT_TRANSLATE_X(0), 3);
- so_data (so, fui(nv50->viewport.translate[0]));
- so_data (so, fui(nv50->viewport.translate[1]));
- so_data (so, fui(nv50->viewport.translate[2]));
- so_method(so, tesla, NV50TCL_VIEWPORT_SCALE_X(0), 3);
- so_data (so, fui(nv50->viewport.scale[0]));
- so_data (so, fui(nv50->viewport.scale[1]));
- so_data (so, fui(nv50->viewport.scale[2]));
-
- so_method(so, tesla, NV50TCL_VIEWPORT_TRANSFORM_EN, 1);
- so_data (so, 1);
- /* 0x0000 = remove whole primitive only (xyz)
- * 0x1018 = remove whole primitive only (xy), clamp z
- * 0x1080 = clip primitive (xyz)
- * 0x1098 = clip primitive (xy), clamp z
- */
- so_method(so, tesla, NV50TCL_VIEW_VOLUME_CLIP_CTRL, 1);
- so_data (so, 0x1080);
- /* no idea what 0f90 does */
- so_method(so, tesla, 0x0f90, 1);
- so_data (so, 0);
+ for (i = 0; i < validate_list_len; i++) {
+ struct state_validate *validate = &validate_list[i];
+ struct nouveau_stateobj *so;
- so_ref(so, &nv50->state.viewport);
- so_ref(NULL, &so);
- nv50->state.dirty |= NV50_NEW_VIEWPORT;
- }
-viewport_uptodate:
+ if (!(nv50->dirty & validate->states))
+ continue;
- if (nv50->dirty & NV50_NEW_SAMPLER) {
- unsigned nr = 0;
+ so = validate->func(nv50);
+ if (!so)
+ continue;
- for (i = 0; i < PIPE_SHADER_TYPES; ++i)
- nr += nv50->sampler_nr[i];
+ nr_dwords += (so->total + so->cur);
+ nr_relocs += so->cur_reloc;
- so = so_new(1 + 5 * PIPE_SHADER_TYPES,
- 1 + 19 * PIPE_SHADER_TYPES + nr * 8,
- PIPE_SHADER_TYPES * 2);
+ so_ref(so, &nv50->state.hw[i]);
+ so_ref(NULL, &so);
+ nv50->state.hw_dirty |= (1 << i);
+ }
+ nv50->dirty = 0;
- nv50_validate_samplers(nv50, so, PIPE_SHADER_VERTEX);
- nv50_validate_samplers(nv50, so, PIPE_SHADER_FRAGMENT);
+ if (nv50->screen->cur_ctx != nv50) {
+ for (i = 0; i < validate_list_len; i++) {
+ if (!nv50->state.hw[i] ||
+ (nv50->state.hw_dirty & (1 << i)))
+ continue;
- so_method(so, tesla, 0x1334, 1); /* flush TSC */
- so_data (so, 0);
+ nr_dwords += (nv50->state.hw[i]->total +
+ nv50->state.hw[i]->cur);
+ nr_relocs += nv50->state.hw[i]->cur_reloc;
+ nv50->state.hw_dirty |= (1 << i);
+ }
- so_ref(so, &nv50->state.tsc_upload);
- so_ref(NULL, &so);
+ nv50->screen->cur_ctx = nv50;
}
- if (nv50->dirty & (NV50_NEW_TEXTURE | NV50_NEW_SAMPLER))
- nv50_tex_validate(nv50);
+ ret = MARK_RING(chan, nr_dwords, nr_relocs);
+ if (ret) {
+ debug_printf("MARK_RING(%d, %d) failed: %d\n",
+ nr_dwords, nr_relocs, ret);
+ return FALSE;
+ }
- if (nv50->dirty & NV50_NEW_ARRAYS)
- nv50_vbo_validate(nv50);
+ while (nv50->state.hw_dirty) {
+ i = ffs(nv50->state.hw_dirty) - 1;
+ nv50->state.hw_dirty &= ~(1 << i);
- nv50->state.dirty |= nv50->dirty;
- nv50->dirty = 0;
- nv50_state_emit(nv50);
+ so_emit(chan, nv50->state.hw[i]);
+ }
+ /* Yes, really, we need to do this. If a buffer that is referenced
+ * on the hardware isn't part of changed state above, without doing
+ * this the kernel is given no clue that the buffer is being used
+ * still. This can cause all sorts of fun issues.
+ */
+ nv50_tex_relocs(nv50);
+ so_emit_reloc_markers(chan, nv50->state.hw[0]); /* fb */
+ so_emit_reloc_markers(chan, nv50->state.hw[3]); /* vp */
+ so_emit_reloc_markers(chan, nv50->state.hw[4]); /* fp */
+ so_emit_reloc_markers(chan, nv50->state.hw[17]); /* vb */
+ nv50_screen_relocs(nv50->screen);
+
+ /* No idea.. */
+ BEGIN_RING(chan, tesla, 0x142c, 1);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, tesla, 0x142c, 1);
+ OUT_RING (chan, 0);
return TRUE;
}
diff --git a/src/gallium/drivers/nv50/nv50_surface.c b/src/gallium/drivers/nv50/nv50_surface.c
index cabd148bc5..7a9dada531 100644
--- a/src/gallium/drivers/nv50/nv50_surface.c
+++ b/src/gallium/drivers/nv50/nv50_surface.c
@@ -28,6 +28,7 @@
#include "util/u_inlines.h"
#include "util/u_tile.h"
+#include "util/u_format.h"
static INLINE int
nv50_format(enum pipe_format format)
@@ -37,10 +38,35 @@ nv50_format(enum pipe_format format)
return NV50_2D_DST_FORMAT_A8R8G8B8_UNORM;
case PIPE_FORMAT_B8G8R8X8_UNORM:
return NV50_2D_DST_FORMAT_X8R8G8B8_UNORM;
+ case PIPE_FORMAT_B8G8R8A8_SRGB:
+ return NV50_2D_DST_FORMAT_A8R8G8B8_SRGB;
+ case PIPE_FORMAT_B8G8R8X8_SRGB:
+ return NV50_2D_DST_FORMAT_X8R8G8B8_SRGB;
case PIPE_FORMAT_B5G6R5_UNORM:
return NV50_2D_DST_FORMAT_R5G6B5_UNORM;
+ case PIPE_FORMAT_B5G5R5A1_UNORM:
+ return NV50_2D_DST_FORMAT_A1R5G5B5_UNORM;
case PIPE_FORMAT_A8_UNORM:
+ case PIPE_FORMAT_I8_UNORM:
+ case PIPE_FORMAT_L8_UNORM:
return NV50_2D_DST_FORMAT_R8_UNORM;
+ case PIPE_FORMAT_R32G32B32A32_FLOAT:
+ return NV50_2D_DST_FORMAT_R32G32B32A32_FLOAT;
+ case PIPE_FORMAT_R32G32B32_FLOAT:
+ return NV50_2D_DST_FORMAT_R32G32B32X32_FLOAT;
+ case PIPE_FORMAT_Z32_FLOAT:
+ return NV50_2D_DST_FORMAT_R32_FLOAT;
+
+ /* only because we require src format == dst format: */
+ case PIPE_FORMAT_R16G16_SNORM:
+ case PIPE_FORMAT_R16G16_UNORM:
+ case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
+ return NV50_2D_DST_FORMAT_A8R8G8B8_UNORM;
+ case PIPE_FORMAT_L8A8_UNORM:
+ case PIPE_FORMAT_B4G4R4A4_UNORM:
+ return NV50_2D_DST_FORMAT_R16_UNORM;
+
default:
return -1;
}
@@ -57,8 +83,11 @@ nv50_surface_set(struct nv50_screen *screen, struct pipe_surface *ps, int dst)
int flags = NOUVEAU_BO_VRAM | (dst ? NOUVEAU_BO_WR : NOUVEAU_BO_RD);
format = nv50_format(ps->format);
- if (format < 0)
+ if (format < 0) {
+ NOUVEAU_ERR("invalid/unsupported surface format: %s\n",
+ util_format_name(ps->format));
return 1;
+ }
if (!bo->tile_flags) {
MARK_RING (chan, 9, 2); /* flush on lack of space or relocs */
diff --git a/src/gallium/drivers/nv50/nv50_tex.c b/src/gallium/drivers/nv50/nv50_tex.c
index de0560e20c..d094b490ed 100644
--- a/src/gallium/drivers/nv50/nv50_tex.c
+++ b/src/gallium/drivers/nv50/nv50_tex.c
@@ -24,30 +24,21 @@
#include "nv50_texture.h"
#include "nouveau/nouveau_stateobj.h"
+#include "nouveau/nouveau_reloc.h"
#include "util/u_format.h"
#define _MIXED(pf, t0, t1, t2, t3, cr, cg, cb, ca, f) \
-{ \
- PIPE_FORMAT_##pf, \
+[PIPE_FORMAT_##pf] = ( \
NV50TIC_0_0_MAPR_##cr | NV50TIC_0_0_TYPER_##t0 | \
NV50TIC_0_0_MAPG_##cg | NV50TIC_0_0_TYPEG_##t1 | \
NV50TIC_0_0_MAPB_##cb | NV50TIC_0_0_TYPEB_##t2 | \
NV50TIC_0_0_MAPA_##ca | NV50TIC_0_0_TYPEA_##t3 | \
- NV50TIC_0_0_FMT_##f \
-}
+ NV50TIC_0_0_FMT_##f)
#define _(pf, t, cr, cg, cb, ca, f) _MIXED(pf, t, t, t, t, cr, cg, cb, ca, f)
-struct nv50_texture_format {
- enum pipe_format pf;
- uint32_t hw;
-};
-
-#define NV50_TEX_FORMAT_LIST_SIZE \
- (sizeof(nv50_tex_format_list) / sizeof(struct nv50_texture_format))
-
-static const struct nv50_texture_format nv50_tex_format_list[] =
+static const uint32_t nv50_texture_formats[PIPE_FORMAT_COUNT] =
{
_(B8G8R8A8_UNORM, UNORM, C2, C1, C0, C3, 8_8_8_8),
_(B8G8R8A8_SRGB, UNORM, C2, C1, C0, C3, 8_8_8_8),
@@ -59,18 +50,20 @@ static const struct nv50_texture_format nv50_tex_format_list[] =
_(B5G6R5_UNORM, UNORM, C2, C1, C0, ONE, 5_6_5),
_(L8_UNORM, UNORM, C0, C0, C0, ONE, 8),
+ _(L8_SRGB, UNORM, C0, C0, C0, ONE, 8),
_(A8_UNORM, UNORM, ZERO, ZERO, ZERO, C0, 8),
_(I8_UNORM, UNORM, C0, C0, C0, C0, 8),
_(L8A8_UNORM, UNORM, C0, C0, C0, C1, 8_8),
+ _(L8A8_SRGB, UNORM, C0, C0, C0, C1, 8_8),
_(DXT1_RGB, UNORM, C0, C1, C2, ONE, DXT1),
_(DXT1_RGBA, UNORM, C0, C1, C2, C3, DXT1),
_(DXT3_RGBA, UNORM, C0, C1, C2, C3, DXT3),
_(DXT5_RGBA, UNORM, C0, C1, C2, C3, DXT5),
- _MIXED(S8Z24_UNORM, UINT, UNORM, UINT, UINT, C1, C1, C1, ONE, 24_8),
- _MIXED(Z24S8_UNORM, UNORM, UINT, UINT, UINT, C0, C0, C0, ONE, 8_24),
+ _MIXED(S8_USCALED_Z24_UNORM, UINT, UNORM, UINT, UINT, C1, C1, C1, ONE, 24_8),
+ _MIXED(Z24_UNORM_S8_USCALED, UNORM, UINT, UINT, UINT, C0, C0, C0, ONE, 8_24),
_(R16G16B16A16_SNORM, UNORM, C0, C1, C2, C3, 16_16_16_16),
_(R16G16B16A16_UNORM, SNORM, C0, C1, C2, C3, 16_16_16_16),
@@ -80,149 +73,207 @@ static const struct nv50_texture_format nv50_tex_format_list[] =
_(R16G16_UNORM, UNORM, C0, C1, ZERO, ONE, 16_16),
_MIXED(Z32_FLOAT, FLOAT, UINT, UINT, UINT, C0, C0, C0, ONE, 32_DEPTH)
-
};
#undef _
#undef _MIXED
-static int
-nv50_tex_construct(struct nv50_context *nv50, struct nouveau_stateobj *so,
- struct nv50_miptree *mt, int unit, unsigned p)
+static INLINE uint32_t
+nv50_tic_swizzle(uint32_t tc, unsigned swz)
+{
+ switch (swz) {
+ case PIPE_SWIZZLE_RED:
+ return (tc & NV50TIC_0_0_MAPR_MASK) >> NV50TIC_0_0_MAPR_SHIFT;
+ case PIPE_SWIZZLE_GREEN:
+ return (tc & NV50TIC_0_0_MAPG_MASK) >> NV50TIC_0_0_MAPG_SHIFT;
+ case PIPE_SWIZZLE_BLUE:
+ return (tc & NV50TIC_0_0_MAPB_MASK) >> NV50TIC_0_0_MAPB_SHIFT;
+ case PIPE_SWIZZLE_ALPHA:
+ return (tc & NV50TIC_0_0_MAPA_MASK) >> NV50TIC_0_0_MAPA_SHIFT;
+ case PIPE_SWIZZLE_ONE:
+ return 7;
+ case PIPE_SWIZZLE_ZERO:
+ default:
+ return 0;
+ }
+}
+
+boolean
+nv50_tex_construct(struct nv50_sampler_view *view)
{
- unsigned i;
- uint32_t mode;
const struct util_format_description *desc;
+ struct nv50_miptree *mt = nv50_miptree(view->pipe.texture);
+ uint32_t swz[4], *tic = view->tic;
- for (i = 0; i < NV50_TEX_FORMAT_LIST_SIZE; i++)
- if (nv50_tex_format_list[i].pf == mt->base.base.format)
- break;
- if (i == NV50_TEX_FORMAT_LIST_SIZE)
- return 1;
-
- if (nv50->sampler[p][unit]->normalized)
- mode = 0x50001000 | (1 << 31);
- else {
- mode = 0x50001000 | (7 << 14);
- assert(mt->base.base.target == PIPE_TEXTURE_2D);
- }
+ tic[0] = nv50_texture_formats[view->pipe.format];
- mode |= ((mt->base.bo->tile_mode & 0x0f) << 22) |
- ((mt->base.bo->tile_mode & 0xf0) << 21);
+ swz[0] = nv50_tic_swizzle(tic[0], view->pipe.swizzle_r);
+ swz[1] = nv50_tic_swizzle(tic[0], view->pipe.swizzle_g);
+ swz[2] = nv50_tic_swizzle(tic[0], view->pipe.swizzle_b);
+ swz[3] = nv50_tic_swizzle(tic[0], view->pipe.swizzle_a);
+ view->tic[0] = (tic[0] & ~NV50TIC_0_0_SWIZZLE_MASK) |
+ (swz[0] << NV50TIC_0_0_MAPR_SHIFT) |
+ (swz[1] << NV50TIC_0_0_MAPG_SHIFT) |
+ (swz[2] << NV50TIC_0_0_MAPB_SHIFT) |
+ (swz[3] << NV50TIC_0_0_MAPA_SHIFT);
- desc = util_format_description(mt->base.base.format);
- assert(desc);
+ tic[2] = 0x50001000;
+ tic[2] |= ((mt->base.bo->tile_mode & 0x0f) << 22) |
+ ((mt->base.bo->tile_mode & 0xf0) << 21);
+ desc = util_format_description(mt->base.base.format);
if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB)
- mode |= 0x0400;
+ tic[2] |= NV50TIC_0_2_COLORSPACE_SRGB;
switch (mt->base.base.target) {
case PIPE_TEXTURE_1D:
+ tic[2] |= NV50TIC_0_2_TARGET_1D;
break;
case PIPE_TEXTURE_2D:
- mode |= (1 << 14);
+ tic[2] |= NV50TIC_0_2_TARGET_2D;
break;
case PIPE_TEXTURE_3D:
- mode |= (2 << 14);
+ tic[2] |= NV50TIC_0_2_TARGET_3D;
break;
case PIPE_TEXTURE_CUBE:
- mode |= (3 << 14);
+ tic[2] |= NV50TIC_0_2_TARGET_CUBE;
break;
default:
- assert(!"unsupported texture target");
- break;
+ NOUVEAU_ERR("invalid texture target: %d\n",
+ mt->base.base.target);
+ return FALSE;
}
- so_data (so, nv50_tex_format_list[i].hw);
- so_reloc(so, mt->base.bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_LOW |
- NOUVEAU_BO_RD, 0, 0);
- so_data (so, mode);
- so_data (so, 0x00300000);
- so_data (so, mt->base.base.width0 | (1 << 31));
- so_data (so, (mt->base.base.last_level << 28) |
- (mt->base.base.depth0 << 16) | mt->base.base.height0);
- so_data (so, 0x03000000);
- so_data (so, mt->base.base.last_level << 4);
-
- return 0;
-}
+ tic[3] = 0x00300000;
+
+ tic[4] = (1 << 31) | mt->base.base.width0;
+ tic[5] = (mt->base.base.last_level << 28) |
+ (mt->base.base.depth0 << 16) | mt->base.base.height0;
-#ifndef NV50TCL_BIND_TIC
-#define NV50TCL_BIND_TIC(n) (0x1448 + 8 * n)
-#endif
+ tic[6] = 0x03000000;
-static boolean
+ tic[7] = (view->pipe.last_level << 4) | view->pipe.first_level;
+
+ return TRUE;
+}
+
+static int
nv50_validate_textures(struct nv50_context *nv50, struct nouveau_stateobj *so,
unsigned p)
{
- static const unsigned p_remap[PIPE_SHADER_TYPES] = { 0, 2, 1 };
-
struct nouveau_grobj *eng2d = nv50->screen->eng2d;
struct nouveau_grobj *tesla = nv50->screen->tesla;
- unsigned unit, j, p_hw = p_remap[p];
+ unsigned unit, j;
+
+ const unsigned rll = NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | NOUVEAU_BO_LOW;
+ const unsigned rlh = NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | NOUVEAU_BO_HIGH
+ | NOUVEAU_BO_OR;
nv50_so_init_sifc(nv50, so, nv50->screen->tic, NOUVEAU_BO_VRAM,
- p * (32 * 8 * 4), nv50->miptree_nr[p] * 8 * 4);
+ p * (32 * 8 * 4), nv50->sampler_view_nr[p] * 8 * 4);
- for (unit = 0; unit < nv50->miptree_nr[p]; ++unit) {
- struct nv50_miptree *mt = nv50->miptree[p][unit];
+ for (unit = 0; unit < nv50->sampler_view_nr[p]; ++unit) {
+ struct nv50_sampler_view *view =
+ nv50_sampler_view(nv50->sampler_views[p][unit]);
so_method(so, eng2d, NV50_2D_SIFC_DATA | (2 << 29), 8);
- if (mt) {
- if (nv50_tex_construct(nv50, so, mt, unit, p))
- return FALSE;
+ if (view) {
+ uint32_t tic2 = view->tic[2];
+ struct nv50_miptree *mt =
+ nv50_miptree(view->pipe.texture);
+
+ if (nv50->sampler[p][unit]->normalized)
+ tic2 |= NV50TIC_0_2_NORMALIZED_COORDS;
+
+ so_data (so, view->tic[0]);
+ so_reloc (so, mt->base.bo, 0, rll, 0, 0);
+ so_reloc (so, mt->base.bo, 0, rlh, tic2, tic2);
+ so_datap (so, &view->tic[3], 5);
+
/* Set TEX insn $t src binding $unit in program type p
* to TIC, TSC entry (32 * p + unit), mark valid (1).
*/
- so_method(so, tesla, NV50TCL_BIND_TIC(p_hw), 1);
+ so_method(so, tesla, NV50TCL_BIND_TIC(p), 1);
so_data (so, ((32 * p + unit) << 9) | (unit << 1) | 1);
} else {
for (j = 0; j < 8; ++j)
so_data(so, 0);
- so_method(so, tesla, NV50TCL_BIND_TIC(p_hw), 1);
+ so_method(so, tesla, NV50TCL_BIND_TIC(p), 1);
so_data (so, (unit << 1) | 0);
}
}
- for (; unit < nv50->state.miptree_nr[p]; unit++) {
+ for (; unit < nv50->state.sampler_view_nr[p]; unit++) {
/* Make other bindings invalid. */
- so_method(so, tesla, NV50TCL_BIND_TIC(p_hw), 1);
+ so_method(so, tesla, NV50TCL_BIND_TIC(p), 1);
so_data (so, (unit << 1) | 0);
}
- nv50->state.miptree_nr[p] = nv50->miptree_nr[p];
+ nv50->state.sampler_view_nr[p] = nv50->sampler_view_nr[p];
return TRUE;
}
void
+nv50_tex_relocs(struct nv50_context *nv50)
+{
+ struct nouveau_channel *chan = nv50->screen->tesla->channel;
+ int p, unit;
+
+ p = PIPE_SHADER_FRAGMENT;
+ for (unit = 0; unit < nv50->sampler_view_nr[p]; unit++) {
+ struct pipe_sampler_view *view = nv50->sampler_views[p][unit];
+ if (!view)
+ continue;
+ nouveau_reloc_emit(chan, nv50->screen->tic,
+ ((p * 32) + unit) * 32, NULL,
+ nv50_miptree(view->texture)->base.bo, 0, 0,
+ NOUVEAU_BO_VRAM | NOUVEAU_BO_LOW |
+ NOUVEAU_BO_RD, 0, 0);
+ }
+
+ p = PIPE_SHADER_VERTEX;
+ for (unit = 0; unit < nv50->sampler_view_nr[p]; unit++) {
+ struct pipe_sampler_view *view = nv50->sampler_views[p][unit];
+ if (!view)
+ continue;
+ nouveau_reloc_emit(chan, nv50->screen->tic,
+ ((p * 32) + unit) * 32, NULL,
+ nv50_miptree(view->texture)->base.bo, 0, 0,
+ NOUVEAU_BO_VRAM | NOUVEAU_BO_LOW |
+ NOUVEAU_BO_RD, 0, 0);
+ }
+}
+
+struct nouveau_stateobj *
nv50_tex_validate(struct nv50_context *nv50)
{
struct nouveau_stateobj *so;
struct nouveau_grobj *tesla = nv50->screen->tesla;
- unsigned p, start, push, nrlc;
-
- for (nrlc = 0, start = 0, push = 0, p = 0; p < PIPE_SHADER_TYPES; ++p) {
- start += MAX2(nv50->miptree_nr[p], nv50->state.miptree_nr[p]);
- push += MAX2(nv50->miptree_nr[p], nv50->state.miptree_nr[p]);
- nrlc += nv50->miptree_nr[p];
+ unsigned p, m = 0, d = 0, r = 0;
+
+ for (p = 0; p < 3; ++p) {
+ unsigned nr = MAX2(nv50->sampler_view_nr[p],
+ nv50->state.sampler_view_nr[p]);
+ m += nr;
+ d += nr;
+ r += nv50->sampler_view_nr[p];
}
- start = start * 2 + 4 * PIPE_SHADER_TYPES + 2;
- push = push * 9 + 19 * PIPE_SHADER_TYPES + 2;
- nrlc = nrlc * 2 + 2 * PIPE_SHADER_TYPES;
+ m = m * 2 + 3 * 4 + 1;
+ d = d * 9 + 3 * 19 + 1;
+ r = r * 2 + 3 * 2;
- so = so_new(start, push, nrlc);
+ so = so_new(m, d, r);
- if (nv50_validate_textures(nv50, so, PIPE_SHADER_VERTEX) == FALSE ||
- nv50_validate_textures(nv50, so, PIPE_SHADER_FRAGMENT) == FALSE) {
+ if (nv50_validate_textures(nv50, so, 0) == FALSE ||
+ nv50_validate_textures(nv50, so, 2) == FALSE) {
so_ref(NULL, &so);
NOUVEAU_ERR("failed tex validate\n");
- return;
+ return NULL;
}
so_method(so, tesla, 0x1330, 1); /* flush TIC */
so_data (so, 0);
- so_ref(so, &nv50->state.tic_upload);
- so_ref(NULL, &so);
+ return so;
}
diff --git a/src/gallium/drivers/nv50/nv50_texture.h b/src/gallium/drivers/nv50/nv50_texture.h
index b870302019..3475d3e432 100644
--- a/src/gallium/drivers/nv50/nv50_texture.h
+++ b/src/gallium/drivers/nv50/nv50_texture.h
@@ -7,7 +7,9 @@
*/
/* Texture image control block */
+#define NV50TIC_0_0_SWIZZLE_MASK 0x3ffc0000
#define NV50TIC_0_0_MAPA_MASK 0x38000000
+#define NV50TIC_0_0_MAPA_SHIFT 27
#define NV50TIC_0_0_MAPA_ZERO 0x00000000
#define NV50TIC_0_0_MAPA_C0 0x10000000
#define NV50TIC_0_0_MAPA_C1 0x18000000
@@ -15,6 +17,7 @@
#define NV50TIC_0_0_MAPA_C3 0x28000000
#define NV50TIC_0_0_MAPA_ONE 0x38000000
#define NV50TIC_0_0_MAPB_MASK 0x07000000
+#define NV50TIC_0_0_MAPB_SHIFT 24
#define NV50TIC_0_0_MAPB_ZERO 0x00000000
#define NV50TIC_0_0_MAPB_C0 0x02000000
#define NV50TIC_0_0_MAPB_C1 0x03000000
@@ -22,6 +25,7 @@
#define NV50TIC_0_0_MAPB_C3 0x05000000
#define NV50TIC_0_0_MAPB_ONE 0x07000000
#define NV50TIC_0_0_MAPG_MASK 0x00e00000
+#define NV50TIC_0_0_MAPG_SHIFT 21
#define NV50TIC_0_0_MAPG_ZERO 0x00000000
#define NV50TIC_0_0_MAPG_C0 0x00400000
#define NV50TIC_0_0_MAPG_C1 0x00600000
@@ -29,6 +33,7 @@
#define NV50TIC_0_0_MAPG_C3 0x00a00000
#define NV50TIC_0_0_MAPG_ONE 0x00e00000
#define NV50TIC_0_0_MAPR_MASK 0x001c0000
+#define NV50TIC_0_0_MAPR_SHIFT 18
#define NV50TIC_0_0_MAPR_ZERO 0x00000000
#define NV50TIC_0_0_MAPR_C0 0x00080000
#define NV50TIC_0_0_MAPR_C1 0x000c0000
@@ -89,22 +94,39 @@
#define NV50TIC_0_1_OFFSET_LOW_MASK 0xffffffff
#define NV50TIC_0_1_OFFSET_LOW_SHIFT 0
-#define NV50TIC_0_2_UNKNOWN_MASK 0xffffffff
+#define NV50TIC_0_2_COLORSPACE_SRGB 0x00000400
+#define NV50TIC_0_2_TARGET_1D 0x00000000
+#define NV50TIC_0_2_TARGET_2D 0x00004000
+#define NV50TIC_0_2_TARGET_3D 0x00008000
+#define NV50TIC_0_2_TARGET_CUBE 0x0000c000
+#define NV50TIC_0_2_TARGET_1D_ARRAY 0x00010000
+#define NV50TIC_0_2_TARGET_2D_ARRAY 0x00014000
+#define NV50TIC_0_2_TARGET_BUFFER 0x00018000
+#define NV50TIC_0_2_TARGET_RECT 0x0001c000
+/* #define NV50TIC_0_0_TILE_MODE_LINEAR 0x00040000 */
+#define NV50TIC_0_2_TILE_MODE_Y_MASK 0x01c00000
+#define NV50TIC_0_2_TILE_MODE_Y_SHIFT 22
+#define NV50TIC_0_2_TILE_MODE_Z_MASK 0x0e000000
+#define NV50TIC_0_2_TILE_MODE_Z_SHIFT 25
+#define NV50TIC_0_2_NORMALIZED_COORDS 0x80000000
#define NV50TIC_0_3_UNKNOWN_MASK 0xffffffff
#define NV50TIC_0_4_WIDTH_MASK 0x0000ffff
#define NV50TIC_0_4_WIDTH_SHIFT 0
-#define NV50TIC_0_5_DEPTH_MASK 0xffff0000
+#define NV50TIC_0_5_LAST_LEVEL_MASK 0xf0000000
+#define NV50TIC_0_5_LAST_LEVEL_SHIFT 28
+#define NV50TIC_0_5_DEPTH_MASK 0x0fff0000
#define NV50TIC_0_5_DEPTH_SHIFT 16
#define NV50TIC_0_5_HEIGHT_MASK 0x0000ffff
#define NV50TIC_0_5_HEIGHT_SHIFT 0
-
#define NV50TIC_0_6_UNKNOWN_MASK 0xffffffff
-#define NV50TIC_0_7_OFFSET_HIGH_MASK 0xffffffff
-#define NV50TIC_0_7_OFFSET_HIGH_SHIFT 0
+#define NV50TIC_0_7_BASE_LEVEL_MASK 0x0000000f
+#define NV50TIC_0_7_BASE_LEVEL_SHIFT 0
+#define NV50TIC_0_7_MAX_LEVEL_MASK 0x000000f0
+#define NV50TIC_0_7_MAX_LEVEL_SHIFT 4
/* Texture sampler control block */
#define NV50TSC_1_0_WRAPS_MASK 0x00000007
diff --git a/src/gallium/drivers/nv50/nv50_transfer.c b/src/gallium/drivers/nv50/nv50_transfer.c
index 7c360e9e73..9eb223eca6 100644
--- a/src/gallium/drivers/nv50/nv50_transfer.c
+++ b/src/gallium/drivers/nv50/nv50_transfer.c
@@ -121,11 +121,12 @@ nv50_transfer_rect_m2mf(struct pipe_screen *pscreen,
}
static struct pipe_transfer *
-nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
+nv50_transfer_new(struct pipe_context *pcontext, struct pipe_texture *pt,
unsigned face, unsigned level, unsigned zslice,
enum pipe_transfer_usage usage,
unsigned x, unsigned y, unsigned w, unsigned h)
{
+ struct pipe_screen *pscreen = pcontext->screen;
struct nouveau_device *dev = nouveau_screen(pscreen)->device;
struct nv50_miptree *mt = nv50_miptree(pt);
struct nv50_miptree_level *lvl = &mt->level[level];
@@ -186,7 +187,7 @@ nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
}
static void
-nv50_transfer_del(struct pipe_transfer *ptx)
+nv50_transfer_del(struct pipe_context *pcontext, struct pipe_transfer *ptx)
{
struct nv50_transfer *tx = (struct nv50_transfer *)ptx;
struct nv50_miptree *mt = nv50_miptree(ptx->texture);
@@ -196,7 +197,7 @@ nv50_transfer_del(struct pipe_transfer *ptx)
unsigned ny = util_format_get_nblocksy(pt->format, tx->base.height);
if (ptx->usage & PIPE_TRANSFER_WRITE) {
- struct pipe_screen *pscreen = pt->screen;
+ struct pipe_screen *pscreen = pcontext->screen;
nv50_transfer_rect_m2mf(pscreen, tx->bo, 0,
tx->base.stride, tx->bo->tile_mode,
@@ -218,7 +219,7 @@ nv50_transfer_del(struct pipe_transfer *ptx)
}
static void *
-nv50_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+nv50_transfer_map(struct pipe_context *pcontext, struct pipe_transfer *ptx)
{
struct nv50_transfer *tx = (struct nv50_transfer *)ptx;
unsigned flags = 0;
@@ -236,7 +237,7 @@ nv50_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
}
static void
-nv50_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+nv50_transfer_unmap(struct pipe_context *pcontext, struct pipe_transfer *ptx)
{
struct nv50_transfer *tx = (struct nv50_transfer *)ptx;
@@ -244,12 +245,12 @@ nv50_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
}
void
-nv50_transfer_init_screen_functions(struct pipe_screen *pscreen)
+nv50_init_transfer_functions(struct nv50_context *nv50)
{
- pscreen->get_tex_transfer = nv50_transfer_new;
- pscreen->tex_transfer_destroy = nv50_transfer_del;
- pscreen->transfer_map = nv50_transfer_map;
- pscreen->transfer_unmap = nv50_transfer_unmap;
+ nv50->pipe.get_tex_transfer = nv50_transfer_new;
+ nv50->pipe.tex_transfer_destroy = nv50_transfer_del;
+ nv50->pipe.transfer_map = nv50_transfer_map;
+ nv50->pipe.transfer_unmap = nv50_transfer_unmap;
}
void
diff --git a/src/gallium/drivers/nv50/nv50_vbo.c b/src/gallium/drivers/nv50/nv50_vbo.c
index 1c8ee0b9ad..5047286806 100644
--- a/src/gallium/drivers/nv50/nv50_vbo.c
+++ b/src/gallium/drivers/nv50/nv50_vbo.c
@@ -25,53 +25,9 @@
#include "util/u_inlines.h"
#include "util/u_format.h"
+#include "nouveau/nouveau_util.h"
#include "nv50_context.h"
-static boolean
-nv50_push_elements_u08(struct nv50_context *, uint8_t *, unsigned);
-
-static boolean
-nv50_push_elements_u16(struct nv50_context *, uint16_t *, unsigned);
-
-static boolean
-nv50_push_elements_u32(struct nv50_context *, uint32_t *, unsigned);
-
-static boolean
-nv50_push_arrays(struct nv50_context *, unsigned, unsigned);
-
-#define NV50_USING_LOATHED_EDGEFLAG(ctx) ((ctx)->vertprog->cfg.edgeflag_in < 16)
-
-static INLINE unsigned
-nv50_prim(unsigned mode)
-{
- switch (mode) {
- case PIPE_PRIM_POINTS: return NV50TCL_VERTEX_BEGIN_POINTS;
- case PIPE_PRIM_LINES: return NV50TCL_VERTEX_BEGIN_LINES;
- case PIPE_PRIM_LINE_LOOP: return NV50TCL_VERTEX_BEGIN_LINE_LOOP;
- case PIPE_PRIM_LINE_STRIP: return NV50TCL_VERTEX_BEGIN_LINE_STRIP;
- case PIPE_PRIM_TRIANGLES: return NV50TCL_VERTEX_BEGIN_TRIANGLES;
- case PIPE_PRIM_TRIANGLE_STRIP:
- return NV50TCL_VERTEX_BEGIN_TRIANGLE_STRIP;
- case PIPE_PRIM_TRIANGLE_FAN: return NV50TCL_VERTEX_BEGIN_TRIANGLE_FAN;
- case PIPE_PRIM_QUADS: return NV50TCL_VERTEX_BEGIN_QUADS;
- case PIPE_PRIM_QUAD_STRIP: return NV50TCL_VERTEX_BEGIN_QUAD_STRIP;
- case PIPE_PRIM_POLYGON: return NV50TCL_VERTEX_BEGIN_POLYGON;
- case PIPE_PRIM_LINES_ADJACENCY:
- return NV50TCL_VERTEX_BEGIN_LINES_ADJACENCY;
- case PIPE_PRIM_LINE_STRIP_ADJACENCY:
- return NV50TCL_VERTEX_BEGIN_LINE_STRIP_ADJACENCY;
- case PIPE_PRIM_TRIANGLES_ADJACENCY:
- return NV50TCL_VERTEX_BEGIN_TRIANGLES_ADJACENCY;
- case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY:
- return NV50TCL_VERTEX_BEGIN_TRIANGLE_STRIP_ADJACENCY;
- default:
- break;
- }
-
- NOUVEAU_ERR("invalid primitive type %d\n", mode);
- return NV50TCL_VERTEX_BEGIN_POINTS;
-}
-
static INLINE uint32_t
nv50_vbo_type_to_hw(enum pipe_format format)
{
@@ -139,15 +95,16 @@ nv50_vbo_vtxelt_to_hw(struct pipe_vertex_element *ve)
uint32_t hw_type, hw_size;
enum pipe_format pf = ve->src_format;
const struct util_format_description *desc;
- unsigned size;
+ unsigned size, nr_components;
desc = util_format_description(pf);
assert(desc);
size = util_format_get_component_bits(pf, UTIL_FORMAT_COLORSPACE_RGB, 0);
+ nr_components = util_format_get_nr_components(pf);
hw_type = nv50_vbo_type_to_hw(pf);
- hw_size = nv50_vbo_size_to_hw(size, ve->nr_components);
+ hw_size = nv50_vbo_size_to_hw(size, nr_components);
if (!hw_type || !hw_size) {
NOUVEAU_ERR("unsupported vbo format: %s\n", util_format_name(pf));
@@ -161,250 +118,58 @@ nv50_vbo_vtxelt_to_hw(struct pipe_vertex_element *ve)
return (hw_type | hw_size);
}
-/* For instanced drawing from user buffers, hitting the FIFO repeatedly
- * with the same vertex data is probably worse than uploading all data.
- */
-static boolean
-nv50_upload_vtxbuf(struct nv50_context *nv50, unsigned i)
-{
- struct nv50_screen *nscreen = nv50->screen;
- struct pipe_screen *pscreen = &nscreen->base.base;
- struct pipe_buffer *buf = nscreen->strm_vbuf[i];
- struct pipe_vertex_buffer *vb = &nv50->vtxbuf[i];
- uint8_t *src;
- unsigned size = align(vb->buffer->size, 4096);
-
- if (buf && buf->size < size)
- pipe_buffer_reference(&nscreen->strm_vbuf[i], NULL);
-
- if (!nscreen->strm_vbuf[i]) {
- nscreen->strm_vbuf[i] = pipe_buffer_create(
- pscreen, 0, PIPE_BUFFER_USAGE_VERTEX, size);
- buf = nscreen->strm_vbuf[i];
- }
-
- src = pipe_buffer_map(pscreen, vb->buffer, PIPE_BUFFER_USAGE_CPU_READ);
- if (!src)
- return FALSE;
- src += vb->buffer_offset;
-
- size = (vb->max_index + 1) * vb->stride + 16; /* + 16 is for stride 0 */
- if (vb->buffer_offset + size > vb->buffer->size)
- size = vb->buffer->size - vb->buffer_offset;
-
- pipe_buffer_write(pscreen, buf, vb->buffer_offset, size, src);
- pipe_buffer_unmap(pscreen, vb->buffer);
-
- vb->buffer = buf; /* don't pipe_reference, this is a private copy */
- return TRUE;
-}
-
-static void
-nv50_upload_user_vbufs(struct nv50_context *nv50)
-{
- unsigned i;
-
- if (nv50->vbo_fifo)
- nv50->dirty |= NV50_NEW_ARRAYS;
- if (!(nv50->dirty & NV50_NEW_ARRAYS))
- return;
-
- for (i = 0; i < nv50->vtxbuf_nr; ++i) {
- if (nv50->vtxbuf[i].buffer->usage & PIPE_BUFFER_USAGE_VERTEX)
- continue;
- nv50_upload_vtxbuf(nv50, i);
- }
-}
-
-static void
-nv50_set_static_vtxattr(struct nv50_context *nv50, unsigned i, void *data)
-{
- struct nouveau_grobj *tesla = nv50->screen->tesla;
- struct nouveau_channel *chan = tesla->channel;
- float v[4];
-
- util_format_read_4f(nv50->vtxelt[i].src_format,
- v, 0, data, 0, 0, 0, 1, 1);
-
- switch (nv50->vtxelt[i].nr_components) {
- case 4:
- BEGIN_RING(chan, tesla, NV50TCL_VTX_ATTR_4F_X(i), 4);
- OUT_RINGf (chan, v[0]);
- OUT_RINGf (chan, v[1]);
- OUT_RINGf (chan, v[2]);
- OUT_RINGf (chan, v[3]);
- break;
- case 3:
- BEGIN_RING(chan, tesla, NV50TCL_VTX_ATTR_3F_X(i), 3);
- OUT_RINGf (chan, v[0]);
- OUT_RINGf (chan, v[1]);
- OUT_RINGf (chan, v[2]);
- break;
- case 2:
- BEGIN_RING(chan, tesla, NV50TCL_VTX_ATTR_2F_X(i), 2);
- OUT_RINGf (chan, v[0]);
- OUT_RINGf (chan, v[1]);
- break;
- case 1:
- BEGIN_RING(chan, tesla, NV50TCL_VTX_ATTR_1F(i), 1);
- OUT_RINGf (chan, v[0]);
- break;
- default:
- assert(0);
- break;
- }
-}
-
-static unsigned
-init_per_instance_arrays_immd(struct nv50_context *nv50,
- unsigned startInstance,
- unsigned pos[16], unsigned step[16])
-{
- struct nouveau_bo *bo;
- unsigned i, b, count = 0;
-
- for (i = 0; i < nv50->vtxelt_nr; ++i) {
- if (!nv50->vtxelt[i].instance_divisor)
- continue;
- ++count;
- b = nv50->vtxelt[i].vertex_buffer_index;
-
- pos[i] = nv50->vtxelt[i].src_offset +
- nv50->vtxbuf[b].buffer_offset +
- startInstance * nv50->vtxbuf[b].stride;
- step[i] = startInstance % nv50->vtxelt[i].instance_divisor;
-
- bo = nouveau_bo(nv50->vtxbuf[b].buffer);
- if (!bo->map)
- nouveau_bo_map(bo, NOUVEAU_BO_RD);
-
- nv50_set_static_vtxattr(nv50, i, (uint8_t *)bo->map + pos[i]);
- }
-
- return count;
-}
-
-static unsigned
-init_per_instance_arrays(struct nv50_context *nv50,
- unsigned startInstance,
- unsigned pos[16], unsigned step[16])
-{
- struct nouveau_grobj *tesla = nv50->screen->tesla;
- struct nouveau_channel *chan = tesla->channel;
+struct instance {
struct nouveau_bo *bo;
- struct nouveau_stateobj *so;
- unsigned i, b, count = 0;
- const uint32_t rl = NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_RD;
-
- if (nv50->vbo_fifo)
- return init_per_instance_arrays_immd(nv50, startInstance,
- pos, step);
-
- so = so_new(nv50->vtxelt_nr, nv50->vtxelt_nr * 2, nv50->vtxelt_nr * 2);
-
- for (i = 0; i < nv50->vtxelt_nr; ++i) {
- if (!nv50->vtxelt[i].instance_divisor)
- continue;
- ++count;
- b = nv50->vtxelt[i].vertex_buffer_index;
-
- pos[i] = nv50->vtxelt[i].src_offset +
- nv50->vtxbuf[b].buffer_offset +
- startInstance * nv50->vtxbuf[b].stride;
-
- if (!startInstance) {
- step[i] = 0;
- continue;
- }
- step[i] = startInstance % nv50->vtxelt[i].instance_divisor;
-
- bo = nouveau_bo(nv50->vtxbuf[b].buffer);
-
- so_method(so, tesla, NV50TCL_VERTEX_ARRAY_START_HIGH(i), 2);
- so_reloc (so, bo, pos[i], rl | NOUVEAU_BO_HIGH, 0, 0);
- so_reloc (so, bo, pos[i], rl | NOUVEAU_BO_LOW, 0, 0);
- }
-
- if (count && startInstance) {
- so_ref (so, &nv50->state.instbuf); /* for flush notify */
- so_emit(chan, nv50->state.instbuf);
- }
- so_ref (NULL, &so);
-
- return count;
-}
+ unsigned delta;
+ unsigned stride;
+ unsigned step;
+ unsigned divisor;
+};
static void
-step_per_instance_arrays_immd(struct nv50_context *nv50,
- unsigned pos[16], unsigned step[16])
+instance_init(struct nv50_context *nv50, struct instance *a, unsigned first)
{
- struct nouveau_bo *bo;
- unsigned i, b;
+ int i;
- for (i = 0; i < nv50->vtxelt_nr; ++i) {
- if (!nv50->vtxelt[i].instance_divisor)
- continue;
- if (++step[i] != nv50->vtxelt[i].instance_divisor)
- continue;
- b = nv50->vtxelt[i].vertex_buffer_index;
- bo = nouveau_bo(nv50->vtxbuf[b].buffer);
+ for (i = 0; i < nv50->vtxelt->num_elements; i++) {
+ struct pipe_vertex_element *ve = &nv50->vtxelt->pipe[i];
+ struct pipe_vertex_buffer *vb;
- step[i] = 0;
- pos[i] += nv50->vtxbuf[b].stride;
+ a[i].divisor = ve->instance_divisor;
+ if (a[i].divisor) {
+ vb = &nv50->vtxbuf[ve->vertex_buffer_index];
- nv50_set_static_vtxattr(nv50, i, (uint8_t *)bo->map + pos[i]);
+ a[i].bo = nouveau_bo(vb->buffer);
+ a[i].stride = vb->stride;
+ a[i].step = first % a[i].divisor;
+ a[i].delta = vb->buffer_offset + ve->src_offset +
+ (first * a[i].stride);
+ }
}
}
static void
-step_per_instance_arrays(struct nv50_context *nv50,
- unsigned pos[16], unsigned step[16])
+instance_step(struct nv50_context *nv50, struct instance *a)
{
+ struct nouveau_channel *chan = nv50->screen->tesla->channel;
struct nouveau_grobj *tesla = nv50->screen->tesla;
- struct nouveau_channel *chan = tesla->channel;
- struct nouveau_bo *bo;
- struct nouveau_stateobj *so;
- unsigned i, b;
- const uint32_t rl = NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_RD;
-
- if (nv50->vbo_fifo) {
- step_per_instance_arrays_immd(nv50, pos, step);
- return;
- }
-
- so = so_new(nv50->vtxelt_nr, nv50->vtxelt_nr * 2, nv50->vtxelt_nr * 2);
+ int i;
- for (i = 0; i < nv50->vtxelt_nr; ++i) {
- if (!nv50->vtxelt[i].instance_divisor)
+ for (i = 0; i < nv50->vtxelt->num_elements; i++) {
+ if (!a[i].divisor)
continue;
- b = nv50->vtxelt[i].vertex_buffer_index;
- if (++step[i] == nv50->vtxelt[i].instance_divisor) {
- step[i] = 0;
- pos[i] += nv50->vtxbuf[b].stride;
+ BEGIN_RING(chan, tesla,
+ NV50TCL_VERTEX_ARRAY_START_HIGH(i), 2);
+ OUT_RELOCh(chan, a[i].bo, a[i].delta, NOUVEAU_BO_RD |
+ NOUVEAU_BO_VRAM | NOUVEAU_BO_GART);
+ OUT_RELOCl(chan, a[i].bo, a[i].delta, NOUVEAU_BO_RD |
+ NOUVEAU_BO_VRAM | NOUVEAU_BO_GART);
+ if (++a[i].step == a[i].divisor) {
+ a[i].step = 0;
+ a[i].delta += a[i].stride;
}
-
- bo = nouveau_bo(nv50->vtxbuf[b].buffer);
-
- so_method(so, tesla, NV50TCL_VERTEX_ARRAY_START_HIGH(i), 2);
- so_reloc (so, bo, pos[i], rl | NOUVEAU_BO_HIGH, 0, 0);
- so_reloc (so, bo, pos[i], rl | NOUVEAU_BO_LOW, 0, 0);
}
-
- so_ref (so, &nv50->state.instbuf); /* for flush notify */
- so_ref (NULL, &so);
-
- so_emit(chan, nv50->state.instbuf);
-}
-
-static INLINE void
-nv50_unmap_vbufs(struct nv50_context *nv50)
-{
- unsigned i;
-
- for (i = 0; i < nv50->vtxbuf_nr; ++i)
- if (nouveau_bo(nv50->vtxbuf[i].buffer)->map)
- nouveau_bo_unmap(nouveau_bo(nv50->vtxbuf[i].buffer));
}
void
@@ -415,198 +180,207 @@ nv50_draw_arrays_instanced(struct pipe_context *pipe,
struct nv50_context *nv50 = nv50_context(pipe);
struct nouveau_channel *chan = nv50->screen->tesla->channel;
struct nouveau_grobj *tesla = nv50->screen->tesla;
- unsigned i, nz_divisors;
- unsigned step[16], pos[16];
-
- if (!NV50_USING_LOATHED_EDGEFLAG(nv50))
- nv50_upload_user_vbufs(nv50);
+ struct instance a[16];
+ unsigned prim = nv50_prim(mode);
- nv50_state_validate(nv50);
+ instance_init(nv50, a, startInstance);
+ if (!nv50_state_validate(nv50, 10 + 16*3))
+ return;
- nz_divisors = init_per_instance_arrays(nv50, startInstance, pos, step);
+ if (nv50->vbo_fifo) {
+ nv50_push_elements_instanced(pipe, NULL, 0, mode, start,
+ count, startInstance,
+ instanceCount);
+ return;
+ }
BEGIN_RING(chan, tesla, NV50TCL_CB_ADDR, 2);
OUT_RING (chan, NV50_CB_AUX | (24 << 8));
OUT_RING (chan, startInstance);
+ while (instanceCount--) {
+ if (AVAIL_RING(chan) < (7 + 16*3)) {
+ FIRE_RING(chan);
+ if (!nv50_state_validate(nv50, 7 + 16*3)) {
+ assert(0);
+ return;
+ }
+ }
+ instance_step(nv50, a);
- BEGIN_RING(chan, tesla, NV50TCL_VERTEX_BEGIN, 1);
- OUT_RING (chan, nv50_prim(mode));
-
- if (nv50->vbo_fifo)
- nv50_push_arrays(nv50, start, count);
- else {
+ BEGIN_RING(chan, tesla, NV50TCL_VERTEX_BEGIN, 1);
+ OUT_RING (chan, prim);
BEGIN_RING(chan, tesla, NV50TCL_VERTEX_BUFFER_FIRST, 2);
OUT_RING (chan, start);
OUT_RING (chan, count);
- }
- BEGIN_RING(chan, tesla, NV50TCL_VERTEX_END, 1);
- OUT_RING (chan, 0);
-
- for (i = 1; i < instanceCount; i++) {
- if (nz_divisors) /* any non-zero array divisors ? */
- step_per_instance_arrays(nv50, pos, step);
-
- BEGIN_RING(chan, tesla, NV50TCL_VERTEX_BEGIN, 1);
- OUT_RING (chan, nv50_prim(mode) | (1 << 28));
-
- if (nv50->vbo_fifo)
- nv50_push_arrays(nv50, start, count);
- else {
- BEGIN_RING(chan, tesla, NV50TCL_VERTEX_BUFFER_FIRST, 2);
- OUT_RING (chan, start);
- OUT_RING (chan, count);
- }
BEGIN_RING(chan, tesla, NV50TCL_VERTEX_END, 1);
OUT_RING (chan, 0);
- }
- nv50_unmap_vbufs(nv50);
- so_ref(NULL, &nv50->state.instbuf);
+ prim |= (1 << 28);
+ }
}
void
nv50_draw_arrays(struct pipe_context *pipe, unsigned mode, unsigned start,
unsigned count)
{
- struct nv50_context *nv50 = nv50_context(pipe);
- struct nouveau_channel *chan = nv50->screen->tesla->channel;
- struct nouveau_grobj *tesla = nv50->screen->tesla;
- boolean ret;
-
- nv50_state_validate(nv50);
-
- BEGIN_RING(chan, tesla, 0x142c, 1);
- OUT_RING (chan, 0);
- BEGIN_RING(chan, tesla, 0x142c, 1);
- OUT_RING (chan, 0);
-
- BEGIN_RING(chan, tesla, NV50TCL_VERTEX_BEGIN, 1);
- OUT_RING (chan, nv50_prim(mode));
-
- if (nv50->vbo_fifo)
- ret = nv50_push_arrays(nv50, start, count);
- else {
- BEGIN_RING(chan, tesla, NV50TCL_VERTEX_BUFFER_FIRST, 2);
- OUT_RING (chan, start);
- OUT_RING (chan, count);
- ret = TRUE;
- }
- BEGIN_RING(chan, tesla, NV50TCL_VERTEX_END, 1);
- OUT_RING (chan, 0);
-
- nv50_unmap_vbufs(nv50);
-
- /* XXX: not sure what to do if ret != TRUE: flush and retry?
- */
- assert(ret);
+ nv50_draw_arrays_instanced(pipe, mode, start, count, 0, 1);
}
-static INLINE boolean
-nv50_draw_elements_inline_u08(struct nv50_context *nv50, uint8_t *map,
- unsigned start, unsigned count)
-{
- struct nouveau_channel *chan = nv50->screen->tesla->channel;
- struct nouveau_grobj *tesla = nv50->screen->tesla;
-
- map += start;
+struct inline_ctx {
+ struct nv50_context *nv50;
+ void *map;
+};
- if (nv50->vbo_fifo)
- return nv50_push_elements_u08(nv50, map, count);
+static void
+inline_elt08(void *priv, unsigned start, unsigned count)
+{
+ struct inline_ctx *ctx = priv;
+ struct nouveau_grobj *tesla = ctx->nv50->screen->tesla;
+ struct nouveau_channel *chan = tesla->channel;
+ uint8_t *map = (uint8_t *)ctx->map + start;
if (count & 1) {
BEGIN_RING(chan, tesla, NV50TCL_VB_ELEMENT_U32, 1);
OUT_RING (chan, map[0]);
map++;
- count--;
+ count &= ~1;
}
- while (count) {
- unsigned nr = count > 2046 ? 2046 : count;
- int i;
-
- BEGIN_RING_NI(chan, tesla, NV50TCL_VB_ELEMENT_U16, nr >> 1);
- for (i = 0; i < nr; i += 2)
- OUT_RING (chan, (map[i + 1] << 16) | map[i]);
+ count >>= 1;
+ if (!count)
+ return;
- count -= nr;
- map += nr;
+ BEGIN_RING_NI(chan, tesla, NV50TCL_VB_ELEMENT_U16, count);
+ while (count--) {
+ OUT_RING(chan, (map[1] << 16) | map[0]);
+ map += 2;
}
- return TRUE;
}
-static INLINE boolean
-nv50_draw_elements_inline_u16(struct nv50_context *nv50, uint16_t *map,
- unsigned start, unsigned count)
+static void
+inline_elt16(void *priv, unsigned start, unsigned count)
{
- struct nouveau_channel *chan = nv50->screen->tesla->channel;
- struct nouveau_grobj *tesla = nv50->screen->tesla;
-
- map += start;
-
- if (nv50->vbo_fifo)
- return nv50_push_elements_u16(nv50, map, count);
+ struct inline_ctx *ctx = priv;
+ struct nouveau_grobj *tesla = ctx->nv50->screen->tesla;
+ struct nouveau_channel *chan = tesla->channel;
+ uint16_t *map = (uint16_t *)ctx->map + start;
if (count & 1) {
BEGIN_RING(chan, tesla, NV50TCL_VB_ELEMENT_U32, 1);
OUT_RING (chan, map[0]);
+ count &= ~1;
map++;
- count--;
}
- while (count) {
- unsigned nr = count > 2046 ? 2046 : count;
- int i;
-
- BEGIN_RING_NI(chan, tesla, NV50TCL_VB_ELEMENT_U16, nr >> 1);
- for (i = 0; i < nr; i += 2)
- OUT_RING (chan, (map[i + 1] << 16) | map[i]);
+ count >>= 1;
+ if (!count)
+ return;
- count -= nr;
- map += nr;
+ BEGIN_RING_NI(chan, tesla, NV50TCL_VB_ELEMENT_U16, count);
+ while (count--) {
+ OUT_RING(chan, (map[1] << 16) | map[0]);
+ map += 2;
}
- return TRUE;
}
-static INLINE boolean
-nv50_draw_elements_inline_u32(struct nv50_context *nv50, uint32_t *map,
- unsigned start, unsigned count)
+static void
+inline_elt32(void *priv, unsigned start, unsigned count)
+{
+ struct inline_ctx *ctx = priv;
+ struct nouveau_grobj *tesla = ctx->nv50->screen->tesla;
+ struct nouveau_channel *chan = tesla->channel;
+
+ BEGIN_RING_NI(chan, tesla, NV50TCL_VB_ELEMENT_U32, count);
+ OUT_RINGp (chan, (uint32_t *)ctx->map + start, count);
+}
+
+static void
+inline_edgeflag(void *priv, boolean enabled)
{
+ struct inline_ctx *ctx = priv;
+ struct nouveau_grobj *tesla = ctx->nv50->screen->tesla;
+ struct nouveau_channel *chan = tesla->channel;
+
+ BEGIN_RING(chan, tesla, NV50TCL_EDGEFLAG_ENABLE, 1);
+ OUT_RING (chan, enabled ? 1 : 0);
+}
+
+static void
+nv50_draw_elements_inline(struct pipe_context *pipe,
+ struct pipe_buffer *indexBuffer, unsigned indexSize,
+ unsigned mode, unsigned start, unsigned count,
+ unsigned startInstance, unsigned instanceCount)
+{
+ struct pipe_screen *pscreen = pipe->screen;
+ struct nv50_context *nv50 = nv50_context(pipe);
struct nouveau_channel *chan = nv50->screen->tesla->channel;
struct nouveau_grobj *tesla = nv50->screen->tesla;
+ struct instance a[16];
+ struct inline_ctx ctx;
+ struct u_split_prim s;
+ boolean nzi = FALSE;
+ unsigned overhead;
+
+ overhead = 16*3; /* potential instance adjustments */
+ overhead += 4; /* Begin()/End() */
+ overhead += 4; /* potential edgeflag disable/reenable */
+ overhead += 3; /* potentially 3 VTX_ELT_U16/U32 packet headers */
+
+ s.priv = &ctx;
+ if (indexSize == 1)
+ s.emit = inline_elt08;
+ else
+ if (indexSize == 2)
+ s.emit = inline_elt16;
+ else
+ s.emit = inline_elt32;
+ s.edge = inline_edgeflag;
+
+ ctx.nv50 = nv50;
+ ctx.map = pipe_buffer_map(pscreen, indexBuffer, PIPE_BUFFER_USAGE_CPU_READ);
+ assert(ctx.map);
+ if (!ctx.map)
+ return;
- map += start;
+ instance_init(nv50, a, startInstance);
+ if (!nv50_state_validate(nv50, overhead + 6 + 3))
+ return;
- if (nv50->vbo_fifo)
- return nv50_push_elements_u32(nv50, map, count);
+ BEGIN_RING(chan, tesla, NV50TCL_CB_ADDR, 2);
+ OUT_RING (chan, NV50_CB_AUX | (24 << 8));
+ OUT_RING (chan, startInstance);
+ while (instanceCount--) {
+ unsigned max_verts;
+ boolean done;
+
+ u_split_prim_init(&s, mode, start, count);
+ do {
+ if (AVAIL_RING(chan) < (overhead + 6)) {
+ FIRE_RING(chan);
+ if (!nv50_state_validate(nv50, (overhead + 6))) {
+ assert(0);
+ return;
+ }
+ }
- while (count) {
- unsigned nr = count > 2047 ? 2047 : count;
+ max_verts = AVAIL_RING(chan) - overhead;
+ if (max_verts > 2047)
+ max_verts = 2047;
+ if (indexSize != 4)
+ max_verts <<= 1;
+ instance_step(nv50, a);
- BEGIN_RING_NI(chan, tesla, NV50TCL_VB_ELEMENT_U32, nr);
- OUT_RINGp (chan, map, nr);
+ BEGIN_RING(chan, tesla, NV50TCL_VERTEX_BEGIN, 1);
+ OUT_RING (chan, nv50_prim(s.mode) | (nzi ? (1<<28) : 0));
+ done = u_split_prim_next(&s, max_verts);
+ BEGIN_RING(chan, tesla, NV50TCL_VERTEX_END, 1);
+ OUT_RING (chan, 0);
+ } while (!done);
- count -= nr;
- map += nr;
+ nzi = TRUE;
}
- return TRUE;
-}
-static INLINE void
-nv50_draw_elements_inline(struct nv50_context *nv50,
- void *map, unsigned indexSize,
- unsigned start, unsigned count)
-{
- switch (indexSize) {
- case 1:
- nv50_draw_elements_inline_u08(nv50, map, start, count);
- break;
- case 2:
- nv50_draw_elements_inline_u16(nv50, map, start, count);
- break;
- case 4:
- nv50_draw_elements_inline_u32(nv50, map, start, count);
- break;
- }
+ pipe_buffer_unmap(pscreen, indexBuffer);
}
void
@@ -617,49 +391,68 @@ nv50_draw_elements_instanced(struct pipe_context *pipe,
unsigned startInstance, unsigned instanceCount)
{
struct nv50_context *nv50 = nv50_context(pipe);
+ struct nouveau_channel *chan = nv50->screen->tesla->channel;
struct nouveau_grobj *tesla = nv50->screen->tesla;
- struct nouveau_channel *chan = tesla->channel;
- struct pipe_screen *pscreen = pipe->screen;
- void *map;
- unsigned i, nz_divisors;
- unsigned step[16], pos[16];
+ struct instance a[16];
+ unsigned prim = nv50_prim(mode);
- map = pipe_buffer_map(pscreen, indexBuffer, PIPE_BUFFER_USAGE_CPU_READ);
-
- if (!NV50_USING_LOATHED_EDGEFLAG(nv50))
- nv50_upload_user_vbufs(nv50);
-
- nv50_state_validate(nv50);
+ instance_init(nv50, a, startInstance);
+ if (!nv50_state_validate(nv50, 13 + 16*3))
+ return;
- nz_divisors = init_per_instance_arrays(nv50, startInstance, pos, step);
+ if (nv50->vbo_fifo) {
+ nv50_push_elements_instanced(pipe, indexBuffer, indexSize,
+ mode, start, count, startInstance,
+ instanceCount);
+ return;
+ } else
+ if (!(indexBuffer->usage & PIPE_BUFFER_USAGE_INDEX) || indexSize == 1) {
+ nv50_draw_elements_inline(pipe, indexBuffer, indexSize,
+ mode, start, count, startInstance,
+ instanceCount);
+ return;
+ }
BEGIN_RING(chan, tesla, NV50TCL_CB_ADDR, 2);
OUT_RING (chan, NV50_CB_AUX | (24 << 8));
OUT_RING (chan, startInstance);
-
- BEGIN_RING(chan, tesla, NV50TCL_VERTEX_BEGIN, 1);
- OUT_RING (chan, nv50_prim(mode));
-
- nv50_draw_elements_inline(nv50, map, indexSize, start, count);
-
- BEGIN_RING(chan, tesla, NV50TCL_VERTEX_END, 1);
- OUT_RING (chan, 0);
-
- for (i = 1; i < instanceCount; ++i) {
- if (nz_divisors) /* any non-zero array divisors ? */
- step_per_instance_arrays(nv50, pos, step);
+ while (instanceCount--) {
+ if (AVAIL_RING(chan) < (7 + 16*3)) {
+ FIRE_RING(chan);
+ if (!nv50_state_validate(nv50, 10 + 16*3)) {
+ assert(0);
+ return;
+ }
+ }
+ instance_step(nv50, a);
BEGIN_RING(chan, tesla, NV50TCL_VERTEX_BEGIN, 1);
- OUT_RING (chan, nv50_prim(mode) | (1 << 28));
-
- nv50_draw_elements_inline(nv50, map, indexSize, start, count);
-
+ OUT_RING (chan, prim);
+ if (indexSize == 4) {
+ BEGIN_RING(chan, tesla, NV50TCL_VB_ELEMENT_U32 | 0x30000, 0);
+ OUT_RING (chan, count);
+ nouveau_pushbuf_submit(chan, nouveau_bo(indexBuffer),
+ start << 2, count << 2);
+ } else
+ if (indexSize == 2) {
+ unsigned vb_start = (start & ~1);
+ unsigned vb_end = (start + count + 1) & ~1;
+ unsigned dwords = (vb_end - vb_start) >> 1;
+
+ BEGIN_RING(chan, tesla, NV50TCL_VB_ELEMENT_U16_SETUP, 1);
+ OUT_RING (chan, ((start & 1) << 31) | count);
+ BEGIN_RING(chan, tesla, NV50TCL_VB_ELEMENT_U16 | 0x30000, 0);
+ OUT_RING (chan, dwords);
+ nouveau_pushbuf_submit(chan, nouveau_bo(indexBuffer),
+ vb_start << 1, dwords << 2);
+ BEGIN_RING(chan, tesla, NV50TCL_VB_ELEMENT_U16_SETUP, 1);
+ OUT_RING (chan, 0);
+ }
BEGIN_RING(chan, tesla, NV50TCL_VERTEX_END, 1);
OUT_RING (chan, 0);
- }
- nv50_unmap_vbufs(nv50);
- so_ref(NULL, &nv50->state.instbuf);
+ prim |= (1 << 28);
+ }
}
void
@@ -667,51 +460,8 @@ nv50_draw_elements(struct pipe_context *pipe,
struct pipe_buffer *indexBuffer, unsigned indexSize,
unsigned mode, unsigned start, unsigned count)
{
- struct nv50_context *nv50 = nv50_context(pipe);
- struct nouveau_channel *chan = nv50->screen->tesla->channel;
- struct nouveau_grobj *tesla = nv50->screen->tesla;
- struct pipe_screen *pscreen = pipe->screen;
- void *map;
-
- nv50_state_validate(nv50);
-
- BEGIN_RING(chan, tesla, 0x142c, 1);
- OUT_RING (chan, 0);
- BEGIN_RING(chan, tesla, 0x142c, 1);
- OUT_RING (chan, 0);
-
- BEGIN_RING(chan, tesla, NV50TCL_VERTEX_BEGIN, 1);
- OUT_RING (chan, nv50_prim(mode));
-
- if (!nv50->vbo_fifo && indexSize == 4) {
- BEGIN_RING(chan, tesla, NV50TCL_VB_ELEMENT_U32 | 0x30000, 0);
- OUT_RING (chan, count);
- nouveau_pushbuf_submit(chan, nouveau_bo(indexBuffer),
- start << 2, count << 2);
- } else
- if (!nv50->vbo_fifo && indexSize == 2) {
- unsigned vb_start = (start & ~1);
- unsigned vb_end = (start + count + 1) & ~1;
- unsigned dwords = (vb_end - vb_start) >> 1;
-
- BEGIN_RING(chan, tesla, NV50TCL_VB_ELEMENT_U16_SETUP, 1);
- OUT_RING (chan, ((start & 1) << 31) | count);
- BEGIN_RING(chan, tesla, NV50TCL_VB_ELEMENT_U16 | 0x30000, 0);
- OUT_RING (chan, dwords);
- nouveau_pushbuf_submit(chan, nouveau_bo(indexBuffer),
- vb_start << 1, dwords << 2);
- BEGIN_RING(chan, tesla, NV50TCL_VB_ELEMENT_U16_SETUP, 1);
- OUT_RING (chan, 0);
- } else {
- map = pipe_buffer_map(pscreen, indexBuffer,
- PIPE_BUFFER_USAGE_CPU_READ);
- nv50_draw_elements_inline(nv50, map, indexSize, start, count);
- nv50_unmap_vbufs(nv50);
- pipe_buffer_unmap(pscreen, indexBuffer);
- }
-
- BEGIN_RING(chan, tesla, NV50TCL_VERTEX_END, 1);
- OUT_RING (chan, 0);
+ nv50_draw_elements_instanced(pipe, indexBuffer, indexSize,
+ mode, start, count, 0, 1);
}
static INLINE boolean
@@ -726,6 +476,7 @@ nv50_vbo_static_attrib(struct nv50_context *nv50, unsigned attrib,
struct nouveau_bo *bo = nouveau_bo(vb->buffer);
float v[4];
int ret;
+ unsigned nr_components = util_format_get_nr_components(ve->src_format);
ret = nouveau_bo_map(bo, NOUVEAU_BO_RD);
if (ret)
@@ -736,9 +487,10 @@ nv50_vbo_static_attrib(struct nv50_context *nv50, unsigned attrib,
0, 0, 1, 1);
so = *pso;
if (!so)
- *pso = so = so_new(nv50->vtxelt_nr, nv50->vtxelt_nr * 4, 0);
+ *pso = so = so_new(nv50->vtxelt->num_elements,
+ nv50->vtxelt->num_elements * 4, 0);
- switch (ve->nr_components) {
+ switch (nr_components) {
case 4:
so_method(so, tesla, NV50TCL_VTX_ATTR_4F_X(attrib), 4);
so_data (so, fui(v[0]));
@@ -775,6 +527,18 @@ nv50_vbo_static_attrib(struct nv50_context *nv50, unsigned attrib,
}
void
+nv50_vtxelt_construct(struct nv50_vtxelt_stateobj *cso)
+{
+ unsigned i;
+
+ for (i = 0; i < cso->num_elements; ++i) {
+ struct pipe_vertex_element *ve = &cso->pipe[i];
+
+ cso->hw[i] = nv50_vbo_vtxelt_to_hw(ve);
+ }
+}
+
+struct nouveau_stateobj *
nv50_vbo_validate(struct nv50_context *nv50)
{
struct nouveau_grobj *tesla = nv50->screen->tesla;
@@ -783,30 +547,32 @@ nv50_vbo_validate(struct nv50_context *nv50)
/* don't validate if Gallium took away our buffers */
if (nv50->vtxbuf_nr == 0)
- return;
+ return NULL;
+
nv50->vbo_fifo = 0;
+ if (nv50->screen->force_push ||
+ nv50->vertprog->cfg.edgeflag_in < 16)
+ nv50->vbo_fifo = 0xffff;
- for (i = 0; i < nv50->vtxbuf_nr; ++i)
+ for (i = 0; i < nv50->vtxbuf_nr; i++) {
if (nv50->vtxbuf[i].stride &&
!(nv50->vtxbuf[i].buffer->usage & PIPE_BUFFER_USAGE_VERTEX))
nv50->vbo_fifo = 0xffff;
+ }
- if (NV50_USING_LOATHED_EDGEFLAG(nv50))
- nv50->vbo_fifo = 0xffff; /* vertprog can't set edgeflag */
-
- n_ve = MAX2(nv50->vtxelt_nr, nv50->state.vtxelt_nr);
+ n_ve = MAX2(nv50->vtxelt->num_elements, nv50->state.vtxelt_nr);
vtxattr = NULL;
- vtxbuf = so_new(n_ve * 2, n_ve * 5, nv50->vtxelt_nr * 4);
+ vtxbuf = so_new(n_ve * 2, n_ve * 5, nv50->vtxelt->num_elements * 4);
vtxfmt = so_new(1, n_ve, 0);
so_method(vtxfmt, tesla, NV50TCL_VERTEX_ARRAY_ATTRIB(0), n_ve);
- for (i = 0; i < nv50->vtxelt_nr; i++) {
- struct pipe_vertex_element *ve = &nv50->vtxelt[i];
+ for (i = 0; i < nv50->vtxelt->num_elements; i++) {
+ struct pipe_vertex_element *ve = &nv50->vtxelt->pipe[i];
struct pipe_vertex_buffer *vb =
&nv50->vtxbuf[ve->vertex_buffer_index];
struct nouveau_bo *bo = nouveau_bo(vb->buffer);
- uint32_t hw = nv50_vbo_vtxelt_to_hw(ve);
+ uint32_t hw = nv50->vtxelt->hw[i];
if (!vb->stride &&
nv50_vbo_static_attrib(nv50, i, &vtxattr, ve, vb)) {
@@ -821,13 +587,13 @@ nv50_vbo_validate(struct nv50_context *nv50)
}
if (nv50->vbo_fifo) {
- so_data (vtxfmt, hw |
- (ve->instance_divisor ? (1 << 4) : i));
+ so_data (vtxfmt, hw | (ve->instance_divisor ? (1 << 4) : i));
so_method(vtxbuf, tesla,
NV50TCL_VERTEX_ARRAY_FORMAT(i), 1);
so_data (vtxbuf, 0);
continue;
}
+
so_data(vtxfmt, hw | i);
so_method(vtxbuf, tesla, NV50TCL_VERTEX_ARRAY_FORMAT(i), 3);
@@ -855,355 +621,13 @@ nv50_vbo_validate(struct nv50_context *nv50)
so_method(vtxbuf, tesla, NV50TCL_VERTEX_ARRAY_FORMAT(i), 1);
so_data (vtxbuf, 0);
}
- nv50->state.vtxelt_nr = nv50->vtxelt_nr;
+ nv50->state.vtxelt_nr = nv50->vtxelt->num_elements;
- so_ref (vtxfmt, &nv50->state.vtxfmt);
so_ref (vtxbuf, &nv50->state.vtxbuf);
so_ref (vtxattr, &nv50->state.vtxattr);
so_ref (NULL, &vtxbuf);
- so_ref (NULL, &vtxfmt);
so_ref (NULL, &vtxattr);
+ return vtxfmt;
}
-typedef void (*pfn_push)(struct nouveau_channel *, void *);
-
-struct nv50_vbo_emitctx
-{
- pfn_push push[16];
- uint8_t *map[16];
- unsigned stride[16];
- unsigned nr_ve;
- unsigned vtx_dwords;
- unsigned vtx_max;
-
- float edgeflag;
- unsigned ve_edgeflag;
-};
-
-static INLINE void
-emit_vtx_next(struct nouveau_channel *chan, struct nv50_vbo_emitctx *emit)
-{
- unsigned i;
-
- for (i = 0; i < emit->nr_ve; ++i) {
- emit->push[i](chan, emit->map[i]);
- emit->map[i] += emit->stride[i];
- }
-}
-
-static INLINE void
-emit_vtx(struct nouveau_channel *chan, struct nv50_vbo_emitctx *emit,
- uint32_t vi)
-{
- unsigned i;
-
- for (i = 0; i < emit->nr_ve; ++i)
- emit->push[i](chan, emit->map[i] + emit->stride[i] * vi);
-}
-
-static INLINE boolean
-nv50_map_vbufs(struct nv50_context *nv50)
-{
- int i;
-
- for (i = 0; i < nv50->vtxbuf_nr; ++i) {
- struct pipe_vertex_buffer *vb = &nv50->vtxbuf[i];
- unsigned size = vb->stride * (vb->max_index + 1) + 16;
-
- if (nouveau_bo(vb->buffer)->map)
- continue;
-
- size = vb->stride * (vb->max_index + 1) + 16;
- size = MIN2(size, vb->buffer->size);
- if (!size)
- size = vb->buffer->size;
-
- if (nouveau_bo_map_range(nouveau_bo(vb->buffer),
- 0, size, NOUVEAU_BO_RD))
- break;
- }
-
- if (i == nv50->vtxbuf_nr)
- return TRUE;
- for (; i >= 0; --i)
- nouveau_bo_unmap(nouveau_bo(nv50->vtxbuf[i].buffer));
- return FALSE;
-}
-
-static void
-emit_b32_1(struct nouveau_channel *chan, void *data)
-{
- uint32_t *v = data;
-
- OUT_RING(chan, v[0]);
-}
-
-static void
-emit_b32_2(struct nouveau_channel *chan, void *data)
-{
- uint32_t *v = data;
-
- OUT_RING(chan, v[0]);
- OUT_RING(chan, v[1]);
-}
-
-static void
-emit_b32_3(struct nouveau_channel *chan, void *data)
-{
- uint32_t *v = data;
-
- OUT_RING(chan, v[0]);
- OUT_RING(chan, v[1]);
- OUT_RING(chan, v[2]);
-}
-
-static void
-emit_b32_4(struct nouveau_channel *chan, void *data)
-{
- uint32_t *v = data;
-
- OUT_RING(chan, v[0]);
- OUT_RING(chan, v[1]);
- OUT_RING(chan, v[2]);
- OUT_RING(chan, v[3]);
-}
-
-static void
-emit_b16_1(struct nouveau_channel *chan, void *data)
-{
- uint16_t *v = data;
-
- OUT_RING(chan, v[0]);
-}
-
-static void
-emit_b16_3(struct nouveau_channel *chan, void *data)
-{
- uint16_t *v = data;
-
- OUT_RING(chan, (v[1] << 16) | v[0]);
- OUT_RING(chan, v[2]);
-}
-
-static void
-emit_b08_1(struct nouveau_channel *chan, void *data)
-{
- uint8_t *v = data;
-
- OUT_RING(chan, v[0]);
-}
-
-static void
-emit_b08_3(struct nouveau_channel *chan, void *data)
-{
- uint8_t *v = data;
-
- OUT_RING(chan, (v[2] << 16) | (v[1] << 8) | v[0]);
-}
-
-static boolean
-emit_prepare(struct nv50_context *nv50, struct nv50_vbo_emitctx *emit,
- unsigned start)
-{
- unsigned i;
-
- if (nv50_map_vbufs(nv50) == FALSE)
- return FALSE;
-
- emit->ve_edgeflag = nv50->vertprog->cfg.edgeflag_in;
-
- emit->edgeflag = 0.5f;
- emit->nr_ve = 0;
- emit->vtx_dwords = 0;
-
- for (i = 0; i < nv50->vtxelt_nr; ++i) {
- struct pipe_vertex_element *ve;
- struct pipe_vertex_buffer *vb;
- unsigned n, size;
- const struct util_format_description *desc;
-
- ve = &nv50->vtxelt[i];
- vb = &nv50->vtxbuf[ve->vertex_buffer_index];
- if (!(nv50->vbo_fifo & (1 << i)) || ve->instance_divisor)
- continue;
- n = emit->nr_ve++;
-
- emit->stride[n] = vb->stride;
- emit->map[n] = (uint8_t *)nouveau_bo(vb->buffer)->map +
- vb->buffer_offset +
- (start * vb->stride + ve->src_offset);
-
- desc = util_format_description(ve->src_format);
- assert(desc);
-
- size = util_format_get_component_bits(
- ve->src_format, UTIL_FORMAT_COLORSPACE_RGB, 0);
-
- assert(ve->nr_components > 0 && ve->nr_components <= 4);
-
- /* It shouldn't be necessary to push the implicit 1s
- * for case 3 and size 8 cases 1, 2, 3.
- */
- switch (size) {
- default:
- NOUVEAU_ERR("unsupported vtxelt size: %u\n", size);
- return FALSE;
- case 32:
- switch (ve->nr_components) {
- case 1: emit->push[n] = emit_b32_1; break;
- case 2: emit->push[n] = emit_b32_2; break;
- case 3: emit->push[n] = emit_b32_3; break;
- case 4: emit->push[n] = emit_b32_4; break;
- }
- emit->vtx_dwords += ve->nr_components;
- break;
- case 16:
- switch (ve->nr_components) {
- case 1: emit->push[n] = emit_b16_1; break;
- case 2: emit->push[n] = emit_b32_1; break;
- case 3: emit->push[n] = emit_b16_3; break;
- case 4: emit->push[n] = emit_b32_2; break;
- }
- emit->vtx_dwords += (ve->nr_components + 1) >> 1;
- break;
- case 8:
- switch (ve->nr_components) {
- case 1: emit->push[n] = emit_b08_1; break;
- case 2: emit->push[n] = emit_b16_1; break;
- case 3: emit->push[n] = emit_b08_3; break;
- case 4: emit->push[n] = emit_b32_1; break;
- }
- emit->vtx_dwords += 1;
- break;
- }
- }
-
- emit->vtx_max = 512 / emit->vtx_dwords;
- if (emit->ve_edgeflag < 16)
- emit->vtx_max = 1;
-
- return TRUE;
-}
-
-static INLINE void
-set_edgeflag(struct nouveau_channel *chan,
- struct nouveau_grobj *tesla,
- struct nv50_vbo_emitctx *emit, uint32_t index)
-{
- unsigned i = emit->ve_edgeflag;
-
- if (i < 16) {
- float f = *((float *)(emit->map[i] + index * emit->stride[i]));
-
- if (emit->edgeflag != f) {
- emit->edgeflag = f;
-
- BEGIN_RING(chan, tesla, 0x15e4, 1);
- OUT_RING (chan, f ? 1 : 0);
- }
- }
-}
-
-static boolean
-nv50_push_arrays(struct nv50_context *nv50, unsigned start, unsigned count)
-{
- struct nouveau_channel *chan = nv50->screen->base.channel;
- struct nouveau_grobj *tesla = nv50->screen->tesla;
- struct nv50_vbo_emitctx emit;
- if (emit_prepare(nv50, &emit, start) == FALSE)
- return FALSE;
-
- while (count) {
- unsigned i, dw, nr = MIN2(count, emit.vtx_max);
- dw = nr * emit.vtx_dwords;
-
- set_edgeflag(chan, tesla, &emit, 0); /* nr will be 1 */
-
- BEGIN_RING_NI(chan, tesla, NV50TCL_VERTEX_DATA, dw);
- for (i = 0; i < nr; ++i)
- emit_vtx_next(chan, &emit);
-
- count -= nr;
- }
-
- return TRUE;
-}
-
-static boolean
-nv50_push_elements_u32(struct nv50_context *nv50, uint32_t *map, unsigned count)
-{
- struct nouveau_channel *chan = nv50->screen->base.channel;
- struct nouveau_grobj *tesla = nv50->screen->tesla;
- struct nv50_vbo_emitctx emit;
-
- if (emit_prepare(nv50, &emit, 0) == FALSE)
- return FALSE;
-
- while (count) {
- unsigned i, dw, nr = MIN2(count, emit.vtx_max);
- dw = nr * emit.vtx_dwords;
-
- set_edgeflag(chan, tesla, &emit, *map);
-
- BEGIN_RING_NI(chan, tesla, NV50TCL_VERTEX_DATA, dw);
- for (i = 0; i < nr; ++i)
- emit_vtx(chan, &emit, *map++);
-
- count -= nr;
- }
-
- return TRUE;
-}
-
-static boolean
-nv50_push_elements_u16(struct nv50_context *nv50, uint16_t *map, unsigned count)
-{
- struct nouveau_channel *chan = nv50->screen->base.channel;
- struct nouveau_grobj *tesla = nv50->screen->tesla;
- struct nv50_vbo_emitctx emit;
-
- if (emit_prepare(nv50, &emit, 0) == FALSE)
- return FALSE;
-
- while (count) {
- unsigned i, dw, nr = MIN2(count, emit.vtx_max);
- dw = nr * emit.vtx_dwords;
-
- set_edgeflag(chan, tesla, &emit, *map);
-
- BEGIN_RING_NI(chan, tesla, NV50TCL_VERTEX_DATA, dw);
- for (i = 0; i < nr; ++i)
- emit_vtx(chan, &emit, *map++);
-
- count -= nr;
- }
-
- return TRUE;
-}
-
-static boolean
-nv50_push_elements_u08(struct nv50_context *nv50, uint8_t *map, unsigned count)
-{
- struct nouveau_channel *chan = nv50->screen->base.channel;
- struct nouveau_grobj *tesla = nv50->screen->tesla;
- struct nv50_vbo_emitctx emit;
-
- if (emit_prepare(nv50, &emit, 0) == FALSE)
- return FALSE;
-
- while (count) {
- unsigned i, dw, nr = MIN2(count, emit.vtx_max);
- dw = nr * emit.vtx_dwords;
-
- set_edgeflag(chan, tesla, &emit, *map);
-
- BEGIN_RING_NI(chan, tesla, NV50TCL_VERTEX_DATA, dw);
- for (i = 0; i < nr; ++i)
- emit_vtx(chan, &emit, *map++);
-
- count -= nr;
- }
-
- return TRUE;
-}
diff --git a/src/gallium/drivers/nvfx/Makefile b/src/gallium/drivers/nvfx/Makefile
new file mode 100644
index 0000000000..dfe97e6ed5
--- /dev/null
+++ b/src/gallium/drivers/nvfx/Makefile
@@ -0,0 +1,32 @@
+TOP = ../../../..
+include $(TOP)/configs/current
+
+LIBNAME = nvfx
+
+C_SOURCES = \
+ nv04_surface_2d.c \
+ nvfx_context.c \
+ nvfx_clear.c \
+ nvfx_draw.c \
+ nvfx_fragprog.c \
+ nvfx_fragtex.c \
+ nv30_fragtex.c \
+ nv40_fragtex.c \
+ nvfx_miptree.c \
+ nvfx_query.c \
+ nvfx_screen.c \
+ nvfx_state.c \
+ nvfx_state_blend.c \
+ nvfx_state_emit.c \
+ nvfx_state_fb.c \
+ nvfx_state_rasterizer.c \
+ nvfx_state_scissor.c \
+ nvfx_state_stipple.c \
+ nvfx_state_viewport.c \
+ nvfx_state_zsa.c \
+ nvfx_surface.c \
+ nvfx_transfer.c \
+ nvfx_vbo.c \
+ nvfx_vertprog.c
+
+include ../../Makefile.template
diff --git a/src/gallium/drivers/nouveau/nv04_surface_2d.c b/src/gallium/drivers/nvfx/nv04_surface_2d.c
index b074547c4d..6784170c00 100644
--- a/src/gallium/drivers/nouveau/nv04_surface_2d.c
+++ b/src/gallium/drivers/nvfx/nv04_surface_2d.c
@@ -25,7 +25,7 @@ nv04_surface_format(enum pipe_format format)
case PIPE_FORMAT_B8G8R8X8_UNORM:
case PIPE_FORMAT_B8G8R8A8_UNORM:
return NV04_CONTEXT_SURFACES_2D_FORMAT_A8R8G8B8;
- case PIPE_FORMAT_S8Z24_UNORM:
+ case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
case PIPE_FORMAT_X8Z24_UNORM:
return NV04_CONTEXT_SURFACES_2D_FORMAT_Y32;
default:
@@ -45,7 +45,7 @@ nv04_rect_format(enum pipe_format format)
return NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT_A16R5G6B5;
case PIPE_FORMAT_B8G8R8X8_UNORM:
case PIPE_FORMAT_B8G8R8A8_UNORM:
- case PIPE_FORMAT_S8Z24_UNORM:
+ case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
case PIPE_FORMAT_X8Z24_UNORM:
return NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT_A8R8G8B8;
default:
@@ -518,7 +518,6 @@ nv04_surface_wrap_for_render(struct pipe_screen *pscreen, struct nv04_surface_2d
ns->base.usage = PIPE_BUFFER_USAGE_GPU_WRITE | NOUVEAU_BUFFER_USAGE_NO_RENDER | PIPE_BUFFER_USAGE_GPU_READ;
}
- struct nv40_screen* screen = (struct nv40_screen*)pscreen;
ns->base.usage = PIPE_BUFFER_USAGE_GPU_READ | PIPE_BUFFER_USAGE_GPU_WRITE;
struct pipe_texture templ;
@@ -544,4 +543,3 @@ nv04_surface_wrap_for_render(struct pipe_screen *pscreen, struct nv04_surface_2d
return temp_ns;
}
-
diff --git a/src/gallium/drivers/nouveau/nv04_surface_2d.h b/src/gallium/drivers/nvfx/nv04_surface_2d.h
index ce696a11a3..ce696a11a3 100644
--- a/src/gallium/drivers/nouveau/nv04_surface_2d.h
+++ b/src/gallium/drivers/nvfx/nv04_surface_2d.h
diff --git a/src/gallium/drivers/nv30/nv30_fragtex.c b/src/gallium/drivers/nvfx/nv30_fragtex.c
index f7d98f3f20..d3f3edb327 100644
--- a/src/gallium/drivers/nv30/nv30_fragtex.c
+++ b/src/gallium/drivers/nvfx/nv30_fragtex.c
@@ -1,7 +1,37 @@
#include "util/u_format.h"
-#include "nv30_context.h"
+#include "nvfx_context.h"
#include "nouveau/nouveau_util.h"
+#include "nvfx_tex.h"
+
+void
+nv30_sampler_state_init(struct pipe_context *pipe,
+ struct nvfx_sampler_state *ps,
+ const struct pipe_sampler_state *cso)
+{
+ if (cso->max_anisotropy >= 8) {
+ ps->en |= NV34TCL_TX_ENABLE_ANISO_8X;
+ } else
+ if (cso->max_anisotropy >= 4) {
+ ps->en |= NV34TCL_TX_ENABLE_ANISO_4X;
+ } else
+ if (cso->max_anisotropy >= 2) {
+ ps->en |= NV34TCL_TX_ENABLE_ANISO_2X;
+ }
+
+ {
+ float limit;
+
+ limit = CLAMP(cso->lod_bias, -16.0, 15.0);
+ ps->filt |= (int)(cso->lod_bias * 256.0) & 0x1fff;
+
+ limit = CLAMP(cso->max_lod, 0.0, 15.0);
+ ps->en |= (int)(limit) << 14 /*NV34TCL_TX_ENABLE_MIPMAP_MAX_LOD_SHIFT*/;
+
+ limit = CLAMP(cso->min_lod, 0.0, 15.0);
+ ps->en |= (int)(limit) << 26 /*NV34TCL_TX_ENABLE_MIPMAP_MIN_LOD_SHIFT*/;
+ }
+}
#define _(m,tf,ts0x,ts0y,ts0z,ts0w,ts1x,ts1y,ts1z,ts1w) \
{ \
@@ -33,7 +63,7 @@ nv30_texture_formats[] = {
_(I8_UNORM , L8 , S1, S1, S1, S1, X, X, X, X),
_(L8A8_UNORM , A8L8 , S1, S1, S1, S1, X, X, X, Y),
_(Z16_UNORM , R5G6B5 , S1, S1, S1, ONE, X, X, X, X),
- _(S8Z24_UNORM , A8R8G8B8, S1, S1, S1, ONE, X, X, X, X),
+ _(S8_USCALED_Z24_UNORM , A8R8G8B8, S1, S1, S1, ONE, X, X, X, X),
_(DXT1_RGB , DXT1 , S1, S1, S1, ONE, X, Y, Z, W),
_(DXT1_RGBA , DXT1 , S1, S1, S1, S1, X, Y, Z, W),
_(DXT3_RGBA , DXT3 , S1, S1, S1, S1, X, Y, Z, W),
@@ -57,11 +87,11 @@ nv30_fragtex_format(uint pipe_format)
}
-static struct nouveau_stateobj *
-nv30_fragtex_build(struct nv30_context *nv30, int unit)
+struct nouveau_stateobj *
+nv30_fragtex_build(struct nvfx_context *nvfx, int unit)
{
- struct nv30_sampler_state *ps = nv30->tex_sampler[unit];
- struct nv30_miptree *nv30mt = nv30->tex_miptree[unit];
+ struct nvfx_sampler_state *ps = nvfx->tex_sampler[unit];
+ struct nvfx_miptree *nv30mt = (struct nvfx_miptree *)nvfx->fragment_sampler_views[unit]->texture;
struct pipe_texture *pt = &nv30mt->base;
struct nouveau_bo *bo = nouveau_bo(nv30mt->buffer);
struct nv30_texture_format *tf;
@@ -101,7 +131,7 @@ nv30_fragtex_build(struct nv30_context *nv30, int unit)
txs = tf->swizzle;
so = so_new(1, 8, 2);
- so_method(so, nv30->screen->rankine, NV34TCL_TX_OFFSET(unit), 8);
+ so_method(so, nvfx->screen->eng3d, NV34TCL_TX_OFFSET(unit), 8);
so_reloc (so, bo, 0, tex_flags | NOUVEAU_BO_LOW, 0, 0);
so_reloc (so, bo, txf, tex_flags | NOUVEAU_BO_OR,
NV34TCL_TX_FORMAT_DMA0, NV34TCL_TX_FORMAT_DMA1);
@@ -115,47 +145,3 @@ nv30_fragtex_build(struct nv30_context *nv30, int unit)
return so;
}
-
-static boolean
-nv30_fragtex_validate(struct nv30_context *nv30)
-{
- struct nv30_fragment_program *fp = nv30->fragprog;
- struct nv30_state *state = &nv30->state;
- struct nouveau_stateobj *so;
- unsigned samplers, unit;
-
- samplers = state->fp_samplers & ~fp->samplers;
- while (samplers) {
- unit = ffs(samplers) - 1;
- samplers &= ~(1 << unit);
-
- so = so_new(1, 1, 0);
- so_method(so, nv30->screen->rankine, NV34TCL_TX_ENABLE(unit), 1);
- so_data (so, 0);
- so_ref(so, &nv30->state.hw[NV30_STATE_FRAGTEX0 + unit]);
- so_ref(NULL, &so);
- state->dirty |= (1ULL << (NV30_STATE_FRAGTEX0 + unit));
- }
-
- samplers = nv30->dirty_samplers & fp->samplers;
- while (samplers) {
- unit = ffs(samplers) - 1;
- samplers &= ~(1 << unit);
-
- so = nv30_fragtex_build(nv30, unit);
- so_ref(so, &nv30->state.hw[NV30_STATE_FRAGTEX0 + unit]);
- so_ref(NULL, &so);
- state->dirty |= (1ULL << (NV30_STATE_FRAGTEX0 + unit));
- }
-
- nv30->state.fp_samplers = fp->samplers;
- return FALSE;
-}
-
-struct nv30_state_entry nv30_state_fragtex = {
- .validate = nv30_fragtex_validate,
- .dirty = {
- .pipe = NV30_NEW_SAMPLER | NV30_NEW_FRAGPROG,
- .hw = 0
- }
-};
diff --git a/src/gallium/drivers/nvfx/nv30_vertprog.h b/src/gallium/drivers/nvfx/nv30_vertprog.h
new file mode 100644
index 0000000000..ec0444c07f
--- /dev/null
+++ b/src/gallium/drivers/nvfx/nv30_vertprog.h
@@ -0,0 +1,169 @@
+#ifndef __NV30_SHADER_H__
+#define __NV30_SHADER_H__
+
+/* Vertex programs instruction set
+ *
+ * 128bit opcodes, split into 4 32-bit ones for ease of use.
+ *
+ * Non-native instructions
+ * ABS - MOV + NV40_VP_INST0_DEST_ABS
+ * POW - EX2 + MUL + LG2
+ * SUB - ADD, second source negated
+ * SWZ - MOV
+ * XPD -
+ *
+ * Register access
+ * - Only one INPUT can be accessed per-instruction (move extras into TEMPs)
+ * - Only one CONST can be accessed per-instruction (move extras into TEMPs)
+ *
+ * Relative Addressing
+ * According to the value returned for
+ * MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB
+ *
+ * there are only two address registers available. The destination in the
+ * ARL instruction is set to TEMP <n> (The temp isn't actually written).
+ *
+ * When using vanilla ARB_v_p, the proprietary driver will squish both the
+ * available ADDRESS regs into the first hardware reg in the X and Y
+ * components.
+ *
+ * To use an address reg as an index into consts, the CONST_SRC is set to
+ * (const_base + offset) and INDEX_CONST is set.
+ *
+ * To access the second address reg use ADDR_REG_SELECT_1. A particular
+ * component of the address regs is selected with ADDR_SWZ.
+ *
+ * Only one address register can be accessed per instruction.
+ *
+ * Conditional execution (see NV_vertex_program{2,3} for details) Conditional
+ * execution of an instruction is enabled by setting COND_TEST_ENABLE, and
+ * selecting the condition which will allow the test to pass with
+ * COND_{FL,LT,...}. It is possible to swizzle the values in the condition
+ * register, which allows for testing against an individual component.
+ *
+ * Branching:
+ *
+ * The BRA/CAL instructions seem to follow a slightly different opcode
+ * layout. The destination instruction ID (IADDR) overlaps a source field.
+ * Instruction ID's seem to be numbered based on the UPLOAD_FROM_ID FIFO
+ * command, and is incremented automatically on each UPLOAD_INST FIFO
+ * command.
+ *
+ * Conditional branching is achieved by using the condition tests described
+ * above. There doesn't appear to be dedicated looping instructions, but
+ * this can be done using a temp reg + conditional branching.
+ *
+ * Subroutines may be uploaded before the main program itself, but the first
+ * executed instruction is determined by the PROGRAM_START_ID FIFO command.
+ *
+ */
+
+/* DWORD 0 */
+
+#define NV30_VP_INST_ADDR_REG_SELECT_1 (1 << 24)
+#define NV30_VP_INST_SRC2_ABS (1 << 23) /* guess */
+#define NV30_VP_INST_SRC1_ABS (1 << 22) /* guess */
+#define NV30_VP_INST_SRC0_ABS (1 << 21) /* guess */
+#define NV30_VP_INST_VEC_RESULT (1 << 20)
+#define NV30_VP_INST_DEST_TEMP_ID_SHIFT 16
+#define NV30_VP_INST_DEST_TEMP_ID_MASK (0x0F << 16)
+#define NV30_VP_INST_COND_UPDATE_ENABLE (1<<15)
+#define NV30_VP_INST_VEC_DEST_TEMP_MASK (0xF << 16)
+#define NV30_VP_INST_COND_TEST_ENABLE (1<<14)
+#define NV30_VP_INST_COND_SHIFT 11
+#define NV30_VP_INST_COND_MASK (0x07 << 11)
+#define NV30_VP_INST_COND_SWZ_X_SHIFT 9
+#define NV30_VP_INST_COND_SWZ_X_MASK (0x03 << 9)
+#define NV30_VP_INST_COND_SWZ_Y_SHIFT 7
+#define NV30_VP_INST_COND_SWZ_Y_MASK (0x03 << 7)
+#define NV30_VP_INST_COND_SWZ_Z_SHIFT 5
+#define NV30_VP_INST_COND_SWZ_Z_MASK (0x03 << 5)
+#define NV30_VP_INST_COND_SWZ_W_SHIFT 3
+#define NV30_VP_INST_COND_SWZ_W_MASK (0x03 << 3)
+#define NV30_VP_INST_COND_SWZ_ALL_SHIFT 3
+#define NV30_VP_INST_COND_SWZ_ALL_MASK (0xFF << 3)
+#define NV30_VP_INST_ADDR_SWZ_SHIFT 1
+#define NV30_VP_INST_ADDR_SWZ_MASK (0x03 << 1)
+#define NV30_VP_INST_SCA_OPCODEH_SHIFT 0
+#define NV30_VP_INST_SCA_OPCODEH_MASK (0x01 << 0)
+
+/* DWORD 1 */
+#define NV30_VP_INST_SCA_OPCODEL_SHIFT 28
+#define NV30_VP_INST_SCA_OPCODEL_MASK (0x0F << 28)
+#define NV30_VP_INST_VEC_OPCODE_SHIFT 23
+#define NV30_VP_INST_VEC_OPCODE_MASK (0x1F << 23)
+#define NV30_VP_INST_CONST_SRC_SHIFT 14
+#define NV30_VP_INST_CONST_SRC_MASK (0xFF << 14)
+#define NV30_VP_INST_INPUT_SRC_SHIFT 9 /*NV20*/
+#define NV30_VP_INST_INPUT_SRC_MASK (0x0F << 9) /*NV20*/
+#define NV30_VP_INST_SRC0H_SHIFT 0 /*NV20*/
+#define NV30_VP_INST_SRC0H_MASK (0x1FF << 0) /*NV20*/
+
+/* Please note: the IADDR fields overlap other fields because they are used
+ * only for branch instructions. See Branching: label above
+ *
+ * DWORD 2
+ */
+#define NV30_VP_INST_SRC0L_SHIFT 26 /*NV20*/
+#define NV30_VP_INST_SRC0L_MASK (0x3F <<26) /* NV30_VP_SRC0_LOW_MASK << 26 */
+#define NV30_VP_INST_SRC1_SHIFT 11 /*NV20*/
+#define NV30_VP_INST_SRC1_MASK (0x7FFF<<11) /*NV20*/
+#define NV30_VP_INST_SRC2H_SHIFT 0 /*NV20*/
+#define NV30_VP_INST_SRC2H_MASK (0x7FF << 0) /* NV30_VP_SRC2_HIGH_MASK >> 4*/
+#define NV30_VP_INST_IADDR_SHIFT 2
+#define NV30_VP_INST_IADDR_MASK (0xF << 28) /* NV30_VP_SRC2_LOW_MASK << 28 */
+
+/* DWORD 3 */
+#define NV30_VP_INST_SRC2L_SHIFT 28 /*NV20*/
+#define NV30_VP_INST_SRC2L_MASK (0x0F <<28) /*NV20*/
+#define NV30_VP_INST_STEMP_WRITEMASK_SHIFT 24
+#define NV30_VP_INST_STEMP_WRITEMASK_MASK (0x0F << 24)
+#define NV30_VP_INST_VTEMP_WRITEMASK_SHIFT 20
+#define NV30_VP_INST_VTEMP_WRITEMASK_MASK (0x0F << 20)
+#define NV30_VP_INST_SDEST_WRITEMASK_SHIFT 16
+#define NV30_VP_INST_SDEST_WRITEMASK_MASK (0x0F << 16)
+#define NV30_VP_INST_VDEST_WRITEMASK_SHIFT 12 /*NV20*/
+#define NV30_VP_INST_VDEST_WRITEMASK_MASK (0x0F << 12) /*NV20*/
+#define NV30_VP_INST_DEST_SHIFT 2
+#define NV30_VP_INST_DEST_MASK (0x0F << 2)
+# define NV30_VP_INST_DEST_POS 0
+# define NV30_VP_INST_DEST_BFC0 1
+# define NV30_VP_INST_DEST_BFC1 2
+# define NV30_VP_INST_DEST_COL0 3
+# define NV30_VP_INST_DEST_COL1 4
+# define NV30_VP_INST_DEST_FOGC 5
+# define NV30_VP_INST_DEST_PSZ 6
+# define NV30_VP_INST_DEST_TC(n) (8+n)
+
+/* Useful to split the source selection regs into their pieces */
+#define NV30_VP_SRC0_HIGH_SHIFT 6
+#define NV30_VP_SRC0_HIGH_MASK 0x00007FC0
+#define NV30_VP_SRC0_LOW_MASK 0x0000003F
+#define NV30_VP_SRC2_HIGH_SHIFT 4
+#define NV30_VP_SRC2_HIGH_MASK 0x00007FF0
+#define NV30_VP_SRC2_LOW_MASK 0x0000000F
+
+
+/* Source-register definition - matches NV20 exactly */
+#define NV30_VP_SRC_NEGATE (1<<14)
+#define NV30_VP_SRC_SWZ_X_SHIFT 12
+#define NV30_VP_SRC_REG_SWZ_X_MASK (0x03 <<12)
+#define NV30_VP_SRC_SWZ_Y_SHIFT 10
+#define NV30_VP_SRC_REG_SWZ_Y_MASK (0x03 <<10)
+#define NV30_VP_SRC_SWZ_Z_SHIFT 8
+#define NV30_VP_SRC_REG_SWZ_Z_MASK (0x03 << 8)
+#define NV30_VP_SRC_SWZ_W_SHIFT 6
+#define NV30_VP_SRC_REG_SWZ_W_MASK (0x03 << 6)
+#define NV30_VP_SRC_REG_SWZ_ALL_SHIFT 6
+#define NV30_VP_SRC_REG_SWZ_ALL_MASK (0xFF << 6)
+#define NV30_VP_SRC_TEMP_SRC_SHIFT 2
+#define NV30_VP_SRC_REG_TEMP_ID_MASK (0x0F << 0)
+#define NV30_VP_SRC_REG_TYPE_SHIFT 0
+#define NV30_VP_SRC_REG_TYPE_MASK (0x03 << 0)
+#define NV30_VP_SRC_REG_TYPE_TEMP 1
+#define NV30_VP_SRC_REG_TYPE_INPUT 2
+#define NV30_VP_SRC_REG_TYPE_CONST 3 /* guess */
+
+#include "nvfx_shader.h"
+
+#endif
diff --git a/src/gallium/drivers/nv40/nv40_fragtex.c b/src/gallium/drivers/nvfx/nv40_fragtex.c
index b60118922a..fe87cebbb6 100644
--- a/src/gallium/drivers/nv40/nv40_fragtex.c
+++ b/src/gallium/drivers/nvfx/nv40_fragtex.c
@@ -1,18 +1,63 @@
#include "util/u_format.h"
+#include "nvfx_context.h"
+#include "nvfx_tex.h"
-#include "nv40_context.h"
+void
+nv40_sampler_state_init(struct pipe_context *pipe,
+ struct nvfx_sampler_state *ps,
+ const struct pipe_sampler_state *cso)
+{
+ if (cso->max_anisotropy >= 2) {
+ /* no idea, binary driver sets it, works without it.. meh.. */
+ ps->wrap |= (1 << 5);
+
+ if (cso->max_anisotropy >= 16) {
+ ps->en |= NV40TCL_TEX_ENABLE_ANISO_16X;
+ } else
+ if (cso->max_anisotropy >= 12) {
+ ps->en |= NV40TCL_TEX_ENABLE_ANISO_12X;
+ } else
+ if (cso->max_anisotropy >= 10) {
+ ps->en |= NV40TCL_TEX_ENABLE_ANISO_10X;
+ } else
+ if (cso->max_anisotropy >= 8) {
+ ps->en |= NV40TCL_TEX_ENABLE_ANISO_8X;
+ } else
+ if (cso->max_anisotropy >= 6) {
+ ps->en |= NV40TCL_TEX_ENABLE_ANISO_6X;
+ } else
+ if (cso->max_anisotropy >= 4) {
+ ps->en |= NV40TCL_TEX_ENABLE_ANISO_4X;
+ } else {
+ ps->en |= NV40TCL_TEX_ENABLE_ANISO_2X;
+ }
+ }
+
+ {
+ float limit;
+
+ limit = CLAMP(cso->lod_bias, -16.0, 15.0);
+ ps->filt |= (int)(cso->lod_bias * 256.0) & 0x1fff;
+
+ limit = CLAMP(cso->max_lod, 0.0, 15.0);
+ ps->en |= (int)(limit * 256.0) << 7;
+
+ limit = CLAMP(cso->min_lod, 0.0, 15.0);
+ ps->en |= (int)(limit * 256.0) << 19;
+ }
+}
#define _(m,tf,ts0x,ts0y,ts0z,ts0w,ts1x,ts1y,ts1z,ts1w,sx,sy,sz,sw) \
{ \
TRUE, \
PIPE_FORMAT_##m, \
NV40TCL_TEX_FORMAT_FORMAT_##tf, \
- (NV40TCL_TEX_SWIZZLE_S0_X_##ts0x | NV40TCL_TEX_SWIZZLE_S0_Y_##ts0y | \
- NV40TCL_TEX_SWIZZLE_S0_Z_##ts0z | NV40TCL_TEX_SWIZZLE_S0_W_##ts0w | \
- NV40TCL_TEX_SWIZZLE_S1_X_##ts1x | NV40TCL_TEX_SWIZZLE_S1_Y_##ts1y | \
- NV40TCL_TEX_SWIZZLE_S1_Z_##ts1z | NV40TCL_TEX_SWIZZLE_S1_W_##ts1w), \
- ((NV40TCL_TEX_FILTER_SIGNED_RED*sx) | (NV40TCL_TEX_FILTER_SIGNED_GREEN*sy) | \
- (NV40TCL_TEX_FILTER_SIGNED_BLUE*sz) | (NV40TCL_TEX_FILTER_SIGNED_ALPHA*sw)) \
+ (NV34TCL_TX_SWIZZLE_S0_X_##ts0x | NV34TCL_TX_SWIZZLE_S0_Y_##ts0y | \
+ NV34TCL_TX_SWIZZLE_S0_Z_##ts0z | NV34TCL_TX_SWIZZLE_S0_W_##ts0w | \
+ NV34TCL_TX_SWIZZLE_S1_X_##ts1x | NV34TCL_TX_SWIZZLE_S1_Y_##ts1y | \
+ NV34TCL_TX_SWIZZLE_S1_Z_##ts1z | NV34TCL_TX_SWIZZLE_S1_W_##ts1w), \
+ ((NV34TCL_TX_FILTER_SIGNED_RED*sx) | (NV34TCL_TX_FILTER_SIGNED_GREEN*sy) | \
+ (NV34TCL_TX_FILTER_SIGNED_BLUE*sz) | (NV34TCL_TX_FILTER_SIGNED_ALPHA*sw)) \
}
struct nv40_texture_format {
@@ -36,7 +81,7 @@ nv40_texture_formats[] = {
_(I8_UNORM , L8 , S1, S1, S1, S1, X, X, X, X, 0, 0, 0, 0),
_(L8A8_UNORM , A8L8 , S1, S1, S1, S1, X, X, X, Y, 0, 0, 0, 0),
_(Z16_UNORM , Z16 , S1, S1, S1, ONE, X, X, X, X, 0, 0, 0, 0),
- _(S8Z24_UNORM , Z24 , S1, S1, S1, ONE, X, X, X, X, 0, 0, 0, 0),
+ _(S8_USCALED_Z24_UNORM , Z24 , S1, S1, S1, ONE, X, X, X, X, 0, 0, 0, 0),
_(DXT1_RGB , DXT1 , S1, S1, S1, ONE, X, Y, Z, W, 0, 0, 0, 0),
_(DXT1_RGBA , DXT1 , S1, S1, S1, S1, X, Y, Z, W, 0, 0, 0, 0),
_(DXT3_RGBA , DXT3 , S1, S1, S1, S1, X, Y, Z, W, 0, 0, 0, 0),
@@ -60,11 +105,11 @@ nv40_fragtex_format(uint pipe_format)
}
-static struct nouveau_stateobj *
-nv40_fragtex_build(struct nv40_context *nv40, int unit)
+struct nouveau_stateobj *
+nv40_fragtex_build(struct nvfx_context *nvfx, int unit)
{
- struct nv40_sampler_state *ps = nv40->tex_sampler[unit];
- struct nv40_miptree *nv40mt = nv40->tex_miptree[unit];
+ struct nvfx_sampler_state *ps = nvfx->tex_sampler[unit];
+ struct nvfx_miptree *nv40mt = (struct nvfx_miptree *)nvfx->fragment_sampler_views[unit]->texture;
struct nouveau_bo *bo = nouveau_bo(nv40mt->buffer);
struct pipe_texture *pt = &nv40mt->base;
struct nv40_texture_format *tf;
@@ -81,20 +126,20 @@ nv40_fragtex_build(struct nv40_context *nv40, int unit)
txf |= ((pt->last_level + 1) << NV40TCL_TEX_FORMAT_MIPMAP_COUNT_SHIFT);
if (1) /* XXX */
- txf |= NV40TCL_TEX_FORMAT_NO_BORDER;
+ txf |= NV34TCL_TX_FORMAT_NO_BORDER;
switch (pt->target) {
case PIPE_TEXTURE_CUBE:
- txf |= NV40TCL_TEX_FORMAT_CUBIC;
+ txf |= NV34TCL_TX_FORMAT_CUBIC;
/* fall-through */
case PIPE_TEXTURE_2D:
- txf |= NV40TCL_TEX_FORMAT_DIMS_2D;
+ txf |= NV34TCL_TX_FORMAT_DIMS_2D;
break;
case PIPE_TEXTURE_3D:
- txf |= NV40TCL_TEX_FORMAT_DIMS_3D;
+ txf |= NV34TCL_TX_FORMAT_DIMS_3D;
break;
case PIPE_TEXTURE_1D:
- txf |= NV40TCL_TEX_FORMAT_DIMS_1D;
+ txf |= NV34TCL_TX_FORMAT_DIMS_1D;
break;
default:
NOUVEAU_ERR("Unknown target %d\n", pt->target);
@@ -111,63 +156,19 @@ nv40_fragtex_build(struct nv40_context *nv40, int unit)
txs = tf->swizzle;
so = so_new(2, 9, 2);
- so_method(so, nv40->screen->curie, NV40TCL_TEX_OFFSET(unit), 8);
+ so_method(so, nvfx->screen->eng3d, NV34TCL_TX_OFFSET(unit), 8);
so_reloc (so, bo, 0, tex_flags | NOUVEAU_BO_LOW, 0, 0);
so_reloc (so, bo, txf, tex_flags | NOUVEAU_BO_OR,
- NV40TCL_TEX_FORMAT_DMA0, NV40TCL_TEX_FORMAT_DMA1);
+ NV34TCL_TX_FORMAT_DMA0, NV34TCL_TX_FORMAT_DMA1);
so_data (so, ps->wrap);
so_data (so, NV40TCL_TEX_ENABLE_ENABLE | ps->en);
so_data (so, txs);
so_data (so, ps->filt | tf->sign | 0x2000 /*voodoo*/);
- so_data (so, (pt->width0 << NV40TCL_TEX_SIZE0_W_SHIFT) |
+ so_data (so, (pt->width0 << NV34TCL_TX_NPOT_SIZE_W_SHIFT) |
pt->height0);
so_data (so, ps->bcol);
- so_method(so, nv40->screen->curie, NV40TCL_TEX_SIZE1(unit), 1);
+ so_method(so, nvfx->screen->eng3d, NV40TCL_TEX_SIZE1(unit), 1);
so_data (so, (pt->depth0 << NV40TCL_TEX_SIZE1_DEPTH_SHIFT) | txp);
return so;
}
-
-static boolean
-nv40_fragtex_validate(struct nv40_context *nv40)
-{
- struct nv40_fragment_program *fp = nv40->fragprog;
- struct nv40_state *state = &nv40->state;
- struct nouveau_stateobj *so;
- unsigned samplers, unit;
-
- samplers = state->fp_samplers & ~fp->samplers;
- while (samplers) {
- unit = ffs(samplers) - 1;
- samplers &= ~(1 << unit);
-
- so = so_new(1, 1, 0);
- so_method(so, nv40->screen->curie, NV40TCL_TEX_ENABLE(unit), 1);
- so_data (so, 0);
- so_ref(so, &nv40->state.hw[NV40_STATE_FRAGTEX0 + unit]);
- state->dirty |= (1ULL << (NV40_STATE_FRAGTEX0 + unit));
- }
-
- samplers = nv40->dirty_samplers & fp->samplers;
- while (samplers) {
- unit = ffs(samplers) - 1;
- samplers &= ~(1 << unit);
-
- so = nv40_fragtex_build(nv40, unit);
- so_ref(so, &nv40->state.hw[NV40_STATE_FRAGTEX0 + unit]);
- so_ref(NULL, &so);
- state->dirty |= (1ULL << (NV40_STATE_FRAGTEX0 + unit));
- }
-
- nv40->state.fp_samplers = fp->samplers;
- return FALSE;
-}
-
-struct nv40_state_entry nv40_state_fragtex = {
- .validate = nv40_fragtex_validate,
- .dirty = {
- .pipe = NV40_NEW_SAMPLER | NV40_NEW_FRAGPROG,
- .hw = 0
- }
-};
-
diff --git a/src/gallium/drivers/nvfx/nv40_vertprog.h b/src/gallium/drivers/nvfx/nv40_vertprog.h
new file mode 100644
index 0000000000..7337293bab
--- /dev/null
+++ b/src/gallium/drivers/nvfx/nv40_vertprog.h
@@ -0,0 +1,177 @@
+#ifndef __NV40_SHADER_H__
+#define __NV40_SHADER_H__
+
+/* Vertex programs instruction set
+ *
+ * The NV40 instruction set is very similar to NV30. Most fields are in
+ * a slightly different position in the instruction however.
+ *
+ * Merged instructions
+ * In some cases it is possible to put two instructions into one opcode
+ * slot. The rules for when this is OK is not entirely clear to me yet.
+ *
+ * There are separate writemasks and dest temp register fields for each
+ * grouping of instructions. There is however only one field with the
+ * ID of a result register. Writing to temp/result regs is selected by
+ * setting VEC_RESULT/SCA_RESULT.
+ *
+ * Temporary registers
+ * The source/dest temp register fields have been extended by 1 bit, to
+ * give a total of 32 temporary registers.
+ *
+ * Relative Addressing
+ * NV40 can use an address register to index into vertex attribute regs.
+ * This is done by putting the offset value into INPUT_SRC and setting
+ * the INDEX_INPUT flag.
+ *
+ * Conditional execution (see NV_vertex_program{2,3} for details)
+ * There is a second condition code register on NV40, it's use is enabled
+ * by setting the COND_REG_SELECT_1 flag.
+ *
+ * Texture lookup
+ * TODO
+ */
+
+/* ---- OPCODE BITS 127:96 / data DWORD 0 --- */
+#define NV40_VP_INST_VEC_RESULT (1 << 30)
+/* uncertain.. */
+#define NV40_VP_INST_COND_UPDATE_ENABLE ((1 << 14)|1<<29)
+/* use address reg as index into attribs */
+#define NV40_VP_INST_INDEX_INPUT (1 << 27)
+#define NV40_VP_INST_COND_REG_SELECT_1 (1 << 25)
+#define NV40_VP_INST_ADDR_REG_SELECT_1 (1 << 24)
+#define NV40_VP_INST_SRC2_ABS (1 << 23)
+#define NV40_VP_INST_SRC1_ABS (1 << 22)
+#define NV40_VP_INST_SRC0_ABS (1 << 21)
+#define NV40_VP_INST_VEC_DEST_TEMP_SHIFT 15
+#define NV40_VP_INST_VEC_DEST_TEMP_MASK (0x1F << 15)
+#define NV40_VP_INST_COND_TEST_ENABLE (1 << 13)
+#define NV40_VP_INST_COND_SHIFT 10
+#define NV40_VP_INST_COND_MASK (0x7 << 10)
+#define NV40_VP_INST_COND_SWZ_X_SHIFT 8
+#define NV40_VP_INST_COND_SWZ_X_MASK (3 << 8)
+#define NV40_VP_INST_COND_SWZ_Y_SHIFT 6
+#define NV40_VP_INST_COND_SWZ_Y_MASK (3 << 6)
+#define NV40_VP_INST_COND_SWZ_Z_SHIFT 4
+#define NV40_VP_INST_COND_SWZ_Z_MASK (3 << 4)
+#define NV40_VP_INST_COND_SWZ_W_SHIFT 2
+#define NV40_VP_INST_COND_SWZ_W_MASK (3 << 2)
+#define NV40_VP_INST_COND_SWZ_ALL_SHIFT 2
+#define NV40_VP_INST_COND_SWZ_ALL_MASK (0xFF << 2)
+#define NV40_VP_INST_ADDR_SWZ_SHIFT 0
+#define NV40_VP_INST_ADDR_SWZ_MASK (0x03 << 0)
+#define NV40_VP_INST0_KNOWN ( \
+ NV40_VP_INST_INDEX_INPUT | \
+ NV40_VP_INST_COND_REG_SELECT_1 | \
+ NV40_VP_INST_ADDR_REG_SELECT_1 | \
+ NV40_VP_INST_SRC2_ABS | \
+ NV40_VP_INST_SRC1_ABS | \
+ NV40_VP_INST_SRC0_ABS | \
+ NV40_VP_INST_VEC_DEST_TEMP_MASK | \
+ NV40_VP_INST_COND_TEST_ENABLE | \
+ NV40_VP_INST_COND_MASK | \
+ NV40_VP_INST_COND_SWZ_ALL_MASK | \
+ NV40_VP_INST_ADDR_SWZ_MASK)
+
+/* ---- OPCODE BITS 95:64 / data DWORD 1 --- */
+#define NV40_VP_INST_VEC_OPCODE_SHIFT 22
+#define NV40_VP_INST_VEC_OPCODE_MASK (0x1F << 22)
+#define NV40_VP_INST_SCA_OPCODE_SHIFT 27
+#define NV40_VP_INST_SCA_OPCODE_MASK (0x1F << 27)
+#define NV40_VP_INST_CONST_SRC_SHIFT 12
+#define NV40_VP_INST_CONST_SRC_MASK (0xFF << 12)
+#define NV40_VP_INST_INPUT_SRC_SHIFT 8
+#define NV40_VP_INST_INPUT_SRC_MASK (0x0F << 8)
+#define NV40_VP_INST_SRC0H_SHIFT 0
+#define NV40_VP_INST_SRC0H_MASK (0xFF << 0)
+#define NV40_VP_INST1_KNOWN ( \
+ NV40_VP_INST_VEC_OPCODE_MASK | \
+ NV40_VP_INST_SCA_OPCODE_MASK | \
+ NV40_VP_INST_CONST_SRC_MASK | \
+ NV40_VP_INST_INPUT_SRC_MASK | \
+ NV40_VP_INST_SRC0H_MASK \
+ )
+
+/* ---- OPCODE BITS 63:32 / data DWORD 2 --- */
+#define NV40_VP_INST_SRC0L_SHIFT 23
+#define NV40_VP_INST_SRC0L_MASK (0x1FF << 23)
+#define NV40_VP_INST_SRC1_SHIFT 6
+#define NV40_VP_INST_SRC1_MASK (0x1FFFF << 6)
+#define NV40_VP_INST_SRC2H_SHIFT 0
+#define NV40_VP_INST_SRC2H_MASK (0x3F << 0)
+#define NV40_VP_INST_IADDRH_SHIFT 0
+#define NV40_VP_INST_IADDRH_MASK (0x1F << 0)
+
+/* ---- OPCODE BITS 31:0 / data DWORD 3 --- */
+#define NV40_VP_INST_IADDRL_SHIFT 29
+#define NV40_VP_INST_IADDRL_MASK (7 << 29)
+#define NV40_VP_INST_SRC2L_SHIFT 21
+#define NV40_VP_INST_SRC2L_MASK (0x7FF << 21)
+#define NV40_VP_INST_SCA_WRITEMASK_SHIFT 17
+#define NV40_VP_INST_SCA_WRITEMASK_MASK (0xF << 17)
+# define NV40_VP_INST_SCA_WRITEMASK_X (1 << 20)
+# define NV40_VP_INST_SCA_WRITEMASK_Y (1 << 19)
+# define NV40_VP_INST_SCA_WRITEMASK_Z (1 << 18)
+# define NV40_VP_INST_SCA_WRITEMASK_W (1 << 17)
+#define NV40_VP_INST_VEC_WRITEMASK_SHIFT 13
+#define NV40_VP_INST_VEC_WRITEMASK_MASK (0xF << 13)
+# define NV40_VP_INST_VEC_WRITEMASK_X (1 << 16)
+# define NV40_VP_INST_VEC_WRITEMASK_Y (1 << 15)
+# define NV40_VP_INST_VEC_WRITEMASK_Z (1 << 14)
+# define NV40_VP_INST_VEC_WRITEMASK_W (1 << 13)
+#define NV40_VP_INST_SCA_RESULT (1 << 12)
+#define NV40_VP_INST_SCA_DEST_TEMP_SHIFT 7
+#define NV40_VP_INST_SCA_DEST_TEMP_MASK (0x1F << 7)
+#define NV40_VP_INST_DEST_SHIFT 2
+#define NV40_VP_INST_DEST_MASK (31 << 2)
+# define NV40_VP_INST_DEST_POS 0
+# define NV40_VP_INST_DEST_COL0 1
+# define NV40_VP_INST_DEST_COL1 2
+# define NV40_VP_INST_DEST_BFC0 3
+# define NV40_VP_INST_DEST_BFC1 4
+# define NV40_VP_INST_DEST_FOGC 5
+# define NV40_VP_INST_DEST_PSZ 6
+# define NV40_VP_INST_DEST_TC0 7
+# define NV40_VP_INST_DEST_TC(n) (7+n)
+# define NV40_VP_INST_DEST_TEMP 0x1F
+#define NV40_VP_INST_INDEX_CONST (1 << 1)
+#define NV40_VP_INST3_KNOWN ( \
+ NV40_VP_INST_SRC2L_MASK |\
+ NV40_VP_INST_SCA_WRITEMASK_MASK |\
+ NV40_VP_INST_VEC_WRITEMASK_MASK |\
+ NV40_VP_INST_SCA_DEST_TEMP_MASK |\
+ NV40_VP_INST_DEST_MASK |\
+ NV40_VP_INST_INDEX_CONST)
+
+/* Useful to split the source selection regs into their pieces */
+#define NV40_VP_SRC0_HIGH_SHIFT 9
+#define NV40_VP_SRC0_HIGH_MASK 0x0001FE00
+#define NV40_VP_SRC0_LOW_MASK 0x000001FF
+#define NV40_VP_SRC2_HIGH_SHIFT 11
+#define NV40_VP_SRC2_HIGH_MASK 0x0001F800
+#define NV40_VP_SRC2_LOW_MASK 0x000007FF
+
+/* Source selection - these are the bits you fill NV40_VP_INST_SRCn with */
+#define NV40_VP_SRC_NEGATE (1 << 16)
+#define NV40_VP_SRC_SWZ_X_SHIFT 14
+#define NV40_VP_SRC_SWZ_X_MASK (3 << 14)
+#define NV40_VP_SRC_SWZ_Y_SHIFT 12
+#define NV40_VP_SRC_SWZ_Y_MASK (3 << 12)
+#define NV40_VP_SRC_SWZ_Z_SHIFT 10
+#define NV40_VP_SRC_SWZ_Z_MASK (3 << 10)
+#define NV40_VP_SRC_SWZ_W_SHIFT 8
+#define NV40_VP_SRC_SWZ_W_MASK (3 << 8)
+#define NV40_VP_SRC_SWZ_ALL_SHIFT 8
+#define NV40_VP_SRC_SWZ_ALL_MASK (0xFF << 8)
+#define NV40_VP_SRC_TEMP_SRC_SHIFT 2
+#define NV40_VP_SRC_TEMP_SRC_MASK (0x1F << 2)
+#define NV40_VP_SRC_REG_TYPE_SHIFT 0
+#define NV40_VP_SRC_REG_TYPE_MASK (3 << 0)
+# define NV40_VP_SRC_REG_TYPE_UNK0 0
+# define NV40_VP_SRC_REG_TYPE_TEMP 1
+# define NV40_VP_SRC_REG_TYPE_INPUT 2
+# define NV40_VP_SRC_REG_TYPE_CONST 3
+
+#include "nvfx_shader.h"
+
+#endif
diff --git a/src/gallium/drivers/nv30/nv30_clear.c b/src/gallium/drivers/nvfx/nvfx_clear.c
index c4ba926664..2be70fcee4 100644
--- a/src/gallium/drivers/nv30/nv30_clear.c
+++ b/src/gallium/drivers/nvfx/nvfx_clear.c
@@ -3,12 +3,12 @@
#include "pipe/p_state.h"
#include "util/u_clear.h"
-#include "nv30_context.h"
+#include "nvfx_context.h"
void
-nv30_clear(struct pipe_context *pipe, unsigned buffers,
+nvfx_clear(struct pipe_context *pipe, unsigned buffers,
const float *rgba, double depth, unsigned stencil)
{
- util_clear(pipe, &nv30_context(pipe)->framebuffer, buffers, rgba, depth,
+ util_clear(pipe, &nvfx_context(pipe)->framebuffer, buffers, rgba, depth,
stencil);
}
diff --git a/src/gallium/drivers/nvfx/nvfx_context.c b/src/gallium/drivers/nvfx/nvfx_context.c
new file mode 100644
index 0000000000..fc3cbdb558
--- /dev/null
+++ b/src/gallium/drivers/nvfx/nvfx_context.c
@@ -0,0 +1,90 @@
+#include "draw/draw_context.h"
+#include "pipe/p_defines.h"
+
+#include "nvfx_context.h"
+#include "nvfx_screen.h"
+
+static void
+nvfx_flush(struct pipe_context *pipe, unsigned flags,
+ struct pipe_fence_handle **fence)
+{
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+ struct nvfx_screen *screen = nvfx->screen;
+ struct nouveau_channel *chan = screen->base.channel;
+ struct nouveau_grobj *eng3d = screen->eng3d;
+
+ if (flags & PIPE_FLUSH_TEXTURE_CACHE) {
+ BEGIN_RING(chan, eng3d, 0x1fd8, 1);
+ OUT_RING (chan, 2);
+ BEGIN_RING(chan, eng3d, 0x1fd8, 1);
+ OUT_RING (chan, 1);
+ }
+
+ FIRE_RING(chan);
+ if (fence)
+ *fence = NULL;
+}
+
+static void
+nvfx_destroy(struct pipe_context *pipe)
+{
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+ unsigned i;
+
+ for (i = 0; i < NVFX_STATE_MAX; i++) {
+ if (nvfx->state.hw[i])
+ so_ref(NULL, &nvfx->state.hw[i]);
+ }
+
+ if (nvfx->draw)
+ draw_destroy(nvfx->draw);
+ FREE(nvfx);
+}
+
+struct pipe_context *
+nvfx_create(struct pipe_screen *pscreen, void *priv)
+{
+ struct nvfx_screen *screen = nvfx_screen(pscreen);
+ struct pipe_winsys *ws = pscreen->winsys;
+ struct nvfx_context *nvfx;
+ struct nouveau_winsys *nvws = screen->nvws;
+
+ nvfx = CALLOC(1, sizeof(struct nvfx_context));
+ if (!nvfx)
+ return NULL;
+ nvfx->screen = screen;
+
+ nvfx->nvws = nvws;
+
+ nvfx->pipe.winsys = ws;
+ nvfx->pipe.screen = pscreen;
+ nvfx->pipe.priv = priv;
+ nvfx->pipe.destroy = nvfx_destroy;
+ nvfx->pipe.draw_arrays = nvfx_draw_arrays;
+ nvfx->pipe.draw_elements = nvfx_draw_elements;
+ nvfx->pipe.clear = nvfx_clear;
+ nvfx->pipe.flush = nvfx_flush;
+
+ nvfx->pipe.is_texture_referenced = nouveau_is_texture_referenced;
+ nvfx->pipe.is_buffer_referenced = nouveau_is_buffer_referenced;
+
+ screen->base.channel->user_private = nvfx;
+ screen->base.channel->flush_notify = nvfx_state_flush_notify;
+
+ nvfx->is_nv4x = screen->is_nv4x;
+
+ nvfx_init_query_functions(nvfx);
+ nvfx_init_surface_functions(nvfx);
+ nvfx_init_state_functions(nvfx);
+ nvfx_init_transfer_functions(nvfx);
+
+ /* Create, configure, and install fallback swtnl path */
+ nvfx->draw = draw_create();
+ draw_wide_point_threshold(nvfx->draw, 9999999.0);
+ draw_wide_line_threshold(nvfx->draw, 9999999.0);
+ draw_enable_line_stipple(nvfx->draw, FALSE);
+ draw_enable_point_sprites(nvfx->draw, FALSE);
+ draw_set_rasterize_stage(nvfx->draw, nvfx_draw_render_stage(nvfx));
+
+ return &nvfx->pipe;
+}
diff --git a/src/gallium/drivers/nvfx/nvfx_context.h b/src/gallium/drivers/nvfx/nvfx_context.h
new file mode 100644
index 0000000000..ab7225cf6c
--- /dev/null
+++ b/src/gallium/drivers/nvfx/nvfx_context.h
@@ -0,0 +1,264 @@
+#ifndef __NVFX_CONTEXT_H__
+#define __NVFX_CONTEXT_H__
+
+#include <stdio.h>
+
+#include "pipe/p_context.h"
+#include "pipe/p_defines.h"
+#include "pipe/p_state.h"
+#include "pipe/p_compiler.h"
+
+#include "util/u_memory.h"
+#include "util/u_math.h"
+#include "util/u_inlines.h"
+
+#include "draw/draw_vertex.h"
+
+#include "nouveau/nouveau_winsys.h"
+#include "nouveau/nouveau_gldefs.h"
+#include "nouveau/nouveau_context.h"
+#include "nouveau/nouveau_stateobj.h"
+
+#include "nvfx_state.h"
+
+#define NOUVEAU_ERR(fmt, args...) \
+ fprintf(stderr, "%s:%d - "fmt, __func__, __LINE__, ##args);
+#define NOUVEAU_MSG(fmt, args...) \
+ fprintf(stderr, "nouveau: "fmt, ##args);
+
+enum nvfx_state_index {
+ NVFX_STATE_FB = 0,
+ NVFX_STATE_VIEWPORT = 1,
+ NVFX_STATE_BLEND = 2,
+ NVFX_STATE_RAST = 3,
+ NVFX_STATE_ZSA = 4,
+ NVFX_STATE_BCOL = 5,
+ NVFX_STATE_CLIP = 6,
+ NVFX_STATE_SCISSOR = 7,
+ NVFX_STATE_STIPPLE = 8,
+ NVFX_STATE_FRAGPROG = 9,
+ NVFX_STATE_VERTPROG = 10,
+ NVFX_STATE_FRAGTEX0 = 11,
+ NVFX_STATE_FRAGTEX1 = 12,
+ NVFX_STATE_FRAGTEX2 = 13,
+ NVFX_STATE_FRAGTEX3 = 14,
+ NVFX_STATE_FRAGTEX4 = 15,
+ NVFX_STATE_FRAGTEX5 = 16,
+ NVFX_STATE_FRAGTEX6 = 17,
+ NVFX_STATE_FRAGTEX7 = 18,
+ NVFX_STATE_FRAGTEX8 = 19,
+ NVFX_STATE_FRAGTEX9 = 20,
+ NVFX_STATE_FRAGTEX10 = 21,
+ NVFX_STATE_FRAGTEX11 = 22,
+ NVFX_STATE_FRAGTEX12 = 23,
+ NVFX_STATE_FRAGTEX13 = 24,
+ NVFX_STATE_FRAGTEX14 = 25,
+ NVFX_STATE_FRAGTEX15 = 26,
+ NVFX_STATE_VERTTEX0 = 27,
+ NVFX_STATE_VERTTEX1 = 28,
+ NVFX_STATE_VERTTEX2 = 29,
+ NVFX_STATE_VERTTEX3 = 30,
+ NVFX_STATE_VTXBUF = 31,
+ NVFX_STATE_VTXFMT = 32,
+ NVFX_STATE_VTXATTR = 33,
+ NVFX_STATE_SR = 34,
+ NVFX_STATE_MAX = 35
+};
+
+#include "nvfx_screen.h"
+
+#define NVFX_NEW_BLEND (1 << 0)
+#define NVFX_NEW_RAST (1 << 1)
+#define NVFX_NEW_ZSA (1 << 2)
+#define NVFX_NEW_SAMPLER (1 << 3)
+#define NVFX_NEW_FB (1 << 4)
+#define NVFX_NEW_STIPPLE (1 << 5)
+#define NVFX_NEW_SCISSOR (1 << 6)
+#define NVFX_NEW_VIEWPORT (1 << 7)
+#define NVFX_NEW_BCOL (1 << 8)
+#define NVFX_NEW_VERTPROG (1 << 9)
+#define NVFX_NEW_FRAGPROG (1 << 10)
+#define NVFX_NEW_ARRAYS (1 << 11)
+#define NVFX_NEW_UCP (1 << 12)
+#define NVFX_NEW_SR (1 << 13)
+
+struct nvfx_rasterizer_state {
+ struct pipe_rasterizer_state pipe;
+ struct nouveau_stateobj *so;
+};
+
+struct nvfx_zsa_state {
+ struct pipe_depth_stencil_alpha_state pipe;
+ struct nouveau_stateobj *so;
+};
+
+struct nvfx_blend_state {
+ struct pipe_blend_state pipe;
+ struct nouveau_stateobj *so;
+};
+
+
+struct nvfx_state {
+ unsigned scissor_enabled;
+ unsigned stipple_enabled;
+ unsigned fp_samplers;
+
+ uint64_t dirty;
+ struct nouveau_stateobj *hw[NVFX_STATE_MAX];
+};
+
+struct nvfx_vtxelt_state {
+ struct pipe_vertex_element pipe[16];
+ unsigned num_elements;
+};
+
+struct nvfx_context {
+ struct pipe_context pipe;
+
+ struct nouveau_winsys *nvws;
+ struct nvfx_screen *screen;
+
+ unsigned is_nv4x; /* either 0 or ~0 */
+
+ struct draw_context *draw;
+
+ /* HW state derived from pipe states */
+ struct nvfx_state state;
+ struct {
+ struct nvfx_vertex_program *vertprog;
+
+ unsigned nr_attribs;
+ unsigned hw[PIPE_MAX_SHADER_INPUTS];
+ unsigned draw[PIPE_MAX_SHADER_INPUTS];
+ unsigned emit[PIPE_MAX_SHADER_INPUTS];
+ } swtnl;
+
+ enum {
+ HW, SWTNL, SWRAST
+ } render_mode;
+ unsigned fallback_swtnl;
+ unsigned fallback_swrast;
+
+ /* Context state */
+ unsigned dirty, draw_dirty;
+ struct pipe_scissor_state scissor;
+ unsigned stipple[32];
+ struct pipe_clip_state clip;
+ struct nvfx_vertex_program *vertprog;
+ struct nvfx_fragment_program *fragprog;
+ struct pipe_buffer *constbuf[PIPE_SHADER_TYPES];
+ unsigned constbuf_nr[PIPE_SHADER_TYPES];
+ struct nvfx_rasterizer_state *rasterizer;
+ struct nvfx_zsa_state *zsa;
+ struct nvfx_blend_state *blend;
+ struct pipe_blend_color blend_colour;
+ struct pipe_stencil_ref stencil_ref;
+ struct pipe_viewport_state viewport;
+ struct pipe_framebuffer_state framebuffer;
+ struct pipe_buffer *idxbuf;
+ unsigned idxbuf_format;
+ struct nvfx_sampler_state *tex_sampler[PIPE_MAX_SAMPLERS];
+ struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS];
+ unsigned nr_samplers;
+ unsigned nr_textures;
+ unsigned dirty_samplers;
+ struct pipe_vertex_buffer vtxbuf[PIPE_MAX_ATTRIBS];
+ unsigned vtxbuf_nr;
+ struct nvfx_vtxelt_state *vtxelt;
+};
+
+static INLINE struct nvfx_context *
+nvfx_context(struct pipe_context *pipe)
+{
+ return (struct nvfx_context *)pipe;
+}
+
+struct nvfx_state_entry {
+ boolean (*validate)(struct nvfx_context *nvfx);
+ struct {
+ unsigned pipe;
+ unsigned hw;
+ } dirty;
+};
+
+extern struct nvfx_state_entry nvfx_state_blend;
+extern struct nvfx_state_entry nvfx_state_blend_colour;
+extern struct nvfx_state_entry nvfx_state_fragprog;
+extern struct nvfx_state_entry nvfx_state_fragtex;
+extern struct nvfx_state_entry nvfx_state_framebuffer;
+extern struct nvfx_state_entry nvfx_state_rasterizer;
+extern struct nvfx_state_entry nvfx_state_scissor;
+extern struct nvfx_state_entry nvfx_state_sr;
+extern struct nvfx_state_entry nvfx_state_stipple;
+extern struct nvfx_state_entry nvfx_state_vbo;
+extern struct nvfx_state_entry nvfx_state_vertprog;
+extern struct nvfx_state_entry nvfx_state_viewport;
+extern struct nvfx_state_entry nvfx_state_vtxfmt;
+extern struct nvfx_state_entry nvfx_state_zsa;
+
+extern void nvfx_init_query_functions(struct nvfx_context *nvfx);
+extern void nvfx_init_surface_functions(struct nvfx_context *nvfx);
+
+/* nvfx_context.c */
+struct pipe_context *
+nvfx_create(struct pipe_screen *pscreen, void *priv);
+
+/* nvfx_clear.c */
+extern void nvfx_clear(struct pipe_context *pipe, unsigned buffers,
+ const float *rgba, double depth, unsigned stencil);
+
+/* nvfx_draw.c */
+extern struct draw_stage *nvfx_draw_render_stage(struct nvfx_context *nvfx);
+extern void nvfx_draw_elements_swtnl(struct pipe_context *pipe,
+ struct pipe_buffer *idxbuf,
+ unsigned ib_size, unsigned mode,
+ unsigned start, unsigned count);
+
+/* nvfx_fragprog.c */
+extern void nvfx_fragprog_destroy(struct nvfx_context *,
+ struct nvfx_fragment_program *);
+
+/* nv30_fragtex.c */
+extern void
+nv30_sampler_state_init(struct pipe_context *pipe,
+ struct nvfx_sampler_state *ps,
+ const struct pipe_sampler_state *cso);
+extern void nv30_fragtex_bind(struct nvfx_context *);
+extern struct nouveau_stateobj *
+nv30_fragtex_build(struct nvfx_context *nvfx, int unit);
+
+/* nv40_fragtex.c */
+extern void
+nv40_sampler_state_init(struct pipe_context *pipe,
+ struct nvfx_sampler_state *ps,
+ const struct pipe_sampler_state *cso);
+extern void nv40_fragtex_bind(struct nvfx_context *);
+extern struct nouveau_stateobj *
+nv40_fragtex_build(struct nvfx_context *nvfx, int unit);
+
+/* nvfx_state.c */
+extern void nvfx_init_state_functions(struct nvfx_context *nvfx);
+
+/* nvfx_state_emit.c */
+extern void nvfx_state_flush_notify(struct nouveau_channel *chan);
+extern boolean nvfx_state_validate(struct nvfx_context *nvfx);
+extern boolean nvfx_state_validate_swtnl(struct nvfx_context *nvfx);
+extern void nvfx_state_emit(struct nvfx_context *nvfx);
+
+/* nvfx_transfer.c */
+extern void nvfx_init_transfer_functions(struct nvfx_context *nvfx);
+
+/* nvfx_vbo.c */
+extern void nvfx_draw_arrays(struct pipe_context *, unsigned mode,
+ unsigned start, unsigned count);
+extern void nvfx_draw_elements(struct pipe_context *pipe,
+ struct pipe_buffer *indexBuffer,
+ unsigned indexSize,
+ unsigned mode, unsigned start,
+ unsigned count);
+
+/* nvfx_vertprog.c */
+extern void nvfx_vertprog_destroy(struct nvfx_context *,
+ struct nvfx_vertex_program *);
+
+#endif
diff --git a/src/gallium/drivers/nvfx/nvfx_draw.c b/src/gallium/drivers/nvfx/nvfx_draw.c
new file mode 100644
index 0000000000..68e50a3647
--- /dev/null
+++ b/src/gallium/drivers/nvfx/nvfx_draw.c
@@ -0,0 +1,356 @@
+#include "pipe/p_shader_tokens.h"
+#include "util/u_inlines.h"
+#include "tgsi/tgsi_ureg.h"
+
+#include "util/u_pack_color.h"
+
+#include "draw/draw_context.h"
+#include "draw/draw_vertex.h"
+#include "draw/draw_pipe.h"
+
+#include "nvfx_context.h"
+#include "nv30_vertprog.h"
+#include "nv40_vertprog.h"
+
+/* Simple, but crappy, swtnl path, hopefully we wont need to hit this very
+ * often at all. Uses "quadro style" vertex submission + a fixed vertex
+ * layout to avoid the need to generate a vertex program or vtxfmt.
+ */
+
+struct nvfx_render_stage {
+ struct draw_stage stage;
+ struct nvfx_context *nvfx;
+ unsigned prim;
+};
+
+static INLINE struct nvfx_render_stage *
+nvfx_render_stage(struct draw_stage *stage)
+{
+ return (struct nvfx_render_stage *)stage;
+}
+
+static INLINE void
+nvfx_render_vertex(struct nvfx_context *nvfx, const struct vertex_header *v)
+{
+ struct nvfx_screen *screen = nvfx->screen;
+ struct nouveau_channel *chan = screen->base.channel;
+ struct nouveau_grobj *eng3d = screen->eng3d;
+ unsigned i;
+
+ for (i = 0; i < nvfx->swtnl.nr_attribs; i++) {
+ unsigned idx = nvfx->swtnl.draw[i];
+ unsigned hw = nvfx->swtnl.hw[i];
+
+ switch (nvfx->swtnl.emit[i]) {
+ case EMIT_OMIT:
+ break;
+ case EMIT_1F:
+ BEGIN_RING(chan, eng3d, NV34TCL_VTX_ATTR_1F(hw), 1);
+ OUT_RING (chan, fui(v->data[idx][0]));
+ break;
+ case EMIT_2F:
+ BEGIN_RING(chan, eng3d, NV34TCL_VTX_ATTR_2F_X(hw), 2);
+ OUT_RING (chan, fui(v->data[idx][0]));
+ OUT_RING (chan, fui(v->data[idx][1]));
+ break;
+ case EMIT_3F:
+ BEGIN_RING(chan, eng3d, NV34TCL_VTX_ATTR_3F_X(hw), 3);
+ OUT_RING (chan, fui(v->data[idx][0]));
+ OUT_RING (chan, fui(v->data[idx][1]));
+ OUT_RING (chan, fui(v->data[idx][2]));
+ break;
+ case EMIT_4F:
+ BEGIN_RING(chan, eng3d, NV34TCL_VTX_ATTR_4F_X(hw), 4);
+ OUT_RING (chan, fui(v->data[idx][0]));
+ OUT_RING (chan, fui(v->data[idx][1]));
+ OUT_RING (chan, fui(v->data[idx][2]));
+ OUT_RING (chan, fui(v->data[idx][3]));
+ break;
+ case 0xff:
+ BEGIN_RING(chan, eng3d, NV34TCL_VTX_ATTR_4F_X(hw), 4);
+ OUT_RING (chan, fui(v->data[idx][0] / v->data[idx][3]));
+ OUT_RING (chan, fui(v->data[idx][1] / v->data[idx][3]));
+ OUT_RING (chan, fui(v->data[idx][2] / v->data[idx][3]));
+ OUT_RING (chan, fui(1.0f / v->data[idx][3]));
+ break;
+ case EMIT_4UB:
+ BEGIN_RING(chan, eng3d, NV34TCL_VTX_ATTR_4UB(hw), 1);
+ OUT_RING (chan, pack_ub4(float_to_ubyte(v->data[idx][0]),
+ float_to_ubyte(v->data[idx][1]),
+ float_to_ubyte(v->data[idx][2]),
+ float_to_ubyte(v->data[idx][3])));
+ case EMIT_4UB_BGRA:
+ BEGIN_RING(chan, eng3d, NV34TCL_VTX_ATTR_4UB(hw), 1);
+ OUT_RING (chan, pack_ub4(float_to_ubyte(v->data[idx][2]),
+ float_to_ubyte(v->data[idx][1]),
+ float_to_ubyte(v->data[idx][0]),
+ float_to_ubyte(v->data[idx][3])));
+ break;
+ default:
+ assert(0);
+ break;
+ }
+ }
+}
+
+static INLINE void
+nvfx_render_prim(struct draw_stage *stage, struct prim_header *prim,
+ unsigned mode, unsigned count)
+{
+ struct nvfx_render_stage *rs = nvfx_render_stage(stage);
+ struct nvfx_context *nvfx = rs->nvfx;
+
+ struct nvfx_screen *screen = nvfx->screen;
+ struct nouveau_channel *chan = screen->base.channel;
+ struct nouveau_grobj *eng3d = screen->eng3d;
+ unsigned i;
+
+ /* Ensure there's room for 4xfloat32 + potentially 3 begin/end */
+ if (AVAIL_RING(chan) < ((count * 20) + 6)) {
+ if (rs->prim != NV34TCL_VERTEX_BEGIN_END_STOP) {
+ NOUVEAU_ERR("AIII, missed flush\n");
+ assert(0);
+ }
+ FIRE_RING(chan);
+ nvfx_state_emit(nvfx);
+ }
+
+ /* Switch primitive modes if necessary */
+ if (rs->prim != mode) {
+ if (rs->prim != NV34TCL_VERTEX_BEGIN_END_STOP) {
+ BEGIN_RING(chan, eng3d, NV34TCL_VERTEX_BEGIN_END, 1);
+ OUT_RING (chan, NV34TCL_VERTEX_BEGIN_END_STOP);
+ }
+
+ BEGIN_RING(chan, eng3d, NV34TCL_VERTEX_BEGIN_END, 1);
+ OUT_RING (chan, mode);
+ rs->prim = mode;
+ }
+
+ /* Emit vertex data */
+ for (i = 0; i < count; i++)
+ nvfx_render_vertex(nvfx, prim->v[i]);
+
+ /* If it's likely we'll need to empty the push buffer soon, finish
+ * off the primitive now.
+ */
+ if (AVAIL_RING(chan) < ((count * 20) + 6)) {
+ BEGIN_RING(chan, eng3d, NV34TCL_VERTEX_BEGIN_END, 1);
+ OUT_RING (chan, NV34TCL_VERTEX_BEGIN_END_STOP);
+ rs->prim = NV34TCL_VERTEX_BEGIN_END_STOP;
+ }
+}
+
+static void
+nvfx_render_point(struct draw_stage *draw, struct prim_header *prim)
+{
+ nvfx_render_prim(draw, prim, NV34TCL_VERTEX_BEGIN_END_POINTS, 1);
+}
+
+static void
+nvfx_render_line(struct draw_stage *draw, struct prim_header *prim)
+{
+ nvfx_render_prim(draw, prim, NV34TCL_VERTEX_BEGIN_END_LINES, 2);
+}
+
+static void
+nvfx_render_tri(struct draw_stage *draw, struct prim_header *prim)
+{
+ nvfx_render_prim(draw, prim, NV34TCL_VERTEX_BEGIN_END_TRIANGLES, 3);
+}
+
+static void
+nvfx_render_flush(struct draw_stage *draw, unsigned flags)
+{
+ struct nvfx_render_stage *rs = nvfx_render_stage(draw);
+ struct nvfx_context *nvfx = rs->nvfx;
+ struct nvfx_screen *screen = nvfx->screen;
+ struct nouveau_channel *chan = screen->base.channel;
+ struct nouveau_grobj *eng3d = screen->eng3d;
+
+ if (rs->prim != NV34TCL_VERTEX_BEGIN_END_STOP) {
+ BEGIN_RING(chan, eng3d, NV34TCL_VERTEX_BEGIN_END, 1);
+ OUT_RING (chan, NV34TCL_VERTEX_BEGIN_END_STOP);
+ rs->prim = NV34TCL_VERTEX_BEGIN_END_STOP;
+ }
+}
+
+static void
+nvfx_render_reset_stipple_counter(struct draw_stage *draw)
+{
+}
+
+static void
+nvfx_render_destroy(struct draw_stage *draw)
+{
+ FREE(draw);
+}
+
+static struct nvfx_vertex_program *
+nvfx_create_drawvp(struct nvfx_context *nvfx)
+{
+ struct ureg_program *ureg;
+ uint i;
+
+ ureg = ureg_create( TGSI_PROCESSOR_VERTEX );
+ if (ureg == NULL)
+ return NULL;
+
+ ureg_MOV(ureg, ureg_DECL_output(ureg, TGSI_SEMANTIC_POSITION, 0), ureg_DECL_vs_input(ureg, 0));
+ ureg_MOV(ureg, ureg_DECL_output(ureg, TGSI_SEMANTIC_COLOR, 0), ureg_DECL_vs_input(ureg, 3));
+ ureg_MOV(ureg, ureg_DECL_output(ureg, TGSI_SEMANTIC_COLOR, 1), ureg_DECL_vs_input(ureg, 4));
+ ureg_MOV(ureg, ureg_DECL_output(ureg, TGSI_SEMANTIC_BCOLOR, 0), ureg_DECL_vs_input(ureg, 3));
+ ureg_MOV(ureg, ureg_DECL_output(ureg, TGSI_SEMANTIC_BCOLOR, 1), ureg_DECL_vs_input(ureg, 4));
+ ureg_MOV(ureg,
+ ureg_writemask(ureg_DECL_output(ureg, TGSI_SEMANTIC_FOG, 1), TGSI_WRITEMASK_X),
+ ureg_DECL_vs_input(ureg, 5));
+ for (i = 0; i < 8; ++i)
+ ureg_MOV(ureg, ureg_DECL_output(ureg, TGSI_SEMANTIC_GENERIC, i), ureg_DECL_vs_input(ureg, 8 + i));
+
+ ureg_END( ureg );
+
+ return ureg_create_shader_and_destroy( ureg, &nvfx->pipe );
+}
+
+struct draw_stage *
+nvfx_draw_render_stage(struct nvfx_context *nvfx)
+{
+ struct nvfx_render_stage *render = CALLOC_STRUCT(nvfx_render_stage);
+
+ if (!nvfx->swtnl.vertprog)
+ nvfx->swtnl.vertprog = nvfx_create_drawvp(nvfx);
+
+ render->nvfx = nvfx;
+ render->stage.draw = nvfx->draw;
+ render->stage.point = nvfx_render_point;
+ render->stage.line = nvfx_render_line;
+ render->stage.tri = nvfx_render_tri;
+ render->stage.flush = nvfx_render_flush;
+ render->stage.reset_stipple_counter = nvfx_render_reset_stipple_counter;
+ render->stage.destroy = nvfx_render_destroy;
+
+ return &render->stage;
+}
+
+void
+nvfx_draw_elements_swtnl(struct pipe_context *pipe,
+ struct pipe_buffer *idxbuf, unsigned idxbuf_size,
+ unsigned mode, unsigned start, unsigned count)
+{
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+ struct pipe_screen *pscreen = pipe->screen;
+ unsigned i;
+ void *map;
+
+ if (!nvfx_state_validate_swtnl(nvfx))
+ return;
+ nvfx->state.dirty &= ~(1ULL << NVFX_STATE_VTXBUF);
+ nvfx_state_emit(nvfx);
+
+ for (i = 0; i < nvfx->vtxbuf_nr; i++) {
+ map = pipe_buffer_map(pscreen, nvfx->vtxbuf[i].buffer,
+ PIPE_BUFFER_USAGE_CPU_READ);
+ draw_set_mapped_vertex_buffer(nvfx->draw, i, map);
+ }
+
+ if (idxbuf) {
+ map = pipe_buffer_map(pscreen, idxbuf,
+ PIPE_BUFFER_USAGE_CPU_READ);
+ draw_set_mapped_element_buffer(nvfx->draw, idxbuf_size, map);
+ } else {
+ draw_set_mapped_element_buffer(nvfx->draw, 0, NULL);
+ }
+
+ if (nvfx->constbuf[PIPE_SHADER_VERTEX]) {
+ const unsigned nr = nvfx->constbuf_nr[PIPE_SHADER_VERTEX];
+
+ map = pipe_buffer_map(pscreen,
+ nvfx->constbuf[PIPE_SHADER_VERTEX],
+ PIPE_BUFFER_USAGE_CPU_READ);
+ draw_set_mapped_constant_buffer(nvfx->draw, PIPE_SHADER_VERTEX, 0,
+ map, nr);
+ }
+
+ draw_arrays(nvfx->draw, mode, start, count);
+
+ for (i = 0; i < nvfx->vtxbuf_nr; i++)
+ pipe_buffer_unmap(pscreen, nvfx->vtxbuf[i].buffer);
+
+ if (idxbuf)
+ pipe_buffer_unmap(pscreen, idxbuf);
+
+ if (nvfx->constbuf[PIPE_SHADER_VERTEX])
+ pipe_buffer_unmap(pscreen, nvfx->constbuf[PIPE_SHADER_VERTEX]);
+
+ draw_flush(nvfx->draw);
+ pipe->flush(pipe, 0, NULL);
+}
+
+static INLINE void
+emit_attrib(struct nvfx_context *nvfx, unsigned hw, unsigned emit,
+ unsigned semantic, unsigned index)
+{
+ unsigned draw_out = draw_find_shader_output(nvfx->draw, semantic, index);
+ unsigned a = nvfx->swtnl.nr_attribs++;
+
+ nvfx->swtnl.hw[a] = hw;
+ nvfx->swtnl.emit[a] = emit;
+ nvfx->swtnl.draw[a] = draw_out;
+}
+
+static boolean
+nvfx_state_vtxfmt_validate(struct nvfx_context *nvfx)
+{
+ struct nvfx_fragment_program *fp = nvfx->fragprog;
+ unsigned colour = 0, texcoords = 0, fog = 0, i;
+
+ /* Determine needed fragprog inputs */
+ for (i = 0; i < fp->info.num_inputs; i++) {
+ switch (fp->info.input_semantic_name[i]) {
+ case TGSI_SEMANTIC_POSITION:
+ break;
+ case TGSI_SEMANTIC_COLOR:
+ colour |= (1 << fp->info.input_semantic_index[i]);
+ break;
+ case TGSI_SEMANTIC_GENERIC:
+ texcoords |= (1 << fp->info.input_semantic_index[i]);
+ break;
+ case TGSI_SEMANTIC_FOG:
+ fog = 1;
+ break;
+ default:
+ assert(0);
+ }
+ }
+
+ nvfx->swtnl.nr_attribs = 0;
+
+ /* Map draw vtxprog output to hw attribute IDs */
+ for (i = 0; i < 2; i++) {
+ if (!(colour & (1 << i)))
+ continue;
+ emit_attrib(nvfx, 3 + i, EMIT_4F, TGSI_SEMANTIC_COLOR, i);
+ }
+
+ for (i = 0; i < 8; i++) {
+ if (!(texcoords & (1 << i)))
+ continue;
+ emit_attrib(nvfx, 8 + i, EMIT_4F, TGSI_SEMANTIC_GENERIC, i);
+ }
+
+ if (fog) {
+ emit_attrib(nvfx, 5, EMIT_1F, TGSI_SEMANTIC_FOG, 0);
+ }
+
+ emit_attrib(nvfx, 0, 0xff, TGSI_SEMANTIC_POSITION, 0);
+
+ return FALSE;
+}
+
+struct nvfx_state_entry nvfx_state_vtxfmt = {
+ .validate = nvfx_state_vtxfmt_validate,
+ .dirty = {
+ .pipe = NVFX_NEW_ARRAYS | NVFX_NEW_FRAGPROG,
+ .hw = 0
+ }
+};
diff --git a/src/gallium/drivers/nv40/nv40_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c
index dc24f9b08a..b9c91cec8c 100644
--- a/src/gallium/drivers/nv40/nv40_fragprog.c
+++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c
@@ -7,37 +7,20 @@
#include "tgsi/tgsi_parse.h"
#include "tgsi/tgsi_util.h"
-#include "nv40_context.h"
-
-#define SWZ_X 0
-#define SWZ_Y 1
-#define SWZ_Z 2
-#define SWZ_W 3
-#define MASK_X 1
-#define MASK_Y 2
-#define MASK_Z 4
-#define MASK_W 8
-#define MASK_ALL (MASK_X|MASK_Y|MASK_Z|MASK_W)
-#define DEF_SCALE NV40_FP_OP_DST_SCALE_1X
-#define DEF_CTEST NV40_FP_OP_COND_TR
-#include "nv40_shader.h"
-
-#define swz(s,x,y,z,w) nv40_sr_swz((s), SWZ_##x, SWZ_##y, SWZ_##z, SWZ_##w)
-#define neg(s) nv40_sr_neg((s))
-#define abs(s) nv40_sr_abs((s))
-#define scale(s,v) nv40_sr_scale((s), NV40_FP_OP_DST_SCALE_##v)
+#include "nvfx_context.h"
+#include "nvfx_shader.h"
#define MAX_CONSTS 128
#define MAX_IMM 32
-struct nv40_fpc {
- struct nv40_fragment_program *fp;
+struct nvfx_fpc {
+ struct nvfx_fragment_program *fp;
uint attrib_map[PIPE_MAX_SHADER_INPUTS];
unsigned r_temps;
unsigned r_temps_discard;
- struct nv40_sreg r_result[PIPE_MAX_SHADER_OUTPUTS];
- struct nv40_sreg *r_temp;
+ struct nvfx_sreg r_result[PIPE_MAX_SHADER_OUTPUTS];
+ struct nvfx_sreg *r_temp;
int num_regs;
@@ -50,35 +33,35 @@ struct nv40_fpc {
} consts[MAX_CONSTS];
int nr_consts;
- struct nv40_sreg imm[MAX_IMM];
+ struct nvfx_sreg imm[MAX_IMM];
unsigned nr_imm;
};
-static INLINE struct nv40_sreg
-temp(struct nv40_fpc *fpc)
+static INLINE struct nvfx_sreg
+temp(struct nvfx_fpc *fpc)
{
int idx = ffs(~fpc->r_temps) - 1;
if (idx < 0) {
NOUVEAU_ERR("out of temps!!\n");
assert(0);
- return nv40_sr(NV40SR_TEMP, 0);
+ return nvfx_sr(NVFXSR_TEMP, 0);
}
fpc->r_temps |= (1 << idx);
fpc->r_temps_discard |= (1 << idx);
- return nv40_sr(NV40SR_TEMP, idx);
+ return nvfx_sr(NVFXSR_TEMP, idx);
}
static INLINE void
-release_temps(struct nv40_fpc *fpc)
+release_temps(struct nvfx_fpc *fpc)
{
fpc->r_temps &= ~fpc->r_temps_discard;
fpc->r_temps_discard = 0;
}
-static INLINE struct nv40_sreg
-constant(struct nv40_fpc *fpc, int pipe, float vals[4])
+static INLINE struct nvfx_sreg
+constant(struct nvfx_fpc *fpc, int pipe, float vals[4])
{
int idx;
@@ -89,45 +72,45 @@ constant(struct nv40_fpc *fpc, int pipe, float vals[4])
fpc->consts[idx].pipe = pipe;
if (pipe == -1)
memcpy(fpc->consts[idx].vals, vals, 4 * sizeof(float));
- return nv40_sr(NV40SR_CONST, idx);
+ return nvfx_sr(NVFXSR_CONST, idx);
}
#define arith(cc,s,o,d,m,s0,s1,s2) \
- nv40_fp_arith((cc), (s), NV40_FP_OP_OPCODE_##o, \
+ nvfx_fp_arith((cc), (s), NVFX_FP_OP_OPCODE_##o, \
(d), (m), (s0), (s1), (s2))
#define tex(cc,s,o,u,d,m,s0,s1,s2) \
- nv40_fp_tex((cc), (s), NV40_FP_OP_OPCODE_##o, (u), \
+ nvfx_fp_tex((cc), (s), NVFX_FP_OP_OPCODE_##o, (u), \
(d), (m), (s0), none, none)
static void
-grow_insns(struct nv40_fpc *fpc, int size)
+grow_insns(struct nvfx_fpc *fpc, int size)
{
- struct nv40_fragment_program *fp = fpc->fp;
+ struct nvfx_fragment_program *fp = fpc->fp;
fp->insn_len += size;
fp->insn = realloc(fp->insn, sizeof(uint32_t) * fp->insn_len);
}
static void
-emit_src(struct nv40_fpc *fpc, int pos, struct nv40_sreg src)
+emit_src(struct nvfx_fpc *fpc, int pos, struct nvfx_sreg src)
{
- struct nv40_fragment_program *fp = fpc->fp;
+ struct nvfx_fragment_program *fp = fpc->fp;
uint32_t *hw = &fp->insn[fpc->inst_offset];
uint32_t sr = 0;
switch (src.type) {
- case NV40SR_INPUT:
- sr |= (NV40_FP_REG_TYPE_INPUT << NV40_FP_REG_TYPE_SHIFT);
- hw[0] |= (src.index << NV40_FP_OP_INPUT_SRC_SHIFT);
+ case NVFXSR_INPUT:
+ sr |= (NVFX_FP_REG_TYPE_INPUT << NVFX_FP_REG_TYPE_SHIFT);
+ hw[0] |= (src.index << NVFX_FP_OP_INPUT_SRC_SHIFT);
break;
- case NV40SR_OUTPUT:
- sr |= NV40_FP_REG_SRC_HALF;
+ case NVFXSR_OUTPUT:
+ sr |= NVFX_FP_REG_SRC_HALF;
/* fall-through */
- case NV40SR_TEMP:
- sr |= (NV40_FP_REG_TYPE_TEMP << NV40_FP_REG_TYPE_SHIFT);
- sr |= (src.index << NV40_FP_REG_SRC_SHIFT);
+ case NVFXSR_TEMP:
+ sr |= (NVFX_FP_REG_TYPE_TEMP << NVFX_FP_REG_TYPE_SHIFT);
+ sr |= (src.index << NVFX_FP_REG_SRC_SHIFT);
break;
- case NV40SR_CONST:
+ case NVFXSR_CONST:
if (!fpc->have_const) {
grow_insns(fpc, 4);
fpc->have_const = 1;
@@ -135,7 +118,7 @@ emit_src(struct nv40_fpc *fpc, int pos, struct nv40_sreg src)
hw = &fp->insn[fpc->inst_offset];
if (fpc->consts[src.index].pipe >= 0) {
- struct nv40_fragment_program_data *fpd;
+ struct nvfx_fragment_program_data *fpd;
fp->consts = realloc(fp->consts, ++fp->nr_consts *
sizeof(*fpd));
@@ -149,63 +132,63 @@ emit_src(struct nv40_fpc *fpc, int pos, struct nv40_sreg src)
sizeof(uint32_t) * 4);
}
- sr |= (NV40_FP_REG_TYPE_CONST << NV40_FP_REG_TYPE_SHIFT);
+ sr |= (NVFX_FP_REG_TYPE_CONST << NVFX_FP_REG_TYPE_SHIFT);
break;
- case NV40SR_NONE:
- sr |= (NV40_FP_REG_TYPE_INPUT << NV40_FP_REG_TYPE_SHIFT);
+ case NVFXSR_NONE:
+ sr |= (NVFX_FP_REG_TYPE_INPUT << NVFX_FP_REG_TYPE_SHIFT);
break;
default:
assert(0);
}
if (src.negate)
- sr |= NV40_FP_REG_NEGATE;
+ sr |= NVFX_FP_REG_NEGATE;
if (src.abs)
hw[1] |= (1 << (29 + pos));
- sr |= ((src.swz[0] << NV40_FP_REG_SWZ_X_SHIFT) |
- (src.swz[1] << NV40_FP_REG_SWZ_Y_SHIFT) |
- (src.swz[2] << NV40_FP_REG_SWZ_Z_SHIFT) |
- (src.swz[3] << NV40_FP_REG_SWZ_W_SHIFT));
+ sr |= ((src.swz[0] << NVFX_FP_REG_SWZ_X_SHIFT) |
+ (src.swz[1] << NVFX_FP_REG_SWZ_Y_SHIFT) |
+ (src.swz[2] << NVFX_FP_REG_SWZ_Z_SHIFT) |
+ (src.swz[3] << NVFX_FP_REG_SWZ_W_SHIFT));
hw[pos + 1] |= sr;
}
static void
-emit_dst(struct nv40_fpc *fpc, struct nv40_sreg dst)
+emit_dst(struct nvfx_fpc *fpc, struct nvfx_sreg dst)
{
- struct nv40_fragment_program *fp = fpc->fp;
+ struct nvfx_fragment_program *fp = fpc->fp;
uint32_t *hw = &fp->insn[fpc->inst_offset];
switch (dst.type) {
- case NV40SR_TEMP:
+ case NVFXSR_TEMP:
if (fpc->num_regs < (dst.index + 1))
fpc->num_regs = dst.index + 1;
break;
- case NV40SR_OUTPUT:
+ case NVFXSR_OUTPUT:
if (dst.index == 1) {
fp->fp_control |= 0xe;
} else {
- hw[0] |= NV40_FP_OP_OUT_REG_HALF;
+ hw[0] |= NVFX_FP_OP_OUT_REG_HALF;
}
break;
- case NV40SR_NONE:
+ case NVFXSR_NONE:
hw[0] |= (1 << 30);
break;
default:
assert(0);
}
- hw[0] |= (dst.index << NV40_FP_OP_OUT_REG_SHIFT);
+ hw[0] |= (dst.index << NVFX_FP_OP_OUT_REG_SHIFT);
}
static void
-nv40_fp_arith(struct nv40_fpc *fpc, int sat, int op,
- struct nv40_sreg dst, int mask,
- struct nv40_sreg s0, struct nv40_sreg s1, struct nv40_sreg s2)
+nvfx_fp_arith(struct nvfx_fpc *fpc, int sat, int op,
+ struct nvfx_sreg dst, int mask,
+ struct nvfx_sreg s0, struct nvfx_sreg s1, struct nvfx_sreg s2)
{
- struct nv40_fragment_program *fp = fpc->fp;
+ struct nvfx_fragment_program *fp = fpc->fp;
uint32_t *hw;
fpc->inst_offset = fp->insn_len;
@@ -214,22 +197,22 @@ nv40_fp_arith(struct nv40_fpc *fpc, int sat, int op,
hw = &fp->insn[fpc->inst_offset];
memset(hw, 0, sizeof(uint32_t) * 4);
- if (op == NV40_FP_OP_OPCODE_KIL)
- fp->fp_control |= NV40TCL_FP_CONTROL_KIL;
- hw[0] |= (op << NV40_FP_OP_OPCODE_SHIFT);
- hw[0] |= (mask << NV40_FP_OP_OUTMASK_SHIFT);
- hw[2] |= (dst.dst_scale << NV40_FP_OP_DST_SCALE_SHIFT);
+ if (op == NVFX_FP_OP_OPCODE_KIL)
+ fp->fp_control |= NV34TCL_FP_CONTROL_USES_KIL;
+ hw[0] |= (op << NVFX_FP_OP_OPCODE_SHIFT);
+ hw[0] |= (mask << NVFX_FP_OP_OUTMASK_SHIFT);
+ hw[2] |= (dst.dst_scale << NVFX_FP_OP_DST_SCALE_SHIFT);
if (sat)
- hw[0] |= NV40_FP_OP_OUT_SAT;
+ hw[0] |= NVFX_FP_OP_OUT_SAT;
if (dst.cc_update)
- hw[0] |= NV40_FP_OP_COND_WRITE_ENABLE;
- hw[1] |= (dst.cc_test << NV40_FP_OP_COND_SHIFT);
- hw[1] |= ((dst.cc_swz[0] << NV40_FP_OP_COND_SWZ_X_SHIFT) |
- (dst.cc_swz[1] << NV40_FP_OP_COND_SWZ_Y_SHIFT) |
- (dst.cc_swz[2] << NV40_FP_OP_COND_SWZ_Z_SHIFT) |
- (dst.cc_swz[3] << NV40_FP_OP_COND_SWZ_W_SHIFT));
+ hw[0] |= NVFX_FP_OP_COND_WRITE_ENABLE;
+ hw[1] |= (dst.cc_test << NVFX_FP_OP_COND_SHIFT);
+ hw[1] |= ((dst.cc_swz[0] << NVFX_FP_OP_COND_SWZ_X_SHIFT) |
+ (dst.cc_swz[1] << NVFX_FP_OP_COND_SWZ_Y_SHIFT) |
+ (dst.cc_swz[2] << NVFX_FP_OP_COND_SWZ_Z_SHIFT) |
+ (dst.cc_swz[3] << NVFX_FP_OP_COND_SWZ_W_SHIFT));
emit_dst(fpc, dst);
emit_src(fpc, 0, s0);
@@ -238,26 +221,26 @@ nv40_fp_arith(struct nv40_fpc *fpc, int sat, int op,
}
static void
-nv40_fp_tex(struct nv40_fpc *fpc, int sat, int op, int unit,
- struct nv40_sreg dst, int mask,
- struct nv40_sreg s0, struct nv40_sreg s1, struct nv40_sreg s2)
+nvfx_fp_tex(struct nvfx_fpc *fpc, int sat, int op, int unit,
+ struct nvfx_sreg dst, int mask,
+ struct nvfx_sreg s0, struct nvfx_sreg s1, struct nvfx_sreg s2)
{
- struct nv40_fragment_program *fp = fpc->fp;
+ struct nvfx_fragment_program *fp = fpc->fp;
- nv40_fp_arith(fpc, sat, op, dst, mask, s0, s1, s2);
+ nvfx_fp_arith(fpc, sat, op, dst, mask, s0, s1, s2);
- fp->insn[fpc->inst_offset] |= (unit << NV40_FP_OP_TEX_UNIT_SHIFT);
+ fp->insn[fpc->inst_offset] |= (unit << NVFX_FP_OP_TEX_UNIT_SHIFT);
fp->samplers |= (1 << unit);
}
-static INLINE struct nv40_sreg
-tgsi_src(struct nv40_fpc *fpc, const struct tgsi_full_src_register *fsrc)
+static INLINE struct nvfx_sreg
+tgsi_src(struct nvfx_fpc *fpc, const struct tgsi_full_src_register *fsrc)
{
- struct nv40_sreg src;
+ struct nvfx_sreg src;
switch (fsrc->Register.File) {
case TGSI_FILE_INPUT:
- src = nv40_sr(NV40SR_INPUT,
+ src = nvfx_sr(NVFXSR_INPUT,
fpc->attrib_map[fsrc->Register.Index]);
break;
case TGSI_FILE_CONSTANT:
@@ -288,18 +271,18 @@ tgsi_src(struct nv40_fpc *fpc, const struct tgsi_full_src_register *fsrc)
return src;
}
-static INLINE struct nv40_sreg
-tgsi_dst(struct nv40_fpc *fpc, const struct tgsi_full_dst_register *fdst) {
+static INLINE struct nvfx_sreg
+tgsi_dst(struct nvfx_fpc *fpc, const struct tgsi_full_dst_register *fdst) {
switch (fdst->Register.File) {
case TGSI_FILE_OUTPUT:
return fpc->r_result[fdst->Register.Index];
case TGSI_FILE_TEMPORARY:
return fpc->r_temp[fdst->Register.Index];
case TGSI_FILE_NULL:
- return nv40_sr(NV40SR_NONE, 0);
+ return nvfx_sr(NVFXSR_NONE, 0);
default:
NOUVEAU_ERR("bad dst file %d\n", fdst->Register.File);
- return nv40_sr(NV40SR_NONE, 0);
+ return nvfx_sr(NVFXSR_NONE, 0);
}
}
@@ -308,52 +291,19 @@ tgsi_mask(uint tgsi)
{
int mask = 0;
- if (tgsi & TGSI_WRITEMASK_X) mask |= MASK_X;
- if (tgsi & TGSI_WRITEMASK_Y) mask |= MASK_Y;
- if (tgsi & TGSI_WRITEMASK_Z) mask |= MASK_Z;
- if (tgsi & TGSI_WRITEMASK_W) mask |= MASK_W;
+ if (tgsi & TGSI_WRITEMASK_X) mask |= NVFX_FP_MASK_X;
+ if (tgsi & TGSI_WRITEMASK_Y) mask |= NVFX_FP_MASK_Y;
+ if (tgsi & TGSI_WRITEMASK_Z) mask |= NVFX_FP_MASK_Z;
+ if (tgsi & TGSI_WRITEMASK_W) mask |= NVFX_FP_MASK_W;
return mask;
}
static boolean
-src_native_swz(struct nv40_fpc *fpc, const struct tgsi_full_src_register *fsrc,
- struct nv40_sreg *src)
-{
- const struct nv40_sreg none = nv40_sr(NV40SR_NONE, 0);
- struct nv40_sreg tgsi = tgsi_src(fpc, fsrc);
- uint mask = 0;
- uint c;
-
- for (c = 0; c < 4; c++) {
- switch (tgsi_util_get_full_src_register_swizzle(fsrc, c)) {
- case TGSI_SWIZZLE_X:
- case TGSI_SWIZZLE_Y:
- case TGSI_SWIZZLE_Z:
- case TGSI_SWIZZLE_W:
- mask |= (1 << c);
- break;
- default:
- assert(0);
- }
- }
-
- if (mask == MASK_ALL)
- return TRUE;
-
- *src = temp(fpc);
-
- if (mask)
- arith(fpc, 0, MOV, *src, mask, tgsi, none, none);
-
- return FALSE;
-}
-
-static boolean
-nv40_fragprog_parse_instruction(struct nv40_fpc *fpc,
+nvfx_fragprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_fpc *fpc,
const struct tgsi_full_instruction *finst)
{
- const struct nv40_sreg none = nv40_sr(NV40SR_NONE, 0);
- struct nv40_sreg src[3], dst, tmp;
+ const struct nvfx_sreg none = nvfx_sr(NVFXSR_NONE, 0);
+ struct nvfx_sreg src[3], dst, tmp;
int mask, sat, unit;
int ai = -1, ci = -1, ii = -1;
int i;
@@ -377,23 +327,12 @@ nv40_fragprog_parse_instruction(struct nv40_fpc *fpc,
switch (fsrc->Register.File) {
case TGSI_FILE_INPUT:
- case TGSI_FILE_CONSTANT:
- case TGSI_FILE_TEMPORARY:
- if (!src_native_swz(fpc, fsrc, &src[i]))
- continue;
- break;
- default:
- break;
- }
-
- switch (fsrc->Register.File) {
- case TGSI_FILE_INPUT:
if (ai == -1 || ai == fsrc->Register.Index) {
ai = fsrc->Register.Index;
src[i] = tgsi_src(fpc, fsrc);
} else {
src[i] = temp(fpc);
- arith(fpc, 0, MOV, src[i], MASK_ALL,
+ arith(fpc, 0, MOV, src[i], NVFX_FP_MASK_ALL,
tgsi_src(fpc, fsrc), none, none);
}
break;
@@ -404,7 +343,7 @@ nv40_fragprog_parse_instruction(struct nv40_fpc *fpc,
src[i] = tgsi_src(fpc, fsrc);
} else {
src[i] = temp(fpc);
- arith(fpc, 0, MOV, src[i], MASK_ALL,
+ arith(fpc, 0, MOV, src[i], NVFX_FP_MASK_ALL,
tgsi_src(fpc, fsrc), none, none);
}
break;
@@ -415,7 +354,7 @@ nv40_fragprog_parse_instruction(struct nv40_fpc *fpc,
src[i] = tgsi_src(fpc, fsrc);
} else {
src[i] = temp(fpc);
- arith(fpc, 0, MOV, src[i], MASK_ALL,
+ arith(fpc, 0, MOV, src[i], NVFX_FP_MASK_ALL,
tgsi_src(fpc, fsrc), none, none);
}
break;
@@ -445,25 +384,25 @@ nv40_fragprog_parse_instruction(struct nv40_fpc *fpc,
arith(fpc, sat, ADD, dst, mask, src[0], src[1], none);
break;
case TGSI_OPCODE_CMP:
- tmp = nv40_sr(NV40SR_NONE, 0);
+ tmp = nvfx_sr(NVFXSR_NONE, 0);
tmp.cc_update = 1;
arith(fpc, 0, MOV, tmp, 0xf, src[0], none, none);
- dst.cc_test = NV40_VP_INST_COND_GE;
+ dst.cc_test = NVFX_COND_GE;
arith(fpc, sat, MOV, dst, mask, src[2], none, none);
- dst.cc_test = NV40_VP_INST_COND_LT;
+ dst.cc_test = NVFX_COND_LT;
arith(fpc, sat, MOV, dst, mask, src[1], none, none);
break;
case TGSI_OPCODE_COS:
arith(fpc, sat, COS, dst, mask, src[0], none, none);
break;
case TGSI_OPCODE_DDX:
- if (mask & (MASK_Z | MASK_W)) {
+ if (mask & (NVFX_FP_MASK_Z | NVFX_FP_MASK_W)) {
tmp = temp(fpc);
- arith(fpc, sat, DDX, tmp, MASK_X | MASK_Y,
+ arith(fpc, sat, DDX, tmp, NVFX_FP_MASK_X | NVFX_FP_MASK_Y,
swz(src[0], Z, W, Z, W), none, none);
- arith(fpc, 0, MOV, tmp, MASK_Z | MASK_W,
+ arith(fpc, 0, MOV, tmp, NVFX_FP_MASK_Z | NVFX_FP_MASK_W,
swz(tmp, X, Y, X, Y), none, none);
- arith(fpc, sat, DDX, tmp, MASK_X | MASK_Y, src[0],
+ arith(fpc, sat, DDX, tmp, NVFX_FP_MASK_X | NVFX_FP_MASK_Y, src[0],
none, none);
arith(fpc, 0, MOV, dst, mask, tmp, none, none);
} else {
@@ -471,13 +410,13 @@ nv40_fragprog_parse_instruction(struct nv40_fpc *fpc,
}
break;
case TGSI_OPCODE_DDY:
- if (mask & (MASK_Z | MASK_W)) {
+ if (mask & (NVFX_FP_MASK_Z | NVFX_FP_MASK_W)) {
tmp = temp(fpc);
- arith(fpc, sat, DDY, tmp, MASK_X | MASK_Y,
+ arith(fpc, sat, DDY, tmp, NVFX_FP_MASK_X | NVFX_FP_MASK_Y,
swz(src[0], Z, W, Z, W), none, none);
- arith(fpc, 0, MOV, tmp, MASK_Z | MASK_W,
+ arith(fpc, 0, MOV, tmp, NVFX_FP_MASK_Z | NVFX_FP_MASK_W,
swz(tmp, X, Y, X, Y), none, none);
- arith(fpc, sat, DDY, tmp, MASK_X | MASK_Y, src[0],
+ arith(fpc, sat, DDY, tmp, NVFX_FP_MASK_X | NVFX_FP_MASK_Y, src[0],
none, none);
arith(fpc, 0, MOV, dst, mask, tmp, none, none);
} else {
@@ -492,7 +431,7 @@ nv40_fragprog_parse_instruction(struct nv40_fpc *fpc,
break;
case TGSI_OPCODE_DPH:
tmp = temp(fpc);
- arith(fpc, 0, DP3, tmp, MASK_X, src[0], src[1], none);
+ arith(fpc, 0, DP3, tmp, NVFX_FP_MASK_X, src[0], src[1], none);
arith(fpc, sat, ADD, dst, mask, swz(tmp, X, X, X, X),
swz(src[1], W, W, W, W), none);
break;
@@ -512,10 +451,10 @@ nv40_fragprog_parse_instruction(struct nv40_fpc *fpc,
arith(fpc, 0, KIL, none, 0, none, none, none);
break;
case TGSI_OPCODE_KIL:
- dst = nv40_sr(NV40SR_NONE, 0);
+ dst = nvfx_sr(NVFXSR_NONE, 0);
dst.cc_update = 1;
- arith(fpc, 0, MOV, dst, MASK_ALL, src[0], none, none);
- dst.cc_update = 0; dst.cc_test = NV40_FP_OP_COND_LT;
+ arith(fpc, 0, MOV, dst, NVFX_FP_MASK_ALL, src[0], none, none);
+ dst.cc_update = 0; dst.cc_test = NVFX_COND_LT;
arith(fpc, 0, KIL, dst, 0, none, none, none);
break;
case TGSI_OPCODE_LG2:
@@ -523,9 +462,13 @@ nv40_fragprog_parse_instruction(struct nv40_fpc *fpc,
break;
// case TGSI_OPCODE_LIT:
case TGSI_OPCODE_LRP:
- tmp = temp(fpc);
- arith(fpc, 0, MAD, tmp, mask, neg(src[0]), src[2], src[2]);
- arith(fpc, sat, MAD, dst, mask, src[0], src[1], tmp);
+ if(!nvfx->is_nv4x)
+ arith(fpc, sat, LRP_NV30, dst, mask, src[0], src[1], src[2]);
+ else {
+ tmp = temp(fpc);
+ arith(fpc, 0, MAD, tmp, mask, neg(src[0]), src[2], src[2]);
+ arith(fpc, sat, MAD, dst, mask, src[0], src[1], tmp);
+ }
break;
case TGSI_OPCODE_MAD:
arith(fpc, sat, MAD, dst, mask, src[0], src[1], src[2]);
@@ -543,13 +486,17 @@ nv40_fragprog_parse_instruction(struct nv40_fpc *fpc,
arith(fpc, sat, MUL, dst, mask, src[0], src[1], none);
break;
case TGSI_OPCODE_POW:
- tmp = temp(fpc);
- arith(fpc, 0, LG2, tmp, MASK_X,
- swz(src[0], X, X, X, X), none, none);
- arith(fpc, 0, MUL, tmp, MASK_X, swz(tmp, X, X, X, X),
- swz(src[1], X, X, X, X), none);
- arith(fpc, sat, EX2, dst, mask,
- swz(tmp, X, X, X, X), none, none);
+ if(!nvfx->is_nv4x)
+ arith(fpc, sat, POW_NV30, dst, mask, src[0], src[1], none);
+ else {
+ tmp = temp(fpc);
+ arith(fpc, 0, LG2, tmp, NVFX_FP_MASK_X,
+ swz(src[0], X, X, X, X), none, none);
+ arith(fpc, 0, MUL, tmp, NVFX_FP_MASK_X, swz(tmp, X, X, X, X),
+ swz(src[1], X, X, X, X), none);
+ arith(fpc, sat, EX2, dst, mask,
+ swz(tmp, X, X, X, X), none, none);
+ }
break;
case TGSI_OPCODE_RCP:
arith(fpc, sat, RCP, dst, mask, src[0], none, none);
@@ -558,42 +505,50 @@ nv40_fragprog_parse_instruction(struct nv40_fpc *fpc,
assert(0);
break;
case TGSI_OPCODE_RFL:
- tmp = temp(fpc);
- arith(fpc, 0, DP3, tmp, MASK_X, src[0], src[0], none);
- arith(fpc, 0, DP3, tmp, MASK_Y, src[0], src[1], none);
- arith(fpc, 0, DIV, scale(tmp, 2X), MASK_Z,
- swz(tmp, Y, Y, Y, Y), swz(tmp, X, X, X, X), none);
- arith(fpc, sat, MAD, dst, mask,
- swz(tmp, Z, Z, Z, Z), src[0], neg(src[1]));
+ if(!nvfx->is_nv4x)
+ arith(fpc, 0, RFL_NV30, dst, mask, src[0], src[1], none);
+ else {
+ tmp = temp(fpc);
+ arith(fpc, 0, DP3, tmp, NVFX_FP_MASK_X, src[0], src[0], none);
+ arith(fpc, 0, DP3, tmp, NVFX_FP_MASK_Y, src[0], src[1], none);
+ arith(fpc, 0, DIV, scale(tmp, 2X), NVFX_FP_MASK_Z,
+ swz(tmp, Y, Y, Y, Y), swz(tmp, X, X, X, X), none);
+ arith(fpc, sat, MAD, dst, mask,
+ swz(tmp, Z, Z, Z, Z), src[0], neg(src[1]));
+ }
break;
case TGSI_OPCODE_RSQ:
- tmp = temp(fpc);
- arith(fpc, 0, LG2, scale(tmp, INV_2X), MASK_X,
- abs(swz(src[0], X, X, X, X)), none, none);
- arith(fpc, sat, EX2, dst, mask,
- neg(swz(tmp, X, X, X, X)), none, none);
+ if(!nvfx->is_nv4x)
+ arith(fpc, sat, RSQ_NV30, dst, mask, abs(swz(src[0], X, X, X, X)), none, none);
+ else {
+ tmp = temp(fpc);
+ arith(fpc, 0, LG2, scale(tmp, INV_2X), NVFX_FP_MASK_X,
+ abs(swz(src[0], X, X, X, X)), none, none);
+ arith(fpc, sat, EX2, dst, mask,
+ neg(swz(tmp, X, X, X, X)), none, none);
+ }
break;
case TGSI_OPCODE_SCS:
/* avoid overwriting the source */
- if(src[0].swz[SWZ_X] != SWZ_X)
+ if(src[0].swz[NVFX_SWZ_X] != NVFX_SWZ_X)
{
- if (mask & MASK_X) {
- arith(fpc, sat, COS, dst, MASK_X,
+ if (mask & NVFX_FP_MASK_X) {
+ arith(fpc, sat, COS, dst, NVFX_FP_MASK_X,
swz(src[0], X, X, X, X), none, none);
}
- if (mask & MASK_Y) {
- arith(fpc, sat, SIN, dst, MASK_Y,
+ if (mask & NVFX_FP_MASK_Y) {
+ arith(fpc, sat, SIN, dst, NVFX_FP_MASK_Y,
swz(src[0], X, X, X, X), none, none);
}
}
else
{
- if (mask & MASK_Y) {
- arith(fpc, sat, SIN, dst, MASK_Y,
+ if (mask & NVFX_FP_MASK_Y) {
+ arith(fpc, sat, SIN, dst, NVFX_FP_MASK_Y,
swz(src[0], X, X, X, X), none, none);
}
- if (mask & MASK_X) {
- arith(fpc, sat, COS, dst, MASK_X,
+ if (mask & NVFX_FP_MASK_X) {
+ arith(fpc, sat, COS, dst, NVFX_FP_MASK_X,
swz(src[0], X, X, X, X), none, none);
}
}
@@ -641,7 +596,7 @@ nv40_fragprog_parse_instruction(struct nv40_fpc *fpc,
tmp = temp(fpc);
arith(fpc, 0, MUL, tmp, mask,
swz(src[0], Z, X, Y, Y), swz(src[1], Y, Z, X, X), none);
- arith(fpc, sat, MAD, dst, (mask & ~MASK_W),
+ arith(fpc, sat, MAD, dst, (mask & ~NVFX_FP_MASK_W),
swz(src[0], Y, Z, X, X), swz(src[1], Z, X, Y, Y),
neg(tmp));
break;
@@ -655,32 +610,32 @@ nv40_fragprog_parse_instruction(struct nv40_fpc *fpc,
}
static boolean
-nv40_fragprog_parse_decl_attrib(struct nv40_fpc *fpc,
+nvfx_fragprog_parse_decl_attrib(struct nvfx_context* nvfx, struct nvfx_fpc *fpc,
const struct tgsi_full_declaration *fdec)
{
int hw;
switch (fdec->Semantic.Name) {
case TGSI_SEMANTIC_POSITION:
- hw = NV40_FP_OP_INPUT_SRC_POSITION;
+ hw = NVFX_FP_OP_INPUT_SRC_POSITION;
break;
case TGSI_SEMANTIC_COLOR:
if (fdec->Semantic.Index == 0) {
- hw = NV40_FP_OP_INPUT_SRC_COL0;
+ hw = NVFX_FP_OP_INPUT_SRC_COL0;
} else
if (fdec->Semantic.Index == 1) {
- hw = NV40_FP_OP_INPUT_SRC_COL1;
+ hw = NVFX_FP_OP_INPUT_SRC_COL1;
} else {
NOUVEAU_ERR("bad colour semantic index\n");
return FALSE;
}
break;
case TGSI_SEMANTIC_FOG:
- hw = NV40_FP_OP_INPUT_SRC_FOGC;
+ hw = NVFX_FP_OP_INPUT_SRC_FOGC;
break;
case TGSI_SEMANTIC_GENERIC:
if (fdec->Semantic.Index <= 7) {
- hw = NV40_FP_OP_INPUT_SRC_TC(fdec->Semantic.
+ hw = NVFX_FP_OP_INPUT_SRC_TC(fdec->Semantic.
Index);
} else {
NOUVEAU_ERR("bad generic semantic index\n");
@@ -697,7 +652,7 @@ nv40_fragprog_parse_decl_attrib(struct nv40_fpc *fpc,
}
static boolean
-nv40_fragprog_parse_decl_output(struct nv40_fpc *fpc,
+nvfx_fragprog_parse_decl_output(struct nvfx_context* nvfx, struct nvfx_fpc *fpc,
const struct tgsi_full_declaration *fdec)
{
unsigned idx = fdec->Range.First;
@@ -708,12 +663,14 @@ nv40_fragprog_parse_decl_output(struct nv40_fpc *fpc,
hw = 1;
break;
case TGSI_SEMANTIC_COLOR:
+ hw = ~0;
switch (fdec->Semantic.Index) {
case 0: hw = 0; break;
case 1: hw = 2; break;
case 2: hw = 3; break;
case 3: hw = 4; break;
- default:
+ }
+ if(hw > ((nvfx->is_nv4x) ? 4 : 2)) {
NOUVEAU_ERR("bad rcol index\n");
return FALSE;
}
@@ -723,13 +680,13 @@ nv40_fragprog_parse_decl_output(struct nv40_fpc *fpc,
return FALSE;
}
- fpc->r_result[idx] = nv40_sr(NV40SR_OUTPUT, hw);
+ fpc->r_result[idx] = nvfx_sr(NVFXSR_OUTPUT, hw);
fpc->r_temps |= (1 << hw);
return TRUE;
}
static boolean
-nv40_fragprog_prepare(struct nv40_fpc *fpc)
+nvfx_fragprog_prepare(struct nvfx_context* nvfx, struct nvfx_fpc *fpc)
{
struct tgsi_parse_context p;
int high_temp = -1, i;
@@ -746,11 +703,11 @@ nv40_fragprog_prepare(struct nv40_fpc *fpc)
fdec = &p.FullToken.FullDeclaration;
switch (fdec->Declaration.File) {
case TGSI_FILE_INPUT:
- if (!nv40_fragprog_parse_decl_attrib(fpc, fdec))
+ if (!nvfx_fragprog_parse_decl_attrib(nvfx, fpc, fdec))
goto out_err;
break;
case TGSI_FILE_OUTPUT:
- if (!nv40_fragprog_parse_decl_output(fpc, fdec))
+ if (!nvfx_fragprog_parse_decl_output(nvfx, fpc, fdec))
goto out_err;
break;
case TGSI_FILE_TEMPORARY:
@@ -787,7 +744,7 @@ nv40_fragprog_prepare(struct nv40_fpc *fpc)
tgsi_parse_free(&p);
if (++high_temp) {
- fpc->r_temp = CALLOC(high_temp, sizeof(struct nv40_sreg));
+ fpc->r_temp = CALLOC(high_temp, sizeof(struct nvfx_sreg));
for (i = 0; i < high_temp; i++)
fpc->r_temp[i] = temp(fpc);
fpc->r_temps_discard = 0;
@@ -803,19 +760,19 @@ out_err:
}
static void
-nv40_fragprog_translate(struct nv40_context *nv40,
- struct nv40_fragment_program *fp)
+nvfx_fragprog_translate(struct nvfx_context *nvfx,
+ struct nvfx_fragment_program *fp)
{
struct tgsi_parse_context parse;
- struct nv40_fpc *fpc = NULL;
+ struct nvfx_fpc *fpc = NULL;
- fpc = CALLOC(1, sizeof(struct nv40_fpc));
+ fpc = CALLOC(1, sizeof(struct nvfx_fpc));
if (!fpc)
return;
fpc->fp = fp;
fpc->num_regs = 2;
- if (!nv40_fragprog_prepare(fpc)) {
+ if (!nvfx_fragprog_prepare(nvfx, fpc)) {
FREE(fpc);
return;
}
@@ -831,7 +788,7 @@ nv40_fragprog_translate(struct nv40_context *nv40,
const struct tgsi_full_instruction *finst;
finst = &parse.FullToken.FullInstruction;
- if (!nv40_fragprog_parse_instruction(fpc, finst))
+ if (!nvfx_fragprog_parse_instruction(nvfx, fpc, finst))
goto out_err;
}
break;
@@ -840,10 +797,14 @@ nv40_fragprog_translate(struct nv40_context *nv40,
}
}
- fp->fp_control |= fpc->num_regs << NV40TCL_FP_CONTROL_TEMP_COUNT_SHIFT;
+ if(!nvfx->is_nv4x)
+ fp->fp_control |= (fpc->num_regs-1)/2;
+ else
+ fp->fp_control |= fpc->num_regs << NV40TCL_FP_CONTROL_TEMP_COUNT_SHIFT;
/* Terminate final instruction */
- fp->insn[fpc->inst_offset] |= 0x00000001;
+ if(fp->insn)
+ fp->insn[fpc->inst_offset] |= 0x00000001;
/* Append NOP + END instruction, may or may not be necessary. */
fpc->inst_offset = fp->insn_len;
@@ -862,10 +823,10 @@ out_err:
}
static void
-nv40_fragprog_upload(struct nv40_context *nv40,
- struct nv40_fragment_program *fp)
+nvfx_fragprog_upload(struct nvfx_context *nvfx,
+ struct nvfx_fragment_program *fp)
{
- struct pipe_screen *pscreen = nv40->pipe.screen;
+ struct pipe_screen *pscreen = nvfx->pipe.screen;
const uint32_t le = 1;
uint32_t *map;
int i;
@@ -896,12 +857,12 @@ nv40_fragprog_upload(struct nv40_context *nv40,
}
static boolean
-nv40_fragprog_validate(struct nv40_context *nv40)
+nvfx_fragprog_validate(struct nvfx_context *nvfx)
{
- struct nv40_fragment_program *fp = nv40->fragprog;
+ struct nvfx_fragment_program *fp = nvfx->fragprog;
struct pipe_buffer *constbuf =
- nv40->constbuf[PIPE_SHADER_FRAGMENT];
- struct pipe_screen *pscreen = nv40->pipe.screen;
+ nvfx->constbuf[PIPE_SHADER_FRAGMENT];
+ struct pipe_screen *pscreen = nvfx->pipe.screen;
struct nouveau_stateobj *so;
boolean new_consts = FALSE;
int i;
@@ -909,24 +870,31 @@ nv40_fragprog_validate(struct nv40_context *nv40)
if (fp->translated)
goto update_constants;
- nv40->fallback_swrast &= ~NV40_NEW_FRAGPROG;
- nv40_fragprog_translate(nv40, fp);
+ nvfx->fallback_swrast &= ~NVFX_NEW_FRAGPROG;
+ nvfx_fragprog_translate(nvfx, fp);
if (!fp->translated) {
- nv40->fallback_swrast |= NV40_NEW_FRAGPROG;
+ nvfx->fallback_swrast |= NVFX_NEW_FRAGPROG;
return FALSE;
}
fp->buffer = pscreen->buffer_create(pscreen, 0x100, 0, fp->insn_len * 4);
- nv40_fragprog_upload(nv40, fp);
+ nvfx_fragprog_upload(nvfx, fp);
- so = so_new(2, 2, 1);
- so_method(so, nv40->screen->curie, NV40TCL_FP_ADDRESS, 1);
+ so = so_new(4, 4, 1);
+ so_method(so, nvfx->screen->eng3d, NV34TCL_FP_ACTIVE_PROGRAM, 1);
so_reloc (so, nouveau_bo(fp->buffer), 0, NOUVEAU_BO_VRAM |
NOUVEAU_BO_GART | NOUVEAU_BO_RD | NOUVEAU_BO_LOW |
- NOUVEAU_BO_OR, NV40TCL_FP_ADDRESS_DMA0,
- NV40TCL_FP_ADDRESS_DMA1);
- so_method(so, nv40->screen->curie, NV40TCL_FP_CONTROL, 1);
+ NOUVEAU_BO_OR, NV34TCL_FP_ACTIVE_PROGRAM_DMA0,
+ NV34TCL_FP_ACTIVE_PROGRAM_DMA1);
+ so_method(so, nvfx->screen->eng3d, NV34TCL_FP_CONTROL, 1);
so_data (so, fp->fp_control);
+ if(!nvfx->is_nv4x) {
+ so_method(so, nvfx->screen->eng3d, NV34TCL_FP_REG_CONTROL, 1);
+ so_data (so, (1<<16)|0x4);
+ so_method(so, nvfx->screen->eng3d, NV34TCL_TX_UNITS_ENABLE, 1);
+ so_data (so, fp->samplers);
+ }
+
so_ref(so, &fp->so);
so_ref(NULL, &so);
@@ -937,7 +905,7 @@ update_constants:
map = pipe_buffer_map(pscreen, constbuf,
PIPE_BUFFER_USAGE_CPU_READ);
for (i = 0; i < fp->nr_consts; i++) {
- struct nv40_fragment_program_data *fpd = &fp->consts[i];
+ struct nvfx_fragment_program_data *fpd = &fp->consts[i];
uint32_t *p = &fp->insn[fpd->offset];
uint32_t *cb = (uint32_t *)&map[fpd->index * 4];
@@ -949,11 +917,11 @@ update_constants:
pipe_buffer_unmap(pscreen, constbuf);
if (new_consts)
- nv40_fragprog_upload(nv40, fp);
+ nvfx_fragprog_upload(nvfx, fp);
}
- if (new_consts || fp->so != nv40->state.hw[NV40_STATE_FRAGPROG]) {
- so_ref(fp->so, &nv40->state.hw[NV40_STATE_FRAGPROG]);
+ if (new_consts || fp->so != nvfx->state.hw[NVFX_STATE_FRAGPROG]) {
+ so_ref(fp->so, &nvfx->state.hw[NVFX_STATE_FRAGPROG]);
return TRUE;
}
@@ -961,8 +929,8 @@ update_constants:
}
void
-nv40_fragprog_destroy(struct nv40_context *nv40,
- struct nv40_fragment_program *fp)
+nvfx_fragprog_destroy(struct nvfx_context *nvfx,
+ struct nvfx_fragment_program *fp)
{
if (fp->buffer)
pipe_buffer_reference(&fp->buffer, NULL);
@@ -974,11 +942,10 @@ nv40_fragprog_destroy(struct nv40_context *nv40,
FREE(fp->insn);
}
-struct nv40_state_entry nv40_state_fragprog = {
- .validate = nv40_fragprog_validate,
+struct nvfx_state_entry nvfx_state_fragprog = {
+ .validate = nvfx_fragprog_validate,
.dirty = {
- .pipe = NV40_NEW_FRAGPROG,
- .hw = NV40_STATE_FRAGPROG
+ .pipe = NVFX_NEW_FRAGPROG,
+ .hw = NVFX_STATE_FRAGPROG
}
};
-
diff --git a/src/gallium/drivers/nvfx/nvfx_fragtex.c b/src/gallium/drivers/nvfx/nvfx_fragtex.c
new file mode 100644
index 0000000000..84e4eb1004
--- /dev/null
+++ b/src/gallium/drivers/nvfx/nvfx_fragtex.c
@@ -0,0 +1,49 @@
+#include "nvfx_context.h"
+
+static boolean
+nvfx_fragtex_validate(struct nvfx_context *nvfx)
+{
+ struct nvfx_fragment_program *fp = nvfx->fragprog;
+ struct nvfx_state *state = &nvfx->state;
+ struct nouveau_stateobj *so;
+ unsigned samplers, unit;
+
+ samplers = state->fp_samplers & ~fp->samplers;
+ while (samplers) {
+ unit = ffs(samplers) - 1;
+ samplers &= ~(1 << unit);
+
+ so = so_new(1, 1, 0);
+ so_method(so, nvfx->screen->eng3d, NV34TCL_TX_ENABLE(unit), 1);
+ so_data (so, 0);
+ so_ref(so, &nvfx->state.hw[NVFX_STATE_FRAGTEX0 + unit]);
+ so_ref(NULL, &so);
+ state->dirty |= (1ULL << (NVFX_STATE_FRAGTEX0 + unit));
+ }
+
+ samplers = nvfx->dirty_samplers & fp->samplers;
+ while (samplers) {
+ unit = ffs(samplers) - 1;
+ samplers &= ~(1 << unit);
+
+ if(!nvfx->is_nv4x)
+ so = nv30_fragtex_build(nvfx, unit);
+ else
+ so = nv40_fragtex_build(nvfx, unit);
+
+ so_ref(so, &nvfx->state.hw[NVFX_STATE_FRAGTEX0 + unit]);
+ so_ref(NULL, &so);
+ state->dirty |= (1ULL << (NVFX_STATE_FRAGTEX0 + unit));
+ }
+
+ nvfx->state.fp_samplers = fp->samplers;
+ return FALSE;
+}
+
+struct nvfx_state_entry nvfx_state_fragtex = {
+ .validate = nvfx_fragtex_validate,
+ .dirty = {
+ .pipe = NVFX_NEW_SAMPLER | NVFX_NEW_FRAGPROG,
+ .hw = 0
+ }
+};
diff --git a/src/gallium/drivers/nv40/nv40_miptree.c b/src/gallium/drivers/nvfx/nvfx_miptree.c
index 85d7e1f197..9de25175e7 100644
--- a/src/gallium/drivers/nv40/nv40_miptree.c
+++ b/src/gallium/drivers/nvfx/nvfx_miptree.c
@@ -4,13 +4,13 @@
#include "util/u_format.h"
#include "util/u_math.h"
-#include "nv40_context.h"
-#include "../nouveau/nv04_surface_2d.h"
+#include "nvfx_context.h"
+#include "nv04_surface_2d.h"
static void
-nv40_miptree_layout(struct nv40_miptree *mt)
+nvfx_miptree_layout(struct nvfx_miptree *mt)
{
struct pipe_texture *pt = &mt->base;
uint width = pt->width0;
@@ -20,7 +20,7 @@ nv40_miptree_layout(struct nv40_miptree *mt)
PIPE_TEXTURE_USAGE_DEPTH_STENCIL |
PIPE_TEXTURE_USAGE_RENDER_TARGET |
PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
- PIPE_TEXTURE_USAGE_PRIMARY);
+ PIPE_TEXTURE_USAGE_SCANOUT);
if (pt->target == PIPE_TEXTURE_CUBE) {
nr_faces = 6;
@@ -62,13 +62,16 @@ nv40_miptree_layout(struct nv40_miptree *mt)
}
static struct pipe_texture *
-nv40_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)
+nvfx_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)
{
- struct nv40_miptree *mt;
+ struct nvfx_miptree *mt;
unsigned buf_usage = PIPE_BUFFER_USAGE_PIXEL |
NOUVEAU_BUFFER_USAGE_TEXTURE;
+ static int no_swizzle = -1;
+ if(no_swizzle < 0)
+ no_swizzle = debug_get_bool_option("NOUVEAU_NO_SWIZZLE", FALSE);
- mt = MALLOC(sizeof(struct nv40_miptree));
+ mt = MALLOC(sizeof(struct nvfx_miptree));
if (!mt)
return NULL;
mt->base = *pt;
@@ -80,7 +83,7 @@ nv40_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)
pt->height0 & (pt->height0 - 1))
mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
else
- if (pt->tex_usage & (PIPE_TEXTURE_USAGE_PRIMARY |
+ if (pt->tex_usage & (PIPE_TEXTURE_USAGE_SCANOUT |
PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
PIPE_TEXTURE_USAGE_DEPTH_STENCIL))
mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
@@ -89,12 +92,24 @@ nv40_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)
mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
else {
switch (pt->format) {
+ case PIPE_FORMAT_B5G6R5_UNORM:
+ case PIPE_FORMAT_L8A8_UNORM:
+ case PIPE_FORMAT_A8_UNORM:
+ case PIPE_FORMAT_L8_UNORM:
+ case PIPE_FORMAT_I8_UNORM:
+ /* TODO: we can actually swizzle these formats on nv40, we
+ are just preserving the pre-unification behavior.
+ The whole 2D code is going to be rewritten anyway. */
+ if(nvfx_screen(pscreen)->is_nv4x) {
+ mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
+ break;
+ }
/* TODO: Figure out which formats can be swizzled */
case PIPE_FORMAT_B8G8R8A8_UNORM:
case PIPE_FORMAT_B8G8R8X8_UNORM:
case PIPE_FORMAT_R16_SNORM:
{
- if (debug_get_bool_option("NOUVEAU_NO_SWIZZLE", FALSE))
+ if (no_swizzle)
mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
break;
}
@@ -112,7 +127,7 @@ nv40_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)
if (pt->tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET && util_format_get_stride(pt->format, pt->width0) < 64)
mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
- nv40_miptree_layout(mt);
+ nvfx_miptree_layout(mt);
mt->buffer = pscreen->buffer_create(pscreen, 256, buf_usage, mt->total_size);
if (!mt->buffer) {
@@ -124,17 +139,17 @@ nv40_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)
}
static struct pipe_texture *
-nv40_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt,
+nvfx_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt,
const unsigned *stride, struct pipe_buffer *pb)
{
- struct nv40_miptree *mt;
+ struct nvfx_miptree *mt;
/* Only supports 2D, non-mipmapped textures for the moment */
if (pt->target != PIPE_TEXTURE_2D || pt->last_level != 0 ||
pt->depth0 != 1)
return NULL;
- mt = CALLOC_STRUCT(nv40_miptree);
+ mt = CALLOC_STRUCT(nvfx_miptree);
if (!mt)
return NULL;
@@ -153,9 +168,9 @@ nv40_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt,
}
static void
-nv40_miptree_destroy(struct pipe_texture *pt)
+nvfx_miptree_destroy(struct pipe_texture *pt)
{
- struct nv40_miptree *mt = (struct nv40_miptree *)pt;
+ struct nvfx_miptree *mt = (struct nvfx_miptree *)pt;
int l;
pipe_buffer_reference(&mt->buffer, NULL);
@@ -168,11 +183,11 @@ nv40_miptree_destroy(struct pipe_texture *pt)
}
static struct pipe_surface *
-nv40_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
+nvfx_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
unsigned face, unsigned level, unsigned zslice,
unsigned flags)
{
- struct nv40_miptree *mt = (struct nv40_miptree *)pt;
+ struct nvfx_miptree *mt = (struct nvfx_miptree *)pt;
struct nv04_surface *ns;
ns = CALLOC_STRUCT(nv04_surface);
@@ -202,21 +217,21 @@ nv40_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
* Note that ns->pitch is always a multiple of 64 for linear surfaces and swizzled surfaces are POT, so
* ns->pitch & 63 is equivalent to (ns->pitch < 64 && swizzled)*/
if((ns->pitch & 63) && (ns->base.usage & (PIPE_BUFFER_USAGE_GPU_WRITE | NOUVEAU_BUFFER_USAGE_NO_RENDER)) == PIPE_BUFFER_USAGE_GPU_WRITE)
- return &nv04_surface_wrap_for_render(pscreen, ((struct nv40_screen*)pscreen)->eng2d, ns)->base;
+ return &nv04_surface_wrap_for_render(pscreen, ((struct nvfx_screen*)pscreen)->eng2d, ns)->base;
return &ns->base;
}
static void
-nv40_miptree_surface_del(struct pipe_surface *ps)
+nvfx_miptree_surface_del(struct pipe_surface *ps)
{
struct nv04_surface* ns = (struct nv04_surface*)ps;
if(ns->backing)
{
- struct nv40_screen* screen = (struct nv40_screen*)ps->texture->screen;
+ struct nvfx_screen* screen = (struct nvfx_screen*)ps->texture->screen;
if(ns->backing->base.usage & PIPE_BUFFER_USAGE_GPU_WRITE)
screen->eng2d->copy(screen->eng2d, &ns->backing->base, 0, 0, ps, 0, 0, ns->base.width, ns->base.height);
- nv40_miptree_surface_del(&ns->backing->base);
+ nvfx_miptree_surface_del(&ns->backing->base);
}
pipe_texture_reference(&ps->texture, NULL);
@@ -224,12 +239,12 @@ nv40_miptree_surface_del(struct pipe_surface *ps)
}
void
-nv40_screen_init_miptree_functions(struct pipe_screen *pscreen)
+nvfx_screen_init_miptree_functions(struct pipe_screen *pscreen)
{
- pscreen->texture_create = nv40_miptree_create;
- pscreen->texture_blanket = nv40_miptree_blanket;
- pscreen->texture_destroy = nv40_miptree_destroy;
- pscreen->get_tex_surface = nv40_miptree_surface_new;
- pscreen->tex_surface_destroy = nv40_miptree_surface_del;
-}
+ pscreen->texture_create = nvfx_miptree_create;
+ pscreen->texture_destroy = nvfx_miptree_destroy;
+ pscreen->get_tex_surface = nvfx_miptree_surface_new;
+ pscreen->tex_surface_destroy = nvfx_miptree_surface_del;
+ nouveau_screen(pscreen)->texture_blanket = nvfx_miptree_blanket;
+}
diff --git a/src/gallium/drivers/nvfx/nvfx_query.c b/src/gallium/drivers/nvfx/nvfx_query.c
new file mode 100644
index 0000000000..acbaf75a23
--- /dev/null
+++ b/src/gallium/drivers/nvfx/nvfx_query.c
@@ -0,0 +1,127 @@
+#include "pipe/p_context.h"
+
+#include "nvfx_context.h"
+
+struct nvfx_query {
+ struct nouveau_resource *object;
+ unsigned type;
+ boolean ready;
+ uint64_t result;
+};
+
+static INLINE struct nvfx_query *
+nvfx_query(struct pipe_query *pipe)
+{
+ return (struct nvfx_query *)pipe;
+}
+
+static struct pipe_query *
+nvfx_query_create(struct pipe_context *pipe, unsigned query_type)
+{
+ struct nvfx_query *q;
+
+ q = CALLOC(1, sizeof(struct nvfx_query));
+ q->type = query_type;
+
+ return (struct pipe_query *)q;
+}
+
+static void
+nvfx_query_destroy(struct pipe_context *pipe, struct pipe_query *pq)
+{
+ struct nvfx_query *q = nvfx_query(pq);
+
+ if (q->object)
+ nouveau_resource_free(&q->object);
+ FREE(q);
+}
+
+static void
+nvfx_query_begin(struct pipe_context *pipe, struct pipe_query *pq)
+{
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+ struct nvfx_query *q = nvfx_query(pq);
+ struct nvfx_screen *screen = nvfx->screen;
+ struct nouveau_channel *chan = screen->base.channel;
+ struct nouveau_grobj *eng3d = screen->eng3d;
+
+ assert(q->type == PIPE_QUERY_OCCLUSION_COUNTER);
+
+ /* Happens when end_query() is called, then another begin_query()
+ * without querying the result in-between. For now we'll wait for
+ * the existing query to notify completion, but it could be better.
+ */
+ if (q->object) {
+ uint64_t tmp;
+ pipe->get_query_result(pipe, pq, 1, &tmp);
+ }
+
+ if (nouveau_resource_alloc(nvfx->screen->query_heap, 1, NULL, &q->object))
+ assert(0);
+ nouveau_notifier_reset(nvfx->screen->query, q->object->start);
+
+ BEGIN_RING(chan, eng3d, NV34TCL_QUERY_RESET, 1);
+ OUT_RING (chan, 1);
+ BEGIN_RING(chan, eng3d, NV34TCL_QUERY_UNK17CC, 1);
+ OUT_RING (chan, 1);
+
+ q->ready = FALSE;
+}
+
+static void
+nvfx_query_end(struct pipe_context *pipe, struct pipe_query *pq)
+{
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+ struct nvfx_screen *screen = nvfx->screen;
+ struct nouveau_channel *chan = screen->base.channel;
+ struct nouveau_grobj *eng3d = screen->eng3d;
+ struct nvfx_query *q = nvfx_query(pq);
+
+ BEGIN_RING(chan, eng3d, NV34TCL_QUERY_GET, 1);
+ OUT_RING (chan, (0x01 << NV34TCL_QUERY_GET_UNK24_SHIFT) |
+ ((q->object->start * 32) << NV34TCL_QUERY_GET_OFFSET_SHIFT));
+ FIRE_RING(chan);
+}
+
+static boolean
+nvfx_query_result(struct pipe_context *pipe, struct pipe_query *pq,
+ boolean wait, uint64_t *result)
+{
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+ struct nvfx_query *q = nvfx_query(pq);
+
+ assert(q->object && q->type == PIPE_QUERY_OCCLUSION_COUNTER);
+
+ if (!q->ready) {
+ unsigned status;
+
+ status = nouveau_notifier_status(nvfx->screen->query,
+ q->object->start);
+ if (status != NV_NOTIFY_STATE_STATUS_COMPLETED) {
+ if (wait == FALSE)
+ return FALSE;
+
+ nouveau_notifier_wait_status(nvfx->screen->query,
+ q->object->start,
+ NV_NOTIFY_STATE_STATUS_COMPLETED, 0);
+ }
+
+ q->result = nouveau_notifier_return_val(nvfx->screen->query,
+ q->object->start);
+ q->ready = TRUE;
+ nouveau_resource_free(&q->object);
+ }
+
+ *result = q->result;
+ return TRUE;
+}
+
+void
+nvfx_init_query_functions(struct nvfx_context *nvfx)
+{
+ nvfx->pipe.create_query = nvfx_query_create;
+ nvfx->pipe.destroy_query = nvfx_query_destroy;
+ nvfx->pipe.begin_query = nvfx_query_begin;
+ nvfx->pipe.end_query = nvfx_query_end;
+ nvfx->pipe.get_query_result = nvfx_query_result;
+}
diff --git a/src/gallium/drivers/nvfx/nvfx_screen.c b/src/gallium/drivers/nvfx/nvfx_screen.c
new file mode 100644
index 0000000000..1a103520a3
--- /dev/null
+++ b/src/gallium/drivers/nvfx/nvfx_screen.c
@@ -0,0 +1,462 @@
+#include "pipe/p_screen.h"
+#include "pipe/p_state.h"
+
+#include "nouveau/nouveau_screen.h"
+
+#include "nvfx_context.h"
+#include "nvfx_screen.h"
+
+#define NV30TCL_CHIPSET_3X_MASK 0x00000003
+#define NV34TCL_CHIPSET_3X_MASK 0x00000010
+#define NV35TCL_CHIPSET_3X_MASK 0x000001e0
+
+/* FIXME: It seems I should not include directly ../../winsys/drm/nouveau/drm/nouveau_drm_api.h
+* to get the pointer to the context front buffer, so I copied nouveau_winsys here.
+* nv30_screen_surface_format_supported() can then use it to enforce creating fbo
+* with same number of bits everywhere.
+*/
+struct nouveau_winsys {
+ struct pipe_winsys base;
+
+ struct pipe_screen *pscreen;
+
+ struct pipe_surface *front;
+};
+#define NV4X_GRCLASS4097_CHIPSETS 0x00000baf
+#define NV4X_GRCLASS4497_CHIPSETS 0x00005450
+#define NV6X_GRCLASS4497_CHIPSETS 0x00000088
+
+static int
+nvfx_screen_get_param(struct pipe_screen *pscreen, int param)
+{
+ struct nvfx_screen *screen = nvfx_screen(pscreen);
+
+ switch (param) {
+ case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
+ /* TODO: check this */
+ return screen->is_nv4x ? 16 : 8;
+ case PIPE_CAP_NPOT_TEXTURES:
+ return !!screen->is_nv4x;
+ case PIPE_CAP_TWO_SIDED_STENCIL:
+ return 1;
+ case PIPE_CAP_GLSL:
+ return 0;
+ case PIPE_CAP_ANISOTROPIC_FILTER:
+ return 1;
+ case PIPE_CAP_POINT_SPRITE:
+ return 1;
+ case PIPE_CAP_MAX_RENDER_TARGETS:
+ return screen->is_nv4x ? 4 : 2;
+ case PIPE_CAP_OCCLUSION_QUERY:
+ return 1;
+ case PIPE_CAP_TEXTURE_SHADOW_MAP:
+ return 1;
+ case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
+ return 13;
+ case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
+ return 10;
+ case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
+ return 13;
+ case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
+ return !!screen->is_nv4x;
+ case PIPE_CAP_TEXTURE_MIRROR_REPEAT:
+ return 1;
+ case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS:
+ return 0; /* We have 4 on nv40 - but unsupported currently */
+ case PIPE_CAP_TGSI_CONT_SUPPORTED:
+ return 0;
+ case PIPE_CAP_BLEND_EQUATION_SEPARATE:
+ return !!screen->is_nv4x;
+ case NOUVEAU_CAP_HW_VTXBUF:
+ return 0;
+ case NOUVEAU_CAP_HW_IDXBUF:
+ return 0;
+ case PIPE_CAP_MAX_COMBINED_SAMPLERS:
+ return 16;
+ case PIPE_CAP_INDEP_BLEND_ENABLE:
+ /* TODO: on nv40 we have separate color masks */
+ /* TODO: nv40 mrt blending is probably broken */
+ return 0;
+ case PIPE_CAP_INDEP_BLEND_FUNC:
+ return 0;
+ case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
+ case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
+ return 1;
+ case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
+ case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
+ return 0;
+ default:
+ NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
+ return 0;
+ }
+}
+
+static float
+nvfx_screen_get_paramf(struct pipe_screen *pscreen, int param)
+{
+ struct nvfx_screen *screen = nvfx_screen(pscreen);
+
+ switch (param) {
+ case PIPE_CAP_MAX_LINE_WIDTH:
+ case PIPE_CAP_MAX_LINE_WIDTH_AA:
+ return 10.0;
+ case PIPE_CAP_MAX_POINT_WIDTH:
+ case PIPE_CAP_MAX_POINT_WIDTH_AA:
+ return 64.0;
+ case PIPE_CAP_MAX_TEXTURE_ANISOTROPY:
+ return screen->is_nv4x ? 16.0 : 8.0;
+ case PIPE_CAP_MAX_TEXTURE_LOD_BIAS:
+ return screen->is_nv4x ? 16.0 : 4.0;
+ default:
+ NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
+ return 0.0;
+ }
+}
+
+static boolean
+nvfx_screen_surface_format_supported(struct pipe_screen *pscreen,
+ enum pipe_format format,
+ enum pipe_texture_target target,
+ unsigned tex_usage, unsigned geom_flags)
+{
+ struct nvfx_screen *screen = nvfx_screen(pscreen);
+ struct pipe_surface *front = ((struct nouveau_winsys *) pscreen->winsys)->front;
+
+ if (tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET) {
+ switch (format) {
+ case PIPE_FORMAT_B8G8R8A8_UNORM:
+ case PIPE_FORMAT_B5G6R5_UNORM:
+ return TRUE;
+ default:
+ break;
+ }
+ } else
+ if (tex_usage & PIPE_TEXTURE_USAGE_DEPTH_STENCIL) {
+ switch (format) {
+ case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
+ case PIPE_FORMAT_X8Z24_UNORM:
+ return TRUE;
+ case PIPE_FORMAT_Z16_UNORM:
+ /* TODO: this nv30 limitation probably does not exist */
+ if (!screen->is_nv4x && front)
+ return (front->format == PIPE_FORMAT_B5G6R5_UNORM);
+ return TRUE;
+ default:
+ break;
+ }
+ } else {
+ switch (format) {
+ case PIPE_FORMAT_B8G8R8A8_UNORM:
+ case PIPE_FORMAT_B5G5R5A1_UNORM:
+ case PIPE_FORMAT_B4G4R4A4_UNORM:
+ case PIPE_FORMAT_B5G6R5_UNORM:
+ case PIPE_FORMAT_L8_UNORM:
+ case PIPE_FORMAT_A8_UNORM:
+ case PIPE_FORMAT_I8_UNORM:
+ case PIPE_FORMAT_L8A8_UNORM:
+ case PIPE_FORMAT_Z16_UNORM:
+ case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
+ case PIPE_FORMAT_DXT1_RGB:
+ case PIPE_FORMAT_DXT1_RGBA:
+ case PIPE_FORMAT_DXT3_RGBA:
+ case PIPE_FORMAT_DXT5_RGBA:
+ return TRUE;
+ /* TODO: does nv30 support this? */
+ case PIPE_FORMAT_R16_SNORM:
+ return !!screen->is_nv4x;
+ default:
+ break;
+ }
+ }
+
+ return FALSE;
+}
+
+static struct pipe_buffer *
+nvfx_surface_buffer(struct pipe_surface *surf)
+{
+ struct nvfx_miptree *mt = (struct nvfx_miptree *)surf->texture;
+
+ return mt->buffer;
+}
+
+static void
+nvfx_screen_destroy(struct pipe_screen *pscreen)
+{
+ struct nvfx_screen *screen = nvfx_screen(pscreen);
+ unsigned i;
+
+ for (i = 0; i < NVFX_STATE_MAX; i++) {
+ if (screen->state[i])
+ so_ref(NULL, &screen->state[i]);
+ }
+
+ nouveau_resource_destroy(&screen->vp_exec_heap);
+ nouveau_resource_destroy(&screen->vp_data_heap);
+ nouveau_resource_destroy(&screen->query_heap);
+ nouveau_notifier_free(&screen->query);
+ nouveau_notifier_free(&screen->sync);
+ nouveau_grobj_free(&screen->eng3d);
+ nv04_surface_2d_takedown(&screen->eng2d);
+
+ nouveau_screen_fini(&screen->base);
+
+ FREE(pscreen);
+}
+
+static void nv30_screen_init(struct nvfx_screen *screen, struct nouveau_stateobj* so)
+{
+ int i;
+
+ /* TODO: perhaps we should do some of this on nv40 too? */
+ for (i=1; i<8; i++) {
+ so_method(so, screen->eng3d, NV34TCL_VIEWPORT_CLIP_HORIZ(i), 1);
+ so_data (so, 0);
+ so_method(so, screen->eng3d, NV34TCL_VIEWPORT_CLIP_VERT(i), 1);
+ so_data (so, 0);
+ }
+
+ so_method(so, screen->eng3d, 0x220, 1);
+ so_data (so, 1);
+
+ so_method(so, screen->eng3d, 0x03b0, 1);
+ so_data (so, 0x00100000);
+ so_method(so, screen->eng3d, 0x1454, 1);
+ so_data (so, 0);
+ so_method(so, screen->eng3d, 0x1d80, 1);
+ so_data (so, 3);
+ so_method(so, screen->eng3d, 0x1450, 1);
+ so_data (so, 0x00030004);
+
+ /* NEW */
+ so_method(so, screen->eng3d, 0x1e98, 1);
+ so_data (so, 0);
+ so_method(so, screen->eng3d, 0x17e0, 3);
+ so_data (so, fui(0.0));
+ so_data (so, fui(0.0));
+ so_data (so, fui(1.0));
+ so_method(so, screen->eng3d, 0x1f80, 16);
+ for (i=0; i<16; i++) {
+ so_data (so, (i==8) ? 0x0000ffff : 0);
+ }
+
+ so_method(so, screen->eng3d, 0x120, 3);
+ so_data (so, 0);
+ so_data (so, 1);
+ so_data (so, 2);
+
+ so_method(so, screen->eng3d, 0x1d88, 1);
+ so_data (so, 0x00001200);
+
+ so_method(so, screen->eng3d, NV34TCL_RC_ENABLE, 1);
+ so_data (so, 0);
+
+ so_method(so, screen->eng3d, NV34TCL_DEPTH_RANGE_NEAR, 2);
+ so_data (so, fui(0.0));
+ so_data (so, fui(1.0));
+
+ so_method(so, screen->eng3d, NV34TCL_MULTISAMPLE_CONTROL, 1);
+ so_data (so, 0xffff0000);
+
+ /* enables use of vp rather than fixed-function somehow */
+ so_method(so, screen->eng3d, 0x1e94, 1);
+ so_data (so, 0x13);
+}
+
+static void nv40_screen_init(struct nvfx_screen *screen, struct nouveau_stateobj* so)
+{
+ so_method(so, screen->eng3d, NV40TCL_DMA_COLOR2, 2);
+ so_data (so, screen->base.channel->vram->handle);
+ so_data (so, screen->base.channel->vram->handle);
+
+ so_method(so, screen->eng3d, 0x1ea4, 3);
+ so_data (so, 0x00000010);
+ so_data (so, 0x01000100);
+ so_data (so, 0xff800006);
+
+ /* vtxprog output routing */
+ so_method(so, screen->eng3d, 0x1fc4, 1);
+ so_data (so, 0x06144321);
+ so_method(so, screen->eng3d, 0x1fc8, 2);
+ so_data (so, 0xedcba987);
+ so_data (so, 0x00000021);
+ so_method(so, screen->eng3d, 0x1fd0, 1);
+ so_data (so, 0x00171615);
+ so_method(so, screen->eng3d, 0x1fd4, 1);
+ so_data (so, 0x001b1a19);
+
+ so_method(so, screen->eng3d, 0x1ef8, 1);
+ so_data (so, 0x0020ffff);
+ so_method(so, screen->eng3d, 0x1d64, 1);
+ so_data (so, 0x00d30000);
+ so_method(so, screen->eng3d, 0x1e94, 1);
+ so_data (so, 0x00000001);
+}
+
+static void
+nvfx_screen_init_buffer_functions(struct nvfx_screen* screen)
+{
+ int vram_hack_default = 0;
+ int vram_hack;
+ // TODO: this is a bit of a guess; also add other cards that may need this hack.
+ // It may also depend on the specific card or the AGP/PCIe chipset.
+ if(screen->base.device->chipset == 0x47 /* G70 */
+ || screen->base.device->chipset == 0x49 /* G71 */
+ || screen->base.device->chipset == 0x46 /* G72 */
+ )
+ vram_hack_default = 1;
+ vram_hack = debug_get_bool_option("NOUVEAU_VTXIDX_IN_VRAM", vram_hack_default);
+
+#ifdef DEBUG
+ if(!vram_hack)
+ {
+ fprintf(stderr, "Some systems may experience graphics corruption due to randomly misplaced vertices.\n"
+ "If this is happening, export NOUVEAU_VTXIDX_IN_VRAM=1 may reduce or eliminate the problem\n");
+ }
+ else
+ {
+ fprintf(stderr, "A performance reducing hack is being used to help avoid graphics corruption.\n"
+ "You can try export NOUVEAU_VTXIDX_IN_VRAM=0 to disable it.\n");
+ }
+#endif
+
+ screen->vertex_buffer_flags = vram_hack ? NOUVEAU_BO_VRAM : NOUVEAU_BO_GART;
+}
+
+struct pipe_screen *
+nvfx_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
+{
+ struct nvfx_screen *screen = CALLOC_STRUCT(nvfx_screen);
+ struct nouveau_channel *chan;
+ struct pipe_screen *pscreen;
+ struct nouveau_stateobj *so;
+ unsigned eng3d_class = 0;
+ int ret;
+
+ if (!screen)
+ return NULL;
+
+ pscreen = &screen->base.base;
+
+ ret = nouveau_screen_init(&screen->base, dev);
+ if (ret) {
+ nvfx_screen_destroy(pscreen);
+ return NULL;
+ }
+ chan = screen->base.channel;
+
+ pscreen->winsys = ws;
+ pscreen->destroy = nvfx_screen_destroy;
+ pscreen->get_param = nvfx_screen_get_param;
+ pscreen->get_paramf = nvfx_screen_get_paramf;
+ pscreen->is_format_supported = nvfx_screen_surface_format_supported;
+ pscreen->context_create = nvfx_create;
+
+ switch (dev->chipset & 0xf0) {
+ case 0x30:
+ if (NV30TCL_CHIPSET_3X_MASK & (1 << (dev->chipset & 0x0f)))
+ eng3d_class = 0x0397;
+ else if (NV34TCL_CHIPSET_3X_MASK & (1 << (dev->chipset & 0x0f)))
+ eng3d_class = 0x0697;
+ else if (NV35TCL_CHIPSET_3X_MASK & (1 << (dev->chipset & 0x0f)))
+ eng3d_class = 0x0497;
+ break;
+ case 0x40:
+ if (NV4X_GRCLASS4097_CHIPSETS & (1 << (dev->chipset & 0x0f)))
+ eng3d_class = NV40TCL;
+ else if (NV4X_GRCLASS4497_CHIPSETS & (1 << (dev->chipset & 0x0f)))
+ eng3d_class = NV44TCL;
+ screen->is_nv4x = ~0;
+ break;
+ case 0x60:
+ if (NV6X_GRCLASS4497_CHIPSETS & (1 << (dev->chipset & 0x0f)))
+ eng3d_class = NV44TCL;
+ screen->is_nv4x = ~0;
+ break;
+ }
+
+ if (!eng3d_class) {
+ NOUVEAU_ERR("Unknown nv3x/nv4x chipset: nv%02x\n", dev->chipset);
+ return NULL;
+ }
+
+ nvfx_screen_init_buffer_functions(screen);
+ nvfx_screen_init_miptree_functions(pscreen);
+
+ ret = nouveau_grobj_alloc(chan, 0xbeef3097, eng3d_class, &screen->eng3d);
+ if (ret) {
+ NOUVEAU_ERR("Error creating 3D object: %d\n", ret);
+ return FALSE;
+ }
+
+ /* 2D engine setup */
+ screen->eng2d = nv04_surface_2d_init(&screen->base);
+ screen->eng2d->buf = nvfx_surface_buffer;
+
+ /* Notifier for sync purposes */
+ ret = nouveau_notifier_alloc(chan, 0xbeef0301, 1, &screen->sync);
+ if (ret) {
+ NOUVEAU_ERR("Error creating notifier object: %d\n", ret);
+ nvfx_screen_destroy(pscreen);
+ return NULL;
+ }
+
+ /* Query objects */
+ ret = nouveau_notifier_alloc(chan, 0xbeef0302, 32, &screen->query);
+ if (ret) {
+ NOUVEAU_ERR("Error initialising query objects: %d\n", ret);
+ nvfx_screen_destroy(pscreen);
+ return NULL;
+ }
+
+ ret = nouveau_resource_init(&screen->query_heap, 0, 32);
+ if (ret) {
+ NOUVEAU_ERR("Error initialising query object heap: %d\n", ret);
+ nvfx_screen_destroy(pscreen);
+ return NULL;
+ }
+
+ /* Vtxprog resources */
+ if (nouveau_resource_init(&screen->vp_exec_heap, 0, screen->is_nv4x ? 512 : 256) ||
+ nouveau_resource_init(&screen->vp_data_heap, 0, 256)) {
+ nvfx_screen_destroy(pscreen);
+ return NULL;
+ }
+
+ /* Static eng3d initialisation */
+ /* make the so big and don't worry about exact values
+ since we it will be thrown away immediately after use */
+ so = so_new(256, 256, 0);
+ so_method(so, screen->eng3d, NV34TCL_DMA_NOTIFY, 1);
+ so_data (so, screen->sync->handle);
+ so_method(so, screen->eng3d, NV34TCL_DMA_TEXTURE0, 2);
+ so_data (so, chan->vram->handle);
+ so_data (so, chan->gart->handle);
+ so_method(so, screen->eng3d, NV34TCL_DMA_COLOR1, 1);
+ so_data (so, chan->vram->handle);
+ so_method(so, screen->eng3d, NV34TCL_DMA_COLOR0, 2);
+ so_data (so, chan->vram->handle);
+ so_data (so, chan->vram->handle);
+ so_method(so, screen->eng3d, NV34TCL_DMA_VTXBUF0, 2);
+ so_data (so, chan->vram->handle);
+ so_data (so, chan->gart->handle);
+
+ so_method(so, screen->eng3d, NV34TCL_DMA_FENCE, 2);
+ so_data (so, 0);
+ so_data (so, screen->query->handle);
+
+ so_method(so, screen->eng3d, NV34TCL_DMA_IN_MEMORY7, 2);
+ so_data (so, chan->vram->handle);
+ so_data (so, chan->vram->handle);
+
+ if(!screen->is_nv4x)
+ nv30_screen_init(screen, so);
+ else
+ nv40_screen_init(screen, so);
+
+ so_emit(chan, so);
+ so_ref(NULL, &so);
+ nouveau_pushbuf_flush(chan, 0);
+
+ return pscreen;
+}
diff --git a/src/gallium/drivers/nv40/nv40_screen.h b/src/gallium/drivers/nvfx/nvfx_screen.h
index 9437aa050d..baa848c47a 100644
--- a/src/gallium/drivers/nv40/nv40_screen.h
+++ b/src/gallium/drivers/nvfx/nvfx_screen.h
@@ -1,19 +1,22 @@
-#ifndef __NV40_SCREEN_H__
-#define __NV40_SCREEN_H__
+#ifndef __NVFX_SCREEN_H__
+#define __NVFX_SCREEN_H__
#include "nouveau/nouveau_screen.h"
-#include "nouveau/nv04_surface_2d.h"
+#include "nv04_surface_2d.h"
-struct nv40_screen {
+struct nvfx_screen {
struct nouveau_screen base;
struct nouveau_winsys *nvws;
- struct nv40_context *cur_ctx;
+ struct nvfx_context *cur_ctx;
+
+ unsigned is_nv4x; /* either 0 or ~0 */
+ int vertex_buffer_flags;
/* HW graphics objects */
struct nv04_surface_2d *eng2d;
- struct nouveau_grobj *curie;
+ struct nouveau_grobj *eng3d;
struct nouveau_notifier *sync;
/* Query object resources */
@@ -25,16 +28,13 @@ struct nv40_screen {
struct nouveau_resource *vp_data_heap;
/* Current 3D state of channel */
- struct nouveau_stateobj *state[NV40_STATE_MAX];
+ struct nouveau_stateobj *state[NVFX_STATE_MAX];
};
-static INLINE struct nv40_screen *
-nv40_screen(struct pipe_screen *screen)
+static INLINE struct nvfx_screen *
+nvfx_screen(struct pipe_screen *screen)
{
- return (struct nv40_screen *)screen;
+ return (struct nvfx_screen *)screen;
}
-void
-nv40_screen_init_transfer_functions(struct pipe_screen *pscreen);
-
#endif
diff --git a/src/gallium/drivers/nvfx/nvfx_shader.h b/src/gallium/drivers/nvfx/nvfx_shader.h
new file mode 100644
index 0000000000..0b2f044f7f
--- /dev/null
+++ b/src/gallium/drivers/nvfx/nvfx_shader.h
@@ -0,0 +1,429 @@
+#ifndef __NVFX_SHADER_H__
+#define __NVFX_SHADER_H__
+
+/* this will resolve to either the NV30 or the NV40 version
+ * depending on the current hardware */
+/* unusual, but very fast and compact method */
+#define NVFX_VP(c) ((NV30_VP_##c) + (nvfx->is_nv4x & ((NV40_VP_##c) - (NV30_VP_##c))))
+
+#define NVFX_VP_INST_SLOT_VEC 0
+#define NVFX_VP_INST_SLOT_SCA 1
+
+#define NVFX_VP_INST_IN_POS 0 /* These seem to match the bindings specified in */
+#define NVFX_VP_INST_IN_WEIGHT 1 /* the ARB_v_p spec (2.14.3.1) */
+#define NVFX_VP_INST_IN_NORMAL 2
+#define NVFX_VP_INST_IN_COL0 3 /* Should probably confirm them all though */
+#define NVFX_VP_INST_IN_COL1 4
+#define NVFX_VP_INST_IN_FOGC 5
+#define NVFX_VP_INST_IN_TC0 8
+#define NVFX_VP_INST_IN_TC(n) (8+n)
+
+#define NVFX_VP_INST_SCA_OP_NOP 0x00
+#define NVFX_VP_INST_SCA_OP_MOV 0x01
+#define NVFX_VP_INST_SCA_OP_RCP 0x02
+#define NVFX_VP_INST_SCA_OP_RCC 0x03
+#define NVFX_VP_INST_SCA_OP_RSQ 0x04
+#define NVFX_VP_INST_SCA_OP_EXP 0x05
+#define NVFX_VP_INST_SCA_OP_LOG 0x06
+#define NVFX_VP_INST_SCA_OP_LIT 0x07
+#define NVFX_VP_INST_SCA_OP_BRA 0x09
+#define NVFX_VP_INST_SCA_OP_CAL 0x0B
+#define NVFX_VP_INST_SCA_OP_RET 0x0C
+#define NVFX_VP_INST_SCA_OP_LG2 0x0D
+#define NVFX_VP_INST_SCA_OP_EX2 0x0E
+#define NVFX_VP_INST_SCA_OP_SIN 0x0F
+#define NVFX_VP_INST_SCA_OP_COS 0x10
+
+#define NV40_VP_INST_SCA_OP_PUSHA 0x13
+#define NV40_VP_INST_SCA_OP_POPA 0x14
+
+#define NVFX_VP_INST_VEC_OP_NOP 0x00
+#define NVFX_VP_INST_VEC_OP_MOV 0x01
+#define NVFX_VP_INST_VEC_OP_MUL 0x02
+#define NVFX_VP_INST_VEC_OP_ADD 0x03
+#define NVFX_VP_INST_VEC_OP_MAD 0x04
+#define NVFX_VP_INST_VEC_OP_DP3 0x05
+#define NVFX_VP_INST_VEC_OP_DPH 0x06
+#define NVFX_VP_INST_VEC_OP_DP4 0x07
+#define NVFX_VP_INST_VEC_OP_DST 0x08
+#define NVFX_VP_INST_VEC_OP_MIN 0x09
+#define NVFX_VP_INST_VEC_OP_MAX 0x0A
+#define NVFX_VP_INST_VEC_OP_SLT 0x0B
+#define NVFX_VP_INST_VEC_OP_SGE 0x0C
+#define NVFX_VP_INST_VEC_OP_ARL 0x0D
+#define NVFX_VP_INST_VEC_OP_FRC 0x0E
+#define NVFX_VP_INST_VEC_OP_FLR 0x0F
+#define NVFX_VP_INST_VEC_OP_SEQ 0x10
+#define NVFX_VP_INST_VEC_OP_SFL 0x11
+#define NVFX_VP_INST_VEC_OP_SGT 0x12
+#define NVFX_VP_INST_VEC_OP_SLE 0x13
+#define NVFX_VP_INST_VEC_OP_SNE 0x14
+#define NVFX_VP_INST_VEC_OP_STR 0x15
+#define NVFX_VP_INST_VEC_OP_SSG 0x16
+#define NVFX_VP_INST_VEC_OP_ARR 0x17
+#define NVFX_VP_INST_VEC_OP_ARA 0x18
+
+#define NV40_VP_INST_VEC_OP_TXL 0x19
+
+/* DWORD 3 */
+#define NVFX_VP_INST_LAST (1 << 0)
+
+/*
+ * Each fragment program opcode appears to be comprised of 4 32-bit values.
+ *
+ * 0 - Opcode, output reg/mask, ATTRIB source
+ * 1 - Source 0
+ * 2 - Source 1
+ * 3 - Source 2
+ *
+ * There appears to be no special difference between result regs and temp regs.
+ * result.color == R0.xyzw
+ * result.depth == R1.z
+ * When the fragprog contains instructions to write depth, NV30_TCL_PRIMITIVE_3D_UNK1D78=0
+ * otherwise it is set to 1.
+ *
+ * Constants are inserted directly after the instruction that uses them.
+ *
+ * It appears that it's not possible to use two input registers in one
+ * instruction as the input sourcing is done in the instruction dword
+ * and not the source selection dwords. As such instructions such as:
+ *
+ * ADD result.color, fragment.color, fragment.texcoord[0];
+ *
+ * must be split into two MOV's and then an ADD (nvidia does this) but
+ * I'm not sure why it's not just one MOV and then source the second input
+ * in the ADD instruction..
+ *
+ * Negation of the full source is done with NV30_FP_REG_NEGATE, arbitrary
+ * negation requires multiplication with a const.
+ *
+ * Arbitrary swizzling is supported with the exception of SWIZZLE_ZERO/SWIZZLE_ONE
+ * The temp/result regs appear to be initialised to (0.0, 0.0, 0.0, 0.0) as SWIZZLE_ZERO
+ * is implemented simply by not writing to the relevant components of the destination.
+ *
+ * Conditional execution
+ * TODO
+ *
+ * Non-native instructions:
+ * LIT
+ * LRP - MAD+MAD
+ * SUB - ADD, negate second source
+ * RSQ - LG2 + EX2
+ * POW - LG2 + MUL + EX2
+ * SCS - COS + SIN
+ * XPD
+ *
+ * NV40 Looping
+ * Loops appear to be fairly expensive on NV40 at least, the proprietary
+ * driver goes to a lot of effort to avoid using the native looping
+ * instructions. If the total number of *executed* instructions between
+ * REP/ENDREP or LOOP/ENDLOOP is <=500, the driver will unroll the loop.
+ * The maximum loop count is 255.
+ *
+ */
+
+//== Opcode / Destination selection ==
+#define NVFX_FP_OP_PROGRAM_END (1 << 0)
+#define NVFX_FP_OP_OUT_REG_SHIFT 1
+#define NV30_FP_OP_OUT_REG_MASK (31 << 1) /* uncertain */
+#define NV40_FP_OP_OUT_REG_MASK (63 << 1)
+/* Needs to be set when writing outputs to get expected result.. */
+#define NVFX_FP_OP_OUT_REG_HALF (1 << 7)
+#define NVFX_FP_OP_COND_WRITE_ENABLE (1 << 8)
+#define NVFX_FP_OP_OUTMASK_SHIFT 9
+#define NVFX_FP_OP_OUTMASK_MASK (0xF << 9)
+# define NVFX_FP_OP_OUT_X (1<<9)
+# define NVFX_FP_OP_OUT_Y (1<<10)
+# define NVFX_FP_OP_OUT_Z (1<<11)
+# define NVFX_FP_OP_OUT_W (1<<12)
+/* Uncertain about these, especially the input_src values.. it's possible that
+ * they can be dynamically changed.
+ */
+#define NVFX_FP_OP_INPUT_SRC_SHIFT 13
+#define NVFX_FP_OP_INPUT_SRC_MASK (15 << 13)
+# define NVFX_FP_OP_INPUT_SRC_POSITION 0x0
+# define NVFX_FP_OP_INPUT_SRC_COL0 0x1
+# define NVFX_FP_OP_INPUT_SRC_COL1 0x2
+# define NVFX_FP_OP_INPUT_SRC_FOGC 0x3
+# define NVFX_FP_OP_INPUT_SRC_TC0 0x4
+# define NVFX_FP_OP_INPUT_SRC_TC(n) (0x4 + n)
+# define NV40_FP_OP_INPUT_SRC_FACING 0xE
+#define NVFX_FP_OP_TEX_UNIT_SHIFT 17
+#define NVFX_FP_OP_TEX_UNIT_MASK (0xF << 17) /* guess */
+#define NVFX_FP_OP_PRECISION_SHIFT 22
+#define NVFX_FP_OP_PRECISION_MASK (3 << 22)
+# define NVFX_FP_PRECISION_FP32 0
+# define NVFX_FP_PRECISION_FP16 1
+# define NVFX_FP_PRECISION_FX12 2
+#define NVFX_FP_OP_OPCODE_SHIFT 24
+#define NVFX_FP_OP_OPCODE_MASK (0x3F << 24)
+/* NV30/NV40 fragment program opcodes */
+#define NVFX_FP_OP_OPCODE_NOP 0x00
+#define NVFX_FP_OP_OPCODE_MOV 0x01
+#define NVFX_FP_OP_OPCODE_MUL 0x02
+#define NVFX_FP_OP_OPCODE_ADD 0x03
+#define NVFX_FP_OP_OPCODE_MAD 0x04
+#define NVFX_FP_OP_OPCODE_DP3 0x05
+#define NVFX_FP_OP_OPCODE_DP4 0x06
+#define NVFX_FP_OP_OPCODE_DST 0x07
+#define NVFX_FP_OP_OPCODE_MIN 0x08
+#define NVFX_FP_OP_OPCODE_MAX 0x09
+#define NVFX_FP_OP_OPCODE_SLT 0x0A
+#define NVFX_FP_OP_OPCODE_SGE 0x0B
+#define NVFX_FP_OP_OPCODE_SLE 0x0C
+#define NVFX_FP_OP_OPCODE_SGT 0x0D
+#define NVFX_FP_OP_OPCODE_SNE 0x0E
+#define NVFX_FP_OP_OPCODE_SEQ 0x0F
+#define NVFX_FP_OP_OPCODE_FRC 0x10
+#define NVFX_FP_OP_OPCODE_FLR 0x11
+#define NVFX_FP_OP_OPCODE_KIL 0x12
+#define NVFX_FP_OP_OPCODE_PK4B 0x13
+#define NVFX_FP_OP_OPCODE_UP4B 0x14
+#define NVFX_FP_OP_OPCODE_DDX 0x15 /* can only write XY */
+#define NVFX_FP_OP_OPCODE_DDY 0x16 /* can only write XY */
+#define NVFX_FP_OP_OPCODE_TEX 0x17
+#define NVFX_FP_OP_OPCODE_TXP 0x18
+#define NVFX_FP_OP_OPCODE_TXD 0x19
+#define NVFX_FP_OP_OPCODE_RCP 0x1A
+#define NVFX_FP_OP_OPCODE_EX2 0x1C
+#define NVFX_FP_OP_OPCODE_LG2 0x1D
+#define NVFX_FP_OP_OPCODE_STR 0x20
+#define NVFX_FP_OP_OPCODE_SFL 0x21
+#define NVFX_FP_OP_OPCODE_COS 0x22
+#define NVFX_FP_OP_OPCODE_SIN 0x23
+#define NVFX_FP_OP_OPCODE_PK2H 0x24
+#define NVFX_FP_OP_OPCODE_UP2H 0x25
+#define NVFX_FP_OP_OPCODE_PK4UB 0x27
+#define NVFX_FP_OP_OPCODE_UP4UB 0x28
+#define NVFX_FP_OP_OPCODE_PK2US 0x29
+#define NVFX_FP_OP_OPCODE_UP2US 0x2A
+#define NVFX_FP_OP_OPCODE_DP2A 0x2E
+#define NVFX_FP_OP_OPCODE_TXB 0x31
+#define NVFX_FP_OP_OPCODE_DIV 0x3A
+
+/* NV30 only fragment program opcodes */
+#define NVFX_FP_OP_OPCODE_RSQ_NV30 0x1B
+#define NVFX_FP_OP_OPCODE_LIT_NV30 0x1E
+#define NVFX_FP_OP_OPCODE_LRP_NV30 0x1F
+#define NVFX_FP_OP_OPCODE_POW_NV30 0x26
+#define NVFX_FP_OP_OPCODE_RFL_NV30 0x36
+
+/* NV40 only fragment program opcodes */
+#define NVFX_FP_OP_OPCODE_TXL_NV40 0x31
+/* The use of these instructions appears to be indicated by bit 31 of DWORD 2.*/
+#define NV40_FP_OP_BRA_OPCODE_BRK 0x0
+#define NV40_FP_OP_BRA_OPCODE_CAL 0x1
+#define NV40_FP_OP_BRA_OPCODE_IF 0x2
+#define NV40_FP_OP_BRA_OPCODE_LOOP 0x3
+#define NV40_FP_OP_BRA_OPCODE_REP 0x4
+#define NV40_FP_OP_BRA_OPCODE_RET 0x5
+
+#define NVFX_FP_OP_OUT_SAT (1 << 31)
+
+/* high order bits of SRC0 */
+#define NVFX_FP_OP_OUT_ABS (1 << 29)
+#define NVFX_FP_OP_COND_SWZ_W_SHIFT 27
+#define NVFX_FP_OP_COND_SWZ_W_MASK (3 << 27)
+#define NVFX_FP_OP_COND_SWZ_Z_SHIFT 25
+#define NVFX_FP_OP_COND_SWZ_Z_MASK (3 << 25)
+#define NVFX_FP_OP_COND_SWZ_Y_SHIFT 23
+#define NVFX_FP_OP_COND_SWZ_Y_MASK (3 << 23)
+#define NVFX_FP_OP_COND_SWZ_X_SHIFT 21
+#define NVFX_FP_OP_COND_SWZ_X_MASK (3 << 21)
+#define NVFX_FP_OP_COND_SWZ_ALL_SHIFT 21
+#define NVFX_FP_OP_COND_SWZ_ALL_MASK (0xFF << 21)
+#define NVFX_FP_OP_COND_SHIFT 18
+#define NVFX_FP_OP_COND_MASK (0x07 << 18)
+# define NVFX_FP_OP_COND_FL 0
+# define NVFX_FP_OP_COND_LT 1
+# define NVFX_FP_OP_COND_EQ 2
+# define NVFX_FP_OP_COND_LE 3
+# define NVFX_FP_OP_COND_GT 4
+# define NVFX_FP_OP_COND_NE 5
+# define NVFX_FP_OP_COND_GE 6
+# define NVFX_FP_OP_COND_TR 7
+
+/* high order bits of SRC1 */
+#define NV40_FP_OP_OPCODE_IS_BRANCH (1<<31)
+#define NVFX_FP_OP_DST_SCALE_SHIFT 28
+#define NVFX_FP_OP_DST_SCALE_MASK (3 << 28)
+#define NVFX_FP_OP_DST_SCALE_1X 0
+#define NVFX_FP_OP_DST_SCALE_2X 1
+#define NVFX_FP_OP_DST_SCALE_4X 2
+#define NVFX_FP_OP_DST_SCALE_8X 3
+#define NVFX_FP_OP_DST_SCALE_INV_2X 5
+#define NVFX_FP_OP_DST_SCALE_INV_4X 6
+#define NVFX_FP_OP_DST_SCALE_INV_8X 7
+
+/* SRC1 LOOP */
+#define NV40_FP_OP_LOOP_INCR_SHIFT 19
+#define NV40_FP_OP_LOOP_INCR_MASK (0xFF << 19)
+#define NV40_FP_OP_LOOP_INDEX_SHIFT 10
+#define NV40_FP_OP_LOOP_INDEX_MASK (0xFF << 10)
+#define NV40_FP_OP_LOOP_COUNT_SHIFT 2
+#define NV40_FP_OP_LOOP_COUNT_MASK (0xFF << 2)
+
+/* SRC1 IF */
+#define NV40_FP_OP_ELSE_ID_SHIFT 2
+#define NV40_FP_OP_ELSE_ID_MASK (0xFF << 2)
+
+/* SRC1 CAL */
+#define NV40_FP_OP_IADDR_SHIFT 2
+#define NV40_FP_OP_IADDR_MASK (0xFF << 2)
+
+/* SRC1 REP
+ * I have no idea why there are 3 count values here.. but they
+ * have always been filled with the same value in my tests so
+ * far..
+ */
+#define NV40_FP_OP_REP_COUNT1_SHIFT 2
+#define NV40_FP_OP_REP_COUNT1_MASK (0xFF << 2)
+#define NV40_FP_OP_REP_COUNT2_SHIFT 10
+#define NV40_FP_OP_REP_COUNT2_MASK (0xFF << 10)
+#define NV40_FP_OP_REP_COUNT3_SHIFT 19
+#define NV40_FP_OP_REP_COUNT3_MASK (0xFF << 19)
+
+/* SRC2 REP/IF */
+#define NV40_FP_OP_END_ID_SHIFT 2
+#define NV40_FP_OP_END_ID_MASK (0xFF << 2)
+
+/* high order bits of SRC2 */
+#define NVFX_FP_OP_INDEX_INPUT (1 << 30)
+#define NV40_FP_OP_ADDR_INDEX_SHIFT 19
+#define NV40_FP_OP_ADDR_INDEX_MASK (0xF << 19)
+
+//== Register selection ==
+#define NVFX_FP_REG_TYPE_SHIFT 0
+#define NVFX_FP_REG_TYPE_MASK (3 << 0)
+# define NVFX_FP_REG_TYPE_TEMP 0
+# define NVFX_FP_REG_TYPE_INPUT 1
+# define NVFX_FP_REG_TYPE_CONST 2
+#define NVFX_FP_REG_SRC_SHIFT 2
+#define NV30_FP_REG_SRC_MASK (31 << 2)
+#define NV40_FP_REG_SRC_MASK (63 << 2)
+#define NVFX_FP_REG_SRC_HALF (1 << 8)
+#define NVFX_FP_REG_SWZ_ALL_SHIFT 9
+#define NVFX_FP_REG_SWZ_ALL_MASK (255 << 9)
+#define NVFX_FP_REG_SWZ_X_SHIFT 9
+#define NVFX_FP_REG_SWZ_X_MASK (3 << 9)
+#define NVFX_FP_REG_SWZ_Y_SHIFT 11
+#define NVFX_FP_REG_SWZ_Y_MASK (3 << 11)
+#define NVFX_FP_REG_SWZ_Z_SHIFT 13
+#define NVFX_FP_REG_SWZ_Z_MASK (3 << 13)
+#define NVFX_FP_REG_SWZ_W_SHIFT 15
+#define NVFX_FP_REG_SWZ_W_MASK (3 << 15)
+# define NVFX_FP_SWIZZLE_X 0
+# define NVFX_FP_SWIZZLE_Y 1
+# define NVFX_FP_SWIZZLE_Z 2
+# define NVFX_FP_SWIZZLE_W 3
+#define NVFX_FP_REG_NEGATE (1 << 17)
+
+#define NVFXSR_NONE 0
+#define NVFXSR_OUTPUT 1
+#define NVFXSR_INPUT 2
+#define NVFXSR_TEMP 3
+#define NVFXSR_CONST 4
+
+#define NVFX_COND_FL 0
+#define NVFX_COND_LT 1
+#define NVFX_COND_EQ 2
+#define NVFX_COND_LE 3
+#define NVFX_COND_GT 4
+#define NVFX_COND_NE 5
+#define NVFX_COND_GE 6
+#define NVFX_COND_TR 7
+
+/* Yes, this are ordered differently... */
+
+#define NVFX_VP_MASK_X 8
+#define NVFX_VP_MASK_Y 4
+#define NVFX_VP_MASK_Z 2
+#define NVFX_VP_MASK_W 1
+#define NVFX_VP_MASK_ALL 0xf
+
+#define NVFX_FP_MASK_X 1
+#define NVFX_FP_MASK_Y 2
+#define NVFX_FP_MASK_Z 4
+#define NVFX_FP_MASK_W 8
+#define NVFX_FP_MASK_ALL 0xf
+
+#define NVFX_SWZ_X 0
+#define NVFX_SWZ_Y 1
+#define NVFX_SWZ_Z 2
+#define NVFX_SWZ_W 3
+
+#define swz(s,x,y,z,w) nvfx_sr_swz((s), NVFX_SWZ_##x, NVFX_SWZ_##y, NVFX_SWZ_##z, NVFX_SWZ_##w)
+#define neg(s) nvfx_sr_neg((s))
+#define abs(s) nvfx_sr_abs((s))
+#define scale(s,v) nvfx_sr_scale((s), NVFX_FP_OP_DST_SCALE_##v)
+
+struct nvfx_sreg {
+ int type;
+ int index;
+
+ int dst_scale;
+
+ int negate;
+ int abs;
+ int swz[4];
+
+ int cc_update;
+ int cc_update_reg;
+ int cc_test;
+ int cc_test_reg;
+ int cc_swz[4];
+};
+
+static INLINE struct nvfx_sreg
+nvfx_sr(int type, int index)
+{
+ struct nvfx_sreg temp = {
+ .type = type,
+ .index = index,
+ .dst_scale = 0,
+ .abs = 0,
+ .negate = 0,
+ .swz = { 0, 1, 2, 3 },
+ .cc_update = 0,
+ .cc_update_reg = 0,
+ .cc_test = NVFX_COND_TR,
+ .cc_test_reg = 0,
+ .cc_swz = { 0, 1, 2, 3 },
+ };
+ return temp;
+}
+
+static INLINE struct nvfx_sreg
+nvfx_sr_swz(struct nvfx_sreg src, int x, int y, int z, int w)
+{
+ struct nvfx_sreg dst = src;
+
+ dst.swz[NVFX_SWZ_X] = src.swz[x];
+ dst.swz[NVFX_SWZ_Y] = src.swz[y];
+ dst.swz[NVFX_SWZ_Z] = src.swz[z];
+ dst.swz[NVFX_SWZ_W] = src.swz[w];
+ return dst;
+}
+
+static INLINE struct nvfx_sreg
+nvfx_sr_neg(struct nvfx_sreg src)
+{
+ src.negate = !src.negate;
+ return src;
+}
+
+static INLINE struct nvfx_sreg
+nvfx_sr_abs(struct nvfx_sreg src)
+{
+ src.abs = 1;
+ return src;
+}
+
+static INLINE struct nvfx_sreg
+nvfx_sr_scale(struct nvfx_sreg src, int scale)
+{
+ src.dst_scale = scale;
+ return src;
+}
+
+#endif
diff --git a/src/gallium/drivers/nvfx/nvfx_state.c b/src/gallium/drivers/nvfx/nvfx_state.c
new file mode 100644
index 0000000000..ecaa0dcb16
--- /dev/null
+++ b/src/gallium/drivers/nvfx/nvfx_state.c
@@ -0,0 +1,650 @@
+#include "pipe/p_state.h"
+#include "pipe/p_defines.h"
+#include "util/u_inlines.h"
+
+#include "draw/draw_context.h"
+
+#include "tgsi/tgsi_parse.h"
+
+#include "nvfx_context.h"
+#include "nvfx_state.h"
+#include "nvfx_tex.h"
+
+static void *
+nvfx_blend_state_create(struct pipe_context *pipe,
+ const struct pipe_blend_state *cso)
+{
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+ struct nouveau_grobj *eng3d = nvfx->screen->eng3d;
+ struct nvfx_blend_state *bso = CALLOC(1, sizeof(*bso));
+ struct nouveau_stateobj *so = so_new(5, 8, 0);
+
+ if (cso->rt[0].blend_enable) {
+ so_method(so, eng3d, NV34TCL_BLEND_FUNC_ENABLE, 3);
+ so_data (so, 1);
+ so_data (so, (nvgl_blend_func(cso->rt[0].alpha_src_factor) << 16) |
+ nvgl_blend_func(cso->rt[0].rgb_src_factor));
+ so_data (so, nvgl_blend_func(cso->rt[0].alpha_dst_factor) << 16 |
+ nvgl_blend_func(cso->rt[0].rgb_dst_factor));
+ if(nvfx->screen->base.device->chipset < 0x40) {
+ so_method(so, eng3d, NV34TCL_BLEND_EQUATION, 1);
+ so_data (so, nvgl_blend_eqn(cso->rt[0].rgb_func));
+ } else {
+ so_method(so, eng3d, NV40TCL_BLEND_EQUATION, 1);
+ so_data (so, nvgl_blend_eqn(cso->rt[0].alpha_func) << 16 |
+ nvgl_blend_eqn(cso->rt[0].rgb_func));
+ }
+ } else {
+ so_method(so, eng3d, NV34TCL_BLEND_FUNC_ENABLE, 1);
+ so_data (so, 0);
+ }
+
+ so_method(so, eng3d, NV34TCL_COLOR_MASK, 1);
+ so_data (so, (((cso->rt[0].colormask & PIPE_MASK_A) ? (0x01 << 24) : 0) |
+ ((cso->rt[0].colormask & PIPE_MASK_R) ? (0x01 << 16) : 0) |
+ ((cso->rt[0].colormask & PIPE_MASK_G) ? (0x01 << 8) : 0) |
+ ((cso->rt[0].colormask & PIPE_MASK_B) ? (0x01 << 0) : 0)));
+
+ /* TODO: add NV40 MRT color mask */
+
+ if (cso->logicop_enable) {
+ so_method(so, eng3d, NV34TCL_COLOR_LOGIC_OP_ENABLE, 2);
+ so_data (so, 1);
+ so_data (so, nvgl_logicop_func(cso->logicop_func));
+ } else {
+ so_method(so, eng3d, NV34TCL_COLOR_LOGIC_OP_ENABLE, 1);
+ so_data (so, 0);
+ }
+
+ so_method(so, eng3d, NV34TCL_DITHER_ENABLE, 1);
+ so_data (so, cso->dither ? 1 : 0);
+
+ so_ref(so, &bso->so);
+ so_ref(NULL, &so);
+ bso->pipe = *cso;
+ return (void *)bso;
+}
+
+static void
+nvfx_blend_state_bind(struct pipe_context *pipe, void *hwcso)
+{
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+
+ nvfx->blend = hwcso;
+ nvfx->dirty |= NVFX_NEW_BLEND;
+}
+
+static void
+nvfx_blend_state_delete(struct pipe_context *pipe, void *hwcso)
+{
+ struct nvfx_blend_state *bso = hwcso;
+
+ so_ref(NULL, &bso->so);
+ FREE(bso);
+}
+
+static void *
+nvfx_sampler_state_create(struct pipe_context *pipe,
+ const struct pipe_sampler_state *cso)
+{
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+ struct nvfx_sampler_state *ps;
+
+ ps = MALLOC(sizeof(struct nvfx_sampler_state));
+
+ /* on nv30, we use this as an internal flag */
+ ps->fmt = cso->normalized_coords ? 0 : NV40TCL_TEX_FORMAT_RECT;
+ ps->en = 0;
+ ps->filt = nvfx_tex_filter(cso);
+ ps->wrap = (nvfx_tex_wrap_mode(cso->wrap_s) << NV34TCL_TX_WRAP_S_SHIFT) |
+ (nvfx_tex_wrap_mode(cso->wrap_t) << NV34TCL_TX_WRAP_T_SHIFT) |
+ (nvfx_tex_wrap_mode(cso->wrap_r) << NV34TCL_TX_WRAP_R_SHIFT) |
+ nvfx_tex_wrap_compare_mode(cso);
+ ps->bcol = nvfx_tex_border_color(cso->border_color);
+
+ if(nvfx->is_nv4x)
+ nv40_sampler_state_init(pipe, ps, cso);
+ else
+ nv30_sampler_state_init(pipe, ps, cso);
+
+ return (void *)ps;
+}
+
+static void
+nvfx_sampler_state_bind(struct pipe_context *pipe, unsigned nr, void **sampler)
+{
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+ unsigned unit;
+
+ for (unit = 0; unit < nr; unit++) {
+ nvfx->tex_sampler[unit] = sampler[unit];
+ nvfx->dirty_samplers |= (1 << unit);
+ }
+
+ for (unit = nr; unit < nvfx->nr_samplers; unit++) {
+ nvfx->tex_sampler[unit] = NULL;
+ nvfx->dirty_samplers |= (1 << unit);
+ }
+
+ nvfx->nr_samplers = nr;
+ nvfx->dirty |= NVFX_NEW_SAMPLER;
+}
+
+static void
+nvfx_sampler_state_delete(struct pipe_context *pipe, void *hwcso)
+{
+ FREE(hwcso);
+}
+
+static void
+nvfx_set_fragment_sampler_views(struct pipe_context *pipe,
+ unsigned nr,
+ struct pipe_sampler_view **views)
+{
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+ unsigned unit;
+
+ for (unit = 0; unit < nr; unit++) {
+ pipe_sampler_view_reference(&nvfx->fragment_sampler_views[unit],
+ views[unit]);
+ nvfx->dirty_samplers |= (1 << unit);
+ }
+
+ for (unit = nr; unit < nvfx->nr_textures; unit++) {
+ pipe_sampler_view_reference(&nvfx->fragment_sampler_views[unit],
+ NULL);
+ nvfx->dirty_samplers |= (1 << unit);
+ }
+
+ nvfx->nr_textures = nr;
+ nvfx->dirty |= NVFX_NEW_SAMPLER;
+}
+
+
+static struct pipe_sampler_view *
+nvfx_create_sampler_view(struct pipe_context *pipe,
+ struct pipe_texture *texture,
+ const struct pipe_sampler_view *templ)
+{
+ struct pipe_sampler_view *view = CALLOC_STRUCT(pipe_sampler_view);
+
+ if (view) {
+ *view = *templ;
+ view->reference.count = 1;
+ view->texture = NULL;
+ pipe_texture_reference(&view->texture, texture);
+ view->context = pipe;
+ }
+
+ return view;
+}
+
+
+static void
+nvfx_sampler_view_destroy(struct pipe_context *pipe,
+ struct pipe_sampler_view *view)
+{
+ pipe_texture_reference(&view->texture, NULL);
+ FREE(view);
+}
+
+static void *
+nvfx_rasterizer_state_create(struct pipe_context *pipe,
+ const struct pipe_rasterizer_state *cso)
+{
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+ struct nvfx_rasterizer_state *rsso = CALLOC(1, sizeof(*rsso));
+ struct nouveau_stateobj *so = so_new(9, 19, 0);
+ struct nouveau_grobj *eng3d = nvfx->screen->eng3d;
+
+ /*XXX: ignored:
+ * light_twoside
+ * point_smooth -nohw
+ * multisample
+ */
+
+ so_method(so, eng3d, NV34TCL_SHADE_MODEL, 1);
+ so_data (so, cso->flatshade ? NV34TCL_SHADE_MODEL_FLAT :
+ NV34TCL_SHADE_MODEL_SMOOTH);
+
+ so_method(so, eng3d, NV34TCL_LINE_WIDTH, 2);
+ so_data (so, (unsigned char)(cso->line_width * 8.0) & 0xff);
+ so_data (so, cso->line_smooth ? 1 : 0);
+ so_method(so, eng3d, NV34TCL_LINE_STIPPLE_ENABLE, 2);
+ so_data (so, cso->line_stipple_enable ? 1 : 0);
+ so_data (so, (cso->line_stipple_pattern << 16) |
+ cso->line_stipple_factor);
+
+ so_method(so, eng3d, NV34TCL_POINT_SIZE, 1);
+ so_data (so, fui(cso->point_size));
+
+ so_method(so, eng3d, NV34TCL_POLYGON_MODE_FRONT, 6);
+ if (cso->front_winding == PIPE_WINDING_CCW) {
+ so_data(so, nvgl_polygon_mode(cso->fill_ccw));
+ so_data(so, nvgl_polygon_mode(cso->fill_cw));
+ switch (cso->cull_mode) {
+ case PIPE_WINDING_CCW:
+ so_data(so, NV34TCL_CULL_FACE_FRONT);
+ break;
+ case PIPE_WINDING_CW:
+ so_data(so, NV34TCL_CULL_FACE_BACK);
+ break;
+ case PIPE_WINDING_BOTH:
+ so_data(so, NV34TCL_CULL_FACE_FRONT_AND_BACK);
+ break;
+ default:
+ so_data(so, NV34TCL_CULL_FACE_BACK);
+ break;
+ }
+ so_data(so, NV34TCL_FRONT_FACE_CCW);
+ } else {
+ so_data(so, nvgl_polygon_mode(cso->fill_cw));
+ so_data(so, nvgl_polygon_mode(cso->fill_ccw));
+ switch (cso->cull_mode) {
+ case PIPE_WINDING_CCW:
+ so_data(so, NV34TCL_CULL_FACE_BACK);
+ break;
+ case PIPE_WINDING_CW:
+ so_data(so, NV34TCL_CULL_FACE_FRONT);
+ break;
+ case PIPE_WINDING_BOTH:
+ so_data(so, NV34TCL_CULL_FACE_FRONT_AND_BACK);
+ break;
+ default:
+ so_data(so, NV34TCL_CULL_FACE_BACK);
+ break;
+ }
+ so_data(so, NV34TCL_FRONT_FACE_CW);
+ }
+ so_data(so, cso->poly_smooth ? 1 : 0);
+ so_data(so, (cso->cull_mode != PIPE_WINDING_NONE) ? 1 : 0);
+
+ so_method(so, eng3d, NV34TCL_POLYGON_STIPPLE_ENABLE, 1);
+ so_data (so, cso->poly_stipple_enable ? 1 : 0);
+
+ so_method(so, eng3d, NV34TCL_POLYGON_OFFSET_POINT_ENABLE, 3);
+ if ((cso->offset_cw && cso->fill_cw == PIPE_POLYGON_MODE_POINT) ||
+ (cso->offset_ccw && cso->fill_ccw == PIPE_POLYGON_MODE_POINT))
+ so_data(so, 1);
+ else
+ so_data(so, 0);
+ if ((cso->offset_cw && cso->fill_cw == PIPE_POLYGON_MODE_LINE) ||
+ (cso->offset_ccw && cso->fill_ccw == PIPE_POLYGON_MODE_LINE))
+ so_data(so, 1);
+ else
+ so_data(so, 0);
+ if ((cso->offset_cw && cso->fill_cw == PIPE_POLYGON_MODE_FILL) ||
+ (cso->offset_ccw && cso->fill_ccw == PIPE_POLYGON_MODE_FILL))
+ so_data(so, 1);
+ else
+ so_data(so, 0);
+ if (cso->offset_cw || cso->offset_ccw) {
+ so_method(so, eng3d, NV34TCL_POLYGON_OFFSET_FACTOR, 2);
+ so_data (so, fui(cso->offset_scale));
+ so_data (so, fui(cso->offset_units * 2));
+ }
+
+ so_method(so, eng3d, NV34TCL_POINT_SPRITE, 1);
+ if (cso->point_quad_rasterization) {
+ unsigned psctl = (1 << 0), i;
+
+ for (i = 0; i < 8; i++) {
+ if ((cso->sprite_coord_enable >> i) & 1)
+ psctl |= (1 << (8 + i));
+ }
+
+ so_data(so, psctl);
+ } else {
+ so_data(so, 0);
+ }
+
+ so_ref(so, &rsso->so);
+ so_ref(NULL, &so);
+ rsso->pipe = *cso;
+ return (void *)rsso;
+}
+
+static void
+nvfx_rasterizer_state_bind(struct pipe_context *pipe, void *hwcso)
+{
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+
+ nvfx->rasterizer = hwcso;
+ nvfx->dirty |= NVFX_NEW_RAST;
+ nvfx->draw_dirty |= NVFX_NEW_RAST;
+}
+
+static void
+nvfx_rasterizer_state_delete(struct pipe_context *pipe, void *hwcso)
+{
+ struct nvfx_rasterizer_state *rsso = hwcso;
+
+ so_ref(NULL, &rsso->so);
+ FREE(rsso);
+}
+
+static void *
+nvfx_depth_stencil_alpha_state_create(struct pipe_context *pipe,
+ const struct pipe_depth_stencil_alpha_state *cso)
+{
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+ struct nvfx_zsa_state *zsaso = CALLOC(1, sizeof(*zsaso));
+ struct nouveau_stateobj *so = so_new(6, 20, 0);
+ struct nouveau_grobj *eng3d = nvfx->screen->eng3d;
+
+ so_method(so, eng3d, NV34TCL_DEPTH_FUNC, 3);
+ so_data (so, nvgl_comparison_op(cso->depth.func));
+ so_data (so, cso->depth.writemask ? 1 : 0);
+ so_data (so, cso->depth.enabled ? 1 : 0);
+
+ so_method(so, eng3d, NV34TCL_ALPHA_FUNC_ENABLE, 3);
+ so_data (so, cso->alpha.enabled ? 1 : 0);
+ so_data (so, nvgl_comparison_op(cso->alpha.func));
+ so_data (so, float_to_ubyte(cso->alpha.ref_value));
+
+ if (cso->stencil[0].enabled) {
+ so_method(so, eng3d, NV34TCL_STENCIL_FRONT_ENABLE, 3);
+ so_data (so, cso->stencil[0].enabled ? 1 : 0);
+ so_data (so, cso->stencil[0].writemask);
+ so_data (so, nvgl_comparison_op(cso->stencil[0].func));
+ so_method(so, eng3d, NV34TCL_STENCIL_FRONT_FUNC_MASK, 4);
+ so_data (so, cso->stencil[0].valuemask);
+ so_data (so, nvgl_stencil_op(cso->stencil[0].fail_op));
+ so_data (so, nvgl_stencil_op(cso->stencil[0].zfail_op));
+ so_data (so, nvgl_stencil_op(cso->stencil[0].zpass_op));
+ } else {
+ so_method(so, eng3d, NV34TCL_STENCIL_FRONT_ENABLE, 1);
+ so_data (so, 0);
+ }
+
+ if (cso->stencil[1].enabled) {
+ so_method(so, eng3d, NV34TCL_STENCIL_BACK_ENABLE, 3);
+ so_data (so, cso->stencil[1].enabled ? 1 : 0);
+ so_data (so, cso->stencil[1].writemask);
+ so_data (so, nvgl_comparison_op(cso->stencil[1].func));
+ so_method(so, eng3d, NV34TCL_STENCIL_BACK_FUNC_MASK, 4);
+ so_data (so, cso->stencil[1].valuemask);
+ so_data (so, nvgl_stencil_op(cso->stencil[1].fail_op));
+ so_data (so, nvgl_stencil_op(cso->stencil[1].zfail_op));
+ so_data (so, nvgl_stencil_op(cso->stencil[1].zpass_op));
+ } else {
+ so_method(so, eng3d, NV34TCL_STENCIL_BACK_ENABLE, 1);
+ so_data (so, 0);
+ }
+
+ so_ref(so, &zsaso->so);
+ so_ref(NULL, &so);
+ zsaso->pipe = *cso;
+ return (void *)zsaso;
+}
+
+static void
+nvfx_depth_stencil_alpha_state_bind(struct pipe_context *pipe, void *hwcso)
+{
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+
+ nvfx->zsa = hwcso;
+ nvfx->dirty |= NVFX_NEW_ZSA;
+}
+
+static void
+nvfx_depth_stencil_alpha_state_delete(struct pipe_context *pipe, void *hwcso)
+{
+ struct nvfx_zsa_state *zsaso = hwcso;
+
+ so_ref(NULL, &zsaso->so);
+ FREE(zsaso);
+}
+
+static void *
+nvfx_vp_state_create(struct pipe_context *pipe,
+ const struct pipe_shader_state *cso)
+{
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+ struct nvfx_vertex_program *vp;
+
+ vp = CALLOC(1, sizeof(struct nvfx_vertex_program));
+ vp->pipe.tokens = tgsi_dup_tokens(cso->tokens);
+ vp->draw = draw_create_vertex_shader(nvfx->draw, &vp->pipe);
+
+ return (void *)vp;
+}
+
+static void
+nvfx_vp_state_bind(struct pipe_context *pipe, void *hwcso)
+{
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+
+ nvfx->vertprog = hwcso;
+ nvfx->dirty |= NVFX_NEW_VERTPROG;
+ nvfx->draw_dirty |= NVFX_NEW_VERTPROG;
+}
+
+static void
+nvfx_vp_state_delete(struct pipe_context *pipe, void *hwcso)
+{
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+ struct nvfx_vertex_program *vp = hwcso;
+
+ draw_delete_vertex_shader(nvfx->draw, vp->draw);
+ nvfx_vertprog_destroy(nvfx, vp);
+ FREE((void*)vp->pipe.tokens);
+ FREE(vp);
+}
+
+static void *
+nvfx_fp_state_create(struct pipe_context *pipe,
+ const struct pipe_shader_state *cso)
+{
+ struct nvfx_fragment_program *fp;
+
+ fp = CALLOC(1, sizeof(struct nvfx_fragment_program));
+ fp->pipe.tokens = tgsi_dup_tokens(cso->tokens);
+
+ tgsi_scan_shader(fp->pipe.tokens, &fp->info);
+
+ return (void *)fp;
+}
+
+static void
+nvfx_fp_state_bind(struct pipe_context *pipe, void *hwcso)
+{
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+
+ nvfx->fragprog = hwcso;
+ nvfx->dirty |= NVFX_NEW_FRAGPROG;
+}
+
+static void
+nvfx_fp_state_delete(struct pipe_context *pipe, void *hwcso)
+{
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+ struct nvfx_fragment_program *fp = hwcso;
+
+ nvfx_fragprog_destroy(nvfx, fp);
+ FREE((void*)fp->pipe.tokens);
+ FREE(fp);
+}
+
+static void
+nvfx_set_blend_color(struct pipe_context *pipe,
+ const struct pipe_blend_color *bcol)
+{
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+
+ nvfx->blend_colour = *bcol;
+ nvfx->dirty |= NVFX_NEW_BCOL;
+}
+
+static void
+nvfx_set_stencil_ref(struct pipe_context *pipe,
+ const struct pipe_stencil_ref *sr)
+{
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+
+ nvfx->stencil_ref = *sr;
+ nvfx->dirty |= NVFX_NEW_SR;
+}
+
+static void
+nvfx_set_clip_state(struct pipe_context *pipe,
+ const struct pipe_clip_state *clip)
+{
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+
+ nvfx->clip = *clip;
+ nvfx->dirty |= NVFX_NEW_UCP;
+ nvfx->draw_dirty |= NVFX_NEW_UCP;
+}
+
+static void
+nvfx_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
+ struct pipe_buffer *buf )
+{
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+
+ nvfx->constbuf[shader] = buf;
+ nvfx->constbuf_nr[shader] = buf->size / (4 * sizeof(float));
+
+ if (shader == PIPE_SHADER_VERTEX) {
+ nvfx->dirty |= NVFX_NEW_VERTPROG;
+ } else
+ if (shader == PIPE_SHADER_FRAGMENT) {
+ nvfx->dirty |= NVFX_NEW_FRAGPROG;
+ }
+}
+
+static void
+nvfx_set_framebuffer_state(struct pipe_context *pipe,
+ const struct pipe_framebuffer_state *fb)
+{
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+
+ nvfx->framebuffer = *fb;
+ nvfx->dirty |= NVFX_NEW_FB;
+}
+
+static void
+nvfx_set_polygon_stipple(struct pipe_context *pipe,
+ const struct pipe_poly_stipple *stipple)
+{
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+
+ memcpy(nvfx->stipple, stipple->stipple, 4 * 32);
+ nvfx->dirty |= NVFX_NEW_STIPPLE;
+}
+
+static void
+nvfx_set_scissor_state(struct pipe_context *pipe,
+ const struct pipe_scissor_state *s)
+{
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+
+ nvfx->scissor = *s;
+ nvfx->dirty |= NVFX_NEW_SCISSOR;
+}
+
+static void
+nvfx_set_viewport_state(struct pipe_context *pipe,
+ const struct pipe_viewport_state *vpt)
+{
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+
+ nvfx->viewport = *vpt;
+ nvfx->dirty |= NVFX_NEW_VIEWPORT;
+ nvfx->draw_dirty |= NVFX_NEW_VIEWPORT;
+}
+
+static void
+nvfx_set_vertex_buffers(struct pipe_context *pipe, unsigned count,
+ const struct pipe_vertex_buffer *vb)
+{
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+
+ memcpy(nvfx->vtxbuf, vb, sizeof(*vb) * count);
+ nvfx->vtxbuf_nr = count;
+
+ nvfx->dirty |= NVFX_NEW_ARRAYS;
+ nvfx->draw_dirty |= NVFX_NEW_ARRAYS;
+}
+
+static void *
+nvfx_vtxelts_state_create(struct pipe_context *pipe,
+ unsigned num_elements,
+ const struct pipe_vertex_element *elements)
+{
+ struct nvfx_vtxelt_state *cso = CALLOC_STRUCT(nvfx_vtxelt_state);
+
+ assert(num_elements < 16); /* not doing fallbacks yet */
+ cso->num_elements = num_elements;
+ memcpy(cso->pipe, elements, num_elements * sizeof(*elements));
+
+/* nvfx_vtxelt_construct(cso);*/
+
+ return (void *)cso;
+}
+
+static void
+nvfx_vtxelts_state_delete(struct pipe_context *pipe, void *hwcso)
+{
+ FREE(hwcso);
+}
+
+static void
+nvfx_vtxelts_state_bind(struct pipe_context *pipe, void *hwcso)
+{
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+
+ nvfx->vtxelt = hwcso;
+ nvfx->dirty |= NVFX_NEW_ARRAYS;
+ /*nvfx->draw_dirty |= NVFX_NEW_ARRAYS;*/
+}
+
+void
+nvfx_init_state_functions(struct nvfx_context *nvfx)
+{
+ nvfx->pipe.create_blend_state = nvfx_blend_state_create;
+ nvfx->pipe.bind_blend_state = nvfx_blend_state_bind;
+ nvfx->pipe.delete_blend_state = nvfx_blend_state_delete;
+
+ nvfx->pipe.create_sampler_state = nvfx_sampler_state_create;
+ nvfx->pipe.bind_fragment_sampler_states = nvfx_sampler_state_bind;
+ nvfx->pipe.delete_sampler_state = nvfx_sampler_state_delete;
+ nvfx->pipe.set_fragment_sampler_views = nvfx_set_fragment_sampler_views;
+ nvfx->pipe.create_sampler_view = nvfx_create_sampler_view;
+ nvfx->pipe.sampler_view_destroy = nvfx_sampler_view_destroy;
+
+ nvfx->pipe.create_rasterizer_state = nvfx_rasterizer_state_create;
+ nvfx->pipe.bind_rasterizer_state = nvfx_rasterizer_state_bind;
+ nvfx->pipe.delete_rasterizer_state = nvfx_rasterizer_state_delete;
+
+ nvfx->pipe.create_depth_stencil_alpha_state =
+ nvfx_depth_stencil_alpha_state_create;
+ nvfx->pipe.bind_depth_stencil_alpha_state =
+ nvfx_depth_stencil_alpha_state_bind;
+ nvfx->pipe.delete_depth_stencil_alpha_state =
+ nvfx_depth_stencil_alpha_state_delete;
+
+ nvfx->pipe.create_vs_state = nvfx_vp_state_create;
+ nvfx->pipe.bind_vs_state = nvfx_vp_state_bind;
+ nvfx->pipe.delete_vs_state = nvfx_vp_state_delete;
+
+ nvfx->pipe.create_fs_state = nvfx_fp_state_create;
+ nvfx->pipe.bind_fs_state = nvfx_fp_state_bind;
+ nvfx->pipe.delete_fs_state = nvfx_fp_state_delete;
+
+ nvfx->pipe.set_blend_color = nvfx_set_blend_color;
+ nvfx->pipe.set_stencil_ref = nvfx_set_stencil_ref;
+ nvfx->pipe.set_clip_state = nvfx_set_clip_state;
+ nvfx->pipe.set_constant_buffer = nvfx_set_constant_buffer;
+ nvfx->pipe.set_framebuffer_state = nvfx_set_framebuffer_state;
+ nvfx->pipe.set_polygon_stipple = nvfx_set_polygon_stipple;
+ nvfx->pipe.set_scissor_state = nvfx_set_scissor_state;
+ nvfx->pipe.set_viewport_state = nvfx_set_viewport_state;
+
+ nvfx->pipe.create_vertex_elements_state = nvfx_vtxelts_state_create;
+ nvfx->pipe.delete_vertex_elements_state = nvfx_vtxelts_state_delete;
+ nvfx->pipe.bind_vertex_elements_state = nvfx_vtxelts_state_bind;
+
+ nvfx->pipe.set_vertex_buffers = nvfx_set_vertex_buffers;
+}
diff --git a/src/gallium/drivers/nv40/nv40_state.h b/src/gallium/drivers/nvfx/nvfx_state.h
index 192074e747..e585246879 100644
--- a/src/gallium/drivers/nv40/nv40_state.h
+++ b/src/gallium/drivers/nvfx/nvfx_state.h
@@ -1,29 +1,21 @@
-#ifndef __NV40_STATE_H__
-#define __NV40_STATE_H__
+#ifndef __NVFX_STATE_H__
+#define __NVFX_STATE_H__
#include "pipe/p_state.h"
#include "tgsi/tgsi_scan.h"
-struct nv40_sampler_state {
- uint32_t fmt;
- uint32_t wrap;
- uint32_t en;
- uint32_t filt;
- uint32_t bcol;
-};
-
-struct nv40_vertex_program_exec {
+struct nvfx_vertex_program_exec {
uint32_t data[4];
boolean has_branch_offset;
int const_index;
};
-struct nv40_vertex_program_data {
+struct nvfx_vertex_program_data {
int index; /* immediates == -1 */
float value[4];
};
-struct nv40_vertex_program {
+struct nvfx_vertex_program {
struct pipe_shader_state pipe;
struct draw_vertex_shader *draw;
@@ -32,9 +24,9 @@ struct nv40_vertex_program {
struct pipe_clip_state ucp;
- struct nv40_vertex_program_exec *insns;
+ struct nvfx_vertex_program_exec *insns;
unsigned nr_insns;
- struct nv40_vertex_program_data *consts;
+ struct nvfx_vertex_program_data *consts;
unsigned nr_consts;
struct nouveau_resource *exec;
@@ -49,12 +41,12 @@ struct nv40_vertex_program {
struct nouveau_stateobj *so;
};
-struct nv40_fragment_program_data {
+struct nvfx_fragment_program_data {
unsigned offset;
unsigned index;
};
-struct nv40_fragment_program {
+struct nvfx_fragment_program {
struct pipe_shader_state pipe;
struct tgsi_shader_info info;
@@ -64,7 +56,7 @@ struct nv40_fragment_program {
uint32_t *insn;
int insn_len;
- struct nv40_fragment_program_data *consts;
+ struct nvfx_fragment_program_data *consts;
unsigned nr_consts;
struct pipe_buffer *buffer;
@@ -73,7 +65,9 @@ struct nv40_fragment_program {
struct nouveau_stateobj *so;
};
-struct nv40_miptree {
+#define NVFX_MAX_TEXTURE_LEVELS 16
+
+struct nvfx_miptree {
struct pipe_texture base;
struct nouveau_bo *bo;
@@ -83,7 +77,7 @@ struct nv40_miptree {
struct {
uint pitch;
uint *image_offset;
- } level[PIPE_MAX_TEXTURE_LEVELS];
+ } level[NVFX_MAX_TEXTURE_LEVELS];
};
#endif
diff --git a/src/gallium/drivers/nvfx/nvfx_state_blend.c b/src/gallium/drivers/nvfx/nvfx_state_blend.c
new file mode 100644
index 0000000000..03b6ef8117
--- /dev/null
+++ b/src/gallium/drivers/nvfx/nvfx_state_blend.c
@@ -0,0 +1,41 @@
+#include "nvfx_context.h"
+
+static boolean
+nvfx_state_blend_validate(struct nvfx_context *nvfx)
+{
+ so_ref(nvfx->blend->so, &nvfx->state.hw[NVFX_STATE_BLEND]);
+ return TRUE;
+}
+
+struct nvfx_state_entry nvfx_state_blend = {
+ .validate = nvfx_state_blend_validate,
+ .dirty = {
+ .pipe = NVFX_NEW_BLEND,
+ .hw = NVFX_STATE_BLEND
+ }
+};
+
+static boolean
+nvfx_state_blend_colour_validate(struct nvfx_context *nvfx)
+{
+ struct nouveau_stateobj *so = so_new(1, 1, 0);
+ struct pipe_blend_color *bcol = &nvfx->blend_colour;
+
+ so_method(so, nvfx->screen->eng3d, NV34TCL_BLEND_COLOR, 1);
+ so_data (so, ((float_to_ubyte(bcol->color[3]) << 24) |
+ (float_to_ubyte(bcol->color[0]) << 16) |
+ (float_to_ubyte(bcol->color[1]) << 8) |
+ (float_to_ubyte(bcol->color[2]) << 0)));
+
+ so_ref(so, &nvfx->state.hw[NVFX_STATE_BCOL]);
+ so_ref(NULL, &so);
+ return TRUE;
+}
+
+struct nvfx_state_entry nvfx_state_blend_colour = {
+ .validate = nvfx_state_blend_colour_validate,
+ .dirty = {
+ .pipe = NVFX_NEW_BCOL,
+ .hw = NVFX_STATE_BCOL
+ }
+};
diff --git a/src/gallium/drivers/nvfx/nvfx_state_emit.c b/src/gallium/drivers/nvfx/nvfx_state_emit.c
new file mode 100644
index 0000000000..72537388ea
--- /dev/null
+++ b/src/gallium/drivers/nvfx/nvfx_state_emit.c
@@ -0,0 +1,179 @@
+#include "nvfx_context.h"
+#include "nvfx_state.h"
+#include "draw/draw_context.h"
+
+#define RENDER_STATES(name, vbo) \
+static struct nvfx_state_entry *name##render_states[] = { \
+ &nvfx_state_framebuffer, \
+ &nvfx_state_rasterizer, \
+ &nvfx_state_scissor, \
+ &nvfx_state_stipple, \
+ &nvfx_state_fragprog, \
+ &nvfx_state_fragtex, \
+ &nvfx_state_vertprog, \
+ &nvfx_state_blend, \
+ &nvfx_state_blend_colour, \
+ &nvfx_state_zsa, \
+ &nvfx_state_sr, \
+ &nvfx_state_viewport, \
+ &nvfx_state_##vbo, \
+ NULL \
+}
+
+RENDER_STATES(, vbo);
+RENDER_STATES(swtnl_, vtxfmt);
+
+static void
+nvfx_state_do_validate(struct nvfx_context *nvfx,
+ struct nvfx_state_entry **states)
+{
+ while (*states) {
+ struct nvfx_state_entry *e = *states;
+
+ if (nvfx->dirty & e->dirty.pipe) {
+ if (e->validate(nvfx))
+ nvfx->state.dirty |= (1ULL << e->dirty.hw);
+ }
+
+ states++;
+ }
+ nvfx->dirty = 0;
+}
+
+void
+nvfx_state_emit(struct nvfx_context *nvfx)
+{
+ struct nvfx_state *state = &nvfx->state;
+ struct nvfx_screen *screen = nvfx->screen;
+ struct nouveau_channel *chan = screen->base.channel;
+ struct nouveau_grobj *eng3d = screen->eng3d;
+ unsigned i;
+ uint64_t states;
+
+ /* XXX: race conditions
+ */
+ if (nvfx != screen->cur_ctx) {
+ for (i = 0; i < NVFX_STATE_MAX; i++) {
+ if (state->hw[i] && screen->state[i] != state->hw[i])
+ state->dirty |= (1ULL << i);
+ }
+
+ screen->cur_ctx = nvfx;
+ }
+
+ for (i = 0, states = state->dirty; states; i++) {
+ if (!(states & (1ULL << i)))
+ continue;
+ so_ref (state->hw[i], &nvfx->screen->state[i]);
+ if (state->hw[i])
+ so_emit(chan, nvfx->screen->state[i]);
+ states &= ~(1ULL << i);
+ }
+
+ /* TODO: could nv30 need this or something similar too? */
+ if(nvfx->is_nv4x) {
+ if (state->dirty & ((1ULL << NVFX_STATE_FRAGPROG) |
+ (1ULL << NVFX_STATE_FRAGTEX0))) {
+ BEGIN_RING(chan, eng3d, NV40TCL_TEX_CACHE_CTL, 1);
+ OUT_RING (chan, 2);
+ BEGIN_RING(chan, eng3d, NV40TCL_TEX_CACHE_CTL, 1);
+ OUT_RING (chan, 1);
+ }
+ }
+ state->dirty = 0;
+}
+
+void
+nvfx_state_flush_notify(struct nouveau_channel *chan)
+{
+ struct nvfx_context *nvfx = chan->user_private;
+ struct nvfx_state *state = &nvfx->state;
+ unsigned i, samplers;
+
+ so_emit_reloc_markers(chan, state->hw[NVFX_STATE_FB]);
+ for (i = 0, samplers = state->fp_samplers; i < 16 && samplers; i++) {
+ if (!(samplers & (1 << i)))
+ continue;
+ so_emit_reloc_markers(chan,
+ state->hw[NVFX_STATE_FRAGTEX0+i]);
+ samplers &= ~(1ULL << i);
+ }
+ so_emit_reloc_markers(chan, state->hw[NVFX_STATE_FRAGPROG]);
+ if (state->hw[NVFX_STATE_VTXBUF] && nvfx->render_mode == HW)
+ so_emit_reloc_markers(chan, state->hw[NVFX_STATE_VTXBUF]);
+}
+
+boolean
+nvfx_state_validate(struct nvfx_context *nvfx)
+{
+ boolean was_sw = nvfx->fallback_swtnl ? TRUE : FALSE;
+
+ if (nvfx->render_mode != HW) {
+ /* Don't even bother trying to go back to hw if none
+ * of the states that caused swtnl previously have changed.
+ */
+ if ((nvfx->fallback_swtnl & nvfx->dirty)
+ != nvfx->fallback_swtnl)
+ return FALSE;
+
+ /* Attempt to go to hwtnl again */
+ nvfx->pipe.flush(&nvfx->pipe, 0, NULL);
+ nvfx->dirty |= (NVFX_NEW_VIEWPORT |
+ NVFX_NEW_VERTPROG |
+ NVFX_NEW_ARRAYS);
+ nvfx->render_mode = HW;
+ }
+
+ nvfx_state_do_validate(nvfx, render_states);
+
+ if (nvfx->fallback_swtnl || nvfx->fallback_swrast)
+ return FALSE;
+
+ if (was_sw)
+ NOUVEAU_ERR("swtnl->hw\n");
+
+ return TRUE;
+}
+
+boolean
+nvfx_state_validate_swtnl(struct nvfx_context *nvfx)
+{
+ struct draw_context *draw = nvfx->draw;
+
+ /* Setup for swtnl */
+ if (nvfx->render_mode == HW) {
+ NOUVEAU_ERR("hw->swtnl 0x%08x\n", nvfx->fallback_swtnl);
+ nvfx->pipe.flush(&nvfx->pipe, 0, NULL);
+ nvfx->dirty |= (NVFX_NEW_VIEWPORT |
+ NVFX_NEW_VERTPROG |
+ NVFX_NEW_ARRAYS);
+ nvfx->render_mode = SWTNL;
+ }
+
+ if (nvfx->draw_dirty & NVFX_NEW_VERTPROG)
+ draw_bind_vertex_shader(draw, nvfx->vertprog->draw);
+
+ if (nvfx->draw_dirty & NVFX_NEW_RAST)
+ draw_set_rasterizer_state(draw, &nvfx->rasterizer->pipe);
+
+ if (nvfx->draw_dirty & NVFX_NEW_UCP)
+ draw_set_clip_state(draw, &nvfx->clip);
+
+ if (nvfx->draw_dirty & NVFX_NEW_VIEWPORT)
+ draw_set_viewport_state(draw, &nvfx->viewport);
+
+ if (nvfx->draw_dirty & NVFX_NEW_ARRAYS) {
+ draw_set_vertex_buffers(draw, nvfx->vtxbuf_nr, nvfx->vtxbuf);
+ draw_set_vertex_elements(draw, nvfx->vtxelt->num_elements, nvfx->vtxelt->pipe);
+ }
+
+ nvfx_state_do_validate(nvfx, swtnl_render_states);
+
+ if (nvfx->fallback_swrast) {
+ NOUVEAU_ERR("swtnl->swrast 0x%08x\n", nvfx->fallback_swrast);
+ return FALSE;
+ }
+
+ nvfx->draw_dirty = 0;
+ return TRUE;
+}
diff --git a/src/gallium/drivers/nvfx/nvfx_state_fb.c b/src/gallium/drivers/nvfx/nvfx_state_fb.c
new file mode 100644
index 0000000000..1923184163
--- /dev/null
+++ b/src/gallium/drivers/nvfx/nvfx_state_fb.c
@@ -0,0 +1,234 @@
+#include "nvfx_context.h"
+#include "nouveau/nouveau_util.h"
+
+static struct pipe_buffer *
+nvfx_do_surface_buffer(struct pipe_surface *surface)
+{
+ struct nvfx_miptree *mt = (struct nvfx_miptree *)surface->texture;
+ return mt->buffer;
+}
+
+#define nvfx_surface_buffer(ps) nouveau_bo(nvfx_do_surface_buffer(ps))
+
+static boolean
+nvfx_state_framebuffer_validate(struct nvfx_context *nvfx)
+{
+ struct pipe_framebuffer_state *fb = &nvfx->framebuffer;
+ struct nouveau_channel *chan = nvfx->screen->base.channel;
+ struct nouveau_grobj *eng3d = nvfx->screen->eng3d;
+ struct nv04_surface *rt[4], *zeta = NULL;
+ uint32_t rt_enable = 0, rt_format = 0;
+ int i, colour_format = 0, zeta_format = 0;
+ int depth_only = 0;
+ struct nouveau_stateobj *so = so_new(18, 24, 10);
+ unsigned rt_flags = NOUVEAU_BO_RDWR | NOUVEAU_BO_VRAM;
+ unsigned w = fb->width;
+ unsigned h = fb->height;
+ int colour_bits = 32, zeta_bits = 32;
+
+ if(!nvfx->is_nv4x)
+ assert(fb->nr_cbufs <= 2);
+ else
+ assert(fb->nr_cbufs <= 4);
+
+ for (i = 0; i < fb->nr_cbufs; i++) {
+ if (colour_format) {
+ assert(colour_format == fb->cbufs[i]->format);
+ } else {
+ colour_format = fb->cbufs[i]->format;
+ rt_enable |= (NV34TCL_RT_ENABLE_COLOR0 << i);
+ rt[i] = (struct nv04_surface *)fb->cbufs[i];
+ }
+ }
+
+ if (rt_enable & (NV34TCL_RT_ENABLE_COLOR1 |
+ NV40TCL_RT_ENABLE_COLOR2 | NV40TCL_RT_ENABLE_COLOR3))
+ rt_enable |= NV34TCL_RT_ENABLE_MRT;
+
+ if (fb->zsbuf) {
+ zeta_format = fb->zsbuf->format;
+ zeta = (struct nv04_surface *)fb->zsbuf;
+ }
+
+ if (rt_enable & (NV34TCL_RT_ENABLE_COLOR0 | NV34TCL_RT_ENABLE_COLOR1 |
+ NV40TCL_RT_ENABLE_COLOR2 | NV40TCL_RT_ENABLE_COLOR3)) {
+ /* Render to at least a colour buffer */
+ if (!(rt[0]->base.texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) {
+ assert(!(fb->width & (fb->width - 1)) && !(fb->height & (fb->height - 1)));
+ for (i = 1; i < fb->nr_cbufs; i++)
+ assert(!(rt[i]->base.texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR));
+
+ rt_format = NV34TCL_RT_FORMAT_TYPE_SWIZZLED |
+ (log2i(rt[0]->base.width) << NV34TCL_RT_FORMAT_LOG2_WIDTH_SHIFT) |
+ (log2i(rt[0]->base.height) << NV34TCL_RT_FORMAT_LOG2_HEIGHT_SHIFT);
+ }
+ else
+ rt_format = NV34TCL_RT_FORMAT_TYPE_LINEAR;
+ } else if (fb->zsbuf) {
+ depth_only = 1;
+
+ /* Render to depth buffer only */
+ if (!(zeta->base.texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) {
+ assert(!(fb->width & (fb->width - 1)) && !(fb->height & (fb->height - 1)));
+
+ rt_format = NV34TCL_RT_FORMAT_TYPE_SWIZZLED |
+ (log2i(zeta->base.width) << NV34TCL_RT_FORMAT_LOG2_WIDTH_SHIFT) |
+ (log2i(zeta->base.height) << NV34TCL_RT_FORMAT_LOG2_HEIGHT_SHIFT);
+ }
+ else
+ rt_format = NV34TCL_RT_FORMAT_TYPE_LINEAR;
+ } else {
+ return FALSE;
+ }
+
+ switch (colour_format) {
+ case PIPE_FORMAT_B8G8R8X8_UNORM:
+ rt_format |= NV34TCL_RT_FORMAT_COLOR_X8R8G8B8;
+ break;
+ case PIPE_FORMAT_B8G8R8A8_UNORM:
+ case 0:
+ rt_format |= NV34TCL_RT_FORMAT_COLOR_A8R8G8B8;
+ break;
+ case PIPE_FORMAT_B5G6R5_UNORM:
+ rt_format |= NV34TCL_RT_FORMAT_COLOR_R5G6B5;
+ colour_bits = 16;
+ break;
+ default:
+ assert(0);
+ }
+
+ switch (zeta_format) {
+ case PIPE_FORMAT_Z16_UNORM:
+ rt_format |= NV34TCL_RT_FORMAT_ZETA_Z16;
+ zeta_bits = 16;
+ break;
+ case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
+ case PIPE_FORMAT_X8Z24_UNORM:
+ case 0:
+ rt_format |= NV34TCL_RT_FORMAT_ZETA_Z24S8;
+ break;
+ default:
+ assert(0);
+ }
+
+ if ((!nvfx->is_nv4x) && colour_bits > zeta_bits) {
+ /* TODO: does this limitation really exist?
+ TODO: can it be worked around somehow? */
+ return FALSE;
+ }
+
+ if ((rt_enable & NV34TCL_RT_ENABLE_COLOR0)
+ || ((!nvfx->is_nv4x) && depth_only)) {
+ struct nv04_surface *rt0 = (depth_only ? zeta : rt[0]);
+ uint32_t pitch = rt0->pitch;
+
+ if(!nvfx->is_nv4x)
+ {
+ if (zeta) {
+ pitch |= (zeta->pitch << 16);
+ } else {
+ pitch |= (pitch << 16);
+ }
+ }
+
+ so_method(so, eng3d, NV34TCL_DMA_COLOR0, 1);
+ so_reloc (so, nvfx_surface_buffer(&rt0->base), 0,
+ rt_flags | NOUVEAU_BO_OR,
+ chan->vram->handle, chan->gart->handle);
+ so_method(so, eng3d, NV34TCL_COLOR0_PITCH, 2);
+ so_data (so, pitch);
+ so_reloc (so, nvfx_surface_buffer(&rt[0]->base),
+ rt0->base.offset, rt_flags | NOUVEAU_BO_LOW,
+ 0, 0);
+ }
+
+ if (rt_enable & NV34TCL_RT_ENABLE_COLOR1) {
+ so_method(so, eng3d, NV34TCL_DMA_COLOR1, 1);
+ so_reloc (so, nvfx_surface_buffer(&rt[1]->base), 0,
+ rt_flags | NOUVEAU_BO_OR,
+ chan->vram->handle, chan->gart->handle);
+ so_method(so, eng3d, NV34TCL_COLOR1_OFFSET, 2);
+ so_reloc (so, nvfx_surface_buffer(&rt[1]->base),
+ rt[1]->base.offset, rt_flags | NOUVEAU_BO_LOW,
+ 0, 0);
+ so_data (so, rt[1]->pitch);
+ }
+
+ if(nvfx->is_nv4x)
+ {
+ if (rt_enable & NV40TCL_RT_ENABLE_COLOR2) {
+ so_method(so, eng3d, NV40TCL_DMA_COLOR2, 1);
+ so_reloc (so, nvfx_surface_buffer(&rt[2]->base), 0,
+ rt_flags | NOUVEAU_BO_OR,
+ chan->vram->handle, chan->gart->handle);
+ so_method(so, eng3d, NV40TCL_COLOR2_OFFSET, 1);
+ so_reloc (so, nvfx_surface_buffer(&rt[2]->base),
+ rt[2]->base.offset, rt_flags | NOUVEAU_BO_LOW,
+ 0, 0);
+ so_method(so, eng3d, NV40TCL_COLOR2_PITCH, 1);
+ so_data (so, rt[2]->pitch);
+ }
+
+ if (rt_enable & NV40TCL_RT_ENABLE_COLOR3) {
+ so_method(so, eng3d, NV40TCL_DMA_COLOR3, 1);
+ so_reloc (so, nvfx_surface_buffer(&rt[3]->base), 0,
+ rt_flags | NOUVEAU_BO_OR,
+ chan->vram->handle, chan->gart->handle);
+ so_method(so, eng3d, NV40TCL_COLOR3_OFFSET, 1);
+ so_reloc (so, nvfx_surface_buffer(&rt[3]->base),
+ rt[3]->base.offset, rt_flags | NOUVEAU_BO_LOW,
+ 0, 0);
+ so_method(so, eng3d, NV40TCL_COLOR3_PITCH, 1);
+ so_data (so, rt[3]->pitch);
+ }
+ }
+
+ if (zeta_format) {
+ so_method(so, eng3d, NV34TCL_DMA_ZETA, 1);
+ so_reloc (so, nvfx_surface_buffer(&zeta->base), 0,
+ rt_flags | NOUVEAU_BO_OR,
+ chan->vram->handle, chan->gart->handle);
+ so_method(so, eng3d, NV34TCL_ZETA_OFFSET, 1);
+ /* TODO: reverse engineer LMA */
+ so_reloc (so, nvfx_surface_buffer(&zeta->base),
+ zeta->base.offset, rt_flags | NOUVEAU_BO_LOW, 0, 0);
+ if(nvfx->is_nv4x) {
+ so_method(so, eng3d, NV40TCL_ZETA_PITCH, 1);
+ so_data (so, zeta->pitch);
+ }
+ }
+
+ so_method(so, eng3d, NV34TCL_RT_ENABLE, 1);
+ so_data (so, rt_enable);
+ so_method(so, eng3d, NV34TCL_RT_HORIZ, 3);
+ so_data (so, (w << 16) | 0);
+ so_data (so, (h << 16) | 0);
+ so_data (so, rt_format);
+ so_method(so, eng3d, NV34TCL_VIEWPORT_HORIZ, 2);
+ so_data (so, (w << 16) | 0);
+ so_data (so, (h << 16) | 0);
+ so_method(so, eng3d, NV34TCL_VIEWPORT_CLIP_HORIZ(0), 2);
+ so_data (so, ((w - 1) << 16) | 0);
+ so_data (so, ((h - 1) << 16) | 0);
+ so_method(so, eng3d, 0x1d88, 1);
+ so_data (so, (1 << 12) | h);
+
+ if(!nvfx->is_nv4x) {
+ /* Wonder why this is needed, context should all be set to zero on init */
+ /* TODO: we can most likely remove this, after putting it in context init */
+ so_method(so, eng3d, NV34TCL_VIEWPORT_TX_ORIGIN, 1);
+ so_data (so, 0);
+ }
+
+ so_ref(so, &nvfx->state.hw[NVFX_STATE_FB]);
+ so_ref(NULL, &so);
+ return TRUE;
+}
+
+struct nvfx_state_entry nvfx_state_framebuffer = {
+ .validate = nvfx_state_framebuffer_validate,
+ .dirty = {
+ .pipe = NVFX_NEW_FB,
+ .hw = NVFX_STATE_FB
+ }
+};
diff --git a/src/gallium/drivers/nvfx/nvfx_state_rasterizer.c b/src/gallium/drivers/nvfx/nvfx_state_rasterizer.c
new file mode 100644
index 0000000000..0d35ecbf20
--- /dev/null
+++ b/src/gallium/drivers/nvfx/nvfx_state_rasterizer.c
@@ -0,0 +1,17 @@
+#include "nvfx_context.h"
+
+static boolean
+nvfx_state_rasterizer_validate(struct nvfx_context *nvfx)
+{
+ so_ref(nvfx->rasterizer->so,
+ &nvfx->state.hw[NVFX_STATE_RAST]);
+ return TRUE;
+}
+
+struct nvfx_state_entry nvfx_state_rasterizer = {
+ .validate = nvfx_state_rasterizer_validate,
+ .dirty = {
+ .pipe = NVFX_NEW_RAST,
+ .hw = NVFX_STATE_RAST
+ }
+};
diff --git a/src/gallium/drivers/nvfx/nvfx_state_scissor.c b/src/gallium/drivers/nvfx/nvfx_state_scissor.c
new file mode 100644
index 0000000000..940d8cb5c0
--- /dev/null
+++ b/src/gallium/drivers/nvfx/nvfx_state_scissor.c
@@ -0,0 +1,36 @@
+#include "nvfx_context.h"
+
+static boolean
+nvfx_state_scissor_validate(struct nvfx_context *nvfx)
+{
+ struct pipe_rasterizer_state *rast = &nvfx->rasterizer->pipe;
+ struct pipe_scissor_state *s = &nvfx->scissor;
+ struct nouveau_stateobj *so;
+
+ if (nvfx->state.hw[NVFX_STATE_SCISSOR] &&
+ (rast->scissor == 0 && nvfx->state.scissor_enabled == 0))
+ return FALSE;
+ nvfx->state.scissor_enabled = rast->scissor;
+
+ so = so_new(1, 2, 0);
+ so_method(so, nvfx->screen->eng3d, NV34TCL_SCISSOR_HORIZ, 2);
+ if (nvfx->state.scissor_enabled) {
+ so_data (so, ((s->maxx - s->minx) << 16) | s->minx);
+ so_data (so, ((s->maxy - s->miny) << 16) | s->miny);
+ } else {
+ so_data (so, 4096 << 16);
+ so_data (so, 4096 << 16);
+ }
+
+ so_ref(so, &nvfx->state.hw[NVFX_STATE_SCISSOR]);
+ so_ref(NULL, &so);
+ return TRUE;
+}
+
+struct nvfx_state_entry nvfx_state_scissor = {
+ .validate = nvfx_state_scissor_validate,
+ .dirty = {
+ .pipe = NVFX_NEW_SCISSOR | NVFX_NEW_RAST,
+ .hw = NVFX_STATE_SCISSOR
+ }
+};
diff --git a/src/gallium/drivers/nvfx/nvfx_state_stipple.c b/src/gallium/drivers/nvfx/nvfx_state_stipple.c
new file mode 100644
index 0000000000..57cd3c936a
--- /dev/null
+++ b/src/gallium/drivers/nvfx/nvfx_state_stipple.c
@@ -0,0 +1,40 @@
+#include "nvfx_context.h"
+
+static boolean
+nvfx_state_stipple_validate(struct nvfx_context *nvfx)
+{
+ struct pipe_rasterizer_state *rast = &nvfx->rasterizer->pipe;
+ struct nouveau_grobj *eng3d = nvfx->screen->eng3d;
+ struct nouveau_stateobj *so;
+
+ if (nvfx->state.hw[NVFX_STATE_STIPPLE] &&
+ (rast->poly_stipple_enable == 0 && nvfx->state.stipple_enabled == 0))
+ return FALSE;
+
+ if (rast->poly_stipple_enable) {
+ unsigned i;
+
+ so = so_new(2, 33, 0);
+ so_method(so, eng3d, NV34TCL_POLYGON_STIPPLE_ENABLE, 1);
+ so_data (so, 1);
+ so_method(so, eng3d, NV34TCL_POLYGON_STIPPLE_PATTERN(0), 32);
+ for (i = 0; i < 32; i++)
+ so_data(so, nvfx->stipple[i]);
+ } else {
+ so = so_new(1, 1, 0);
+ so_method(so, eng3d, NV34TCL_POLYGON_STIPPLE_ENABLE, 1);
+ so_data (so, 0);
+ }
+
+ so_ref(so, &nvfx->state.hw[NVFX_STATE_STIPPLE]);
+ so_ref(NULL, &so);
+ return TRUE;
+}
+
+struct nvfx_state_entry nvfx_state_stipple = {
+ .validate = nvfx_state_stipple_validate,
+ .dirty = {
+ .pipe = NVFX_NEW_STIPPLE | NVFX_NEW_RAST,
+ .hw = NVFX_STATE_STIPPLE,
+ }
+};
diff --git a/src/gallium/drivers/nvfx/nvfx_state_viewport.c b/src/gallium/drivers/nvfx/nvfx_state_viewport.c
new file mode 100644
index 0000000000..ec730e3a9e
--- /dev/null
+++ b/src/gallium/drivers/nvfx/nvfx_state_viewport.c
@@ -0,0 +1,52 @@
+#include "nvfx_context.h"
+
+/* Having this depend on FB and RAST looks wrong, but it seems
+ necessary to make this work on nv3x
+ TODO: find the right fix
+*/
+
+static boolean
+nvfx_state_viewport_validate(struct nvfx_context *nvfx)
+{
+ struct pipe_viewport_state *vpt = &nvfx->viewport;
+ struct nouveau_stateobj *so;
+
+ so = so_new(2, 9, 0);
+ so_method(so, nvfx->screen->eng3d,
+ NV34TCL_VIEWPORT_TRANSLATE_X, 8);
+ if(nvfx->render_mode == HW) {
+ so_data (so, fui(vpt->translate[0]));
+ so_data (so, fui(vpt->translate[1]));
+ so_data (so, fui(vpt->translate[2]));
+ so_data (so, fui(vpt->translate[3]));
+ so_data (so, fui(vpt->scale[0]));
+ so_data (so, fui(vpt->scale[1]));
+ so_data (so, fui(vpt->scale[2]));
+ so_data (so, fui(vpt->scale[3]));
+ so_method(so, nvfx->screen->eng3d, 0x1d78, 1);
+ so_data (so, 1);
+ } else {
+ so_data (so, fui(0.0f));
+ so_data (so, fui(0.0f));
+ so_data (so, fui(0.0f));
+ so_data (so, fui(0.0f));
+ so_data (so, fui(1.0f));
+ so_data (so, fui(1.0f));
+ so_data (so, fui(1.0f));
+ so_data (so, fui(1.0f));
+ so_method(so, nvfx->screen->eng3d, 0x1d78, 1);
+ so_data (so, nvfx->is_nv4x ? 0x110 : 1);
+ }
+
+ so_ref(so, &nvfx->state.hw[NVFX_STATE_VIEWPORT]);
+ so_ref(NULL, &so);
+ return TRUE;
+}
+
+struct nvfx_state_entry nvfx_state_viewport = {
+ .validate = nvfx_state_viewport_validate,
+ .dirty = {
+ .pipe = NVFX_NEW_VIEWPORT | NVFX_NEW_FB | NVFX_NEW_RAST,
+ .hw = NVFX_STATE_VIEWPORT
+ }
+};
diff --git a/src/gallium/drivers/nvfx/nvfx_state_zsa.c b/src/gallium/drivers/nvfx/nvfx_state_zsa.c
new file mode 100644
index 0000000000..c84fd041c1
--- /dev/null
+++ b/src/gallium/drivers/nvfx/nvfx_state_zsa.c
@@ -0,0 +1,41 @@
+#include "nvfx_context.h"
+
+static boolean
+nvfx_state_zsa_validate(struct nvfx_context *nvfx)
+{
+ so_ref(nvfx->zsa->so,
+ &nvfx->state.hw[NVFX_STATE_ZSA]);
+ return TRUE;
+}
+
+struct nvfx_state_entry nvfx_state_zsa = {
+ .validate = nvfx_state_zsa_validate,
+ .dirty = {
+ .pipe = NVFX_NEW_ZSA,
+ .hw = NVFX_STATE_ZSA
+ }
+};
+
+static boolean
+nvfx_state_sr_validate(struct nvfx_context *nvfx)
+{
+ struct nouveau_stateobj *so = so_new(2, 2, 0);
+ struct pipe_stencil_ref *sr = &nvfx->stencil_ref;
+
+ so_method(so, nvfx->screen->eng3d, NV34TCL_STENCIL_FRONT_FUNC_REF, 1);
+ so_data (so, sr->ref_value[0]);
+ so_method(so, nvfx->screen->eng3d, NV34TCL_STENCIL_BACK_FUNC_REF, 1);
+ so_data (so, sr->ref_value[1]);
+
+ so_ref(so, &nvfx->state.hw[NVFX_STATE_SR]);
+ so_ref(NULL, &so);
+ return TRUE;
+}
+
+struct nvfx_state_entry nvfx_state_sr = {
+ .validate = nvfx_state_sr_validate,
+ .dirty = {
+ .pipe = NVFX_NEW_SR,
+ .hw = NVFX_STATE_SR
+ }
+};
diff --git a/src/gallium/drivers/nv30/nv30_surface.c b/src/gallium/drivers/nvfx/nvfx_surface.c
index bc18e577ee..8a05ad0a57 100644
--- a/src/gallium/drivers/nv30/nv30_surface.c
+++ b/src/gallium/drivers/nvfx/nvfx_surface.c
@@ -1,9 +1,9 @@
/**************************************************************************
- *
+ *
* Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
* All Rights Reserved.
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
@@ -11,11 +11,11 @@
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
- *
+ *
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
@@ -23,40 +23,40 @@
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
+ *
**************************************************************************/
-#include "nv30_context.h"
+#include "nvfx_context.h"
#include "pipe/p_defines.h"
#include "util/u_inlines.h"
#include "util/u_tile.h"
static void
-nv30_surface_copy(struct pipe_context *pipe,
+nvfx_surface_copy(struct pipe_context *pipe,
struct pipe_surface *dest, unsigned destx, unsigned desty,
struct pipe_surface *src, unsigned srcx, unsigned srcy,
unsigned width, unsigned height)
{
- struct nv30_context *nv30 = nv30_context(pipe);
- struct nv04_surface_2d *eng2d = nv30->screen->eng2d;
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+ struct nv04_surface_2d *eng2d = nvfx->screen->eng2d;
eng2d->copy(eng2d, dest, destx, desty, src, srcx, srcy, width, height);
}
static void
-nv30_surface_fill(struct pipe_context *pipe, struct pipe_surface *dest,
+nvfx_surface_fill(struct pipe_context *pipe, struct pipe_surface *dest,
unsigned destx, unsigned desty, unsigned width,
unsigned height, unsigned value)
{
- struct nv30_context *nv30 = nv30_context(pipe);
- struct nv04_surface_2d *eng2d = nv30->screen->eng2d;
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+ struct nv04_surface_2d *eng2d = nvfx->screen->eng2d;
eng2d->fill(eng2d, dest, destx, desty, width, height, value);
}
void
-nv30_init_surface_functions(struct nv30_context *nv30)
+nvfx_init_surface_functions(struct nvfx_context *nvfx)
{
- nv30->pipe.surface_copy = nv30_surface_copy;
- nv30->pipe.surface_fill = nv30_surface_fill;
+ nvfx->pipe.surface_copy = nvfx_surface_copy;
+ nvfx->pipe.surface_fill = nvfx_surface_fill;
}
diff --git a/src/gallium/drivers/nvfx/nvfx_tex.h b/src/gallium/drivers/nvfx/nvfx_tex.h
new file mode 100644
index 0000000000..69187a79e7
--- /dev/null
+++ b/src/gallium/drivers/nvfx/nvfx_tex.h
@@ -0,0 +1,133 @@
+#ifndef NVFX_TEX_H_
+#define NVFX_TEX_H_
+
+static inline unsigned
+nvfx_tex_wrap_mode(unsigned wrap) {
+ unsigned ret;
+
+ switch (wrap) {
+ case PIPE_TEX_WRAP_REPEAT:
+ ret = NV34TCL_TX_WRAP_S_REPEAT;
+ break;
+ case PIPE_TEX_WRAP_MIRROR_REPEAT:
+ ret = NV34TCL_TX_WRAP_S_MIRRORED_REPEAT;
+ break;
+ case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
+ ret = NV34TCL_TX_WRAP_S_CLAMP_TO_EDGE;
+ break;
+ case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
+ ret = NV34TCL_TX_WRAP_S_CLAMP_TO_BORDER;
+ break;
+ case PIPE_TEX_WRAP_CLAMP:
+ ret = NV34TCL_TX_WRAP_S_CLAMP;
+ break;
+ case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE:
+ ret = NV40TCL_TEX_WRAP_S_MIRROR_CLAMP_TO_EDGE;
+ break;
+ case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER:
+ ret = NV40TCL_TEX_WRAP_S_MIRROR_CLAMP_TO_BORDER;
+ break;
+ case PIPE_TEX_WRAP_MIRROR_CLAMP:
+ ret = NV40TCL_TEX_WRAP_S_MIRROR_CLAMP;
+ break;
+ default:
+ NOUVEAU_ERR("unknown wrap mode: %d\n", wrap);
+ ret = NV34TCL_TX_WRAP_S_REPEAT;
+ break;
+ }
+
+ return ret >> NV34TCL_TX_WRAP_S_SHIFT;
+}
+
+static inline unsigned
+nvfx_tex_wrap_compare_mode(const struct pipe_sampler_state* cso)
+{
+ if (cso->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) {
+ switch (cso->compare_func) {
+ case PIPE_FUNC_NEVER:
+ return NV34TCL_TX_WRAP_RCOMP_NEVER;
+ case PIPE_FUNC_GREATER:
+ return NV34TCL_TX_WRAP_RCOMP_GREATER;
+ case PIPE_FUNC_EQUAL:
+ return NV34TCL_TX_WRAP_RCOMP_EQUAL;
+ case PIPE_FUNC_GEQUAL:
+ return NV34TCL_TX_WRAP_RCOMP_GEQUAL;
+ case PIPE_FUNC_LESS:
+ return NV34TCL_TX_WRAP_RCOMP_LESS;
+ case PIPE_FUNC_NOTEQUAL:
+ return NV34TCL_TX_WRAP_RCOMP_NOTEQUAL;
+ case PIPE_FUNC_LEQUAL:
+ return NV34TCL_TX_WRAP_RCOMP_LEQUAL;
+ case PIPE_FUNC_ALWAYS:
+ return NV34TCL_TX_WRAP_RCOMP_ALWAYS;
+ default:
+ break;
+ }
+ }
+ return 0;
+}
+
+static inline unsigned nvfx_tex_filter(const struct pipe_sampler_state* cso)
+{
+ unsigned filter = 0;
+ switch (cso->mag_img_filter) {
+ case PIPE_TEX_FILTER_LINEAR:
+ filter |= NV34TCL_TX_FILTER_MAGNIFY_LINEAR;
+ break;
+ case PIPE_TEX_FILTER_NEAREST:
+ default:
+ filter |= NV34TCL_TX_FILTER_MAGNIFY_NEAREST;
+ break;
+ }
+
+ switch (cso->min_img_filter) {
+ case PIPE_TEX_FILTER_LINEAR:
+ switch (cso->min_mip_filter) {
+ case PIPE_TEX_MIPFILTER_NEAREST:
+ filter |= NV34TCL_TX_FILTER_MINIFY_LINEAR_MIPMAP_NEAREST;
+ break;
+ case PIPE_TEX_MIPFILTER_LINEAR:
+ filter |= NV34TCL_TX_FILTER_MINIFY_LINEAR_MIPMAP_LINEAR;
+ break;
+ case PIPE_TEX_MIPFILTER_NONE:
+ default:
+ filter |= NV34TCL_TX_FILTER_MINIFY_LINEAR;
+ break;
+ }
+ break;
+ case PIPE_TEX_FILTER_NEAREST:
+ default:
+ switch (cso->min_mip_filter) {
+ case PIPE_TEX_MIPFILTER_NEAREST:
+ filter |= NV34TCL_TX_FILTER_MINIFY_NEAREST_MIPMAP_NEAREST;
+ break;
+ case PIPE_TEX_MIPFILTER_LINEAR:
+ filter |= NV34TCL_TX_FILTER_MINIFY_NEAREST_MIPMAP_LINEAR;
+ break;
+ case PIPE_TEX_MIPFILTER_NONE:
+ default:
+ filter |= NV34TCL_TX_FILTER_MINIFY_NEAREST;
+ break;
+ }
+ break;
+ }
+ return filter;
+}
+
+static inline unsigned nvfx_tex_border_color(const float* border_color)
+{
+ return ((float_to_ubyte(border_color[3]) << 24) |
+ (float_to_ubyte(border_color[0]) << 16) |
+ (float_to_ubyte(border_color[1]) << 8) |
+ (float_to_ubyte(border_color[2]) << 0));
+}
+
+struct nvfx_sampler_state {
+ uint32_t fmt;
+ uint32_t wrap;
+ uint32_t en;
+ uint32_t filt;
+ uint32_t bcol;
+};
+
+#endif /* NVFX_TEX_H_ */
diff --git a/src/gallium/drivers/nv40/nv40_transfer.c b/src/gallium/drivers/nvfx/nvfx_transfer.c
index 0462a042c3..1c250e9fe4 100644
--- a/src/gallium/drivers/nv40/nv40_transfer.c
+++ b/src/gallium/drivers/nvfx/nvfx_transfer.c
@@ -5,18 +5,18 @@
#include "util/u_memory.h"
#include "util/u_math.h"
#include "nouveau/nouveau_winsys.h"
-#include "nv40_context.h"
-#include "nv40_screen.h"
-#include "nv40_state.h"
+#include "nvfx_context.h"
+#include "nvfx_screen.h"
+#include "nvfx_state.h"
-struct nv40_transfer {
+struct nvfx_transfer {
struct pipe_transfer base;
struct pipe_surface *surface;
boolean direct;
};
static void
-nv40_compatible_transfer_tex(struct pipe_texture *pt, unsigned width, unsigned height,
+nvfx_compatible_transfer_tex(struct pipe_texture *pt, unsigned width, unsigned height,
struct pipe_texture *template)
{
memset(template, 0, sizeof(struct pipe_texture));
@@ -33,16 +33,20 @@ nv40_compatible_transfer_tex(struct pipe_texture *pt, unsigned width, unsigned h
}
static struct pipe_transfer *
-nv40_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
+nvfx_transfer_new(struct pipe_context *pipe, struct pipe_texture *pt,
unsigned face, unsigned level, unsigned zslice,
enum pipe_transfer_usage usage,
unsigned x, unsigned y, unsigned w, unsigned h)
{
- struct nv40_miptree *mt = (struct nv40_miptree *)pt;
- struct nv40_transfer *tx;
+ struct pipe_screen *pscreen = pipe->screen;
+ struct nvfx_miptree *mt = (struct nvfx_miptree *)pt;
+ struct nvfx_transfer *tx;
struct pipe_texture tx_tex_template, *tx_tex;
+ static int no_transfer = -1;
+ if(no_transfer < 0)
+ no_transfer = debug_get_bool_option("NOUVEAU_NO_TRANSFER", TRUE/*XXX:FALSE*/);
- tx = CALLOC_STRUCT(nv40_transfer);
+ tx = CALLOC_STRUCT(nvfx_transfer);
if (!tx)
return NULL;
@@ -58,8 +62,7 @@ nv40_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
tx->base.zslice = zslice;
/* Direct access to texture */
- if ((pt->tex_usage & PIPE_TEXTURE_USAGE_DYNAMIC ||
- debug_get_bool_option("NOUVEAU_NO_TRANSFER", TRUE/*XXX:FALSE*/)) &&
+ if ((pt->tex_usage & PIPE_TEXTURE_USAGE_DYNAMIC || no_transfer) &&
pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)
{
tx->direct = true;
@@ -71,7 +74,7 @@ nv40_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
tx->direct = false;
- nv40_compatible_transfer_tex(pt, w, h, &tx_tex_template);
+ nvfx_compatible_transfer_tex(pt, w, h, &tx_tex_template);
tx_tex = pscreen->texture_create(pscreen, &tx_tex_template);
if (!tx_tex)
@@ -80,7 +83,7 @@ nv40_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
return NULL;
}
- tx->base.stride = ((struct nv40_miptree*)tx_tex)->level[0].pitch;
+ tx->base.stride = ((struct nvfx_miptree*)tx_tex)->level[0].pitch;
tx->surface = pscreen->get_tex_surface(pscreen, tx_tex,
0, 0, 0,
@@ -96,7 +99,7 @@ nv40_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
}
if (usage & PIPE_TRANSFER_READ) {
- struct nv40_screen *nvscreen = nv40_screen(pscreen);
+ struct nvfx_screen *nvscreen = nvfx_screen(pscreen);
struct pipe_surface *src;
src = pscreen->get_tex_surface(pscreen, pt,
@@ -117,13 +120,14 @@ nv40_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
}
static void
-nv40_transfer_del(struct pipe_transfer *ptx)
+nvfx_transfer_del(struct pipe_context *pipe,
+ struct pipe_transfer *ptx)
{
- struct nv40_transfer *tx = (struct nv40_transfer *)ptx;
+ struct nvfx_transfer *tx = (struct nvfx_transfer *)ptx;
if (!tx->direct && (ptx->usage & PIPE_TRANSFER_WRITE)) {
- struct pipe_screen *pscreen = ptx->texture->screen;
- struct nv40_screen *nvscreen = nv40_screen(pscreen);
+ struct pipe_screen *pscreen = pipe->screen;
+ struct nvfx_screen *nvscreen = nvfx_screen(pscreen);
struct pipe_surface *dst;
dst = pscreen->get_tex_surface(pscreen, ptx->texture,
@@ -145,11 +149,12 @@ nv40_transfer_del(struct pipe_transfer *ptx)
}
static void *
-nv40_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+nvfx_transfer_map(struct pipe_context *pipe, struct pipe_transfer *ptx)
{
- struct nv40_transfer *tx = (struct nv40_transfer *)ptx;
+ struct pipe_screen *pscreen = pipe->screen;
+ struct nvfx_transfer *tx = (struct nvfx_transfer *)ptx;
struct nv04_surface *ns = (struct nv04_surface *)tx->surface;
- struct nv40_miptree *mt = (struct nv40_miptree *)tx->surface->texture;
+ struct nvfx_miptree *mt = (struct nvfx_miptree *)tx->surface->texture;
void *map = pipe_buffer_map(pscreen, mt->buffer,
pipe_transfer_buffer_flags(ptx));
@@ -160,19 +165,20 @@ nv40_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
}
static void
-nv40_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+nvfx_transfer_unmap(struct pipe_context *pipe, struct pipe_transfer *ptx)
{
- struct nv40_transfer *tx = (struct nv40_transfer *)ptx;
- struct nv40_miptree *mt = (struct nv40_miptree *)tx->surface->texture;
+ struct pipe_screen *pscreen = pipe->screen;
+ struct nvfx_transfer *tx = (struct nvfx_transfer *)ptx;
+ struct nvfx_miptree *mt = (struct nvfx_miptree *)tx->surface->texture;
pipe_buffer_unmap(pscreen, mt->buffer);
}
void
-nv40_screen_init_transfer_functions(struct pipe_screen *pscreen)
+nvfx_init_transfer_functions(struct nvfx_context *nvfx)
{
- pscreen->get_tex_transfer = nv40_transfer_new;
- pscreen->tex_transfer_destroy = nv40_transfer_del;
- pscreen->transfer_map = nv40_transfer_map;
- pscreen->transfer_unmap = nv40_transfer_unmap;
+ nvfx->pipe.get_tex_transfer = nvfx_transfer_new;
+ nvfx->pipe.tex_transfer_destroy = nvfx_transfer_del;
+ nvfx->pipe.transfer_map = nvfx_transfer_map;
+ nvfx->pipe.transfer_unmap = nvfx_transfer_unmap;
}
diff --git a/src/gallium/drivers/nv30/nv30_vbo.c b/src/gallium/drivers/nvfx/nvfx_vbo.c
index e48823a913..c26536b0e7 100644
--- a/src/gallium/drivers/nv30/nv30_vbo.c
+++ b/src/gallium/drivers/nvfx/nvfx_vbo.c
@@ -3,17 +3,24 @@
#include "util/u_inlines.h"
#include "util/u_format.h"
-#include "nv30_context.h"
-#include "nv30_state.h"
+#include "nvfx_context.h"
+#include "nvfx_state.h"
#include "nouveau/nouveau_channel.h"
#include "nouveau/nouveau_pushbuf.h"
#include "nouveau/nouveau_util.h"
-#define FORCE_SWTNL 0
+static boolean
+nvfx_force_swtnl(struct nvfx_context *nvfx)
+{
+ static int force_swtnl = -1;
+ if(force_swtnl < 0)
+ force_swtnl = debug_get_bool_option("NOUVEAU_SWTNL", 0);
+ return force_swtnl;
+}
static INLINE int
-nv30_vbo_format_to_hw(enum pipe_format pipe, unsigned *fmt, unsigned *ncomp)
+nvfx_vbo_format_to_hw(enum pipe_format pipe, unsigned *fmt, unsigned *ncomp)
{
switch (pipe) {
case PIPE_FORMAT_R32_FLOAT:
@@ -69,15 +76,15 @@ nv30_vbo_format_to_hw(enum pipe_format pipe, unsigned *fmt, unsigned *ncomp)
}
static boolean
-nv30_vbo_set_idxbuf(struct nv30_context *nv30, struct pipe_buffer *ib,
+nvfx_vbo_set_idxbuf(struct nvfx_context *nvfx, struct pipe_buffer *ib,
unsigned ib_size)
{
- struct pipe_screen *pscreen = &nv30->screen->base.base;
+ struct pipe_screen *pscreen = &nvfx->screen->base.base;
unsigned type;
if (!ib) {
- nv30->idxbuf = NULL;
- nv30->idxbuf_format = 0xdeadbeef;
+ nvfx->idxbuf = NULL;
+ nvfx->idxbuf_format = 0xdeadbeef;
return FALSE;
}
@@ -95,27 +102,27 @@ nv30_vbo_set_idxbuf(struct nv30_context *nv30, struct pipe_buffer *ib,
return FALSE;
}
- if (ib != nv30->idxbuf ||
- type != nv30->idxbuf_format) {
- nv30->dirty |= NV30_NEW_ARRAYS;
- nv30->idxbuf = ib;
- nv30->idxbuf_format = type;
+ if (ib != nvfx->idxbuf ||
+ type != nvfx->idxbuf_format) {
+ nvfx->dirty |= NVFX_NEW_ARRAYS;
+ nvfx->idxbuf = ib;
+ nvfx->idxbuf_format = type;
}
return TRUE;
}
static boolean
-nv30_vbo_static_attrib(struct nv30_context *nv30, struct nouveau_stateobj *so,
+nvfx_vbo_static_attrib(struct nvfx_context *nvfx, struct nouveau_stateobj *so,
int attrib, struct pipe_vertex_element *ve,
struct pipe_vertex_buffer *vb)
{
- struct pipe_screen *pscreen = nv30->pipe.screen;
- struct nouveau_grobj *rankine = nv30->screen->rankine;
+ struct pipe_screen *pscreen = nvfx->pipe.screen;
+ struct nouveau_grobj *eng3d = nvfx->screen->eng3d;
unsigned type, ncomp;
void *map;
- if (nv30_vbo_format_to_hw(ve->src_format, &type, &ncomp))
+ if (nvfx_vbo_format_to_hw(ve->src_format, &type, &ncomp))
return FALSE;
map = pipe_buffer_map(pscreen, vb->buffer, PIPE_BUFFER_USAGE_CPU_READ);
@@ -128,25 +135,25 @@ nv30_vbo_static_attrib(struct nv30_context *nv30, struct nouveau_stateobj *so,
switch (ncomp) {
case 4:
- so_method(so, rankine, NV34TCL_VTX_ATTR_4F_X(attrib), 4);
+ so_method(so, eng3d, NV34TCL_VTX_ATTR_4F_X(attrib), 4);
so_data (so, fui(v[0]));
so_data (so, fui(v[1]));
so_data (so, fui(v[2]));
so_data (so, fui(v[3]));
break;
case 3:
- so_method(so, rankine, NV34TCL_VTX_ATTR_3F_X(attrib), 3);
+ so_method(so, eng3d, NV34TCL_VTX_ATTR_3F_X(attrib), 3);
so_data (so, fui(v[0]));
so_data (so, fui(v[1]));
so_data (so, fui(v[2]));
break;
case 2:
- so_method(so, rankine, NV34TCL_VTX_ATTR_2F_X(attrib), 2);
+ so_method(so, eng3d, NV34TCL_VTX_ATTR_2F_X(attrib), 2);
so_data (so, fui(v[0]));
so_data (so, fui(v[1]));
break;
case 1:
- so_method(so, rankine, NV34TCL_VTX_ATTR_1F(attrib), 1);
+ so_method(so, eng3d, NV34TCL_VTX_ATTR_1F(attrib), 1);
so_data (so, fui(v[0]));
break;
default:
@@ -165,26 +172,26 @@ nv30_vbo_static_attrib(struct nv30_context *nv30, struct nouveau_stateobj *so,
}
void
-nv30_draw_arrays(struct pipe_context *pipe,
+nvfx_draw_arrays(struct pipe_context *pipe,
unsigned mode, unsigned start, unsigned count)
{
- struct nv30_context *nv30 = nv30_context(pipe);
- struct nv30_screen *screen = nv30->screen;
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+ struct nvfx_screen *screen = nvfx->screen;
struct nouveau_channel *chan = screen->base.channel;
- struct nouveau_grobj *rankine = screen->rankine;
+ struct nouveau_grobj *eng3d = screen->eng3d;
unsigned restart = 0;
- nv30_vbo_set_idxbuf(nv30, NULL, 0);
- if (FORCE_SWTNL || !nv30_state_validate(nv30)) {
- /*return nv30_draw_elements_swtnl(pipe, NULL, 0,
- mode, start, count);*/
- return;
+ nvfx_vbo_set_idxbuf(nvfx, NULL, 0);
+ if (nvfx_force_swtnl(nvfx) || !nvfx_state_validate(nvfx)) {
+ nvfx_draw_elements_swtnl(pipe, NULL, 0,
+ mode, start, count);
+ return;
}
while (count) {
unsigned vc, nr;
- nv30_state_emit(nv30);
+ nvfx_state_emit(nvfx);
vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 256,
mode, start, count, &restart);
@@ -193,12 +200,12 @@ nv30_draw_arrays(struct pipe_context *pipe,
continue;
}
- BEGIN_RING(chan, rankine, NV34TCL_VERTEX_BEGIN_END, 1);
+ BEGIN_RING(chan, eng3d, NV34TCL_VERTEX_BEGIN_END, 1);
OUT_RING (chan, nvgl_primitive(mode));
nr = (vc & 0xff);
if (nr) {
- BEGIN_RING(chan, rankine, NV34TCL_VB_VERTEX_BATCH, 1);
+ BEGIN_RING(chan, eng3d, NV34TCL_VB_VERTEX_BATCH, 1);
OUT_RING (chan, ((nr - 1) << 24) | start);
start += nr;
}
@@ -209,14 +216,14 @@ nv30_draw_arrays(struct pipe_context *pipe,
nr -= push;
- BEGIN_RING_NI(chan, rankine, NV34TCL_VB_VERTEX_BATCH, push);
+ BEGIN_RING_NI(chan, eng3d, NV34TCL_VB_VERTEX_BATCH, push);
while (push--) {
OUT_RING(chan, ((0x100 - 1) << 24) | start);
start += 0x100;
}
}
- BEGIN_RING(chan, rankine, NV34TCL_VERTEX_BEGIN_END, 1);
+ BEGIN_RING(chan, eng3d, NV34TCL_VERTEX_BEGIN_END, 1);
OUT_RING (chan, 0);
count -= vc;
@@ -227,18 +234,18 @@ nv30_draw_arrays(struct pipe_context *pipe,
}
static INLINE void
-nv30_draw_elements_u08(struct nv30_context *nv30, void *ib,
+nvfx_draw_elements_u08(struct nvfx_context *nvfx, void *ib,
unsigned mode, unsigned start, unsigned count)
{
- struct nv30_screen *screen = nv30->screen;
+ struct nvfx_screen *screen = nvfx->screen;
struct nouveau_channel *chan = screen->base.channel;
- struct nouveau_grobj *rankine = screen->rankine;
+ struct nouveau_grobj *eng3d = screen->eng3d;
while (count) {
uint8_t *elts = (uint8_t *)ib + start;
unsigned vc, push, restart = 0;
- nv30_state_emit(nv30);
+ nvfx_state_emit(nvfx);
vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 2,
mode, start, count, &restart);
@@ -248,11 +255,11 @@ nv30_draw_elements_u08(struct nv30_context *nv30, void *ib,
}
count -= vc;
- BEGIN_RING(chan, rankine, NV34TCL_VERTEX_BEGIN_END, 1);
+ BEGIN_RING(chan, eng3d, NV34TCL_VERTEX_BEGIN_END, 1);
OUT_RING (chan, nvgl_primitive(mode));
if (vc & 1) {
- BEGIN_RING(chan, rankine, NV34TCL_VB_ELEMENT_U32, 1);
+ BEGIN_RING(chan, eng3d, NV34TCL_VB_ELEMENT_U32, 1);
OUT_RING (chan, elts[0]);
elts++; vc--;
}
@@ -262,7 +269,7 @@ nv30_draw_elements_u08(struct nv30_context *nv30, void *ib,
push = MIN2(vc, 2047 * 2);
- BEGIN_RING_NI(chan, rankine, NV34TCL_VB_ELEMENT_U16, push >> 1);
+ BEGIN_RING_NI(chan, eng3d, NV34TCL_VB_ELEMENT_U16, push >> 1);
for (i = 0; i < push; i+=2)
OUT_RING(chan, (elts[i+1] << 16) | elts[i]);
@@ -270,7 +277,7 @@ nv30_draw_elements_u08(struct nv30_context *nv30, void *ib,
elts += push;
}
- BEGIN_RING(chan, rankine, NV34TCL_VERTEX_BEGIN_END, 1);
+ BEGIN_RING(chan, eng3d, NV34TCL_VERTEX_BEGIN_END, 1);
OUT_RING (chan, 0);
start = restart;
@@ -278,18 +285,18 @@ nv30_draw_elements_u08(struct nv30_context *nv30, void *ib,
}
static INLINE void
-nv30_draw_elements_u16(struct nv30_context *nv30, void *ib,
+nvfx_draw_elements_u16(struct nvfx_context *nvfx, void *ib,
unsigned mode, unsigned start, unsigned count)
{
- struct nv30_screen *screen = nv30->screen;
+ struct nvfx_screen *screen = nvfx->screen;
struct nouveau_channel *chan = screen->base.channel;
- struct nouveau_grobj *rankine = screen->rankine;
+ struct nouveau_grobj *eng3d = screen->eng3d;
while (count) {
uint16_t *elts = (uint16_t *)ib + start;
unsigned vc, push, restart = 0;
- nv30_state_emit(nv30);
+ nvfx_state_emit(nvfx);
vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 2,
mode, start, count, &restart);
@@ -299,11 +306,11 @@ nv30_draw_elements_u16(struct nv30_context *nv30, void *ib,
}
count -= vc;
- BEGIN_RING(chan, rankine, NV34TCL_VERTEX_BEGIN_END, 1);
+ BEGIN_RING(chan, eng3d, NV34TCL_VERTEX_BEGIN_END, 1);
OUT_RING (chan, nvgl_primitive(mode));
if (vc & 1) {
- BEGIN_RING(chan, rankine, NV34TCL_VB_ELEMENT_U32, 1);
+ BEGIN_RING(chan, eng3d, NV34TCL_VB_ELEMENT_U32, 1);
OUT_RING (chan, elts[0]);
elts++; vc--;
}
@@ -313,7 +320,7 @@ nv30_draw_elements_u16(struct nv30_context *nv30, void *ib,
push = MIN2(vc, 2047 * 2);
- BEGIN_RING_NI(chan, rankine, NV34TCL_VB_ELEMENT_U16, push >> 1);
+ BEGIN_RING_NI(chan, eng3d, NV34TCL_VB_ELEMENT_U16, push >> 1);
for (i = 0; i < push; i+=2)
OUT_RING(chan, (elts[i+1] << 16) | elts[i]);
@@ -321,7 +328,7 @@ nv30_draw_elements_u16(struct nv30_context *nv30, void *ib,
elts += push;
}
- BEGIN_RING(chan, rankine, NV34TCL_VERTEX_BEGIN_END, 1);
+ BEGIN_RING(chan, eng3d, NV34TCL_VERTEX_BEGIN_END, 1);
OUT_RING (chan, 0);
start = restart;
@@ -329,18 +336,18 @@ nv30_draw_elements_u16(struct nv30_context *nv30, void *ib,
}
static INLINE void
-nv30_draw_elements_u32(struct nv30_context *nv30, void *ib,
+nvfx_draw_elements_u32(struct nvfx_context *nvfx, void *ib,
unsigned mode, unsigned start, unsigned count)
{
- struct nv30_screen *screen = nv30->screen;
+ struct nvfx_screen *screen = nvfx->screen;
struct nouveau_channel *chan = screen->base.channel;
- struct nouveau_grobj *rankine = screen->rankine;
+ struct nouveau_grobj *eng3d = screen->eng3d;
while (count) {
uint32_t *elts = (uint32_t *)ib + start;
unsigned vc, push, restart = 0;
- nv30_state_emit(nv30);
+ nvfx_state_emit(nvfx);
vc = nouveau_vbuf_split(AVAIL_RING(chan), 5, 1,
mode, start, count, &restart);
@@ -350,20 +357,20 @@ nv30_draw_elements_u32(struct nv30_context *nv30, void *ib,
}
count -= vc;
- BEGIN_RING(chan, rankine, NV34TCL_VERTEX_BEGIN_END, 1);
+ BEGIN_RING(chan, eng3d, NV34TCL_VERTEX_BEGIN_END, 1);
OUT_RING (chan, nvgl_primitive(mode));
while (vc) {
push = MIN2(vc, 2047);
- BEGIN_RING_NI(chan, rankine, NV34TCL_VB_ELEMENT_U32, push);
+ BEGIN_RING_NI(chan, eng3d, NV34TCL_VB_ELEMENT_U32, push);
OUT_RINGp (chan, elts, push);
vc -= push;
elts += push;
}
- BEGIN_RING(chan, rankine, NV34TCL_VERTEX_BEGIN_END, 1);
+ BEGIN_RING(chan, eng3d, NV34TCL_VERTEX_BEGIN_END, 1);
OUT_RING (chan, 0);
start = restart;
@@ -371,11 +378,11 @@ nv30_draw_elements_u32(struct nv30_context *nv30, void *ib,
}
static void
-nv30_draw_elements_inline(struct pipe_context *pipe,
+nvfx_draw_elements_inline(struct pipe_context *pipe,
struct pipe_buffer *ib, unsigned ib_size,
unsigned mode, unsigned start, unsigned count)
{
- struct nv30_context *nv30 = nv30_context(pipe);
+ struct nvfx_context *nvfx = nvfx_context(pipe);
struct pipe_screen *pscreen = pipe->screen;
void *map;
@@ -387,13 +394,13 @@ nv30_draw_elements_inline(struct pipe_context *pipe,
switch (ib_size) {
case 1:
- nv30_draw_elements_u08(nv30, map, mode, start, count);
+ nvfx_draw_elements_u08(nvfx, map, mode, start, count);
break;
case 2:
- nv30_draw_elements_u16(nv30, map, mode, start, count);
+ nvfx_draw_elements_u16(nvfx, map, mode, start, count);
break;
case 4:
- nv30_draw_elements_u32(nv30, map, mode, start, count);
+ nvfx_draw_elements_u32(nvfx, map, mode, start, count);
break;
default:
NOUVEAU_ERR("invalid idxbuf fmt %d\n", ib_size);
@@ -404,19 +411,19 @@ nv30_draw_elements_inline(struct pipe_context *pipe,
}
static void
-nv30_draw_elements_vbo(struct pipe_context *pipe,
+nvfx_draw_elements_vbo(struct pipe_context *pipe,
unsigned mode, unsigned start, unsigned count)
{
- struct nv30_context *nv30 = nv30_context(pipe);
- struct nv30_screen *screen = nv30->screen;
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+ struct nvfx_screen *screen = nvfx->screen;
struct nouveau_channel *chan = screen->base.channel;
- struct nouveau_grobj *rankine = screen->rankine;
+ struct nouveau_grobj *eng3d = screen->eng3d;
unsigned restart = 0;
while (count) {
unsigned nr, vc;
- nv30_state_emit(nv30);
+ nvfx_state_emit(nvfx);
vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 256,
mode, start, count, &restart);
@@ -425,12 +432,12 @@ nv30_draw_elements_vbo(struct pipe_context *pipe,
continue;
}
- BEGIN_RING(chan, rankine, NV34TCL_VERTEX_BEGIN_END, 1);
+ BEGIN_RING(chan, eng3d, NV34TCL_VERTEX_BEGIN_END, 1);
OUT_RING (chan, nvgl_primitive(mode));
nr = (vc & 0xff);
if (nr) {
- BEGIN_RING(chan, rankine, NV34TCL_VB_INDEX_BATCH, 1);
+ BEGIN_RING(chan, eng3d, NV34TCL_VB_INDEX_BATCH, 1);
OUT_RING (chan, ((nr - 1) << 24) | start);
start += nr;
}
@@ -441,14 +448,14 @@ nv30_draw_elements_vbo(struct pipe_context *pipe,
nr -= push;
- BEGIN_RING_NI(chan, rankine, NV34TCL_VB_INDEX_BATCH, push);
+ BEGIN_RING_NI(chan, eng3d, NV34TCL_VB_INDEX_BATCH, push);
while (push--) {
OUT_RING(chan, ((0x100 - 1) << 24) | start);
start += 0x100;
}
}
- BEGIN_RING(chan, rankine, NV34TCL_VERTEX_BEGIN_END, 1);
+ BEGIN_RING(chan, eng3d, NV34TCL_VERTEX_BEGIN_END, 1);
OUT_RING (chan, 0);
count -= vc;
@@ -457,24 +464,24 @@ nv30_draw_elements_vbo(struct pipe_context *pipe,
}
void
-nv30_draw_elements(struct pipe_context *pipe,
+nvfx_draw_elements(struct pipe_context *pipe,
struct pipe_buffer *indexBuffer, unsigned indexSize,
unsigned mode, unsigned start, unsigned count)
{
- struct nv30_context *nv30 = nv30_context(pipe);
+ struct nvfx_context *nvfx = nvfx_context(pipe);
boolean idxbuf;
- idxbuf = nv30_vbo_set_idxbuf(nv30, indexBuffer, indexSize);
- if (FORCE_SWTNL || !nv30_state_validate(nv30)) {
- /*return nv30_draw_elements_swtnl(pipe, NULL, 0,
- mode, start, count);*/
+ idxbuf = nvfx_vbo_set_idxbuf(nvfx, indexBuffer, indexSize);
+ if (nvfx_force_swtnl(nvfx) || !nvfx_state_validate(nvfx)) {
+ nvfx_draw_elements_swtnl(pipe, indexBuffer, indexSize,
+ mode, start, count);
return;
}
if (idxbuf) {
- nv30_draw_elements_vbo(pipe, mode, start, count);
+ nvfx_draw_elements_vbo(pipe, mode, start, count);
} else {
- nv30_draw_elements_inline(pipe, indexBuffer, indexSize,
+ nvfx_draw_elements_inline(pipe, indexBuffer, indexSize,
mode, start, count);
}
@@ -482,49 +489,50 @@ nv30_draw_elements(struct pipe_context *pipe,
}
static boolean
-nv30_vbo_validate(struct nv30_context *nv30)
+nvfx_vbo_validate(struct nvfx_context *nvfx)
{
struct nouveau_stateobj *vtxbuf, *vtxfmt, *sattr = NULL;
- struct nouveau_grobj *rankine = nv30->screen->rankine;
- struct pipe_buffer *ib = nv30->idxbuf;
- unsigned ib_format = nv30->idxbuf_format;
- unsigned vb_flags = NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_RD;
+ struct nouveau_grobj *eng3d = nvfx->screen->eng3d;
+ struct pipe_buffer *ib = nvfx->idxbuf;
+ unsigned ib_format = nvfx->idxbuf_format;
+ unsigned vb_flags = nvfx->screen->vertex_buffer_flags | NOUVEAU_BO_RD;
int hw;
vtxbuf = so_new(3, 17, 18);
- so_method(vtxbuf, rankine, NV34TCL_VTXBUF_ADDRESS(0), nv30->vtxelt_nr);
+ so_method(vtxbuf, eng3d, NV34TCL_VTXBUF_ADDRESS(0), nvfx->vtxelt->num_elements);
vtxfmt = so_new(1, 16, 0);
- so_method(vtxfmt, rankine, NV34TCL_VTXFMT(0), nv30->vtxelt_nr);
+ so_method(vtxfmt, eng3d, NV34TCL_VTXFMT(0), nvfx->vtxelt->num_elements);
- for (hw = 0; hw < nv30->vtxelt_nr; hw++) {
+ for (hw = 0; hw < nvfx->vtxelt->num_elements; hw++) {
struct pipe_vertex_element *ve;
struct pipe_vertex_buffer *vb;
unsigned type, ncomp;
- ve = &nv30->vtxelt[hw];
- vb = &nv30->vtxbuf[ve->vertex_buffer_index];
+ ve = &nvfx->vtxelt->pipe[hw];
+ vb = &nvfx->vtxbuf[ve->vertex_buffer_index];
if (!vb->stride) {
if (!sattr)
sattr = so_new(16, 16 * 4, 0);
- if (nv30_vbo_static_attrib(nv30, sattr, hw, ve, vb)) {
+ if (nvfx_vbo_static_attrib(nvfx, sattr, hw, ve, vb)) {
so_data(vtxbuf, 0);
so_data(vtxfmt, NV34TCL_VTXFMT_TYPE_FLOAT);
continue;
}
}
- if (nv30_vbo_format_to_hw(ve->src_format, &type, &ncomp)) {
- /*nv30->fallback_swtnl |= NV30_NEW_ARRAYS;*/
+ if (nvfx_vbo_format_to_hw(ve->src_format, &type, &ncomp)) {
+ nvfx->fallback_swtnl |= NVFX_NEW_ARRAYS;
so_ref(NULL, &vtxbuf);
so_ref(NULL, &vtxfmt);
return FALSE;
}
- so_reloc(vtxbuf, nouveau_bo(vb->buffer), vb->buffer_offset +
- ve->src_offset, vb_flags | NOUVEAU_BO_LOW |
- NOUVEAU_BO_OR, 0, NV34TCL_VTXBUF_ADDRESS_DMA1);
+ so_reloc(vtxbuf, nouveau_bo(vb->buffer),
+ vb->buffer_offset + ve->src_offset,
+ vb_flags | NOUVEAU_BO_LOW | NOUVEAU_BO_OR,
+ 0, NV34TCL_VTXBUF_ADDRESS_DMA1);
so_data (vtxfmt, ((vb->stride << NV34TCL_VTXFMT_STRIDE_SHIFT) |
(ncomp << NV34TCL_VTXFMT_SIZE_SHIFT) | type));
}
@@ -532,31 +540,31 @@ nv30_vbo_validate(struct nv30_context *nv30)
if (ib) {
struct nouveau_bo *bo = nouveau_bo(ib);
- so_method(vtxbuf, rankine, NV34TCL_IDXBUF_ADDRESS, 2);
+ so_method(vtxbuf, eng3d, NV34TCL_IDXBUF_ADDRESS, 2);
so_reloc (vtxbuf, bo, 0, vb_flags | NOUVEAU_BO_LOW, 0, 0);
so_reloc (vtxbuf, bo, ib_format, vb_flags | NOUVEAU_BO_OR,
0, NV34TCL_IDXBUF_FORMAT_DMA1);
}
- so_method(vtxbuf, rankine, 0x1710, 1);
+ so_method(vtxbuf, eng3d, 0x1710, 1);
so_data (vtxbuf, 0);
- so_ref(vtxbuf, &nv30->state.hw[NV30_STATE_VTXBUF]);
+ so_ref(vtxbuf, &nvfx->state.hw[NVFX_STATE_VTXBUF]);
so_ref(NULL, &vtxbuf);
- nv30->state.dirty |= (1ULL << NV30_STATE_VTXBUF);
- so_ref(vtxfmt, &nv30->state.hw[NV30_STATE_VTXFMT]);
+ nvfx->state.dirty |= (1ULL << NVFX_STATE_VTXBUF);
+ so_ref(vtxfmt, &nvfx->state.hw[NVFX_STATE_VTXFMT]);
so_ref(NULL, &vtxfmt);
- nv30->state.dirty |= (1ULL << NV30_STATE_VTXFMT);
- so_ref(sattr, &nv30->state.hw[NV30_STATE_VTXATTR]);
+ nvfx->state.dirty |= (1ULL << NVFX_STATE_VTXFMT);
+ so_ref(sattr, &nvfx->state.hw[NVFX_STATE_VTXATTR]);
so_ref(NULL, &sattr);
- nv30->state.dirty |= (1ULL << NV30_STATE_VTXATTR);
+ nvfx->state.dirty |= (1ULL << NVFX_STATE_VTXATTR);
return FALSE;
}
-struct nv30_state_entry nv30_state_vbo = {
- .validate = nv30_vbo_validate,
+struct nvfx_state_entry nvfx_state_vbo = {
+ .validate = nvfx_vbo_validate,
.dirty = {
- .pipe = NV30_NEW_ARRAYS,
+ .pipe = NVFX_NEW_ARRAYS,
.hw = 0,
}
};
diff --git a/src/gallium/drivers/nv40/nv40_vertprog.c b/src/gallium/drivers/nvfx/nvfx_vertprog.c
index c93c5d127c..2d243be16a 100644
--- a/src/gallium/drivers/nv40/nv40_vertprog.c
+++ b/src/gallium/drivers/nvfx/nvfx_vertprog.c
@@ -5,10 +5,11 @@
#include "pipe/p_shader_tokens.h"
#include "tgsi/tgsi_parse.h"
+#include "tgsi/tgsi_dump.h"
#include "tgsi/tgsi_util.h"
-#include "nv40_context.h"
-#include "nv40_state.h"
+#include "nvfx_context.h"
+#include "nvfx_state.h"
/* TODO (at least...):
* 1. Indexed consts + ARL
@@ -21,76 +22,62 @@
* 4. bugs
*/
-#define SWZ_X 0
-#define SWZ_Y 1
-#define SWZ_Z 2
-#define SWZ_W 3
-#define MASK_X 8
-#define MASK_Y 4
-#define MASK_Z 2
-#define MASK_W 1
-#define MASK_ALL (MASK_X|MASK_Y|MASK_Z|MASK_W)
-#define DEF_SCALE 0
-#define DEF_CTEST 0
-#include "nv40_shader.h"
+#include "nv30_vertprog.h"
+#include "nv40_vertprog.h"
-#define swz(s,x,y,z,w) nv40_sr_swz((s), SWZ_##x, SWZ_##y, SWZ_##z, SWZ_##w)
-#define neg(s) nv40_sr_neg((s))
-#define abs(s) nv40_sr_abs((s))
+#define NVFX_VP_INST_DEST_CLIP(n) ((~0 - 6) + (n))
-#define NV40_VP_INST_DEST_CLIP(n) ((~0 - 6) + (n))
+struct nvfx_vpc {
+ struct nvfx_vertex_program *vp;
-struct nv40_vpc {
- struct nv40_vertex_program *vp;
-
- struct nv40_vertex_program_exec *vpi;
+ struct nvfx_vertex_program_exec *vpi;
unsigned r_temps;
unsigned r_temps_discard;
- struct nv40_sreg r_result[PIPE_MAX_SHADER_OUTPUTS];
- struct nv40_sreg *r_address;
- struct nv40_sreg *r_temp;
+ struct nvfx_sreg r_result[PIPE_MAX_SHADER_OUTPUTS];
+ struct nvfx_sreg *r_address;
+ struct nvfx_sreg *r_temp;
- struct nv40_sreg *imm;
+ struct nvfx_sreg *imm;
unsigned nr_imm;
unsigned hpos_idx;
};
-static struct nv40_sreg
-temp(struct nv40_vpc *vpc)
+static struct nvfx_sreg
+temp(struct nvfx_vpc *vpc)
{
int idx = ffs(~vpc->r_temps) - 1;
if (idx < 0) {
NOUVEAU_ERR("out of temps!!\n");
assert(0);
- return nv40_sr(NV40SR_TEMP, 0);
+ return nvfx_sr(NVFXSR_TEMP, 0);
}
vpc->r_temps |= (1 << idx);
vpc->r_temps_discard |= (1 << idx);
- return nv40_sr(NV40SR_TEMP, idx);
+ return nvfx_sr(NVFXSR_TEMP, idx);
}
static INLINE void
-release_temps(struct nv40_vpc *vpc)
+release_temps(struct nvfx_vpc *vpc)
{
vpc->r_temps &= ~vpc->r_temps_discard;
vpc->r_temps_discard = 0;
}
-static struct nv40_sreg
-constant(struct nv40_vpc *vpc, int pipe, float x, float y, float z, float w)
+static struct nvfx_sreg
+constant(struct nvfx_vpc *vpc, int pipe, float x, float y, float z, float w)
{
- struct nv40_vertex_program *vp = vpc->vp;
- struct nv40_vertex_program_data *vpd;
+ struct nvfx_vertex_program *vp = vpc->vp;
+ struct nvfx_vertex_program_data *vpd;
int idx;
if (pipe >= 0) {
for (idx = 0; idx < vp->nr_consts; idx++) {
if (vp->consts[idx].index == pipe)
- return nv40_sr(NV40SR_CONST, idx);
+ return nvfx_sr(NVFXSR_CONST, idx);
}
}
@@ -103,70 +90,70 @@ constant(struct nv40_vpc *vpc, int pipe, float x, float y, float z, float w)
vpd->value[1] = y;
vpd->value[2] = z;
vpd->value[3] = w;
- return nv40_sr(NV40SR_CONST, idx);
+ return nvfx_sr(NVFXSR_CONST, idx);
}
#define arith(cc,s,o,d,m,s0,s1,s2) \
- nv40_vp_arith((cc), (s), NV40_VP_INST_##o, (d), (m), (s0), (s1), (s2))
+ nvfx_vp_arith(nvfx, (cc), NVFX_VP_INST_SLOT_##s, NVFX_VP_INST_##s##_OP_##o, (d), (m), (s0), (s1), (s2))
static void
-emit_src(struct nv40_vpc *vpc, uint32_t *hw, int pos, struct nv40_sreg src)
+emit_src(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, uint32_t *hw, int pos, struct nvfx_sreg src)
{
- struct nv40_vertex_program *vp = vpc->vp;
+ struct nvfx_vertex_program *vp = vpc->vp;
uint32_t sr = 0;
switch (src.type) {
- case NV40SR_TEMP:
- sr |= (NV40_VP_SRC_REG_TYPE_TEMP << NV40_VP_SRC_REG_TYPE_SHIFT);
- sr |= (src.index << NV40_VP_SRC_TEMP_SRC_SHIFT);
+ case NVFXSR_TEMP:
+ sr |= (NVFX_VP(SRC_REG_TYPE_TEMP) << NVFX_VP(SRC_REG_TYPE_SHIFT));
+ sr |= (src.index << NVFX_VP(SRC_TEMP_SRC_SHIFT));
break;
- case NV40SR_INPUT:
- sr |= (NV40_VP_SRC_REG_TYPE_INPUT <<
- NV40_VP_SRC_REG_TYPE_SHIFT);
+ case NVFXSR_INPUT:
+ sr |= (NVFX_VP(SRC_REG_TYPE_INPUT) <<
+ NVFX_VP(SRC_REG_TYPE_SHIFT));
vp->ir |= (1 << src.index);
- hw[1] |= (src.index << NV40_VP_INST_INPUT_SRC_SHIFT);
+ hw[1] |= (src.index << NVFX_VP(INST_INPUT_SRC_SHIFT));
break;
- case NV40SR_CONST:
- sr |= (NV40_VP_SRC_REG_TYPE_CONST <<
- NV40_VP_SRC_REG_TYPE_SHIFT);
+ case NVFXSR_CONST:
+ sr |= (NVFX_VP(SRC_REG_TYPE_CONST) <<
+ NVFX_VP(SRC_REG_TYPE_SHIFT));
assert(vpc->vpi->const_index == -1 ||
vpc->vpi->const_index == src.index);
vpc->vpi->const_index = src.index;
break;
- case NV40SR_NONE:
- sr |= (NV40_VP_SRC_REG_TYPE_INPUT <<
- NV40_VP_SRC_REG_TYPE_SHIFT);
+ case NVFXSR_NONE:
+ sr |= (NVFX_VP(SRC_REG_TYPE_INPUT) <<
+ NVFX_VP(SRC_REG_TYPE_SHIFT));
break;
default:
assert(0);
}
if (src.negate)
- sr |= NV40_VP_SRC_NEGATE;
+ sr |= NVFX_VP(SRC_NEGATE);
if (src.abs)
hw[0] |= (1 << (21 + pos));
- sr |= ((src.swz[0] << NV40_VP_SRC_SWZ_X_SHIFT) |
- (src.swz[1] << NV40_VP_SRC_SWZ_Y_SHIFT) |
- (src.swz[2] << NV40_VP_SRC_SWZ_Z_SHIFT) |
- (src.swz[3] << NV40_VP_SRC_SWZ_W_SHIFT));
+ sr |= ((src.swz[0] << NVFX_VP(SRC_SWZ_X_SHIFT)) |
+ (src.swz[1] << NVFX_VP(SRC_SWZ_Y_SHIFT)) |
+ (src.swz[2] << NVFX_VP(SRC_SWZ_Z_SHIFT)) |
+ (src.swz[3] << NVFX_VP(SRC_SWZ_W_SHIFT)));
switch (pos) {
case 0:
- hw[1] |= ((sr & NV40_VP_SRC0_HIGH_MASK) >>
- NV40_VP_SRC0_HIGH_SHIFT) << NV40_VP_INST_SRC0H_SHIFT;
- hw[2] |= (sr & NV40_VP_SRC0_LOW_MASK) <<
- NV40_VP_INST_SRC0L_SHIFT;
+ hw[1] |= ((sr & NVFX_VP(SRC0_HIGH_MASK)) >>
+ NVFX_VP(SRC0_HIGH_SHIFT)) << NVFX_VP(INST_SRC0H_SHIFT);
+ hw[2] |= (sr & NVFX_VP(SRC0_LOW_MASK)) <<
+ NVFX_VP(INST_SRC0L_SHIFT);
break;
case 1:
- hw[2] |= sr << NV40_VP_INST_SRC1_SHIFT;
+ hw[2] |= sr << NVFX_VP(INST_SRC1_SHIFT);
break;
case 2:
- hw[2] |= ((sr & NV40_VP_SRC2_HIGH_MASK) >>
- NV40_VP_SRC2_HIGH_SHIFT) << NV40_VP_INST_SRC2H_SHIFT;
- hw[3] |= (sr & NV40_VP_SRC2_LOW_MASK) <<
- NV40_VP_INST_SRC2L_SHIFT;
+ hw[2] |= ((sr & NVFX_VP(SRC2_HIGH_MASK)) >>
+ NVFX_VP(SRC2_HIGH_SHIFT)) << NVFX_VP(INST_SRC2H_SHIFT);
+ hw[3] |= (sr & NVFX_VP(SRC2_LOW_MASK)) <<
+ NVFX_VP(INST_SRC2L_SHIFT);
break;
default:
assert(0);
@@ -174,78 +161,114 @@ emit_src(struct nv40_vpc *vpc, uint32_t *hw, int pos, struct nv40_sreg src)
}
static void
-emit_dst(struct nv40_vpc *vpc, uint32_t *hw, int slot, struct nv40_sreg dst)
+emit_dst(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, uint32_t *hw, int slot, struct nvfx_sreg dst)
{
- struct nv40_vertex_program *vp = vpc->vp;
+ struct nvfx_vertex_program *vp = vpc->vp;
switch (dst.type) {
- case NV40SR_TEMP:
- hw[3] |= NV40_VP_INST_DEST_MASK;
- if (slot == 0) {
- hw[0] |= (dst.index <<
- NV40_VP_INST_VEC_DEST_TEMP_SHIFT);
- } else {
- hw[3] |= (dst.index <<
- NV40_VP_INST_SCA_DEST_TEMP_SHIFT);
+ case NVFXSR_TEMP:
+ if(!nvfx->is_nv4x)
+ hw[0] |= (dst.index << NV30_VP_INST_DEST_TEMP_ID_SHIFT);
+ else {
+ hw[3] |= NV40_VP_INST_DEST_MASK;
+ if (slot == 0) {
+ hw[0] |= (dst.index <<
+ NV40_VP_INST_VEC_DEST_TEMP_SHIFT);
+ } else {
+ hw[3] |= (dst.index <<
+ NV40_VP_INST_SCA_DEST_TEMP_SHIFT);
+ }
}
break;
- case NV40SR_OUTPUT:
+ case NVFXSR_OUTPUT:
+ /* TODO: this may be wrong because on nv30 COL0 and BFC0 are swapped */
switch (dst.index) {
- case NV40_VP_INST_DEST_COL0 : vp->or |= (1 << 0); break;
- case NV40_VP_INST_DEST_COL1 : vp->or |= (1 << 1); break;
- case NV40_VP_INST_DEST_BFC0 : vp->or |= (1 << 2); break;
- case NV40_VP_INST_DEST_BFC1 : vp->or |= (1 << 3); break;
- case NV40_VP_INST_DEST_FOGC : vp->or |= (1 << 4); break;
- case NV40_VP_INST_DEST_PSZ : vp->or |= (1 << 5); break;
- case NV40_VP_INST_DEST_TC(0): vp->or |= (1 << 14); break;
- case NV40_VP_INST_DEST_TC(1): vp->or |= (1 << 15); break;
- case NV40_VP_INST_DEST_TC(2): vp->or |= (1 << 16); break;
- case NV40_VP_INST_DEST_TC(3): vp->or |= (1 << 17); break;
- case NV40_VP_INST_DEST_TC(4): vp->or |= (1 << 18); break;
- case NV40_VP_INST_DEST_TC(5): vp->or |= (1 << 19); break;
- case NV40_VP_INST_DEST_TC(6): vp->or |= (1 << 20); break;
- case NV40_VP_INST_DEST_TC(7): vp->or |= (1 << 21); break;
- case NV40_VP_INST_DEST_CLIP(0):
+ case NVFX_VP_INST_DEST_CLIP(0):
vp->or |= (1 << 6);
- vp->clip_ctrl |= NV40TCL_CLIP_PLANE_ENABLE_PLANE0;
- dst.index = NV40_VP_INST_DEST_FOGC;
+ vp->clip_ctrl |= NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE0;
+ dst.index = NVFX_VP(INST_DEST_FOGC);
break;
- case NV40_VP_INST_DEST_CLIP(1):
+ case NVFX_VP_INST_DEST_CLIP(1):
vp->or |= (1 << 7);
- vp->clip_ctrl |= NV40TCL_CLIP_PLANE_ENABLE_PLANE1;
- dst.index = NV40_VP_INST_DEST_FOGC;
+ vp->clip_ctrl |= NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE1;
+ dst.index = NVFX_VP(INST_DEST_FOGC);
break;
- case NV40_VP_INST_DEST_CLIP(2):
+ case NVFX_VP_INST_DEST_CLIP(2):
vp->or |= (1 << 8);
- vp->clip_ctrl |= NV40TCL_CLIP_PLANE_ENABLE_PLANE2;
- dst.index = NV40_VP_INST_DEST_FOGC;
+ vp->clip_ctrl |= NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE2;
+ dst.index = NVFX_VP(INST_DEST_FOGC);
break;
- case NV40_VP_INST_DEST_CLIP(3):
+ case NVFX_VP_INST_DEST_CLIP(3):
vp->or |= (1 << 9);
- vp->clip_ctrl |= NV40TCL_CLIP_PLANE_ENABLE_PLANE3;
- dst.index = NV40_VP_INST_DEST_PSZ;
+ vp->clip_ctrl |= NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE3;
+ dst.index = NVFX_VP(INST_DEST_PSZ);
break;
- case NV40_VP_INST_DEST_CLIP(4):
+ case NVFX_VP_INST_DEST_CLIP(4):
vp->or |= (1 << 10);
- vp->clip_ctrl |= NV40TCL_CLIP_PLANE_ENABLE_PLANE4;
- dst.index = NV40_VP_INST_DEST_PSZ;
+ vp->clip_ctrl |= NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE4;
+ dst.index = NVFX_VP(INST_DEST_PSZ);
break;
- case NV40_VP_INST_DEST_CLIP(5):
+ case NVFX_VP_INST_DEST_CLIP(5):
vp->or |= (1 << 11);
- vp->clip_ctrl |= NV40TCL_CLIP_PLANE_ENABLE_PLANE5;
- dst.index = NV40_VP_INST_DEST_PSZ;
+ vp->clip_ctrl |= NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE5;
+ dst.index = NVFX_VP(INST_DEST_PSZ);
break;
default:
+ if(!nvfx->is_nv4x) {
+ switch (dst.index) {
+ case NV30_VP_INST_DEST_COL0 : vp->or |= (1 << 0); break;
+ case NV30_VP_INST_DEST_COL1 : vp->or |= (1 << 1); break;
+ case NV30_VP_INST_DEST_BFC0 : vp->or |= (1 << 2); break;
+ case NV30_VP_INST_DEST_BFC1 : vp->or |= (1 << 3); break;
+ case NV30_VP_INST_DEST_FOGC: vp->or |= (1 << 4); break;
+ case NV30_VP_INST_DEST_PSZ : vp->or |= (1 << 5); break;
+ case NV30_VP_INST_DEST_TC(0): vp->or |= (1 << 14); break;
+ case NV30_VP_INST_DEST_TC(1): vp->or |= (1 << 15); break;
+ case NV30_VP_INST_DEST_TC(2): vp->or |= (1 << 16); break;
+ case NV30_VP_INST_DEST_TC(3): vp->or |= (1 << 17); break;
+ case NV30_VP_INST_DEST_TC(4): vp->or |= (1 << 18); break;
+ case NV30_VP_INST_DEST_TC(5): vp->or |= (1 << 19); break;
+ case NV30_VP_INST_DEST_TC(6): vp->or |= (1 << 20); break;
+ case NV30_VP_INST_DEST_TC(7): vp->or |= (1 << 21); break;
+ }
+ } else {
+ switch (dst.index) {
+ case NV40_VP_INST_DEST_COL0 : vp->or |= (1 << 0); break;
+ case NV40_VP_INST_DEST_COL1 : vp->or |= (1 << 1); break;
+ case NV40_VP_INST_DEST_BFC0 : vp->or |= (1 << 2); break;
+ case NV40_VP_INST_DEST_BFC1 : vp->or |= (1 << 3); break;
+ case NV40_VP_INST_DEST_FOGC: vp->or |= (1 << 4); break;
+ case NV40_VP_INST_DEST_PSZ : vp->or |= (1 << 5); break;
+ case NV40_VP_INST_DEST_TC(0): vp->or |= (1 << 14); break;
+ case NV40_VP_INST_DEST_TC(1): vp->or |= (1 << 15); break;
+ case NV40_VP_INST_DEST_TC(2): vp->or |= (1 << 16); break;
+ case NV40_VP_INST_DEST_TC(3): vp->or |= (1 << 17); break;
+ case NV40_VP_INST_DEST_TC(4): vp->or |= (1 << 18); break;
+ case NV40_VP_INST_DEST_TC(5): vp->or |= (1 << 19); break;
+ case NV40_VP_INST_DEST_TC(6): vp->or |= (1 << 20); break;
+ case NV40_VP_INST_DEST_TC(7): vp->or |= (1 << 21); break;
+ }
+ }
break;
}
- hw[3] |= (dst.index << NV40_VP_INST_DEST_SHIFT);
- if (slot == 0) {
- hw[0] |= NV40_VP_INST_VEC_RESULT;
- hw[0] |= NV40_VP_INST_VEC_DEST_TEMP_MASK | (1<<20);
+ if(!nvfx->is_nv4x) {
+ hw[3] |= (dst.index << NV30_VP_INST_DEST_SHIFT);
+ hw[0] |= NV30_VP_INST_VEC_DEST_TEMP_MASK | (1<<20);
+
+ /*XXX: no way this is entirely correct, someone needs to
+ * figure out what exactly it is.
+ */
+ hw[3] |= 0x800;
} else {
- hw[3] |= NV40_VP_INST_SCA_RESULT;
- hw[3] |= NV40_VP_INST_SCA_DEST_TEMP_MASK;
+ hw[3] |= (dst.index << NV40_VP_INST_DEST_SHIFT);
+ if (slot == 0) {
+ hw[0] |= NV40_VP_INST_VEC_RESULT;
+ hw[0] |= NV40_VP_INST_VEC_DEST_TEMP_MASK | (1<<20);
+ } else {
+ hw[3] |= NV40_VP_INST_SCA_RESULT;
+ hw[3] |= NV40_VP_INST_SCA_DEST_TEMP_MASK;
+ }
}
break;
default:
@@ -254,12 +277,12 @@ emit_dst(struct nv40_vpc *vpc, uint32_t *hw, int slot, struct nv40_sreg dst)
}
static void
-nv40_vp_arith(struct nv40_vpc *vpc, int slot, int op,
- struct nv40_sreg dst, int mask,
- struct nv40_sreg s0, struct nv40_sreg s1,
- struct nv40_sreg s2)
+nvfx_vp_arith(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, int slot, int op,
+ struct nvfx_sreg dst, int mask,
+ struct nvfx_sreg s0, struct nvfx_sreg s1,
+ struct nvfx_sreg s2)
{
- struct nv40_vertex_program *vp = vpc->vp;
+ struct nvfx_vertex_program *vp = vpc->vp;
uint32_t *hw;
vp->insns = realloc(vp->insns, ++vp->nr_insns * sizeof(*vpc->vpi));
@@ -269,35 +292,53 @@ nv40_vp_arith(struct nv40_vpc *vpc, int slot, int op,
hw = vpc->vpi->data;
- hw[0] |= (NV40_VP_INST_COND_TR << NV40_VP_INST_COND_SHIFT);
- hw[0] |= ((0 << NV40_VP_INST_COND_SWZ_X_SHIFT) |
- (1 << NV40_VP_INST_COND_SWZ_Y_SHIFT) |
- (2 << NV40_VP_INST_COND_SWZ_Z_SHIFT) |
- (3 << NV40_VP_INST_COND_SWZ_W_SHIFT));
-
- if (slot == 0) {
- hw[1] |= (op << NV40_VP_INST_VEC_OPCODE_SHIFT);
- hw[3] |= NV40_VP_INST_SCA_DEST_TEMP_MASK;
- hw[3] |= (mask << NV40_VP_INST_VEC_WRITEMASK_SHIFT);
- } else {
- hw[1] |= (op << NV40_VP_INST_SCA_OPCODE_SHIFT);
- hw[0] |= (NV40_VP_INST_VEC_DEST_TEMP_MASK | (1 << 20));
- hw[3] |= (mask << NV40_VP_INST_SCA_WRITEMASK_SHIFT);
+ hw[0] |= (NVFX_COND_TR << NVFX_VP(INST_COND_SHIFT));
+ hw[0] |= ((0 << NVFX_VP(INST_COND_SWZ_X_SHIFT)) |
+ (1 << NVFX_VP(INST_COND_SWZ_Y_SHIFT)) |
+ (2 << NVFX_VP(INST_COND_SWZ_Z_SHIFT)) |
+ (3 << NVFX_VP(INST_COND_SWZ_W_SHIFT)));
+
+ if(!nvfx->is_nv4x) {
+ hw[1] |= (op << NV30_VP_INST_VEC_OPCODE_SHIFT);
+// hw[3] |= NVFX_VP(INST_SCA_DEST_TEMP_MASK);
+// hw[3] |= (mask << NVFX_VP(INST_VEC_WRITEMASK_SHIFT));
+
+ if (dst.type == NVFXSR_OUTPUT) {
+ if (slot)
+ hw[3] |= (mask << NV30_VP_INST_SDEST_WRITEMASK_SHIFT);
+ else
+ hw[3] |= (mask << NV30_VP_INST_VDEST_WRITEMASK_SHIFT);
+ } else {
+ if (slot)
+ hw[3] |= (mask << NV30_VP_INST_STEMP_WRITEMASK_SHIFT);
+ else
+ hw[3] |= (mask << NV30_VP_INST_VTEMP_WRITEMASK_SHIFT);
+ }
+ } else {
+ if (slot == 0) {
+ hw[1] |= (op << NV40_VP_INST_VEC_OPCODE_SHIFT);
+ hw[3] |= NV40_VP_INST_SCA_DEST_TEMP_MASK;
+ hw[3] |= (mask << NV40_VP_INST_VEC_WRITEMASK_SHIFT);
+ } else {
+ hw[1] |= (op << NV40_VP_INST_SCA_OPCODE_SHIFT);
+ hw[0] |= (NV40_VP_INST_VEC_DEST_TEMP_MASK | (1 << 20));
+ hw[3] |= (mask << NV40_VP_INST_SCA_WRITEMASK_SHIFT);
+ }
}
- emit_dst(vpc, hw, slot, dst);
- emit_src(vpc, hw, 0, s0);
- emit_src(vpc, hw, 1, s1);
- emit_src(vpc, hw, 2, s2);
+ emit_dst(nvfx, vpc, hw, slot, dst);
+ emit_src(nvfx, vpc, hw, 0, s0);
+ emit_src(nvfx, vpc, hw, 1, s1);
+ emit_src(nvfx, vpc, hw, 2, s2);
}
-static INLINE struct nv40_sreg
-tgsi_src(struct nv40_vpc *vpc, const struct tgsi_full_src_register *fsrc) {
- struct nv40_sreg src;
+static INLINE struct nvfx_sreg
+tgsi_src(struct nvfx_vpc *vpc, const struct tgsi_full_src_register *fsrc) {
+ struct nvfx_sreg src;
switch (fsrc->Register.File) {
case TGSI_FILE_INPUT:
- src = nv40_sr(NV40SR_INPUT, fsrc->Register.Index);
+ src = nvfx_sr(NVFXSR_INPUT, fsrc->Register.Index);
break;
case TGSI_FILE_CONSTANT:
src = constant(vpc, fsrc->Register.Index, 0, 0, 0, 0);
@@ -322,9 +363,9 @@ tgsi_src(struct nv40_vpc *vpc, const struct tgsi_full_src_register *fsrc) {
return src;
}
-static INLINE struct nv40_sreg
-tgsi_dst(struct nv40_vpc *vpc, const struct tgsi_full_dst_register *fdst) {
- struct nv40_sreg dst;
+static INLINE struct nvfx_sreg
+tgsi_dst(struct nvfx_vpc *vpc, const struct tgsi_full_dst_register *fdst) {
+ struct nvfx_sreg dst;
switch (fdst->Register.File) {
case TGSI_FILE_OUTPUT:
@@ -349,52 +390,19 @@ tgsi_mask(uint tgsi)
{
int mask = 0;
- if (tgsi & TGSI_WRITEMASK_X) mask |= MASK_X;
- if (tgsi & TGSI_WRITEMASK_Y) mask |= MASK_Y;
- if (tgsi & TGSI_WRITEMASK_Z) mask |= MASK_Z;
- if (tgsi & TGSI_WRITEMASK_W) mask |= MASK_W;
+ if (tgsi & TGSI_WRITEMASK_X) mask |= NVFX_VP_MASK_X;
+ if (tgsi & TGSI_WRITEMASK_Y) mask |= NVFX_VP_MASK_Y;
+ if (tgsi & TGSI_WRITEMASK_Z) mask |= NVFX_VP_MASK_Z;
+ if (tgsi & TGSI_WRITEMASK_W) mask |= NVFX_VP_MASK_W;
return mask;
}
static boolean
-src_native_swz(struct nv40_vpc *vpc, const struct tgsi_full_src_register *fsrc,
- struct nv40_sreg *src)
-{
- const struct nv40_sreg none = nv40_sr(NV40SR_NONE, 0);
- struct nv40_sreg tgsi = tgsi_src(vpc, fsrc);
- uint mask = 0;
- uint c;
-
- for (c = 0; c < 4; c++) {
- switch (tgsi_util_get_full_src_register_swizzle(fsrc, c)) {
- case TGSI_SWIZZLE_X:
- case TGSI_SWIZZLE_Y:
- case TGSI_SWIZZLE_Z:
- case TGSI_SWIZZLE_W:
- mask |= tgsi_mask(1 << c);
- break;
- default:
- assert(0);
- }
- }
-
- if (mask == MASK_ALL)
- return TRUE;
-
- *src = temp(vpc);
-
- if (mask)
- arith(vpc, 0, OP_MOV, *src, mask, tgsi, none, none);
-
- return FALSE;
-}
-
-static boolean
-nv40_vertprog_parse_instruction(struct nv40_vpc *vpc,
+nvfx_vertprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_vpc *vpc,
const struct tgsi_full_instruction *finst)
{
- struct nv40_sreg src[3], dst, tmp;
- struct nv40_sreg none = nv40_sr(NV40SR_NONE, 0);
+ struct nvfx_sreg src[3], dst, tmp;
+ struct nvfx_sreg none = nvfx_sr(NVFXSR_NONE, 0);
int mask;
int ai = -1, ci = -1, ii = -1;
int i;
@@ -418,23 +426,12 @@ nv40_vertprog_parse_instruction(struct nv40_vpc *vpc,
switch (fsrc->Register.File) {
case TGSI_FILE_INPUT:
- case TGSI_FILE_CONSTANT:
- case TGSI_FILE_TEMPORARY:
- if (!src_native_swz(vpc, fsrc, &src[i]))
- continue;
- break;
- default:
- break;
- }
-
- switch (fsrc->Register.File) {
- case TGSI_FILE_INPUT:
if (ai == -1 || ai == fsrc->Register.Index) {
ai = fsrc->Register.Index;
src[i] = tgsi_src(vpc, fsrc);
} else {
src[i] = temp(vpc);
- arith(vpc, 0, OP_MOV, src[i], MASK_ALL,
+ arith(vpc, VEC, MOV, src[i], NVFX_VP_MASK_ALL,
tgsi_src(vpc, fsrc), none, none);
}
break;
@@ -445,7 +442,7 @@ nv40_vertprog_parse_instruction(struct nv40_vpc *vpc,
src[i] = tgsi_src(vpc, fsrc);
} else {
src[i] = temp(vpc);
- arith(vpc, 0, OP_MOV, src[i], MASK_ALL,
+ arith(vpc, VEC, MOV, src[i], NVFX_VP_MASK_ALL,
tgsi_src(vpc, fsrc), none, none);
}
break;
@@ -456,7 +453,7 @@ nv40_vertprog_parse_instruction(struct nv40_vpc *vpc,
src[i] = tgsi_src(vpc, fsrc);
} else {
src[i] = temp(vpc);
- arith(vpc, 0, OP_MOV, src[i], MASK_ALL,
+ arith(vpc, VEC, MOV, src[i], NVFX_VP_MASK_ALL,
tgsi_src(vpc, fsrc), none, none);
}
break;
@@ -474,93 +471,96 @@ nv40_vertprog_parse_instruction(struct nv40_vpc *vpc,
switch (finst->Instruction.Opcode) {
case TGSI_OPCODE_ABS:
- arith(vpc, 0, OP_MOV, dst, mask, abs(src[0]), none, none);
+ arith(vpc, VEC, MOV, dst, mask, abs(src[0]), none, none);
break;
case TGSI_OPCODE_ADD:
- arith(vpc, 0, OP_ADD, dst, mask, src[0], none, src[1]);
+ arith(vpc, VEC, ADD, dst, mask, src[0], none, src[1]);
break;
case TGSI_OPCODE_ARL:
- arith(vpc, 0, OP_ARL, dst, mask, src[0], none, none);
+ arith(vpc, VEC, ARL, dst, mask, src[0], none, none);
break;
case TGSI_OPCODE_DP3:
- arith(vpc, 0, OP_DP3, dst, mask, src[0], src[1], none);
+ arith(vpc, VEC, DP3, dst, mask, src[0], src[1], none);
break;
case TGSI_OPCODE_DP4:
- arith(vpc, 0, OP_DP4, dst, mask, src[0], src[1], none);
+ arith(vpc, VEC, DP4, dst, mask, src[0], src[1], none);
break;
case TGSI_OPCODE_DPH:
- arith(vpc, 0, OP_DPH, dst, mask, src[0], src[1], none);
+ arith(vpc, VEC, DPH, dst, mask, src[0], src[1], none);
break;
case TGSI_OPCODE_DST:
- arith(vpc, 0, OP_DST, dst, mask, src[0], src[1], none);
+ arith(vpc, VEC, DST, dst, mask, src[0], src[1], none);
break;
case TGSI_OPCODE_EX2:
- arith(vpc, 1, OP_EX2, dst, mask, none, none, src[0]);
+ arith(vpc, SCA, EX2, dst, mask, none, none, src[0]);
break;
case TGSI_OPCODE_EXP:
- arith(vpc, 1, OP_EXP, dst, mask, none, none, src[0]);
+ arith(vpc, SCA, EXP, dst, mask, none, none, src[0]);
break;
case TGSI_OPCODE_FLR:
- arith(vpc, 0, OP_FLR, dst, mask, src[0], none, none);
+ arith(vpc, VEC, FLR, dst, mask, src[0], none, none);
break;
case TGSI_OPCODE_FRC:
- arith(vpc, 0, OP_FRC, dst, mask, src[0], none, none);
+ arith(vpc, VEC, FRC, dst, mask, src[0], none, none);
break;
case TGSI_OPCODE_LG2:
- arith(vpc, 1, OP_LG2, dst, mask, none, none, src[0]);
+ arith(vpc, SCA, LG2, dst, mask, none, none, src[0]);
break;
case TGSI_OPCODE_LIT:
- arith(vpc, 1, OP_LIT, dst, mask, none, none, src[0]);
+ arith(vpc, SCA, LIT, dst, mask, none, none, src[0]);
break;
case TGSI_OPCODE_LOG:
- arith(vpc, 1, OP_LOG, dst, mask, none, none, src[0]);
+ arith(vpc, SCA, LOG, dst, mask, none, none, src[0]);
break;
case TGSI_OPCODE_MAD:
- arith(vpc, 0, OP_MAD, dst, mask, src[0], src[1], src[2]);
+ arith(vpc, VEC, MAD, dst, mask, src[0], src[1], src[2]);
break;
case TGSI_OPCODE_MAX:
- arith(vpc, 0, OP_MAX, dst, mask, src[0], src[1], none);
+ arith(vpc, VEC, MAX, dst, mask, src[0], src[1], none);
break;
case TGSI_OPCODE_MIN:
- arith(vpc, 0, OP_MIN, dst, mask, src[0], src[1], none);
+ arith(vpc, VEC, MIN, dst, mask, src[0], src[1], none);
break;
case TGSI_OPCODE_MOV:
- arith(vpc, 0, OP_MOV, dst, mask, src[0], none, none);
+ arith(vpc, VEC, MOV, dst, mask, src[0], none, none);
break;
case TGSI_OPCODE_MUL:
- arith(vpc, 0, OP_MUL, dst, mask, src[0], src[1], none);
+ arith(vpc, VEC, MUL, dst, mask, src[0], src[1], none);
break;
case TGSI_OPCODE_POW:
tmp = temp(vpc);
- arith(vpc, 1, OP_LG2, tmp, MASK_X, none, none,
+ arith(vpc, SCA, LG2, tmp, NVFX_VP_MASK_X, none, none,
swz(src[0], X, X, X, X));
- arith(vpc, 0, OP_MUL, tmp, MASK_X, swz(tmp, X, X, X, X),
+ arith(vpc, VEC, MUL, tmp, NVFX_VP_MASK_X, swz(tmp, X, X, X, X),
swz(src[1], X, X, X, X), none);
- arith(vpc, 1, OP_EX2, dst, mask, none, none,
+ arith(vpc, SCA, EX2, dst, mask, none, none,
swz(tmp, X, X, X, X));
break;
case TGSI_OPCODE_RCP:
- arith(vpc, 1, OP_RCP, dst, mask, none, none, src[0]);
+ arith(vpc, SCA, RCP, dst, mask, none, none, src[0]);
break;
case TGSI_OPCODE_RET:
break;
case TGSI_OPCODE_RSQ:
- arith(vpc, 1, OP_RSQ, dst, mask, none, none, abs(src[0]));
+ arith(vpc, SCA, RSQ, dst, mask, none, none, abs(src[0]));
break;
case TGSI_OPCODE_SGE:
- arith(vpc, 0, OP_SGE, dst, mask, src[0], src[1], none);
+ arith(vpc, VEC, SGE, dst, mask, src[0], src[1], none);
+ break;
+ case TGSI_OPCODE_SGT:
+ arith(vpc, VEC, SGT, dst, mask, src[0], src[1], none);
break;
case TGSI_OPCODE_SLT:
- arith(vpc, 0, OP_SLT, dst, mask, src[0], src[1], none);
+ arith(vpc, VEC, SLT, dst, mask, src[0], src[1], none);
break;
case TGSI_OPCODE_SUB:
- arith(vpc, 0, OP_ADD, dst, mask, src[0], none, neg(src[1]));
+ arith(vpc, VEC, ADD, dst, mask, src[0], none, neg(src[1]));
break;
case TGSI_OPCODE_XPD:
tmp = temp(vpc);
- arith(vpc, 0, OP_MUL, tmp, mask,
+ arith(vpc, VEC, MUL, tmp, mask,
swz(src[0], Z, X, Y, Y), swz(src[1], Y, Z, X, X), none);
- arith(vpc, 0, OP_MAD, dst, (mask & ~MASK_W),
+ arith(vpc, VEC, MAD, dst, (mask & ~NVFX_VP_MASK_W),
swz(src[0], Y, Z, X, X), swz(src[1], Z, X, Y, Y),
neg(tmp));
break;
@@ -574,7 +574,7 @@ nv40_vertprog_parse_instruction(struct nv40_vpc *vpc,
}
static boolean
-nv40_vertprog_parse_decl_output(struct nv40_vpc *vpc,
+nvfx_vertprog_parse_decl_output(struct nvfx_context* nvfx, struct nvfx_vpc *vpc,
const struct tgsi_full_declaration *fdec)
{
unsigned idx = fdec->Range.First;
@@ -582,15 +582,15 @@ nv40_vertprog_parse_decl_output(struct nv40_vpc *vpc,
switch (fdec->Semantic.Name) {
case TGSI_SEMANTIC_POSITION:
- hw = NV40_VP_INST_DEST_POS;
+ hw = NVFX_VP(INST_DEST_POS);
vpc->hpos_idx = idx;
break;
case TGSI_SEMANTIC_COLOR:
if (fdec->Semantic.Index == 0) {
- hw = NV40_VP_INST_DEST_COL0;
+ hw = NVFX_VP(INST_DEST_COL0);
} else
if (fdec->Semantic.Index == 1) {
- hw = NV40_VP_INST_DEST_COL1;
+ hw = NVFX_VP(INST_DEST_COL1);
} else {
NOUVEAU_ERR("bad colour semantic index\n");
return FALSE;
@@ -598,24 +598,24 @@ nv40_vertprog_parse_decl_output(struct nv40_vpc *vpc,
break;
case TGSI_SEMANTIC_BCOLOR:
if (fdec->Semantic.Index == 0) {
- hw = NV40_VP_INST_DEST_BFC0;
+ hw = NVFX_VP(INST_DEST_BFC0);
} else
if (fdec->Semantic.Index == 1) {
- hw = NV40_VP_INST_DEST_BFC1;
+ hw = NVFX_VP(INST_DEST_BFC1);
} else {
NOUVEAU_ERR("bad bcolour semantic index\n");
return FALSE;
}
break;
case TGSI_SEMANTIC_FOG:
- hw = NV40_VP_INST_DEST_FOGC;
+ hw = NVFX_VP(INST_DEST_FOGC);
break;
case TGSI_SEMANTIC_PSIZE:
- hw = NV40_VP_INST_DEST_PSZ;
+ hw = NVFX_VP(INST_DEST_PSZ);
break;
case TGSI_SEMANTIC_GENERIC:
if (fdec->Semantic.Index <= 7) {
- hw = NV40_VP_INST_DEST_TC(fdec->Semantic.Index);
+ hw = NVFX_VP(INST_DEST_TC(fdec->Semantic.Index));
} else {
NOUVEAU_ERR("bad generic semantic index\n");
return FALSE;
@@ -630,12 +630,12 @@ nv40_vertprog_parse_decl_output(struct nv40_vpc *vpc,
return FALSE;
}
- vpc->r_result[idx] = nv40_sr(NV40SR_OUTPUT, hw);
+ vpc->r_result[idx] = nvfx_sr(NVFXSR_OUTPUT, hw);
return TRUE;
}
static boolean
-nv40_vertprog_prepare(struct nv40_vpc *vpc)
+nvfx_vertprog_prepare(struct nvfx_context* nvfx, struct nvfx_vpc *vpc)
{
struct tgsi_parse_context p;
int high_temp = -1, high_addr = -1, nr_imm = 0, i;
@@ -670,7 +670,7 @@ nv40_vertprog_prepare(struct nv40_vpc *vpc)
break;
#endif
case TGSI_FILE_OUTPUT:
- if (!nv40_vertprog_parse_decl_output(vpc, fdec))
+ if (!nvfx_vertprog_parse_decl_output(nvfx, vpc, fdec))
return FALSE;
break;
default:
@@ -691,7 +691,7 @@ nv40_vertprog_prepare(struct nv40_vpc *vpc)
if (fdst->Register.Index > high_addr)
high_addr = fdst->Register.Index;
}
-
+
}
break;
#endif
@@ -702,18 +702,18 @@ nv40_vertprog_prepare(struct nv40_vpc *vpc)
tgsi_parse_free(&p);
if (nr_imm) {
- vpc->imm = CALLOC(nr_imm, sizeof(struct nv40_sreg));
+ vpc->imm = CALLOC(nr_imm, sizeof(struct nvfx_sreg));
assert(vpc->imm);
}
if (++high_temp) {
- vpc->r_temp = CALLOC(high_temp, sizeof(struct nv40_sreg));
+ vpc->r_temp = CALLOC(high_temp, sizeof(struct nvfx_sreg));
for (i = 0; i < high_temp; i++)
vpc->r_temp[i] = temp(vpc);
}
if (++high_addr) {
- vpc->r_address = CALLOC(high_addr, sizeof(struct nv40_sreg));
+ vpc->r_address = CALLOC(high_addr, sizeof(struct nvfx_sreg));
for (i = 0; i < high_addr; i++)
vpc->r_address[i] = temp(vpc);
}
@@ -723,20 +723,20 @@ nv40_vertprog_prepare(struct nv40_vpc *vpc)
}
static void
-nv40_vertprog_translate(struct nv40_context *nv40,
- struct nv40_vertex_program *vp)
+nvfx_vertprog_translate(struct nvfx_context *nvfx,
+ struct nvfx_vertex_program *vp)
{
struct tgsi_parse_context parse;
- struct nv40_vpc *vpc = NULL;
- struct nv40_sreg none = nv40_sr(NV40SR_NONE, 0);
+ struct nvfx_vpc *vpc = NULL;
+ struct nvfx_sreg none = nvfx_sr(NVFXSR_NONE, 0);
int i;
- vpc = CALLOC(1, sizeof(struct nv40_vpc));
+ vpc = CALLOC(1, sizeof(struct nvfx_vpc));
if (!vpc)
return;
vpc->vp = vp;
- if (!nv40_vertprog_prepare(vpc)) {
+ if (!nvfx_vertprog_prepare(nvfx, vpc)) {
FREE(vpc);
return;
}
@@ -775,7 +775,7 @@ nv40_vertprog_translate(struct nv40_context *nv40,
{
const struct tgsi_full_instruction *finst;
finst = &parse.FullToken.FullInstruction;
- if (!nv40_vertprog_parse_instruction(vpc, finst))
+ if (!nvfx_vertprog_parse_instruction(nvfx, vpc, finst))
goto out_err;
}
break;
@@ -785,74 +785,74 @@ nv40_vertprog_translate(struct nv40_context *nv40,
}
/* Write out HPOS if it was redirected to a temp earlier */
- if (vpc->r_result[vpc->hpos_idx].type != NV40SR_OUTPUT) {
- struct nv40_sreg hpos = nv40_sr(NV40SR_OUTPUT,
- NV40_VP_INST_DEST_POS);
- struct nv40_sreg htmp = vpc->r_result[vpc->hpos_idx];
+ if (vpc->r_result[vpc->hpos_idx].type != NVFXSR_OUTPUT) {
+ struct nvfx_sreg hpos = nvfx_sr(NVFXSR_OUTPUT,
+ NVFX_VP(INST_DEST_POS));
+ struct nvfx_sreg htmp = vpc->r_result[vpc->hpos_idx];
- arith(vpc, 0, OP_MOV, hpos, MASK_ALL, htmp, none, none);
+ arith(vpc, VEC, MOV, hpos, NVFX_VP_MASK_ALL, htmp, none, none);
}
/* Insert code to handle user clip planes */
for (i = 0; i < vp->ucp.nr; i++) {
- struct nv40_sreg cdst = nv40_sr(NV40SR_OUTPUT,
- NV40_VP_INST_DEST_CLIP(i));
- struct nv40_sreg ceqn = constant(vpc, -1,
- nv40->clip.ucp[i][0],
- nv40->clip.ucp[i][1],
- nv40->clip.ucp[i][2],
- nv40->clip.ucp[i][3]);
- struct nv40_sreg htmp = vpc->r_result[vpc->hpos_idx];
+ struct nvfx_sreg cdst = nvfx_sr(NVFXSR_OUTPUT,
+ NVFX_VP_INST_DEST_CLIP(i));
+ struct nvfx_sreg ceqn = constant(vpc, -1,
+ nvfx->clip.ucp[i][0],
+ nvfx->clip.ucp[i][1],
+ nvfx->clip.ucp[i][2],
+ nvfx->clip.ucp[i][3]);
+ struct nvfx_sreg htmp = vpc->r_result[vpc->hpos_idx];
unsigned mask;
switch (i) {
- case 0: case 3: mask = MASK_Y; break;
- case 1: case 4: mask = MASK_Z; break;
- case 2: case 5: mask = MASK_W; break;
+ case 0: case 3: mask = NVFX_VP_MASK_Y; break;
+ case 1: case 4: mask = NVFX_VP_MASK_Z; break;
+ case 2: case 5: mask = NVFX_VP_MASK_W; break;
default:
NOUVEAU_ERR("invalid clip dist #%d\n", i);
goto out_err;
}
- arith(vpc, 0, OP_DP4, cdst, mask, htmp, ceqn, none);
+ arith(vpc, VEC, DP4, cdst, mask, htmp, ceqn, none);
}
- vp->insns[vp->nr_insns - 1].data[3] |= NV40_VP_INST_LAST;
+ vp->insns[vp->nr_insns - 1].data[3] |= NVFX_VP_INST_LAST;
vp->translated = TRUE;
out_err:
tgsi_parse_free(&parse);
if (vpc->r_temp)
- FREE(vpc->r_temp);
+ FREE(vpc->r_temp);
if (vpc->r_address)
- FREE(vpc->r_address);
- if (vpc->imm)
- FREE(vpc->imm);
+ FREE(vpc->r_address);
+ if (vpc->imm)
+ FREE(vpc->imm);
FREE(vpc);
}
static boolean
-nv40_vertprog_validate(struct nv40_context *nv40)
-{
- struct pipe_screen *pscreen = nv40->pipe.screen;
- struct nv40_screen *screen = nv40->screen;
+nvfx_vertprog_validate(struct nvfx_context *nvfx)
+{
+ struct pipe_screen *pscreen = nvfx->pipe.screen;
+ struct nvfx_screen *screen = nvfx->screen;
struct nouveau_channel *chan = screen->base.channel;
- struct nouveau_grobj *curie = screen->curie;
- struct nv40_vertex_program *vp;
+ struct nouveau_grobj *eng3d = screen->eng3d;
+ struct nvfx_vertex_program *vp;
struct pipe_buffer *constbuf;
boolean upload_code = FALSE, upload_data = FALSE;
int i;
- if (nv40->render_mode == HW) {
- vp = nv40->vertprog;
- constbuf = nv40->constbuf[PIPE_SHADER_VERTEX];
+ if (nvfx->render_mode == HW) {
+ vp = nvfx->vertprog;
+ constbuf = nvfx->constbuf[PIPE_SHADER_VERTEX];
- if ((nv40->dirty & NV40_NEW_UCP) ||
- memcmp(&nv40->clip, &vp->ucp, sizeof(vp->ucp))) {
- nv40_vertprog_destroy(nv40, vp);
- memcpy(&vp->ucp, &nv40->clip, sizeof(vp->ucp));
+ if ((nvfx->dirty & NVFX_NEW_UCP) ||
+ memcmp(&nvfx->clip, &vp->ucp, sizeof(vp->ucp))) {
+ nvfx_vertprog_destroy(nvfx, vp);
+ memcpy(&vp->ucp, &nvfx->clip, sizeof(vp->ucp));
}
} else {
- vp = nv40->swtnl.vertprog;
+ vp = nvfx->swtnl.vertprog;
constbuf = NULL;
}
@@ -860,24 +860,24 @@ nv40_vertprog_validate(struct nv40_context *nv40)
if (vp->translated)
goto check_gpu_resources;
- nv40->fallback_swtnl &= ~NV40_NEW_VERTPROG;
- nv40_vertprog_translate(nv40, vp);
+ nvfx->fallback_swtnl &= ~NVFX_NEW_VERTPROG;
+ nvfx_vertprog_translate(nvfx, vp);
if (!vp->translated) {
- nv40->fallback_swtnl |= NV40_NEW_VERTPROG;
- return FALSE;
+ nvfx->fallback_swtnl |= NVFX_NEW_VERTPROG;
+ return FALSE;
}
check_gpu_resources:
/* Allocate hw vtxprog exec slots */
if (!vp->exec) {
- struct nouveau_resource *heap = nv40->screen->vp_exec_heap;
+ struct nouveau_resource *heap = nvfx->screen->vp_exec_heap;
struct nouveau_stateobj *so;
uint vplen = vp->nr_insns;
if (nouveau_resource_alloc(heap, vplen, vp, &vp->exec)) {
while (heap->next && heap->size < vplen) {
- struct nv40_vertex_program *evict;
-
+ struct nvfx_vertex_program *evict;
+
evict = heap->next->priv;
nouveau_resource_free(&evict->exec);
}
@@ -887,12 +887,14 @@ check_gpu_resources:
}
so = so_new(3, 4, 0);
- so_method(so, curie, NV40TCL_VP_START_FROM_ID, 1);
+ so_method(so, eng3d, NV34TCL_VP_START_FROM_ID, 1);
so_data (so, vp->exec->start);
- so_method(so, curie, NV40TCL_VP_ATTRIB_EN, 2);
- so_data (so, vp->ir);
- so_data (so, vp->or);
- so_method(so, curie, NV40TCL_CLIP_PLANE_ENABLE, 1);
+ if(nvfx->is_nv4x) {
+ so_method(so, eng3d, NV40TCL_VP_ATTRIB_EN, 2);
+ so_data (so, vp->ir);
+ so_data (so, vp->or);
+ }
+ so_method(so, eng3d, NV34TCL_VP_CLIP_PLANES_ENABLE, 1);
so_data (so, vp->clip_ctrl);
so_ref(so, &vp->so);
so_ref(NULL, &so);
@@ -902,12 +904,12 @@ check_gpu_resources:
/* Allocate hw vtxprog const slots */
if (vp->nr_consts && !vp->data) {
- struct nouveau_resource *heap = nv40->screen->vp_data_heap;
+ struct nouveau_resource *heap = nvfx->screen->vp_data_heap;
if (nouveau_resource_alloc(heap, vp->nr_consts, vp, &vp->data)) {
while (heap->next && heap->size < vp->nr_consts) {
- struct nv40_vertex_program *evict;
-
+ struct nvfx_vertex_program *evict;
+
evict = heap->next->priv;
nouveau_resource_free(&evict->data);
}
@@ -929,7 +931,7 @@ check_gpu_resources:
*/
if (vp->exec_start != vp->exec->start) {
for (i = 0; i < vp->nr_insns; i++) {
- struct nv40_vertex_program_exec *vpi = &vp->insns[i];
+ struct nvfx_vertex_program_exec *vpi = &vp->insns[i];
if (vpi->has_branch_offset) {
assert(0);
@@ -941,13 +943,13 @@ check_gpu_resources:
if (vp->nr_consts && vp->data_start != vp->data->start) {
for (i = 0; i < vp->nr_insns; i++) {
- struct nv40_vertex_program_exec *vpi = &vp->insns[i];
+ struct nvfx_vertex_program_exec *vpi = &vp->insns[i];
if (vpi->const_index >= 0) {
- vpi->data[1] &= ~NV40_VP_INST_CONST_SRC_MASK;
+ vpi->data[1] &= ~NVFX_VP(INST_CONST_SRC_MASK);
vpi->data[1] |=
(vpi->const_index + vp->data->start) <<
- NV40_VP_INST_CONST_SRC_SHIFT;
+ NVFX_VP(INST_CONST_SRC_SHIFT);
}
}
@@ -965,7 +967,7 @@ check_gpu_resources:
}
for (i = 0; i < vp->nr_consts; i++) {
- struct nv40_vertex_program_data *vpd = &vp->consts[i];
+ struct nvfx_vertex_program_data *vpd = &vp->consts[i];
if (vpd->index >= 0) {
if (!upload_data &&
@@ -976,13 +978,13 @@ check_gpu_resources:
4 * sizeof(float));
}
- BEGIN_RING(chan, curie, NV40TCL_VP_UPLOAD_CONST_ID, 5);
+ BEGIN_RING(chan, eng3d, NV34TCL_VP_UPLOAD_CONST_ID, 5);
OUT_RING (chan, i + vp->data->start);
OUT_RINGp (chan, (uint32_t *)vpd->value, 4);
}
if (constbuf)
- pscreen->buffer_unmap(pscreen, constbuf);
+ pipe_buffer_unmap(pscreen, constbuf);
}
/* Upload vtxprog */
@@ -995,16 +997,16 @@ check_gpu_resources:
NOUVEAU_MSG("VP %d: 0x%08x\n", i, vp->insns[i].data[3]);
}
#endif
- BEGIN_RING(chan, curie, NV40TCL_VP_UPLOAD_FROM_ID, 1);
+ BEGIN_RING(chan, eng3d, NV34TCL_VP_UPLOAD_FROM_ID, 1);
OUT_RING (chan, vp->exec->start);
for (i = 0; i < vp->nr_insns; i++) {
- BEGIN_RING(chan, curie, NV40TCL_VP_UPLOAD_INST(0), 4);
+ BEGIN_RING(chan, eng3d, NV34TCL_VP_UPLOAD_INST(0), 4);
OUT_RINGp (chan, vp->insns[i].data, 4);
}
}
- if (vp->so != nv40->state.hw[NV40_STATE_VERTPROG]) {
- so_ref(vp->so, &nv40->state.hw[NV40_STATE_VERTPROG]);
+ if (vp->so != nvfx->state.hw[NVFX_STATE_VERTPROG]) {
+ so_ref(vp->so, &nvfx->state.hw[NVFX_STATE_VERTPROG]);
return TRUE;
}
@@ -1012,7 +1014,7 @@ check_gpu_resources:
}
void
-nv40_vertprog_destroy(struct nv40_context *nv40, struct nv40_vertex_program *vp)
+nvfx_vertprog_destroy(struct nvfx_context *nvfx, struct nvfx_vertex_program *vp)
{
vp->translated = FALSE;
@@ -1038,11 +1040,10 @@ nv40_vertprog_destroy(struct nv40_context *nv40, struct nv40_vertex_program *vp)
so_ref(NULL, &vp->so);
}
-struct nv40_state_entry nv40_state_vertprog = {
- .validate = nv40_vertprog_validate,
+struct nvfx_state_entry nvfx_state_vertprog = {
+ .validate = nvfx_vertprog_validate,
.dirty = {
- .pipe = NV40_NEW_VERTPROG | NV40_NEW_UCP,
- .hw = NV40_STATE_VERTPROG,
+ .pipe = NVFX_NEW_VERTPROG | NVFX_NEW_UCP,
+ .hw = NVFX_STATE_VERTPROG,
}
};
-
diff --git a/src/gallium/drivers/r300/Makefile b/src/gallium/drivers/r300/Makefile
index 1f69daec81..a6529b2060 100644
--- a/src/gallium/drivers/r300/Makefile
+++ b/src/gallium/drivers/r300/Makefile
@@ -14,12 +14,14 @@ C_SOURCES = \
r300_query.c \
r300_render.c \
r300_screen.c \
+ r300_screen_buffer.c \
r300_state.c \
r300_state_derived.c \
r300_state_invariant.c \
r300_vs.c \
r300_texture.c \
- r300_tgsi_to_rc.c
+ r300_tgsi_to_rc.c \
+ r300_transfer.c
LIBRARY_INCLUDES = \
-I$(TOP)/src/mesa/drivers/dri/r300/compiler \
diff --git a/src/gallium/drivers/r300/SConscript b/src/gallium/drivers/r300/SConscript
index 183aa17f9b..221878c1c0 100644
--- a/src/gallium/drivers/r300/SConscript
+++ b/src/gallium/drivers/r300/SConscript
@@ -24,12 +24,14 @@ r300 = env.ConvenienceLibrary(
'r300_query.c',
'r300_render.c',
'r300_screen.c',
+ 'r300_screen_buffer.c',
'r300_state.c',
'r300_state_derived.c',
'r300_state_invariant.c',
'r300_vs.c',
'r300_texture.c',
'r300_tgsi_to_rc.c',
+ 'r300_transfer.c',
] + r300compiler) + r300compiler
Export('r300')
diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c
index 513cc0f5d4..bcdf950df9 100644
--- a/src/gallium/drivers/r300/r300_blit.c
+++ b/src/gallium/drivers/r300/r300_blit.c
@@ -36,6 +36,7 @@ static void r300_blitter_save_states(struct r300_context* r300)
util_blitter_save_vertex_shader(r300->blitter, r300->vs_state.state);
util_blitter_save_viewport(r300->blitter, &r300->viewport);
util_blitter_save_clip(r300->blitter, &r300->clip);
+ util_blitter_save_vertex_elements(r300->blitter, r300->velems);
}
/* Clear currently bound buffers. */
@@ -112,9 +113,9 @@ static void r300_hw_copy(struct pipe_context* pipe,
util_blitter_save_fragment_sampler_states(
r300->blitter, state->sampler_count, (void**)state->sampler_states);
- util_blitter_save_fragment_sampler_textures(
+ util_blitter_save_fragment_sampler_views(
r300->blitter, state->texture_count,
- (struct pipe_texture**)state->textures);
+ state->fragment_sampler_views);
/* Do a copy */
util_blitter_copy(r300->blitter,
@@ -148,6 +149,9 @@ void r300_surface_copy(struct pipe_context* pipe,
case 4:
new_format = PIPE_FORMAT_B8G8R8A8_UNORM;
break;
+ case 8:
+ new_format = PIPE_FORMAT_R16G16B16A16_UNORM;
+ break;
default:
debug_printf("r300: surface_copy: Unhandled format: %s. Falling back to software.\n"
"r300: surface_copy: Software fallback doesn't work for tiled textures.\n",
diff --git a/src/gallium/drivers/r300/r300_chipset.c b/src/gallium/drivers/r300/r300_chipset.c
index 92de297ef1..4171986263 100644
--- a/src/gallium/drivers/r300/r300_chipset.c
+++ b/src/gallium/drivers/r300/r300_chipset.c
@@ -24,6 +24,8 @@
#include "util/u_debug.h"
+#include <stdio.h>
+
/* r300_chipset: A file all to itself for deducing the various properties of
* Radeons. */
@@ -365,8 +367,7 @@ void r300_parse_chipset(struct r300_capabilities* caps)
break;
default:
- debug_printf("r300: Warning: Unknown chipset 0x%x\n",
- caps->pci_id);
- break;
+ fprintf(stderr, "r300: Warning: Unknown chipset 0x%x\n",
+ caps->pci_id);
}
}
diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index 86b98a4ba5..4b470b2c6a 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -24,6 +24,7 @@
#include "util/u_memory.h"
#include "util/u_simple_list.h"
+#include "util/u_upload_mgr.h"
#include "r300_blit.h"
#include "r300_context.h"
@@ -32,10 +33,10 @@
#include "r300_query.h"
#include "r300_render.h"
#include "r300_screen.h"
+#include "r300_screen_buffer.h"
#include "r300_state_invariant.h"
-#include "r300_texture.h"
-
-#include "radeon_winsys.h"
+#include "r300_transfer.h"
+#include "r300_winsys.h"
static void r300_destroy_context(struct pipe_context* context)
{
@@ -54,13 +55,15 @@ static void r300_destroy_context(struct pipe_context* context)
FREE(query);
}
+ u_upload_destroy(r300->upload_vb);
+ u_upload_destroy(r300->upload_ib);
+
FREE(r300->blend_color_state.state);
FREE(r300->clip_state.state);
FREE(r300->fb_state.state);
FREE(r300->rs_block_state.state);
FREE(r300->scissor_state.state);
FREE(r300->textures_state.state);
- FREE(r300->vertex_stream_state.state);
FREE(r300->vap_output_state.state);
FREE(r300->viewport_state.state);
FREE(r300->ztop_state.state);
@@ -68,26 +71,23 @@ static void r300_destroy_context(struct pipe_context* context)
}
static unsigned int
-r300_is_texture_referenced(struct pipe_context *pipe,
+r300_is_texture_referenced(struct pipe_context *context,
struct pipe_texture *texture,
unsigned face, unsigned level)
{
- struct pipe_buffer* buf = 0;
-
- r300_get_texture_buffer(pipe->screen, texture, &buf, NULL);
+ struct r300_context* r300 = r300_context(context);
+ struct r300_texture* tex = (struct r300_texture*)texture;
- return pipe->is_buffer_referenced(pipe, buf);
+ return r300->rws->is_buffer_referenced(r300->rws, tex->buffer);
}
static unsigned int
-r300_is_buffer_referenced(struct pipe_context *pipe,
+r300_is_buffer_referenced(struct pipe_context *context,
struct pipe_buffer *buf)
{
- /* This only checks to see whether actual hardware buffers are
- * referenced. Since we use managed BOs and transfers, it's actually not
- * possible for pipe_buffers to ever reference the actual hardware, so
- * buffers are never referenced. */
- return 0;
+ struct r300_context* r300 = r300_context(context);
+
+ return r300_buffer_is_referenced(r300, buf);
}
static void r300_flush_cb(void *data)
@@ -143,7 +143,6 @@ static void r300_setup_atoms(struct r300_context* r300)
r300->rs_block_state.state = CALLOC_STRUCT(r300_rs_block);
r300->scissor_state.state = CALLOC_STRUCT(pipe_scissor_state);
r300->textures_state.state = CALLOC_STRUCT(r300_textures_state);
- r300->vertex_stream_state.state = CALLOC_STRUCT(r300_vertex_stream_state);
r300->vap_output_state.state = CALLOC_STRUCT(r300_vap_output_state);
r300->viewport_state.state = CALLOC_STRUCT(r300_viewport_state);
r300->ztop_state.state = CALLOC_STRUCT(r300_ztop_state);
@@ -154,14 +153,14 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
{
struct r300_context* r300 = CALLOC_STRUCT(r300_context);
struct r300_screen* r300screen = r300_screen(screen);
- struct radeon_winsys* radeon_winsys = r300screen->radeon_winsys;
+ struct r300_winsys_screen *rws = r300screen->rws;
if (!r300)
return NULL;
- r300->winsys = radeon_winsys;
+ r300->rws = rws;
- r300->context.winsys = (struct pipe_winsys*)radeon_winsys;
+ r300->context.winsys = (struct pipe_winsys*)rws;
r300->context.screen = screen;
r300->context.priv = priv;
@@ -198,24 +197,42 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
/* Open up the OQ BO. */
r300->oqbo = screen->buffer_create(screen, 4096,
- PIPE_BUFFER_USAGE_VERTEX, 4096);
+ PIPE_BUFFER_USAGE_PIXEL, 4096);
make_empty_list(&r300->query_list);
r300_init_flush_functions(r300);
r300_init_query_functions(r300);
- /* r300_init_surface_functions(r300); */
+ r300_init_transfer_functions(r300);
r300_init_state_functions(r300);
r300->invariant_state.dirty = TRUE;
- r300->winsys->set_flush_cb(r300->winsys, r300_flush_cb, r300);
- r300->dirty_state = R300_NEW_KITCHEN_SINK;
+ rws->set_flush_cb(r300->rws, r300_flush_cb, r300);
r300->dirty_hw++;
r300->blitter = util_blitter_create(&r300->context);
+ r300->upload_ib = u_upload_create(screen,
+ 32 * 1024, 16,
+ PIPE_BUFFER_USAGE_INDEX);
+
+ if (r300->upload_ib == NULL)
+ goto no_upload_ib;
+
+ r300->upload_vb = u_upload_create(screen,
+ 128 * 1024, 16,
+ PIPE_BUFFER_USAGE_VERTEX);
+ if (r300->upload_vb == NULL)
+ goto no_upload_vb;
+
return &r300->context;
+
+ no_upload_ib:
+ u_upload_destroy(r300->upload_ib);
+ no_upload_vb:
+ FREE(r300);
+ return NULL;
}
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index 0d1518a05b..031092312d 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -30,8 +30,10 @@
#include "pipe/p_context.h"
#include "util/u_inlines.h"
+#include "r300_defines.h"
#include "r300_screen.h"
+struct u_upload_mgr;
struct r300_context;
struct r300_fragment_shader;
@@ -126,17 +128,17 @@ struct r300_texture_format_state {
struct r300_texture_fb_state {
/* Colorbuffer. */
- uint32_t colorpitch[PIPE_MAX_TEXTURE_LEVELS]; /* R300_RB3D_COLORPITCH[0-3]*/
+ uint32_t colorpitch[R300_MAX_TEXTURE_LEVELS]; /* R300_RB3D_COLORPITCH[0-3]*/
uint32_t us_out_fmt; /* R300_US_OUT_FMT[0-3] */
/* Zbuffer. */
- uint32_t depthpitch[PIPE_MAX_TEXTURE_LEVELS]; /* R300_RB3D_DEPTHPITCH */
+ uint32_t depthpitch[R300_MAX_TEXTURE_LEVELS]; /* R300_RB3D_DEPTHPITCH */
uint32_t zb_format; /* R300_ZB_FORMAT */
};
struct r300_textures_state {
/* Textures. */
- struct r300_texture *textures[8];
+ struct pipe_sampler_view *fragment_sampler_views[8];
int texture_count;
/* Sampler states. */
struct r300_sampler_state *sampler_states[8];
@@ -182,12 +184,6 @@ struct r300_ztop_state {
uint32_t z_buffer_top; /* R300_ZB_ZTOP: 0x4f14 */
};
-#define R300_NEW_FRAGMENT_SHADER 0x00000020
-#define R300_NEW_FRAGMENT_SHADER_CONSTANTS 0x00000040
-#define R300_NEW_VERTEX_SHADER_CONSTANTS 0x10000000
-#define R300_NEW_QUERY 0x40000000
-#define R300_NEW_KITCHEN_SINK 0x7fffffff
-
/* The next several objects are not pure Radeon state; they inherit from
* various Gallium classes. */
@@ -225,27 +221,21 @@ struct r300_query {
struct r300_query* next;
};
-enum r300_buffer_tiling {
- R300_BUFFER_LINEAR = 0,
- R300_BUFFER_TILED,
- R300_BUFFER_SQUARETILED
-};
-
struct r300_texture {
/* Parent class */
struct pipe_texture tex;
/* Offsets into the buffer. */
- unsigned offset[PIPE_MAX_TEXTURE_LEVELS];
+ unsigned offset[R300_MAX_TEXTURE_LEVELS];
/* A pitch for each mip-level */
- unsigned pitch[PIPE_MAX_TEXTURE_LEVELS];
+ unsigned pitch[R300_MAX_TEXTURE_LEVELS];
/* Size of one zslice or face based on the texture target */
- unsigned layer_size[PIPE_MAX_TEXTURE_LEVELS];
+ unsigned layer_size[R300_MAX_TEXTURE_LEVELS];
/* Whether the mipmap level is macrotiled. */
- enum r300_buffer_tiling mip_macrotile[PIPE_MAX_TEXTURE_LEVELS];
+ enum r300_buffer_tiling mip_macrotile[R300_MAX_TEXTURE_LEVELS];
/**
* If non-zero, override the natural texture layout with
@@ -266,7 +256,7 @@ struct r300_texture {
boolean is_npot;
/* Pipe buffer backing this texture. */
- struct pipe_buffer* buffer;
+ struct r300_winsys_buffer *buffer;
/* Registers carrying texture format data. */
struct r300_texture_format_state state;
@@ -276,6 +266,23 @@ struct r300_texture {
enum r300_buffer_tiling microtile, macrotile;
};
+struct r300_vertex_info {
+ /* Parent class */
+ struct vertex_info vinfo;
+
+ /* R300_VAP_PROG_STREAK_CNTL_[0-7] */
+ uint32_t vap_prog_stream_cntl[8];
+ /* R300_VAP_PROG_STREAK_CNTL_EXT_[0-7] */
+ uint32_t vap_prog_stream_cntl_ext[8];
+};
+
+struct r300_vertex_element_state {
+ unsigned count;
+ struct pipe_vertex_element velem[PIPE_MAX_ATTRIBS];
+
+ struct r300_vertex_stream_state vertex_stream;
+};
+
extern struct pipe_viewport_state r300_viewport_identity;
struct r300_context {
@@ -283,7 +290,7 @@ struct r300_context {
struct pipe_context context;
/* The interface to the windowing system, etc. */
- struct radeon_winsys* winsys;
+ struct r300_winsys_screen *rws;
/* Draw module. Used mostly for SW TCL. */
struct draw_context* draw;
/* Accelerated blit support. */
@@ -348,8 +355,8 @@ struct r300_context {
int vertex_buffer_count;
int vertex_buffer_max_index;
/* Vertex elements for Gallium. */
- struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS];
- int vertex_element_count;
+ struct r300_vertex_element_state *velems;
+ bool any_user_vbs;
/* Vertex info for Draw. */
struct vertex_info vertex_info;
@@ -368,6 +375,13 @@ struct r300_context {
boolean polygon_offset_enabled;
/* Z buffer bit depth. */
uint32_t zbuffer_bpp;
+ /* Whether scissor is enabled. */
+ boolean scissor_enabled;
+ /* Whether rendering is conditional and should be skipped. */
+ boolean skip_rendering;
+ /* upload managers */
+ struct u_upload_mgr *upload_vb;
+ struct u_upload_mgr *upload_ib;
};
/* Convenience cast wrapper. */
@@ -384,6 +398,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
struct draw_stage* r300_draw_stage(struct r300_context* r300);
void r300_init_state_functions(struct r300_context* r300);
void r300_init_surface_functions(struct r300_context* r300);
+void r300_init_tex_functions( struct pipe_context *pipe );
static INLINE boolean CTX_DBG_ON(struct r300_context * ctx, unsigned flags)
{
@@ -396,7 +411,7 @@ static INLINE void CTX_DBG(struct r300_context * ctx, unsigned flags,
if (CTX_DBG_ON(ctx, flags)) {
va_list va;
va_start(va, fmt);
- debug_vprintf(fmt, va);
+ vfprintf(stderr, fmt, va);
va_end(va);
}
}
@@ -405,4 +420,3 @@ static INLINE void CTX_DBG(struct r300_context * ctx, unsigned flags,
#define DBG CTX_DBG
#endif /* R300_CONTEXT_H */
-
diff --git a/src/gallium/drivers/r300/r300_cs.h b/src/gallium/drivers/r300/r300_cs.h
index 151f72b0fe..456b2ec7b9 100644
--- a/src/gallium/drivers/r300/r300_cs.h
+++ b/src/gallium/drivers/r300/r300_cs.h
@@ -26,8 +26,7 @@
#include "util/u_math.h"
#include "r300_reg.h"
-
-#include "radeon_winsys.h"
+#include "r300_winsys.h"
/* Yes, I know macros are ugly. However, they are much prettier than the code
* that they neatly hide away, and don't have the cost of function setup,so
@@ -51,7 +50,7 @@
#define CS_LOCALS(context) \
struct r300_context* const cs_context_copy = (context); \
- struct radeon_winsys* cs_winsys = cs_context_copy->winsys; \
+ struct r300_winsys_screen *cs_winsys = cs_context_copy->rws; \
int cs_count = 0; (void) cs_count;
#define CHECK_CS(size) \
@@ -105,22 +104,34 @@
cs_count--; \
} while (0)
-#define OUT_CS_RELOC(bo, offset, rd, wd, flags) do { \
+#define OUT_CS_BUF_RELOC(bo, offset, rd, wd, flags) do { \
DBG(cs_context_copy, DBG_CS, "r300: writing relocation for buffer %p, offset %d, " \
"domains (%d, %d, %d)\n", \
bo, offset, rd, wd, flags); \
assert(bo); \
cs_winsys->write_cs_dword(cs_winsys, offset); \
- cs_winsys->write_cs_reloc(cs_winsys, bo, rd, wd, flags); \
+ r300_buffer_write_reloc(cs_winsys, r300_buffer(bo), rd, wd, flags); \
+ cs_count -= 3; \
+} while (0)
+
+
+#define OUT_CS_TEX_RELOC(tex, offset, rd, wd, flags) do { \
+ DBG(cs_context_copy, DBG_CS, "r300: writing relocation for texture %p, offset %d, " \
+ "domains (%d, %d, %d)\n", \
+ tex, offset, rd, wd, flags); \
+ assert(tex); \
+ cs_winsys->write_cs_dword(cs_winsys, offset); \
+ r300_texture_write_reloc(cs_winsys, tex, rd, wd, flags); \
cs_count -= 3; \
} while (0)
-#define OUT_CS_RELOC_NO_OFFSET(bo, rd, wd, flags) do { \
+
+#define OUT_CS_BUF_RELOC_NO_OFFSET(bo, rd, wd, flags) do { \
DBG(cs_context_copy, DBG_CS, "r300: writing relocation for buffer %p, " \
"domains (%d, %d, %d)\n", \
bo, rd, wd, flags); \
assert(bo); \
- cs_winsys->write_cs_reloc(cs_winsys, bo, rd, wd, flags); \
+ r300_buffer_write_reloc(cs_winsys, r300_buffer(bo), rd, wd, flags); \
cs_count -= 2; \
} while (0)
diff --git a/src/gallium/drivers/r300/r300_debug.c b/src/gallium/drivers/r300/r300_debug.c
index b881730848..016e8d6606 100644
--- a/src/gallium/drivers/r300/r300_debug.c
+++ b/src/gallium/drivers/r300/r300_debug.c
@@ -22,6 +22,7 @@
#include "r300_context.h"
+#include <stdio.h>
struct debug_option {
const char * name;
@@ -37,6 +38,7 @@ static struct debug_option debug_options[] = {
{ "draw", DBG_DRAW, "Draw and emit" },
{ "tex", DBG_TEX, "Textures" },
{ "fall", DBG_FALL, "Fallbacks" },
+ { "anisohq", DBG_ANISOHQ, "High quality anisotropic filtering (for benchmarking purposes only!)" },
{ "all", ~0, "Convenience option that enables all debug flags" },
@@ -68,7 +70,7 @@ void r300_init_debug(struct r300_screen * screen)
}
if (!opt->name) {
- debug_printf("Unknown debug option: %s\n", options);
+ fprintf(stderr, "Unknown debug option: %s\n", options);
printhint = TRUE;
}
@@ -80,10 +82,13 @@ void r300_init_debug(struct r300_screen * screen)
}
if (printhint || screen->debug & DBG_HELP) {
- debug_printf("You can enable debug output by setting the RADEON_DEBUG environment variable\n"
- "to a comma-separated list of debug options. Available options are:\n");
+ fprintf(stderr, "You can enable debug output by setting "
+ "the RADEON_DEBUG environment variable\n"
+ "to a comma-separated list of debug options. "
+ "Available options are:\n");
+
for(opt = debug_options; opt->name; ++opt) {
- debug_printf(" %s: %s\n", opt->name, opt->description);
+ fprintf(stderr, " %s: %s\n", opt->name, opt->description);
}
}
}
diff --git a/src/gallium/drivers/r300/r300_defines.h b/src/gallium/drivers/r300/r300_defines.h
new file mode 100644
index 0000000000..2e04876de9
--- /dev/null
+++ b/src/gallium/drivers/r300/r300_defines.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2010 Marek Olšák <maraeo@gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef R300_DEFINES_H
+#define R300_DEFINES_H
+
+#include "pipe/p_defines.h"
+
+#define R300_MAX_TEXTURE_LEVELS 13
+#define R300_MAX_DRAW_VBO_SIZE (1024 * 1024)
+
+#define R300_TEXTURE_USAGE_TRANSFER PIPE_TEXTURE_USAGE_CUSTOM
+
+/* Non-atom dirty state flags. */
+#define R300_NEW_FRAGMENT_SHADER 0x00000020
+#define R300_NEW_FRAGMENT_SHADER_CONSTANTS 0x00000040
+#define R300_NEW_VERTEX_SHADER_CONSTANTS 0x10000000
+#define R300_NEW_QUERY 0x40000000
+#define R300_NEW_KITCHEN_SINK 0x7fffffff
+
+/* Tiling flags. */
+enum r300_buffer_tiling {
+ R300_BUFFER_LINEAR = 0,
+ R300_BUFFER_TILED,
+ R300_BUFFER_SQUARETILED
+};
+
+#endif
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index addb28bded..15bcf8907f 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -32,6 +32,7 @@
#include "r300_emit.h"
#include "r300_fs.h"
#include "r300_screen.h"
+#include "r300_screen_buffer.h"
#include "r300_vs.h"
void r300_emit_blend_state(struct r300_context* r300,
@@ -144,10 +145,8 @@ static const float * get_shader_constant(
struct rc_constant * constant,
struct r300_constant_buffer * externals)
{
- struct r300_viewport_state* viewport =
- (struct r300_viewport_state*)r300->viewport_state.state;
- struct r300_textures_state* texstate =
- (struct r300_textures_state*)r300->textures_state.state;
+ struct r300_viewport_state* viewport = r300->viewport_state.state;
+ struct r300_textures_state* texstate = r300->textures_state.state;
static float vec[4] = { 0.0, 0.0, 0.0, 1.0 };
struct pipe_texture *tex;
@@ -163,7 +162,7 @@ static const float * get_shader_constant(
/* Factor for converting rectangle coords to
* normalized coords. Should only show up on non-r500. */
case RC_STATE_R300_TEXRECT_FACTOR:
- tex = &texstate->textures[constant->u.State[1]]->tex;
+ tex = texstate->fragment_sampler_views[constant->u.State[1]]->texture;
vec[0] = 1.0 / tex->width0;
vec[1] = 1.0 / tex->height0;
break;
@@ -187,13 +186,13 @@ static const float * get_shader_constant(
break;
default:
- debug_printf("r300: Implementation error: "
+ fprintf(stderr, "r300: Implementation error: "
"Unknown RC_CONSTANT type %d\n", constant->u.State[0]);
}
break;
default:
- debug_printf("r300: Implementation error: "
+ fprintf(stderr, "r300: Implementation error: "
"Unhandled constant type %d\n", constant->Type);
}
@@ -415,10 +414,10 @@ void r300_emit_fb_state(struct r300_context* r300, unsigned size, void* state)
assert(tex && tex->buffer && "cbuf is marked, but NULL!");
OUT_CS_REG_SEQ(R300_RB3D_COLOROFFSET0 + (4 * i), 1);
- OUT_CS_RELOC(tex->buffer, surf->offset, 0, RADEON_GEM_DOMAIN_VRAM, 0);
+ OUT_CS_TEX_RELOC(tex, surf->offset, 0, RADEON_GEM_DOMAIN_VRAM, 0);
OUT_CS_REG_SEQ(R300_RB3D_COLORPITCH0 + (4 * i), 1);
- OUT_CS_RELOC(tex->buffer, tex->fb_state.colorpitch[surf->level],
+ OUT_CS_TEX_RELOC(tex, tex->fb_state.colorpitch[surf->level],
0, RADEON_GEM_DOMAIN_VRAM, 0);
OUT_CS_REG(R300_US_OUT_FMT_0 + (4 * i), tex->fb_state.us_out_fmt);
@@ -434,12 +433,12 @@ void r300_emit_fb_state(struct r300_context* r300, unsigned size, void* state)
assert(tex && tex->buffer && "zsbuf is marked, but NULL!");
OUT_CS_REG_SEQ(R300_ZB_DEPTHOFFSET, 1);
- OUT_CS_RELOC(tex->buffer, surf->offset, 0, RADEON_GEM_DOMAIN_VRAM, 0);
+ OUT_CS_TEX_RELOC(tex, surf->offset, 0, RADEON_GEM_DOMAIN_VRAM, 0);
OUT_CS_REG(R300_ZB_FORMAT, tex->fb_state.zb_format);
OUT_CS_REG_SEQ(R300_ZB_DEPTHPITCH, 1);
- OUT_CS_RELOC(tex->buffer, tex->fb_state.depthpitch[surf->level],
+ OUT_CS_TEX_RELOC(tex, tex->fb_state.depthpitch[surf->level],
0, RADEON_GEM_DOMAIN_VRAM, 0);
}
@@ -448,7 +447,7 @@ void r300_emit_fb_state(struct r300_context* r300, unsigned size, void* state)
END_CS;
}
-static void r300_emit_query_start(struct r300_context *r300)
+void r300_emit_query_start(struct r300_context *r300)
{
struct r300_capabilities *caps = r300_screen(r300->context.screen)->caps;
struct r300_query *query = r300->query_current;
@@ -491,13 +490,13 @@ static void r300_emit_query_finish(struct r300_context *r300,
/* pipe 3 only */
OUT_CS_REG(R300_SU_REG_DEST, 1 << 3);
OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR, 1);
- OUT_CS_RELOC(r300->oqbo, query->offset + (sizeof(uint32_t) * 3),
+ OUT_CS_BUF_RELOC(r300->oqbo, query->offset + (sizeof(uint32_t) * 3),
0, RADEON_GEM_DOMAIN_GTT, 0);
case 3:
/* pipe 2 only */
OUT_CS_REG(R300_SU_REG_DEST, 1 << 2);
OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR, 1);
- OUT_CS_RELOC(r300->oqbo, query->offset + (sizeof(uint32_t) * 2),
+ OUT_CS_BUF_RELOC(r300->oqbo, query->offset + (sizeof(uint32_t) * 2),
0, RADEON_GEM_DOMAIN_GTT, 0);
case 2:
/* pipe 1 only */
@@ -505,19 +504,19 @@ static void r300_emit_query_finish(struct r300_context *r300,
OUT_CS_REG(R300_SU_REG_DEST,
1 << (caps->high_second_pipe ? 3 : 1));
OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR, 1);
- OUT_CS_RELOC(r300->oqbo, query->offset + (sizeof(uint32_t) * 1),
+ OUT_CS_BUF_RELOC(r300->oqbo, query->offset + (sizeof(uint32_t) * 1),
0, RADEON_GEM_DOMAIN_GTT, 0);
case 1:
/* pipe 0 only */
OUT_CS_REG(R300_SU_REG_DEST, 1 << 0);
OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR, 1);
- OUT_CS_RELOC(r300->oqbo, query->offset + (sizeof(uint32_t) * 0),
+ OUT_CS_BUF_RELOC(r300->oqbo, query->offset + (sizeof(uint32_t) * 0),
0, RADEON_GEM_DOMAIN_GTT, 0);
break;
default:
- debug_printf("r300: Implementation error: Chipset reports %d"
+ fprintf(stderr, "r300: Implementation error: Chipset reports %d"
" pixel pipes!\n", caps->num_frag_pipes);
- assert(0);
+ abort();
}
/* And, finally, reset it to normal... */
@@ -533,7 +532,7 @@ static void rv530_emit_query_single(struct r300_context *r300,
BEGIN_CS(8);
OUT_CS_REG(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_0);
OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR, 1);
- OUT_CS_RELOC(r300->oqbo, query->offset, 0, RADEON_GEM_DOMAIN_GTT, 0);
+ OUT_CS_BUF_RELOC(r300->oqbo, query->offset, 0, RADEON_GEM_DOMAIN_GTT, 0);
OUT_CS_REG(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_ALL);
END_CS;
}
@@ -546,10 +545,10 @@ static void rv530_emit_query_double(struct r300_context *r300,
BEGIN_CS(14);
OUT_CS_REG(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_0);
OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR, 1);
- OUT_CS_RELOC(r300->oqbo, query->offset, 0, RADEON_GEM_DOMAIN_GTT, 0);
+ OUT_CS_BUF_RELOC(r300->oqbo, query->offset, 0, RADEON_GEM_DOMAIN_GTT, 0);
OUT_CS_REG(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_1);
OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR, 1);
- OUT_CS_RELOC(r300->oqbo, query->offset + sizeof(uint32_t), 0, RADEON_GEM_DOMAIN_GTT, 0);
+ OUT_CS_BUF_RELOC(r300->oqbo, query->offset + sizeof(uint32_t), 0, RADEON_GEM_DOMAIN_GTT, 0);
OUT_CS_REG(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_ALL);
END_CS;
}
@@ -675,7 +674,7 @@ void r300_emit_scissor_state(struct r300_context* r300,
maxx = fb->width;
maxy = fb->height;
- if (((struct r300_rs_state*)r300->rs_state.state)->rs.scissor) {
+ if (r300->scissor_enabled) {
minx = MAX2(minx, scissor->minx);
miny = MAX2(miny, scissor->miny);
maxx = MIN2(maxx, scissor->maxx);
@@ -747,8 +746,9 @@ void r300_emit_textures_state(struct r300_context *r300,
OUT_CS_REG(R300_TX_FORMAT2_0 + (i * 4), texstate->format[2]);
OUT_CS_REG_SEQ(R300_TX_OFFSET_0 + (i * 4), 1);
- OUT_CS_RELOC(allstate->textures[i]->buffer, texstate->tile_config,
- RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0, 0);
+ OUT_CS_TEX_RELOC((struct r300_texture *)allstate->fragment_sampler_views[i]->texture,
+ texstate->tile_config,
+ RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0, 0);
}
}
END_CS;
@@ -757,9 +757,9 @@ void r300_emit_textures_state(struct r300_context *r300,
void r300_emit_aos(struct r300_context* r300, unsigned offset)
{
struct pipe_vertex_buffer *vb1, *vb2, *vbuf = r300->vertex_buffer;
- struct pipe_vertex_element *velem = r300->vertex_element;
+ struct pipe_vertex_element *velem = r300->velems->velem;
int i;
- unsigned size1, size2, aos_count = r300->vertex_element_count;
+ unsigned size1, size2, aos_count = r300->velems->count;
unsigned packet_size = (aos_count * 3 + 1) / 2;
CS_LOCALS(r300);
@@ -788,12 +788,36 @@ void r300_emit_aos(struct r300_context* r300, unsigned offset)
}
for (i = 0; i < aos_count; i++) {
- OUT_CS_RELOC_NO_OFFSET(vbuf[velem[i].vertex_buffer_index].buffer,
- RADEON_GEM_DOMAIN_GTT, 0, 0);
+ OUT_CS_BUF_RELOC_NO_OFFSET(vbuf[velem[i].vertex_buffer_index].buffer,
+ RADEON_GEM_DOMAIN_GTT, 0, 0);
}
END_CS;
}
+void r300_emit_vertex_buffer(struct r300_context* r300)
+{
+ CS_LOCALS(r300);
+
+ DBG(r300, DBG_DRAW, "r300: Preparing vertex buffer %p for render, "
+ "vertex size %d\n", r300->vbo,
+ r300->vertex_info.size);
+ /* Set the pointer to our vertex buffer. The emitted values are this:
+ * PACKET3 [3D_LOAD_VBPNTR]
+ * COUNT [1]
+ * FORMAT [size | stride << 8]
+ * OFFSET [offset into BO]
+ * VBPNTR [relocated BO]
+ */
+ BEGIN_CS(7);
+ OUT_CS_PKT3(R300_PACKET3_3D_LOAD_VBPNTR, 3);
+ OUT_CS(1);
+ OUT_CS(r300->vertex_info.size |
+ (r300->vertex_info.size << 8));
+ OUT_CS(r300->vbo_offset);
+ OUT_CS_BUF_RELOC(r300->vbo, 0, RADEON_GEM_DOMAIN_GTT, 0, 0);
+ END_CS;
+}
+
void r300_emit_vertex_stream_state(struct r300_context* r300,
unsigned size, void* state)
{
@@ -867,12 +891,6 @@ void r300_emit_vs_state(struct r300_context* r300, unsigned size, void* state)
CS_LOCALS(r300);
- if (!r300screen->caps->has_tcl) {
- debug_printf("r300: Implementation error: emit_vertex_shader called,"
- " but has_tcl is FALSE!\n");
- return;
- }
-
BEGIN_CS(size);
/* R300_VAP_PVS_CODE_CNTL_0
* R300_VAP_PVS_CONST_CNTL
@@ -902,28 +920,19 @@ void r300_emit_vs_state(struct r300_context* r300, unsigned size, void* state)
void r300_emit_vs_constant_buffer(struct r300_context* r300,
struct rc_constant_list* constants)
{
- int i;
struct r300_screen* r300screen = r300_screen(r300->context.screen);
+ unsigned i;
CS_LOCALS(r300);
- if (!r300screen->caps->has_tcl) {
- debug_printf("r300: Implementation error: emit_vertex_shader called,"
- " but has_tcl is FALSE!\n");
- return;
- }
-
- if (constants->Count == 0)
- return;
-
BEGIN_CS(constants->Count * 4 + 3);
OUT_CS_REG(R300_VAP_PVS_VECTOR_INDX_REG,
(r300screen->caps->is_r500 ?
R500_PVS_CONST_START : R300_PVS_CONST_START));
OUT_CS_ONE_REG(R300_VAP_PVS_UPLOAD_DATA, constants->Count * 4);
for (i = 0; i < constants->Count; i++) {
- const float * data = get_shader_constant(r300,
- &constants->Constants[i],
- &r300->shader_constants[PIPE_SHADER_VERTEX]);
+ const float *data = get_shader_constant(r300,
+ &constants->Constants[i],
+ &r300->shader_constants[PIPE_SHADER_VERTEX]);
OUT_CS_32F(data[0]);
OUT_CS_32F(data[1]);
OUT_CS_32F(data[2]);
@@ -980,21 +989,27 @@ void r300_emit_buffer_validate(struct r300_context *r300,
(struct r300_textures_state*)r300->textures_state.state;
struct r300_texture* tex;
struct pipe_vertex_buffer *vbuf = r300->vertex_buffer;
- struct pipe_vertex_element *velem = r300->vertex_element;
+ struct pipe_vertex_element *velem = r300->velems->velem;
struct pipe_buffer *pbuf;
unsigned i;
boolean invalid = FALSE;
+ /* upload buffers first */
+ if (r300->any_user_vbs) {
+ r300_upload_user_buffers(r300);
+ r300->any_user_vbs = false;
+ }
+
/* Clean out BOs. */
- r300->winsys->reset_bos(r300->winsys);
+ r300->rws->reset_bos(r300->rws);
validate:
/* Color buffers... */
for (i = 0; i < fb->nr_cbufs; i++) {
tex = (struct r300_texture*)fb->cbufs[i]->texture;
assert(tex && tex->buffer && "cbuf is marked, but NULL!");
- if (!r300->winsys->add_buffer(r300->winsys, tex->buffer,
- 0, RADEON_GEM_DOMAIN_VRAM)) {
+ if (!r300_add_texture(r300->rws, tex,
+ 0, RADEON_GEM_DOMAIN_VRAM)) {
r300->context.flush(&r300->context, 0, NULL);
goto validate;
}
@@ -1003,66 +1018,67 @@ validate:
if (fb->zsbuf) {
tex = (struct r300_texture*)fb->zsbuf->texture;
assert(tex && tex->buffer && "zsbuf is marked, but NULL!");
- if (!r300->winsys->add_buffer(r300->winsys, tex->buffer,
- 0, RADEON_GEM_DOMAIN_VRAM)) {
+ if (!r300_add_texture(r300->rws, tex,
+ 0, RADEON_GEM_DOMAIN_VRAM)) {
r300->context.flush(&r300->context, 0, NULL);
goto validate;
}
}
/* ...textures... */
for (i = 0; i < texstate->count; i++) {
- tex = texstate->textures[i];
- if (!tex || !texstate->sampler_states[i])
+ if (!(texstate->tx_enable & (1 << i))) {
continue;
- if (!r300->winsys->add_buffer(r300->winsys, tex->buffer,
- RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0)) {
+ }
+
+ tex = (struct r300_texture*)texstate->fragment_sampler_views[i]->texture;
+ if (!r300_add_texture(r300->rws, tex,
+ RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0)) {
r300->context.flush(&r300->context, 0, NULL);
goto validate;
}
}
/* ...occlusion query buffer... */
if (r300->dirty_state & R300_NEW_QUERY) {
- if (!r300->winsys->add_buffer(r300->winsys, r300->oqbo,
- 0, RADEON_GEM_DOMAIN_GTT)) {
+ if (!r300_add_buffer(r300->rws, r300->oqbo,
+ 0, RADEON_GEM_DOMAIN_GTT)) {
r300->context.flush(&r300->context, 0, NULL);
goto validate;
}
}
/* ...vertex buffer for SWTCL path... */
if (r300->vbo) {
- if (!r300->winsys->add_buffer(r300->winsys, r300->vbo,
- RADEON_GEM_DOMAIN_GTT, 0)) {
+ if (!r300_add_buffer(r300->rws, r300->vbo,
+ RADEON_GEM_DOMAIN_GTT, 0)) {
r300->context.flush(&r300->context, 0, NULL);
goto validate;
}
}
/* ...vertex buffers for HWTCL path... */
if (do_validate_vertex_buffers) {
- for (i = 0; i < r300->vertex_element_count; i++) {
+ for (i = 0; i < r300->velems->count; i++) {
pbuf = vbuf[velem[i].vertex_buffer_index].buffer;
- if (!r300->winsys->add_buffer(r300->winsys, pbuf,
- RADEON_GEM_DOMAIN_GTT, 0)) {
- r300->context.flush(&r300->context, 0, NULL);
+ if (!r300_add_buffer(r300->rws, pbuf,
+ RADEON_GEM_DOMAIN_GTT, 0)) {
+ r300->context.flush(&r300->context, 0, NULL);
goto validate;
}
}
}
/* ...and index buffer for HWTCL path. */
if (index_buffer) {
- if (!r300->winsys->add_buffer(r300->winsys, index_buffer,
- RADEON_GEM_DOMAIN_GTT, 0)) {
+ if (!r300_add_buffer(r300->rws, index_buffer,
+ RADEON_GEM_DOMAIN_GTT, 0)) {
r300->context.flush(&r300->context, 0, NULL);
goto validate;
}
}
-
- if (!r300->winsys->validate(r300->winsys)) {
+ if (!r300->rws->validate(r300->rws)) {
r300->context.flush(&r300->context, 0, NULL);
if (invalid) {
/* Well, hell. */
- debug_printf("r300: Stuck in validation loop, gonna quit now.");
- exit(1);
+ fprintf(stderr, "r300: Stuck in validation loop, gonna quit now.\n");
+ abort();
}
invalid = TRUE;
goto validate;
@@ -1127,7 +1143,9 @@ void r300_emit_dirty_state(struct r300_context* r300)
if (r300->dirty_state & R300_NEW_VERTEX_SHADER_CONSTANTS) {
struct r300_vertex_shader* vs = r300->vs_state.state;
- r300_emit_vs_constant_buffer(r300, &vs->code.constants);
+ if (vs->code.constants.Count) {
+ r300_emit_vs_constant_buffer(r300, &vs->code.constants);
+ }
r300->dirty_state &= ~R300_NEW_VERTEX_SHADER_CONSTANTS;
}
@@ -1135,8 +1153,10 @@ void r300_emit_dirty_state(struct r300_context* r300)
assert(r300->dirty_state == 0);
*/
- /* Finally, emit the VBO. */
- /* r300_emit_vertex_buffer(r300); */
+ /* Emit the VBO for SWTCL. */
+ if (!r300screen->caps->has_tcl) {
+ r300_emit_vertex_buffer(r300);
+ }
r300->dirty_hw++;
}
diff --git a/src/gallium/drivers/r300/r300_emit.h b/src/gallium/drivers/r300/r300_emit.h
index 449e640a88..7db2fc6a1a 100644
--- a/src/gallium/drivers/r300/r300_emit.h
+++ b/src/gallium/drivers/r300/r300_emit.h
@@ -57,8 +57,7 @@ void r500_emit_fs_constant_buffer(struct r300_context* r300,
void r300_emit_fb_state(struct r300_context* r300, unsigned size, void* state);
-void r300_emit_query_begin(struct r300_context* r300,
- struct r300_query* query);
+void r300_emit_query_start(struct r300_context* r300);
void r300_emit_query_end(struct r300_context* r300);
diff --git a/src/gallium/drivers/r300/r300_flush.c b/src/gallium/drivers/r300/r300_flush.c
index e37d309270..70de152713 100644
--- a/src/gallium/drivers/r300/r300_flush.c
+++ b/src/gallium/drivers/r300/r300_flush.c
@@ -61,6 +61,12 @@ static void r300_flush(struct pipe_context* pipe,
atom->dirty = TRUE;
}
}
+
+ /* Unmark HWTCL state for SWTCL. */
+ if (!r300_screen(pipe->screen)->caps->has_tcl) {
+ r300->vs_state.dirty = FALSE;
+ r300->dirty_state &= ~R300_NEW_VERTEX_SHADER_CONSTANTS;
+ }
}
/* reset flushed query */
diff --git a/src/gallium/drivers/r300/r300_fs.c b/src/gallium/drivers/r300/r300_fs.c
index 3c2625269b..e23fef8c9f 100644
--- a/src/gallium/drivers/r300/r300_fs.c
+++ b/src/gallium/drivers/r300/r300_fs.c
@@ -204,9 +204,9 @@ static void r300_translate_fragment_shader(
r3xx_compile_fragment_program(&compiler);
if (compiler.Base.Error) {
/* XXX failover maybe? */
- DBG(r300, DBG_FP, "r300: Error compiling fragment program: %s\n",
- compiler.Base.ErrorMsg);
- assert(0);
+ fprintf(stderr, "r300 FP: Compiler Error:\n%s",
+ compiler.Base.ErrorMsg);
+ abort();
}
/* And, finally... */
diff --git a/src/gallium/drivers/r300/r300_query.c b/src/gallium/drivers/r300/r300_query.c
index ca00b043c5..1778dc9cca 100644
--- a/src/gallium/drivers/r300/r300_query.c
+++ b/src/gallium/drivers/r300/r300_query.c
@@ -30,6 +30,8 @@
#include "r300_query.h"
#include "r300_reg.h"
+#include <stdio.h>
+
static struct pipe_query *r300_create_query(struct pipe_context *pipe,
unsigned query_type)
{
@@ -97,8 +99,10 @@ static void r300_end_query(struct pipe_context* pipe,
struct pipe_query* query)
{
struct r300_context* r300 = r300_context(pipe);
+ struct r300_query* q = (struct r300_query*)query;
r300_emit_query_end(r300);
+ q->begin_emitted = false;
r300->query_current = NULL;
}
@@ -135,8 +139,8 @@ static boolean r300_get_query_result(struct pipe_context* pipe,
if (*map == ~0U) {
/* Looks like our results aren't ready yet. */
if (wait) {
- debug_printf("r300: Despite waiting, OQ results haven't"
- " come in yet.\n");
+ fprintf(stderr, "r300: Despite waiting, OQ results haven't "
+ "come in yet.\n");
}
temp = ~0U;
break;
@@ -155,10 +159,33 @@ static boolean r300_get_query_result(struct pipe_context* pipe,
return TRUE;
}
+static void r300_render_condition(struct pipe_context *pipe,
+ struct pipe_query *query,
+ uint mode)
+{
+ struct r300_context *r300 = r300_context(pipe);
+ uint64_t result;
+ boolean wait;
+
+ if (query) {
+ wait = mode == PIPE_RENDER_COND_WAIT ||
+ mode == PIPE_RENDER_COND_BY_REGION_WAIT;
+
+ if (!r300_get_query_result(pipe, query, wait, &result)) {
+ r300->skip_rendering = FALSE;
+ }
+
+ r300->skip_rendering = result == 0;
+ } else {
+ r300->skip_rendering = FALSE;
+ }
+}
+
void r300_init_query_functions(struct r300_context* r300) {
r300->context.create_query = r300_create_query;
r300->context.destroy_query = r300_destroy_query;
r300->context.begin_query = r300_begin_query;
r300->context.end_query = r300_end_query;
r300->context.get_query_result = r300_get_query_result;
+ r300->context.render_condition = r300_render_condition;
}
diff --git a/src/gallium/drivers/r300/r300_reg.h b/src/gallium/drivers/r300/r300_reg.h
index c67cc86871..bb87cc7eae 100644
--- a/src/gallium/drivers/r300/r300_reg.h
+++ b/src/gallium/drivers/r300/r300_reg.h
@@ -1500,6 +1500,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
# define R300_ANISO_THRESHOLD_MASK (7<<17)
# define R500_MACRO_SWITCH (1<<22)
+# define R500_TX_MAX_ANISO(x) ((x) << 23)
+# define R500_TX_MAX_ANISO_MASK (63 << 23)
+# define R500_TX_ANISO_HIGH_QUALITY (1 << 30)
+
# define R500_BORDER_FIX (1<<31)
#define R300_TX_FORMAT0_0 0x4480
@@ -1552,6 +1556,26 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
# define R300_TX_FORMAT_32F_32F 0x1C
# define R300_TX_FORMAT_32F_32F_32F_32F 0x1D
# define R300_TX_FORMAT_W24_FP 0x1E
+# define R400_TX_FORMAT_ATI2N 0x1F
+
+/* These need TX_FORMAT2_[0-15].TXFORMAT_MSB set.
+
+ My guess is the 10-bit formats are the 8-bit ones but with filtering being
+ performed with the precision of 10 bits per channel. This makes sense
+ with sRGB textures since the conversion to linear space reduces the precision
+ significantly so the shader gets approximately the 8-bit precision
+ in the end. It might also improve the quality of HDR rendering where
+ high-precision filtering is desirable.
+
+ Again, this is guessed, the formats might mean something entirely else.
+ The others should be fine. */
+# define R500_TX_FORMAT_X1 0x0
+# define R500_TX_FORMAT_X1_REV 0x1
+# define R500_TX_FORMAT_X10 0x2
+# define R500_TX_FORMAT_Y10X10 0x3
+# define R500_TX_FORMAT_W10Z10Y10X10 0x4
+# define R500_TX_FORMAT_ATI1N 0x5
+
# define R300_TX_FORMAT_SIGNED_W (1 << 5)
# define R300_TX_FORMAT_SIGNED_Z (1 << 6)
@@ -1716,6 +1740,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
# define R300_PFS_CNTL_TEX_OFFSET_MASK (31 << 13)
# define R300_PFS_CNTL_TEX_END_SHIFT 18
# define R300_PFS_CNTL_TEX_END_MASK (31 << 18)
+# define R400_PFS_CNTL_TEX_OFFSET_MSB_SHIFT 24
+# define R400_PFS_CNTL_TEX_OFFSET_MSB_MASK (0xf << 24)
+# define R400_PFS_CNTL_TEX_END_MSB_SHIFT 28
+# define R400_PFS_CNTL_TEX_END_MSB_MASK (0xf << 28)
/* gap */
@@ -1740,6 +1768,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
# define R300_TEX_SIZE_MASK (31 << 17)
# define R300_RGBA_OUT (1 << 22)
# define R300_W_OUT (1 << 23)
+# define R400_TEX_START_MSB_SHIFT 24
+# define R400_TEX_START_MSG_MASK (0xf << 24)
+# define R400_TEX_SIZE_MSB_SHIFT 28
+# define R400_TEX_SIZE_MSG_MASK (0xf << 28)
/* TEX
* As far as I can tell, texture instructions cannot write into output
@@ -1760,6 +1792,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
# define R300_TEX_OP_TXP 3
# define R300_TEX_OP_TXB 4
# define R300_TEX_INST_MASK (7 << 15)
+# define R400_SRC_ADDR_EXT_BIT (1 << 19)
+# define R400_DST_ADDR_EXT_BIT (1 << 20)
/* Output format from the unfied shader */
#define R300_US_OUT_FMT_0 0x46A4
@@ -2068,6 +2102,43 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
# define R300_ALU_OUTA_CLAMP (1 << 30)
/* END: Fragment program instruction set */
+/* R4xx extended fragment shader registers. */
+#define R400_US_ALU_EXT_ADDR_0 0x4ac0 /* up to 63 (0x4bbc) */
+# define R400_ADDR0_EXT_RGB_MSB_BIT 0x01
+# define R400_ADDR1_EXT_RGB_MSB_BIT 0x02
+# define R400_ADDR2_EXT_RGB_MSB_BIT 0x04
+# define R400_ADDRD_EXT_RGB_MSB_BIT 0x08
+# define R400_ADDR0_EXT_A_MSB_BIT 0x10
+# define R400_ADDR1_EXT_A_MSB_BIT 0x20
+# define R400_ADDR2_EXT_A_MSB_BIT 0x40
+# define R400_ADDRD_EXT_A_MSB_BIT 0x80
+#define R400_US_CODE_BANK 0x46b8
+# define R400_BANK_SHIFT 0
+# define R400_BANK_MASK 0xf
+# define R400_R390_MODE_ENABLE (1 << 4)
+#define R400_US_CODE_EXT 0x46bc
+# define R400_ALU_OFFSET_MSB_SHIFT 0
+# define R400_ALU_OFFSET_MSB_MASK (0x7 << 0)
+# define R400_ALU_SIZE_MSB_SHIFT 3
+# define R400_ALU_SIZE_MSB_MASK (0x7 << 3)
+# define R400_ALU_START0_MSB_SHIFT 6
+# define R400_ALU_START0_MSB_MASK (0x7 << 6)
+# define R400_ALU_SIZE0_MSB_SHIFT 9
+# define R400_ALU_SIZE0_MSB_MASK (0x7 << 9)
+# define R400_ALU_START1_MSB_SHIFT 12
+# define R400_ALU_START1_MSB_MASK (0x7 << 12)
+# define R400_ALU_SIZE1_MSB_SHIFT 15
+# define R400_ALU_SIZE1_MSB_MASK (0x7 << 15)
+# define R400_ALU_START2_MSB_SHIFT 18
+# define R400_ALU_START2_MSB_MASK (0x7 << 18)
+# define R400_ALU_SIZE2_MSB_SHIFT 21
+# define R400_ALU_SIZE2_MSB_MASK (0x7 << 21)
+# define R400_ALU_START3_MSB_SHIFT 24
+# define R400_ALU_START3_MSB_MASK (0x7 << 24)
+# define R400_ALU_SIZE3_MSB_SHIFT 27
+# define R400_ALU_SIZE3_MSB_MASK (0x7 << 27)
+/* END: R4xx extended fragment shader registers. */
+
/* Fog: Fog Blending Enable */
#define R300_FG_FOG_BLEND 0x4bc0
# define R300_FG_FOG_BLEND_DISABLE (0 << 0)
@@ -3266,7 +3337,6 @@ enum {
# define R300_W_SRC_US (0 << 2)
# define R300_W_SRC_RAS (1 << 2)
-
/* Draw a primitive from vertex data in arrays loaded via 3D_LOAD_VBPNTR.
* Two parameter dwords:
* 0. VAP_VTX_FMT: The first parameter is not written to hardware
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
index 6c891029a5..7898329771 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -30,18 +30,17 @@
#include "util/u_format.h"
#include "util/u_memory.h"
+#include "util/u_upload_mgr.h"
#include "util/u_prim.h"
#include "r300_cs.h"
#include "r300_context.h"
+#include "r300_screen_buffer.h"
#include "r300_emit.h"
#include "r300_reg.h"
#include "r300_render.h"
#include "r300_state_derived.h"
-/* r300_render: Vertex and index buffer primitive emission. */
-#define R300_MAX_VBO_SIZE (1024 * 1024)
-
/* XXX The DRM rejects VAP_ALT_NUM_VERTICES.. */
//#define ENABLE_ALT_NUM_VERTS
@@ -123,7 +122,7 @@ static uint32_t r300_provoking_vertex_fixes(struct r300_context *r300,
static boolean r300_reserve_cs_space(struct r300_context *r300,
unsigned dwords)
{
- if (!r300->winsys->check_cs(r300->winsys, dwords)) {
+ if (!r300->rws->check_cs(r300->rws, dwords)) {
r300->context.flush(&r300->context, 0, NULL);
return TRUE;
}
@@ -131,9 +130,36 @@ static boolean r300_reserve_cs_space(struct r300_context *r300,
}
static boolean immd_is_good_idea(struct r300_context *r300,
- unsigned count)
+ unsigned count)
{
- return count <= 4;
+ struct pipe_vertex_element* velem;
+ struct pipe_vertex_buffer* vbuf;
+ boolean checked[PIPE_MAX_ATTRIBS] = {0};
+ unsigned vertex_element_count = r300->velems->count;
+ unsigned i, vbi;
+
+ if (count > 10) {
+ return FALSE;
+ }
+
+ /* We shouldn't map buffers referenced by CS, busy buffers,
+ * and ones placed in VRAM. */
+ /* XXX Check for VRAM buffers. */
+ for (i = 0; i < vertex_element_count; i++) {
+ velem = &r300->velems->velem[i];
+ vbi = velem->vertex_buffer_index;
+
+ if (!checked[vbi]) {
+ vbuf = &r300->vertex_buffer[vbi];
+
+ if (r300_buffer_is_referenced(r300, vbuf->buffer)) {
+ /* It's a very bad idea to map it... */
+ return FALSE;
+ }
+ checked[vbi] = TRUE;
+ }
+ }
+ return TRUE;
}
static void r300_emit_draw_arrays_immediate(struct r300_context *r300,
@@ -143,7 +169,7 @@ static void r300_emit_draw_arrays_immediate(struct r300_context *r300,
{
struct pipe_vertex_element* velem;
struct pipe_vertex_buffer* vbuf;
- unsigned vertex_element_count = r300->vertex_element_count;
+ unsigned vertex_element_count = r300->velems->count;
unsigned i, v, vbi, dw, elem_offset, dwords;
/* Size of the vertex, in dwords. */
@@ -166,7 +192,7 @@ static void r300_emit_draw_arrays_immediate(struct r300_context *r300,
/* Calculate the vertex size, offsets, strides etc. and map the buffers. */
for (i = 0; i < vertex_element_count; i++) {
- velem = &r300->vertex_element[i];
+ velem = &r300->velems->velem[i];
offset[i] = velem->src_offset / 4;
size[i] = util_format_get_blocksize(velem->src_format) / 4;
vertex_size += size[i];
@@ -183,18 +209,19 @@ static void r300_emit_draw_arrays_immediate(struct r300_context *r300,
}
}
- dwords = 10 + count * vertex_size;
+ dwords = 9 + count * vertex_size;
r300_reserve_cs_space(r300, r300_get_num_dirty_dwords(r300) + dwords);
- r300_emit_buffer_validate(r300, FALSE, 0);
+ r300_emit_buffer_validate(r300, FALSE, NULL);
r300_emit_dirty_state(r300);
BEGIN_CS(dwords);
OUT_CS_REG(R300_GA_COLOR_CONTROL,
r300_provoking_vertex_fixes(r300, mode));
OUT_CS_REG(R300_VAP_VTX_SIZE, vertex_size);
- OUT_CS_REG(R300_VAP_VF_MIN_VTX_INDX, 0);
- OUT_CS_REG(R300_VAP_VF_MAX_VTX_INDX, count - 1);
+ OUT_CS_REG_SEQ(R300_VAP_VF_MAX_VTX_INDX, 2);
+ OUT_CS(count - 1);
+ OUT_CS(0);
OUT_CS_PKT3(R300_PACKET3_3D_DRAW_IMMD_2, count * vertex_size);
OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_EMBEDDED | (count << 16) |
r300_translate_primitive(mode));
@@ -202,7 +229,7 @@ static void r300_emit_draw_arrays_immediate(struct r300_context *r300,
/* Emit vertices. */
for (v = 0; v < count; v++) {
for (i = 0; i < vertex_element_count; i++) {
- velem = &r300->vertex_element[i];
+ velem = &r300->velems->velem[i];
vbi = velem->vertex_buffer_index;
elem_offset = offset[i] + stride[vbi] * (v + start);
@@ -215,7 +242,7 @@ static void r300_emit_draw_arrays_immediate(struct r300_context *r300,
/* Unmap buffers. */
for (i = 0; i < vertex_element_count; i++) {
- vbi = r300->vertex_element[i].vertex_buffer_index;
+ vbi = r300->velems->velem[i].vertex_buffer_index;
if (map[vbi]) {
vbuf = &r300->vertex_buffer[vbi];
@@ -238,15 +265,16 @@ static void r300_emit_draw_arrays(struct r300_context *r300,
if (alt_num_verts) {
assert(count < (1 << 24));
- BEGIN_CS(10);
+ BEGIN_CS(9);
OUT_CS_REG(R500_VAP_ALT_NUM_VERTICES, count);
} else {
- BEGIN_CS(8);
+ BEGIN_CS(7);
}
OUT_CS_REG(R300_GA_COLOR_CONTROL,
r300_provoking_vertex_fixes(r300, mode));
- OUT_CS_REG(R300_VAP_VF_MIN_VTX_INDX, 0);
- OUT_CS_REG(R300_VAP_VF_MAX_VTX_INDX, count - 1);
+ OUT_CS_REG_SEQ(R300_VAP_VF_MAX_VTX_INDX, 2);
+ OUT_CS(count - 1);
+ OUT_CS(0);
OUT_CS_PKT3(R300_PACKET3_3D_DRAW_VBUF_2, 0);
OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_LIST | (count << 16) |
r300_translate_primitive(mode) |
@@ -272,24 +300,24 @@ static void r300_emit_draw_elements(struct r300_context *r300,
#endif
CS_LOCALS(r300);
- assert((start * indexSize) % 4 == 0);
assert(count < (1 << 24));
+ maxIndex = MIN2(maxIndex, r300->vertex_buffer_max_index);
+
DBG(r300, DBG_DRAW, "r300: Indexbuf of %u indices, min %u max %u\n",
count, minIndex, maxIndex);
- maxIndex = MIN2(maxIndex, ((1 << 24) - 1));
-
if (alt_num_verts) {
- BEGIN_CS(16);
+ BEGIN_CS(15);
OUT_CS_REG(R500_VAP_ALT_NUM_VERTICES, count);
} else {
- BEGIN_CS(14);
+ BEGIN_CS(13);
}
OUT_CS_REG(R300_GA_COLOR_CONTROL,
r300_provoking_vertex_fixes(r300, mode));
- OUT_CS_REG(R300_VAP_VF_MIN_VTX_INDX, minIndex);
- OUT_CS_REG(R300_VAP_VF_MAX_VTX_INDX, maxIndex);
+ OUT_CS_REG_SEQ(R300_VAP_VF_MAX_VTX_INDX, 2);
+ OUT_CS(maxIndex);
+ OUT_CS(minIndex);
OUT_CS_PKT3(R300_PACKET3_3D_DRAW_INDX_2, 0);
if (indexSize == 4) {
count_dwords = count;
@@ -313,14 +341,15 @@ static void r300_emit_draw_elements(struct r300_context *r300,
OUT_CS(R300_INDX_BUFFER_ONE_REG_WR | (R300_VAP_PORT_IDX0 >> 2) |
(0 << R300_INDX_BUFFER_SKIP_SHIFT));
OUT_CS(offset_dwords << 2);
- OUT_CS_RELOC(indexBuffer, count_dwords,
- RADEON_GEM_DOMAIN_GTT, 0, 0);
+ OUT_CS_BUF_RELOC(indexBuffer, count_dwords,
+ RADEON_GEM_DOMAIN_GTT, 0, 0);
END_CS;
}
static void r300_shorten_ubyte_elts(struct r300_context* r300,
struct pipe_buffer** elts,
+ unsigned start,
unsigned count)
{
struct pipe_screen* screen = r300->context.screen;
@@ -338,6 +367,8 @@ static void r300_shorten_ubyte_elts(struct r300_context* r300,
in_map = pipe_buffer_map(screen, *elts, PIPE_BUFFER_USAGE_CPU_READ);
out_map = pipe_buffer_map(screen, new_elts, PIPE_BUFFER_USAGE_CPU_WRITE);
+ in_map += start;
+
for (i = 0; i < count; i++) {
*out_map = (unsigned short)*in_map;
in_map++;
@@ -350,6 +381,32 @@ static void r300_shorten_ubyte_elts(struct r300_context* r300,
*elts = new_elts;
}
+static void r300_align_ushort_elts(struct r300_context *r300,
+ struct pipe_buffer **elts,
+ unsigned start, unsigned count)
+{
+ struct pipe_screen* screen = r300->context.screen;
+ struct pipe_buffer* new_elts;
+ unsigned short *in_map;
+ unsigned short *out_map;
+
+ new_elts = screen->buffer_create(screen, 32,
+ PIPE_BUFFER_USAGE_INDEX |
+ PIPE_BUFFER_USAGE_CPU_WRITE |
+ PIPE_BUFFER_USAGE_GPU_READ,
+ 2 * count);
+
+ in_map = pipe_buffer_map(screen, *elts, PIPE_BUFFER_USAGE_CPU_READ);
+ out_map = pipe_buffer_map(screen, new_elts, PIPE_BUFFER_USAGE_CPU_WRITE);
+
+ memcpy(out_map, in_map+start, 2 * count);
+
+ pipe_buffer_unmap(screen, *elts);
+ pipe_buffer_unmap(screen, new_elts);
+
+ *elts = new_elts;
+}
+
/* This is the fast-path drawing & emission for HW TCL. */
void r300_draw_range_elements(struct pipe_context* pipe,
struct pipe_buffer* indexBuffer,
@@ -370,23 +427,35 @@ void r300_draw_range_elements(struct pipe_context* pipe,
#endif
unsigned short_count;
+ if (r300->skip_rendering) {
+ return;
+ }
+
if (!u_trim_pipe_prim(mode, &count)) {
return;
}
if (indexSize == 1) {
- r300_shorten_ubyte_elts(r300, &indexBuffer, count);
+ r300_shorten_ubyte_elts(r300, &indexBuffer, start, count);
indexSize = 2;
+ start = 0;
+ } else if (indexSize == 2 && start % 2 != 0) {
+ r300_align_ushort_elts(r300, &indexBuffer, start, count);
+ start = 0;
}
r300_update_derived_state(r300);
+ r300_upload_index_buffer(r300, &indexBuffer, indexSize, start, count);
+
/* 128 dwords for emit_aos and emit_draw_elements */
r300_reserve_cs_space(r300, r300_get_num_dirty_dwords(r300) + 128);
r300_emit_buffer_validate(r300, TRUE, indexBuffer);
r300_emit_dirty_state(r300);
r300_emit_aos(r300, 0);
+ u_upload_flush(r300->upload_vb);
+ u_upload_flush(r300->upload_ib);
if (alt_num_verts || count <= 65535) {
r300_emit_draw_elements(r300, indexBuffer, indexSize, minIndex,
maxIndex, mode, start, count);
@@ -409,7 +478,7 @@ void r300_draw_range_elements(struct pipe_context* pipe,
}
if (indexBuffer != orgIndexBuffer) {
- pipe->screen->buffer_destroy(indexBuffer);
+ pipe_buffer_reference( &indexBuffer, NULL );
}
}
@@ -438,6 +507,10 @@ void r300_draw_arrays(struct pipe_context* pipe, unsigned mode,
#endif
unsigned short_count;
+ if (r300->skip_rendering) {
+ return;
+ }
+
if (!u_trim_pipe_prim(mode, &count)) {
return;
}
@@ -450,7 +523,7 @@ void r300_draw_arrays(struct pipe_context* pipe, unsigned mode,
/* Make sure there are at least 128 spare dwords in the command buffer.
* (most of it being consumed by emit_aos) */
r300_reserve_cs_space(r300, r300_get_num_dirty_dwords(r300) + 128);
- r300_emit_buffer_validate(r300, TRUE, 0);
+ r300_emit_buffer_validate(r300, TRUE, NULL);
r300_emit_dirty_state(r300);
if (alt_num_verts || count <= 65535) {
@@ -468,11 +541,12 @@ void r300_draw_arrays(struct pipe_context* pipe, unsigned mode,
/* Again, we emit both AOS and draw_arrays so there should be
* at least 128 spare dwords. */
if (count && r300_reserve_cs_space(r300, 128)) {
- r300_emit_buffer_validate(r300, TRUE, 0);
+ r300_emit_buffer_validate(r300, TRUE, NULL);
r300_emit_dirty_state(r300);
}
} while (count);
}
+ u_upload_flush(r300->upload_vb);
}
}
@@ -503,13 +577,6 @@ void r300_swtcl_draw_arrays(struct pipe_context* pipe,
draw_set_mapped_element_buffer(r300->draw, 0, NULL);
- draw_set_mapped_constant_buffer(r300->draw,
- PIPE_SHADER_VERTEX,
- 0,
- r300->shader_constants[PIPE_SHADER_VERTEX].constants,
- r300->shader_constants[PIPE_SHADER_VERTEX].count *
- (sizeof(float) * 4));
-
draw_arrays(r300->draw, mode, start, count);
for (i = 0; i < r300->vertex_buffer_count; i++) {
@@ -548,13 +615,6 @@ void r300_swtcl_draw_range_elements(struct pipe_context* pipe,
draw_set_mapped_element_buffer_range(r300->draw, indexSize,
minIndex, maxIndex, indices);
- draw_set_mapped_constant_buffer(r300->draw,
- PIPE_SHADER_VERTEX,
- 0,
- r300->shader_constants[PIPE_SHADER_VERTEX].constants,
- r300->shader_constants[PIPE_SHADER_VERTEX].count *
- (sizeof(float) * 4));
-
draw_arrays(r300->draw, mode, start, count);
for (i = 0; i < r300->vertex_buffer_count; i++) {
@@ -620,9 +680,9 @@ static boolean r300_render_allocate_vertices(struct vbuf_render* render,
r300render->vbo = pipe_buffer_create(screen,
64,
PIPE_BUFFER_USAGE_VERTEX,
- R300_MAX_VBO_SIZE);
+ R300_MAX_DRAW_VBO_SIZE);
r300render->vbo_offset = 0;
- r300render->vbo_size = R300_MAX_VBO_SIZE;
+ r300render->vbo_size = R300_MAX_DRAW_VBO_SIZE;
}
r300render->vertex_size = vertex_size;
@@ -688,6 +748,7 @@ static void r300_render_draw_arrays(struct vbuf_render* render,
CS_LOCALS(r300);
r300_reserve_cs_space(r300, r300_get_num_dirty_dwords(r300) + 2);
+ r300_emit_buffer_validate(r300, FALSE, NULL);
r300_emit_dirty_state(r300);
DBG(r300, DBG_DRAW, "r300: Doing vbuf render, count %d\n", count);
@@ -711,6 +772,7 @@ static void r300_render_draw(struct vbuf_render* render,
CS_LOCALS(r300);
r300_reserve_cs_space(r300, r300_get_num_dirty_dwords(r300) + dwords);
+ r300_emit_buffer_validate(r300, FALSE, NULL);
r300_emit_dirty_state(r300);
BEGIN_CS(dwords);
diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
index d397a8eb2b..50e5e9307e 100644
--- a/src/gallium/drivers/r300/r300_screen.c
+++ b/src/gallium/drivers/r300/r300_screen.c
@@ -1,5 +1,6 @@
/*
* Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com>
+ * Copyright 2010 Marek Olšák <maraeo@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -20,16 +21,12 @@
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE. */
-#include "util/u_inlines.h"
#include "util/u_format.h"
#include "util/u_memory.h"
-#include "util/u_simple_screen.h"
#include "r300_context.h"
-#include "r300_screen.h"
#include "r300_texture.h"
-
-#include "radeon_winsys.h"
+#include "r300_screen_buffer.h"
#include "r300_winsys.h"
/* Return the identifier behind whom the brave coders responsible for this
@@ -167,7 +164,7 @@ static int r300_get_param(struct pipe_screen* pscreen, int param)
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
return 0;
default:
- debug_printf("r300: Implementation error: Bad param %d\n",
+ fprintf(stderr, "r300: Implementation error: Bad param %d\n",
param);
return 0;
}
@@ -196,7 +193,7 @@ static float r300_get_paramf(struct pipe_screen* pscreen, int param)
case PIPE_CAP_MAX_TEXTURE_LOD_BIAS:
return 16.0f;
default:
- debug_printf("r300: Implementation error: Bad paramf %d\n",
+ fprintf(stderr, "r300: Implementation error: Bad paramf %d\n",
param);
return 0.0f;
}
@@ -210,12 +207,17 @@ static boolean r300_is_format_supported(struct pipe_screen* screen,
{
uint32_t retval = 0;
boolean is_r500 = r300_screen(screen)->caps->is_r500;
+ boolean is_r400 = r300_screen(screen)->caps->is_r400;
boolean is_z24 = format == PIPE_FORMAT_X8Z24_UNORM ||
- format == PIPE_FORMAT_S8Z24_UNORM;
+ format == PIPE_FORMAT_S8_USCALED_Z24_UNORM;
boolean is_color2101010 = format == PIPE_FORMAT_R10G10B10A2_UNORM;
+ boolean is_ati1n = format == PIPE_FORMAT_RGTC1_UNORM ||
+ format == PIPE_FORMAT_RGTC1_SNORM;
+ boolean is_ati2n = format == PIPE_FORMAT_RGTC2_UNORM ||
+ format == PIPE_FORMAT_RGTC2_SNORM;
if (target >= PIPE_MAX_TEXTURE_TYPES) {
- debug_printf("r300: Implementation error: Received bogus texture "
+ fprintf(stderr, "r300: Implementation error: Received bogus texture "
"target %d in %s\n", target, __FUNCTION__);
return FALSE;
}
@@ -224,6 +226,10 @@ static boolean r300_is_format_supported(struct pipe_screen* screen,
if ((usage & PIPE_TEXTURE_USAGE_SAMPLER) &&
/* Z24 cannot be sampled from on non-r5xx. */
(is_r500 || !is_z24) &&
+ /* ATI1N is r5xx-only. */
+ (is_r500 || !is_ati1n) &&
+ /* ATI2N is supported on r4xx-r5xx. */
+ (is_r400 || is_r500 || !is_ati2n) &&
r300_is_sampler_format_supported(format)) {
retval |= PIPE_TEXTURE_USAGE_SAMPLER;
}
@@ -231,14 +237,16 @@ static boolean r300_is_format_supported(struct pipe_screen* screen,
/* Check colorbuffer format support. */
if ((usage & (PIPE_TEXTURE_USAGE_RENDER_TARGET |
PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
- PIPE_TEXTURE_USAGE_PRIMARY)) &&
+ PIPE_TEXTURE_USAGE_SCANOUT |
+ PIPE_TEXTURE_USAGE_SHARED)) &&
/* 2101010 cannot be rendered to on non-r5xx. */
(is_r500 || !is_color2101010) &&
r300_is_colorbuffer_format_supported(format)) {
retval |= usage &
(PIPE_TEXTURE_USAGE_RENDER_TARGET |
PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
- PIPE_TEXTURE_USAGE_PRIMARY);
+ PIPE_TEXTURE_USAGE_SCANOUT |
+ PIPE_TEXTURE_USAGE_SHARED);
}
/* Check depth-stencil format support. */
@@ -250,82 +258,22 @@ static boolean r300_is_format_supported(struct pipe_screen* screen,
return retval == usage;
}
-static struct pipe_transfer*
-r300_get_tex_transfer(struct pipe_screen *screen,
- struct pipe_texture *texture,
- unsigned face, unsigned level, unsigned zslice,
- enum pipe_transfer_usage usage, unsigned x, unsigned y,
- unsigned w, unsigned h)
-{
- struct r300_texture *tex = (struct r300_texture *)texture;
- struct r300_transfer *trans;
- struct r300_screen *rscreen = r300_screen(screen);
- unsigned offset;
-
- offset = r300_texture_get_offset(tex, level, zslice, face); /* in bytes */
-
- trans = CALLOC_STRUCT(r300_transfer);
- if (trans) {
- pipe_texture_reference(&trans->transfer.texture, texture);
- trans->transfer.x = x;
- trans->transfer.y = y;
- trans->transfer.width = w;
- trans->transfer.height = h;
- trans->transfer.stride = r300_texture_get_stride(rscreen, tex, level);
- trans->transfer.usage = usage;
- trans->transfer.zslice = zslice;
- trans->transfer.face = face;
-
- trans->offset = offset;
- }
- return &trans->transfer;
-}
-
-static void
-r300_tex_transfer_destroy(struct pipe_transfer *trans)
-{
- pipe_texture_reference(&trans->texture, NULL);
- FREE(trans);
-}
-
-static void* r300_transfer_map(struct pipe_screen* screen,
- struct pipe_transfer* transfer)
-{
- struct r300_texture* tex = (struct r300_texture*)transfer->texture;
- char* map;
- enum pipe_format format = tex->tex.format;
-
- map = pipe_buffer_map(screen, tex->buffer,
- pipe_transfer_buffer_flags(transfer));
-
- if (!map) {
- return NULL;
- }
-
- return map + r300_transfer(transfer)->offset +
- transfer->y / util_format_get_blockheight(format) * transfer->stride +
- transfer->x / util_format_get_blockwidth(format) * util_format_get_blocksize(format);
-}
-
-static void r300_transfer_unmap(struct pipe_screen* screen,
- struct pipe_transfer* transfer)
-{
- struct r300_texture* tex = (struct r300_texture*)transfer->texture;
- pipe_buffer_unmap(screen, tex->buffer);
-}
-
static void r300_destroy_screen(struct pipe_screen* pscreen)
{
struct r300_screen* r300screen = r300_screen(pscreen);
+ struct r300_winsys_screen *rws = r300_winsys_screen(pscreen);
+
+ if (rws)
+ rws->destroy(rws);
FREE(r300screen->caps);
FREE(r300screen);
}
-struct pipe_screen* r300_create_screen(struct radeon_winsys* radeon_winsys)
+struct pipe_screen* r300_create_screen(struct r300_winsys_screen *rws)
{
- struct r300_screen* r300screen = CALLOC_STRUCT(r300_screen);
- struct r300_capabilities* caps = CALLOC_STRUCT(r300_capabilities);
+ struct r300_screen *r300screen = CALLOC_STRUCT(r300_screen);
+ struct r300_capabilities *caps = CALLOC_STRUCT(r300_capabilities);
if (!r300screen || !caps) {
FREE(r300screen);
@@ -333,16 +281,16 @@ struct pipe_screen* r300_create_screen(struct radeon_winsys* radeon_winsys)
return NULL;
}
- caps->pci_id = radeon_winsys->pci_id;
- caps->num_frag_pipes = radeon_winsys->gb_pipes;
- caps->num_z_pipes = radeon_winsys->z_pipes;
+ caps->pci_id = rws->get_value(rws, R300_VID_PCI_ID);
+ caps->num_frag_pipes = rws->get_value(rws, R300_VID_GB_PIPES);
+ caps->num_z_pipes = rws->get_value(rws, R300_VID_Z_PIPES);
r300_init_debug(r300screen);
r300_parse_chipset(caps);
r300screen->caps = caps;
- r300screen->radeon_winsys = radeon_winsys;
- r300screen->screen.winsys = (struct pipe_winsys*)radeon_winsys;
+ r300screen->rws = rws;
+ r300screen->screen.winsys = (struct pipe_winsys*)rws;
r300screen->screen.destroy = r300_destroy_screen;
r300screen->screen.get_name = r300_get_name;
r300screen->screen.get_vendor = r300_get_vendor;
@@ -350,13 +298,15 @@ struct pipe_screen* r300_create_screen(struct radeon_winsys* radeon_winsys)
r300screen->screen.get_paramf = r300_get_paramf;
r300screen->screen.is_format_supported = r300_is_format_supported;
r300screen->screen.context_create = r300_create_context;
- r300screen->screen.get_tex_transfer = r300_get_tex_transfer;
- r300screen->screen.tex_transfer_destroy = r300_tex_transfer_destroy;
- r300screen->screen.transfer_map = r300_transfer_map;
- r300screen->screen.transfer_unmap = r300_transfer_unmap;
r300_init_screen_texture_functions(&r300screen->screen);
- u_simple_screen_init(&r300screen->screen);
+ r300_screen_init_buffer_functions(r300screen);
return &r300screen->screen;
}
+
+struct r300_winsys_screen *
+r300_winsys_screen(struct pipe_screen *screen)
+{
+ return r300_screen(screen)->rws;
+}
diff --git a/src/gallium/drivers/r300/r300_screen.h b/src/gallium/drivers/r300/r300_screen.h
index 502fbfa5a2..1cf8b7452d 100644
--- a/src/gallium/drivers/r300/r300_screen.h
+++ b/src/gallium/drivers/r300/r300_screen.h
@@ -1,5 +1,6 @@
/*
* Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com>
+ * Copyright 2010 Marek Olšák <maraeo@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -27,13 +28,13 @@
#include "r300_chipset.h"
-struct radeon_winsys;
+#include <stdio.h>
struct r300_screen {
/* Parent class */
struct pipe_screen screen;
- struct radeon_winsys* radeon_winsys;
+ struct r300_winsys_screen *rws;
/* Chipset capabilities */
struct r300_capabilities* caps;
@@ -42,26 +43,12 @@ struct r300_screen {
unsigned debug;
};
-struct r300_transfer {
- /* Parent class */
- struct pipe_transfer transfer;
-
- /* Offset from start of buffer. */
- unsigned offset;
-};
/* Convenience cast wrapper. */
static INLINE struct r300_screen* r300_screen(struct pipe_screen* screen) {
return (struct r300_screen*)screen;
}
-/* Convenience cast wrapper. */
-static INLINE struct r300_transfer*
-r300_transfer(struct pipe_transfer* transfer)
-{
- return (struct r300_transfer*)transfer;
-}
-
/* Debug functionality. */
/**
@@ -81,6 +68,7 @@ r300_transfer(struct pipe_transfer* transfer)
#define DBG_DRAW 0x0000010
#define DBG_TEX 0x0000020
#define DBG_FALL 0x0000040
+#define DBG_ANISOHQ 0x0000080
/*@}*/
static INLINE boolean SCREEN_DBG_ON(struct r300_screen * screen, unsigned flags)
@@ -94,7 +82,7 @@ static INLINE void SCREEN_DBG(struct r300_screen * screen, unsigned flags,
if (SCREEN_DBG_ON(screen, flags)) {
va_list va;
va_start(va, fmt);
- debug_vprintf(fmt, va);
+ vfprintf(stderr, fmt, va);
va_end(va);
}
}
diff --git a/src/gallium/drivers/r300/r300_screen_buffer.c b/src/gallium/drivers/r300/r300_screen_buffer.c
new file mode 100644
index 0000000000..a1cd48ee73
--- /dev/null
+++ b/src/gallium/drivers/r300/r300_screen_buffer.c
@@ -0,0 +1,314 @@
+/*
+ * Copyright 2010 Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors: Dave Airlie
+ */
+#include <stdio.h>
+
+#include "util/u_inlines.h"
+#include "util/u_format.h"
+#include "util/u_memory.h"
+#include "util/u_upload_mgr.h"
+#include "util/u_math.h"
+
+#include "r300_screen_buffer.h"
+
+#include "r300_winsys.h"
+
+boolean r300_buffer_is_referenced(struct r300_context *r300,
+ struct pipe_buffer *buf)
+{
+ struct r300_buffer *rbuf = r300_buffer(buf);
+ if (r300_buffer_is_user_buffer(buf))
+ return FALSE;
+
+ return r300->rws->is_buffer_referenced(r300->rws, rbuf->buf);
+
+}
+int r300_upload_index_buffer(struct r300_context *r300,
+ struct pipe_buffer **index_buffer,
+ unsigned index_size,
+ unsigned start,
+ unsigned count)
+{
+ struct pipe_buffer *upload_buffer = NULL;
+ unsigned index_offset = start * index_size;
+ int ret = 0;
+
+ if (r300_buffer_is_user_buffer(*index_buffer)) {
+ ret = u_upload_buffer(r300->upload_ib,
+ index_offset,
+ count * index_size,
+ *index_buffer,
+ &index_offset,
+ &upload_buffer);
+ if (ret) {
+ goto done;
+ }
+ *index_buffer = upload_buffer;
+ }
+ done:
+ // if (upload_buffer)
+ // pipe_buffer_reference(&upload_buffer, NULL);
+ return ret;
+}
+
+int r300_upload_user_buffers(struct r300_context *r300)
+{
+ enum pipe_error ret = PIPE_OK;
+ int i, nr;
+
+ nr = r300->vertex_buffer_count;
+
+ for (i = 0; i < nr; i++) {
+
+ if (r300_buffer_is_user_buffer(r300->vertex_buffer[i].buffer)) {
+ struct pipe_buffer *upload_buffer = NULL;
+ unsigned offset = 0; /*r300->vertex_buffer[i].buffer_offset * 4;*/
+ unsigned size = r300->vertex_buffer[i].buffer->size;
+ unsigned upload_offset;
+ ret = u_upload_buffer(r300->upload_vb,
+ offset, size,
+ r300->vertex_buffer[i].buffer,
+ &upload_offset, &upload_buffer);
+ if (ret)
+ return ret;
+
+ pipe_buffer_reference(&r300->vertex_buffer[i].buffer, NULL);
+ r300->vertex_buffer[i].buffer = upload_buffer;
+ r300->vertex_buffer[i].buffer_offset = upload_offset;
+ }
+ }
+ return ret;
+}
+
+static struct r300_winsys_buffer *
+r300_winsys_buffer_create(struct r300_screen *r300screen,
+ unsigned alignment,
+ unsigned usage,
+ unsigned size)
+{
+ struct r300_winsys_screen *rws = r300screen->rws;
+ struct r300_winsys_buffer *buf;
+
+ buf = rws->buffer_create(rws, alignment, usage, size);
+ return buf;
+}
+
+static void r300_winsys_buffer_destroy(struct r300_screen *r300screen,
+ struct r300_buffer *rbuf)
+{
+ struct r300_winsys_screen *rws = r300screen->rws;
+
+ if (rbuf->buf) {
+ rws->buffer_reference(rws, &rbuf->buf, NULL);
+ rbuf->buf = NULL;
+ }
+}
+
+static struct pipe_buffer *r300_buffer_create(struct pipe_screen *screen,
+ unsigned alignment,
+ unsigned usage,
+ unsigned size)
+{
+ struct r300_screen *r300screen = r300_screen(screen);
+ struct r300_buffer *rbuf;
+
+ rbuf = CALLOC_STRUCT(r300_buffer);
+ if (!rbuf)
+ goto error1;
+
+ rbuf->magic = R300_BUFFER_MAGIC;
+
+ pipe_reference_init(&rbuf->base.reference, 1);
+ rbuf->base.screen = screen;
+ rbuf->base.alignment = alignment;
+ rbuf->base.usage = usage;
+ rbuf->base.size = size;
+
+ rbuf->buf = r300_winsys_buffer_create(r300screen,
+ alignment,
+ usage,
+ size);
+
+ if (!rbuf->buf)
+ goto error2;
+
+ return &rbuf->base;
+error2:
+ FREE(rbuf);
+error1:
+ return NULL;
+}
+
+
+static struct pipe_buffer *r300_user_buffer_create(struct pipe_screen *screen,
+ void *ptr,
+ unsigned bytes)
+{
+ struct r300_buffer *rbuf;
+
+ rbuf = CALLOC_STRUCT(r300_buffer);
+ if (!rbuf)
+ goto no_rbuf;
+
+ rbuf->magic = R300_BUFFER_MAGIC;
+
+ pipe_reference_init(&rbuf->base.reference, 1);
+ rbuf->base.screen = screen;
+ rbuf->base.alignment = 1;
+ rbuf->base.usage = 0;
+ rbuf->base.size = bytes;
+
+ rbuf->user_buffer = ptr;
+ return &rbuf->base;
+
+no_rbuf:
+ return NULL;
+}
+
+static void r300_buffer_destroy(struct pipe_buffer *buf)
+{
+ struct r300_screen *r300screen = r300_screen(buf->screen);
+ struct r300_buffer *rbuf = r300_buffer(buf);
+
+ r300_winsys_buffer_destroy(r300screen, rbuf);
+ FREE(rbuf);
+}
+
+static void *
+r300_buffer_map_range(struct pipe_screen *screen,
+ struct pipe_buffer *buf,
+ unsigned offset, unsigned length,
+ unsigned usage )
+{
+ struct r300_screen *r300screen = r300_screen(screen);
+ struct r300_winsys_screen *rws = r300screen->rws;
+ struct r300_buffer *rbuf = r300_buffer(buf);
+ void *map;
+ int flush = 0;
+ int i;
+
+ if (rbuf->user_buffer)
+ return rbuf->user_buffer;
+
+ if (rbuf->base.usage & PIPE_BUFFER_USAGE_CONSTANT)
+ goto just_map;
+
+ /* check if the mapping is to a range we already flushed */
+ if (usage & PIPE_BUFFER_USAGE_DISCARD) {
+ for (i = 0; i < rbuf->num_ranges; i++) {
+
+ if ((offset >= rbuf->ranges[i].start) &&
+ (offset < rbuf->ranges[i].end))
+ flush = 1;
+
+ if (flush) {
+ /* unreference this hw buffer and allocate a new one */
+ rws->buffer_reference(rws, &rbuf->buf, NULL);
+
+ rbuf->num_ranges = 0;
+ rbuf->map = NULL;
+ rbuf->buf = r300_winsys_buffer_create(r300screen,
+ rbuf->base.alignment,
+ rbuf->base.usage,
+ rbuf->base.size);
+ break;
+ }
+ }
+ }
+just_map:
+ map = rws->buffer_map(rws, rbuf->buf, usage);
+
+ return map;
+}
+
+static void
+r300_buffer_flush_mapped_range( struct pipe_screen *screen,
+ struct pipe_buffer *buf,
+ unsigned offset,
+ unsigned length )
+{
+ struct r300_buffer *rbuf = r300_buffer(buf);
+ int i;
+
+ if (rbuf->user_buffer)
+ return;
+
+ if (rbuf->base.usage & PIPE_BUFFER_USAGE_CONSTANT)
+ return;
+
+ /* mark the range as used */
+ for(i = 0; i < rbuf->num_ranges; ++i) {
+ if(offset <= rbuf->ranges[i].end && rbuf->ranges[i].start <= (offset+length)) {
+ rbuf->ranges[i].start = MIN2(rbuf->ranges[i].start, offset);
+ rbuf->ranges[i].end = MAX2(rbuf->ranges[i].end, (offset+length));
+ return;
+ }
+ }
+
+ rbuf->ranges[rbuf->num_ranges].start = offset;
+ rbuf->ranges[rbuf->num_ranges].end = offset+length;
+ rbuf->num_ranges++;
+}
+
+static void *
+r300_buffer_map(struct pipe_screen *screen,
+ struct pipe_buffer *buf,
+ unsigned usage)
+{
+ struct r300_screen *r300screen = r300_screen(screen);
+ struct r300_winsys_screen *rws = r300screen->rws;
+ struct r300_buffer *rbuf = r300_buffer(buf);
+ void *map;
+
+ if (rbuf->user_buffer)
+ return rbuf->user_buffer;
+
+ map = rws->buffer_map(rws, rbuf->buf, usage);
+
+ return map;
+}
+
+static void
+r300_buffer_unmap(struct pipe_screen *screen,
+ struct pipe_buffer *buf)
+{
+ struct r300_screen *r300screen = r300_screen(screen);
+ struct r300_winsys_screen *rws = r300screen->rws;
+ struct r300_buffer *rbuf = r300_buffer(buf);
+
+ if (rbuf->buf) {
+ rws->buffer_unmap(rws, rbuf->buf);
+ }
+}
+
+void r300_screen_init_buffer_functions(struct r300_screen *r300screen)
+{
+ r300screen->screen.buffer_create = r300_buffer_create;
+ r300screen->screen.user_buffer_create = r300_user_buffer_create;
+ r300screen->screen.buffer_map = r300_buffer_map;
+ r300screen->screen.buffer_map_range = r300_buffer_map_range;
+ r300screen->screen.buffer_flush_mapped_range = r300_buffer_flush_mapped_range;
+ r300screen->screen.buffer_unmap = r300_buffer_unmap;
+ r300screen->screen.buffer_destroy = r300_buffer_destroy;
+}
diff --git a/src/gallium/drivers/r300/r300_screen_buffer.h b/src/gallium/drivers/r300/r300_screen_buffer.h
new file mode 100644
index 0000000000..0cf349c25c
--- /dev/null
+++ b/src/gallium/drivers/r300/r300_screen_buffer.h
@@ -0,0 +1,99 @@
+#ifndef R300_SCREEN_BUFFER_H
+#define R300_SCREEN_BUFFER_H
+#include <stdio.h>
+#include "pipe/p_compiler.h"
+#include "pipe/p_state.h"
+#include "r300_screen.h"
+
+#include "r300_winsys.h"
+#include "r300_context.h"
+
+#define R300_BUFFER_MAGIC 0xabcd1234
+
+struct r300_buffer_range {
+ uint32_t start;
+ uint32_t end;
+};
+#define R300_BUFFER_MAX_RANGES 32
+
+struct r300_buffer
+{
+ struct pipe_buffer base;
+
+ uint32_t magic;
+
+ struct r300_winsys_buffer *buf;
+
+ void *user_buffer;
+ struct r300_buffer_range ranges[R300_BUFFER_MAX_RANGES];
+ unsigned num_ranges;
+
+ void *map;
+};
+
+static INLINE struct r300_buffer *
+r300_buffer(struct pipe_buffer *buffer)
+{
+ if (buffer) {
+ assert(((struct r300_buffer *)buffer)->magic == R300_BUFFER_MAGIC);
+ return (struct r300_buffer *)buffer;
+ }
+ return NULL;
+}
+
+static INLINE boolean
+r300_buffer_is_user_buffer(struct pipe_buffer *buffer)
+{
+ return r300_buffer(buffer)->user_buffer ? true : false;
+}
+
+static INLINE boolean r300_add_buffer(struct r300_winsys_screen *rws,
+ struct pipe_buffer *buffer,
+ int rd, int wr)
+{
+ struct r300_buffer *buf = r300_buffer(buffer);
+
+ if (!buf->buf)
+ return true;
+
+ return rws->add_buffer(rws, buf->buf, rd, wr);
+}
+
+
+static INLINE boolean r300_add_texture(struct r300_winsys_screen *rws,
+ struct r300_texture *tex,
+ int rd, int wr)
+{
+ return rws->add_buffer(rws, tex->buffer, rd, wr);
+}
+
+void r300_screen_init_buffer_functions(struct r300_screen *r300screen);
+
+static INLINE void r300_buffer_write_reloc(struct r300_winsys_screen *rws,
+ struct r300_buffer *buf,
+ uint32_t rd, uint32_t wd, uint32_t flags)
+{
+ if (!buf->buf)
+ return;
+
+ rws->write_cs_reloc(rws, buf->buf, rd, wd, flags);
+}
+
+static INLINE void r300_texture_write_reloc(struct r300_winsys_screen *rws,
+ struct r300_texture *texture,
+ uint32_t rd, uint32_t wd, uint32_t flags)
+{
+ rws->write_cs_reloc(rws, texture->buffer, rd, wd, flags);
+}
+
+int r300_upload_user_buffers(struct r300_context *r300);
+
+int r300_upload_index_buffer(struct r300_context *r300,
+ struct pipe_buffer **index_buffer,
+ unsigned index_size,
+ unsigned start,
+ unsigned count);
+
+boolean r300_buffer_is_referenced(struct r300_context *r300,
+ struct pipe_buffer *buf);
+#endif
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 1f6f99d3e5..2c0a7d82f5 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -34,11 +34,11 @@
#include "r300_context.h"
#include "r300_reg.h"
#include "r300_screen.h"
+#include "r300_screen_buffer.h"
#include "r300_state_inlines.h"
#include "r300_fs.h"
#include "r300_vs.h"
-
-#include "radeon_winsys.h"
+#include "r300_winsys.h"
/* r300_state: Functions used to intialize state context by translating
* Gallium state objects into semi-native r300 state objects. */
@@ -320,10 +320,17 @@ static void* r300_create_blend_state(struct pipe_context* pipe,
}
}
+ /* Neither fglrx nor classic r300 ever set this, regardless of dithering
+ * state. Since it's an optional implementation detail, we can leave it
+ * out and never dither.
+ *
+ * This could be revisited if we ever get quality or conformance hints.
+ *
if (state->dither) {
blend->dither = R300_RB3D_DITHER_CTL_DITHER_MODE_LUT |
- R300_RB3D_DITHER_CTL_ALPHA_DITHER_MODE_LUT;
+ R300_RB3D_DITHER_CTL_ALPHA_DITHER_MODE_LUT;
}
+ */
return (void*)blend;
}
@@ -525,10 +532,10 @@ static void r300_fb_update_tiling_flags(struct r300_context *r300,
tex = (struct r300_texture*)old_state->cbufs[i]->texture;
if (tex) {
- r300->winsys->buffer_set_tiling(r300->winsys, tex->buffer,
+ r300->rws->buffer_set_tiling(r300->rws, tex->buffer,
tex->pitch[0],
- tex->microtile != 0,
- tex->macrotile != 0);
+ tex->microtile,
+ tex->macrotile);
}
}
if (old_state->zsbuf &&
@@ -537,10 +544,10 @@ static void r300_fb_update_tiling_flags(struct r300_context *r300,
tex = (struct r300_texture*)old_state->zsbuf->texture;
if (tex) {
- r300->winsys->buffer_set_tiling(r300->winsys, tex->buffer,
+ r300->rws->buffer_set_tiling(r300->rws, tex->buffer,
tex->pitch[0],
- tex->microtile != 0,
- tex->macrotile != 0);
+ tex->microtile,
+ tex->macrotile);
}
}
@@ -549,19 +556,19 @@ static void r300_fb_update_tiling_flags(struct r300_context *r300,
tex = (struct r300_texture*)new_state->cbufs[i]->texture;
level = new_state->cbufs[i]->level;
- r300->winsys->buffer_set_tiling(r300->winsys, tex->buffer,
+ r300->rws->buffer_set_tiling(r300->rws, tex->buffer,
tex->pitch[level],
- tex->microtile != 0,
- tex->mip_macrotile[level] != 0);
+ tex->microtile,
+ tex->mip_macrotile[level]);
}
if (new_state->zsbuf) {
tex = (struct r300_texture*)new_state->zsbuf->texture;
level = new_state->zsbuf->level;
- r300->winsys->buffer_set_tiling(r300->winsys, tex->buffer,
+ r300->rws->buffer_set_tiling(r300->rws, tex->buffer,
tex->pitch[level],
- tex->microtile != 0,
- tex->mip_macrotile[level] != 0);
+ tex->microtile,
+ tex->mip_macrotile[level]);
}
}
@@ -571,12 +578,12 @@ static void
{
struct r300_context* r300 = r300_context(pipe);
struct r300_screen* r300screen = r300_screen(pipe->screen);
+ struct pipe_framebuffer_state *old_state = r300->fb_state.state;
unsigned max_width, max_height;
uint32_t zbuffer_bpp = 0;
-
if (state->nr_cbufs > 4) {
- debug_printf("r300: Implementation error: Too many MRTs in %s, "
+ fprintf(stderr, "r300: Implementation error: Too many MRTs in %s, "
"refusing to bind framebuffer state!\n", __FUNCTION__);
return;
}
@@ -590,28 +597,35 @@ static void
}
if (state->width > max_width || state->height > max_height) {
- debug_printf("r300: Implementation error: Render targets are too "
+ fprintf(stderr, "r300: Implementation error: Render targets are too "
"big in %s, refusing to bind framebuffer state!\n", __FUNCTION__);
return;
}
-
if (r300->draw) {
draw_flush(r300->draw);
}
- memcpy(r300->fb_state.state, state, sizeof(struct pipe_framebuffer_state));
+ r300->fb_state.dirty = TRUE;
- r300->fb_state.size = (10 * state->nr_cbufs) + (2 * (4 - state->nr_cbufs)) +
- (state->zsbuf ? 10 : 0) + 8;
+ /* If nr_cbufs is changed from zero to non-zero or vice versa... */
+ if (!!old_state->nr_cbufs != !!state->nr_cbufs) {
+ r300->blend_state.dirty = TRUE;
+ }
+ /* If zsbuf is set from NULL to non-NULL or vice versa.. */
+ if (!!old_state->zsbuf != !!state->zsbuf) {
+ r300->dsa_state.dirty = TRUE;
+ }
+ if (!r300->scissor_enabled) {
+ r300->scissor_state.dirty = TRUE;
+ }
r300_fb_update_tiling_flags(r300, r300->fb_state.state, state);
- /* XXX wait what */
- r300->blend_state.dirty = TRUE;
- r300->dsa_state.dirty = TRUE;
- r300->fb_state.dirty = TRUE;
- r300->scissor_state.dirty = TRUE;
+ memcpy(r300->fb_state.state, state, sizeof(struct pipe_framebuffer_state));
+
+ r300->fb_state.size = (10 * state->nr_cbufs) + (2 * (4 - state->nr_cbufs)) +
+ (state->zsbuf ? 10 : 0) + 8;
/* Polygon offset depends on the zbuffer bit depth. */
if (state->zsbuf && r300->polygon_offset_enabled) {
@@ -716,8 +730,7 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
rs->vap_control_status = R300_VC_32BIT_SWAP;
#endif
- /* If bypassing TCL, or if no TCL engine is present, turn off the HW TCL.
- * Else, enable HW TCL and force Draw's TCL off. */
+ /* If no TCL engine is present, turn off the HW TCL. */
if (!r300screen->caps->has_tcl) {
rs->vap_control_status |= R300_VAP_TCL_BYPASS;
}
@@ -807,6 +820,7 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state)
{
struct r300_context* r300 = r300_context(pipe);
struct r300_rs_state* rs = (struct r300_rs_state*)state;
+ boolean scissor_was_enabled = r300->scissor_enabled;
if (r300->draw) {
draw_flush(r300->draw);
@@ -815,20 +829,17 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state)
if (rs) {
r300->polygon_offset_enabled = rs->rs.offset_cw || rs->rs.offset_ccw;
+ r300->scissor_enabled = rs->rs.scissor;
} else {
r300->polygon_offset_enabled = FALSE;
+ r300->scissor_enabled = FALSE;
}
UPDATE_STATE(state, r300->rs_state);
r300->rs_state.size = 17 + (r300->polygon_offset_enabled ? 5 : 0);
- /* XXX Why is this still needed, dammit!? */
- r300->scissor_state.dirty = TRUE;
- r300->viewport_state.dirty = TRUE;
-
- /* XXX Clean these up when we move to atom emits */
- if (r300->fs && r300->fs->inputs.wpos != ATTR_UNUSED) {
- r300->dirty_state |= R300_NEW_FRAGMENT_SHADER_CONSTANTS;
+ if (scissor_was_enabled != r300->scissor_enabled) {
+ r300->scissor_state.dirty = TRUE;
}
}
@@ -844,6 +855,7 @@ static void*
{
struct r300_context* r300 = r300_context(pipe);
struct r300_sampler_state* sampler = CALLOC_STRUCT(r300_sampler_state);
+ boolean is_r500 = r300_screen(pipe->screen)->caps->is_r500;
int lod_bias;
union util_color uc;
@@ -859,6 +871,8 @@ static void*
state->min_mip_filter,
state->max_anisotropy > 0);
+ sampler->filter0 |= r300_anisotropy(state->max_anisotropy);
+
/* Unfortunately, r300-r500 don't support floating-point mipmap lods. */
/* We must pass these to the merge function to clamp them properly. */
sampler->min_lod = MAX2((unsigned)state->min_lod, 0);
@@ -868,7 +882,13 @@ static void*
sampler->filter1 |= lod_bias << R300_LOD_BIAS_SHIFT;
- sampler->filter1 |= r300_anisotropy(state->max_anisotropy);
+ /* This is very high quality anisotropic filtering for R5xx.
+ * It's good for benchmarking the performance of texturing but
+ * in practice we don't want to slow down the driver because it's
+ * a pretty good performance killer. Feel free to play with it. */
+ if (DBG_ON(r300, DBG_ANISOHQ) && is_r500) {
+ sampler->filter1 |= r500_anisotropy(state->max_anisotropy);
+ }
util_pack_color(state->border_color, PIPE_FORMAT_B8G8R8A8_UNORM, &uc);
sampler->border_color = uc.ui;
@@ -918,13 +938,14 @@ static void r300_delete_sampler_state(struct pipe_context* pipe, void* state)
FREE(state);
}
-static void r300_set_sampler_textures(struct pipe_context* pipe,
- unsigned count,
- struct pipe_texture** texture)
+static void r300_set_fragment_sampler_views(struct pipe_context* pipe,
+ unsigned count,
+ struct pipe_sampler_view** views)
{
struct r300_context* r300 = r300_context(pipe);
struct r300_textures_state* state =
(struct r300_textures_state*)r300->textures_state.state;
+ struct r300_texture *texture;
unsigned i;
boolean is_r500 = r300_screen(r300->context.screen)->caps->is_r500;
boolean dirty_tex = FALSE;
@@ -935,13 +956,20 @@ static void r300_set_sampler_textures(struct pipe_context* pipe,
}
for (i = 0; i < count; i++) {
- if (state->textures[i] != (struct r300_texture*)texture[i]) {
- pipe_texture_reference((struct pipe_texture**)&state->textures[i],
- texture[i]);
+ if (state->fragment_sampler_views[i] != views[i]) {
+ pipe_sampler_view_reference(&state->fragment_sampler_views[i],
+ views[i]);
+
+ if (!views[i]) {
+ continue;
+ }
+
+ /* A new sampler view (= texture)... */
dirty_tex = TRUE;
/* R300-specific - set the texrect factor in the fragment shader */
- if (!is_r500 && state->textures[i]->is_npot) {
+ texture = (struct r300_texture *)views[i]->texture;
+ if (!is_r500 && texture->is_npot) {
/* XXX It would be nice to re-emit just 1 constant,
* XXX not all of them */
r300->dirty_state |= R300_NEW_FRAGMENT_SHADER_CONSTANTS;
@@ -950,9 +978,9 @@ static void r300_set_sampler_textures(struct pipe_context* pipe,
}
for (i = count; i < 8; i++) {
- if (state->textures[i]) {
- pipe_texture_reference((struct pipe_texture**)&state->textures[i],
- NULL);
+ if (state->fragment_sampler_views[i]) {
+ pipe_sampler_view_reference(&state->fragment_sampler_views[i],
+ NULL);
}
}
@@ -965,6 +993,32 @@ static void r300_set_sampler_textures(struct pipe_context* pipe,
}
}
+static struct pipe_sampler_view *
+r300_create_sampler_view(struct pipe_context *pipe,
+ struct pipe_texture *texture,
+ const struct pipe_sampler_view *templ)
+{
+ struct pipe_sampler_view *view = CALLOC_STRUCT(pipe_sampler_view);
+
+ if (view) {
+ *view = *templ;
+ view->reference.count = 1;
+ view->texture = NULL;
+ pipe_texture_reference(&view->texture, texture);
+ view->context = pipe;
+ }
+
+ return view;
+}
+
+static void
+r300_sampler_view_destroy(struct pipe_context *pipe,
+ struct pipe_sampler_view *view)
+{
+ pipe_texture_reference(&view->texture, NULL);
+ FREE(view);
+}
+
static void r300_set_scissor_state(struct pipe_context* pipe,
const struct pipe_scissor_state* state)
{
@@ -973,7 +1027,9 @@ static void r300_set_scissor_state(struct pipe_context* pipe,
memcpy(r300->scissor_state.state, state,
sizeof(struct pipe_scissor_state));
- r300->scissor_state.dirty = TRUE;
+ if (r300->scissor_enabled) {
+ r300->scissor_state.dirty = TRUE;
+ }
}
static void r300_set_viewport_state(struct pipe_context* pipe,
@@ -1024,63 +1080,171 @@ static void r300_set_vertex_buffers(struct pipe_context* pipe,
const struct pipe_vertex_buffer* buffers)
{
struct r300_context* r300 = r300_context(pipe);
- unsigned i, max_index = ~0;
+ struct pipe_vertex_buffer *vbo;
+ unsigned i, max_index = (1 << 24) - 1;
+ boolean any_user_buffer = FALSE;
- memcpy(r300->vertex_buffer, buffers,
- sizeof(struct pipe_vertex_buffer) * count);
+ if (count == r300->vertex_buffer_count &&
+ memcmp(r300->vertex_buffer, buffers,
+ sizeof(struct pipe_vertex_buffer) * count) == 0) {
+ return;
+ }
+
+ /* Check if the stride is aligned to the size of DWORD. */
+ for (i = 0; i < count; i++) {
+ if (buffers[i].buffer) {
+ if (buffers[i].stride % 4 != 0) {
+ // XXX Shouldn't we align the buffer?
+ fprintf(stderr, "r300_set_vertex_buffers: "
+ "Unaligned buffer stride %i isn't supported.\n",
+ buffers[i].stride);
+ assert(0);
+ abort();
+ }
+ }
+ }
for (i = 0; i < count; i++) {
- max_index = MIN2(buffers[i].max_index, max_index);
+ /* Why, yes, I AM casting away constness. How did you know? */
+ vbo = (struct pipe_vertex_buffer*)&buffers[i];
+
+ /* Reference our buffer. */
+ pipe_buffer_reference(&r300->vertex_buffer[i].buffer, vbo->buffer);
+
+ /* Skip NULL buffers */
+ if (!buffers[i].buffer) {
+ continue;
+ }
+
+ if (r300_buffer_is_user_buffer(vbo->buffer)) {
+ any_user_buffer = TRUE;
+ }
+
+ if (vbo->max_index == ~0) {
+ /* Bogus value from broken state tracker; hax it. */
+ vbo->max_index =
+ (vbo->buffer->size - vbo->buffer_offset) / vbo->stride;
+ }
+
+ max_index = MIN2(vbo->max_index, max_index);
}
+ for (; i < r300->vertex_buffer_count; i++) {
+ /* Dereference any old buffers. */
+ pipe_buffer_reference(&r300->vertex_buffer[i].buffer, NULL);
+ }
+
+ memcpy(r300->vertex_buffer, buffers,
+ sizeof(struct pipe_vertex_buffer) * count);
+
r300->vertex_buffer_count = count;
r300->vertex_buffer_max_index = max_index;
+ r300->any_user_vbs = any_user_buffer;
if (r300->draw) {
draw_flush(r300->draw);
draw_set_vertex_buffers(r300->draw, count, buffers);
- } else {
- r300->vertex_stream_state.dirty = TRUE;
}
}
-static boolean r300_validate_aos(struct r300_context *r300)
+/* Update the PSC tables. */
+static void r300_vertex_psc(struct r300_vertex_element_state *velems)
{
- struct pipe_vertex_buffer *vbuf = r300->vertex_buffer;
- struct pipe_vertex_element *velem = r300->vertex_element;
- int i;
-
- /* Check if formats and strides are aligned to the size of DWORD. */
- for (i = 0; i < r300->vertex_element_count; i++) {
- if (vbuf[velem[i].vertex_buffer_index].stride % 4 != 0 ||
- util_format_get_blocksize(velem[i].src_format) % 4 != 0) {
- return FALSE;
+ struct r300_vertex_stream_state *vstream = &velems->vertex_stream;
+ uint16_t type, swizzle;
+ enum pipe_format format;
+ unsigned i;
+
+ assert(velems->count <= 16);
+
+ /* Vertex shaders have no semantics on their inputs,
+ * so PSC should just route stuff based on the vertex elements,
+ * and not on attrib information. */
+ for (i = 0; i < velems->count; i++) {
+ format = velems->velem[i].src_format;
+
+ type = r300_translate_vertex_data_type(format) |
+ (i << R300_DST_VEC_LOC_SHIFT);
+ swizzle = r300_translate_vertex_data_swizzle(format);
+
+ if (i & 1) {
+ vstream->vap_prog_stream_cntl[i >> 1] |= type << 16;
+ vstream->vap_prog_stream_cntl_ext[i >> 1] |= swizzle << 16;
+ } else {
+ vstream->vap_prog_stream_cntl[i >> 1] |= type;
+ vstream->vap_prog_stream_cntl_ext[i >> 1] |= swizzle;
}
}
- return TRUE;
+
+ /* Set the last vector in the PSC. */
+ if (i) {
+ i -= 1;
+ }
+ vstream->vap_prog_stream_cntl[i >> 1] |=
+ (R300_LAST_VEC << (i & 1 ? 16 : 0));
+
+ vstream->count = (i >> 1) + 1;
}
-static void r300_set_vertex_elements(struct pipe_context* pipe,
- unsigned count,
- const struct pipe_vertex_element* elements)
+static void* r300_create_vertex_elements_state(struct pipe_context* pipe,
+ unsigned count,
+ const struct pipe_vertex_element* attribs)
{
- struct r300_context* r300 = r300_context(pipe);
+ struct r300_screen* r300screen = r300_screen(pipe->screen);
+ struct r300_vertex_element_state *velems;
+ unsigned i, size;
+
+ assert(count <= PIPE_MAX_ATTRIBS);
+ velems = CALLOC_STRUCT(r300_vertex_element_state);
+ if (velems != NULL) {
+ velems->count = count;
+ memcpy(velems->velem, attribs, sizeof(struct pipe_vertex_element) * count);
+
+ if (r300screen->caps->has_tcl) {
+ /* Check if the format is aligned to the size of DWORD. */
+ for (i = 0; i < count; i++) {
+ size = util_format_get_blocksize(attribs[i].src_format);
+
+ if (size % 4 != 0) {
+ /* XXX Shouldn't we align the format? */
+ fprintf(stderr, "r300_create_vertex_elements_state: "
+ "Unaligned format %s:%i isn't supported\n",
+ util_format_name(attribs[i].src_format), size);
+ assert(0);
+ abort();
+ }
+ }
+
+ r300_vertex_psc(velems);
+ }
+ }
+ return velems;
+}
+
+static void r300_bind_vertex_elements_state(struct pipe_context *pipe,
+ void *state)
+{
+ struct r300_context *r300 = r300_context(pipe);
+ struct r300_vertex_element_state *velems = state;
+
+ if (velems == NULL) {
+ return;
+ }
- memcpy(r300->vertex_element,
- elements,
- sizeof(struct pipe_vertex_element) * count);
- r300->vertex_element_count = count;
+ r300->velems = velems;
if (r300->draw) {
draw_flush(r300->draw);
- draw_set_vertex_elements(r300->draw, count, elements);
+ draw_set_vertex_elements(r300->draw, velems->count, velems->velem);
}
- if (!r300_validate_aos(r300)) {
- /* XXX We should fallback using draw. */
- assert(0);
- abort();
- }
+ UPDATE_STATE(&velems->vertex_stream, r300->vertex_stream_state);
+ r300->vertex_stream_state.size = (1 + velems->vertex_stream.count) * 2;
+}
+
+static void r300_delete_vertex_elements_state(struct pipe_context *pipe, void *state)
+{
+ FREE(state);
}
static void* r300_create_vs_state(struct pipe_context* pipe,
@@ -1088,68 +1252,71 @@ static void* r300_create_vs_state(struct pipe_context* pipe,
{
struct r300_context* r300 = r300_context(pipe);
- if (r300_screen(pipe->screen)->caps->has_tcl) {
- struct r300_vertex_shader* vs = CALLOC_STRUCT(r300_vertex_shader);
- /* Copy state directly into shader. */
- vs->state = *shader;
- vs->state.tokens = tgsi_dup_tokens(shader->tokens);
-
- tgsi_scan_shader(shader->tokens, &vs->info);
+ struct r300_vertex_shader* vs = CALLOC_STRUCT(r300_vertex_shader);
+ r300_vertex_shader_common_init(vs, shader);
- return (void*)vs;
+ if (r300_screen(pipe->screen)->caps->has_tcl) {
+ r300_translate_vertex_shader(r300, vs);
} else {
- return draw_create_vertex_shader(r300->draw, shader);
+ vs->draw_vs = draw_create_vertex_shader(r300->draw, shader);
}
+
+ return vs;
}
static void r300_bind_vs_state(struct pipe_context* pipe, void* shader)
{
struct r300_context* r300 = r300_context(pipe);
+ struct r300_vertex_shader* vs = (struct r300_vertex_shader*)shader;
- if (r300_screen(pipe->screen)->caps->has_tcl) {
- struct r300_vertex_shader* vs = (struct r300_vertex_shader*)shader;
+ if (vs == NULL) {
+ r300->vs_state.state = NULL;
+ return;
+ }
+ if (vs == r300->vs_state.state) {
+ return;
+ }
+ r300->vs_state.state = vs;
- if (vs == NULL) {
- r300->vs_state.state = NULL;
- return;
- } else if (!vs->translated) {
- r300_translate_vertex_shader(r300, vs);
- }
+ // VS output mapping for HWTCL or stream mapping for SWTCL to the RS block
+ if (r300->fs) {
+ r300_vertex_shader_setup_wpos(r300);
+ }
+ memcpy(r300->vap_output_state.state, &vs->vap_out,
+ sizeof(struct r300_vap_output_state));
+ r300->vap_output_state.dirty = TRUE;
+
+ /* The majority of the RS block bits is dependent on the vertex shader. */
+ r300->rs_block_state.dirty = TRUE; /* Will be updated before the emission. */
- UPDATE_STATE(shader, r300->vs_state);
+ if (r300_screen(pipe->screen)->caps->has_tcl) {
+ r300->vs_state.dirty = TRUE;
r300->vs_state.size = vs->code.length + 9;
- r300->rs_block_state.dirty = TRUE; /* Will be updated before the emission. */
- r300->vap_output_state.dirty = TRUE;
- r300->vertex_stream_state.dirty = TRUE; /* XXX needed for TCL bypass */
r300->pvs_flush.dirty = TRUE;
- if (r300->fs) {
- r300_vertex_shader_setup_wpos(r300);
- }
-
r300->dirty_state |= R300_NEW_VERTEX_SHADER_CONSTANTS;
} else {
draw_flush(r300->draw);
draw_bind_vertex_shader(r300->draw,
- (struct draw_vertex_shader*)shader);
+ (struct draw_vertex_shader*)vs->draw_vs);
}
}
static void r300_delete_vs_state(struct pipe_context* pipe, void* shader)
{
struct r300_context* r300 = r300_context(pipe);
+ struct r300_vertex_shader* vs = (struct r300_vertex_shader*)shader;
if (r300_screen(pipe->screen)->caps->has_tcl) {
- struct r300_vertex_shader* vs = (struct r300_vertex_shader*)shader;
-
rc_constants_destroy(&vs->code.constants);
- FREE((void*)vs->state.tokens);
- FREE(shader);
} else {
draw_delete_vertex_shader(r300->draw,
- (struct draw_vertex_shader*)shader);
+ (struct draw_vertex_shader*)vs->draw_vs);
}
+
+ FREE((void*)vs->state.tokens);
+ FREE(shader);
}
static void r300_set_constant_buffer(struct pipe_context *pipe,
@@ -1191,7 +1358,7 @@ static void r300_set_constant_buffer(struct pipe_context *pipe,
/* XXX Subtract immediates and RC_STATE_* variables. */
if (buf->size > (sizeof(float) * 4 * max_size)) {
- debug_printf("r300: Max size of the constant buffer is "
+ fprintf(stderr, "r300: Max size of the constant buffer is "
"%i*4 floats.\n", max_size);
abort();
}
@@ -1201,11 +1368,17 @@ static void r300_set_constant_buffer(struct pipe_context *pipe,
pipe_buffer_unmap(pipe->screen, buf);
if (shader == PIPE_SHADER_VERTEX) {
- r300->dirty_state |= R300_NEW_VERTEX_SHADER_CONSTANTS;
- r300->pvs_flush.dirty = TRUE;
- }
- else if (shader == PIPE_SHADER_FRAGMENT)
+ if (r300screen->caps->has_tcl) {
+ r300->dirty_state |= R300_NEW_VERTEX_SHADER_CONSTANTS;
+ r300->pvs_flush.dirty = TRUE;
+ } else if (r300->draw) {
+ draw_set_mapped_constant_buffer(r300->draw, PIPE_SHADER_VERTEX,
+ 0, r300->shader_constants[PIPE_SHADER_VERTEX].constants,
+ buf->size);
+ }
+ } else if (shader == PIPE_SHADER_FRAGMENT) {
r300->dirty_state |= R300_NEW_FRAGMENT_SHADER_CONSTANTS;
+ }
}
void r300_init_state_functions(struct r300_context* r300)
@@ -1243,14 +1416,19 @@ void r300_init_state_functions(struct r300_context* r300)
r300->context.bind_vertex_sampler_states = r300_lacks_vertex_textures;
r300->context.delete_sampler_state = r300_delete_sampler_state;
- r300->context.set_fragment_sampler_textures = r300_set_sampler_textures;
+ r300->context.set_fragment_sampler_views = r300_set_fragment_sampler_views;
+ r300->context.create_sampler_view = r300_create_sampler_view;
+ r300->context.sampler_view_destroy = r300_sampler_view_destroy;
r300->context.set_scissor_state = r300_set_scissor_state;
r300->context.set_viewport_state = r300_set_viewport_state;
r300->context.set_vertex_buffers = r300_set_vertex_buffers;
- r300->context.set_vertex_elements = r300_set_vertex_elements;
+
+ r300->context.create_vertex_elements_state = r300_create_vertex_elements_state;
+ r300->context.bind_vertex_elements_state = r300_bind_vertex_elements_state;
+ r300->context.delete_vertex_elements_state = r300_delete_vertex_elements_state;
r300->context.create_vs_state = r300_create_vs_state;
r300->context.bind_vs_state = r300_bind_vs_state;
diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c
index 9c8e907fdf..bc5431c802 100644
--- a/src/gallium/drivers/r300/r300_state_derived.c
+++ b/src/gallium/drivers/r300/r300_state_derived.c
@@ -103,74 +103,19 @@ static void r300_draw_emit_all_attribs(struct r300_context* r300)
assert(gen_count <= 8);
}
-/* Update the PSC tables. */
-/* XXX move this function into r300_state.c after TCL-bypass gets removed
- * XXX because this one is dependent only on vertex elements. */
-static void r300_vertex_psc(struct r300_context* r300)
-{
- struct r300_vertex_shader* vs = r300->vs_state.state;
- struct r300_vertex_stream_state *vformat =
- (struct r300_vertex_stream_state*)r300->vertex_stream_state.state;
- uint16_t type, swizzle;
- enum pipe_format format;
- unsigned i;
- int identity[16] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
- int* stream_tab;
-
- memset(vformat, 0, sizeof(struct r300_vertex_stream_state));
-
- stream_tab = identity;
-
- /* Vertex shaders have no semantics on their inputs,
- * so PSC should just route stuff based on the vertex elements,
- * and not on attrib information. */
- DBG(r300, DBG_DRAW, "r300: vs expects %d attribs, routing %d elements"
- " in psc\n",
- vs->info.num_inputs,
- r300->vertex_element_count);
-
- for (i = 0; i < r300->vertex_element_count; i++) {
- format = r300->vertex_element[i].src_format;
-
- type = r300_translate_vertex_data_type(format) |
- (stream_tab[i] << R300_DST_VEC_LOC_SHIFT);
- swizzle = r300_translate_vertex_data_swizzle(format);
-
- if (i & 1) {
- vformat->vap_prog_stream_cntl[i >> 1] |= type << 16;
- vformat->vap_prog_stream_cntl_ext[i >> 1] |= swizzle << 16;
- } else {
- vformat->vap_prog_stream_cntl[i >> 1] |= type;
- vformat->vap_prog_stream_cntl_ext[i >> 1] |= swizzle;
- }
- }
-
- assert(i <= 15);
-
- /* Set the last vector in the PSC. */
- if (i) {
- i -= 1;
- }
- vformat->vap_prog_stream_cntl[i >> 1] |=
- (R300_LAST_VEC << (i & 1 ? 16 : 0));
-
- vformat->count = (i >> 1) + 1;
- r300->vertex_stream_state.size = (1 + vformat->count) * 2;
-}
-
/* Update the PSC tables for SW TCL, using Draw. */
-static void r300_swtcl_vertex_psc(struct r300_context* r300)
+static void r300_swtcl_vertex_psc(struct r300_context *r300)
{
+ struct r300_vertex_stream_state *vstream = r300->vertex_stream_state.state;
struct r300_vertex_shader* vs = r300->vs_state.state;
- struct r300_vertex_stream_state *vformat =
- (struct r300_vertex_stream_state*)r300->vertex_stream_state.state;
struct vertex_info* vinfo = &r300->vertex_info;
uint16_t type, swizzle;
enum pipe_format format;
unsigned i, attrib_count;
int* vs_output_tab = vs->stream_loc_notcl;
- memset(vformat, 0, sizeof(struct r300_vertex_stream_state));
+ /* XXX hax */
+ memset(vstream, 0, sizeof(struct r300_vertex_stream_state));
/* For each Draw attribute, route it to the fragment shader according
* to the vs_output_tab. */
@@ -181,9 +126,7 @@ static void r300_swtcl_vertex_psc(struct r300_context* r300)
" vs_output_tab %d\n", vinfo->attrib[i].src_index,
vinfo->attrib[i].interp_mode, vinfo->attrib[i].emit,
vs_output_tab[i]);
- }
- for (i = 0; i < attrib_count; i++) {
/* Make sure we have a proper destination for our attribute. */
assert(vs_output_tab[i] != -1);
@@ -199,11 +142,11 @@ static void r300_swtcl_vertex_psc(struct r300_context* r300)
/* Add the attribute to the PSC table. */
if (i & 1) {
- vformat->vap_prog_stream_cntl[i >> 1] |= type << 16;
- vformat->vap_prog_stream_cntl_ext[i >> 1] |= swizzle << 16;
+ vstream->vap_prog_stream_cntl[i >> 1] |= type << 16;
+ vstream->vap_prog_stream_cntl_ext[i >> 1] |= swizzle << 16;
} else {
- vformat->vap_prog_stream_cntl[i >> 1] |= type;
- vformat->vap_prog_stream_cntl_ext[i >> 1] |= swizzle;
+ vstream->vap_prog_stream_cntl[i >> 1] |= type;
+ vstream->vap_prog_stream_cntl_ext[i >> 1] |= swizzle;
}
}
@@ -211,11 +154,12 @@ static void r300_swtcl_vertex_psc(struct r300_context* r300)
if (i) {
i -= 1;
}
- vformat->vap_prog_stream_cntl[i >> 1] |=
+ vstream->vap_prog_stream_cntl[i >> 1] |=
(R300_LAST_VEC << (i & 1 ? 16 : 0));
- vformat->count = (i >> 1) + 1;
- r300->vertex_stream_state.size = (1 + vformat->count) * 2;
+ vstream->count = (i >> 1) + 1;
+ r300->vertex_stream_state.dirty = TRUE;
+ r300->vertex_stream_state.size = (1 + vstream->count) * 2;
}
static void r300_rs_col(struct r300_rs_block* rs, int id, int ptr,
@@ -432,23 +376,8 @@ static void r300_update_rs_block(struct r300_context* r300,
static void r300_update_derived_shader_state(struct r300_context* r300)
{
struct r300_vertex_shader* vs = r300->vs_state.state;
- struct r300_screen* r300screen = r300_screen(r300->context.screen);
- struct r300_vap_output_state *vap_out =
- (struct r300_vap_output_state*)r300->vap_output_state.state;
-
- /* XXX Mmm, delicious hax */
- memset(&r300->vertex_info, 0, sizeof(struct vertex_info));
- memcpy(vap_out, vs->hwfmt, sizeof(uint)*4);
r300_update_rs_block(r300, &vs->outputs, &r300->fs->inputs);
-
- if (r300screen->caps->has_tcl) {
- r300_vertex_psc(r300);
- } else {
- r300_draw_emit_all_attribs(r300);
- draw_compute_vertex_size(&r300->vertex_info);
- r300_swtcl_vertex_psc(r300);
- }
}
static boolean r300_dsa_writes_depth_stencil(struct r300_dsa_state* dsa)
@@ -528,20 +457,25 @@ static void r300_merge_textures_and_samplers(struct r300_context* r300)
(struct r300_textures_state*)r300->textures_state.state;
struct r300_texture_sampler_state *texstate;
struct r300_sampler_state *sampler;
+ struct pipe_sampler_view *view;
struct r300_texture *tex;
unsigned min_level, max_level, i, size;
unsigned count = MIN2(state->texture_count, state->sampler_count);
state->tx_enable = 0;
+ state->count = 0;
size = 2;
for (i = 0; i < count; i++) {
- if (state->textures[i] && state->sampler_states[i]) {
+ if (state->fragment_sampler_views[i] && state->sampler_states[i]) {
state->tx_enable |= 1 << i;
- tex = state->textures[i];
+ view = state->fragment_sampler_views[i];
+ tex = (struct r300_texture *)view->texture;
sampler = state->sampler_states[i];
+ assert(view->format == tex->tex.format);
+
texstate = &state->regs[i];
memcpy(texstate->format, &tex->state, sizeof(uint32_t)*3);
texstate->filter[0] = sampler->filter0;
@@ -563,8 +497,10 @@ static void r300_merge_textures_and_samplers(struct r300_context* r300)
} else {
/* determine min/max levels */
/* the MAX_MIP level is the largest (finest) one */
- max_level = MIN2(sampler->max_lod, tex->tex.last_level);
- min_level = MIN2(sampler->min_lod, max_level);
+ max_level = MIN3(sampler->max_lod + view->first_level,
+ tex->tex.last_level, view->last_level);
+ min_level = MIN2(sampler->min_lod + view->first_level,
+ max_level);
texstate->format[0] |= R300_TX_NUM_LEVELS(max_level);
texstate->filter[0] |= R300_TX_MAX_MIP_LEVEL(min_level);
}
@@ -581,9 +517,7 @@ static void r300_merge_textures_and_samplers(struct r300_context* r300)
void r300_update_derived_state(struct r300_context* r300)
{
- if (r300->rs_block_state.dirty ||
- r300->vertex_stream_state.dirty || /* XXX put updating this state out of this file */
- r300->rs_state.dirty) { /* XXX and remove this one (tcl_bypass dependency) */
+ if (r300->rs_block_state.dirty) {
r300_update_derived_shader_state(r300);
}
@@ -591,5 +525,12 @@ void r300_update_derived_state(struct r300_context* r300)
r300_merge_textures_and_samplers(r300);
}
+ if (r300->draw) {
+ memset(&r300->vertex_info, 0, sizeof(struct vertex_info));
+ r300_draw_emit_all_attribs(r300);
+ draw_compute_vertex_size(&r300->vertex_info);
+ r300_swtcl_vertex_psc(r300);
+ }
+
r300_update_ztop(r300);
}
diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h
index af7827820c..8a690039b6 100644
--- a/src/gallium/drivers/r300/r300_state_inlines.h
+++ b/src/gallium/drivers/r300/r300_state_inlines.h
@@ -32,6 +32,8 @@
#include "r300_reg.h"
+#include <stdio.h>
+
/* Some maths. These should probably find their way to u_math, if needed. */
static INLINE int pack_float_16_6x(float f) {
@@ -54,7 +56,7 @@ static INLINE uint32_t r300_translate_blend_function(int blend_func)
case PIPE_BLEND_MAX:
return R300_COMB_FCN_MAX;
default:
- debug_printf("r300: Unknown blend function %d\n", blend_func);
+ fprintf(stderr, "r300: Unknown blend function %d\n", blend_func);
assert(0);
break;
}
@@ -100,13 +102,13 @@ static INLINE uint32_t r300_translate_blend_factor(int blend_fact)
case PIPE_BLENDFACTOR_SRC1_ALPHA:
case PIPE_BLENDFACTOR_INV_SRC1_COLOR:
case PIPE_BLENDFACTOR_INV_SRC1_ALPHA:
- debug_printf("r300: Implementation error: "
+ fprintf(stderr, "r300: Implementation error: "
"Bad blend factor %d not supported!\n", blend_fact);
assert(0);
break;
default:
- debug_printf("r300: Unknown blend factor %d\n", blend_fact);
+ fprintf(stderr, "r300: Unknown blend factor %d\n", blend_fact);
assert(0);
break;
}
@@ -135,7 +137,7 @@ static INLINE uint32_t r300_translate_depth_stencil_function(int zs_func)
case PIPE_FUNC_ALWAYS:
return R300_ZS_ALWAYS;
default:
- debug_printf("r300: Unknown depth/stencil function %d\n",
+ fprintf(stderr, "r300: Unknown depth/stencil function %d\n",
zs_func);
assert(0);
break;
@@ -163,7 +165,7 @@ static INLINE uint32_t r300_translate_stencil_op(int s_op)
case PIPE_STENCIL_OP_INVERT:
return R300_ZS_INVERT;
default:
- debug_printf("r300: Unknown stencil op %d", s_op);
+ fprintf(stderr, "r300: Unknown stencil op %d", s_op);
assert(0);
break;
}
@@ -190,7 +192,7 @@ static INLINE uint32_t r300_translate_alpha_function(int alpha_func)
case PIPE_FUNC_ALWAYS:
return R300_FG_ALPHA_FUNC_ALWAYS;
default:
- debug_printf("r300: Unknown alpha function %d", alpha_func);
+ fprintf(stderr, "r300: Unknown alpha function %d", alpha_func);
assert(0);
break;
}
@@ -209,7 +211,7 @@ r300_translate_polygon_mode_front(unsigned mode) {
return R300_GA_POLY_MODE_FRONT_PTYPE_POINT;
default:
- debug_printf("r300: Bad polygon mode %i in %s\n", mode,
+ fprintf(stderr, "r300: Bad polygon mode %i in %s\n", mode,
__FUNCTION__);
return R300_GA_POLY_MODE_FRONT_PTYPE_TRI;
}
@@ -227,7 +229,7 @@ r300_translate_polygon_mode_back(unsigned mode) {
return R300_GA_POLY_MODE_BACK_PTYPE_POINT;
default:
- debug_printf("r300: Bad polygon mode %i in %s\n", mode,
+ fprintf(stderr, "r300: Bad polygon mode %i in %s\n", mode,
__FUNCTION__);
return R300_GA_POLY_MODE_BACK_PTYPE_TRI;
}
@@ -255,7 +257,7 @@ static INLINE uint32_t r300_translate_wrap(int wrap)
case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER:
return R300_TX_CLAMP_TO_EDGE | R300_TX_MIRRORED;
default:
- debug_printf("r300: Unknown texture wrap %d", wrap);
+ fprintf(stderr, "r300: Unknown texture wrap %d", wrap);
assert(0);
return 0;
}
@@ -276,7 +278,7 @@ static INLINE uint32_t r300_translate_tex_filters(int min, int mag, int mip,
retval |= R300_TX_MIN_FILTER_LINEAR;
break;
default:
- debug_printf("r300: Unknown texture filter %d\n", min);
+ fprintf(stderr, "r300: Unknown texture filter %d\n", min);
assert(0);
break;
}
@@ -288,7 +290,7 @@ static INLINE uint32_t r300_translate_tex_filters(int min, int mag, int mip,
retval |= R300_TX_MAG_FILTER_LINEAR;
break;
default:
- debug_printf("r300: Unknown texture filter %d\n", mag);
+ fprintf(stderr, "r300: Unknown texture filter %d\n", mag);
assert(0);
break;
}
@@ -304,7 +306,7 @@ static INLINE uint32_t r300_translate_tex_filters(int min, int mag, int mip,
retval |= R300_TX_MIN_FILTER_MIP_LINEAR;
break;
default:
- debug_printf("r300: Unknown texture filter %d\n", mip);
+ fprintf(stderr, "r300: Unknown texture filter %d\n", mip);
assert(0);
break;
}
@@ -327,6 +329,18 @@ static INLINE uint32_t r300_anisotropy(unsigned max_aniso)
}
}
+static INLINE uint32_t r500_anisotropy(unsigned max_aniso)
+{
+ if (!max_aniso) {
+ return 0;
+ }
+ max_aniso -= 1;
+
+ // Map the range [0, 15] to [0, 63].
+ return R500_TX_MAX_ANISO(MIN2((unsigned)(max_aniso*4.2001), 63)) |
+ R500_TX_ANISO_HIGH_QUALITY;;
+}
+
/* Non-CSO state. (For now.) */
static INLINE uint32_t r300_translate_gb_pipes(int pipe_count)
@@ -348,44 +362,16 @@ static INLINE uint32_t r300_translate_gb_pipes(int pipe_count)
return 0;
}
-/* Utility function to count the number of components in RGBAZS formats.
- * XXX should go to util or p_format.h */
-static INLINE unsigned pf_component_count(enum pipe_format format) {
- unsigned count = 0;
-
- if (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 0)) {
- count++;
- }
- if (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 1)) {
- count++;
- }
- if (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 2)) {
- count++;
- }
- if (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 3)) {
- count++;
- }
- if (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_ZS, 0)) {
- count++;
- }
- if (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_ZS, 1)) {
- count++;
- }
-
- return count;
-}
-
/* Translate pipe_formats into PSC vertex types. */
static INLINE uint16_t
r300_translate_vertex_data_type(enum pipe_format format) {
uint32_t result = 0;
const struct util_format_description *desc;
- unsigned components = pf_component_count(format);
desc = util_format_description(format);
if (desc->layout != UTIL_FORMAT_LAYOUT_PLAIN) {
- debug_printf("r300: Bad format %s in %s:%d\n", util_format_name(format),
+ fprintf(stderr, "r300: Bad format %s in %s:%d\n", util_format_name(format),
__FUNCTION__, __LINE__);
assert(0);
}
@@ -393,20 +379,20 @@ r300_translate_vertex_data_type(enum pipe_format format) {
switch (desc->channel[0].type) {
/* Half-floats, floats, doubles */
case UTIL_FORMAT_TYPE_FLOAT:
- switch (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 0)) {
+ switch (desc->channel[0].size) {
case 16:
/* XXX Supported only on RV350 and later. */
- if (components > 2) {
+ if (desc->nr_channels > 2) {
result = R300_DATA_TYPE_FLT16_4;
} else {
result = R300_DATA_TYPE_FLT16_2;
}
break;
case 32:
- result = R300_DATA_TYPE_FLOAT_1 + (components - 1);
+ result = R300_DATA_TYPE_FLOAT_1 + (desc->nr_channels - 1);
break;
default:
- debug_printf("r300: Bad format %s in %s:%d\n",
+ fprintf(stderr, "r300: Bad format %s in %s:%d\n",
util_format_name(format), __FUNCTION__, __LINE__);
assert(0);
}
@@ -415,27 +401,27 @@ r300_translate_vertex_data_type(enum pipe_format format) {
case UTIL_FORMAT_TYPE_UNSIGNED:
/* Signed ints */
case UTIL_FORMAT_TYPE_SIGNED:
- switch (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 0)) {
+ switch (desc->channel[0].size) {
case 8:
result = R300_DATA_TYPE_BYTE;
break;
case 16:
- if (components > 2) {
+ if (desc->nr_channels > 2) {
result = R300_DATA_TYPE_SHORT_4;
} else {
result = R300_DATA_TYPE_SHORT_2;
}
break;
default:
- debug_printf("r300: Bad format %s in %s:%d\n",
+ fprintf(stderr, "r300: Bad format %s in %s:%d\n",
util_format_name(format), __FUNCTION__, __LINE__);
- debug_printf("r300: util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 0) == %d\n",
- util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 0));
+ fprintf(stderr, "r300: desc->channel[0].size == %d\n",
+ desc->channel[0].size);
assert(0);
}
break;
default:
- debug_printf("r300: Bad format %s in %s:%d\n",
+ fprintf(stderr, "r300: Bad format %s in %s:%d\n",
util_format_name(format), __FUNCTION__, __LINE__);
assert(0);
}
@@ -457,7 +443,7 @@ r300_translate_vertex_data_swizzle(enum pipe_format format) {
assert(format);
if (desc->layout != UTIL_FORMAT_LAYOUT_PLAIN) {
- debug_printf("r300: Bad format %s in %s:%d\n",
+ fprintf(stderr, "r300: Bad format %s in %s:%d\n",
util_format_name(format), __FUNCTION__, __LINE__);
return 0;
}
diff --git a/src/gallium/drivers/r300/r300_state_invariant.c b/src/gallium/drivers/r300/r300_state_invariant.c
index 4a2c68269b..88ae75bb81 100644
--- a/src/gallium/drivers/r300/r300_state_invariant.c
+++ b/src/gallium/drivers/r300/r300_state_invariant.c
@@ -127,7 +127,7 @@ void r300_emit_invariant_state(struct r300_context* r300,
OUT_CS_REG(R300_ZB_HIZ_PITCH, 0x00000000);
/* XXX */
- OUT_CS_REG(R300_SC_CLIP_RULE, 0xaaaa);
+ OUT_CS_REG(R300_SC_CLIP_RULE, 0xFFFF);
END_CS;
}
diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c
index c0144f64b4..d03c28ba35 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -30,9 +30,10 @@
#include "r300_context.h"
#include "r300_texture.h"
#include "r300_screen.h"
-#include "r300_state_inlines.h"
+#include "r300_winsys.h"
-#include "radeon_winsys.h"
+/* XXX Enable float textures here. */
+/*#define ENABLE_FLOAT_TEXTURES*/
#define TILE_WIDTH 0
#define TILE_HEIGHT 1
@@ -46,6 +47,18 @@ static const unsigned microblock_table[5][3][2] = {
{{ 2, 1}, {0, 0}, {0, 0}} /* 128 bits per pixel */
};
+/* Return true for non-compressed and non-YUV formats. */
+static boolean r300_format_is_plain(enum pipe_format format)
+{
+ const struct util_format_description *desc = util_format_description(format);
+
+ if (!format) {
+ return FALSE;
+ }
+
+ return desc->layout == UTIL_FORMAT_LAYOUT_PLAIN;
+}
+
/* Translate a pipe_format into a useful texture format for sampling.
*
* Some special formats are translated directly using R300_EASY_TX_FORMAT,
@@ -62,7 +75,7 @@ static uint32_t r300_translate_texformat(enum pipe_format format)
{
uint32_t result = 0;
const struct util_format_description *desc;
- unsigned components = 0, i;
+ unsigned i;
boolean uniform = TRUE;
const uint32_t swizzle_shift[4] = {
R300_TX_FORMAT_R_SHIFT,
@@ -93,7 +106,7 @@ static uint32_t r300_translate_texformat(enum pipe_format format)
case PIPE_FORMAT_Z16_UNORM:
return R300_EASY_TX_FORMAT(X, X, X, X, X16);
case PIPE_FORMAT_X8Z24_UNORM:
- case PIPE_FORMAT_S8Z24_UNORM:
+ case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
return R300_EASY_TX_FORMAT(X, X, X, X, W24_FP);
default:
return ~0; /* Unsupported. */
@@ -147,8 +160,8 @@ static uint32_t r300_translate_texformat(enum pipe_format format)
}
}
- /* Compressed formats. */
- if (desc->layout == UTIL_FORMAT_LAYOUT_COMPRESSED) {
+ /* S3TC formats. */
+ if (desc->layout == UTIL_FORMAT_LAYOUT_S3TC) {
switch (format) {
case PIPE_FORMAT_DXT1_RGB:
case PIPE_FORMAT_DXT1_RGBA:
@@ -166,28 +179,35 @@ static uint32_t r300_translate_texformat(enum pipe_format format)
}
}
- /* Get the number of components. */
- for (i = 0; i < 4; i++) {
- if (desc->channel[i].type != UTIL_FORMAT_TYPE_VOID) {
- ++components;
- }
- }
-
/* Add sign. */
- for (i = 0; i < components; i++) {
+ for (i = 0; i < desc->nr_channels; i++) {
if (desc->channel[i].type == UTIL_FORMAT_TYPE_SIGNED) {
result |= sign_bit[i];
}
}
+ /* RGTC formats. */
+ if (desc->layout == UTIL_FORMAT_LAYOUT_RGTC) {
+ switch (format) {
+ case PIPE_FORMAT_RGTC1_UNORM:
+ case PIPE_FORMAT_RGTC1_SNORM:
+ return R500_TX_FORMAT_ATI1N | result;
+ case PIPE_FORMAT_RGTC2_UNORM:
+ case PIPE_FORMAT_RGTC2_SNORM:
+ return R400_TX_FORMAT_ATI2N | result;
+ default:
+ return ~0; /* Unsupported/unknown. */
+ }
+ }
+
/* See whether the components are of the same size. */
- for (i = 1; i < components; i++) {
+ for (i = 1; i < desc->nr_channels; i++) {
uniform = uniform && desc->channel[0].size == desc->channel[i].size;
}
/* Non-uniform formats. */
if (!uniform) {
- switch (components) {
+ switch (desc->nr_channels) {
case 3:
if (desc->channel[0].size == 5 &&
desc->channel[1].size == 6 &&
@@ -229,7 +249,7 @@ static uint32_t r300_translate_texformat(enum pipe_format format)
switch (desc->channel[0].size) {
case 4:
- switch (components) {
+ switch (desc->nr_channels) {
case 2:
return R300_TX_FORMAT_Y4X4 | result;
case 4:
@@ -238,7 +258,7 @@ static uint32_t r300_translate_texformat(enum pipe_format format)
return ~0;
case 8:
- switch (components) {
+ switch (desc->nr_channels) {
case 1:
return R300_TX_FORMAT_X8 | result;
case 2:
@@ -249,7 +269,7 @@ static uint32_t r300_translate_texformat(enum pipe_format format)
return ~0;
case 16:
- switch (components) {
+ switch (desc->nr_channels) {
case 1:
return R300_TX_FORMAT_X16 | result;
case 2:
@@ -260,12 +280,11 @@ static uint32_t r300_translate_texformat(enum pipe_format format)
}
return ~0;
-/* XXX Enable float textures here. */
-#if 0
+#if defined(ENABLE_FLOAT_TEXTURES)
case UTIL_FORMAT_TYPE_FLOAT:
switch (desc->channel[0].size) {
case 16:
- switch (components) {
+ switch (desc->nr_channels) {
case 1:
return R300_TX_FORMAT_16F | result;
case 2:
@@ -276,7 +295,7 @@ static uint32_t r300_translate_texformat(enum pipe_format format)
return ~0;
case 32:
- switch (components) {
+ switch (desc->nr_channels) {
case 1:
return R300_TX_FORMAT_32F | result;
case 2:
@@ -291,6 +310,17 @@ static uint32_t r300_translate_texformat(enum pipe_format format)
return ~0; /* Unsupported/unknown. */
}
+static uint32_t r500_tx_format_msb_bit(enum pipe_format format)
+{
+ switch (format) {
+ case PIPE_FORMAT_RGTC1_UNORM:
+ case PIPE_FORMAT_RGTC1_SNORM:
+ return R500_TXFORMAT_MSB;
+ default:
+ return 0;
+ }
+}
+
/* Buffer formats. */
/* Colorbuffer formats. This is the unswizzled format of the RB3D block's
@@ -302,7 +332,6 @@ static uint32_t r300_translate_colorformat(enum pipe_format format)
case PIPE_FORMAT_A8_UNORM:
case PIPE_FORMAT_I8_UNORM:
case PIPE_FORMAT_L8_UNORM:
- case PIPE_FORMAT_L8_SRGB:
case PIPE_FORMAT_R8_UNORM:
case PIPE_FORMAT_R8_SNORM:
return R300_COLOR_FORMAT_I8;
@@ -311,24 +340,19 @@ static uint32_t r300_translate_colorformat(enum pipe_format format)
case PIPE_FORMAT_B5G6R5_UNORM:
return R300_COLOR_FORMAT_RGB565;
case PIPE_FORMAT_B5G5R5A1_UNORM:
+ case PIPE_FORMAT_B5G5R5X1_UNORM:
return R300_COLOR_FORMAT_ARGB1555;
case PIPE_FORMAT_B4G4R4A4_UNORM:
return R300_COLOR_FORMAT_ARGB4444;
/* 32-bit buffers. */
case PIPE_FORMAT_B8G8R8A8_UNORM:
- case PIPE_FORMAT_B8G8R8A8_SRGB:
case PIPE_FORMAT_B8G8R8X8_UNORM:
- case PIPE_FORMAT_B8G8R8X8_SRGB:
case PIPE_FORMAT_A8R8G8B8_UNORM:
- case PIPE_FORMAT_A8R8G8B8_SRGB:
case PIPE_FORMAT_X8R8G8B8_UNORM:
- case PIPE_FORMAT_X8R8G8B8_SRGB:
case PIPE_FORMAT_A8B8G8R8_UNORM:
case PIPE_FORMAT_R8G8B8A8_SNORM:
- case PIPE_FORMAT_A8B8G8R8_SRGB:
case PIPE_FORMAT_X8B8G8R8_UNORM:
- case PIPE_FORMAT_X8B8G8R8_SRGB:
case PIPE_FORMAT_R8SG8SB8UX8U_NORM:
return R300_COLOR_FORMAT_ARGB8888;
case PIPE_FORMAT_R10G10B10A2_UNORM:
@@ -337,12 +361,13 @@ static uint32_t r300_translate_colorformat(enum pipe_format format)
/* 64-bit buffers. */
case PIPE_FORMAT_R16G16B16A16_UNORM:
case PIPE_FORMAT_R16G16B16A16_SNORM:
- //case PIPE_FORMAT_R16G16B16A16_FLOAT: /* not in pipe_format */
+#if defined(ENABLE_FLOAT_TEXTURES)
+ case PIPE_FORMAT_R16G16B16A16_FLOAT:
+#endif
return R300_COLOR_FORMAT_ARGB16161616;
-/* XXX Enable float textures here. */
-#if 0
/* 128-bit buffers. */
+#if defined(ENABLE_FLOAT_TEXTURES)
case PIPE_FORMAT_R32G32B32A32_FLOAT:
return R300_COLOR_FORMAT_ARGB32323232;
#endif
@@ -367,7 +392,7 @@ static uint32_t r300_translate_zsformat(enum pipe_format format)
/* 24-bit depth, ignored stencil */
case PIPE_FORMAT_X8Z24_UNORM:
/* 24-bit depth, 8-bit stencil */
- case PIPE_FORMAT_S8Z24_UNORM:
+ case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
return R300_DEPTHFORMAT_24BIT_INT_Z_8BIT_STENCIL;
default:
return ~0; /* Unsupported. */
@@ -393,12 +418,7 @@ static uint32_t r300_translate_out_fmt(enum pipe_format format)
desc = util_format_description(format);
/* Specifies how the shader output is written to the fog unit. */
- if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) {
- /* The gamma correction causes precision loss so we need
- * higher precision to maintain reasonable quality.
- * It has nothing to do with the colorbuffer format. */
- modifier |= R300_US_OUT_FMT_C4_10_GAMMA;
- } else if (desc->channel[0].type == UTIL_FORMAT_TYPE_FLOAT) {
+ if (desc->channel[0].type == UTIL_FORMAT_TYPE_FLOAT) {
if (desc->channel[0].size == 32) {
modifier |= R300_US_OUT_FMT_C4_32_FP;
} else {
@@ -428,46 +448,39 @@ static uint32_t r300_translate_out_fmt(enum pipe_format format)
return modifier | R300_C2_SEL_A;
case PIPE_FORMAT_I8_UNORM:
case PIPE_FORMAT_L8_UNORM:
- case PIPE_FORMAT_L8_SRGB:
case PIPE_FORMAT_R8_UNORM:
case PIPE_FORMAT_R8_SNORM:
return modifier | R300_C2_SEL_R;
- /* ARGB 32-bit outputs. */
+ /* BGRA outputs. */
case PIPE_FORMAT_B5G6R5_UNORM:
case PIPE_FORMAT_B5G5R5A1_UNORM:
+ case PIPE_FORMAT_B5G5R5X1_UNORM:
case PIPE_FORMAT_B4G4R4A4_UNORM:
case PIPE_FORMAT_B8G8R8A8_UNORM:
- case PIPE_FORMAT_B8G8R8A8_SRGB:
case PIPE_FORMAT_B8G8R8X8_UNORM:
- case PIPE_FORMAT_B8G8R8X8_SRGB:
return modifier |
R300_C0_SEL_B | R300_C1_SEL_G |
R300_C2_SEL_R | R300_C3_SEL_A;
- /* BGRA 32-bit outputs. */
+ /* ARGB outputs. */
case PIPE_FORMAT_A8R8G8B8_UNORM:
- case PIPE_FORMAT_A8R8G8B8_SRGB:
case PIPE_FORMAT_X8R8G8B8_UNORM:
- case PIPE_FORMAT_X8R8G8B8_SRGB:
return modifier |
R300_C0_SEL_A | R300_C1_SEL_R |
R300_C2_SEL_G | R300_C3_SEL_B;
- /* RGBA 32-bit outputs. */
+ /* ABGR outputs. */
case PIPE_FORMAT_A8B8G8R8_UNORM:
- case PIPE_FORMAT_R8G8B8A8_SNORM:
- case PIPE_FORMAT_A8B8G8R8_SRGB:
case PIPE_FORMAT_X8B8G8R8_UNORM:
- case PIPE_FORMAT_X8B8G8R8_SRGB:
return modifier |
R300_C0_SEL_A | R300_C1_SEL_B |
R300_C2_SEL_G | R300_C3_SEL_R;
- /* ABGR 32-bit outputs. */
+ /* RGBA outputs. */
+ case PIPE_FORMAT_R8G8B8A8_SNORM:
case PIPE_FORMAT_R8SG8SB8UX8U_NORM:
case PIPE_FORMAT_R10G10B10A2_UNORM:
- /* RGBA high precision outputs (same swizzles as ABGR low precision) */
case PIPE_FORMAT_R16G16B16A16_UNORM:
case PIPE_FORMAT_R16G16B16A16_SNORM:
//case PIPE_FORMAT_R16G16B16A16_FLOAT: /* not in pipe_format */
@@ -508,7 +521,7 @@ static void r300_setup_texture_state(struct r300_screen* screen, struct r300_tex
state->format0 = R300_TX_WIDTH((pt->width0 - 1) & 0x7ff) |
R300_TX_HEIGHT((pt->height0 - 1) & 0x7ff);
- if (tex->is_npot) {
+ if (tex->is_npot || tex->stride_override) {
/* rectangles love this */
state->format0 |= R300_TX_PITCH_EN;
state->format2 = (tex->pitch[0] - 1) & 0x1fff;
@@ -534,6 +547,7 @@ static void r300_setup_texture_state(struct r300_screen* screen, struct r300_tex
if (pt->height0 > 2048) {
state->format2 |= R500_TXHEIGHT_BIT11;
}
+ state->format2 |= r500_tx_format_msb_bit(pt->format);
}
SCREEN_DBG(screen, DBG_TEX, "r300: Set texture state (%dx%d, %d levels)\n",
@@ -617,18 +631,23 @@ static unsigned r300_texture_get_tile_size(struct r300_texture* tex,
/* Return true if macrotiling should be enabled on the miplevel. */
static boolean r300_texture_macro_switch(struct r300_texture *tex,
unsigned level,
- boolean rv350_mode)
+ boolean rv350_mode,
+ int dim)
{
- unsigned tile_width, width;
+ unsigned tile, texdim;
- tile_width = r300_texture_get_tile_size(tex, TILE_WIDTH, TRUE);
- width = u_minify(tex->tex.width0, level);
+ tile = r300_texture_get_tile_size(tex, dim, TRUE);
+ if (dim == TILE_WIDTH) {
+ texdim = u_minify(tex->tex.width0, level);
+ } else {
+ texdim = u_minify(tex->tex.height0, level);
+ }
/* See TX_FILTER1_n.MACRO_SWITCH. */
if (rv350_mode) {
- return width >= tile_width;
+ return texdim >= tile;
} else {
- return width > tile_width;
+ return texdim > tile;
}
}
@@ -653,7 +672,7 @@ unsigned r300_texture_get_stride(struct r300_screen* screen,
width = u_minify(tex->tex.width0, level);
- if (!util_format_is_compressed(tex->tex.format)) {
+ if (r300_format_is_plain(tex->tex.format)) {
tile_width = r300_texture_get_tile_size(tex, TILE_WIDTH,
tex->mip_macrotile[level]);
width = align(width, tile_width);
@@ -671,7 +690,7 @@ static unsigned r300_texture_get_nblocksy(struct r300_texture* tex,
height = u_minify(tex->tex.height0, level);
- if (!util_format_is_compressed(tex->tex.format)) {
+ if (r300_format_is_plain(tex->tex.format)) {
tile_height = r300_texture_get_tile_size(tex, TILE_HEIGHT,
tex->mip_macrotile[level]);
height = align(height, tile_height);
@@ -692,9 +711,11 @@ static void r300_setup_miptree(struct r300_screen* screen,
for (i = 0; i <= base->last_level; i++) {
/* Let's see if this miplevel can be macrotiled. */
- tex->mip_macrotile[i] = (tex->macrotile == R300_BUFFER_TILED &&
- r300_texture_macro_switch(tex, i, rv350_mode)) ?
- R300_BUFFER_TILED : R300_BUFFER_LINEAR;
+ tex->mip_macrotile[i] =
+ (tex->macrotile == R300_BUFFER_TILED &&
+ r300_texture_macro_switch(tex, i, rv350_mode, TILE_WIDTH) &&
+ r300_texture_macro_switch(tex, i, rv350_mode, TILE_HEIGHT)) ?
+ R300_BUFFER_TILED : R300_BUFFER_LINEAR;
stride = r300_texture_get_stride(screen, tex, i);
nblocksy = r300_texture_get_nblocksy(tex, i);
@@ -724,34 +745,74 @@ static void r300_setup_flags(struct r300_texture* tex)
!util_is_power_of_two(tex->tex.height0);
}
+static void r300_setup_tiling(struct pipe_screen *screen,
+ struct r300_texture *tex)
+{
+ struct r300_winsys_screen *rws = (struct r300_winsys_screen *)screen->winsys;
+ enum pipe_format format = tex->tex.format;
+ boolean rv350_mode = r300_screen(screen)->caps->family >= CHIP_FAMILY_RV350;
+
+ if (!r300_format_is_plain(format)) {
+ return;
+ }
+
+ if (tex->tex.width0 == 1 ||
+ tex->tex.height0 == 1) {
+ return;
+ }
+
+ /* Set microtiling. */
+ switch (util_format_get_blocksize(format)) {
+ case 1:
+ case 4:
+ tex->microtile = R300_BUFFER_TILED;
+ break;
+
+ case 2:
+ case 8:
+ if (rws->get_value(rws, R300_VID_SQUARE_TILING_SUPPORT)) {
+ tex->microtile = R300_BUFFER_SQUARETILED;
+ }
+ break;
+ }
+
+ /* Set macrotiling. */
+ if (r300_texture_macro_switch(tex, 0, rv350_mode, TILE_WIDTH) &&
+ r300_texture_macro_switch(tex, 0, rv350_mode, TILE_HEIGHT)) {
+ tex->macrotile = R300_BUFFER_TILED;
+ }
+}
+
/* Create a new texture. */
-static struct pipe_texture*
- r300_texture_create(struct pipe_screen* screen,
- const struct pipe_texture* template)
+static struct pipe_texture* r300_texture_create(struct pipe_screen* screen,
+ const struct pipe_texture* base)
{
struct r300_texture* tex = CALLOC_STRUCT(r300_texture);
struct r300_screen* rscreen = r300_screen(screen);
- struct radeon_winsys* winsys = (struct radeon_winsys*)screen->winsys;
+ struct r300_winsys_screen *rws = (struct r300_winsys_screen *)screen->winsys;
if (!tex) {
return NULL;
}
- tex->tex = *template;
+ tex->tex = *base;
pipe_reference_init(&tex->tex.reference, 1);
tex->tex.screen = screen;
r300_setup_flags(tex);
+ if (!(base->tex_usage & R300_TEXTURE_USAGE_TRANSFER)) {
+ r300_setup_tiling(screen, tex);
+ }
r300_setup_miptree(rscreen, tex);
r300_setup_texture_state(rscreen, tex);
- tex->buffer = screen->buffer_create(screen, 2048,
- PIPE_BUFFER_USAGE_PIXEL,
- tex->size);
- winsys->buffer_set_tiling(winsys, tex->buffer,
- tex->pitch[0],
- tex->microtile != R300_BUFFER_LINEAR,
- tex->macrotile != R300_BUFFER_LINEAR);
+ tex->buffer = rws->buffer_create(rws, 2048,
+ PIPE_BUFFER_USAGE_PIXEL,
+ tex->size);
+ rws->buffer_set_tiling(rws, tex->buffer,
+ tex->pitch[0],
+ tex->microtile,
+ tex->macrotile);
if (!tex->buffer) {
FREE(tex);
@@ -764,9 +825,9 @@ static struct pipe_texture*
static void r300_texture_destroy(struct pipe_texture* texture)
{
struct r300_texture* tex = (struct r300_texture*)texture;
+ struct r300_winsys_screen *rws = (struct r300_winsys_screen *)texture->screen->winsys;
- pipe_buffer_reference(&tex->buffer, NULL);
-
+ rws->buffer_reference(rws, &tex->buffer, NULL);
FREE(tex);
}
@@ -806,14 +867,17 @@ static void r300_tex_surface_destroy(struct pipe_surface* s)
FREE(s);
}
+
static struct pipe_texture*
- r300_texture_blanket(struct pipe_screen* screen,
- const struct pipe_texture* base,
- const unsigned* stride,
- struct pipe_buffer* buffer)
+ r300_texture_from_handle(struct pipe_screen* screen,
+ const struct pipe_texture* base,
+ struct winsys_handle *whandle)
{
- struct r300_texture* tex;
+ struct r300_winsys_screen *rws = (struct r300_winsys_screen*)screen->winsys;
struct r300_screen* rscreen = r300_screen(screen);
+ struct r300_winsys_buffer *buffer;
+ struct r300_texture* tex;
+ unsigned stride;
/* Support only 2D textures without mipmaps */
if (base->target != PIPE_TEXTURE_2D ||
@@ -822,6 +886,11 @@ static struct pipe_texture*
return NULL;
}
+ buffer = rws->buffer_from_handle(rws, screen, whandle, &stride);
+ if (!buffer) {
+ return NULL;
+ }
+
tex = CALLOC_STRUCT(r300_texture);
if (!tex) {
return NULL;
@@ -831,15 +900,36 @@ static struct pipe_texture*
pipe_reference_init(&tex->tex.reference, 1);
tex->tex.screen = screen;
- tex->stride_override = *stride;
- tex->pitch[0] = *stride / util_format_get_blocksize(base->format);
+ tex->stride_override = stride;
+ /* one ref already taken */
+ tex->buffer = buffer;
+
+ rws->buffer_get_tiling(rws, buffer, &tex->microtile, &tex->macrotile);
r300_setup_flags(tex);
+ r300_setup_miptree(rscreen, tex);
r300_setup_texture_state(rscreen, tex);
+ return (struct pipe_texture*)tex;
+}
+
+static boolean
+ r300_texture_get_handle(struct pipe_screen* screen,
+ struct pipe_texture *texture,
+ struct winsys_handle *whandle)
+{
+ struct r300_winsys_screen *rws = (struct r300_winsys_screen *)screen->winsys;
+ struct r300_texture* tex = (struct r300_texture*)texture;
+ unsigned stride;
- pipe_buffer_reference(&tex->buffer, buffer);
+ if (!tex) {
+ return FALSE;
+ }
- return (struct pipe_texture*)tex;
+ stride = r300_texture_get_stride(r300_screen(screen), tex, 0);
+
+ rws->buffer_get_handle(rws, tex->buffer, stride, whandle);
+
+ return TRUE;
}
static struct pipe_video_surface *
@@ -848,7 +938,7 @@ r300_video_surface_create(struct pipe_screen *screen,
unsigned width, unsigned height)
{
struct r300_video_surface *r300_vsfc;
- struct pipe_texture template;
+ struct pipe_texture base;
assert(screen);
assert(width && height);
@@ -863,17 +953,17 @@ r300_video_surface_create(struct pipe_screen *screen,
r300_vsfc->base.width = width;
r300_vsfc->base.height = height;
- memset(&template, 0, sizeof(struct pipe_texture));
- template.target = PIPE_TEXTURE_2D;
- template.format = PIPE_FORMAT_B8G8R8X8_UNORM;
- template.last_level = 0;
- template.width0 = util_next_power_of_two(width);
- template.height0 = util_next_power_of_two(height);
- template.depth0 = 1;
- template.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER |
- PIPE_TEXTURE_USAGE_RENDER_TARGET;
-
- r300_vsfc->tex = screen->texture_create(screen, &template);
+ memset(&base, 0, sizeof(struct pipe_texture));
+ base.target = PIPE_TEXTURE_2D;
+ base.format = PIPE_FORMAT_B8G8R8X8_UNORM;
+ base.last_level = 0;
+ base.width0 = util_next_power_of_two(width);
+ base.height0 = util_next_power_of_two(height);
+ base.depth0 = 1;
+ base.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER |
+ PIPE_TEXTURE_USAGE_RENDER_TARGET;
+
+ r300_vsfc->tex = screen->texture_create(screen, &base);
if (!r300_vsfc->tex)
{
FREE(r300_vsfc);
@@ -893,10 +983,11 @@ static void r300_video_surface_destroy(struct pipe_video_surface *vsfc)
void r300_init_screen_texture_functions(struct pipe_screen* screen)
{
screen->texture_create = r300_texture_create;
+ screen->texture_from_handle = r300_texture_from_handle;
+ screen->texture_get_handle = r300_texture_get_handle;
screen->texture_destroy = r300_texture_destroy;
screen->get_tex_surface = r300_get_tex_surface;
screen->tex_surface_destroy = r300_tex_surface_destroy;
- screen->texture_blanket = r300_texture_blanket;
screen->video_surface_create = r300_video_surface_create;
screen->video_surface_destroy= r300_video_surface_destroy;
@@ -904,19 +995,23 @@ void r300_init_screen_texture_functions(struct pipe_screen* screen)
boolean r300_get_texture_buffer(struct pipe_screen* screen,
struct pipe_texture* texture,
- struct pipe_buffer** buffer,
+ struct r300_winsys_buffer** buffer,
unsigned* stride)
{
struct r300_texture* tex = (struct r300_texture*)texture;
+ struct r300_winsys_screen *rws = (struct r300_winsys_screen *)screen->winsys;
+ struct r300_winsys_buffer *buf;
+
if (!tex) {
return FALSE;
}
- pipe_buffer_reference(buffer, tex->buffer);
+ rws->buffer_reference(rws, &buf, tex->buffer);
if (stride) {
*stride = r300_texture_get_stride(r300_screen(screen), tex, 0);
}
+ *buffer = buf;
return TRUE;
}
diff --git a/src/gallium/drivers/r300/r300_texture.h b/src/gallium/drivers/r300/r300_texture.h
index 46a5fb6188..60c7fa8342 100644
--- a/src/gallium/drivers/r300/r300_texture.h
+++ b/src/gallium/drivers/r300/r300_texture.h
@@ -60,13 +60,11 @@ r300_video_surface(struct pipe_video_surface *pvs)
return (struct r300_video_surface *)pvs;
}
-#ifndef R300_WINSYS_H
-
+/* Used internally for texture_is_referenced()
+ */
boolean r300_get_texture_buffer(struct pipe_screen* screen,
- struct pipe_texture* texture,
- struct pipe_buffer** buffer,
+ struct pipe_texture *texture,
+ struct r300_winsys_buffer** buffer,
unsigned* stride);
-#endif /* R300_WINSYS_H */
-
#endif /* R300_TEXTURE_H */
diff --git a/src/gallium/drivers/r300/r300_tgsi_to_rc.c b/src/gallium/drivers/r300/r300_tgsi_to_rc.c
index aff4ddd4e2..3b3802ee2b 100644
--- a/src/gallium/drivers/r300/r300_tgsi_to_rc.c
+++ b/src/gallium/drivers/r300/r300_tgsi_to_rc.c
@@ -25,12 +25,11 @@
#include "radeon_compiler.h"
#include "radeon_program.h"
+#include "tgsi/tgsi_info.h"
#include "tgsi/tgsi_parse.h"
#include "tgsi/tgsi_scan.h"
#include "tgsi/tgsi_util.h"
-#include "util/u_debug.h"
-
static unsigned translate_opcode(unsigned opcode)
{
switch(opcode) {
@@ -145,7 +144,7 @@ static unsigned translate_opcode(unsigned opcode)
case TGSI_OPCODE_KIL: return RC_OPCODE_KIL;
}
- debug_printf("r300: Unknown TGSI/RC opcode: %i\n", opcode);
+ fprintf(stderr, "r300: Unknown TGSI/RC opcode: %s\n", tgsi_get_opcode_name(opcode));
return RC_OPCODE_ILLEGAL_OPCODE;
}
@@ -272,9 +271,6 @@ static void transform_instruction(struct tgsi_to_rc * ttr, struct tgsi_full_inst
struct rc_instruction * dst;
int i;
- if (src->Instruction.Opcode == TGSI_OPCODE_END)
- return;
-
dst = rc_insert_new_instruction(ttr->compiler, ttr->compiler->Program.Instructions.Prev);
dst->U.I.Opcode = translate_opcode(src->Instruction.Opcode);
dst->U.I.SaturateMode = translate_saturate(src->Instruction.Saturate);
@@ -333,6 +329,7 @@ static void handle_immediate(struct tgsi_to_rc * ttr,
void r300_tgsi_to_rc(struct tgsi_to_rc * ttr,
const struct tgsi_token * tokens)
{
+ struct tgsi_full_instruction *inst;
struct tgsi_parse_context parser;
unsigned imm_index = 0;
int i;
@@ -367,7 +364,15 @@ void r300_tgsi_to_rc(struct tgsi_to_rc * ttr,
imm_index++;
break;
case TGSI_TOKEN_TYPE_INSTRUCTION:
- transform_instruction(ttr, &parser.FullToken.FullInstruction);
+ inst = &parser.FullToken.FullInstruction;
+ /* This hack with the RET opcode woudn't work with
+ * conditionals. */
+ if (inst->Instruction.Opcode == TGSI_OPCODE_END ||
+ inst->Instruction.Opcode == TGSI_OPCODE_RET) {
+ break;
+ }
+
+ transform_instruction(ttr, inst);
break;
}
}
diff --git a/src/gallium/drivers/r300/r300_transfer.c b/src/gallium/drivers/r300/r300_transfer.c
new file mode 100644
index 0000000000..cbf3174b38
--- /dev/null
+++ b/src/gallium/drivers/r300/r300_transfer.c
@@ -0,0 +1,280 @@
+/*
+ * Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com>
+ * Copyright 2010 Marek Olšák <maraeo@gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "r300_context.h"
+#include "r300_transfer.h"
+#include "r300_texture.h"
+#include "r300_screen.h"
+
+#include "r300_winsys.h"
+
+#include "util/u_memory.h"
+#include "util/u_format.h"
+
+struct r300_transfer {
+ /* Parent class */
+ struct pipe_transfer transfer;
+
+ /* Pipe context. */
+ struct pipe_context *ctx;
+
+ /* Parameters of get_tex_transfer. */
+ unsigned x, y, level, zslice, face;
+
+ /* Offset from start of buffer. */
+ unsigned offset;
+
+ /* Detiled texture. */
+ struct r300_texture *detiled_texture;
+
+ /* Transfer and format flags. */
+ unsigned buffer_usage, render_target_usage;
+};
+
+/* Convenience cast wrapper. */
+static INLINE struct r300_transfer*
+r300_transfer(struct pipe_transfer* transfer)
+{
+ return (struct r300_transfer*)transfer;
+}
+
+/* Copy from a tiled texture to a detiled one. */
+static void r300_copy_from_tiled_texture(struct pipe_context *ctx,
+ struct r300_transfer *r300transfer)
+{
+ struct pipe_screen *screen = ctx->screen;
+ struct pipe_transfer *transfer = (struct pipe_transfer*)r300transfer;
+ struct pipe_texture *tex = transfer->texture;
+ struct pipe_surface *src, *dst;
+
+ src = screen->get_tex_surface(screen, tex, r300transfer->face,
+ r300transfer->level, r300transfer->zslice,
+ PIPE_BUFFER_USAGE_GPU_READ |
+ PIPE_BUFFER_USAGE_PIXEL);
+
+ dst = screen->get_tex_surface(screen, &r300transfer->detiled_texture->tex,
+ 0, 0, 0,
+ PIPE_BUFFER_USAGE_GPU_WRITE |
+ PIPE_BUFFER_USAGE_PIXEL |
+ r300transfer->buffer_usage);
+
+ ctx->surface_copy(ctx, dst, 0, 0, src, r300transfer->x, r300transfer->y,
+ transfer->width, transfer->height);
+
+ pipe_surface_reference(&src, NULL);
+ pipe_surface_reference(&dst, NULL);
+}
+
+/* Copy a detiled texture to a tiled one. */
+static void r300_copy_into_tiled_texture(struct pipe_context *ctx,
+ struct r300_transfer *r300transfer)
+{
+ struct pipe_screen *screen = ctx->screen;
+ struct pipe_transfer *transfer = (struct pipe_transfer*)r300transfer;
+ struct pipe_texture *tex = transfer->texture;
+ struct pipe_surface *src, *dst;
+
+ src = screen->get_tex_surface(screen, &r300transfer->detiled_texture->tex,
+ 0, 0, 0,
+ PIPE_BUFFER_USAGE_GPU_READ |
+ PIPE_BUFFER_USAGE_PIXEL);
+
+ dst = screen->get_tex_surface(screen, tex, r300transfer->face,
+ r300transfer->level, r300transfer->zslice,
+ PIPE_BUFFER_USAGE_GPU_WRITE |
+ PIPE_BUFFER_USAGE_PIXEL);
+
+ /* XXX this flush prevents the following DRM error from occuring:
+ * [drm:radeon_cs_ioctl] *ERROR* Failed to parse relocation !
+ * Reproducible with perf/copytex. */
+ ctx->flush(ctx, 0, NULL);
+
+ ctx->surface_copy(ctx, dst, r300transfer->x, r300transfer->y, src, 0, 0,
+ transfer->width, transfer->height);
+
+ /* XXX this flush fixes a few piglit tests (e.g. glean/pixelFormats). */
+ ctx->flush(ctx, 0, NULL);
+
+ pipe_surface_reference(&src, NULL);
+ pipe_surface_reference(&dst, NULL);
+}
+
+static struct pipe_transfer*
+r300_get_tex_transfer(struct pipe_context *ctx,
+ struct pipe_texture *texture,
+ unsigned face, unsigned level, unsigned zslice,
+ enum pipe_transfer_usage usage, unsigned x, unsigned y,
+ unsigned w, unsigned h)
+{
+ struct r300_texture *tex = (struct r300_texture *)texture;
+ struct r300_screen *r300screen = r300_screen(ctx->screen);
+ struct r300_transfer *trans;
+ struct pipe_texture base;
+
+ trans = CALLOC_STRUCT(r300_transfer);
+ if (trans) {
+ /* Initialize the transfer object. */
+ pipe_texture_reference(&trans->transfer.texture, texture);
+ trans->transfer.usage = usage;
+ trans->transfer.width = w;
+ trans->transfer.height = h;
+ trans->ctx = ctx;
+ trans->x = x;
+ trans->y = y;
+ trans->level = level;
+ trans->zslice = zslice;
+ trans->face = face;
+
+ /* If the texture is tiled, we must create a temporary detiled texture
+ * for this transfer. */
+ if (tex->microtile || tex->macrotile) {
+ trans->buffer_usage = pipe_transfer_buffer_flags(&trans->transfer);
+ trans->render_target_usage =
+ util_format_is_depth_or_stencil(texture->format) ?
+ PIPE_TEXTURE_USAGE_DEPTH_STENCIL :
+ PIPE_TEXTURE_USAGE_RENDER_TARGET;
+
+ base.target = PIPE_TEXTURE_2D;
+ base.format = texture->format;
+ base.width0 = w;
+ base.height0 = h;
+ base.depth0 = 0;
+ base.last_level = 0;
+ base.nr_samples = 0;
+ base.tex_usage = PIPE_TEXTURE_USAGE_DYNAMIC |
+ R300_TEXTURE_USAGE_TRANSFER;
+
+ /* For texture reading, the temporary (detiled) texture is used as
+ * a render target when blitting from a tiled texture. */
+ if (usage & PIPE_TRANSFER_READ) {
+ base.tex_usage |= trans->render_target_usage;
+ }
+ /* For texture writing, the temporary texture is used as a sampler
+ * when blitting into a tiled texture. */
+ if (usage & PIPE_TRANSFER_WRITE) {
+ base.tex_usage |= PIPE_TEXTURE_USAGE_SAMPLER;
+ }
+
+ /* Create the temporary texture. */
+ trans->detiled_texture = (struct r300_texture*)
+ ctx->screen->texture_create(ctx->screen,
+ &base);
+
+ assert(!trans->detiled_texture->microtile &&
+ !trans->detiled_texture->macrotile);
+
+ /* Set the stride.
+ * Parameters x, y, level, zslice, and face remain zero. */
+ trans->transfer.stride =
+ r300_texture_get_stride(r300screen, trans->detiled_texture, 0);
+
+ if (usage & PIPE_TRANSFER_READ) {
+ /* We cannot map a tiled texture directly because the data is
+ * in a different order, therefore we do detiling using a blit. */
+ r300_copy_from_tiled_texture(ctx, trans);
+ }
+ } else {
+ trans->transfer.x = x;
+ trans->transfer.y = y;
+ trans->transfer.stride =
+ r300_texture_get_stride(r300screen, tex, level);
+ trans->transfer.level = level;
+ trans->transfer.zslice = zslice;
+ trans->transfer.face = face;
+ trans->offset = r300_texture_get_offset(tex, level, zslice, face);
+ }
+ }
+ return &trans->transfer;
+}
+
+static void r300_tex_transfer_destroy(struct pipe_context *ctx,
+ struct pipe_transfer *trans)
+{
+ struct r300_transfer *r300transfer = r300_transfer(trans);
+
+ if (r300transfer->detiled_texture) {
+ if (trans->usage & PIPE_TRANSFER_WRITE) {
+ r300_copy_into_tiled_texture(r300transfer->ctx, r300transfer);
+ }
+
+ pipe_texture_reference(
+ (struct pipe_texture**)&r300transfer->detiled_texture, NULL);
+ }
+ pipe_texture_reference(&trans->texture, NULL);
+ FREE(trans);
+}
+
+static void* r300_transfer_map(struct pipe_context *ctx,
+ struct pipe_transfer *transfer)
+{
+ struct r300_winsys_screen *rws = (struct r300_winsys_screen *)ctx->winsys;
+ struct r300_transfer *r300transfer = r300_transfer(transfer);
+ struct r300_texture *tex = (struct r300_texture*)transfer->texture;
+ char *map;
+ enum pipe_format format = tex->tex.format;
+
+ if (r300transfer->detiled_texture) {
+ /* The detiled texture is of the same size as the region being mapped
+ * (no offset needed). */
+ return rws->buffer_map(rws,
+ r300transfer->detiled_texture->buffer,
+ pipe_transfer_buffer_flags(transfer));
+ } else {
+ /* Tiling is disabled. */
+ map = rws->buffer_map(rws, tex->buffer,
+ pipe_transfer_buffer_flags(transfer));
+
+ if (!map) {
+ return NULL;
+ }
+
+ return map + r300_transfer(transfer)->offset +
+ transfer->y / util_format_get_blockheight(format) * transfer->stride +
+ transfer->x / util_format_get_blockwidth(format) * util_format_get_blocksize(format);
+ }
+}
+
+static void r300_transfer_unmap(struct pipe_context *ctx,
+ struct pipe_transfer *transfer)
+{
+ struct r300_winsys_screen *rws = (struct r300_winsys_screen *)ctx->winsys;
+ struct r300_transfer *r300transfer = r300_transfer(transfer);
+ struct r300_texture *tex = (struct r300_texture*)transfer->texture;
+
+ if (r300transfer->detiled_texture) {
+ rws->buffer_unmap(rws, r300transfer->detiled_texture->buffer);
+ } else {
+ rws->buffer_unmap(rws, tex->buffer);
+ }
+}
+
+
+void r300_init_transfer_functions( struct r300_context *r300ctx )
+{
+ struct pipe_context *ctx = &r300ctx->context;
+
+ ctx->get_tex_transfer = r300_get_tex_transfer;
+ ctx->tex_transfer_destroy = r300_tex_transfer_destroy;
+ ctx->transfer_map = r300_transfer_map;
+ ctx->transfer_unmap = r300_transfer_unmap;
+}
diff --git a/src/gallium/drivers/r300/r300_transfer.h b/src/gallium/drivers/r300/r300_transfer.h
new file mode 100644
index 0000000000..79baf6d048
--- /dev/null
+++ b/src/gallium/drivers/r300/r300_transfer.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com>
+ * Copyright 2010 Marek Olšák <maraeo@gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef R300_TRANSFER
+#define R300_TRANSFER
+
+#include "pipe/p_screen.h"
+
+struct r300_context;
+
+void r300_init_transfer_functions(struct r300_context *r300ctx);
+
+#endif
diff --git a/src/gallium/drivers/r300/r300_vs.c b/src/gallium/drivers/r300/r300_vs.c
index 60a04bbfed..d5690caa68 100644
--- a/src/gallium/drivers/r300/r300_vs.c
+++ b/src/gallium/drivers/r300/r300_vs.c
@@ -34,8 +34,6 @@
#include "radeon_compiler.h"
-#include "util/u_math.h"
-
/* Convert info about VS output semantics into r300_shader_semantics. */
static void r300_shader_read_vs_outputs(
struct tgsi_shader_info* info,
@@ -89,95 +87,41 @@ static void r300_shader_read_vs_outputs(
assert(0);
}
}
+
+ /* WPOS is a straight copy of POSITION and it's always emitted. */
+ vs_outputs->wpos = i;
}
-static void r300_shader_vap_output_fmt(struct r300_vertex_shader* vs)
+/* This function sets up:
+ * - VAP mapping, which maps VS registers to output semantics and
+ * at the same time it indicates which attributes are enabled and should
+ * be rasterized.
+ * - Stream mapping to VS outputs if TCL is not present. */
+static void r300_init_vs_output_mapping(struct r300_vertex_shader* vs)
{
struct r300_shader_semantics* vs_outputs = &vs->outputs;
- uint32_t* hwfmt = vs->hwfmt;
- int i, gen_count;
+ struct r300_vap_output_state *vap_out = &vs->vap_out;
+ int *stream_loc = vs->stream_loc_notcl;
+ int i, gen_count, tabi = 0;
boolean any_bcolor_used = vs_outputs->bcolor[0] != ATTR_UNUSED ||
vs_outputs->bcolor[1] != ATTR_UNUSED;
- /* Do the actual vertex_info setup.
- *
- * vertex_info has four uints of hardware-specific data in it.
- * vinfo.hwfmt[0] is R300_VAP_VTX_STATE_CNTL
- * vinfo.hwfmt[1] is R300_VAP_VSM_VTX_ASSM
- * vinfo.hwfmt[2] is R300_VAP_OUTPUT_VTX_FMT_0
- * vinfo.hwfmt[3] is R300_VAP_OUTPUT_VTX_FMT_1 */
-
- hwfmt[0] = 0x5555; /* XXX this is classic Mesa bonghits */
+ vap_out->vap_vtx_state_cntl = 0x5555; /* XXX this is classic Mesa bonghits */
/* Position. */
if (vs_outputs->pos != ATTR_UNUSED) {
- hwfmt[1] |= R300_INPUT_CNTL_POS;
- hwfmt[2] |= R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT;
+ vap_out->vap_vsm_vtx_assm |= R300_INPUT_CNTL_POS;
+ vap_out->vap_out_vtx_fmt[0] |= R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT;
+
+ stream_loc[tabi++] = 0;
} else {
assert(0);
}
/* Point size. */
if (vs_outputs->psize != ATTR_UNUSED) {
- hwfmt[2] |= R300_VAP_OUTPUT_VTX_FMT_0__PT_SIZE_PRESENT;
- }
-
- /* Colors. */
- for (i = 0; i < ATTR_COLOR_COUNT; i++) {
- if (vs_outputs->color[i] != ATTR_UNUSED || any_bcolor_used ||
- vs_outputs->color[1] != ATTR_UNUSED) {
- hwfmt[1] |= R300_INPUT_CNTL_COLOR;
- hwfmt[2] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT << i;
- }
- }
-
- /* Back-face colors. */
- if (any_bcolor_used) {
- for (i = 0; i < ATTR_COLOR_COUNT; i++) {
- hwfmt[1] |= R300_INPUT_CNTL_COLOR;
- hwfmt[2] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT << (2+i);
- }
- }
-
- /* Texture coordinates. */
- gen_count = 0;
- for (i = 0; i < ATTR_GENERIC_COUNT; i++) {
- if (vs_outputs->generic[i] != ATTR_UNUSED) {
- hwfmt[1] |= (R300_INPUT_CNTL_TC0 << gen_count);
- hwfmt[3] |= (4 << (3 * gen_count));
- gen_count++;
- }
- }
-
- /* Fog coordinates. */
- if (vs_outputs->fog != ATTR_UNUSED) {
- hwfmt[1] |= (R300_INPUT_CNTL_TC0 << gen_count);
- hwfmt[3] |= (4 << (3 * gen_count));
- gen_count++;
- }
-
- /* XXX magic */
- assert(gen_count <= 8);
+ vap_out->vap_out_vtx_fmt[0] |= R300_VAP_OUTPUT_VTX_FMT_0__PT_SIZE_PRESENT;
- /* WPOS. */
- vs->wpos_tex_output = gen_count;
-}
-
-/* Sets up stream mapping to equivalent VS outputs if TCL is bypassed
- * or isn't present. */
-static void r300_stream_locations_notcl(
- struct r300_shader_semantics* vs_outputs,
- int* stream_loc)
-{
- int i, tabi = 0, gen_count;
- boolean any_bcolor_used = vs_outputs->bcolor[0] != ATTR_UNUSED ||
- vs_outputs->bcolor[1] != ATTR_UNUSED;
-
- /* Position. */
- stream_loc[tabi++] = 0;
-
- /* Point size. */
- if (vs_outputs->psize != ATTR_UNUSED) {
stream_loc[tabi++] = 1;
}
@@ -185,6 +129,9 @@ static void r300_stream_locations_notcl(
for (i = 0; i < ATTR_COLOR_COUNT; i++) {
if (vs_outputs->color[i] != ATTR_UNUSED || any_bcolor_used ||
vs_outputs->color[1] != ATTR_UNUSED) {
+ vap_out->vap_vsm_vtx_assm |= R300_INPUT_CNTL_COLOR;
+ vap_out->vap_out_vtx_fmt[0] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT << i;
+
stream_loc[tabi++] = 2 + i;
}
}
@@ -192,6 +139,9 @@ static void r300_stream_locations_notcl(
/* Back-face colors. */
if (any_bcolor_used) {
for (i = 0; i < ATTR_COLOR_COUNT; i++) {
+ vap_out->vap_vsm_vtx_assm |= R300_INPUT_CNTL_COLOR;
+ vap_out->vap_out_vtx_fmt[0] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT << (2+i);
+
stream_loc[tabi++] = 4 + i;
}
}
@@ -200,6 +150,9 @@ static void r300_stream_locations_notcl(
gen_count = 0;
for (i = 0; i < ATTR_GENERIC_COUNT; i++) {
if (vs_outputs->generic[i] != ATTR_UNUSED) {
+ vap_out->vap_vsm_vtx_assm |= (R300_INPUT_CNTL_TC0 << gen_count);
+ vap_out->vap_out_vtx_fmt[1] |= (4 << (3 * gen_count));
+
assert(tabi < 16);
stream_loc[tabi++] = 6 + gen_count;
gen_count++;
@@ -208,17 +161,22 @@ static void r300_stream_locations_notcl(
/* Fog coordinates. */
if (vs_outputs->fog != ATTR_UNUSED) {
+ vap_out->vap_vsm_vtx_assm |= (R300_INPUT_CNTL_TC0 << gen_count);
+ vap_out->vap_out_vtx_fmt[1] |= (4 << (3 * gen_count));
+
assert(tabi < 16);
stream_loc[tabi++] = 6 + gen_count;
gen_count++;
}
+ /* XXX magic */
+ assert(gen_count <= 8);
+
/* WPOS. */
- if (vs_outputs->wpos != ATTR_UNUSED) {
- assert(tabi < 16);
- stream_loc[tabi++] = 6 + gen_count;
- gen_count++;
- }
+ vs->wpos_tex_output = gen_count;
+
+ assert(tabi < 16);
+ stream_loc[tabi++] = 6 + gen_count;
for (; tabi < 16;) {
stream_loc[tabi++] = -1;
@@ -294,26 +252,16 @@ static void set_vertex_inputs_outputs(struct r300_vertex_program_compiler * c)
}
}
-static void r300_insert_wpos(struct r300_vertex_program_compiler* c,
- struct r300_shader_semantics* outputs)
+void r300_vertex_shader_common_init(struct r300_vertex_shader *vs,
+ const struct pipe_shader_state *shader)
{
- int i, lastOutput = 0;
+ /* Copy state directly into shader. */
+ vs->state = *shader;
+ vs->state.tokens = tgsi_dup_tokens(shader->tokens);
+ tgsi_scan_shader(shader->tokens, &vs->info);
- /* Find the max output index. */
- lastOutput = MAX2(lastOutput, outputs->psize);
- for (i = 0; i < ATTR_COLOR_COUNT; i++) {
- lastOutput = MAX2(lastOutput, outputs->color[i]);
- lastOutput = MAX2(lastOutput, outputs->bcolor[i]);
- }
- for (i = 0; i < ATTR_GENERIC_COUNT; i++) {
- lastOutput = MAX2(lastOutput, outputs->generic[i]);
- }
- lastOutput = MAX2(lastOutput, outputs->fog);
-
- /* Set WPOS after the last output. */
- lastOutput++;
- rc_copy_output(&c->Base, 0, lastOutput); /* out[lastOutput] = out[0]; */
- outputs->wpos = lastOutput;
+ r300_shader_read_vs_outputs(&vs->info, &vs->outputs);
+ r300_init_vs_output_mapping(vs);
}
void r300_translate_vertex_shader(struct r300_context* r300,
@@ -322,9 +270,6 @@ void r300_translate_vertex_shader(struct r300_context* r300,
struct r300_vertex_program_compiler compiler;
struct tgsi_to_rc ttr;
- /* Initialize. */
- r300_shader_read_vs_outputs(&vs->info, &vs->outputs);
-
/* Setup the compiler */
rc_init(&compiler.Base);
@@ -348,45 +293,41 @@ void r300_translate_vertex_shader(struct r300_context* r300,
compiler.SetHwInputOutput = &set_vertex_inputs_outputs;
/* Insert the WPOS output. */
- r300_insert_wpos(&compiler, &vs->outputs);
-
- r300_shader_vap_output_fmt(vs);
- r300_stream_locations_notcl(&vs->outputs, vs->stream_loc_notcl);
+ rc_copy_output(&compiler.Base, 0, vs->outputs.wpos);
/* Invoke the compiler */
r3xx_compile_vertex_program(&compiler);
if (compiler.Base.Error) {
/* XXX We should fallback using Draw. */
- fprintf(stderr, "r300 VP: Compiler error\n");
+ fprintf(stderr, "r300 VP: Compiler error:\n%s", compiler.Base.ErrorMsg);
abort();
}
/* And, finally... */
rc_destroy(&compiler.Base);
- vs->translated = TRUE;
}
boolean r300_vertex_shader_setup_wpos(struct r300_context* r300)
{
struct r300_vertex_shader* vs = r300->vs_state.state;
+ struct r300_vap_output_state *vap_out = &vs->vap_out;
int tex_output = vs->wpos_tex_output;
uint32_t tex_fmt = R300_INPUT_CNTL_TC0 << tex_output;
- uint32_t* hwfmt = vs->hwfmt;
if (r300->fs->inputs.wpos != ATTR_UNUSED) {
/* Enable WPOS in VAP. */
- if (!(hwfmt[1] & tex_fmt)) {
- hwfmt[1] |= tex_fmt;
- hwfmt[3] |= (4 << (3 * tex_output));
+ if (!(vap_out->vap_vsm_vtx_assm & tex_fmt)) {
+ vap_out->vap_vsm_vtx_assm |= tex_fmt;
+ vap_out->vap_out_vtx_fmt[1] |= (4 << (3 * tex_output));
assert(tex_output < 8);
return TRUE;
}
} else {
/* Disable WPOS in VAP. */
- if (hwfmt[1] & tex_fmt) {
- hwfmt[1] &= ~tex_fmt;
- hwfmt[3] &= ~(4 << (3 * tex_output));
+ if (vap_out->vap_vsm_vtx_assm & tex_fmt) {
+ vap_out->vap_vsm_vtx_assm &= ~tex_fmt;
+ vap_out->vap_out_vtx_fmt[1] &= ~(4 << (3 * tex_output));
return TRUE;
}
}
diff --git a/src/gallium/drivers/r300/r300_vs.h b/src/gallium/drivers/r300/r300_vs.h
index 18cfeee3cd..f6f0b86b68 100644
--- a/src/gallium/drivers/r300/r300_vs.h
+++ b/src/gallium/drivers/r300/r300_vs.h
@@ -28,6 +28,7 @@
#include "tgsi/tgsi_scan.h"
#include "radeon_code.h"
+#include "r300_context.h"
#include "r300_shader_semantics.h"
struct r300_context;
@@ -38,7 +39,7 @@ struct r300_vertex_shader {
struct tgsi_shader_info info;
struct r300_shader_semantics outputs;
- uint hwfmt[4];
+ struct r300_vap_output_state vap_out;
/* Stream locations for SWTCL or if TCL is bypassed. */
int stream_loc_notcl[16];
@@ -46,13 +47,17 @@ struct r300_vertex_shader {
/* Output stream location for WPOS. */
int wpos_tex_output;
- /* Has this shader been translated yet? */
- boolean translated;
-
+ /* HWTCL-specific. */
/* Machine code (if translated) */
struct r300_vertex_program_code code;
+
+ /* SWTCL-specific. */
+ void *draw_vs;
};
+void r300_vertex_shader_common_init(struct r300_vertex_shader *vs,
+ const struct pipe_shader_state *shader);
+
void r300_translate_vertex_shader(struct r300_context* r300,
struct r300_vertex_shader* vs);
diff --git a/src/gallium/drivers/r300/r300_winsys.h b/src/gallium/drivers/r300/r300_winsys.h
index 40fb8a95ca..d8d0c609d2 100644
--- a/src/gallium/drivers/r300/r300_winsys.h
+++ b/src/gallium/drivers/r300/r300_winsys.h
@@ -23,10 +23,6 @@
#ifndef R300_WINSYS_H
#define R300_WINSYS_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/* The public interface header for the r300 pipe driver.
* Any winsys hosting this pipe needs to implement r300_winsys and then
* call r300_create_screen to start things. */
@@ -34,19 +30,152 @@ extern "C" {
#include "pipe/p_defines.h"
#include "pipe/p_state.h"
-struct radeon_winsys;
+#include "r300_defines.h"
+
+struct r300_winsys_screen;
/* Creates a new r300 screen. */
-struct pipe_screen* r300_create_screen(struct radeon_winsys* radeon_winsys);
+struct pipe_screen* r300_create_screen(struct r300_winsys_screen *rws);
+
+struct r300_winsys_buffer;
boolean r300_get_texture_buffer(struct pipe_screen* screen,
struct pipe_texture* texture,
- struct pipe_buffer** buffer,
- unsigned* stride);
+ struct r300_winsys_buffer** buffer,
+ unsigned *stride);
+
+enum r300_value_id {
+ R300_VID_PCI_ID,
+ R300_VID_GB_PIPES,
+ R300_VID_Z_PIPES,
+ R300_VID_SQUARE_TILING_SUPPORT
+};
+
+struct r300_winsys_screen {
+ void (*destroy)(struct r300_winsys_screen *ws);
+
+ /**
+ * Buffer management. Buffer attributes are mostly fixed over its lifetime.
+ *
+ * Remember that gallium gets to choose the interface it needs, and the
+ * window systems must then implement that interface (rather than the
+ * other way around...).
+ *
+ * usage is a bitmask of R300_WINSYS_BUFFER_USAGE_PIXEL/VERTEX/INDEX/CONSTANT. This
+ * usage argument is only an optimization hint, not a guarantee, therefore
+ * proper behavior must be observed in all circumstances.
+ *
+ * alignment indicates the client's alignment requirements, eg for
+ * SSE instructions.
+ */
+ struct r300_winsys_buffer *(*buffer_create)(struct r300_winsys_screen *ws,
+ unsigned alignment,
+ unsigned usage,
+ unsigned size);
+
+ /**
+ * Map the entire data store of a buffer object into the client's address.
+ * flags is bitmask of R300_WINSYS_BUFFER_USAGE_CPU_READ/WRITE flags.
+ */
+ void *(*buffer_map)( struct r300_winsys_screen *ws,
+ struct r300_winsys_buffer *buf,
+ unsigned usage);
+
+ void (*buffer_unmap)( struct r300_winsys_screen *ws,
+ struct r300_winsys_buffer *buf );
+
+ void (*buffer_destroy)( struct r300_winsys_buffer *buf );
+
+
+ void (*buffer_reference)(struct r300_winsys_screen *rws,
+ struct r300_winsys_buffer **pdst,
+ struct r300_winsys_buffer *src);
+
+ boolean (*buffer_references)(struct r300_winsys_buffer *a,
+ struct r300_winsys_buffer *b);
+
+ void (*buffer_flush_range)(struct r300_winsys_screen *rws,
+ struct r300_winsys_buffer *buf,
+ unsigned offset,
+ unsigned length);
+
+ /* Add a pipe_buffer to the list of buffer objects to validate. */
+ boolean (*add_buffer)(struct r300_winsys_screen *winsys,
+ struct r300_winsys_buffer *buf,
+ uint32_t rd,
+ uint32_t wd);
+
+
+ /* Revalidate all currently setup pipe_buffers.
+ * Returns TRUE if a flush is required. */
+ boolean (*validate)(struct r300_winsys_screen* winsys);
+
+ /* Check to see if there's room for commands. */
+ boolean (*check_cs)(struct r300_winsys_screen* winsys, int size);
+
+ /* Start a command emit. */
+ void (*begin_cs)(struct r300_winsys_screen* winsys,
+ int size,
+ const char* file,
+ const char* function,
+ int line);
+
+ /* Write a dword to the command buffer. */
+ void (*write_cs_dword)(struct r300_winsys_screen* winsys, uint32_t dword);
+
+ /* Write a relocated dword to the command buffer. */
+ void (*write_cs_reloc)(struct r300_winsys_screen *winsys,
+ struct r300_winsys_buffer *buf,
+ uint32_t rd,
+ uint32_t wd,
+ uint32_t flags);
+
+ /* Finish a command emit. */
+ void (*end_cs)(struct r300_winsys_screen* winsys,
+ const char* file,
+ const char* function,
+ int line);
+
+ /* Flush the CS. */
+ void (*flush_cs)(struct r300_winsys_screen* winsys);
+
+ /* winsys flush - callback from winsys when flush required */
+ void (*set_flush_cb)(struct r300_winsys_screen *winsys,
+ void (*flush_cb)(void *), void *data);
+
+ void (*reset_bos)(struct r300_winsys_screen *winsys);
+
+ void (*buffer_get_tiling)(struct r300_winsys_screen *winsys,
+ struct r300_winsys_buffer *buffer,
+ enum r300_buffer_tiling *microtiled,
+ enum r300_buffer_tiling *macrotiled);
+
+ void (*buffer_set_tiling)(struct r300_winsys_screen *winsys,
+ struct r300_winsys_buffer *buffer,
+ uint32_t pitch,
+ enum r300_buffer_tiling microtiled,
+ enum r300_buffer_tiling macrotiled);
+
+ uint32_t (*get_value)(struct r300_winsys_screen *winsys,
+ enum r300_value_id vid);
+
+ struct r300_winsys_buffer *(*buffer_from_handle)(struct r300_winsys_screen *winsys,
+ struct pipe_screen *screen,
+ struct winsys_handle *whandle,
+ unsigned *stride);
+ boolean (*buffer_get_handle)(struct r300_winsys_screen *winsys,
+ struct r300_winsys_buffer *buffer,
+ unsigned stride,
+ struct winsys_handle *whandle);
+
+ boolean (*is_buffer_referenced)(struct r300_winsys_screen *winsys,
+ struct r300_winsys_buffer *buffer);
+
+
+};
-#ifdef __cplusplus
-}
-#endif
+struct r300_winsys_screen *
+r300_winsys_screen(struct pipe_screen *screen);
#endif /* R300_WINSYS_H */
diff --git a/src/gallium/drivers/softpipe/Makefile b/src/gallium/drivers/softpipe/Makefile
index e4ac49fa85..239655d628 100644
--- a/src/gallium/drivers/softpipe/Makefile
+++ b/src/gallium/drivers/softpipe/Makefile
@@ -6,7 +6,9 @@ LIBNAME = softpipe
C_SOURCES = \
sp_fs_exec.c \
sp_fs_sse.c \
+ sp_buffer.c \
sp_clear.c \
+ sp_fence.c \
sp_flush.c \
sp_query.c \
sp_context.c \
@@ -32,7 +34,6 @@ C_SOURCES = \
sp_tex_tile_cache.c \
sp_tile_cache.c \
sp_surface.c \
- sp_video_context.c \
- sp_winsys.c
+ sp_video_context.c
include ../../Makefile.template
diff --git a/src/gallium/drivers/softpipe/SConscript b/src/gallium/drivers/softpipe/SConscript
index 3042e556c6..9949a53adf 100644
--- a/src/gallium/drivers/softpipe/SConscript
+++ b/src/gallium/drivers/softpipe/SConscript
@@ -7,9 +7,11 @@ softpipe = env.ConvenienceLibrary(
source = [
'sp_fs_exec.c',
'sp_fs_sse.c',
+ 'sp_buffer.c',
'sp_clear.c',
'sp_context.c',
'sp_draw_arrays.c',
+ 'sp_fence.c',
'sp_flush.c',
'sp_prim_vbuf.c',
'sp_setup.c',
@@ -33,8 +35,7 @@ softpipe = env.ConvenienceLibrary(
'sp_tex_tile_cache.c',
'sp_texture.c',
'sp_tile_cache.c',
- 'sp_video_context.c',
- 'sp_winsys.c'
+ 'sp_video_context.c'
])
Export('softpipe')
diff --git a/src/gallium/drivers/softpipe/sp_buffer.c b/src/gallium/drivers/softpipe/sp_buffer.c
new file mode 100644
index 0000000000..8f39025086
--- /dev/null
+++ b/src/gallium/drivers/softpipe/sp_buffer.c
@@ -0,0 +1,118 @@
+/**************************************************************************
+ *
+ * Copyright 2009 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+
+#include "util/u_inlines.h"
+#include "util/u_memory.h"
+#include "util/u_math.h"
+
+#include "sp_screen.h"
+#include "sp_buffer.h"
+
+
+static void *
+softpipe_buffer_map(struct pipe_screen *screen,
+ struct pipe_buffer *buf,
+ unsigned flags)
+{
+ struct softpipe_buffer *softpipe_buf = softpipe_buffer(buf);
+ return softpipe_buf->data;
+}
+
+
+static void
+softpipe_buffer_unmap(struct pipe_screen *screen,
+ struct pipe_buffer *buf)
+{
+}
+
+
+static void
+softpipe_buffer_destroy(struct pipe_buffer *buf)
+{
+ struct softpipe_buffer *sbuf = softpipe_buffer(buf);
+
+ if (!sbuf->userBuffer)
+ align_free(sbuf->data);
+
+ FREE(sbuf);
+}
+
+
+static struct pipe_buffer *
+softpipe_buffer_create(struct pipe_screen *screen,
+ unsigned alignment,
+ unsigned usage,
+ unsigned size)
+{
+ struct softpipe_buffer *buffer = CALLOC_STRUCT(softpipe_buffer);
+
+ pipe_reference_init(&buffer->base.reference, 1);
+ buffer->base.screen = screen;
+ buffer->base.alignment = MAX2(alignment, 16);
+ buffer->base.usage = usage;
+ buffer->base.size = size;
+
+ buffer->data = align_malloc(size, alignment);
+
+ return &buffer->base;
+}
+
+
+/**
+ * Create buffer which wraps user-space data.
+ */
+static struct pipe_buffer *
+softpipe_user_buffer_create(struct pipe_screen *screen,
+ void *ptr,
+ unsigned bytes)
+{
+ struct softpipe_buffer *buffer;
+
+ buffer = CALLOC_STRUCT(softpipe_buffer);
+ if(!buffer)
+ return NULL;
+
+ pipe_reference_init(&buffer->base.reference, 1);
+ buffer->base.screen = screen;
+ buffer->base.size = bytes;
+ buffer->userBuffer = TRUE;
+ buffer->data = ptr;
+
+ return &buffer->base;
+}
+
+
+void
+softpipe_init_screen_buffer_funcs(struct pipe_screen *screen)
+{
+ screen->buffer_create = softpipe_buffer_create;
+ screen->user_buffer_create = softpipe_user_buffer_create;
+ screen->buffer_map = softpipe_buffer_map;
+ screen->buffer_unmap = softpipe_buffer_unmap;
+ screen->buffer_destroy = softpipe_buffer_destroy;
+}
diff --git a/src/gallium/drivers/softpipe/sp_buffer.h b/src/gallium/drivers/softpipe/sp_buffer.h
new file mode 100644
index 0000000000..9d8e56a176
--- /dev/null
+++ b/src/gallium/drivers/softpipe/sp_buffer.h
@@ -0,0 +1,55 @@
+/**************************************************************************
+ *
+ * Copyright 2009 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef SP_BUFFER_H
+#define SP_BUFFER_H
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_state.h"
+
+
+struct softpipe_buffer
+{
+ struct pipe_buffer base;
+ boolean userBuffer; /** Is this a user-space buffer? */
+ void *data;
+};
+
+
+/** Cast wrapper */
+static INLINE struct softpipe_buffer *
+softpipe_buffer( struct pipe_buffer *buf )
+{
+ return (struct softpipe_buffer *)buf;
+}
+
+
+void
+softpipe_init_screen_buffer_funcs(struct pipe_screen *screen);
+
+
+#endif /* SP_BUFFER_H */
diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c
index ddc35bcd62..937a573092 100644
--- a/src/gallium/drivers/softpipe/sp_context.c
+++ b/src/gallium/drivers/softpipe/sp_context.c
@@ -44,6 +44,7 @@
#include "sp_surface.h"
#include "sp_tile_cache.h"
#include "sp_tex_tile_cache.h"
+#include "sp_texture.h"
#include "sp_query.h"
@@ -103,12 +104,12 @@ softpipe_destroy( struct pipe_context *pipe )
for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
sp_destroy_tex_tile_cache(softpipe->tex_cache[i]);
- pipe_texture_reference(&softpipe->texture[i], NULL);
+ pipe_sampler_view_reference(&softpipe->sampler_views[i], NULL);
}
for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) {
sp_destroy_tex_tile_cache(softpipe->vertex_tex_cache[i]);
- pipe_texture_reference(&softpipe->vertex_textures[i], NULL);
+ pipe_sampler_view_reference(&softpipe->vertex_sampler_views[i], NULL);
}
for (i = 0; i < PIPE_SHADER_TYPES; i++) {
@@ -210,7 +211,7 @@ softpipe_create_context( struct pipe_screen *screen,
softpipe->dump_fs = debug_get_bool_option( "GALLIUM_DUMP_FS", FALSE );
softpipe->dump_gs = debug_get_bool_option( "SOFTPIPE_DUMP_GS", FALSE );
- softpipe->pipe.winsys = screen->winsys;
+ softpipe->pipe.winsys = NULL;
softpipe->pipe.screen = screen;
softpipe->pipe.destroy = softpipe_destroy;
softpipe->pipe.priv = priv;
@@ -245,6 +246,10 @@ softpipe_create_context( struct pipe_screen *screen,
softpipe->pipe.bind_gs_state = softpipe_bind_gs_state;
softpipe->pipe.delete_gs_state = softpipe_delete_gs_state;
+ softpipe->pipe.create_vertex_elements_state = softpipe_create_vertex_elements_state;
+ softpipe->pipe.bind_vertex_elements_state = softpipe_bind_vertex_elements_state;
+ softpipe->pipe.delete_vertex_elements_state = softpipe_delete_vertex_elements_state;
+
softpipe->pipe.set_blend_color = softpipe_set_blend_color;
softpipe->pipe.set_stencil_ref = softpipe_set_stencil_ref;
softpipe->pipe.set_clip_state = softpipe_set_clip_state;
@@ -252,12 +257,13 @@ softpipe_create_context( struct pipe_screen *screen,
softpipe->pipe.set_framebuffer_state = softpipe_set_framebuffer_state;
softpipe->pipe.set_polygon_stipple = softpipe_set_polygon_stipple;
softpipe->pipe.set_scissor_state = softpipe_set_scissor_state;
- softpipe->pipe.set_fragment_sampler_textures = softpipe_set_sampler_textures;
- softpipe->pipe.set_vertex_sampler_textures = softpipe_set_vertex_sampler_textures;
+ softpipe->pipe.set_fragment_sampler_views = softpipe_set_sampler_views;
+ softpipe->pipe.set_vertex_sampler_views = softpipe_set_vertex_sampler_views;
+ softpipe->pipe.create_sampler_view = softpipe_create_sampler_view;
+ softpipe->pipe.sampler_view_destroy = softpipe_sampler_view_destroy;
softpipe->pipe.set_viewport_state = softpipe_set_viewport_state;
softpipe->pipe.set_vertex_buffers = softpipe_set_vertex_buffers;
- softpipe->pipe.set_vertex_elements = softpipe_set_vertex_elements;
softpipe->pipe.draw_arrays = softpipe_draw_arrays;
softpipe->pipe.draw_elements = softpipe_draw_elements;
@@ -272,6 +278,7 @@ softpipe_create_context( struct pipe_screen *screen,
softpipe->pipe.is_buffer_referenced = softpipe_is_buffer_referenced;
softpipe_init_query_funcs( softpipe );
+ softpipe_init_texture_funcs( &softpipe->pipe );
softpipe->pipe.render_condition = softpipe_render_condition;
@@ -280,13 +287,13 @@ softpipe_create_context( struct pipe_screen *screen,
* Must be before quad stage setup!
*/
for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++)
- softpipe->cbuf_cache[i] = sp_create_tile_cache( screen );
- softpipe->zsbuf_cache = sp_create_tile_cache( screen );
+ softpipe->cbuf_cache[i] = sp_create_tile_cache( &softpipe->pipe );
+ softpipe->zsbuf_cache = sp_create_tile_cache( &softpipe->pipe );
for (i = 0; i < PIPE_MAX_SAMPLERS; i++)
- softpipe->tex_cache[i] = sp_create_tex_tile_cache( screen );
+ softpipe->tex_cache[i] = sp_create_tex_tile_cache( &softpipe->pipe );
for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) {
- softpipe->vertex_tex_cache[i] = sp_create_tex_tile_cache(screen);
+ softpipe->vertex_tex_cache[i] = sp_create_tex_tile_cache( &softpipe->pipe );
}
/* setup quad rendering stages */
diff --git a/src/gallium/drivers/softpipe/sp_context.h b/src/gallium/drivers/softpipe/sp_context.h
index 95def72c54..75e03c8ae6 100644
--- a/src/gallium/drivers/softpipe/sp_context.h
+++ b/src/gallium/drivers/softpipe/sp_context.h
@@ -45,6 +45,7 @@ struct softpipe_tile_cache;
struct softpipe_tex_tile_cache;
struct sp_fragment_shader;
struct sp_vertex_shader;
+struct sp_velems_state;
struct softpipe_context {
@@ -59,6 +60,7 @@ struct softpipe_context {
struct sp_fragment_shader *fs;
struct sp_vertex_shader *vs;
struct sp_geometry_shader *gs;
+ struct sp_velems_state *velems;
/** Other rendering state */
struct pipe_blend_color blend_color;
@@ -68,17 +70,15 @@ struct softpipe_context {
struct pipe_framebuffer_state framebuffer;
struct pipe_poly_stipple poly_stipple;
struct pipe_scissor_state scissor;
- struct pipe_texture *texture[PIPE_MAX_SAMPLERS];
- struct pipe_texture *vertex_textures[PIPE_MAX_VERTEX_SAMPLERS];
+ struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS];
+ struct pipe_sampler_view *vertex_sampler_views[PIPE_MAX_VERTEX_SAMPLERS];
struct pipe_viewport_state viewport;
struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
- struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS];
unsigned num_samplers;
- unsigned num_textures;
+ unsigned num_sampler_views;
unsigned num_vertex_samplers;
- unsigned num_vertex_textures;
- unsigned num_vertex_elements;
+ unsigned num_vertex_sampler_views;
unsigned num_vertex_buffers;
unsigned dirty; /**< Mask of SP_NEW_x flags */
@@ -93,7 +93,7 @@ struct softpipe_context {
ubyte *mapped_vbuffer[PIPE_MAX_ATTRIBS];
/** Mapped constant buffers */
- void *mapped_constants[PIPE_SHADER_TYPES][PIPE_MAX_CONSTANT_BUFFERS];
+ const void *mapped_constants[PIPE_SHADER_TYPES][PIPE_MAX_CONSTANT_BUFFERS];
/** Vertex format */
struct vertex_info vertex_info;
diff --git a/src/gallium/drivers/softpipe/sp_draw_arrays.c b/src/gallium/drivers/softpipe/sp_draw_arrays.c
index b2acc36bf7..7b77eb239f 100644
--- a/src/gallium/drivers/softpipe/sp_draw_arrays.c
+++ b/src/gallium/drivers/softpipe/sp_draw_arrays.c
@@ -33,90 +33,19 @@
#include "pipe/p_defines.h"
#include "pipe/p_context.h"
-#include "util/u_simple_screen.h"
#include "util/u_inlines.h"
#include "util/u_prim.h"
#include "sp_context.h"
#include "sp_query.h"
#include "sp_state.h"
+#include "sp_buffer.h"
#include "draw/draw_context.h"
-static void
-softpipe_map_constant_buffers(struct softpipe_context *sp)
-{
- struct pipe_winsys *ws = sp->pipe.winsys;
- uint i;
-
- for (i = 0; i < PIPE_SHADER_TYPES; i++) {
- uint j;
-
- for (j = 0; j < PIPE_MAX_CONSTANT_BUFFERS; j++) {
- if (sp->constants[i][j] && sp->constants[i][j]->size) {
- sp->mapped_constants[i][j] = ws->buffer_map(ws,
- sp->constants[i][j],
- PIPE_BUFFER_USAGE_CPU_READ);
- }
- }
- }
-
- for (i = 0; i < PIPE_MAX_CONSTANT_BUFFERS; i++) {
- if (sp->constants[PIPE_SHADER_VERTEX][i]) {
- draw_set_mapped_constant_buffer(sp->draw,
- PIPE_SHADER_VERTEX,
- i,
- sp->mapped_constants[PIPE_SHADER_VERTEX][i],
- sp->constants[PIPE_SHADER_VERTEX][i]->size);
- }
- if (sp->constants[PIPE_SHADER_GEOMETRY][i]) {
- draw_set_mapped_constant_buffer(sp->draw,
- PIPE_SHADER_GEOMETRY,
- i,
- sp->mapped_constants[PIPE_SHADER_GEOMETRY][i],
- sp->constants[PIPE_SHADER_GEOMETRY][i]->size);
- }
- }
-}
-
-
-static void
-softpipe_unmap_constant_buffers(struct softpipe_context *sp)
-{
- struct pipe_winsys *ws = sp->pipe.winsys;
- uint i;
- /* really need to flush all prims since the vert/frag shaders const buffers
- * are going away now.
- */
- draw_flush(sp->draw);
-
- for (i = 0; i < PIPE_MAX_CONSTANT_BUFFERS; i++) {
- draw_set_mapped_constant_buffer(sp->draw,
- PIPE_SHADER_VERTEX,
- i,
- NULL,
- 0);
- draw_set_mapped_constant_buffer(sp->draw,
- PIPE_SHADER_GEOMETRY,
- i,
- NULL,
- 0);
- }
-
- for (i = 0; i < PIPE_SHADER_TYPES; i++) {
- uint j;
-
- for (j = 0; j < PIPE_MAX_CONSTANT_BUFFERS; j++) {
- if (sp->constants[i][j] && sp->constants[i][j]->size) {
- ws->buffer_unmap(ws, sp->constants[i][j]);
- }
- sp->mapped_constants[i][j] = NULL;
- }
- }
-}
/**
@@ -261,25 +190,16 @@ softpipe_draw_range_elements_instanced(struct pipe_context *pipe,
}
softpipe_map_transfers(sp);
- softpipe_map_constant_buffers(sp);
/* Map vertex buffers */
for (i = 0; i < sp->num_vertex_buffers; i++) {
- void *buf;
-
- buf = pipe_buffer_map(pipe->screen,
- sp->vertex_buffer[i].buffer,
- PIPE_BUFFER_USAGE_CPU_READ);
+ void *buf = softpipe_buffer(sp->vertex_buffer[i].buffer)->data;
draw_set_mapped_vertex_buffer(draw, i, buf);
}
/* Map index buffer, if present */
if (indexBuffer) {
- void *mapped_indexes;
-
- mapped_indexes = pipe_buffer_map(pipe->screen,
- indexBuffer,
- PIPE_BUFFER_USAGE_CPU_READ);
+ void *mapped_indexes = softpipe_buffer(indexBuffer)->data;
draw_set_mapped_element_buffer_range(draw,
indexSize,
minIndex,
@@ -300,15 +220,18 @@ softpipe_draw_range_elements_instanced(struct pipe_context *pipe,
/* unmap vertex/index buffers - will cause draw module to flush */
for (i = 0; i < sp->num_vertex_buffers; i++) {
draw_set_mapped_vertex_buffer(draw, i, NULL);
- pipe_buffer_unmap(pipe->screen, sp->vertex_buffer[i].buffer);
}
if (indexBuffer) {
draw_set_mapped_element_buffer(draw, 0, NULL);
- pipe_buffer_unmap(pipe->screen, indexBuffer);
}
- /* Note: leave drawing surfaces mapped */
- softpipe_unmap_constant_buffers(sp);
+ /*
+ * TODO: Flush only when a user vertex/index buffer is present
+ * (or even better, modify draw module to do this
+ * internally when this condition is seen?)
+ */
+ draw_flush(draw);
+ /* Note: leave drawing surfaces mapped */
sp->dirty_render_cache = TRUE;
}
diff --git a/src/gallium/drivers/softpipe/sp_fence.c b/src/gallium/drivers/softpipe/sp_fence.c
new file mode 100644
index 0000000000..66c5214113
--- /dev/null
+++ b/src/gallium/drivers/softpipe/sp_fence.c
@@ -0,0 +1,70 @@
+/**************************************************************************
+ *
+ * Copyright 2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ **************************************************************************/
+
+
+#include "pipe/p_screen.h"
+#include "util/u_debug.h"
+#include "sp_fence.h"
+
+
+static void
+softpipe_fence_reference(struct pipe_screen *screen,
+ struct pipe_fence_handle **ptr,
+ struct pipe_fence_handle *fence)
+{
+ assert(!*ptr);
+ assert(!fence);
+}
+
+
+static int
+softpipe_fence_signalled(struct pipe_screen *screen,
+ struct pipe_fence_handle *fence,
+ unsigned flags)
+{
+ assert(!fence);
+ return 0;
+}
+
+
+static int
+softpipe_fence_finish(struct pipe_screen *screen,
+ struct pipe_fence_handle *fence,
+ unsigned flags)
+{
+ assert(!fence);
+ return 0;
+}
+
+
+void
+softpipe_init_screen_fence_funcs(struct pipe_screen *screen)
+{
+ screen->fence_reference = softpipe_fence_reference;
+ screen->fence_finish = softpipe_fence_finish;
+ screen->fence_signalled = softpipe_fence_signalled;
+}
diff --git a/src/gallium/drivers/softpipe/sp_fence.h b/src/gallium/drivers/softpipe/sp_fence.h
new file mode 100644
index 0000000000..39c33243bd
--- /dev/null
+++ b/src/gallium/drivers/softpipe/sp_fence.h
@@ -0,0 +1,40 @@
+/**************************************************************************
+ *
+ * Copyright 2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ **************************************************************************/
+
+
+#ifndef SP_FENCE_H_
+#define SP_FENCE_H_
+
+
+struct pipe_screen;
+
+
+void
+softpipe_init_screen_fence_funcs(struct pipe_screen *screen);
+
+
+#endif /* SP_FENCE_H_ */
diff --git a/src/gallium/drivers/softpipe/sp_flush.c b/src/gallium/drivers/softpipe/sp_flush.c
index e8952bf4fb..508fe8f764 100644
--- a/src/gallium/drivers/softpipe/sp_flush.c
+++ b/src/gallium/drivers/softpipe/sp_flush.c
@@ -50,10 +50,10 @@ softpipe_flush( struct pipe_context *pipe,
draw_flush(softpipe->draw);
if (flags & PIPE_FLUSH_TEXTURE_CACHE) {
- for (i = 0; i < softpipe->num_textures; i++) {
+ for (i = 0; i < softpipe->num_sampler_views; i++) {
sp_flush_tex_tile_cache(softpipe->tex_cache[i]);
}
- for (i = 0; i < softpipe->num_vertex_textures; i++) {
+ for (i = 0; i < softpipe->num_vertex_sampler_views; i++) {
sp_flush_tex_tile_cache(softpipe->vertex_tex_cache[i]);
}
}
@@ -93,9 +93,9 @@ softpipe_flush( struct pipe_context *pipe,
static unsigned frame_no = 1;
static char filename[256];
util_snprintf(filename, sizeof(filename), "cbuf_%u.bmp", frame_no);
- debug_dump_surface_bmp(filename, softpipe->framebuffer.cbufs[0]);
+ debug_dump_surface_bmp(softpipe, filename, softpipe->framebuffer.cbufs[0]);
util_snprintf(filename, sizeof(filename), "zsbuf_%u.bmp", frame_no);
- debug_dump_surface_bmp(filename, softpipe->framebuffer.zsbuf);
+ debug_dump_surface_bmp(softpipe, filename, softpipe->framebuffer.zsbuf);
++frame_no;
}
#endif
diff --git a/src/gallium/drivers/softpipe/sp_fs_exec.c b/src/gallium/drivers/softpipe/sp_fs_exec.c
index 27fa126b7c..67e2c8f8bc 100644
--- a/src/gallium/drivers/softpipe/sp_fs_exec.c
+++ b/src/gallium/drivers/softpipe/sp_fs_exec.c
@@ -145,8 +145,13 @@ exec_run( const struct sp_fragment_shader *base,
case TGSI_SEMANTIC_COLOR:
{
uint cbuf = sem_index[i];
+
+ assert(sizeof(quad->output.color[cbuf]) ==
+ sizeof(machine->Outputs[i]));
+
+ /* copy float[4][4] result */
memcpy(quad->output.color[cbuf],
- &machine->Outputs[i].xyzw[0].f[0],
+ &machine->Outputs[i],
sizeof(quad->output.color[0]) );
}
break;
diff --git a/src/gallium/drivers/softpipe/sp_fs_sse.c b/src/gallium/drivers/softpipe/sp_fs_sse.c
index acee213670..daa158df7c 100644
--- a/src/gallium/drivers/softpipe/sp_fs_sse.c
+++ b/src/gallium/drivers/softpipe/sp_fs_sse.c
@@ -156,8 +156,13 @@ fs_sse_run( const struct sp_fragment_shader *base,
case TGSI_SEMANTIC_COLOR:
{
uint cbuf = sem_index[i];
+
+ assert(sizeof(quad->output.color[cbuf]) ==
+ sizeof(machine->Outputs[i]));
+
+ /* copy float[4][4] result */
memcpy(quad->output.color[cbuf],
- &machine->Outputs[i].xyzw[0].f[0],
+ &machine->Outputs[i],
sizeof(quad->output.color[0]) );
}
break;
diff --git a/src/gallium/drivers/softpipe/sp_prim_vbuf.c b/src/gallium/drivers/softpipe/sp_prim_vbuf.c
index 98c08eaffa..6749243ab4 100644
--- a/src/gallium/drivers/softpipe/sp_prim_vbuf.c
+++ b/src/gallium/drivers/softpipe/sp_prim_vbuf.c
@@ -264,57 +264,29 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr)
break;
case PIPE_PRIM_QUADS:
- if (softpipe->rasterizer->flatshade_first) {
- for (i = 3; i < nr; i += 4) {
- sp_setup_tri( setup_ctx,
- get_vert(vertex_buffer, indices[i-2], stride),
- get_vert(vertex_buffer, indices[i-1], stride),
- get_vert(vertex_buffer, indices[i-3], stride) );
- sp_setup_tri( setup_ctx,
- get_vert(vertex_buffer, indices[i-1], stride),
- get_vert(vertex_buffer, indices[i-0], stride),
- get_vert(vertex_buffer, indices[i-3], stride) );
- }
- }
- else {
- for (i = 3; i < nr; i += 4) {
- sp_setup_tri( setup_ctx,
+ for (i = 3; i < nr; i += 4) {
+ sp_setup_tri( setup_ctx,
get_vert(vertex_buffer, indices[i-3], stride),
get_vert(vertex_buffer, indices[i-2], stride),
get_vert(vertex_buffer, indices[i-0], stride) );
- sp_setup_tri( setup_ctx,
+ sp_setup_tri( setup_ctx,
get_vert(vertex_buffer, indices[i-2], stride),
get_vert(vertex_buffer, indices[i-1], stride),
get_vert(vertex_buffer, indices[i-0], stride) );
- }
}
break;
case PIPE_PRIM_QUAD_STRIP:
- if (softpipe->rasterizer->flatshade_first) {
- for (i = 3; i < nr; i += 2) {
- sp_setup_tri( setup_ctx,
- get_vert(vertex_buffer, indices[i-0], stride),
- get_vert(vertex_buffer, indices[i-1], stride),
- get_vert(vertex_buffer, indices[i-3], stride));
- sp_setup_tri( setup_ctx,
- get_vert(vertex_buffer, indices[i-2], stride),
- get_vert(vertex_buffer, indices[i-0], stride),
- get_vert(vertex_buffer, indices[i-3], stride) );
- }
- }
- else {
- for (i = 3; i < nr; i += 2) {
- sp_setup_tri( setup_ctx,
+ for (i = 3; i < nr; i += 2) {
+ sp_setup_tri( setup_ctx,
get_vert(vertex_buffer, indices[i-3], stride),
get_vert(vertex_buffer, indices[i-2], stride),
get_vert(vertex_buffer, indices[i-0], stride) );
- sp_setup_tri( setup_ctx,
+ sp_setup_tri( setup_ctx,
get_vert(vertex_buffer, indices[i-1], stride),
get_vert(vertex_buffer, indices[i-3], stride),
get_vert(vertex_buffer, indices[i-0], stride) );
- }
}
break;
@@ -448,56 +420,28 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr)
break;
case PIPE_PRIM_QUADS:
- if (softpipe->rasterizer->flatshade_first) {
- for (i = 3; i < nr; i += 4) {
- sp_setup_tri( setup_ctx,
- get_vert(vertex_buffer, i-2, stride),
- get_vert(vertex_buffer, i-1, stride),
- get_vert(vertex_buffer, i-3, stride) );
- sp_setup_tri( setup_ctx,
- get_vert(vertex_buffer, i-1, stride),
- get_vert(vertex_buffer, i-0, stride),
- get_vert(vertex_buffer, i-3, stride) );
- }
- }
- else {
- for (i = 3; i < nr; i += 4) {
- sp_setup_tri( setup_ctx,
+ for (i = 3; i < nr; i += 4) {
+ sp_setup_tri( setup_ctx,
get_vert(vertex_buffer, i-3, stride),
get_vert(vertex_buffer, i-2, stride),
get_vert(vertex_buffer, i-0, stride) );
- sp_setup_tri( setup_ctx,
+ sp_setup_tri( setup_ctx,
get_vert(vertex_buffer, i-2, stride),
get_vert(vertex_buffer, i-1, stride),
get_vert(vertex_buffer, i-0, stride) );
- }
}
break;
case PIPE_PRIM_QUAD_STRIP:
- if (softpipe->rasterizer->flatshade_first) {
- for (i = 3; i < nr; i += 2) {
- sp_setup_tri( setup_ctx,
- get_vert(vertex_buffer, i-0, stride),
- get_vert(vertex_buffer, i-1, stride),
- get_vert(vertex_buffer, i-3, stride) );
- sp_setup_tri( setup_ctx,
- get_vert(vertex_buffer, i-2, stride),
- get_vert(vertex_buffer, i-0, stride),
- get_vert(vertex_buffer, i-3, stride) );
- }
- }
- else {
- for (i = 3; i < nr; i += 2) {
- sp_setup_tri( setup_ctx,
+ for (i = 3; i < nr; i += 2) {
+ sp_setup_tri( setup_ctx,
get_vert(vertex_buffer, i-3, stride),
get_vert(vertex_buffer, i-2, stride),
get_vert(vertex_buffer, i-0, stride) );
- sp_setup_tri( setup_ctx,
+ sp_setup_tri( setup_ctx,
get_vert(vertex_buffer, i-1, stride),
get_vert(vertex_buffer, i-3, stride),
get_vert(vertex_buffer, i-0, stride) );
- }
}
break;
diff --git a/src/gallium/drivers/softpipe/sp_public.h b/src/gallium/drivers/softpipe/sp_public.h
new file mode 100644
index 0000000000..62d0903d87
--- /dev/null
+++ b/src/gallium/drivers/softpipe/sp_public.h
@@ -0,0 +1,10 @@
+#ifndef SP_PUBLIC_H
+#define SP_PUBLIC_H
+
+struct pipe_screen;
+struct sw_winsys;
+
+struct pipe_screen *
+softpipe_create_screen(struct sw_winsys *winsys);
+
+#endif
diff --git a/src/gallium/drivers/softpipe/sp_quad_depth_test.c b/src/gallium/drivers/softpipe/sp_quad_depth_test.c
index 17cd5b8207..4ee31969e6 100644
--- a/src/gallium/drivers/softpipe/sp_quad_depth_test.c
+++ b/src/gallium/drivers/softpipe/sp_quad_depth_test.c
@@ -75,7 +75,7 @@ get_depth_stencil_values( struct depth_data *data,
}
break;
case PIPE_FORMAT_Z24X8_UNORM:
- case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
for (j = 0; j < QUAD_SIZE; j++) {
int x = quad->input.x0 % TILE_SIZE + (j & 1);
int y = quad->input.y0 % TILE_SIZE + (j >> 1);
@@ -84,7 +84,7 @@ get_depth_stencil_values( struct depth_data *data,
}
break;
case PIPE_FORMAT_X8Z24_UNORM:
- case PIPE_FORMAT_S8Z24_UNORM:
+ case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
for (j = 0; j < QUAD_SIZE; j++) {
int x = quad->input.x0 % TILE_SIZE + (j & 1);
int y = quad->input.y0 % TILE_SIZE + (j >> 1);
@@ -153,7 +153,7 @@ convert_quad_depth( struct depth_data *data,
}
break;
case PIPE_FORMAT_Z24X8_UNORM:
- case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
{
float scale = (float) ((1 << 24) - 1);
@@ -163,7 +163,7 @@ convert_quad_depth( struct depth_data *data,
}
break;
case PIPE_FORMAT_X8Z24_UNORM:
- case PIPE_FORMAT_S8Z24_UNORM:
+ case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
{
float scale = (float) ((1 << 24) - 1);
@@ -206,14 +206,14 @@ write_depth_stencil_values( struct depth_data *data,
tile->data.depth32[y][x] = data->bzzzz[j];
}
break;
- case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
for (j = 0; j < QUAD_SIZE; j++) {
int x = quad->input.x0 % TILE_SIZE + (j & 1);
int y = quad->input.y0 % TILE_SIZE + (j >> 1);
tile->data.depth32[y][x] = (data->stencilVals[j] << 24) | data->bzzzz[j];
}
break;
- case PIPE_FORMAT_S8Z24_UNORM:
+ case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
for (j = 0; j < QUAD_SIZE; j++) {
int x = quad->input.x0 % TILE_SIZE + (j & 1);
int y = quad->input.y0 % TILE_SIZE + (j >> 1);
diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
index 6ec63fe698..be64048abf 100644
--- a/src/gallium/drivers/softpipe/sp_screen.c
+++ b/src/gallium/drivers/softpipe/sp_screen.c
@@ -27,15 +27,18 @@
#include "util/u_memory.h"
-#include "util/u_simple_screen.h"
-#include "util/u_simple_screen.h"
+#include "util/u_format_s3tc.h"
#include "pipe/p_defines.h"
#include "pipe/p_screen.h"
+#include "state_tracker/sw_winsys.h"
+
#include "sp_texture.h"
-#include "sp_winsys.h"
#include "sp_screen.h"
#include "sp_context.h"
+#include "sp_buffer.h"
+#include "sp_fence.h"
+#include "sp_public.h"
static const char *
@@ -83,11 +86,11 @@ softpipe_get_param(struct pipe_screen *screen, int param)
case PIPE_CAP_TEXTURE_SHADOW_MAP:
return 1;
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
- return 13; /* max 4Kx4K */
+ return SP_MAX_TEXTURE_2D_LEVELS;
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
- return 9; /* max 256x256x256 */
+ return SP_MAX_TEXTURE_3D_LEVELS;
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
- return 13; /* max 4Kx4K */
+ return SP_MAX_TEXTURE_2D_LEVELS;
case PIPE_CAP_TGSI_CONT_SUPPORTED:
return 1;
case PIPE_CAP_BLEND_EQUATION_SEPARATE:
@@ -145,36 +148,50 @@ softpipe_is_format_supported( struct pipe_screen *screen,
unsigned tex_usage,
unsigned geom_flags )
{
+ struct sw_winsys *winsys = softpipe_screen(screen)->winsys;
+
assert(target == PIPE_TEXTURE_1D ||
target == PIPE_TEXTURE_2D ||
target == PIPE_TEXTURE_3D ||
target == PIPE_TEXTURE_CUBE);
switch(format) {
- case PIPE_FORMAT_L16_UNORM:
case PIPE_FORMAT_YUYV:
case PIPE_FORMAT_UYVY:
+ return FALSE;
+
case PIPE_FORMAT_DXT1_RGB:
case PIPE_FORMAT_DXT1_RGBA:
case PIPE_FORMAT_DXT3_RGBA:
case PIPE_FORMAT_DXT5_RGBA:
+ return util_format_s3tc_enabled;
+
case PIPE_FORMAT_Z32_FLOAT:
- case PIPE_FORMAT_R8G8_SNORM:
- case PIPE_FORMAT_R5SG5SB6U_NORM:
- case PIPE_FORMAT_R8SG8SB8UX8U_NORM:
- case PIPE_FORMAT_R8G8B8A8_SNORM:
case PIPE_FORMAT_NONE:
return FALSE;
+
default:
- return TRUE;
+ break;
+ }
+
+ if(tex_usage & (PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
+ PIPE_TEXTURE_USAGE_SCANOUT |
+ PIPE_TEXTURE_USAGE_SHARED)) {
+ if(!winsys->is_displaytarget_format_supported(winsys, tex_usage, format))
+ return FALSE;
}
+
+ /* XXX: this is often a lie. Pull in logic from llvmpipe to fix.
+ */
+ return TRUE;
}
static void
softpipe_destroy_screen( struct pipe_screen *screen )
{
- struct pipe_winsys *winsys = screen->winsys;
+ struct softpipe_screen *sp_screen = softpipe_screen(screen);
+ struct sw_winsys *winsys = sp_screen->winsys;
if(winsys->destroy)
winsys->destroy(winsys);
@@ -183,21 +200,37 @@ softpipe_destroy_screen( struct pipe_screen *screen )
}
+/* This is often overriden by the co-state tracker.
+ */
+static void
+softpipe_flush_frontbuffer(struct pipe_screen *_screen,
+ struct pipe_surface *surface,
+ void *context_private)
+{
+ struct softpipe_screen *screen = softpipe_screen(_screen);
+ struct sw_winsys *winsys = screen->winsys;
+ struct softpipe_texture *texture = softpipe_texture(surface->texture);
+
+ assert(texture->dt);
+ if (texture->dt)
+ winsys->displaytarget_display(winsys, texture->dt, context_private);
+}
/**
* Create a new pipe_screen object
* Note: we're not presently subclassing pipe_screen (no softpipe_screen).
*/
struct pipe_screen *
-softpipe_create_screen(struct pipe_winsys *winsys)
+softpipe_create_screen(struct sw_winsys *winsys)
{
struct softpipe_screen *screen = CALLOC_STRUCT(softpipe_screen);
if (!screen)
return NULL;
- screen->base.winsys = winsys;
+ screen->winsys = winsys;
+ screen->base.winsys = NULL;
screen->base.destroy = softpipe_destroy_screen;
screen->base.get_name = softpipe_get_name;
@@ -206,9 +239,13 @@ softpipe_create_screen(struct pipe_winsys *winsys)
screen->base.get_paramf = softpipe_get_paramf;
screen->base.is_format_supported = softpipe_is_format_supported;
screen->base.context_create = softpipe_create_context;
+ screen->base.flush_frontbuffer = softpipe_flush_frontbuffer;
+
+ util_format_s3tc_init();
softpipe_init_screen_texture_funcs(&screen->base);
- u_simple_screen_init(&screen->base);
+ softpipe_init_screen_buffer_funcs(&screen->base);
+ softpipe_init_screen_fence_funcs(&screen->base);
return &screen->base;
}
diff --git a/src/gallium/drivers/softpipe/sp_screen.h b/src/gallium/drivers/softpipe/sp_screen.h
index 3d4bfd3e84..f741454c9e 100644
--- a/src/gallium/drivers/softpipe/sp_screen.h
+++ b/src/gallium/drivers/softpipe/sp_screen.h
@@ -35,10 +35,13 @@
#include "pipe/p_defines.h"
+struct sw_winsys;
struct softpipe_screen {
struct pipe_screen base;
+ struct sw_winsys *winsys;
+
/* Increments whenever textures are modified. Contexts can track
* this.
*/
@@ -55,4 +58,5 @@ softpipe_screen( struct pipe_screen *pipe )
}
+
#endif /* SP_SCREEN_H */
diff --git a/src/gallium/drivers/softpipe/sp_state.h b/src/gallium/drivers/softpipe/sp_state.h
index 4370bbeaee..ade96b0fd4 100644
--- a/src/gallium/drivers/softpipe/sp_state.h
+++ b/src/gallium/drivers/softpipe/sp_state.h
@@ -100,6 +100,11 @@ struct sp_geometry_shader {
struct draw_geometry_shader *draw_data;
};
+struct sp_velems_state {
+ unsigned count;
+ struct pipe_vertex_element velem[PIPE_MAX_ATTRIBS];
+};
+
void *
softpipe_create_blend_state(struct pipe_context *,
@@ -160,28 +165,39 @@ void *softpipe_create_gs_state(struct pipe_context *,
void softpipe_bind_gs_state(struct pipe_context *, void *);
void softpipe_delete_gs_state(struct pipe_context *, void *);
+void *softpipe_create_vertex_elements_state(struct pipe_context *,
+ unsigned count,
+ const struct pipe_vertex_element *);
+void softpipe_bind_vertex_elements_state(struct pipe_context *, void *);
+void softpipe_delete_vertex_elements_state(struct pipe_context *, void *);
+
void softpipe_set_polygon_stipple( struct pipe_context *,
- const struct pipe_poly_stipple * );
+ const struct pipe_poly_stipple * );
void softpipe_set_scissor_state( struct pipe_context *,
const struct pipe_scissor_state * );
-void softpipe_set_sampler_textures( struct pipe_context *,
- unsigned num,
- struct pipe_texture ** );
+void softpipe_set_sampler_views( struct pipe_context *,
+ unsigned num,
+ struct pipe_sampler_view ** );
void
-softpipe_set_vertex_sampler_textures(struct pipe_context *,
- unsigned num_textures,
- struct pipe_texture **);
+softpipe_set_vertex_sampler_views(struct pipe_context *,
+ unsigned num,
+ struct pipe_sampler_view **);
+
+struct pipe_sampler_view *
+softpipe_create_sampler_view(struct pipe_context *pipe,
+ struct pipe_texture *texture,
+ const struct pipe_sampler_view *templ);
+
+void
+softpipe_sampler_view_destroy(struct pipe_context *pipe,
+ struct pipe_sampler_view *view);
void softpipe_set_viewport_state( struct pipe_context *,
const struct pipe_viewport_state * );
-void softpipe_set_vertex_elements(struct pipe_context *,
- unsigned count,
- const struct pipe_vertex_element *);
-
void softpipe_set_vertex_buffers(struct pipe_context *,
unsigned count,
const struct pipe_vertex_buffer *);
diff --git a/src/gallium/drivers/softpipe/sp_state_fs.c b/src/gallium/drivers/softpipe/sp_state_fs.c
index c88e213751..d6f3229bed 100644
--- a/src/gallium/drivers/softpipe/sp_state_fs.c
+++ b/src/gallium/drivers/softpipe/sp_state_fs.c
@@ -28,6 +28,7 @@
#include "sp_context.h"
#include "sp_state.h"
#include "sp_fs.h"
+#include "sp_buffer.h"
#include "pipe/p_defines.h"
#include "util/u_memory.h"
@@ -163,26 +164,32 @@ softpipe_delete_vs_state(struct pipe_context *pipe, void *vs)
FREE( state );
}
-
-
void
softpipe_set_constant_buffer(struct pipe_context *pipe,
uint shader, uint index,
- struct pipe_buffer *buf)
+ struct pipe_buffer *constants)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
+ unsigned size = constants ? constants->size : 0;
+ const void *data = constants ? softpipe_buffer(constants)->data : NULL;
assert(shader < PIPE_SHADER_TYPES);
- assert(index < PIPE_MAX_CONSTANT_BUFFERS);
+ assert(index == 0);
draw_flush(softpipe->draw);
/* note: reference counting */
- pipe_buffer_reference(&softpipe->constants[shader][index], buf);
+ pipe_buffer_reference(&softpipe->constants[shader][index], constants);
+ if (shader == PIPE_SHADER_VERTEX || shader == PIPE_SHADER_GEOMETRY) {
+ draw_set_mapped_constant_buffer(softpipe->draw, shader, index, data, size);
+ }
+
+ softpipe->mapped_constants[shader][index] = data;
softpipe->dirty |= SP_NEW_CONSTANTS;
}
+
void *
softpipe_create_gs_state(struct pipe_context *pipe,
const struct pipe_shader_state *templ)
diff --git a/src/gallium/drivers/softpipe/sp_state_sampler.c b/src/gallium/drivers/softpipe/sp_state_sampler.c
index ceb4e338f1..d501952bba 100644
--- a/src/gallium/drivers/softpipe/sp_state_sampler.c
+++ b/src/gallium/drivers/softpipe/sp_state_sampler.c
@@ -121,9 +121,38 @@ softpipe_bind_vertex_sampler_states(struct pipe_context *pipe,
}
+struct pipe_sampler_view *
+softpipe_create_sampler_view(struct pipe_context *pipe,
+ struct pipe_texture *texture,
+ const struct pipe_sampler_view *templ)
+{
+ struct pipe_sampler_view *view = CALLOC_STRUCT(pipe_sampler_view);
+
+ if (view) {
+ *view = *templ;
+ view->reference.count = 1;
+ view->texture = NULL;
+ pipe_texture_reference(&view->texture, texture);
+ view->context = pipe;
+ }
+
+ return view;
+}
+
+
void
-softpipe_set_sampler_textures(struct pipe_context *pipe,
- unsigned num, struct pipe_texture **texture)
+softpipe_sampler_view_destroy(struct pipe_context *pipe,
+ struct pipe_sampler_view *view)
+{
+ pipe_texture_reference(&view->texture, NULL);
+ FREE(view);
+}
+
+
+void
+softpipe_set_sampler_views(struct pipe_context *pipe,
+ unsigned num,
+ struct pipe_sampler_view **views)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
uint i;
@@ -131,51 +160,51 @@ softpipe_set_sampler_textures(struct pipe_context *pipe,
assert(num <= PIPE_MAX_SAMPLERS);
/* Check for no-op */
- if (num == softpipe->num_textures &&
- !memcmp(softpipe->texture, texture, num * sizeof(struct pipe_texture *)))
+ if (num == softpipe->num_sampler_views &&
+ !memcmp(softpipe->sampler_views, views, num * sizeof(struct pipe_sampler_view *)))
return;
draw_flush(softpipe->draw);
for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
- struct pipe_texture *tex = i < num ? texture[i] : NULL;
+ struct pipe_sampler_view *view = i < num ? views[i] : NULL;
- pipe_texture_reference(&softpipe->texture[i], tex);
- sp_tex_tile_cache_set_texture(softpipe->tex_cache[i], tex);
+ pipe_sampler_view_reference(&softpipe->sampler_views[i], view);
+ sp_tex_tile_cache_set_sampler_view(softpipe->tex_cache[i], view);
}
- softpipe->num_textures = num;
+ softpipe->num_sampler_views = num;
softpipe->dirty |= SP_NEW_TEXTURE;
}
void
-softpipe_set_vertex_sampler_textures(struct pipe_context *pipe,
- unsigned num_textures,
- struct pipe_texture **textures)
+softpipe_set_vertex_sampler_views(struct pipe_context *pipe,
+ unsigned num,
+ struct pipe_sampler_view **views)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
uint i;
- assert(num_textures <= PIPE_MAX_VERTEX_SAMPLERS);
+ assert(num <= PIPE_MAX_VERTEX_SAMPLERS);
/* Check for no-op */
- if (num_textures == softpipe->num_vertex_textures &&
- !memcmp(softpipe->vertex_textures, textures, num_textures * sizeof(struct pipe_texture *))) {
+ if (num == softpipe->num_vertex_sampler_views &&
+ !memcmp(softpipe->vertex_sampler_views, views, num * sizeof(struct pipe_sampler_view *))) {
return;
}
draw_flush(softpipe->draw);
for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) {
- struct pipe_texture *tex = i < num_textures ? textures[i] : NULL;
+ struct pipe_sampler_view *view = i < num ? views[i] : NULL;
- pipe_texture_reference(&softpipe->vertex_textures[i], tex);
- sp_tex_tile_cache_set_texture(softpipe->vertex_tex_cache[i], tex);
+ pipe_sampler_view_reference(&softpipe->vertex_sampler_views[i], view);
+ sp_tex_tile_cache_set_sampler_view(softpipe->vertex_tex_cache[i], view);
}
- softpipe->num_vertex_textures = num_textures;
+ softpipe->num_vertex_sampler_views = num;
softpipe->dirty |= SP_NEW_TEXTURE;
}
@@ -245,29 +274,41 @@ softpipe_reset_sampler_varients(struct softpipe_context *softpipe)
*/
for (i = 0; i <= softpipe->vs->max_sampler; i++) {
if (softpipe->vertex_samplers[i]) {
+ struct pipe_texture *texture = NULL;
+
+ if (softpipe->vertex_sampler_views[i]) {
+ texture = softpipe->vertex_sampler_views[i]->texture;
+ }
+
softpipe->tgsi.vert_samplers_list[i] =
get_sampler_varient( i,
- sp_sampler(softpipe->vertex_samplers[i]),
- softpipe->vertex_textures[i],
+ sp_sampler(softpipe->vertex_samplers[i]),
+ texture,
TGSI_PROCESSOR_VERTEX );
sp_sampler_varient_bind_texture( softpipe->tgsi.vert_samplers_list[i],
- softpipe->vertex_tex_cache[i],
- softpipe->vertex_textures[i] );
+ softpipe->vertex_tex_cache[i],
+ texture );
}
}
for (i = 0; i <= softpipe->fs->info.file_max[TGSI_FILE_SAMPLER]; i++) {
if (softpipe->sampler[i]) {
+ struct pipe_texture *texture = NULL;
+
+ if (softpipe->sampler_views[i]) {
+ texture = softpipe->sampler_views[i]->texture;
+ }
+
softpipe->tgsi.frag_samplers_list[i] =
get_sampler_varient( i,
sp_sampler(softpipe->sampler[i]),
- softpipe->texture[i],
+ texture,
TGSI_PROCESSOR_FRAGMENT );
sp_sampler_varient_bind_texture( softpipe->tgsi.frag_samplers_list[i],
softpipe->tex_cache[i],
- softpipe->texture[i] );
+ texture );
}
}
}
diff --git a/src/gallium/drivers/softpipe/sp_state_vertex.c b/src/gallium/drivers/softpipe/sp_state_vertex.c
index b491d92ed1..462f4d2655 100644
--- a/src/gallium/drivers/softpipe/sp_state_vertex.c
+++ b/src/gallium/drivers/softpipe/sp_state_vertex.c
@@ -32,27 +32,45 @@
#include "sp_context.h"
#include "sp_state.h"
+#include "util/u_memory.h"
#include "draw/draw_context.h"
+void *
+softpipe_create_vertex_elements_state(struct pipe_context *pipe,
+ unsigned count,
+ const struct pipe_vertex_element *attribs)
+{
+ struct sp_velems_state *velems;
+ assert(count <= PIPE_MAX_ATTRIBS);
+ velems = (struct sp_velems_state *) MALLOC(sizeof(struct sp_velems_state));
+ if (velems) {
+ velems->count = count;
+ memcpy(velems->velem, attribs, sizeof(*attribs) * count);
+ }
+ return velems;
+}
+
void
-softpipe_set_vertex_elements(struct pipe_context *pipe,
- unsigned count,
- const struct pipe_vertex_element *attribs)
+softpipe_bind_vertex_elements_state(struct pipe_context *pipe,
+ void *velems)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
+ struct sp_velems_state *sp_velems = (struct sp_velems_state *) velems;
- assert(count <= PIPE_MAX_ATTRIBS);
-
- memcpy(softpipe->vertex_element, attribs,
- count * sizeof(struct pipe_vertex_element));
- softpipe->num_vertex_elements = count;
+ softpipe->velems = sp_velems;
softpipe->dirty |= SP_NEW_VERTEX;
- draw_set_vertex_elements(softpipe->draw, count, attribs);
+ if (sp_velems)
+ draw_set_vertex_elements(softpipe->draw, sp_velems->count, sp_velems->velem);
}
+void
+softpipe_delete_vertex_elements_state(struct pipe_context *pipe, void *velems)
+{
+ FREE( velems );
+}
void
softpipe_set_vertex_buffers(struct pipe_context *pipe,
diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c
index ef7ccf4189..fa9e19b282 100644
--- a/src/gallium/drivers/softpipe/sp_tex_sample.c
+++ b/src/gallium/drivers/softpipe/sp_tex_sample.c
@@ -1614,7 +1614,6 @@ sample_cube(struct tgsi_sampler *tgsi_sampler,
struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler);
unsigned j;
float ssss[4], tttt[4];
- unsigned face;
/*
major axis
@@ -1628,7 +1627,8 @@ sample_cube(struct tgsi_sampler *tgsi_sampler,
-rz TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT -rx -ry rz
*/
- /* First choose the cube face.
+ /* Choose the cube face and compute new s/t coords for the 2D face.
+ *
* Use the same cube face for all four pixels in the quad.
*
* This isn't ideal, but if we want to use a different cube face
@@ -1647,85 +1647,37 @@ sample_cube(struct tgsi_sampler *tgsi_sampler,
const float arx = fabsf(rx), ary = fabsf(ry), arz = fabsf(rz);
if (arx >= ary && arx >= arz) {
- if (rx >= 0.0F) {
- face = PIPE_TEX_FACE_POS_X;
- }
- else {
- face = PIPE_TEX_FACE_NEG_X;
+ float sign = (rx >= 0.0F) ? 1.0F : -1.0F;
+ uint face = (rx >= 0.0F) ? PIPE_TEX_FACE_POS_X : PIPE_TEX_FACE_NEG_X;
+ for (j = 0; j < QUAD_SIZE; j++) {
+ const float ima = -0.5F / fabsf(s[j]);
+ ssss[j] = sign * p[j] * ima + 0.5F;
+ tttt[j] = t[j] * ima + 0.5F;
+ samp->faces[j] = face;
}
}
else if (ary >= arx && ary >= arz) {
- if (ry >= 0.0F) {
- face = PIPE_TEX_FACE_POS_Y;
- }
- else {
- face = PIPE_TEX_FACE_NEG_Y;
+ float sign = (ry >= 0.0F) ? 1.0F : -1.0F;
+ uint face = (ry >= 0.0F) ? PIPE_TEX_FACE_POS_Y : PIPE_TEX_FACE_NEG_Y;
+ for (j = 0; j < QUAD_SIZE; j++) {
+ const float ima = -0.5F / fabsf(t[j]);
+ ssss[j] = -s[j] * ima + 0.5F;
+ tttt[j] = sign * -p[j] * ima + 0.5F;
+ samp->faces[j] = face;
}
}
else {
- if (rz > 0.0F) {
- face = PIPE_TEX_FACE_POS_Z;
- }
- else {
- face = PIPE_TEX_FACE_NEG_Z;
+ float sign = (rz >= 0.0F) ? 1.0F : -1.0F;
+ uint face = (rz >= 0.0F) ? PIPE_TEX_FACE_POS_Z : PIPE_TEX_FACE_NEG_Z;
+ for (j = 0; j < QUAD_SIZE; j++) {
+ const float ima = -0.5 / fabsf(p[j]);
+ ssss[j] = sign * -s[j] * ima + 0.5F;
+ tttt[j] = t[j] * ima + 0.5F;
+ samp->faces[j] = face;
}
}
}
- /* Now compute the 2D _face_ texture coords from the
- * 3D _cube_ texture coords.
- */
- for (j = 0; j < QUAD_SIZE; j++) {
- const float rx = s[j], ry = t[j], rz = p[j];
- const float arx = fabsf(rx), ary = fabsf(ry), arz = fabsf(rz);
- float sc, tc, ma;
-
- switch (face) {
- case PIPE_TEX_FACE_POS_X:
- sc = -rz;
- tc = -ry;
- ma = arx;
- break;
- case PIPE_TEX_FACE_NEG_X:
- sc = rz;
- tc = -ry;
- ma = arx;
- break;
- case PIPE_TEX_FACE_POS_Y:
- sc = rx;
- tc = rz;
- ma = ary;
- break;
- case PIPE_TEX_FACE_NEG_Y:
- sc = rx;
- tc = -rz;
- ma = ary;
- break;
- case PIPE_TEX_FACE_POS_Z:
- sc = rx;
- tc = -ry;
- ma = arz;
- break;
- case PIPE_TEX_FACE_NEG_Z:
- sc = -rx;
- tc = -ry;
- ma = arz;
- break;
- default:
- assert(0 && "bad cube face");
- sc = 0.0F;
- tc = 0.0F;
- ma = 0.0F;
- }
-
- {
- const float ima = 1.0 / ma;
- ssss[j] = ( sc * ima + 1.0F ) * 0.5F;
- tttt[j] = ( tc * ima + 1.0F ) * 0.5F;
- samp->faces[j] = face;
- }
- }
-
/* In our little pipeline, the compare stage is next. If compare
* is not active, this will point somewhere deeper into the
* pipeline, eg. to mip_filter or even img_filter.
diff --git a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c
index a0b95c8884..6594514c38 100644
--- a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c
+++ b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c
@@ -43,14 +43,14 @@
struct softpipe_tex_tile_cache *
-sp_create_tex_tile_cache( struct pipe_screen *screen )
+sp_create_tex_tile_cache( struct pipe_context *pipe )
{
struct softpipe_tex_tile_cache *tc;
uint pos;
tc = CALLOC_STRUCT( softpipe_tex_tile_cache );
if (tc) {
- tc->screen = screen;
+ tc->pipe = pipe;
for (pos = 0; pos < NUM_ENTRIES; pos++) {
tc->entries[pos].addr.bits.invalid = 1;
}
@@ -63,19 +63,16 @@ sp_create_tex_tile_cache( struct pipe_screen *screen )
void
sp_destroy_tex_tile_cache(struct softpipe_tex_tile_cache *tc)
{
- struct pipe_screen *screen;
uint pos;
for (pos = 0; pos < NUM_ENTRIES; pos++) {
/*assert(tc->entries[pos].x < 0);*/
}
if (tc->transfer) {
- screen = tc->transfer->texture->screen;
- screen->tex_transfer_destroy(tc->transfer);
+ tc->pipe->tex_transfer_destroy(tc->pipe, tc->transfer);
}
if (tc->tex_trans) {
- screen = tc->tex_trans->texture->screen;
- screen->tex_transfer_destroy(tc->tex_trans);
+ tc->pipe->tex_transfer_destroy(tc->pipe, tc->tex_trans);
}
FREE( tc );
@@ -88,7 +85,7 @@ void
sp_tex_tile_cache_map_transfers(struct softpipe_tex_tile_cache *tc)
{
if (tc->tex_trans && !tc->tex_trans_map)
- tc->tex_trans_map = tc->screen->transfer_map(tc->screen, tc->tex_trans);
+ tc->tex_trans_map = tc->pipe->transfer_map(tc->pipe, tc->tex_trans);
}
@@ -96,7 +93,7 @@ void
sp_tex_tile_cache_unmap_transfers(struct softpipe_tex_tile_cache *tc)
{
if (tc->tex_trans_map) {
- tc->screen->transfer_unmap(tc->screen, tc->tex_trans);
+ tc->pipe->transfer_unmap(tc->pipe, tc->tex_trans);
tc->tex_trans_map = NULL;
}
}
@@ -119,12 +116,13 @@ sp_tex_tile_cache_validate_texture(struct softpipe_tex_tile_cache *tc)
}
/**
- * Specify the texture to cache.
+ * Specify the sampler view to cache.
*/
void
-sp_tex_tile_cache_set_texture(struct softpipe_tex_tile_cache *tc,
- struct pipe_texture *texture)
+sp_tex_tile_cache_set_sampler_view(struct softpipe_tex_tile_cache *tc,
+ struct pipe_sampler_view *view)
{
+ struct pipe_texture *texture = view ? view->texture : NULL;
uint i;
assert(!tc->transfer);
@@ -133,17 +131,23 @@ sp_tex_tile_cache_set_texture(struct softpipe_tex_tile_cache *tc,
pipe_texture_reference(&tc->texture, texture);
if (tc->tex_trans) {
- struct pipe_screen *screen = tc->tex_trans->texture->screen;
-
if (tc->tex_trans_map) {
- screen->transfer_unmap(screen, tc->tex_trans);
+ tc->pipe->transfer_unmap(tc->pipe, tc->tex_trans);
tc->tex_trans_map = NULL;
}
- screen->tex_transfer_destroy(tc->tex_trans);
+ tc->pipe->tex_transfer_destroy(tc->pipe, tc->tex_trans);
tc->tex_trans = NULL;
}
+ if (view) {
+ tc->swizzle_r = view->swizzle_r;
+ tc->swizzle_g = view->swizzle_g;
+ tc->swizzle_b = view->swizzle_b;
+ tc->swizzle_a = view->swizzle_a;
+ tc->format = view->format;
+ }
+
/* mark as entries as invalid/empty */
/* XXX we should try to avoid this when the teximage hasn't changed */
for (i = 0; i < NUM_ENTRIES; i++) {
@@ -204,7 +208,6 @@ const struct softpipe_tex_cached_tile *
sp_find_cached_tile_tex(struct softpipe_tex_tile_cache *tc,
union tex_tile_address addr )
{
- struct pipe_screen *screen = tc->screen;
struct softpipe_tex_cached_tile *tile;
tile = tc->entries + tex_cache_pos( addr );
@@ -232,16 +235,16 @@ sp_find_cached_tile_tex(struct softpipe_tex_tile_cache *tc,
if (tc->tex_trans) {
if (tc->tex_trans_map) {
- tc->screen->transfer_unmap(tc->screen, tc->tex_trans);
+ tc->pipe->transfer_unmap(tc->pipe, tc->tex_trans);
tc->tex_trans_map = NULL;
}
- screen->tex_transfer_destroy(tc->tex_trans);
+ tc->pipe->tex_transfer_destroy(tc->pipe, tc->tex_trans);
tc->tex_trans = NULL;
}
tc->tex_trans =
- screen->get_tex_transfer(screen, tc->texture,
+ tc->pipe->get_tex_transfer(tc->pipe, tc->texture,
addr.bits.face,
addr.bits.level,
addr.bits.z,
@@ -249,7 +252,7 @@ sp_find_cached_tile_tex(struct softpipe_tex_tile_cache *tc,
u_minify(tc->texture->width0, addr.bits.level),
u_minify(tc->texture->height0, addr.bits.level));
- tc->tex_trans_map = screen->transfer_map(screen, tc->tex_trans);
+ tc->tex_trans_map = tc->pipe->transfer_map(tc->pipe, tc->tex_trans);
tc->tex_face = addr.bits.face;
tc->tex_level = addr.bits.level;
@@ -257,11 +260,18 @@ sp_find_cached_tile_tex(struct softpipe_tex_tile_cache *tc,
}
/* get tile from the transfer (view into texture) */
- pipe_get_tile_rgba(tc->tex_trans,
- addr.bits.x * TILE_SIZE,
- addr.bits.y * TILE_SIZE,
- TILE_SIZE, TILE_SIZE,
- (float *) tile->data.color);
+ pipe_get_tile_swizzle(tc->pipe,
+ tc->tex_trans,
+ addr.bits.x * TILE_SIZE,
+ addr.bits.y * TILE_SIZE,
+ TILE_SIZE,
+ TILE_SIZE,
+ tc->swizzle_r,
+ tc->swizzle_g,
+ tc->swizzle_b,
+ tc->swizzle_a,
+ tc->format,
+ (float *) tile->data.color);
tile->addr = addr;
}
diff --git a/src/gallium/drivers/softpipe/sp_tex_tile_cache.h b/src/gallium/drivers/softpipe/sp_tex_tile_cache.h
index ac6886a3df..12ae7ba12d 100644
--- a/src/gallium/drivers/softpipe/sp_tex_tile_cache.h
+++ b/src/gallium/drivers/softpipe/sp_tex_tile_cache.h
@@ -70,7 +70,7 @@ struct softpipe_tex_cached_tile
struct softpipe_tex_tile_cache
{
- struct pipe_screen *screen;
+ struct pipe_context *pipe;
struct pipe_transfer *transfer;
void *transfer_map;
@@ -83,12 +83,18 @@ struct softpipe_tex_tile_cache
void *tex_trans_map;
int tex_face, tex_level, tex_z;
+ unsigned swizzle_r;
+ unsigned swizzle_g;
+ unsigned swizzle_b;
+ unsigned swizzle_a;
+ unsigned format;
+
struct softpipe_tex_cached_tile *last_tile; /**< most recently retrieved tile */
};
extern struct softpipe_tex_tile_cache *
-sp_create_tex_tile_cache( struct pipe_screen *screen );
+sp_create_tex_tile_cache( struct pipe_context *pipe );
extern void
sp_destroy_tex_tile_cache(struct softpipe_tex_tile_cache *tc);
@@ -101,8 +107,8 @@ extern void
sp_tex_tile_cache_unmap_transfers(struct softpipe_tex_tile_cache *tc);
extern void
-sp_tex_tile_cache_set_texture(struct softpipe_tex_tile_cache *tc,
- struct pipe_texture *texture);
+sp_tex_tile_cache_set_sampler_view(struct softpipe_tex_tile_cache *tc,
+ struct pipe_sampler_view *view);
void
sp_tex_tile_cache_validate_texture(struct softpipe_tex_tile_cache *tc);
diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c
index 32d261b5ff..f4983b7c8e 100644
--- a/src/gallium/drivers/softpipe/sp_texture.c
+++ b/src/gallium/drivers/softpipe/sp_texture.c
@@ -40,7 +40,8 @@
#include "sp_context.h"
#include "sp_texture.h"
#include "sp_screen.h"
-#include "sp_winsys.h"
+
+#include "state_tracker/sw_winsys.h"
/**
@@ -72,11 +73,9 @@ softpipe_texture_layout(struct pipe_screen *screen,
depth = u_minify(depth, 1);
}
- spt->buffer = screen->buffer_create(screen, 32,
- PIPE_BUFFER_USAGE_PIXEL,
- buffer_size);
+ spt->data = align_malloc(buffer_size, 16);
- return spt->buffer != NULL;
+ return spt->data != NULL;
}
@@ -87,19 +86,19 @@ static boolean
softpipe_displaytarget_layout(struct pipe_screen *screen,
struct softpipe_texture * spt)
{
- unsigned usage = (PIPE_BUFFER_USAGE_CPU_READ_WRITE |
- PIPE_BUFFER_USAGE_GPU_READ_WRITE);
- unsigned tex_usage = spt->base.tex_usage;
-
- spt->buffer = screen->surface_buffer_create( screen,
- spt->base.width0,
- spt->base.height0,
- spt->base.format,
- usage,
- tex_usage,
- &spt->stride[0]);
-
- return spt->buffer != NULL;
+ struct sw_winsys *winsys = softpipe_screen(screen)->winsys;
+
+ /* Round up the surface size to a multiple of the tile size?
+ */
+ spt->dt = winsys->displaytarget_create(winsys,
+ spt->base.tex_usage,
+ spt->base.format,
+ spt->base.width0,
+ spt->base.height0,
+ 16,
+ &spt->stride[0] );
+
+ return spt->dt != NULL;
}
@@ -123,7 +122,8 @@ softpipe_texture_create(struct pipe_screen *screen,
util_is_power_of_two(template->depth0));
if (spt->base.tex_usage & (PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
- PIPE_TEXTURE_USAGE_PRIMARY)) {
+ PIPE_TEXTURE_USAGE_SCANOUT |
+ PIPE_TEXTURE_USAGE_SHARED)) {
if (!softpipe_displaytarget_layout(screen, spt))
goto fail;
}
@@ -140,47 +140,72 @@ softpipe_texture_create(struct pipe_screen *screen,
}
-/**
- * Create a new pipe_texture which wraps an existing buffer.
- */
-static struct pipe_texture *
-softpipe_texture_blanket(struct pipe_screen * screen,
- const struct pipe_texture *base,
- const unsigned *stride,
- struct pipe_buffer *buffer)
+static void
+softpipe_texture_destroy(struct pipe_texture *pt)
{
- struct softpipe_texture *spt;
- assert(screen);
+ struct softpipe_screen *screen = softpipe_screen(pt->screen);
+ struct softpipe_texture *spt = softpipe_texture(pt);
- /* Only supports one type */
- if (base->target != PIPE_TEXTURE_2D ||
- base->last_level != 0 ||
- base->depth0 != 1) {
- return NULL;
+ if (spt->dt) {
+ /* display target */
+ struct sw_winsys *winsys = screen->winsys;
+ winsys->displaytarget_destroy(winsys, spt->dt);
+ }
+ else {
+ /* regular texture */
+ align_free(spt->data);
}
- spt = CALLOC_STRUCT(softpipe_texture);
+ FREE(spt);
+}
+
+
+static struct pipe_texture *
+softpipe_texture_from_handle(struct pipe_screen *screen,
+ const struct pipe_texture *template,
+ struct winsys_handle *whandle)
+{
+ struct sw_winsys *winsys = softpipe_screen(screen)->winsys;
+ struct softpipe_texture *spt = CALLOC_STRUCT(softpipe_texture);
if (!spt)
return NULL;
- spt->base = *base;
+ spt->base = *template;
pipe_reference_init(&spt->base.reference, 1);
spt->base.screen = screen;
- spt->stride[0] = stride[0];
- pipe_buffer_reference(&spt->buffer, buffer);
+ spt->pot = (util_is_power_of_two(template->width0) &&
+ util_is_power_of_two(template->height0) &&
+ util_is_power_of_two(template->depth0));
+
+ spt->dt = winsys->displaytarget_from_handle(winsys,
+ template,
+ whandle,
+ &spt->stride[0]);
+ if (!spt->dt)
+ goto fail;
return &spt->base;
+
+ fail:
+ FREE(spt);
+ return NULL;
}
-static void
-softpipe_texture_destroy(struct pipe_texture *pt)
+static boolean
+softpipe_texture_get_handle(struct pipe_screen *screen,
+ struct pipe_texture *pt,
+ struct winsys_handle *whandle)
{
+ struct sw_winsys *winsys = softpipe_screen(screen)->winsys;
struct softpipe_texture *spt = softpipe_texture(pt);
- pipe_buffer_reference(&spt->buffer, NULL);
- FREE(spt);
+ assert(spt->dt);
+ if (!spt->dt)
+ return FALSE;
+
+ return winsys->displaytarget_get_handle(winsys, spt->dt, whandle);
}
@@ -278,7 +303,7 @@ softpipe_tex_surface_destroy(struct pipe_surface *surf)
* \param height height of region to read/write
*/
static struct pipe_transfer *
-softpipe_get_tex_transfer(struct pipe_screen *screen,
+softpipe_get_tex_transfer(struct pipe_context *pipe,
struct pipe_texture *texture,
unsigned face, unsigned level, unsigned zslice,
enum pipe_transfer_usage usage,
@@ -332,7 +357,8 @@ softpipe_get_tex_transfer(struct pipe_screen *screen,
* softpipe_get_tex_transfer().
*/
static void
-softpipe_tex_transfer_destroy(struct pipe_transfer *transfer)
+softpipe_tex_transfer_destroy(struct pipe_context *pipe,
+ struct pipe_transfer *transfer)
{
/* Effectively do the texture_update work here - if texture images
* needed post-processing to put them into hardware layout, this is
@@ -348,7 +374,7 @@ softpipe_tex_transfer_destroy(struct pipe_transfer *transfer)
* Create memory mapping for given pipe_transfer object.
*/
static void *
-softpipe_transfer_map( struct pipe_screen *screen,
+softpipe_transfer_map( struct pipe_context *pipe,
struct pipe_transfer *transfer )
{
ubyte *map, *xfer_map;
@@ -359,9 +385,20 @@ softpipe_transfer_map( struct pipe_screen *screen,
spt = softpipe_texture(transfer->texture);
format = transfer->texture->format;
- map = pipe_buffer_map(screen, spt->buffer, pipe_transfer_buffer_flags(transfer));
- if (map == NULL)
- return NULL;
+ if (spt->dt) {
+ /* display target */
+ struct sw_winsys *winsys = softpipe_screen(pipe->screen)->winsys;
+
+ map = winsys->displaytarget_map(winsys, spt->dt,
+ pipe_transfer_buffer_flags(transfer));
+ if (map == NULL)
+ return NULL;
+ }
+ else {
+ map = spt->data;
+ if (map == NULL)
+ return NULL;
+ }
/* May want to different things here depending on read/write nature
* of the map:
@@ -370,7 +407,7 @@ softpipe_transfer_map( struct pipe_screen *screen,
/* Do something to notify sharing contexts of a texture change.
* In softpipe, that would mean flushing the texture cache.
*/
- softpipe_screen(screen)->timestamp++;
+ softpipe_screen(pipe->screen)->timestamp++;
}
xfer_map = map + softpipe_transfer(transfer)->offset +
@@ -385,7 +422,7 @@ softpipe_transfer_map( struct pipe_screen *screen,
* Unmap memory mapping for given pipe_transfer object.
*/
static void
-softpipe_transfer_unmap(struct pipe_screen *screen,
+softpipe_transfer_unmap(struct pipe_context *pipe,
struct pipe_transfer *transfer)
{
struct softpipe_texture *spt;
@@ -393,7 +430,11 @@ softpipe_transfer_unmap(struct pipe_screen *screen,
assert(transfer->texture);
spt = softpipe_texture(transfer->texture);
- pipe_buffer_unmap( screen, spt->buffer );
+ if (spt->dt) {
+ /* display target */
+ struct sw_winsys *winsys = softpipe_screen(pipe->screen)->winsys;
+ winsys->displaytarget_unmap(winsys, spt->dt);
+ }
if (transfer->usage & PIPE_TRANSFER_WRITE) {
/* Mark the texture as dirty to expire the tile caches. */
@@ -455,43 +496,28 @@ softpipe_video_surface_destroy(struct pipe_video_surface *vsfc)
void
+softpipe_init_texture_funcs(struct pipe_context *pipe)
+{
+ pipe->get_tex_transfer = softpipe_get_tex_transfer;
+ pipe->tex_transfer_destroy = softpipe_tex_transfer_destroy;
+ pipe->transfer_map = softpipe_transfer_map;
+ pipe->transfer_unmap = softpipe_transfer_unmap;
+}
+
+void
softpipe_init_screen_texture_funcs(struct pipe_screen *screen)
{
screen->texture_create = softpipe_texture_create;
- screen->texture_blanket = softpipe_texture_blanket;
screen->texture_destroy = softpipe_texture_destroy;
+ screen->texture_from_handle = softpipe_texture_from_handle;
+ screen->texture_get_handle = softpipe_texture_get_handle;
screen->get_tex_surface = softpipe_get_tex_surface;
screen->tex_surface_destroy = softpipe_tex_surface_destroy;
- screen->get_tex_transfer = softpipe_get_tex_transfer;
- screen->tex_transfer_destroy = softpipe_tex_transfer_destroy;
- screen->transfer_map = softpipe_transfer_map;
- screen->transfer_unmap = softpipe_transfer_unmap;
-
screen->video_surface_create = softpipe_video_surface_create;
screen->video_surface_destroy = softpipe_video_surface_destroy;
}
-/**
- * Return pipe_buffer handle and stride for given texture object.
- * XXX used for???
- */
-boolean
-softpipe_get_texture_buffer( struct pipe_texture *texture,
- struct pipe_buffer **buf,
- unsigned *stride )
-{
- struct softpipe_texture *tex = (struct softpipe_texture *) texture;
-
- if (!tex)
- return FALSE;
- pipe_buffer_reference(buf, tex->buffer);
-
- if (stride)
- *stride = tex->stride[0];
-
- return TRUE;
-}
diff --git a/src/gallium/drivers/softpipe/sp_texture.h b/src/gallium/drivers/softpipe/sp_texture.h
index 2ef64e1e7c..c0e6ba8a86 100644
--- a/src/gallium/drivers/softpipe/sp_texture.h
+++ b/src/gallium/drivers/softpipe/sp_texture.h
@@ -33,6 +33,10 @@
#include "pipe/p_video_state.h"
+#define SP_MAX_TEXTURE_2D_LEVELS 13 /* 4K x 4K */
+#define SP_MAX_TEXTURE_3D_LEVELS 9 /* 512 x 512 x 512 */
+
+
struct pipe_context;
struct pipe_screen;
struct softpipe_context;
@@ -42,12 +46,19 @@ struct softpipe_texture
{
struct pipe_texture base;
- unsigned long level_offset[PIPE_MAX_TEXTURE_LEVELS];
- unsigned stride[PIPE_MAX_TEXTURE_LEVELS];
+ unsigned long level_offset[SP_MAX_TEXTURE_2D_LEVELS];
+ unsigned stride[SP_MAX_TEXTURE_2D_LEVELS];
- /* The data is held here:
+ /**
+ * Display target, for textures with the PIPE_TEXTURE_USAGE_DISPLAY_TARGET
+ * usage.
*/
- struct pipe_buffer *buffer;
+ struct sw_displaytarget *dt;
+
+ /**
+ * Malloc'ed data for regular textures, or a mapping to dt above.
+ */
+ void *data;
/* True if texture images are power-of-two in all dimensions:
*/
@@ -96,5 +107,8 @@ softpipe_video_surface(struct pipe_video_surface *pvs)
extern void
softpipe_init_screen_texture_funcs(struct pipe_screen *screen);
+void
+softpipe_init_texture_funcs(struct pipe_context *pipe);
+
#endif /* SP_TEXTURE */
diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c
index aedfdf1b46..7551b923fb 100644
--- a/src/gallium/drivers/softpipe/sp_tile_cache.c
+++ b/src/gallium/drivers/softpipe/sp_tile_cache.c
@@ -79,20 +79,20 @@ clear_clear_flag(uint *bitvec, union tile_address addr)
struct softpipe_tile_cache *
-sp_create_tile_cache( struct pipe_screen *screen )
+sp_create_tile_cache( struct pipe_context *pipe )
{
struct softpipe_tile_cache *tc;
uint pos;
int maxLevels, maxTexSize;
/* sanity checking: max sure MAX_WIDTH/HEIGHT >= largest texture image */
- maxLevels = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS);
+ maxLevels = pipe->screen->get_param(pipe->screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS);
maxTexSize = 1 << (maxLevels - 1);
assert(MAX_WIDTH >= maxTexSize);
tc = CALLOC_STRUCT( softpipe_tile_cache );
if (tc) {
- tc->screen = screen;
+ tc->pipe = pipe;
for (pos = 0; pos < NUM_ENTRIES; pos++) {
tc->entries[pos].addr.bits.invalid = 1;
}
@@ -115,15 +115,13 @@ sp_create_tile_cache( struct pipe_screen *screen )
void
sp_destroy_tile_cache(struct softpipe_tile_cache *tc)
{
- struct pipe_screen *screen;
uint pos;
for (pos = 0; pos < NUM_ENTRIES; pos++) {
/*assert(tc->entries[pos].x < 0);*/
}
if (tc->transfer) {
- screen = tc->transfer->texture->screen;
- screen->tex_transfer_destroy(tc->transfer);
+ tc->pipe->tex_transfer_destroy(tc->pipe, tc->transfer);
}
FREE( tc );
@@ -137,38 +135,36 @@ void
sp_tile_cache_set_surface(struct softpipe_tile_cache *tc,
struct pipe_surface *ps)
{
- if (tc->transfer) {
- struct pipe_screen *screen = tc->transfer->texture->screen;
+ struct pipe_context *pipe = tc->pipe;
+ if (tc->transfer) {
if (ps == tc->surface)
return;
if (tc->transfer_map) {
- screen->transfer_unmap(screen, tc->transfer);
+ pipe->transfer_unmap(pipe, tc->transfer);
tc->transfer_map = NULL;
}
- screen->tex_transfer_destroy(tc->transfer);
+ pipe->tex_transfer_destroy(pipe, tc->transfer);
tc->transfer = NULL;
}
tc->surface = ps;
if (ps) {
- struct pipe_screen *screen = ps->texture->screen;
-
- tc->transfer = screen->get_tex_transfer(screen, ps->texture, ps->face,
+ tc->transfer = pipe->get_tex_transfer(pipe, ps->texture, ps->face,
ps->level, ps->zslice,
PIPE_TRANSFER_READ_WRITE,
0, 0, ps->width, ps->height);
- tc->depth_stencil = (ps->format == PIPE_FORMAT_Z24S8_UNORM ||
+ tc->depth_stencil = (ps->format == PIPE_FORMAT_Z24_UNORM_S8_USCALED ||
ps->format == PIPE_FORMAT_Z24X8_UNORM ||
- ps->format == PIPE_FORMAT_S8Z24_UNORM ||
+ ps->format == PIPE_FORMAT_S8_USCALED_Z24_UNORM ||
ps->format == PIPE_FORMAT_X8Z24_UNORM ||
ps->format == PIPE_FORMAT_Z16_UNORM ||
ps->format == PIPE_FORMAT_Z32_UNORM ||
- ps->format == PIPE_FORMAT_S8_UNORM);
+ ps->format == PIPE_FORMAT_S8_USCALED);
}
}
@@ -187,7 +183,7 @@ void
sp_tile_cache_map_transfers(struct softpipe_tile_cache *tc)
{
if (tc->transfer && !tc->transfer_map)
- tc->transfer_map = tc->screen->transfer_map(tc->screen, tc->transfer);
+ tc->transfer_map = tc->pipe->transfer_map(tc->pipe, tc->transfer);
}
@@ -195,7 +191,7 @@ void
sp_tile_cache_unmap_transfers(struct softpipe_tile_cache *tc)
{
if (tc->transfer_map) {
- tc->screen->transfer_unmap(tc->screen, tc->transfer);
+ tc->pipe->transfer_unmap(tc->pipe, tc->transfer);
tc->transfer_map = NULL;
}
}
@@ -295,7 +291,8 @@ sp_tile_cache_flush_clear(struct softpipe_tile_cache *tc)
union tile_address addr = tile_address(x, y);
if (is_clear_flag_set(tc->clear_flags, addr)) {
- pipe_put_tile_raw(pt,
+ pipe_put_tile_raw(tc->pipe,
+ pt,
x, y, TILE_SIZE, TILE_SIZE,
tc->tile.data.color32, 0/*STRIDE*/);
@@ -329,14 +326,14 @@ sp_flush_tile_cache(struct softpipe_tile_cache *tc)
struct softpipe_cached_tile *tile = tc->entries + pos;
if (!tile->addr.bits.invalid) {
if (tc->depth_stencil) {
- pipe_put_tile_raw(pt,
+ pipe_put_tile_raw(tc->pipe, pt,
tile->addr.bits.x * TILE_SIZE,
tile->addr.bits.y * TILE_SIZE,
TILE_SIZE, TILE_SIZE,
tile->data.depth32, 0/*STRIDE*/);
}
else {
- pipe_put_tile_rgba(pt,
+ pipe_put_tile_rgba(tc->pipe, pt,
tile->addr.bits.x * TILE_SIZE,
tile->addr.bits.y * TILE_SIZE,
TILE_SIZE, TILE_SIZE,
@@ -379,14 +376,14 @@ sp_find_cached_tile(struct softpipe_tile_cache *tc,
if (tile->addr.bits.invalid == 0) {
/* put dirty tile back in framebuffer */
if (tc->depth_stencil) {
- pipe_put_tile_raw(pt,
+ pipe_put_tile_raw(tc->pipe, pt,
tile->addr.bits.x * TILE_SIZE,
tile->addr.bits.y * TILE_SIZE,
TILE_SIZE, TILE_SIZE,
tile->data.depth32, 0/*STRIDE*/);
}
else {
- pipe_put_tile_rgba(pt,
+ pipe_put_tile_rgba(tc->pipe, pt,
tile->addr.bits.x * TILE_SIZE,
tile->addr.bits.y * TILE_SIZE,
TILE_SIZE, TILE_SIZE,
@@ -409,14 +406,14 @@ sp_find_cached_tile(struct softpipe_tile_cache *tc,
else {
/* get new tile data from transfer */
if (tc->depth_stencil) {
- pipe_get_tile_raw(pt,
+ pipe_get_tile_raw(tc->pipe, pt,
tile->addr.bits.x * TILE_SIZE,
tile->addr.bits.y * TILE_SIZE,
TILE_SIZE, TILE_SIZE,
tile->data.depth32, 0/*STRIDE*/);
}
else {
- pipe_get_tile_rgba(pt,
+ pipe_get_tile_rgba(tc->pipe, pt,
tile->addr.bits.x * TILE_SIZE,
tile->addr.bits.y * TILE_SIZE,
TILE_SIZE, TILE_SIZE,
diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.h b/src/gallium/drivers/softpipe/sp_tile_cache.h
index a12092702a..753d8c0daa 100644
--- a/src/gallium/drivers/softpipe/sp_tile_cache.h
+++ b/src/gallium/drivers/softpipe/sp_tile_cache.h
@@ -80,7 +80,7 @@ struct softpipe_cached_tile
struct softpipe_tile_cache
{
- struct pipe_screen *screen;
+ struct pipe_context *pipe;
struct pipe_surface *surface; /**< the surface we're caching */
struct pipe_transfer *transfer;
void *transfer_map;
@@ -98,7 +98,7 @@ struct softpipe_tile_cache
extern struct softpipe_tile_cache *
-sp_create_tile_cache( struct pipe_screen *screen );
+sp_create_tile_cache( struct pipe_context *pipe );
extern void
sp_destroy_tile_cache(struct softpipe_tile_cache *tc);
diff --git a/src/gallium/drivers/softpipe/sp_winsys.c b/src/gallium/drivers/softpipe/sp_winsys.c
deleted file mode 100644
index 0a6245ed2c..0000000000
--- a/src/gallium/drivers/softpipe/sp_winsys.c
+++ /dev/null
@@ -1,245 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2007 Tungsten Graphics, Inc., Bismarck, ND., USA
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- *
- **************************************************************************/
-
-/**
- * @file
- * Malloc softpipe winsys. Uses malloc for all memory allocations.
- *
- * @author Keith Whitwell
- * @author Brian Paul
- * @author Jose Fonseca
- */
-
-
-#include "util/u_simple_screen.h"/* port to just p_screen */
-#include "util/u_format.h"
-#include "util/u_math.h"
-#include "util/u_memory.h"
-#include "util/u_inlines.h"
-#include "pipe/p_format.h"
-#include "pipe/p_context.h"
-#include "sp_winsys.h"
-
-
-struct st_softpipe_buffer
-{
- struct pipe_buffer base;
- boolean userBuffer; /** Is this a user-space buffer? */
- void *data;
- void *mapped;
-};
-
-
-/** Cast wrapper */
-static INLINE struct st_softpipe_buffer *
-st_softpipe_buffer( struct pipe_buffer *buf )
-{
- return (struct st_softpipe_buffer *)buf;
-}
-
-
-static void *
-st_softpipe_buffer_map(struct pipe_winsys *winsys,
- struct pipe_buffer *buf,
- unsigned flags)
-{
- struct st_softpipe_buffer *st_softpipe_buf = st_softpipe_buffer(buf);
- st_softpipe_buf->mapped = st_softpipe_buf->data;
- return st_softpipe_buf->mapped;
-}
-
-
-static void
-st_softpipe_buffer_unmap(struct pipe_winsys *winsys,
- struct pipe_buffer *buf)
-{
- struct st_softpipe_buffer *st_softpipe_buf = st_softpipe_buffer(buf);
- st_softpipe_buf->mapped = NULL;
-}
-
-
-static void
-st_softpipe_buffer_destroy(struct pipe_buffer *buf)
-{
- struct st_softpipe_buffer *oldBuf = st_softpipe_buffer(buf);
-
- if (oldBuf->data) {
- if (!oldBuf->userBuffer)
- align_free(oldBuf->data);
-
- oldBuf->data = NULL;
- }
-
- FREE(oldBuf);
-}
-
-
-static void
-st_softpipe_flush_frontbuffer(struct pipe_winsys *winsys,
- struct pipe_surface *surf,
- void *context_private)
-{
-}
-
-
-
-static const char *
-st_softpipe_get_name(struct pipe_winsys *winsys)
-{
- return "softpipe";
-}
-
-
-static struct pipe_buffer *
-st_softpipe_buffer_create(struct pipe_winsys *winsys,
- unsigned alignment,
- unsigned usage,
- unsigned size)
-{
- struct st_softpipe_buffer *buffer = CALLOC_STRUCT(st_softpipe_buffer);
-
- pipe_reference_init(&buffer->base.reference, 1);
- buffer->base.alignment = alignment;
- buffer->base.usage = usage;
- buffer->base.size = size;
-
- buffer->data = align_malloc(size, alignment);
-
- return &buffer->base;
-}
-
-
-/**
- * Create buffer which wraps user-space data.
- */
-static struct pipe_buffer *
-st_softpipe_user_buffer_create(struct pipe_winsys *winsys,
- void *ptr,
- unsigned bytes)
-{
- struct st_softpipe_buffer *buffer;
-
- buffer = CALLOC_STRUCT(st_softpipe_buffer);
- if(!buffer)
- return NULL;
-
- pipe_reference_init(&buffer->base.reference, 1);
- buffer->base.size = bytes;
- buffer->userBuffer = TRUE;
- buffer->data = ptr;
-
- return &buffer->base;
-}
-
-
-static struct pipe_buffer *
-st_softpipe_surface_buffer_create(struct pipe_winsys *winsys,
- unsigned width, unsigned height,
- enum pipe_format format,
- unsigned usage,
- unsigned tex_usage,
- unsigned *stride)
-{
- const unsigned alignment = 64;
- unsigned nblocksy;
-
- nblocksy = util_format_get_nblocksy(format, height);
- *stride = align(util_format_get_stride(format, width), alignment);
-
- return winsys->buffer_create(winsys, alignment,
- usage,
- *stride * nblocksy);
-}
-
-
-static void
-st_softpipe_fence_reference(struct pipe_winsys *winsys,
- struct pipe_fence_handle **ptr,
- struct pipe_fence_handle *fence)
-{
-}
-
-
-static int
-st_softpipe_fence_signalled(struct pipe_winsys *winsys,
- struct pipe_fence_handle *fence,
- unsigned flag)
-{
- return 0;
-}
-
-
-static int
-st_softpipe_fence_finish(struct pipe_winsys *winsys,
- struct pipe_fence_handle *fence,
- unsigned flag)
-{
- return 0;
-}
-
-
-static void
-st_softpipe_destroy(struct pipe_winsys *winsys)
-{
- FREE(winsys);
-}
-
-
-struct pipe_screen *
-softpipe_create_screen_malloc(void)
-{
- static struct pipe_winsys *winsys;
- struct pipe_screen *screen;
-
- winsys = CALLOC_STRUCT(pipe_winsys);
- if(!winsys)
- return NULL;
-
- winsys->destroy = st_softpipe_destroy;
-
- winsys->buffer_create = st_softpipe_buffer_create;
- winsys->user_buffer_create = st_softpipe_user_buffer_create;
- winsys->buffer_map = st_softpipe_buffer_map;
- winsys->buffer_unmap = st_softpipe_buffer_unmap;
- winsys->buffer_destroy = st_softpipe_buffer_destroy;
-
- winsys->surface_buffer_create = st_softpipe_surface_buffer_create;
-
- winsys->fence_reference = st_softpipe_fence_reference;
- winsys->fence_signalled = st_softpipe_fence_signalled;
- winsys->fence_finish = st_softpipe_fence_finish;
-
- winsys->flush_frontbuffer = st_softpipe_flush_frontbuffer;
- winsys->get_name = st_softpipe_get_name;
-
- screen = softpipe_create_screen(winsys);
- if(!screen)
- st_softpipe_destroy(winsys);
-
- return screen;
-}
diff --git a/src/gallium/drivers/svga/svga_context.c b/src/gallium/drivers/svga/svga_context.c
index d499ae6acc..adb7840182 100644
--- a/src/gallium/drivers/svga/svga_context.c
+++ b/src/gallium/drivers/svga/svga_context.c
@@ -164,6 +164,8 @@ struct pipe_context *svga_context_create( struct pipe_screen *screen,
svga_init_constbuffer_functions(svga);
svga_init_query_functions(svga);
+ svga_init_texture_functions(&svga->pipe);
+
/* debug */
svga->debug.no_swtnl = debug_get_bool_option("SVGA_NO_SWTNL", FALSE);
svga->debug.force_swtnl = debug_get_bool_option("SVGA_FORCE_SWTNL", FALSE);
diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h
index 03302e2a6e..1f66437dfe 100644
--- a/src/gallium/drivers/svga/svga_context.h
+++ b/src/gallium/drivers/svga/svga_context.h
@@ -169,6 +169,11 @@ struct svga_sampler_state {
unsigned view_max_lod;
};
+struct svga_velems_state {
+ unsigned count;
+ struct pipe_vertex_element velem[PIPE_MAX_ATTRIBS];
+};
+
/* Use to calculate differences between state emitted to hardware and
* current driver-calculated state.
*/
@@ -178,13 +183,13 @@ struct svga_state
const struct svga_depth_stencil_state *depth;
const struct svga_rasterizer_state *rast;
const struct svga_sampler_state *sampler[PIPE_MAX_SAMPLERS];
+ const struct svga_velems_state *velems;
- struct pipe_texture *texture[PIPE_MAX_SAMPLERS]; /* or texture ID's? */
+ struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS]; /* or texture ID's? */
struct svga_fragment_shader *fs;
struct svga_vertex_shader *vs;
struct pipe_vertex_buffer vb[PIPE_MAX_ATTRIBS];
- struct pipe_vertex_element ve[PIPE_MAX_ATTRIBS];
struct pipe_buffer *cb[PIPE_SHADER_TYPES];
struct pipe_framebuffer_state framebuffer;
@@ -203,8 +208,7 @@ struct svga_state
struct pipe_viewport_state viewport;
unsigned num_samplers;
- unsigned num_textures;
- unsigned num_vertex_elements;
+ unsigned num_sampler_views;
unsigned num_vertex_buffers;
unsigned reduced_prim;
diff --git a/src/gallium/drivers/svga/svga_pipe_clear.c b/src/gallium/drivers/svga/svga_pipe_clear.c
index 8483a3fad7..bb1664fbed 100644
--- a/src/gallium/drivers/svga/svga_pipe_clear.c
+++ b/src/gallium/drivers/svga/svga_pipe_clear.c
@@ -63,7 +63,7 @@ try_clear(struct svga_context *svga,
if ((buffers & PIPE_CLEAR_DEPTHSTENCIL) && fb->zsbuf) {
flags |= SVGA3D_CLEAR_DEPTH;
- if (svga->curr.framebuffer.zsbuf->format == PIPE_FORMAT_S8Z24_UNORM)
+ if (svga->curr.framebuffer.zsbuf->format == PIPE_FORMAT_S8_USCALED_Z24_UNORM)
flags |= SVGA3D_CLEAR_STENCIL;
rect.w = MAX2(rect.w, fb->zsbuf->width);
diff --git a/src/gallium/drivers/svga/svga_pipe_misc.c b/src/gallium/drivers/svga/svga_pipe_misc.c
index 95bf0e6f91..2c43f9a24f 100644
--- a/src/gallium/drivers/svga/svga_pipe_misc.c
+++ b/src/gallium/drivers/svga/svga_pipe_misc.c
@@ -118,9 +118,9 @@ static void svga_set_framebuffer_state(struct pipe_context *pipe,
case PIPE_FORMAT_Z16_UNORM:
svga->curr.depthscale = 1.0f / DEPTH_BIAS_SCALE_FACTOR_D16;
break;
- case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
case PIPE_FORMAT_Z24X8_UNORM:
- case PIPE_FORMAT_S8Z24_UNORM:
+ case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
case PIPE_FORMAT_X8Z24_UNORM:
svga->curr.depthscale = 1.0f / DEPTH_BIAS_SCALE_FACTOR_D24S8;
break;
diff --git a/src/gallium/drivers/svga/svga_pipe_sampler.c b/src/gallium/drivers/svga/svga_pipe_sampler.c
index acba2b8f9d..82d525ca33 100644
--- a/src/gallium/drivers/svga/svga_pipe_sampler.c
+++ b/src/gallium/drivers/svga/svga_pipe_sampler.c
@@ -155,7 +155,7 @@ static void svga_bind_sampler_states(struct pipe_context *pipe,
/* Check for no-op */
if (num == svga->curr.num_samplers &&
!memcmp(svga->curr.sampler, sampler, num * sizeof(void *))) {
- debug_printf("sampler noop\n");
+ if (0) debug_printf("sampler noop\n");
return;
}
@@ -176,9 +176,36 @@ static void svga_delete_sampler_state(struct pipe_context *pipe,
}
-static void svga_set_sampler_textures(struct pipe_context *pipe,
- unsigned num,
- struct pipe_texture **texture)
+static struct pipe_sampler_view *
+svga_create_sampler_view(struct pipe_context *pipe,
+ struct pipe_texture *texture,
+ const struct pipe_sampler_view *templ)
+{
+ struct pipe_sampler_view *view = CALLOC_STRUCT(pipe_sampler_view);
+
+ if (view) {
+ *view = *templ;
+ view->reference.count = 1;
+ view->texture = NULL;
+ pipe_texture_reference(&view->texture, texture);
+ view->context = pipe;
+ }
+
+ return view;
+}
+
+
+static void
+svga_sampler_view_destroy(struct pipe_context *pipe,
+ struct pipe_sampler_view *view)
+{
+ pipe_texture_reference(&view->texture, NULL);
+ FREE(view);
+}
+
+static void svga_set_sampler_views(struct pipe_context *pipe,
+ unsigned num,
+ struct pipe_sampler_view **views)
{
struct svga_context *svga = svga_context(pipe);
unsigned flag_1d = 0;
@@ -188,31 +215,31 @@ static void svga_set_sampler_textures(struct pipe_context *pipe,
assert(num <= PIPE_MAX_SAMPLERS);
/* Check for no-op */
- if (num == svga->curr.num_textures &&
- !memcmp(svga->curr.texture, texture, num * sizeof(struct pipe_texture *))) {
+ if (num == svga->curr.num_sampler_views &&
+ !memcmp(svga->curr.sampler_views, views, num * sizeof(struct pipe_sampler_view *))) {
if (0) debug_printf("texture noop\n");
return;
}
for (i = 0; i < num; i++) {
- pipe_texture_reference(&svga->curr.texture[i],
- texture[i]);
+ pipe_sampler_view_reference(&svga->curr.sampler_views[i],
+ views[i]);
- if (!texture[i])
+ if (!views[i])
continue;
- if (texture[i]->format == PIPE_FORMAT_B8G8R8A8_SRGB)
+ if (views[i]->texture->format == PIPE_FORMAT_B8G8R8A8_SRGB)
flag_srgb |= 1 << i;
- if (texture[i]->target == PIPE_TEXTURE_1D)
+ if (views[i]->texture->target == PIPE_TEXTURE_1D)
flag_1d |= 1 << i;
}
- for (i = num; i < svga->curr.num_textures; i++)
- pipe_texture_reference(&svga->curr.texture[i],
- NULL);
+ for (i = num; i < svga->curr.num_sampler_views; i++)
+ pipe_sampler_view_reference(&svga->curr.sampler_views[i],
+ NULL);
- svga->curr.num_textures = num;
+ svga->curr.num_sampler_views = num;
svga->dirty |= SVGA_NEW_TEXTURE_BINDING;
if (flag_srgb != svga->curr.tex_flags.flag_srgb ||
@@ -231,7 +258,9 @@ void svga_init_sampler_functions( struct svga_context *svga )
svga->pipe.create_sampler_state = svga_create_sampler_state;
svga->pipe.bind_fragment_sampler_states = svga_bind_sampler_states;
svga->pipe.delete_sampler_state = svga_delete_sampler_state;
- svga->pipe.set_fragment_sampler_textures = svga_set_sampler_textures;
+ svga->pipe.set_fragment_sampler_views = svga_set_sampler_views;
+ svga->pipe.create_sampler_view = svga_create_sampler_view;
+ svga->pipe.sampler_view_destroy = svga_sampler_view_destroy;
}
diff --git a/src/gallium/drivers/svga/svga_pipe_vertex.c b/src/gallium/drivers/svga/svga_pipe_vertex.c
index 836b8441da..1715a47fc6 100644
--- a/src/gallium/drivers/svga/svga_pipe_vertex.c
+++ b/src/gallium/drivers/svga/svga_pipe_vertex.c
@@ -26,6 +26,7 @@
#include "util/u_inlines.h"
#include "pipe/p_defines.h"
#include "util/u_math.h"
+#include "util/u_memory.h"
#include "tgsi/tgsi_parse.h"
#include "svga_screen.h"
@@ -64,20 +65,37 @@ static void svga_set_vertex_buffers(struct pipe_context *pipe,
svga->dirty |= SVGA_NEW_VBUFFER;
}
-static void svga_set_vertex_elements(struct pipe_context *pipe,
- unsigned count,
- const struct pipe_vertex_element *elements)
+
+static void *
+svga_create_vertex_elements_state(struct pipe_context *pipe,
+ unsigned count,
+ const struct pipe_vertex_element *attribs)
{
- struct svga_context *svga = svga_context(pipe);
- unsigned i;
+ struct svga_velems_state *velems;
+ assert(count <= PIPE_MAX_ATTRIBS);
+ velems = (struct svga_velems_state *) MALLOC(sizeof(struct svga_velems_state));
+ if (velems) {
+ velems->count = count;
+ memcpy(velems->velem, attribs, sizeof(*attribs) * count);
+ }
+ return velems;
+}
- for (i = 0; i < count; i++)
- svga->curr.ve[i] = elements[i];
+static void svga_bind_vertex_elements_state(struct pipe_context *pipe,
+ void *velems)
+{
+ struct svga_context *svga = svga_context(pipe);
+ struct svga_velems_state *svga_velems = (struct svga_velems_state *) velems;
- svga->curr.num_vertex_elements = count;
+ svga->curr.velems = svga_velems;
svga->dirty |= SVGA_NEW_VELEMENT;
}
+static void svga_delete_vertex_elements_state(struct pipe_context *pipe,
+ void *velems)
+{
+ FREE(velems);
+}
void svga_cleanup_vertex_state( struct svga_context *svga )
{
@@ -91,7 +109,9 @@ void svga_cleanup_vertex_state( struct svga_context *svga )
void svga_init_vertex_functions( struct svga_context *svga )
{
svga->pipe.set_vertex_buffers = svga_set_vertex_buffers;
- svga->pipe.set_vertex_elements = svga_set_vertex_elements;
+ svga->pipe.create_vertex_elements_state = svga_create_vertex_elements_state;
+ svga->pipe.bind_vertex_elements_state = svga_bind_vertex_elements_state;
+ svga->pipe.delete_vertex_elements_state = svga_delete_vertex_elements_state;
}
diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
index 6022c38cfc..9a2e7c6f5b 100644
--- a/src/gallium/drivers/svga/svga_screen.c
+++ b/src/gallium/drivers/svga/svga_screen.c
@@ -210,7 +210,7 @@ svga_translate_format_cap(enum pipe_format format)
case PIPE_FORMAT_Z16_UNORM:
return SVGA3D_DEVCAP_SURFACEFMT_Z_D16;
- case PIPE_FORMAT_S8Z24_UNORM:
+ case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
return SVGA3D_DEVCAP_SURFACEFMT_Z_D24S8;
case PIPE_FORMAT_X8Z24_UNORM:
return SVGA3D_DEVCAP_SURFACEFMT_Z_D24X8;
diff --git a/src/gallium/drivers/svga/svga_screen_texture.c b/src/gallium/drivers/svga/svga_screen_texture.c
index e9792e063e..811c746695 100644
--- a/src/gallium/drivers/svga/svga_screen_texture.c
+++ b/src/gallium/drivers/svga/svga_screen_texture.c
@@ -41,8 +41,6 @@
#include "svga_debug.h"
#include "svga_screen_buffer.h"
-#include <util/u_string.h>
-
/* XXX: This isn't a real hardware flag, but just a hack for kernel to
* know about primary surfaces. Find a better way to accomplish this.
@@ -83,7 +81,7 @@ svga_translate_format(enum pipe_format format)
*/
case PIPE_FORMAT_Z16_UNORM:
return SVGA3D_Z_D16;
- case PIPE_FORMAT_S8Z24_UNORM:
+ case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
return SVGA3D_Z_D24S8;
case PIPE_FORMAT_X8Z24_UNORM:
return SVGA3D_Z_D24X8;
@@ -116,7 +114,7 @@ svga_translate_format_render(enum pipe_format format)
case PIPE_FORMAT_B5G5R5A1_UNORM:
case PIPE_FORMAT_B4G4R4A4_UNORM:
case PIPE_FORMAT_B5G6R5_UNORM:
- case PIPE_FORMAT_S8Z24_UNORM:
+ case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
case PIPE_FORMAT_X8Z24_UNORM:
case PIPE_FORMAT_Z32_UNORM:
case PIPE_FORMAT_Z16_UNORM:
@@ -315,7 +313,11 @@ svga_texture_create(struct pipe_screen *screen,
tex->key.cachable = 0;
}
- if(templat->tex_usage & PIPE_TEXTURE_USAGE_PRIMARY) {
+ if(templat->tex_usage & PIPE_TEXTURE_USAGE_SHARED) {
+ tex->key.cachable = 0;
+ }
+
+ if(templat->tex_usage & PIPE_TEXTURE_USAGE_SCANOUT) {
tex->key.flags |= SVGA3D_SURFACE_HINT_SCANOUT;
tex->key.cachable = 0;
}
@@ -328,7 +330,7 @@ svga_texture_create(struct pipe_screen *screen,
*/
#if 0
if((templat->tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET) &&
- !util_format_is_compressed(templat->format))
+ !util_format_is_s3tc(templat->format))
tex->key.flags |= SVGA3D_SURFACE_HINT_RENDERTARGET;
#endif
@@ -355,80 +357,18 @@ error1:
}
-static struct pipe_texture *
-svga_texture_blanket(struct pipe_screen * screen,
- const struct pipe_texture *base,
- const unsigned *stride,
- struct pipe_buffer *buffer)
-{
- struct svga_texture *tex;
- struct svga_buffer *sbuf = svga_buffer(buffer);
- struct svga_winsys_screen *sws = svga_winsys_screen(screen);
- assert(screen);
-
- /* Only supports one type */
- if (base->target != PIPE_TEXTURE_2D ||
- base->last_level != 0 ||
- base->depth0 != 1) {
- return NULL;
- }
-
- /**
- * We currently can't do texture blanket on
- * SVGA3D_BUFFER. Need to blit to a temporary surface?
- */
-
- assert(sbuf->handle);
- if (!sbuf->handle)
- return NULL;
-
- if (svga_translate_format(base->format) != sbuf->key.format) {
- unsigned f1 = svga_translate_format(base->format);
- unsigned f2 = sbuf->key.format;
-
- /* It's okay for XRGB and ARGB or depth with/out stencil to get mixed up */
- if ( !( (f1 == SVGA3D_X8R8G8B8 && f2 == SVGA3D_A8R8G8B8) ||
- (f1 == SVGA3D_A8R8G8B8 && f2 == SVGA3D_X8R8G8B8) ||
- (f1 == SVGA3D_Z_D24X8 && f2 == SVGA3D_Z_D24S8) ) ) {
- debug_printf("%s wrong format %u != %u\n", __FUNCTION__, f1, f2);
- return NULL;
- }
- }
-
- tex = CALLOC_STRUCT(svga_texture);
- if (!tex)
- return NULL;
-
- tex->base = *base;
-
-
- if (sbuf->key.format == 1)
- tex->base.format = PIPE_FORMAT_B8G8R8X8_UNORM;
- else if (sbuf->key.format == 2)
- tex->base.format = PIPE_FORMAT_B8G8R8A8_UNORM;
-
- pipe_reference_init(&tex->base.reference, 1);
- tex->base.screen = screen;
-
- SVGA_DBG(DEBUG_DMA, "blanket sid %p\n", sbuf->handle);
- /* We don't own this storage, so don't try to cache it.
- */
- assert(sbuf->key.cachable == 0);
- tex->key.cachable = 0;
- sws->surface_reference(sws, &tex->handle, sbuf->handle);
- return &tex->base;
-}
-
-struct pipe_texture *
-svga_screen_texture_wrap_surface(struct pipe_screen *screen,
- struct pipe_texture *base,
- enum SVGA3dSurfaceFormat format,
- struct svga_winsys_surface *srf)
+static struct pipe_texture *
+svga_screen_texture_from_handle(struct pipe_screen *screen,
+ const struct pipe_texture *base,
+ struct winsys_handle *whandle)
{
+ struct svga_winsys_screen *sws = svga_winsys_screen(screen);
+ struct svga_winsys_surface *srf;
struct svga_texture *tex;
+ enum SVGA3dSurfaceFormat format = 0;
assert(screen);
/* Only supports one type */
@@ -438,6 +378,8 @@ svga_screen_texture_wrap_surface(struct pipe_screen *screen,
return NULL;
}
+ srf = sws->surface_from_handle(sws, whandle, &format);
+
if (!srf)
return NULL;
@@ -478,6 +420,22 @@ svga_screen_texture_wrap_surface(struct pipe_screen *screen,
}
+static boolean
+svga_screen_texture_get_handle(struct pipe_screen *screen,
+ struct pipe_texture *texture,
+ struct winsys_handle *whandle)
+{
+ struct svga_winsys_screen *sws = svga_winsys_screen(texture->screen);
+ unsigned stride;
+
+ assert(svga_texture(texture)->key.cachable == 0);
+ svga_texture(texture)->key.cachable = 0;
+ stride = util_format_get_nblocksx(texture->format, texture->width0) *
+ util_format_get_blocksize(texture->format);
+ return sws->surface_get_handle(sws, svga_texture(texture)->handle, stride, whandle);
+}
+
+
static void
svga_texture_destroy(struct pipe_texture *pt)
{
@@ -823,15 +781,17 @@ svga_surface_needs_propagation(struct pipe_surface *surf)
return s->dirty && s->handle != tex->handle;
}
-
+/* XXX: Still implementing this as if it was a screen function, but
+ * can now modify it to queue transfers on the context.
+ */
static struct pipe_transfer *
-svga_get_tex_transfer(struct pipe_screen *screen,
- struct pipe_texture *texture,
- unsigned face, unsigned level, unsigned zslice,
- enum pipe_transfer_usage usage, unsigned x, unsigned y,
- unsigned w, unsigned h)
+svga_get_tex_transfer(struct pipe_context *pipe,
+ struct pipe_texture *texture,
+ unsigned face, unsigned level, unsigned zslice,
+ enum pipe_transfer_usage usage, unsigned x, unsigned y,
+ unsigned w, unsigned h)
{
- struct svga_screen *ss = svga_screen(screen);
+ struct svga_screen *ss = svga_screen(pipe->screen);
struct svga_winsys_screen *sws = ss->sws;
struct svga_transfer *st;
unsigned nblocksx = util_format_get_nblocksx(texture->format, w);
@@ -899,11 +859,14 @@ no_hwbuf:
}
+/* XXX: Still implementing this as if it was a screen function, but
+ * can now modify it to queue transfers on the context.
+ */
static void *
-svga_transfer_map( struct pipe_screen *screen,
+svga_transfer_map( struct pipe_context *pipe,
struct pipe_transfer *transfer )
{
- struct svga_screen *ss = svga_screen(screen);
+ struct svga_screen *ss = svga_screen(pipe->screen);
struct svga_winsys_screen *sws = ss->sws;
struct svga_transfer *st = svga_transfer(transfer);
@@ -917,11 +880,14 @@ svga_transfer_map( struct pipe_screen *screen,
}
+/* XXX: Still implementing this as if it was a screen function, but
+ * can now modify it to queue transfers on the context.
+ */
static void
-svga_transfer_unmap(struct pipe_screen *screen,
+svga_transfer_unmap(struct pipe_context *pipe,
struct pipe_transfer *transfer)
{
- struct svga_screen *ss = svga_screen(screen);
+ struct svga_screen *ss = svga_screen(pipe->screen);
struct svga_winsys_screen *sws = ss->sws;
struct svga_transfer *st = svga_transfer(transfer);
@@ -931,10 +897,11 @@ svga_transfer_unmap(struct pipe_screen *screen,
static void
-svga_tex_transfer_destroy(struct pipe_transfer *transfer)
+svga_tex_transfer_destroy(struct pipe_context *pipe,
+ struct pipe_transfer *transfer)
{
struct svga_texture *tex = svga_texture(transfer->texture);
- struct svga_screen *ss = svga_screen(transfer->texture->screen);
+ struct svga_screen *ss = svga_screen(pipe->screen);
struct svga_winsys_screen *sws = ss->sws;
struct svga_transfer *st = svga_transfer(transfer);
@@ -951,18 +918,26 @@ svga_tex_transfer_destroy(struct pipe_transfer *transfer)
FREE(st);
}
+
+void
+svga_init_texture_functions(struct pipe_context *pipe)
+{
+ pipe->get_tex_transfer = svga_get_tex_transfer;
+ pipe->transfer_map = svga_transfer_map;
+ pipe->transfer_unmap = svga_transfer_unmap;
+ pipe->tex_transfer_destroy = svga_tex_transfer_destroy;
+}
+
+
void
svga_screen_init_texture_functions(struct pipe_screen *screen)
{
screen->texture_create = svga_texture_create;
+ screen->texture_from_handle = svga_screen_texture_from_handle;
+ screen->texture_get_handle = svga_screen_texture_get_handle;
screen->texture_destroy = svga_texture_destroy;
screen->get_tex_surface = svga_get_tex_surface;
screen->tex_surface_destroy = svga_tex_surface_destroy;
- screen->texture_blanket = svga_texture_blanket;
- screen->get_tex_transfer = svga_get_tex_transfer;
- screen->transfer_map = svga_transfer_map;
- screen->transfer_unmap = svga_transfer_unmap;
- screen->tex_transfer_destroy = svga_tex_transfer_destroy;
}
/***********************************************************************
@@ -994,7 +969,7 @@ svga_get_tex_sampler_view(struct pipe_context *pipe, struct pipe_texture *pt,
if (min_lod == 0 && max_lod >= pt->last_level)
view = FALSE;
- if (util_format_is_compressed(pt->format) && view) {
+ if (util_format_is_s3tc(pt->format) && view) {
format = svga_translate_format_render(pt->format);
}
@@ -1120,33 +1095,3 @@ svga_destroy_sampler_view_priv(struct svga_sampler_view *v)
pipe_texture_reference(&v->texture, NULL);
FREE(v);
}
-
-boolean
-svga_screen_buffer_from_texture(struct pipe_texture *texture,
- struct pipe_buffer **buffer,
- unsigned *stride)
-{
- struct svga_texture *stex = svga_texture(texture);
-
- *buffer = svga_screen_buffer_wrap_surface
- (texture->screen,
- svga_translate_format(texture->format),
- stex->handle);
-
- *stride = util_format_get_stride(texture->format, texture->width0);
-
- return *buffer != NULL;
-}
-
-
-struct svga_winsys_surface *
-svga_screen_texture_get_winsys_surface(struct pipe_texture *texture)
-{
- struct svga_winsys_screen *sws = svga_winsys_screen(texture->screen);
- struct svga_winsys_surface *vsurf = NULL;
-
- assert(svga_texture(texture)->key.cachable == 0);
- svga_texture(texture)->key.cachable = 0;
- sws->surface_reference(sws, &vsurf, svga_texture(texture)->handle);
- return vsurf;
-}
diff --git a/src/gallium/drivers/svga/svga_screen_texture.h b/src/gallium/drivers/svga/svga_screen_texture.h
index 24c1f78ca5..96d035b12d 100644
--- a/src/gallium/drivers/svga/svga_screen_texture.h
+++ b/src/gallium/drivers/svga/svga_screen_texture.h
@@ -78,7 +78,7 @@ struct svga_texture
{
struct pipe_texture base;
- boolean defined[6][PIPE_MAX_TEXTURE_LEVELS];
+ boolean defined[6][SVGA_MAX_TEXTURE_LEVELS];
struct svga_sampler_view *cached_view;
@@ -186,6 +186,9 @@ svga_surface_needs_propagation(struct pipe_surface *surf);
extern void
svga_screen_init_texture_functions(struct pipe_screen *screen);
+void
+svga_init_texture_functions(struct pipe_context *pipe);
+
enum SVGA3dSurfaceFormat
svga_translate_format(enum pipe_format format);
diff --git a/src/gallium/drivers/svga/svga_state_constants.c b/src/gallium/drivers/svga/svga_state_constants.c
index bb92f818ea..493f78a990 100644
--- a/src/gallium/drivers/svga/svga_state_constants.c
+++ b/src/gallium/drivers/svga/svga_state_constants.c
@@ -137,7 +137,7 @@ static int emit_fs_consts( struct svga_context *svga,
for (i = 0; i < key->num_textures; i++) {
if (key->tex[i].unnormalized) {
- struct pipe_texture *tex = svga->curr.texture[i];
+ struct pipe_texture *tex = svga->curr.sampler_views[i]->texture;
float data[4];
data[0] = 1.0 / (float)tex->width0;
diff --git a/src/gallium/drivers/svga/svga_state_framebuffer.c b/src/gallium/drivers/svga/svga_state_framebuffer.c
index b710914acd..bd92f00343 100644
--- a/src/gallium/drivers/svga/svga_state_framebuffer.c
+++ b/src/gallium/drivers/svga/svga_state_framebuffer.c
@@ -70,7 +70,7 @@ static int emit_framebuffer( struct svga_context *svga,
return ret;
if (curr->zsbuf &&
- curr->zsbuf->format == PIPE_FORMAT_S8Z24_UNORM) {
+ curr->zsbuf->format == PIPE_FORMAT_S8_USCALED_Z24_UNORM) {
ret = SVGA3D_SetRenderTarget(svga->swc, SVGA3D_RT_STENCIL, curr->zsbuf);
if (ret != PIPE_OK)
return ret;
diff --git a/src/gallium/drivers/svga/svga_state_fs.c b/src/gallium/drivers/svga/svga_state_fs.c
index 2973444d0a..1310fd9825 100644
--- a/src/gallium/drivers/svga/svga_state_fs.c
+++ b/src/gallium/drivers/svga/svga_state_fs.c
@@ -158,10 +158,11 @@ static int make_fs_key( const struct svga_context *svga,
*
* SVGA_NEW_TEXTURE_BINDING | SVGA_NEW_SAMPLER
*/
- for (i = 0; i < svga->curr.num_textures; i++) {
- if (svga->curr.texture[i]) {
+ for (i = 0; i < svga->curr.num_sampler_views; i++) {
+ if (svga->curr.sampler_views[i]) {
assert(svga->curr.sampler[i]);
- key->tex[i].texture_target = svga->curr.texture[i]->target;
+ assert(svga->curr.sampler_views[i]->texture);
+ key->tex[i].texture_target = svga->curr.sampler_views[i]->texture->target;
if (!svga->curr.sampler[i]->normalized_coords) {
key->tex[i].width_height_idx = idx++;
key->tex[i].unnormalized = TRUE;
@@ -169,7 +170,7 @@ static int make_fs_key( const struct svga_context *svga,
}
}
}
- key->num_textures = svga->curr.num_textures;
+ key->num_textures = svga->curr.num_sampler_views;
idx = 0;
for (i = 0; i < svga->curr.num_samplers; ++i) {
diff --git a/src/gallium/drivers/svga/svga_state_need_swtnl.c b/src/gallium/drivers/svga/svga_state_need_swtnl.c
index d774e3e504..dfaab53aef 100644
--- a/src/gallium/drivers/svga/svga_state_need_swtnl.c
+++ b/src/gallium/drivers/svga/svga_state_need_swtnl.c
@@ -76,8 +76,13 @@ static int update_need_swvfetch( struct svga_context *svga,
unsigned i;
boolean need_swvfetch = FALSE;
- for (i = 0; i < svga->curr.num_vertex_elements; i++) {
- svga->state.sw.ve_format[i] = svga_translate_vertex_format(svga->curr.ve[i].src_format);
+ if (!svga->curr.velems) {
+ /* No vertex elements bound. */
+ return 0;
+ }
+
+ for (i = 0; i < svga->curr.velems->count; i++) {
+ svga->state.sw.ve_format[i] = svga_translate_vertex_format(svga->curr.velems->velem[i].src_format);
if (svga->state.sw.ve_format[i] == SVGA3D_DECLTYPE_MAX) {
need_swvfetch = TRUE;
break;
diff --git a/src/gallium/drivers/svga/svga_state_rss.c b/src/gallium/drivers/svga/svga_state_rss.c
index 107cc403b4..b7195d246b 100644
--- a/src/gallium/drivers/svga/svga_state_rss.c
+++ b/src/gallium/drivers/svga/svga_state_rss.c
@@ -191,15 +191,24 @@ static int emit_rss( struct svga_context *svga,
EMIT_RS( svga, svga->curr.stencil_ref.ref_value[0], STENCILREF, fail );
}
- if (dirty & SVGA_NEW_RAST)
+ if (dirty & (SVGA_NEW_RAST | SVGA_NEW_NEED_PIPELINE))
{
const struct svga_rasterizer_state *curr = svga->curr.rast;
+ unsigned cullmode = curr->cullmode;
/* Shademode: still need to rearrange index list to move
* flat-shading PV first vertex.
*/
EMIT_RS( svga, curr->shademode, SHADEMODE, fail );
- EMIT_RS( svga, curr->cullmode, CULLMODE, fail );
+
+ /* Don't do culling while the software pipeline is active. It
+ * does it for us, and additionally introduces potentially
+ * back-facing triangles.
+ */
+ if (svga->state.sw.need_pipeline)
+ cullmode = SVGA3D_FACE_NONE;
+
+ EMIT_RS( svga, cullmode, CULLMODE, fail );
EMIT_RS( svga, curr->scissortestenable, SCISSORTESTENABLE, fail );
EMIT_RS( svga, curr->multisampleantialias, MULTISAMPLEANTIALIAS, fail );
EMIT_RS( svga, curr->lastpixel, LASTPIXEL, fail );
diff --git a/src/gallium/drivers/svga/svga_state_tss.c b/src/gallium/drivers/svga/svga_state_tss.c
index 17b4785978..c08ec7c2e8 100644
--- a/src/gallium/drivers/svga/svga_state_tss.c
+++ b/src/gallium/drivers/svga/svga_state_tss.c
@@ -37,14 +37,14 @@
void svga_cleanup_tss_binding(struct svga_context *svga)
{
int i;
- unsigned count = MAX2( svga->curr.num_textures,
+ unsigned count = MAX2( svga->curr.num_sampler_views,
svga->state.hw_draw.num_views );
for (i = 0; i < count; i++) {
struct svga_hw_view_state *view = &svga->state.hw_draw.views[i];
svga_sampler_view_reference(&view->v, NULL);
- pipe_texture_reference( &svga->curr.texture[i], NULL );
+ pipe_sampler_view_reference( &svga->curr.sampler_views[i], NULL );
pipe_texture_reference( &view->texture, NULL );
view->dirty = 1;
@@ -57,7 +57,7 @@ update_tss_binding(struct svga_context *svga,
unsigned dirty )
{
unsigned i;
- unsigned count = MAX2( svga->curr.num_textures,
+ unsigned count = MAX2( svga->curr.num_sampler_views,
svga->state.hw_draw.num_views );
unsigned min_lod;
unsigned max_lod;
@@ -77,30 +77,32 @@ update_tss_binding(struct svga_context *svga,
for (i = 0; i < count; i++) {
const struct svga_sampler_state *s = svga->curr.sampler[i];
struct svga_hw_view_state *view = &svga->state.hw_draw.views[i];
+ struct pipe_texture *texture = NULL;
/* get min max lod */
- if (svga->curr.texture[i]) {
+ if (svga->curr.sampler_views[i]) {
min_lod = MAX2(s->view_min_lod, 0);
- max_lod = MIN2(s->view_max_lod, svga->curr.texture[i]->last_level);
+ max_lod = MIN2(s->view_max_lod, svga->curr.sampler_views[i]->texture->last_level);
+ texture = svga->curr.sampler_views[i]->texture;
} else {
min_lod = 0;
max_lod = 0;
}
- if (view->texture != svga->curr.texture[i] ||
+ if (view->texture != texture ||
view->min_lod != min_lod ||
view->max_lod != max_lod) {
svga_sampler_view_reference(&view->v, NULL);
- pipe_texture_reference( &view->texture, svga->curr.texture[i] );
+ pipe_texture_reference( &view->texture, texture );
view->dirty = TRUE;
view->min_lod = min_lod;
view->max_lod = max_lod;
- if (svga->curr.texture[i])
+ if (texture)
view->v = svga_get_tex_sampler_view(&svga->pipe,
- svga->curr.texture[i],
+ texture,
min_lod,
max_lod);
}
@@ -115,7 +117,7 @@ update_tss_binding(struct svga_context *svga,
}
}
- svga->state.hw_draw.num_views = svga->curr.num_textures;
+ svga->state.hw_draw.num_views = svga->curr.num_sampler_views;
if (queue.bind_count) {
SVGA3dTextureState *ts;
diff --git a/src/gallium/drivers/svga/svga_state_vdecl.c b/src/gallium/drivers/svga/svga_state_vdecl.c
index ded903170b..f531e22304 100644
--- a/src/gallium/drivers/svga/svga_state_vdecl.c
+++ b/src/gallium/drivers/svga/svga_state_vdecl.c
@@ -95,17 +95,17 @@ upload_user_buffers( struct svga_context *svga )
static int emit_hw_vs_vdecl( struct svga_context *svga,
unsigned dirty )
{
- const struct pipe_vertex_element *ve = svga->curr.ve;
+ const struct pipe_vertex_element *ve = svga->curr.velems->velem;
SVGA3dVertexDecl decl;
unsigned i;
- assert(svga->curr.num_vertex_elements >=
+ assert(svga->curr.velems->count >=
svga->curr.vs->base.info.file_count[TGSI_FILE_INPUT]);
svga_hwtnl_reset_vdecl( svga->hwtnl,
- svga->curr.num_vertex_elements );
+ svga->curr.velems->count );
- for (i = 0; i < svga->curr.num_vertex_elements; i++) {
+ for (i = 0; i < svga->curr.velems->count; i++) {
const struct pipe_vertex_buffer *vb = &svga->curr.vb[ve[i].vertex_buffer_index];
unsigned usage, index;
diff --git a/src/gallium/drivers/svga/svga_state_vs.c b/src/gallium/drivers/svga/svga_state_vs.c
index d7999fe53d..781f7bf533 100644
--- a/src/gallium/drivers/svga/svga_state_vs.c
+++ b/src/gallium/drivers/svga/svga_state_vs.c
@@ -186,8 +186,8 @@ static int update_zero_stride( struct svga_context *svga,
svga->curr.zero_stride_vertex_elements = 0;
svga->curr.num_zero_stride_vertex_elements = 0;
- for (i = 0; i < svga->curr.num_vertex_elements; i++) {
- const struct pipe_vertex_element *vel = &svga->curr.ve[i];
+ for (i = 0; i < svga->curr.velems->count; i++) {
+ const struct pipe_vertex_element *vel = &svga->curr.velems->velem[i];
const struct pipe_vertex_buffer *vbuffer = &svga->curr.vb[
vel->vertex_buffer_index];
if (vbuffer->stride == 0) {
diff --git a/src/gallium/drivers/svga/svga_swtnl_state.c b/src/gallium/drivers/svga/svga_swtnl_state.c
index 35f36a828f..246d34e649 100644
--- a/src/gallium/drivers/svga/svga_swtnl_state.c
+++ b/src/gallium/drivers/svga/svga_swtnl_state.c
@@ -99,8 +99,8 @@ static int update_swtnl_draw( struct svga_context *svga,
if (dirty & SVGA_NEW_VELEMENT)
draw_set_vertex_elements(svga->swtnl.draw,
- svga->curr.num_vertex_elements,
- svga->curr.ve );
+ svga->curr.velems->count,
+ svga->curr.velems->velem );
if (dirty & SVGA_NEW_CLIP)
draw_set_clip_state(svga->swtnl.draw,
diff --git a/src/gallium/drivers/svga/svga_winsys.h b/src/gallium/drivers/svga/svga_winsys.h
index b4e3af0eaf..d4bb176f9a 100644
--- a/src/gallium/drivers/svga/svga_winsys.h
+++ b/src/gallium/drivers/svga/svga_winsys.h
@@ -51,6 +51,7 @@ struct pipe_context;
struct pipe_fence_handle;
struct pipe_texture;
struct svga_region;
+struct winsys_handle;
#define SVGA_BUFFER_USAGE_PINNED (PIPE_BUFFER_USAGE_CUSTOM << 0)
@@ -187,6 +188,25 @@ struct svga_winsys_screen
uint32 numMipLevels);
/**
+ * Creates a surface from a winsys handle.
+ * Used to implement pipe_screen::texture_from_handle.
+ */
+ struct svga_winsys_surface *
+ (*surface_from_handle)(struct svga_winsys_screen *sws,
+ struct winsys_handle *whandle,
+ SVGA3dSurfaceFormat *format);
+
+ /**
+ * Get a winsys_handle from a surface.
+ * Used to implement pipe_screen::texture_get_handle.
+ */
+ boolean
+ (*surface_get_handle)(struct svga_winsys_screen *sws,
+ struct svga_winsys_surface *surface,
+ unsigned stride,
+ struct winsys_handle *whandle);
+
+ /**
* Whether this surface is sitting in a validate list
*/
boolean
@@ -284,19 +304,6 @@ svga_screen_buffer_wrap_surface(struct pipe_screen *screen,
struct svga_winsys_surface *srf);
struct svga_winsys_surface *
-svga_screen_texture_get_winsys_surface(struct pipe_texture *texture);
-struct svga_winsys_surface *
svga_screen_buffer_get_winsys_surface(struct pipe_buffer *buffer);
-boolean
-svga_screen_buffer_from_texture(struct pipe_texture *texture,
- struct pipe_buffer **buffer,
- unsigned *stride);
-
-struct pipe_texture *
-svga_screen_texture_wrap_surface(struct pipe_screen *screen,
- struct pipe_texture *base,
- enum SVGA3dSurfaceFormat format,
- struct svga_winsys_surface *srf);
-
#endif /* SVGA_WINSYS_H_ */
diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_dump.c b/src/gallium/drivers/svga/svgadump/svga_shader_dump.c
index 705ca29e8f..4ee1bf2c35 100644
--- a/src/gallium/drivers/svga/svgadump/svga_shader_dump.c
+++ b/src/gallium/drivers/svga/svgadump/svga_shader_dump.c
@@ -360,7 +360,9 @@ dump_dstreg(struct sh_dstreg dstreg,
union {
struct sh_reg reg;
struct sh_dstreg dstreg;
- } u = { { 0 } };
+ } u;
+
+ memset(&u, 0, sizeof(u));
assert( (dstreg.modifier & (SVGA3DDSTMOD_SATURATE | SVGA3DDSTMOD_PARTIALPRECISION)) == dstreg.modifier );
diff --git a/src/gallium/drivers/sw/Makefile b/src/gallium/drivers/sw/Makefile
new file mode 100644
index 0000000000..2713a62ee9
--- /dev/null
+++ b/src/gallium/drivers/sw/Makefile
@@ -0,0 +1,10 @@
+# Meta-driver which combines whichever software rasterizers have been
+# built into a single convenience library.
+
+TOP = ../../../..
+include $(TOP)/configs/current
+
+C_SOURCES = \
+ sw.c
+
+include ../../Makefile.template
diff --git a/src/gallium/drivers/sw/SConscript b/src/gallium/drivers/sw/SConscript
new file mode 100644
index 0000000000..6fbbdf3cc4
--- /dev/null
+++ b/src/gallium/drivers/sw/SConscript
@@ -0,0 +1,42 @@
+#######################################################################
+# SConscript for swrast convenience library
+#
+# This is a meta-driver which consists of any and all of the software
+# rasterizers into a single driver. A software rasterizer is defined
+# as any driver which takes an sw_winsys pointer as the only argument
+# to create_screen.
+#
+# XXX: unfortunately users of this driver still need to link in any
+# extra libraries needed for the particular driver (eg llvm for
+# llvmpipe). Not sure how to get around this.
+
+Import('*')
+
+if not set(('softpipe', 'llvmpipe', 'cell')).intersection(env['drivers']):
+ print 'warning: no supported pipe driver: skipping build of sw meta-driver'
+ Return()
+
+env = env.Clone()
+
+if 'softpipe' in env['drivers']:
+ env.Append(CPPDEFINES = 'GALLIUM_SOFTPIPE')
+ env.Prepend(LIBS = [softpipe])
+
+if 'llvmpipe' in env['drivers']:
+ env.Tool('llvm')
+ if 'LLVM_VERSION' in env:
+ env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE')
+ env.Tool('udis86')
+ env.Prepend(LIBS = [llvmpipe])
+
+if 'cell' in env['drivers']:
+ env.Append(CPPDEFINES = 'GALLIUM_CELL')
+ env.Prepend(LIBS = [cell])
+
+sw = env.ConvenienceLibrary(
+ target = 'sw',
+ source = [
+ 'sw.c',
+ ]
+ )
+ Export('sw')
diff --git a/src/gallium/drivers/sw/sw.c b/src/gallium/drivers/sw/sw.c
new file mode 100644
index 0000000000..9f156df45f
--- /dev/null
+++ b/src/gallium/drivers/sw/sw.c
@@ -0,0 +1,59 @@
+#include "pipe/p_compiler.h"
+#include "util/u_debug.h"
+#include "target-helpers/wrap_screen.h"
+#include "sw_public.h"
+#include "state_tracker/sw_winsys.h"
+
+
+/* Helper function to choose and instantiate one of the software rasterizers:
+ * cell, llvmpipe, softpipe.
+ */
+
+#ifdef GALLIUM_SOFTPIPE
+#include "softpipe/sp_public.h"
+#endif
+
+#ifdef GALLIUM_LLVMPIPE
+#include "llvmpipe/lp_public.h"
+#endif
+
+#ifdef GALLIUM_CELL
+#include "cell/ppu/cell_public.h"
+#endif
+
+struct pipe_screen *
+swrast_create_screen(struct sw_winsys *winsys)
+{
+ const char *default_driver;
+ const char *driver;
+ struct pipe_screen *screen = NULL;
+
+#if defined(GALLIUM_CELL)
+ default_driver = "cell";
+#elif defined(GALLIUM_LLVMPIPE)
+ default_driver = "llvmpipe";
+#elif defined(GALLIUM_SOFTPIPE)
+ default_driver = "softpipe";
+#else
+ default_driver = "";
+#endif
+
+ driver = debug_get_option("GALLIUM_DRIVER", default_driver);
+
+#if defined(GALLIUM_CELL)
+ if (screen == NULL && strcmp(driver, "cell") == 0)
+ screen = cell_create_screen( winsys );
+#endif
+
+#if defined(GALLIUM_LLVMPIPE)
+ if (screen == NULL && strcmp(driver, "llvmpipe") == 0)
+ screen = llvmpipe_create_screen( winsys );
+#endif
+
+#if defined(GALLIUM_SOFTPIPE)
+ if (screen == NULL)
+ screen = softpipe_create_screen( winsys );
+#endif
+
+ return screen;
+}
diff --git a/src/gallium/drivers/sw/sw_public.h b/src/gallium/drivers/sw/sw_public.h
new file mode 100644
index 0000000000..7085c5c85a
--- /dev/null
+++ b/src/gallium/drivers/sw/sw_public.h
@@ -0,0 +1,13 @@
+#ifndef SW_PUBLIC_H
+#define SW_PUBLIC_H
+
+/* A convenience library, primarily to isolate the logic required to
+ * figure out which if any software rasterizers have been built and
+ * select between them.
+ */
+struct sw_winsys;
+
+struct pipe_screen *
+swrast_create_screen(struct sw_winsys *winsys);
+
+#endif
diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c
index df40fbade6..5c24bd1f7d 100644
--- a/src/gallium/drivers/trace/tr_context.c
+++ b/src/gallium/drivers/trace/tr_context.c
@@ -25,9 +25,12 @@
*
**************************************************************************/
+#include "util/u_inlines.h"
#include "util/u_memory.h"
#include "util/u_simple_list.h"
+#include "util/u_format.h"
+#include "pipe/p_format.h"
#include "pipe/p_screen.h"
#include "tr_dump.h"
@@ -112,7 +115,7 @@ trace_context_draw_block(struct trace_context *tr_ctx, int flag)
(void *) tr_ctx->draw_rule.fs, (void *) tr_ctx->curr.fs,
(void *) tr_ctx->draw_rule.vs, (void *) tr_ctx->curr.vs,
(void *) tr_ctx->draw_rule.surf, 0,
- (void *) tr_ctx->draw_rule.tex, 0);
+ (void *) tr_ctx->draw_rule.sampler_view, 0);
if (tr_ctx->draw_rule.fs &&
tr_ctx->draw_rule.fs == tr_ctx->curr.fs)
block = TRUE;
@@ -126,12 +129,12 @@ trace_context_draw_block(struct trace_context *tr_ctx, int flag)
for (k = 0; k < tr_ctx->curr.nr_cbufs; k++)
if (tr_ctx->draw_rule.surf == tr_ctx->curr.cbufs[k])
block = TRUE;
- if (tr_ctx->draw_rule.tex) {
- for (k = 0; k < tr_ctx->curr.num_texs; k++)
- if (tr_ctx->draw_rule.tex == tr_ctx->curr.tex[k])
+ if (tr_ctx->draw_rule.sampler_view) {
+ for (k = 0; k < tr_ctx->curr.num_sampler_views; k++)
+ if (tr_ctx->draw_rule.sampler_view == tr_ctx->curr.sampler_views[k])
block = TRUE;
- for (k = 0; k < tr_ctx->curr.num_vert_texs; k++) {
- if (tr_ctx->draw_rule.tex == tr_ctx->curr.vert_tex[k]) {
+ for (k = 0; k < tr_ctx->curr.num_vert_sampler_views; k++) {
+ if (tr_ctx->draw_rule.sampler_view == tr_ctx->curr.vert_sampler_views[k]) {
block = TRUE;
}
}
@@ -773,6 +776,70 @@ trace_context_delete_vs_state(struct pipe_context *_pipe,
}
+static INLINE void *
+trace_context_create_vertex_elements_state(struct pipe_context *_pipe,
+ unsigned num_elements,
+ const struct pipe_vertex_element *elements)
+{
+ struct trace_context *tr_ctx = trace_context(_pipe);
+ struct pipe_context *pipe = tr_ctx->pipe;
+ void * result;
+
+ trace_dump_call_begin("pipe_context", "create_vertex_elements_state");
+
+ trace_dump_arg(ptr, pipe);
+ trace_dump_arg(uint, num_elements);
+
+ trace_dump_arg_begin("elements");
+ trace_dump_struct_array(vertex_element, elements, num_elements);
+ trace_dump_arg_end();
+
+ result = pipe->create_vertex_elements_state(pipe, num_elements, elements);
+
+ trace_dump_ret(ptr, result);
+
+ trace_dump_call_end();
+
+ return result;
+}
+
+
+static INLINE void
+trace_context_bind_vertex_elements_state(struct pipe_context *_pipe,
+ void *state)
+{
+ struct trace_context *tr_ctx = trace_context(_pipe);
+ struct pipe_context *pipe = tr_ctx->pipe;
+
+ trace_dump_call_begin("pipe_context", "bind_vertex_elements_state");
+
+ trace_dump_arg(ptr, pipe);
+ trace_dump_arg(ptr, state);
+
+ pipe->bind_vertex_elements_state(pipe, state);
+
+ trace_dump_call_end();
+}
+
+
+static INLINE void
+trace_context_delete_vertex_elements_state(struct pipe_context *_pipe,
+ void *state)
+{
+ struct trace_context *tr_ctx = trace_context(_pipe);
+ struct pipe_context *pipe = tr_ctx->pipe;
+
+ trace_dump_call_begin("pipe_context", "delete_verte_elements_state");
+
+ trace_dump_arg(ptr, pipe);
+ trace_dump_arg(ptr, state);
+
+ pipe->delete_vertex_elements_state(pipe, state);
+
+ trace_dump_call_end();
+}
+
+
static INLINE void
trace_context_set_blend_color(struct pipe_context *_pipe,
const struct pipe_blend_color *state)
@@ -949,63 +1016,119 @@ trace_context_set_viewport_state(struct pipe_context *_pipe,
}
+static struct pipe_sampler_view *
+trace_create_sampler_view(struct pipe_context *_pipe,
+ struct pipe_texture *_texture,
+ const struct pipe_sampler_view *templ)
+{
+ struct trace_context *tr_ctx = trace_context(_pipe);
+ struct trace_texture *tr_tex = trace_texture(_texture);
+ struct pipe_context *pipe = tr_ctx->pipe;
+ struct pipe_texture *texture = tr_tex->texture;
+ struct trace_sampler_view *result = CALLOC_STRUCT(trace_sampler_view);
+
+ trace_dump_call_begin("pipe_context", "create_sampler_view");
+
+ trace_dump_arg(ptr, pipe);
+ trace_dump_arg(ptr, texture);
+ trace_dump_arg(ptr, templ);
+
+ result->sampler_view = pipe->create_sampler_view(pipe, texture, templ);
+
+ result->base = *templ;
+ result->base.reference.count = 1;
+ result->base.texture = NULL;
+ pipe_texture_reference(&result->base.texture, _texture);
+ result->base.context = _pipe;
+
+ trace_dump_ret(ptr, result);
+
+ trace_dump_call_end();
+
+ return &result->base;
+}
+
+
+static void
+trace_sampler_view_destroy(struct pipe_context *_pipe,
+ struct pipe_sampler_view *_view)
+{
+ struct trace_context *tr_ctx = trace_context(_pipe);
+ struct trace_sampler_view *tr_view = trace_sampler_view(_view);
+ struct pipe_context *pipe = tr_ctx->pipe;
+ struct pipe_sampler_view *view = tr_view->sampler_view;
+
+ trace_dump_call_begin("pipe_context", "sampler_view_destroy");
+
+ trace_dump_arg(ptr, pipe);
+ trace_dump_arg(ptr, view);
+
+ pipe->sampler_view_destroy(pipe, view);
+
+ trace_dump_call_end();
+
+ pipe_texture_reference(&_view->texture, NULL);
+ FREE(_view);
+}
+
+
static INLINE void
-trace_context_set_fragment_sampler_textures(struct pipe_context *_pipe,
- unsigned num_textures,
- struct pipe_texture **textures)
+trace_context_set_fragment_sampler_views(struct pipe_context *_pipe,
+ unsigned num,
+ struct pipe_sampler_view **views)
{
struct trace_context *tr_ctx = trace_context(_pipe);
- struct trace_texture *tr_tex;
+ struct trace_sampler_view *tr_view;
struct pipe_context *pipe = tr_ctx->pipe;
- struct pipe_texture *unwrapped_textures[PIPE_MAX_SAMPLERS];
+ struct pipe_sampler_view *unwrapped_views[PIPE_MAX_SAMPLERS];
unsigned i;
- tr_ctx->curr.num_texs = num_textures;
- for(i = 0; i < num_textures; ++i) {
- tr_tex = trace_texture(textures[i]);
- tr_ctx->curr.tex[i] = tr_tex;
- unwrapped_textures[i] = tr_tex ? tr_tex->texture : NULL;
+ tr_ctx->curr.num_sampler_views = num;
+ for(i = 0; i < num; ++i) {
+ tr_view = trace_sampler_view(views[i]);
+ tr_ctx->curr.sampler_views[i] = tr_view;
+ unwrapped_views[i] = tr_view ? tr_view->sampler_view : NULL;
}
- textures = unwrapped_textures;
+ views = unwrapped_views;
- trace_dump_call_begin("pipe_context", "set_fragment_sampler_textures");
+ trace_dump_call_begin("pipe_context", "set_fragment_sampler_views");
trace_dump_arg(ptr, pipe);
- trace_dump_arg(uint, num_textures);
- trace_dump_arg_array(ptr, textures, num_textures);
+ trace_dump_arg(uint, num);
+ trace_dump_arg_array(ptr, views, num);
- pipe->set_fragment_sampler_textures(pipe, num_textures, textures);
+ pipe->set_fragment_sampler_views(pipe, num, views);
trace_dump_call_end();
}
static INLINE void
-trace_context_set_vertex_sampler_textures(struct pipe_context *_pipe,
- unsigned num_textures,
- struct pipe_texture **textures)
+trace_context_set_vertex_sampler_views(struct pipe_context *_pipe,
+ unsigned num,
+ struct pipe_sampler_view **views)
{
struct trace_context *tr_ctx = trace_context(_pipe);
- struct trace_texture *tr_tex;
+ struct trace_sampler_view *tr_view;
struct pipe_context *pipe = tr_ctx->pipe;
- struct pipe_texture *unwrapped_textures[PIPE_MAX_VERTEX_SAMPLERS];
+ struct pipe_sampler_view *unwrapped_views[PIPE_MAX_VERTEX_SAMPLERS];
unsigned i;
- tr_ctx->curr.num_vert_texs = num_textures;
- for(i = 0; i < num_textures; ++i) {
- tr_tex = trace_texture(textures[i]);
- tr_ctx->curr.vert_tex[i] = tr_tex;
- unwrapped_textures[i] = tr_tex ? tr_tex->texture : NULL;
+ tr_ctx->curr.num_vert_sampler_views = num;
+ for(i = 0; i < num; ++i) {
+ tr_view = trace_sampler_view(views[i]);
+ tr_ctx->curr.vert_sampler_views[i] = tr_view;
+ unwrapped_views[i] = tr_view ? tr_view->sampler_view : NULL;
}
- textures = unwrapped_textures;
+ views = unwrapped_views;
- trace_dump_call_begin("pipe_context", "set_vertex_sampler_textures");
+ trace_dump_call_begin("pipe_context", "set_vertex_sampler_views");
trace_dump_arg(ptr, pipe);
- trace_dump_arg(uint, num_textures);
- trace_dump_arg_array(ptr, textures, num_textures);
+ trace_dump_arg(uint, num);
+ trace_dump_arg_array(ptr, views, num);
- pipe->set_vertex_sampler_textures(pipe, num_textures, textures);
+ pipe->set_vertex_sampler_views(pipe, num, views);
trace_dump_call_end();
}
@@ -1048,29 +1171,6 @@ trace_context_set_vertex_buffers(struct pipe_context *_pipe,
static INLINE void
-trace_context_set_vertex_elements(struct pipe_context *_pipe,
- unsigned num_elements,
- const struct pipe_vertex_element *elements)
-{
- struct trace_context *tr_ctx = trace_context(_pipe);
- struct pipe_context *pipe = tr_ctx->pipe;
-
- trace_dump_call_begin("pipe_context", "set_vertex_elements");
-
- trace_dump_arg(ptr, pipe);
- trace_dump_arg(uint, num_elements);
-
- trace_dump_arg_begin("elements");
- trace_dump_struct_array(vertex_element, elements, num_elements);
- trace_dump_arg_end();
-
- pipe->set_vertex_elements(pipe, num_elements, elements);
-
- trace_dump_call_end();
-}
-
-
-static INLINE void
trace_context_surface_copy(struct pipe_context *_pipe,
struct pipe_surface *dest,
unsigned destx, unsigned desty,
@@ -1242,6 +1342,136 @@ trace_is_buffer_referenced( struct pipe_context *_pipe,
return referenced;
}
+
+/********************************************************************
+ * transfer
+ */
+
+
+static struct pipe_transfer *
+trace_context_get_tex_transfer(struct pipe_context *_context,
+ struct pipe_texture *_texture,
+ unsigned face, unsigned level,
+ unsigned zslice,
+ enum pipe_transfer_usage usage,
+ unsigned x, unsigned y, unsigned w, unsigned h)
+{
+ struct trace_context *tr_context = trace_context(_context);
+ struct trace_texture *tr_tex = trace_texture(_texture);
+ struct pipe_context *context = tr_context->pipe;
+ struct pipe_texture *texture = tr_tex->texture;
+ struct pipe_transfer *result = NULL;
+
+ assert(texture->screen == context->screen);
+
+ trace_dump_call_begin("pipe_context", "get_tex_transfer");
+
+ trace_dump_arg(ptr, context);
+ trace_dump_arg(ptr, texture);
+ trace_dump_arg(uint, face);
+ trace_dump_arg(uint, level);
+ trace_dump_arg(uint, zslice);
+ trace_dump_arg(uint, usage);
+
+ trace_dump_arg(uint, x);
+ trace_dump_arg(uint, y);
+ trace_dump_arg(uint, w);
+ trace_dump_arg(uint, h);
+
+ result = context->get_tex_transfer(context, texture, face, level, zslice, usage,
+ x, y, w, h);
+
+ trace_dump_ret(ptr, result);
+
+ trace_dump_call_end();
+
+ if (result)
+ result = trace_transfer_create(tr_context, tr_tex, result);
+
+ return result;
+}
+
+
+static void
+trace_context_tex_transfer_destroy(struct pipe_context *_context,
+ struct pipe_transfer *_transfer)
+{
+ struct trace_context *tr_context = trace_context(_context);
+ struct trace_transfer *tr_trans = trace_transfer(_transfer);
+ struct pipe_context *context = tr_context->pipe;
+ struct pipe_transfer *transfer = tr_trans->transfer;
+
+ trace_dump_call_begin("pipe_context", "tex_transfer_destroy");
+
+ trace_dump_arg(ptr, context);
+ trace_dump_arg(ptr, transfer);
+
+ trace_dump_call_end();
+
+ trace_transfer_destroy(tr_context, tr_trans);
+}
+
+
+static void *
+trace_context_transfer_map(struct pipe_context *_context,
+ struct pipe_transfer *_transfer)
+{
+ struct trace_context *tr_context = trace_context(_context);
+ struct trace_transfer *tr_trans = trace_transfer(_transfer);
+ struct pipe_context *context = tr_context->pipe;
+ struct pipe_transfer *transfer = tr_trans->transfer;
+ void *map;
+
+ map = context->transfer_map(context, transfer);
+ if(map) {
+ if(transfer->usage & PIPE_TRANSFER_WRITE) {
+ assert(!tr_trans->map);
+ tr_trans->map = map;
+ }
+ }
+
+ return map;
+}
+
+
+static void
+trace_context_transfer_unmap(struct pipe_context *_context,
+ struct pipe_transfer *_transfer)
+{
+ struct trace_context *tr_ctx = trace_context(_context);
+ struct trace_transfer *tr_trans = trace_transfer(_transfer);
+ struct pipe_context *context = tr_ctx->pipe;
+ struct pipe_transfer *transfer = tr_trans->transfer;
+
+ if(tr_trans->map) {
+ size_t size = util_format_get_nblocksy(transfer->texture->format, transfer->height) * transfer->stride;
+
+ trace_dump_call_begin("pipe_context", "transfer_write");
+
+ trace_dump_arg(ptr, context);
+
+ trace_dump_arg(ptr, transfer);
+
+ trace_dump_arg_begin("stride");
+ trace_dump_uint(transfer->stride);
+ trace_dump_arg_end();
+
+ trace_dump_arg_begin("data");
+ trace_dump_bytes(tr_trans->map, size);
+ trace_dump_arg_end();
+
+ trace_dump_arg_begin("size");
+ trace_dump_uint(size);
+ trace_dump_arg_end();
+
+ trace_dump_call_end();
+
+ tr_trans->map = NULL;
+ }
+
+ context->transfer_unmap(context, transfer);
+}
+
static const struct debug_named_value rbug_blocker_flags[] = {
{"before", 1},
{"after", 2},
@@ -1303,6 +1533,9 @@ trace_context_create(struct trace_screen *tr_scr,
tr_ctx->base.create_vs_state = trace_context_create_vs_state;
tr_ctx->base.bind_vs_state = trace_context_bind_vs_state;
tr_ctx->base.delete_vs_state = trace_context_delete_vs_state;
+ tr_ctx->base.create_vertex_elements_state = trace_context_create_vertex_elements_state;
+ tr_ctx->base.bind_vertex_elements_state = trace_context_bind_vertex_elements_state;
+ tr_ctx->base.delete_vertex_elements_state = trace_context_delete_vertex_elements_state;
tr_ctx->base.set_blend_color = trace_context_set_blend_color;
tr_ctx->base.set_stencil_ref = trace_context_set_stencil_ref;
tr_ctx->base.set_clip_state = trace_context_set_clip_state;
@@ -1311,10 +1544,11 @@ trace_context_create(struct trace_screen *tr_scr,
tr_ctx->base.set_polygon_stipple = trace_context_set_polygon_stipple;
tr_ctx->base.set_scissor_state = trace_context_set_scissor_state;
tr_ctx->base.set_viewport_state = trace_context_set_viewport_state;
- tr_ctx->base.set_fragment_sampler_textures = trace_context_set_fragment_sampler_textures;
- tr_ctx->base.set_vertex_sampler_textures = trace_context_set_vertex_sampler_textures;
+ tr_ctx->base.set_fragment_sampler_views = trace_context_set_fragment_sampler_views;
+ tr_ctx->base.set_vertex_sampler_views = trace_context_set_vertex_sampler_views;
+ tr_ctx->base.create_sampler_view = trace_create_sampler_view;
+ tr_ctx->base.sampler_view_destroy = trace_sampler_view_destroy;
tr_ctx->base.set_vertex_buffers = trace_context_set_vertex_buffers;
- tr_ctx->base.set_vertex_elements = trace_context_set_vertex_elements;
if (pipe->surface_copy)
tr_ctx->base.surface_copy = trace_context_surface_copy;
if (pipe->surface_fill)
@@ -1324,6 +1558,11 @@ trace_context_create(struct trace_screen *tr_scr,
tr_ctx->base.is_texture_referenced = trace_is_texture_referenced;
tr_ctx->base.is_buffer_referenced = trace_is_buffer_referenced;
+ tr_ctx->base.get_tex_transfer = trace_context_get_tex_transfer;
+ tr_ctx->base.tex_transfer_destroy = trace_context_tex_transfer_destroy;
+ tr_ctx->base.transfer_map = trace_context_transfer_map;
+ tr_ctx->base.transfer_unmap = trace_context_transfer_unmap;
+
tr_ctx->pipe = pipe;
trace_screen_add_to_list(tr_scr, contexts, tr_ctx);
diff --git a/src/gallium/drivers/trace/tr_context.h b/src/gallium/drivers/trace/tr_context.h
index 1428423248..feec9b6bbf 100644
--- a/src/gallium/drivers/trace/tr_context.h
+++ b/src/gallium/drivers/trace/tr_context.h
@@ -53,11 +53,11 @@ struct trace_context
struct trace_shader *fs;
struct trace_shader *vs;
- struct trace_texture *tex[PIPE_MAX_SAMPLERS];
- unsigned num_texs;
+ struct trace_sampler_view *sampler_views[PIPE_MAX_SAMPLERS];
+ unsigned num_sampler_views;
- struct trace_texture *vert_tex[PIPE_MAX_VERTEX_SAMPLERS];
- unsigned num_vert_texs;
+ struct trace_sampler_view *vert_sampler_views[PIPE_MAX_VERTEX_SAMPLERS];
+ unsigned num_vert_sampler_views;
unsigned nr_cbufs;
struct trace_texture *cbufs[PIPE_MAX_COLOR_BUFS];
@@ -68,7 +68,7 @@ struct trace_context
struct trace_shader *fs;
struct trace_shader *vs;
- struct trace_texture *tex;
+ struct trace_sampler_view *sampler_view;
struct trace_texture *surf;
int blocker;
diff --git a/src/gallium/drivers/trace/tr_drm.c b/src/gallium/drivers/trace/tr_drm.c
index 2b4915003e..eaa47df406 100644
--- a/src/gallium/drivers/trace/tr_drm.c
+++ b/src/gallium/drivers/trace/tr_drm.c
@@ -30,9 +30,7 @@
#include "util/u_memory.h"
#include "tr_drm.h"
#include "tr_screen.h"
-#include "tr_context.h"
-#include "tr_buffer.h"
-#include "tr_texture.h"
+#include "tr_public.h"
struct trace_drm_api
{
@@ -62,69 +60,8 @@ trace_drm_create_screen(struct drm_api *_api, int fd,
screen = api->create_screen(api, fd, arg);
- return trace_screen_create(screen);
-}
-
-
-static struct pipe_texture *
-trace_drm_texture_from_shared_handle(struct drm_api *_api,
- struct pipe_screen *_screen,
- struct pipe_texture *templ,
- const char *name,
- unsigned stride,
- unsigned handle)
-{
- struct trace_screen *tr_screen = trace_screen(_screen);
- struct trace_drm_api *tr_api = trace_drm_api(_api);
- struct pipe_screen *screen = tr_screen->screen;
- struct drm_api *api = tr_api->api;
- struct pipe_texture *result;
-
- /* TODO trace call */
-
- result = api->texture_from_shared_handle(api, screen, templ, name, stride, handle);
-
- result = trace_texture_create(trace_screen(_screen), result);
-
- return result;
-}
-
-static boolean
-trace_drm_shared_handle_from_texture(struct drm_api *_api,
- struct pipe_screen *_screen,
- struct pipe_texture *_texture,
- unsigned *stride,
- unsigned *handle)
-{
- struct trace_screen *tr_screen = trace_screen(_screen);
- struct trace_texture *tr_texture = trace_texture(_texture);
- struct trace_drm_api *tr_api = trace_drm_api(_api);
- struct pipe_screen *screen = tr_screen->screen;
- struct pipe_texture *texture = tr_texture->texture;
- struct drm_api *api = tr_api->api;
-
- /* TODO trace call */
-
- return api->shared_handle_from_texture(api, screen, texture, stride, handle);
-}
-static boolean
-trace_drm_local_handle_from_texture(struct drm_api *_api,
- struct pipe_screen *_screen,
- struct pipe_texture *_texture,
- unsigned *stride,
- unsigned *handle)
-{
- struct trace_screen *tr_screen = trace_screen(_screen);
- struct trace_texture *tr_texture = trace_texture(_texture);
- struct trace_drm_api *tr_api = trace_drm_api(_api);
- struct pipe_screen *screen = tr_screen->screen;
- struct pipe_texture *texture = tr_texture->texture;
- struct drm_api *api = tr_api->api;
-
- /* TODO trace call */
-
- return api->local_handle_from_texture(api, screen, texture, stride, handle);
+ return trace_screen_create(screen);
}
static void
@@ -158,9 +95,6 @@ trace_drm_create(struct drm_api *api)
tr_api->base.name = api->name;
tr_api->base.driver_name = api->driver_name;
tr_api->base.create_screen = trace_drm_create_screen;
- tr_api->base.texture_from_shared_handle = trace_drm_texture_from_shared_handle;
- tr_api->base.shared_handle_from_texture = trace_drm_shared_handle_from_texture;
- tr_api->base.local_handle_from_texture = trace_drm_local_handle_from_texture;
tr_api->base.destroy = trace_drm_destroy;
tr_api->api = api;
diff --git a/src/gallium/drivers/trace/tr_dump_state.c b/src/gallium/drivers/trace/tr_dump_state.c
index f97d963dba..f82dd01c69 100644
--- a/src/gallium/drivers/trace/tr_dump_state.c
+++ b/src/gallium/drivers/trace/tr_dump_state.c
@@ -479,7 +479,6 @@ void trace_dump_vertex_element(const struct pipe_vertex_element *state)
trace_dump_member(uint, state, src_offset);
trace_dump_member(uint, state, vertex_buffer_index);
- trace_dump_member(uint, state, nr_components);
trace_dump_member(format, state, src_format);
diff --git a/src/gallium/drivers/trace/tr_public.h b/src/gallium/drivers/trace/tr_public.h
new file mode 100644
index 0000000000..62e217097d
--- /dev/null
+++ b/src/gallium/drivers/trace/tr_public.h
@@ -0,0 +1,45 @@
+/**************************************************************************
+ *
+ * Copyright 2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ **************************************************************************/
+
+#ifndef TR_PUBLIC_H
+#define TR_PUBLIC_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct pipe_screen;
+struct pipe_context;
+
+struct pipe_screen *
+trace_screen_create(struct pipe_screen *screen);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* TR_PUBLIC_H */
diff --git a/src/gallium/drivers/trace/tr_rbug.c b/src/gallium/drivers/trace/tr_rbug.c
index a43adac694..53ab8c686d 100644
--- a/src/gallium/drivers/trace/tr_rbug.c
+++ b/src/gallium/drivers/trace/tr_rbug.c
@@ -219,7 +219,7 @@ trace_rbug_texture_read(struct trace_rbug *tr_rbug, struct rbug_header *header,
struct trace_texture *tr_tex = NULL;
struct tr_list *ptr;
- struct pipe_screen *screen = tr_scr->screen;
+ struct pipe_context *context = tr_scr->private_context;
struct pipe_texture *tex;
struct pipe_transfer *t;
@@ -239,12 +239,12 @@ trace_rbug_texture_read(struct trace_rbug *tr_rbug, struct rbug_header *header,
}
tex = tr_tex->texture;
- t = screen->get_tex_transfer(tr_scr->screen, tex,
- gptr->face, gptr->level, gptr->zslice,
- PIPE_TRANSFER_READ,
- gptr->x, gptr->y, gptr->w, gptr->h);
+ t = context->get_tex_transfer(context, tex,
+ gptr->face, gptr->level, gptr->zslice,
+ PIPE_TRANSFER_READ,
+ gptr->x, gptr->y, gptr->w, gptr->h);
- map = screen->transfer_map(screen, t);
+ map = context->transfer_map(context, t);
rbug_send_texture_read_reply(tr_rbug->con, serial,
t->texture->format,
@@ -256,8 +256,8 @@ trace_rbug_texture_read(struct trace_rbug *tr_rbug, struct rbug_header *header,
t->stride,
NULL);
- screen->transfer_unmap(screen, t);
- screen->tex_transfer_destroy(t);
+ context->transfer_unmap(context, t);
+ context->tex_transfer_destroy(context, t);
pipe_mutex_unlock(tr_scr->list_mutex);
@@ -313,12 +313,12 @@ trace_rbug_context_info(struct trace_rbug *tr_rbug, struct rbug_header *header,
for (i = 0; i < tr_ctx->curr.nr_cbufs; i++)
cbufs[i] = VOID2U64(tr_ctx->curr.cbufs[i]);
- for (i = 0; i < tr_ctx->curr.num_texs; i++)
- texs[i] = VOID2U64(tr_ctx->curr.tex[i]);
+ for (i = 0; i < tr_ctx->curr.num_sampler_views; i++)
+ texs[i] = VOID2U64(tr_ctx->curr.sampler_views[i]);
rbug_send_context_info_reply(tr_rbug->con, serial,
VOID2U64(tr_ctx->curr.vs), VOID2U64(tr_ctx->curr.fs),
- texs, tr_ctx->curr.num_texs,
+ texs, tr_ctx->curr.num_sampler_views,
cbufs, tr_ctx->curr.nr_cbufs,
VOID2U64(tr_ctx->curr.zsbuf),
tr_ctx->draw_blocker, tr_ctx->draw_blocked, NULL);
@@ -444,7 +444,7 @@ trace_rbug_context_draw_rule(struct trace_rbug *tr_rbug, struct rbug_header *hea
pipe_mutex_lock(tr_ctx->draw_mutex);
tr_ctx->draw_rule.vs = U642VOID(rule->vertex);
tr_ctx->draw_rule.fs = U642VOID(rule->fragment);
- tr_ctx->draw_rule.tex = U642VOID(rule->texture);
+ tr_ctx->draw_rule.sampler_view = U642VOID(rule->texture);
tr_ctx->draw_rule.surf = U642VOID(rule->surface);
tr_ctx->draw_rule.blocker = rule->block;
tr_ctx->draw_blocker |= RBUG_BLOCK_RULE;
diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c
index 388d83eb5c..25990bdac7 100644
--- a/src/gallium/drivers/trace/tr_screen.c
+++ b/src/gallium/drivers/trace/tr_screen.c
@@ -35,6 +35,7 @@
#include "tr_texture.h"
#include "tr_context.h"
#include "tr_screen.h"
+#include "tr_public.h"
#include "util/u_inlines.h"
#include "pipe/p_format.h"
@@ -236,39 +237,41 @@ trace_screen_texture_create(struct pipe_screen *_screen,
return result;
}
-
static struct pipe_texture *
-trace_screen_texture_blanket(struct pipe_screen *_screen,
- const struct pipe_texture *templat,
- const unsigned *ppitch,
- struct pipe_buffer *_buffer)
+trace_screen_texture_from_handle(struct pipe_screen *_screen,
+ const struct pipe_texture *templ,
+ struct winsys_handle *handle)
{
- struct trace_screen *tr_scr = trace_screen(_screen);
- struct trace_buffer *tr_buf = trace_buffer(_buffer);
- struct pipe_screen *screen = tr_scr->screen;
- struct pipe_buffer *buffer = tr_buf->buffer;
- unsigned pitch = *ppitch;
+ struct trace_screen *tr_screen = trace_screen(_screen);
+ struct pipe_screen *screen = tr_screen->screen;
struct pipe_texture *result;
- trace_dump_call_begin("pipe_screen", "texture_blanket");
+ /* TODO trace call */
- trace_dump_arg(ptr, screen);
- trace_dump_arg(template, templat);
- trace_dump_arg(uint, pitch);
- trace_dump_arg(ptr, buffer);
+ result = screen->texture_from_handle(screen, templ, handle);
- result = screen->texture_blanket(screen, templat, ppitch, buffer);
+ result = trace_texture_create(trace_screen(_screen), result);
- trace_dump_ret(ptr, result);
+ return result;
+}
- trace_dump_call_end();
+static boolean
+trace_screen_texture_get_handle(struct pipe_screen *_screen,
+ struct pipe_texture *_texture,
+ struct winsys_handle *handle)
+{
+ struct trace_screen *tr_screen = trace_screen(_screen);
+ struct trace_texture *tr_texture = trace_texture(_texture);
+ struct pipe_screen *screen = tr_screen->screen;
+ struct pipe_texture *texture = tr_texture->texture;
- result = trace_texture_create(tr_scr, result);
+ /* TODO trace call */
- return result;
+ return screen->texture_get_handle(screen, texture, handle);
}
+
static void
trace_screen_texture_destroy(struct pipe_texture *_texture)
{
@@ -350,133 +353,7 @@ trace_screen_tex_surface_destroy(struct pipe_surface *_surface)
}
-/********************************************************************
- * transfer
- */
-
-
-static struct pipe_transfer *
-trace_screen_get_tex_transfer(struct pipe_screen *_screen,
- struct pipe_texture *_texture,
- unsigned face, unsigned level,
- unsigned zslice,
- enum pipe_transfer_usage usage,
- unsigned x, unsigned y, unsigned w, unsigned h)
-{
- struct trace_screen *tr_scr = trace_screen(_screen);
- struct trace_texture *tr_tex = trace_texture(_texture);
- struct pipe_screen *screen = tr_scr->screen;
- struct pipe_texture *texture = tr_tex->texture;
- struct pipe_transfer *result = NULL;
-
- assert(texture->screen == screen);
-
- trace_dump_call_begin("pipe_screen", "get_tex_transfer");
- trace_dump_arg(ptr, screen);
- trace_dump_arg(ptr, texture);
- trace_dump_arg(uint, face);
- trace_dump_arg(uint, level);
- trace_dump_arg(uint, zslice);
- trace_dump_arg(uint, usage);
-
- trace_dump_arg(uint, x);
- trace_dump_arg(uint, y);
- trace_dump_arg(uint, w);
- trace_dump_arg(uint, h);
-
- result = screen->get_tex_transfer(screen, texture, face, level, zslice, usage,
- x, y, w, h);
-
- trace_dump_ret(ptr, result);
-
- trace_dump_call_end();
-
- if (result)
- result = trace_transfer_create(tr_tex, result);
-
- return result;
-}
-
-
-static void
-trace_screen_tex_transfer_destroy(struct pipe_transfer *_transfer)
-{
- struct trace_screen *tr_scr = trace_screen(_transfer->texture->screen);
- struct trace_transfer *tr_trans = trace_transfer(_transfer);
- struct pipe_screen *screen = tr_scr->screen;
- struct pipe_transfer *transfer = tr_trans->transfer;
-
- trace_dump_call_begin("pipe_screen", "tex_transfer_destroy");
-
- trace_dump_arg(ptr, screen);
- trace_dump_arg(ptr, transfer);
-
- trace_dump_call_end();
-
- trace_transfer_destroy(tr_trans);
-}
-
-
-static void *
-trace_screen_transfer_map(struct pipe_screen *_screen,
- struct pipe_transfer *_transfer)
-{
- struct trace_screen *tr_scr = trace_screen(_screen);
- struct trace_transfer *tr_trans = trace_transfer(_transfer);
- struct pipe_screen *screen = tr_scr->screen;
- struct pipe_transfer *transfer = tr_trans->transfer;
- void *map;
-
- map = screen->transfer_map(screen, transfer);
- if(map) {
- if(transfer->usage & PIPE_TRANSFER_WRITE) {
- assert(!tr_trans->map);
- tr_trans->map = map;
- }
- }
-
- return map;
-}
-
-
-static void
-trace_screen_transfer_unmap(struct pipe_screen *_screen,
- struct pipe_transfer *_transfer)
-{
- struct trace_screen *tr_scr = trace_screen(_screen);
- struct trace_transfer *tr_trans = trace_transfer(_transfer);
- struct pipe_screen *screen = tr_scr->screen;
- struct pipe_transfer *transfer = tr_trans->transfer;
-
- if(tr_trans->map) {
- size_t size = util_format_get_nblocksy(transfer->texture->format, transfer->height) * transfer->stride;
-
- trace_dump_call_begin("pipe_screen", "transfer_write");
-
- trace_dump_arg(ptr, screen);
-
- trace_dump_arg(ptr, transfer);
-
- trace_dump_arg_begin("stride");
- trace_dump_uint(transfer->stride);
- trace_dump_arg_end();
-
- trace_dump_arg_begin("data");
- trace_dump_bytes(tr_trans->map, size);
- trace_dump_arg_end();
-
- trace_dump_arg_begin("size");
- trace_dump_uint(size);
- trace_dump_arg_end();
-
- trace_dump_call_end();
-
- tr_trans->map = NULL;
- }
-
- screen->transfer_unmap(screen, transfer);
-}
/********************************************************************
@@ -484,45 +361,7 @@ trace_screen_transfer_unmap(struct pipe_screen *_screen,
*/
-static struct pipe_buffer *
-trace_screen_surface_buffer_create(struct pipe_screen *_screen,
- unsigned width, unsigned height,
- enum pipe_format format,
- unsigned usage,
- unsigned tex_usage,
- unsigned *pstride)
-{
- struct trace_screen *tr_scr = trace_screen(_screen);
- struct pipe_screen *screen = tr_scr->screen;
- unsigned stride;
- struct pipe_buffer *result;
-
- trace_dump_call_begin("pipe_screen", "surface_buffer_create");
-
- trace_dump_arg(ptr, screen);
- trace_dump_arg(uint, width);
- trace_dump_arg(uint, height);
- trace_dump_arg(format, format);
- trace_dump_arg(uint, usage);
- trace_dump_arg(uint, tex_usage);
-
- result = screen->surface_buffer_create(screen,
- width, height,
- format,
- usage,
- tex_usage,
- pstride);
-
- stride = *pstride;
-
- trace_dump_arg(uint, stride);
-
- trace_dump_ret(ptr, result);
-
- trace_dump_call_end();
- return trace_buffer_create(tr_scr, result);
-}
static struct pipe_buffer *
@@ -931,17 +770,13 @@ trace_screen_create(struct pipe_screen *screen)
assert(screen->context_create);
tr_scr->base.context_create = trace_screen_context_create;
tr_scr->base.texture_create = trace_screen_texture_create;
- tr_scr->base.texture_blanket = trace_screen_texture_blanket;
+ tr_scr->base.texture_from_handle = trace_screen_texture_from_handle;
+ tr_scr->base.texture_get_handle = trace_screen_texture_get_handle;
tr_scr->base.texture_destroy = trace_screen_texture_destroy;
tr_scr->base.get_tex_surface = trace_screen_get_tex_surface;
tr_scr->base.tex_surface_destroy = trace_screen_tex_surface_destroy;
- tr_scr->base.get_tex_transfer = trace_screen_get_tex_transfer;
- tr_scr->base.tex_transfer_destroy = trace_screen_tex_transfer_destroy;
- tr_scr->base.transfer_map = trace_screen_transfer_map;
- tr_scr->base.transfer_unmap = trace_screen_transfer_unmap;
tr_scr->base.buffer_create = trace_screen_buffer_create;
tr_scr->base.user_buffer_create = trace_screen_user_buffer_create;
- tr_scr->base.surface_buffer_create = trace_screen_surface_buffer_create;
if (screen->buffer_map)
tr_scr->base.buffer_map = trace_screen_buffer_map;
if (screen->buffer_map_range)
@@ -955,7 +790,11 @@ trace_screen_create(struct pipe_screen *screen)
tr_scr->base.fence_signalled = trace_screen_fence_signalled;
tr_scr->base.fence_finish = trace_screen_fence_finish;
tr_scr->base.flush_frontbuffer = trace_screen_flush_frontbuffer;
+
tr_scr->screen = screen;
+ tr_scr->private_context = screen->context_create(screen, NULL);
+ if (tr_scr->private_context == NULL)
+ goto error3;
trace_dump_ret(ptr, screen);
trace_dump_call_end();
@@ -965,10 +804,8 @@ trace_screen_create(struct pipe_screen *screen)
return &tr_scr->base;
-#if 0
error3:
FREE(tr_scr);
-#endif
error2:
trace_dump_ret(ptr, screen);
trace_dump_call_end();
diff --git a/src/gallium/drivers/trace/tr_screen.h b/src/gallium/drivers/trace/tr_screen.h
index fe5a0fa190..9bfbe72e2c 100644
--- a/src/gallium/drivers/trace/tr_screen.h
+++ b/src/gallium/drivers/trace/tr_screen.h
@@ -56,6 +56,7 @@ struct trace_screen
struct pipe_screen base;
struct pipe_screen *screen;
+ struct pipe_context *private_context;
/* remote debugger */
struct trace_rbug *rbug;
@@ -99,9 +100,6 @@ trace_enabled(void);
struct trace_screen *
trace_screen(struct pipe_screen *screen);
-struct pipe_screen *
-trace_screen_create(struct pipe_screen *screen);
-
void
trace_screen_user_buffer_update(struct pipe_screen *screen,
struct pipe_buffer *buffer);
diff --git a/src/gallium/drivers/trace/tr_texture.c b/src/gallium/drivers/trace/tr_texture.c
index 5321d68ec0..d818e21bb8 100644
--- a/src/gallium/drivers/trace/tr_texture.c
+++ b/src/gallium/drivers/trace/tr_texture.c
@@ -31,6 +31,7 @@
#include "util/u_simple_list.h"
#include "tr_screen.h"
+#include "tr_context.h"
#include "tr_texture.h"
@@ -124,8 +125,9 @@ trace_surface_destroy(struct trace_surface *tr_surf)
struct pipe_transfer *
-trace_transfer_create(struct trace_texture *tr_tex,
- struct pipe_transfer *transfer)
+trace_transfer_create(struct trace_context *tr_ctx,
+ struct trace_texture *tr_tex,
+ struct pipe_transfer *transfer)
{
struct trace_screen *tr_scr = trace_screen(tr_tex->base.screen);
struct trace_transfer *tr_trans;
@@ -142,8 +144,9 @@ trace_transfer_create(struct trace_texture *tr_tex,
memcpy(&tr_trans->base, transfer, sizeof(struct pipe_transfer));
tr_trans->base.texture = NULL;
- pipe_texture_reference(&tr_trans->base.texture, &tr_tex->base);
tr_trans->transfer = transfer;
+
+ pipe_texture_reference(&tr_trans->base.texture, &tr_tex->base);
assert(tr_trans->base.texture == &tr_tex->base);
trace_screen_add_to_list(tr_scr, transfers, tr_trans);
@@ -151,21 +154,23 @@ trace_transfer_create(struct trace_texture *tr_tex,
return &tr_trans->base;
error:
- transfer->texture->screen->tex_transfer_destroy(transfer);
+ tr_ctx->pipe->tex_transfer_destroy(tr_ctx->pipe, transfer);
return NULL;
}
void
-trace_transfer_destroy(struct trace_transfer *tr_trans)
+trace_transfer_destroy(struct trace_context *tr_context,
+ struct trace_transfer *tr_trans)
{
- struct trace_screen *tr_scr = trace_screen(tr_trans->base.texture->screen);
- struct pipe_screen *screen = tr_trans->transfer->texture->screen;
+ struct trace_screen *tr_scr = trace_screen(tr_context->base.screen);
+ struct pipe_context *context = tr_context->pipe;
+ struct pipe_transfer *transfer = tr_trans->transfer;
trace_screen_remove_from_list(tr_scr, transfers, tr_trans);
pipe_texture_reference(&tr_trans->base.texture, NULL);
- screen->tex_transfer_destroy(tr_trans->transfer);
+ context->tex_transfer_destroy(context, transfer);
FREE(tr_trans);
}
diff --git a/src/gallium/drivers/trace/tr_texture.h b/src/gallium/drivers/trace/tr_texture.h
index 395e523e73..66250465e4 100644
--- a/src/gallium/drivers/trace/tr_texture.h
+++ b/src/gallium/drivers/trace/tr_texture.h
@@ -34,6 +34,7 @@
#include "tr_screen.h"
+struct trace_context;
struct trace_texture
{
@@ -55,11 +56,20 @@ struct trace_surface
};
+struct trace_sampler_view
+{
+ struct pipe_sampler_view base;
+
+ struct pipe_sampler_view *sampler_view;
+};
+
+
struct trace_transfer
{
struct pipe_transfer base;
struct pipe_transfer *transfer;
+ struct pipe_context *pipe;
struct tr_list list;
@@ -87,6 +97,15 @@ trace_surface(struct pipe_surface *surface)
}
+static INLINE struct trace_sampler_view *
+trace_sampler_view(struct pipe_sampler_view *sampler_view)
+{
+ if (!sampler_view)
+ return NULL;
+ return (struct trace_sampler_view *)sampler_view;
+}
+
+
static INLINE struct trace_transfer *
trace_transfer(struct pipe_transfer *transfer)
{
@@ -112,11 +131,13 @@ void
trace_surface_destroy(struct trace_surface *tr_surf);
struct pipe_transfer *
-trace_transfer_create(struct trace_texture *tr_tex,
- struct pipe_transfer *transfer);
+trace_transfer_create(struct trace_context *tr_ctx,
+ struct trace_texture *tr_tex,
+ struct pipe_transfer *transfer);
void
-trace_transfer_destroy(struct trace_transfer *tr_trans);
+trace_transfer_destroy(struct trace_context *tr_ctx,
+ struct trace_transfer *tr_trans);
#endif /* TR_TEXTURE_H_ */
diff --git a/src/gallium/include/pipe/p_compiler.h b/src/gallium/include/pipe/p_compiler.h
index b93b38310a..d645fd09bf 100644
--- a/src/gallium/include/pipe/p_compiler.h
+++ b/src/gallium/include/pipe/p_compiler.h
@@ -31,13 +31,8 @@
#include "p_config.h"
-#ifndef XFree86Server
#include <stdlib.h>
#include <string.h>
-#else
-#include "xf86_ansic.h"
-#include "xf86_libc.h"
-#endif
#include <stddef.h>
#include <stdarg.h>
@@ -79,6 +74,7 @@ typedef unsigned char boolean;
#define FALSE false
#endif
+typedef unsigned short half;
/* Function inlining */
#ifndef INLINE
diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h
index f82b77903e..6aba6ef1ee 100644
--- a/src/gallium/include/pipe/p_context.h
+++ b/src/gallium/include/pipe/p_context.h
@@ -58,7 +58,7 @@ struct pipe_context {
void (*destroy)( struct pipe_context * );
/**
- * VBO drawing (return false on fallbacks (temporary??))
+ * VBO drawing
*/
/*@{*/
void (*draw_arrays)( struct pipe_context *pipe,
@@ -177,6 +177,12 @@ struct pipe_context {
void (*bind_gs_state)(struct pipe_context *, void *);
void (*delete_gs_state)(struct pipe_context *, void *);
+ void * (*create_vertex_elements_state)(struct pipe_context *,
+ unsigned num_elements,
+ const struct pipe_vertex_element *);
+ void (*bind_vertex_elements_state)(struct pipe_context *, void *);
+ void (*delete_vertex_elements_state)(struct pipe_context *, void *);
+
/*@}*/
/**
@@ -208,21 +214,18 @@ struct pipe_context {
void (*set_viewport_state)( struct pipe_context *,
const struct pipe_viewport_state * );
- void (*set_fragment_sampler_textures)(struct pipe_context *,
- unsigned num_textures,
- struct pipe_texture **);
+ void (*set_fragment_sampler_views)(struct pipe_context *,
+ unsigned num_views,
+ struct pipe_sampler_view **);
- void (*set_vertex_sampler_textures)(struct pipe_context *,
- unsigned num_textures,
- struct pipe_texture **);
+ void (*set_vertex_sampler_views)(struct pipe_context *,
+ unsigned num_views,
+ struct pipe_sampler_view **);
void (*set_vertex_buffers)( struct pipe_context *,
unsigned num_buffers,
const struct pipe_vertex_buffer * );
- void (*set_vertex_elements)( struct pipe_context *,
- unsigned num_elements,
- const struct pipe_vertex_element * );
/*@}*/
@@ -303,6 +306,42 @@ struct pipe_context {
*/
unsigned int (*is_buffer_referenced)(struct pipe_context *pipe,
struct pipe_buffer *buf);
+
+ /**
+ * Create a view on a texture to be used by a shader stage.
+ */
+ struct pipe_sampler_view * (*create_sampler_view)(struct pipe_context *ctx,
+ struct pipe_texture *texture,
+ const struct pipe_sampler_view *templat);
+
+ void (*sampler_view_destroy)(struct pipe_context *ctx,
+ struct pipe_sampler_view *view);
+
+
+ /**
+ * Get a transfer object for transferring data to/from a texture.
+ *
+ * Transfers are (by default) context-private and allow uploads to be
+ * interleaved with
+ */
+ struct pipe_transfer *(*get_tex_transfer)(struct pipe_context *,
+ struct pipe_texture *texture,
+ unsigned face, unsigned level,
+ unsigned zslice,
+ enum pipe_transfer_usage usage,
+ unsigned x, unsigned y,
+ unsigned w, unsigned h);
+
+ void (*tex_transfer_destroy)(struct pipe_context *,
+ struct pipe_transfer *);
+
+ void *(*transfer_map)( struct pipe_context *,
+ struct pipe_transfer *transfer );
+
+ void (*transfer_unmap)( struct pipe_context *,
+ struct pipe_transfer *transfer );
+
+
};
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 5cebd43ace..c1e291b9da 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -176,11 +176,12 @@ enum pipe_texture_target {
#define PIPE_TEX_COMPARE_R_TO_TEXTURE 1
#define PIPE_TEXTURE_USAGE_RENDER_TARGET 0x1
-#define PIPE_TEXTURE_USAGE_DISPLAY_TARGET 0x2 /* ie a backbuffer */
-#define PIPE_TEXTURE_USAGE_PRIMARY 0x4 /* ie a frontbuffer */
+#define PIPE_TEXTURE_USAGE_DISPLAY_TARGET 0x2 /* windows presentable buffer, ie a backbuffer */
+#define PIPE_TEXTURE_USAGE_SCANOUT 0x4 /* ie a frontbuffer */
#define PIPE_TEXTURE_USAGE_DEPTH_STENCIL 0x8
#define PIPE_TEXTURE_USAGE_SAMPLER 0x10
#define PIPE_TEXTURE_USAGE_DYNAMIC 0x20
+#define PIPE_TEXTURE_USAGE_SHARED 0x40
/** Pipe driver custom usage flags should be greater or equal to this value */
#define PIPE_TEXTURE_USAGE_CUSTOM (1 << 16)
@@ -369,6 +370,17 @@ enum pipe_transfer_usage {
/**
+ * Texture swizzles
+ */
+#define PIPE_SWIZZLE_RED 0
+#define PIPE_SWIZZLE_GREEN 1
+#define PIPE_SWIZZLE_BLUE 2
+#define PIPE_SWIZZLE_ALPHA 3
+#define PIPE_SWIZZLE_ZERO 4
+#define PIPE_SWIZZLE_ONE 5
+
+
+/**
* Implementation capabilities/limits which are queried through
* pipe_screen::get_param() and pipe_screen::get_paramf().
*/
diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h
index cbf3273ec8..c7a90a09a1 100644
--- a/src/gallium/include/pipe/p_format.h
+++ b/src/gallium/include/pipe/p_format.h
@@ -44,119 +44,140 @@ extern "C" {
*/
enum pipe_format {
- PIPE_FORMAT_NONE = 0,
- PIPE_FORMAT_B8G8R8A8_UNORM = 1,
- PIPE_FORMAT_B8G8R8X8_UNORM = 2,
- PIPE_FORMAT_A8R8G8B8_UNORM = 3,
- PIPE_FORMAT_X8R8G8B8_UNORM = 4,
- PIPE_FORMAT_B5G5R5A1_UNORM = 5,
- PIPE_FORMAT_B4G4R4A4_UNORM = 6,
- PIPE_FORMAT_B5G6R5_UNORM = 7,
- PIPE_FORMAT_R10G10B10A2_UNORM = 8,
- PIPE_FORMAT_L8_UNORM = 9, /**< ubyte luminance */
- PIPE_FORMAT_A8_UNORM = 10, /**< ubyte alpha */
- PIPE_FORMAT_I8_UNORM = 11, /**< ubyte intensity */
- PIPE_FORMAT_L8A8_UNORM = 12, /**< ubyte alpha, luminance */
- PIPE_FORMAT_L16_UNORM = 13, /**< ushort luminance */
- PIPE_FORMAT_UYVY = 14,
- PIPE_FORMAT_YUYV = 15,
- PIPE_FORMAT_Z16_UNORM = 16,
- PIPE_FORMAT_Z32_UNORM = 17,
- PIPE_FORMAT_Z32_FLOAT = 18,
- PIPE_FORMAT_Z24S8_UNORM = 19,
- PIPE_FORMAT_S8Z24_UNORM = 20,
- PIPE_FORMAT_Z24X8_UNORM = 21,
- PIPE_FORMAT_X8Z24_UNORM = 22,
- PIPE_FORMAT_S8_UNORM = 23, /**< ubyte stencil */
- PIPE_FORMAT_R64_FLOAT = 24,
- PIPE_FORMAT_R64G64_FLOAT = 25,
- PIPE_FORMAT_R64G64B64_FLOAT = 26,
- PIPE_FORMAT_R64G64B64A64_FLOAT = 27,
- PIPE_FORMAT_R32_FLOAT = 28,
- PIPE_FORMAT_R32G32_FLOAT = 29,
- PIPE_FORMAT_R32G32B32_FLOAT = 30,
- PIPE_FORMAT_R32G32B32A32_FLOAT = 31,
- PIPE_FORMAT_R32_UNORM = 32,
- PIPE_FORMAT_R32G32_UNORM = 33,
- PIPE_FORMAT_R32G32B32_UNORM = 34,
- PIPE_FORMAT_R32G32B32A32_UNORM = 35,
- PIPE_FORMAT_R32_USCALED = 36,
- PIPE_FORMAT_R32G32_USCALED = 37,
- PIPE_FORMAT_R32G32B32_USCALED = 38,
- PIPE_FORMAT_R32G32B32A32_USCALED = 39,
- PIPE_FORMAT_R32_SNORM = 40,
- PIPE_FORMAT_R32G32_SNORM = 41,
- PIPE_FORMAT_R32G32B32_SNORM = 42,
- PIPE_FORMAT_R32G32B32A32_SNORM = 43,
- PIPE_FORMAT_R32_SSCALED = 44,
- PIPE_FORMAT_R32G32_SSCALED = 45,
- PIPE_FORMAT_R32G32B32_SSCALED = 46,
- PIPE_FORMAT_R32G32B32A32_SSCALED = 47,
- PIPE_FORMAT_R16_UNORM = 48,
- PIPE_FORMAT_R16G16_UNORM = 49,
- PIPE_FORMAT_R16G16B16_UNORM = 50,
- PIPE_FORMAT_R16G16B16A16_UNORM = 51,
- PIPE_FORMAT_R16_USCALED = 52,
- PIPE_FORMAT_R16G16_USCALED = 53,
- PIPE_FORMAT_R16G16B16_USCALED = 54,
- PIPE_FORMAT_R16G16B16A16_USCALED = 55,
- PIPE_FORMAT_R16_SNORM = 56,
- PIPE_FORMAT_R16G16_SNORM = 57,
- PIPE_FORMAT_R16G16B16_SNORM = 58,
- PIPE_FORMAT_R16G16B16A16_SNORM = 59,
- PIPE_FORMAT_R16_SSCALED = 60,
- PIPE_FORMAT_R16G16_SSCALED = 61,
- PIPE_FORMAT_R16G16B16_SSCALED = 62,
- PIPE_FORMAT_R16G16B16A16_SSCALED = 63,
- PIPE_FORMAT_R8_UNORM = 64,
- PIPE_FORMAT_R8G8_UNORM = 65,
- PIPE_FORMAT_R8G8B8_UNORM = 66,
- PIPE_FORMAT_R8G8B8A8_UNORM = 67,
- PIPE_FORMAT_X8B8G8R8_UNORM = 68,
- PIPE_FORMAT_R8_USCALED = 69,
- PIPE_FORMAT_R8G8_USCALED = 70,
- PIPE_FORMAT_R8G8B8_USCALED = 71,
- PIPE_FORMAT_R8G8B8A8_USCALED = 72,
- PIPE_FORMAT_R8_SNORM = 74,
- PIPE_FORMAT_R8G8_SNORM = 75,
- PIPE_FORMAT_R8G8B8_SNORM = 76,
- PIPE_FORMAT_R8G8B8A8_SNORM = 77,
- PIPE_FORMAT_R8_SSCALED = 82,
- PIPE_FORMAT_R8G8_SSCALED = 83,
- PIPE_FORMAT_R8G8B8_SSCALED = 84,
- PIPE_FORMAT_R8G8B8A8_SSCALED = 85,
- PIPE_FORMAT_R32_FIXED = 87,
- PIPE_FORMAT_R32G32_FIXED = 88,
- PIPE_FORMAT_R32G32B32_FIXED = 89,
- PIPE_FORMAT_R32G32B32A32_FIXED = 90,
- /* sRGB formats */
- PIPE_FORMAT_L8_SRGB = 91,
- PIPE_FORMAT_L8A8_SRGB = 92,
- PIPE_FORMAT_R8G8B8_SRGB = 93,
- PIPE_FORMAT_A8B8G8R8_SRGB = 94,
- PIPE_FORMAT_X8B8G8R8_SRGB = 95,
- PIPE_FORMAT_B8G8R8A8_SRGB = 96,
- PIPE_FORMAT_B8G8R8X8_SRGB = 97,
- PIPE_FORMAT_A8R8G8B8_SRGB = 98,
- PIPE_FORMAT_X8R8G8B8_SRGB = 99,
+ PIPE_FORMAT_NONE = 0,
+ PIPE_FORMAT_B8G8R8A8_UNORM = 1,
+ PIPE_FORMAT_B8G8R8X8_UNORM = 2,
+ PIPE_FORMAT_A8R8G8B8_UNORM = 3,
+ PIPE_FORMAT_X8R8G8B8_UNORM = 4,
+ PIPE_FORMAT_B5G5R5A1_UNORM = 5,
+ PIPE_FORMAT_B4G4R4A4_UNORM = 6,
+ PIPE_FORMAT_B5G6R5_UNORM = 7,
+ PIPE_FORMAT_R10G10B10A2_UNORM = 8,
+ PIPE_FORMAT_L8_UNORM = 9, /**< ubyte luminance */
+ PIPE_FORMAT_A8_UNORM = 10, /**< ubyte alpha */
+ PIPE_FORMAT_I8_UNORM = 11, /**< ubyte intensity */
+ PIPE_FORMAT_L8A8_UNORM = 12, /**< ubyte alpha, luminance */
+ PIPE_FORMAT_L16_UNORM = 13, /**< ushort luminance */
+ PIPE_FORMAT_UYVY = 14,
+ PIPE_FORMAT_YUYV = 15,
+ PIPE_FORMAT_Z16_UNORM = 16,
+ PIPE_FORMAT_Z32_UNORM = 17,
+ PIPE_FORMAT_Z32_FLOAT = 18,
+ PIPE_FORMAT_Z24_UNORM_S8_USCALED = 19,
+ PIPE_FORMAT_S8_USCALED_Z24_UNORM = 20,
+ PIPE_FORMAT_Z24X8_UNORM = 21,
+ PIPE_FORMAT_X8Z24_UNORM = 22,
+ PIPE_FORMAT_S8_USCALED = 23, /**< ubyte stencil */
+ PIPE_FORMAT_R64_FLOAT = 24,
+ PIPE_FORMAT_R64G64_FLOAT = 25,
+ PIPE_FORMAT_R64G64B64_FLOAT = 26,
+ PIPE_FORMAT_R64G64B64A64_FLOAT = 27,
+ PIPE_FORMAT_R32_FLOAT = 28,
+ PIPE_FORMAT_R32G32_FLOAT = 29,
+ PIPE_FORMAT_R32G32B32_FLOAT = 30,
+ PIPE_FORMAT_R32G32B32A32_FLOAT = 31,
+ PIPE_FORMAT_R32_UNORM = 32,
+ PIPE_FORMAT_R32G32_UNORM = 33,
+ PIPE_FORMAT_R32G32B32_UNORM = 34,
+ PIPE_FORMAT_R32G32B32A32_UNORM = 35,
+ PIPE_FORMAT_R32_USCALED = 36,
+ PIPE_FORMAT_R32G32_USCALED = 37,
+ PIPE_FORMAT_R32G32B32_USCALED = 38,
+ PIPE_FORMAT_R32G32B32A32_USCALED = 39,
+ PIPE_FORMAT_R32_SNORM = 40,
+ PIPE_FORMAT_R32G32_SNORM = 41,
+ PIPE_FORMAT_R32G32B32_SNORM = 42,
+ PIPE_FORMAT_R32G32B32A32_SNORM = 43,
+ PIPE_FORMAT_R32_SSCALED = 44,
+ PIPE_FORMAT_R32G32_SSCALED = 45,
+ PIPE_FORMAT_R32G32B32_SSCALED = 46,
+ PIPE_FORMAT_R32G32B32A32_SSCALED = 47,
+ PIPE_FORMAT_R16_UNORM = 48,
+ PIPE_FORMAT_R16G16_UNORM = 49,
+ PIPE_FORMAT_R16G16B16_UNORM = 50,
+ PIPE_FORMAT_R16G16B16A16_UNORM = 51,
+ PIPE_FORMAT_R16_USCALED = 52,
+ PIPE_FORMAT_R16G16_USCALED = 53,
+ PIPE_FORMAT_R16G16B16_USCALED = 54,
+ PIPE_FORMAT_R16G16B16A16_USCALED = 55,
+ PIPE_FORMAT_R16_SNORM = 56,
+ PIPE_FORMAT_R16G16_SNORM = 57,
+ PIPE_FORMAT_R16G16B16_SNORM = 58,
+ PIPE_FORMAT_R16G16B16A16_SNORM = 59,
+ PIPE_FORMAT_R16_SSCALED = 60,
+ PIPE_FORMAT_R16G16_SSCALED = 61,
+ PIPE_FORMAT_R16G16B16_SSCALED = 62,
+ PIPE_FORMAT_R16G16B16A16_SSCALED = 63,
+ PIPE_FORMAT_R8_UNORM = 64,
+ PIPE_FORMAT_R8G8_UNORM = 65,
+ PIPE_FORMAT_R8G8B8_UNORM = 66,
+ PIPE_FORMAT_R8G8B8A8_UNORM = 67,
+ PIPE_FORMAT_X8B8G8R8_UNORM = 68,
+ PIPE_FORMAT_R8_USCALED = 69,
+ PIPE_FORMAT_R8G8_USCALED = 70,
+ PIPE_FORMAT_R8G8B8_USCALED = 71,
+ PIPE_FORMAT_R8G8B8A8_USCALED = 72,
+ PIPE_FORMAT_R8_SNORM = 74,
+ PIPE_FORMAT_R8G8_SNORM = 75,
+ PIPE_FORMAT_R8G8B8_SNORM = 76,
+ PIPE_FORMAT_R8G8B8A8_SNORM = 77,
+ PIPE_FORMAT_R8_SSCALED = 82,
+ PIPE_FORMAT_R8G8_SSCALED = 83,
+ PIPE_FORMAT_R8G8B8_SSCALED = 84,
+ PIPE_FORMAT_R8G8B8A8_SSCALED = 85,
+ PIPE_FORMAT_R32_FIXED = 87,
+ PIPE_FORMAT_R32G32_FIXED = 88,
+ PIPE_FORMAT_R32G32B32_FIXED = 89,
+ PIPE_FORMAT_R32G32B32A32_FIXED = 90,
+ PIPE_FORMAT_R16_FLOAT = 91,
+ PIPE_FORMAT_R16G16_FLOAT = 92,
+ PIPE_FORMAT_R16G16B16_FLOAT = 93,
+ PIPE_FORMAT_R16G16B16A16_FLOAT = 94,
- /* mixed formats */
- PIPE_FORMAT_R8SG8SB8UX8U_NORM = 100,
- PIPE_FORMAT_R5SG5SB6U_NORM = 101,
+ /* sRGB formats */
+ PIPE_FORMAT_L8_SRGB = 95,
+ PIPE_FORMAT_L8A8_SRGB = 96,
+ PIPE_FORMAT_R8G8B8_SRGB = 97,
+ PIPE_FORMAT_A8B8G8R8_SRGB = 98,
+ PIPE_FORMAT_X8B8G8R8_SRGB = 99,
+ PIPE_FORMAT_B8G8R8A8_SRGB = 100,
+ PIPE_FORMAT_B8G8R8X8_SRGB = 101,
+ PIPE_FORMAT_A8R8G8B8_SRGB = 102,
+ PIPE_FORMAT_X8R8G8B8_SRGB = 103,
+ PIPE_FORMAT_R8G8B8A8_SRGB = 104,
/* compressed formats */
- PIPE_FORMAT_DXT1_RGB = 102,
- PIPE_FORMAT_DXT1_RGBA = 103,
- PIPE_FORMAT_DXT3_RGBA = 104,
- PIPE_FORMAT_DXT5_RGBA = 105,
+ PIPE_FORMAT_DXT1_RGB = 105,
+ PIPE_FORMAT_DXT1_RGBA = 106,
+ PIPE_FORMAT_DXT3_RGBA = 107,
+ PIPE_FORMAT_DXT5_RGBA = 108,
/* sRGB, compressed */
- PIPE_FORMAT_DXT1_SRGB = 106,
- PIPE_FORMAT_DXT1_SRGBA = 107,
- PIPE_FORMAT_DXT3_SRGBA = 108,
- PIPE_FORMAT_DXT5_SRGBA = 109,
+ PIPE_FORMAT_DXT1_SRGB = 109,
+ PIPE_FORMAT_DXT1_SRGBA = 110,
+ PIPE_FORMAT_DXT3_SRGBA = 111,
+ PIPE_FORMAT_DXT5_SRGBA = 112,
- PIPE_FORMAT_A8B8G8R8_UNORM = 110,
+ /* rgtc compressed */
+ PIPE_FORMAT_RGTC1_UNORM = 113,
+ PIPE_FORMAT_RGTC1_SNORM = 114,
+ PIPE_FORMAT_RGTC2_UNORM = 115,
+ PIPE_FORMAT_RGTC2_SNORM = 116,
+
+ PIPE_FORMAT_R8G8_B8G8_UNORM = 117,
+ PIPE_FORMAT_G8R8_G8B8_UNORM = 118,
+
+ /* mixed formats */
+ PIPE_FORMAT_R8SG8SB8UX8U_NORM = 119,
+ PIPE_FORMAT_R5SG5SB6U_NORM = 120,
+
+ PIPE_FORMAT_A8B8G8R8_UNORM = 121,
+ PIPE_FORMAT_B5G5R5X1_UNORM = 122,
+ PIPE_FORMAT_R10G10B10A2_USCALED = 123,
+ PIPE_FORMAT_R11G11B10_FLOAT = 124,
+ PIPE_FORMAT_R9G9B9E5_FLOAT = 125,
+ PIPE_FORMAT_Z32_FLOAT_S8X24_USCALED = 126,
+ PIPE_FORMAT_R1_UNORM = 127,
PIPE_FORMAT_COUNT
};
diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h
index e4a9222809..b7cb83abbe 100644
--- a/src/gallium/include/pipe/p_screen.h
+++ b/src/gallium/include/pipe/p_screen.h
@@ -50,6 +50,8 @@ extern "C" {
/** Opaque type */
+struct winsys_handle;
+/** Opaque type */
struct pipe_fence_handle;
struct pipe_winsys;
struct pipe_buffer;
@@ -108,16 +110,23 @@ struct pipe_screen {
const struct pipe_texture *templat);
/**
- * Create a new texture object, using the given template info, but on top of
- * existing memory.
- *
- * It is assumed that the buffer data is layed out according to the expected
- * by the hardware. NULL will be returned if any inconsistency is found.
+ * Create a texture from a winsys_handle. The handle is often created in
+ * another process by first creating a pipe texture and then calling
+ * texture_get_handle.
*/
- struct pipe_texture * (*texture_blanket)(struct pipe_screen *,
- const struct pipe_texture *templat,
- const unsigned *stride,
- struct pipe_buffer *buffer);
+ struct pipe_texture * (*texture_from_handle)(struct pipe_screen *,
+ const struct pipe_texture *templat,
+ struct winsys_handle *handle);
+
+ /**
+ * Get a winsys_handle from a texture. Some platforms/winsys requires
+ * that the texture is created with a special usage flag like
+ * DISPLAYTARGET or PRIMARY.
+ */
+ boolean (*texture_get_handle)(struct pipe_screen *,
+ struct pipe_texture *tex,
+ struct winsys_handle *handle);
+
void (*texture_destroy)(struct pipe_texture *pt);
@@ -133,23 +142,6 @@ struct pipe_screen {
void (*tex_surface_destroy)(struct pipe_surface *);
- /** Get a transfer object for transferring data to/from a texture */
- struct pipe_transfer *(*get_tex_transfer)(struct pipe_screen *,
- struct pipe_texture *texture,
- unsigned face, unsigned level,
- unsigned zslice,
- enum pipe_transfer_usage usage,
- unsigned x, unsigned y,
- unsigned w, unsigned h);
-
- void (*tex_transfer_destroy)(struct pipe_transfer *);
-
- void *(*transfer_map)( struct pipe_screen *,
- struct pipe_transfer *transfer );
-
- void (*transfer_unmap)( struct pipe_screen *,
- struct pipe_transfer *transfer );
-
/**
* Create a new buffer.
@@ -187,23 +179,6 @@ struct pipe_screen {
void *ptr,
unsigned bytes);
- /**
- * Allocate storage for a display target surface.
- *
- * Often surfaces which are meant to be blitted to the front screen (i.e.,
- * display targets) must be allocated with special characteristics, memory
- * pools, or obtained directly from the windowing system.
- *
- * This callback is invoked by the pipe_screenwhen creating a texture marked
- * with the PIPE_TEXTURE_USAGE_DISPLAY_TARGET flag to get the underlying
- * buffer storage.
- */
- struct pipe_buffer *(*surface_buffer_create)(struct pipe_screen *screen,
- unsigned width, unsigned height,
- enum pipe_format format,
- unsigned usage,
- unsigned tex_usage,
- unsigned *stride);
/**
@@ -273,6 +248,7 @@ struct pipe_screen {
/**
* Do any special operations to ensure buffer size is correct
+ * \param context_private the private data of the calling context
*/
void (*update_buffer)( struct pipe_screen *ws,
void *context_private );
@@ -280,10 +256,12 @@ struct pipe_screen {
/**
* Do any special operations to ensure frontbuffer contents are
* displayed, eg copy fake frontbuffer.
+ * \param winsys_drawable_handle an opaque handle that the calling context
+ * gets out-of-band
*/
void (*flush_frontbuffer)( struct pipe_screen *screen,
struct pipe_surface *surf,
- void *context_private );
+ void *winsys_drawable_handle );
diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index 02558520bf..11072407d9 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -249,7 +249,7 @@ struct pipe_framebuffer_state
{
unsigned width, height;
- /** multiple colorbuffers for multiple render targets */
+ /** multiple color buffers for multiple render targets */
unsigned nr_cbufs;
struct pipe_surface *cbufs[PIPE_MAX_COLOR_BUFS];
@@ -285,12 +285,12 @@ struct pipe_sampler_state
struct pipe_surface
{
struct pipe_reference reference;
- enum pipe_format format; /**< PIPE_FORMAT_x */
+ enum pipe_format format;
unsigned width; /**< logical width in pixels */
unsigned height; /**< logical height in pixels */
unsigned layout; /**< PIPE_SURFACE_LAYOUT_x */
unsigned offset; /**< offset from start of buffer, in bytes */
- unsigned usage; /**< PIPE_BUFFER_USAGE_* */
+ unsigned usage; /**< bitmask of PIPE_BUFFER_USAGE_x */
unsigned zslice;
struct pipe_texture *texture; /**< texture into which this is a view */
@@ -300,6 +300,24 @@ struct pipe_surface
/**
+ * A view into a texture that can be bound to a shader stage.
+ */
+struct pipe_sampler_view
+{
+ struct pipe_reference reference;
+ enum pipe_format format; /**< typed PIPE_FORMAT_x */
+ struct pipe_texture *texture; /**< texture into which this is a view */
+ struct pipe_context *context; /**< context this view belongs to */
+ unsigned first_level:8; /**< first mipmap level */
+ unsigned last_level:8; /**< last mipmap level */
+ unsigned swizzle_r:3; /**< PIPE_SWIZZLE_x for red component */
+ unsigned swizzle_g:3; /**< PIPE_SWIZZLE_x for green component */
+ unsigned swizzle_b:3; /**< PIPE_SWIZZLE_x for blue component */
+ unsigned swizzle_a:3; /**< PIPE_SWIZZLE_x for alpha component */
+};
+
+
+/**
* Transfer object. For data transfer to/from a texture.
*/
struct pipe_transfer
@@ -336,7 +354,7 @@ struct pipe_texture
unsigned nr_samples:8; /**< for multisampled surfaces, nr of samples */
- unsigned tex_usage; /* PIPE_TEXTURE_USAGE_* */
+ unsigned tex_usage; /**< bitmask of PIPE_TEXTURE_USAGE_* */
struct pipe_screen *screen; /**< screen that this texture belongs to */
};
@@ -373,9 +391,8 @@ struct pipe_vertex_element
* this attribute live in?
*/
unsigned vertex_buffer_index:8;
- unsigned nr_components:8;
- enum pipe_format src_format; /**< PIPE_FORMAT_* */
+ enum pipe_format src_format;
};
diff --git a/src/gallium/include/state_tracker/dri1_api.h b/src/gallium/include/state_tracker/dri1_api.h
index b173ba3683..bb1cd6d1d8 100644
--- a/src/gallium/include/state_tracker/dri1_api.h
+++ b/src/gallium/include/state_tracker/dri1_api.h
@@ -7,14 +7,14 @@
#include "state_tracker/drm_api.h"
-#include <drm.h>
-
struct pipe_screen;
struct pipe_winsys;
struct pipe_buffer;
struct pipe_context;
struct pipe_texture;
+struct drm_clip_rect;
+
struct dri1_api_version
{
int major;
@@ -31,8 +31,8 @@ struct dri1_api_lock_funcs
{
void (*lock) (struct pipe_context * pipe);
void (*unlock) (struct pipe_context * locked_pipe);
- boolean(*is_locked) (struct pipe_context * locked_pipe);
- boolean(*is_lock_lost) (struct pipe_context * locked_pipe);
+ boolean(*is_locked) (struct pipe_context * locked_pipe);
+ boolean(*is_lock_lost) (struct pipe_context * locked_pipe);
void (*clear_lost_lock) (struct pipe_context * locked_pipe);
};
diff --git a/src/gallium/include/state_tracker/drisw_api.h b/src/gallium/include/state_tracker/drisw_api.h
new file mode 100644
index 0000000000..c6adebb4ec
--- /dev/null
+++ b/src/gallium/include/state_tracker/drisw_api.h
@@ -0,0 +1,35 @@
+#ifndef _DRISW_API_H_
+#define _DRISW_API_H_
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_screen.h"
+#include "pipe/p_format.h"
+
+#include "state_tracker/drm_api.h"
+
+struct pipe_screen;
+struct pipe_winsys;
+struct pipe_buffer;
+struct pipe_context;
+struct pipe_texture;
+
+struct dri_drawable;
+
+/**
+ * This callback struct is intended for the winsys to call the loader.
+ */
+
+struct drisw_loader_funcs
+{
+ void (*put_image) (struct dri_drawable *dri_drawable,
+ void *data, unsigned width, unsigned height);
+};
+
+struct drisw_create_screen_arg
+{
+ struct drm_create_screen_arg base;
+
+ struct drisw_loader_funcs *lf;
+};
+
+#endif
diff --git a/src/gallium/include/state_tracker/drm_api.h b/src/gallium/include/state_tracker/drm_api.h
index e9fa9b4d2a..9780cf250b 100644
--- a/src/gallium/include/state_tracker/drm_api.h
+++ b/src/gallium/include/state_tracker/drm_api.h
@@ -13,10 +13,37 @@ struct pipe_texture;
enum drm_create_screen_mode {
DRM_CREATE_NORMAL = 0,
DRM_CREATE_DRI1,
+ DRM_CREATE_DRISW,
DRM_CREATE_DRIVER = 1024,
DRM_CREATE_MAX
};
+#define DRM_API_HANDLE_TYPE_SHARED 0
+#define DRM_API_HANDLE_TYPE_KMS 1
+
+/**
+ * For use with pipe_screen::{texture_from_handle|texture_get_handle}.
+ */
+struct winsys_handle
+{
+ /**
+ * Unused for texture_from_handle, always
+ * DRM_API_HANDLE_TYPE_SHARED. Input to texture_get_handle,
+ * use TEXTURE_USAGE to select handle for kms or ipc.
+ */
+ unsigned type;
+ /**
+ * Input to texture_from_handle.
+ * Output for texture_get_handle.
+ */
+ unsigned handle;
+ /**
+ * Input to texture_from_handle.
+ * Output for texture_get_handle.
+ */
+ unsigned stride;
+};
+
/**
* Modes other than DRM_CREATE_NORMAL derive from this struct.
*/
@@ -28,6 +55,8 @@ struct drm_create_screen_arg {
struct drm_api
{
+ void (*destroy)(struct drm_api *api);
+
const char *name;
/**
@@ -36,37 +65,10 @@ struct drm_api
const char *driver_name;
/**
- * Special buffer functions
+ * Create a pipe srcreen.
*/
- /*@{*/
struct pipe_screen* (*create_screen)(struct drm_api *api, int drm_fd,
struct drm_create_screen_arg *arg);
- /*@}*/
-
- /**
- * Special buffer functions
- */
- /*@{*/
- struct pipe_texture*
- (*texture_from_shared_handle)(struct drm_api *api,
- struct pipe_screen *screen,
- struct pipe_texture *templ,
- const char *name,
- unsigned stride,
- unsigned handle);
- boolean (*shared_handle_from_texture)(struct drm_api *api,
- struct pipe_screen *screen,
- struct pipe_texture *texture,
- unsigned *stride,
- unsigned *handle);
- boolean (*local_handle_from_texture)(struct drm_api *api,
- struct pipe_screen *screen,
- struct pipe_texture *texture,
- unsigned *stride,
- unsigned *handle);
- /*@}*/
-
- void (*destroy)(struct drm_api *api);
};
extern struct drm_api * drm_api_create(void);
diff --git a/src/gallium/include/state_tracker/graw.h b/src/gallium/include/state_tracker/graw.h
new file mode 100644
index 0000000000..a58e18e473
--- /dev/null
+++ b/src/gallium/include/state_tracker/graw.h
@@ -0,0 +1,36 @@
+#ifndef GALLIUM_RAW_H
+#define GALLIUM_RAW_H
+
+/* This is an API for exercising gallium functionality in a
+ * platform-neutral fashion. Whatever platform integration is
+ * necessary to implement this interface is orchestrated by the
+ * individual target building this entity.
+ *
+ * For instance, the graw-xlib target includes code to implent these
+ * interfaces on top of the X window system.
+ *
+ * Programs using this interface may additionally benefit from some of
+ * the utilities currently in the libgallium.a library, especially
+ * those for parsing text representations of TGSI shaders.
+ */
+
+#include "pipe/p_format.h"
+
+struct pipe_screen;
+
+struct pipe_screen *graw_init( void );
+
+/* Returns a handle to be used with flush_frontbuffer()/present().
+ *
+ * Query format support with screen::is_format_supported and usage
+ * XXX.
+ */
+void *graw_create_window( int x,
+ int y,
+ unsigned width,
+ unsigned height,
+ enum pipe_format format );
+
+void graw_destroy_window( void *handle );
+
+#endif
diff --git a/src/gallium/include/state_tracker/st_api.h b/src/gallium/include/state_tracker/st_api.h
new file mode 100644
index 0000000000..70ad215bfc
--- /dev/null
+++ b/src/gallium/include/state_tracker/st_api.h
@@ -0,0 +1,407 @@
+/**********************************************************
+ * Copyright 2010 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+
+#ifndef _ST_API_H_
+#define _ST_API_H_
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_format.h"
+
+/**
+ * \file API for communication between state trackers and state tracker
+ * managers.
+ *
+ * While both are state tackers, we use the term state tracker for rendering
+ * APIs such as OpenGL or OpenVG, and state tracker manager for window system
+ * APIs such as EGL or GLX in this file.
+ *
+ * This file defines an API to be implemented by both state trackers and state
+ * tracker managers.
+ */
+
+/**
+ * The entry points of the state trackers.
+ */
+#define ST_MODULE_OPENGL_SYMBOL "st_module_OpenGL"
+#define ST_MODULE_OPENGL_ES1_SYMBOL "st_module_OpenGL_ES1"
+#define ST_MODULE_OPENGL_ES2_SYMBOL "st_module_OpenGL_ES2"
+#define ST_MODULE_OPENVG_SYMBOL "st_module_OpenVG"
+
+/**
+ * The supported rendering API of a state tracker.
+ */
+enum st_api_type {
+ ST_API_OPENGL,
+ ST_API_OPENGL_ES1,
+ ST_API_OPENGL_ES2,
+ ST_API_OPENVG,
+
+ ST_API_COUNT
+};
+
+/**
+ * Used in st_context_iface->teximage.
+ */
+enum st_texture_type {
+ ST_TEXTURE_1D,
+ ST_TEXTURE_2D,
+ ST_TEXTURE_3D,
+ ST_TEXTURE_RECT,
+};
+
+/**
+ * Available attachments of framebuffer.
+ */
+enum st_attachment_type {
+ ST_ATTACHMENT_FRONT_LEFT,
+ ST_ATTACHMENT_BACK_LEFT,
+ ST_ATTACHMENT_FRONT_RIGHT,
+ ST_ATTACHMENT_BACK_RIGHT,
+ ST_ATTACHMENT_DEPTH_STENCIL,
+ ST_ATTACHMENT_ACCUM,
+ ST_ATTACHMENT_SAMPLE,
+
+ ST_ATTACHMENT_COUNT,
+ ST_ATTACHMENT_INVALID = -1
+};
+
+/* for buffer_mask in st_visual */
+#define ST_ATTACHMENT_FRONT_LEFT_MASK (1 << ST_ATTACHMENT_FRONT_LEFT)
+#define ST_ATTACHMENT_BACK_LEFT_MASK (1 << ST_ATTACHMENT_BACK_LEFT)
+#define ST_ATTACHMENT_FRONT_RIGHT_MASK (1 << ST_ATTACHMENT_FRONT_RIGHT)
+#define ST_ATTACHMENT_BACK_RIGHT_MASK (1 << ST_ATTACHMENT_BACK_RIGHT)
+#define ST_ATTACHMENT_DEPTH_STENCIL_MASK (1 << ST_ATTACHMENT_DEPTH_STENCIL)
+#define ST_ATTACHMENT_ACCUM_MASK (1 << ST_ATTACHMENT_ACCUM)
+#define ST_ATTACHMENT_SAMPLE_MASK (1 << ST_ATTACHMENT_SAMPLE)
+
+/**
+ * Enumerations of state tracker context resources.
+ */
+enum st_context_resource_type {
+ ST_CONTEXT_RESOURCE_OPENGL_TEXTURE_2D,
+ ST_CONTEXT_RESOURCE_OPENGL_TEXTURE_3D,
+ ST_CONTEXT_RESOURCE_OPENGL_TEXTURE_CUBE_MAP_POSITIVE_X,
+ ST_CONTEXT_RESOURCE_OPENGL_TEXTURE_CUBE_MAP_NEGATIVE_X,
+ ST_CONTEXT_RESOURCE_OPENGL_TEXTURE_CUBE_MAP_POSITIVE_Y,
+ ST_CONTEXT_RESOURCE_OPENGL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
+ ST_CONTEXT_RESOURCE_OPENGL_TEXTURE_CUBE_MAP_POSITIVE_Z,
+ ST_CONTEXT_RESOURCE_OPENGL_TEXTURE_CUBE_MAP_NEGATIVE_Z,
+ ST_CONTEXT_RESOURCE_OPENGL_RENDERBUFFER,
+ ST_CONTEXT_RESOURCE_OPENVG_PARENT_IMAGE,
+};
+
+/**
+ * The return type of st_api->get_proc_address.
+ */
+typedef void (*st_proc_t)(void);
+
+struct pipe_context;
+struct pipe_texture;
+struct pipe_fence_handle;
+
+/**
+ * Used in st_context_iface->get_resource_for_egl_image.
+ */
+struct st_context_resource
+{
+ /* these fields are filled by the caller */
+ enum st_context_resource_type type;
+ void *resource;
+
+ /* this is owned by the caller */
+ struct pipe_texture *texture;
+};
+
+/**
+ * Used in st_manager_iface->get_egl_image.
+ */
+struct st_egl_image
+{
+ /* these fields are filled by the caller */
+ struct st_context_iface *stctxi;
+ void *egl_image;
+
+ /* this is owned by the caller */
+ struct pipe_texture *texture;
+
+ unsigned face;
+ unsigned level;
+ unsigned zslice;
+};
+
+/**
+ * Represent the visual of a framebuffer.
+ */
+struct st_visual
+{
+ /**
+ * Available buffers. Tested with ST_FRAMEBUFFER_*_MASK.
+ */
+ unsigned buffer_mask;
+
+ /**
+ * Buffer formats. The formats are always set even when the buffer is
+ * not available.
+ */
+ enum pipe_format color_format;
+ enum pipe_format depth_stencil_format;
+ enum pipe_format accum_format;
+ int samples;
+
+ /**
+ * Desired render buffer.
+ */
+ enum st_attachment_type render_buffer;
+};
+
+/**
+ * Represent a windowing system drawable.
+ *
+ * The framebuffer is implemented by the state tracker manager and
+ * used by the state trackers.
+ *
+ * Instead of the winsys pokeing into the API context to figure
+ * out what buffers that might be needed in the future by the API
+ * context, it calls into the framebuffer to get the textures.
+ *
+ * This structure along with the notify_invalid_framebuffer
+ * allows framebuffers to be shared between different threads
+ * but at the same make the API context free from thread
+ * syncronisation primitves, with the exception of a small
+ * atomic flag used for notification of framebuffer dirty status.
+ *
+ * The thread syncronisation is put inside the framebuffer
+ * and only called once the framebuffer has become dirty.
+ */
+struct st_framebuffer_iface
+{
+ /**
+ * Available for the state tracker manager to use.
+ */
+ void *st_manager_private;
+
+ /**
+ * The visual of a framebuffer.
+ */
+ const struct st_visual *visual;
+
+ /**
+ * Flush the front buffer.
+ *
+ * On some window systems, changes to the front buffers are not immediately
+ * visible. They need to be flushed.
+ *
+ * @att is one of the front buffer attachments.
+ */
+ boolean (*flush_front)(struct st_framebuffer_iface *stfbi,
+ enum st_attachment_type statt);
+
+ /**
+ * The state tracker asks for the textures it needs.
+ *
+ * It should try to only ask for attachments that it currently renders
+ * to, thus allowing the winsys to delay the allocation of textures not
+ * needed. For example front buffer attachments are not needed if you
+ * only do back buffer rendering.
+ *
+ * The implementor of this function needs to also ensure
+ * thread safty as this call might be done from multiple threads.
+ *
+ * The returned textures are owned by the caller. They should be
+ * unreferenced when no longer used. If this function is called multiple
+ * times with different sets of attachments, those buffers not included in
+ * the last call might be destroyed. This behavior might change in the
+ * future.
+ */
+ boolean (*validate)(struct st_framebuffer_iface *stfbi,
+ const enum st_attachment_type *statts,
+ unsigned count,
+ struct pipe_texture **out);
+};
+
+/**
+ * Represent a rendering context.
+ *
+ * This entity is created from st_api and used by the state tracker manager.
+ */
+struct st_context_iface
+{
+ /**
+ * Available for the state tracker and the manager to use.
+ */
+ void *st_context_private;
+ void *st_manager_private;
+
+ /**
+ * Destroy the context.
+ */
+ void (*destroy)(struct st_context_iface *stctxi);
+
+ /**
+ * Invalidate the current textures that was taken from a framebuffer.
+ *
+ * The state tracker manager calls this function to let the rendering
+ * context know that it should update the textures it got from
+ * st_framebuffer_iface::validate. It should do so at the latest time possible.
+ * Possible right before sending triangles to the pipe context.
+ *
+ * For certain platforms this function might be called from a thread other
+ * than the thread that the context is currently bound in, and must
+ * therefore be thread safe. But it is the state tracker manager's
+ * responsibility to make sure that the framebuffer is bound to the context
+ * and the API context is current for the duration of this call.
+ *
+ * Thus reducing the sync primitive needed to a single atomic flag.
+ */
+ void (*notify_invalid_framebuffer)(struct st_context_iface *stctxi,
+ struct st_framebuffer_iface *stfbi);
+
+ /**
+ * Flush all drawing from context to the pipe also flushes the pipe.
+ */
+ void (*flush)(struct st_context_iface *stctxi, unsigned flags,
+ struct pipe_fence_handle **fence);
+
+ /**
+ * Replace the texture image of a texture object at the specified level.
+ *
+ * This function is optional.
+ */
+ boolean (*teximage)(struct st_context_iface *stctxi, enum st_texture_type target,
+ int level, enum pipe_format internal_format,
+ struct pipe_texture *tex, boolean mipmap);
+
+ /**
+ * Used to implement glXCopyContext.
+ */
+ void (*copy)(struct st_context_iface *stctxi,
+ struct st_context_iface *stsrci, unsigned mask);
+
+ /**
+ * Look up and return the info of a resource for EGLImage.
+ *
+ * This function is optional.
+ */
+ boolean (*get_resource_for_egl_image)(struct st_context_iface *stctxi,
+ struct st_context_resource *stres);
+};
+
+
+/**
+ * Represent a state tracker manager.
+ *
+ * This interface is implemented by the state tracker manager. It corresponds
+ * to a "display" in the window system.
+ */
+struct st_manager
+{
+ struct pipe_screen *screen;
+
+ /**
+ * Look up and return the info of an EGLImage.
+ *
+ * This function is optional.
+ */
+ boolean (*get_egl_image)(struct st_manager *smapi,
+ struct st_egl_image *stimg);
+};
+
+/**
+ * Represent a rendering API such as OpenGL or OpenVG.
+ *
+ * Implemented by the state tracker and used by the state tracker manager.
+ */
+struct st_api
+{
+ /**
+ * Destroy the API.
+ */
+ void (*destroy)(struct st_api *stapi);
+
+ /**
+ * Return an API entry point.
+ *
+ * For GL this is the same as _glapi_get_proc_address.
+ */
+ st_proc_t (*get_proc_address)(struct st_api *stapi, const char *procname);
+
+ /**
+ * Return true if the visual is supported by the state tracker.
+ */
+ boolean (*is_visual_supported)(struct st_api *stapi,
+ const struct st_visual *visual);
+
+ /**
+ * Create a rendering context.
+ */
+ struct st_context_iface *(*create_context)(struct st_api *stapi,
+ struct st_manager *smapi,
+ const struct st_visual *visual,
+ struct st_context_iface *stsharei);
+
+ /**
+ * Bind the context to the calling thread with draw and read as drawables.
+ *
+ * The framebuffers might have different visuals than the context does.
+ */
+ boolean (*make_current)(struct st_api *stapi,
+ struct st_context_iface *stctxi,
+ struct st_framebuffer_iface *stdrawi,
+ struct st_framebuffer_iface *streadi);
+
+ /**
+ * Get the currently bound context in the calling thread.
+ */
+ struct st_context_iface *(*get_current)(struct st_api *stapi);
+};
+
+/**
+ * Represent a state tracker.
+ *
+ * This is the entry point of a state tracker.
+ */
+struct st_module
+{
+ enum st_api_type api;
+ struct st_api *(*create_api)(void);
+};
+
+/**
+ * Return true if the visual has the specified buffers.
+ */
+static INLINE boolean
+st_visual_have_buffers(const struct st_visual *visual, unsigned mask)
+{
+ return ((visual->buffer_mask & mask) == mask);
+}
+
+/* these symbols may need to be dynamically lookup up */
+extern PUBLIC const struct st_module st_module_OpenGL;
+extern PUBLIC const struct st_module st_module_OpenGL_ES1;
+extern PUBLIC const struct st_module st_module_OpenGL_ES2;
+extern PUBLIC const struct st_module st_module_OpenVG;
+
+#endif /* _ST_API_H_ */
diff --git a/src/gallium/drivers/llvmpipe/lp_winsys.h b/src/gallium/include/state_tracker/sw_winsys.h
index ce11fa9304..a87650dc77 100644
--- a/src/gallium/drivers/llvmpipe/lp_winsys.h
+++ b/src/gallium/include/state_tracker/sw_winsys.h
@@ -27,12 +27,12 @@
/**
* @file
- * llvmpipe public interface.
+ * Software rasterizer winsys.
*/
-#ifndef LP_WINSYS_H
-#define LP_WINSYS_H
+#ifndef SW_WINSYS_H
+#define SW_WINSYS_H
#include "pipe/p_compiler.h" /* for boolean */
@@ -44,30 +44,33 @@ extern "C" {
#endif
+struct winsys_handle;
struct pipe_screen;
struct pipe_context;
+struct pipe_texture;
/**
* Opaque pointer.
*/
-struct llvmpipe_displaytarget;
+struct sw_displaytarget;
/**
- * This is the interface that llvmpipe expects any window system
+ * This is the interface that sw expects any window system
* hosting it to implement.
*
- * llvmpipe is for the most part a self sufficient driver. The only thing it
+ * sw is for the most part a self sufficient driver. The only thing it
* does not know is how to display a surface.
*/
-struct llvmpipe_winsys
+struct sw_winsys
{
void
- (*destroy)( struct llvmpipe_winsys *ws );
+ (*destroy)( struct sw_winsys *ws );
boolean
- (*is_displaytarget_format_supported)( struct llvmpipe_winsys *ws,
+ (*is_displaytarget_format_supported)( struct sw_winsys *ws,
+ unsigned tex_usage,
enum pipe_format format );
/**
@@ -81,21 +84,42 @@ struct llvmpipe_winsys
* with the PIPE_TEXTURE_USAGE_DISPLAY_TARGET flag to get the underlying
* storage.
*/
- struct llvmpipe_displaytarget *
- (*displaytarget_create)( struct llvmpipe_winsys *ws,
+ struct sw_displaytarget *
+ (*displaytarget_create)( struct sw_winsys *ws,
+ unsigned tex_usage,
enum pipe_format format,
unsigned width, unsigned height,
unsigned alignment,
unsigned *stride );
+ /**
+ * Used to implement texture_from_handle.
+ */
+ struct sw_displaytarget *
+ (*displaytarget_from_handle)( struct sw_winsys *ws,
+ const struct pipe_texture *templat,
+ struct winsys_handle *whandle,
+ unsigned *stride );
+
+ /**
+ * Used to implement texture_get_handle.
+ */
+ boolean
+ (*displaytarget_get_handle)( struct sw_winsys *ws,
+ struct sw_displaytarget *dt,
+ struct winsys_handle *whandle );
+
+ /**
+ * \param flags bitmask of PIPE_BUFFER_USAGE_x flags
+ */
void *
- (*displaytarget_map)( struct llvmpipe_winsys *ws,
- struct llvmpipe_displaytarget *dt,
+ (*displaytarget_map)( struct sw_winsys *ws,
+ struct sw_displaytarget *dt,
unsigned flags );
void
- (*displaytarget_unmap)( struct llvmpipe_winsys *ws,
- struct llvmpipe_displaytarget *dt );
+ (*displaytarget_unmap)( struct sw_winsys *ws,
+ struct sw_displaytarget *dt );
/**
* @sa pipe_screen:flush_frontbuffer.
@@ -103,23 +127,19 @@ struct llvmpipe_winsys
* This call will likely become asynchronous eventually.
*/
void
- (*displaytarget_display)( struct llvmpipe_winsys *ws,
- struct llvmpipe_displaytarget *dt,
+ (*displaytarget_display)( struct sw_winsys *ws,
+ struct sw_displaytarget *dt,
void *context_private );
void
- (*displaytarget_destroy)( struct llvmpipe_winsys *ws,
- struct llvmpipe_displaytarget *dt );
+ (*displaytarget_destroy)( struct sw_winsys *ws,
+ struct sw_displaytarget *dt );
};
-struct pipe_screen *
-llvmpipe_create_screen( struct llvmpipe_winsys * );
-
-
#ifdef __cplusplus
}
#endif
-#endif /* LP_WINSYS_H */
+#endif /* SW_WINSYS_H */
diff --git a/src/gallium/include/state_tracker/xlib_sw_winsys.h b/src/gallium/include/state_tracker/xlib_sw_winsys.h
new file mode 100644
index 0000000000..f22c22bb62
--- /dev/null
+++ b/src/gallium/include/state_tracker/xlib_sw_winsys.h
@@ -0,0 +1,29 @@
+#ifndef XLIB_SW_WINSYS_H
+#define XLIB_SW_WINSYS_H
+
+#include "state_tracker/sw_winsys.h"
+#include <X11/Xlib.h>
+
+
+struct pipe_screen;
+struct pipe_surface;
+
+/* This is what the xlib software winsys expects to find in the
+ * "private" field of flush_frontbuffers().
+ *
+ * Xlib-based state trackers somehow need to know this.
+ */
+struct xlib_drawable {
+ Visual *visual;
+ int depth;
+ Drawable drawable;
+};
+
+
+/* This is the public interface to the ws/xlib module. Why isn't it
+ * being defined in that directory?
+ */
+struct sw_winsys *xlib_create_sw_winsys( Display *display );
+
+
+#endif
diff --git a/src/gallium/state_trackers/dri/Makefile b/src/gallium/state_trackers/dri/Makefile
index ef8f19709a..72e70577b3 100644
--- a/src/gallium/state_trackers/dri/Makefile
+++ b/src/gallium/state_trackers/dri/Makefile
@@ -1,28 +1,12 @@
+# src/gallium/state_trackers/dri/Makefile
TOP = ../../../..
include $(TOP)/configs/current
-LIBNAME = dridrm
+SUBDIRS = drm sw
-LIBRARY_INCLUDES = \
- -I$(TOP)/include \
- -I$(TOP)/src/mesa \
- -I$(TOP)/src/mesa/drivers/dri/common \
- -I$(TOP)/src/mesa/main \
- $(shell pkg-config --cflags-only-I libdrm)
-
-
-C_SOURCES = \
- dri_context.c \
- dri_screen.c \
- dri_drawable.c \
- dri_extensions.c
-
-# $(TOP)/src/mesa/drivers/dri/common/utils.c \
- $(TOP)/src/mesa/drivers/dri/common/vblank.c \
- $(TOP)/src/mesa/drivers/dri/common/dri_util.c \
- $(TOP)/src/mesa/drivers/dri/common/xmlconfig.c \
- $(TOP)/src/mesa/drivers/common/driverfuncs.c \
- $(TOP)/src/mesa/drivers/dri/common/texmem.c \
- $(TOP)/src/mesa/drivers/dri/common/drirenderbuffer.c
-
-include ../../Makefile.template
+default install clean:
+ @for dir in $(SUBDIRS) ; do \
+ if [ -d $$dir ] ; then \
+ (cd $$dir && $(MAKE) $@) || exit 1; \
+ fi \
+ done
diff --git a/src/gallium/state_trackers/dri/SConscript b/src/gallium/state_trackers/dri/SConscript
index ce2c273597..aba60fb8c5 100644
--- a/src/gallium/state_trackers/dri/SConscript
+++ b/src/gallium/state_trackers/dri/SConscript
@@ -1,23 +1,6 @@
-#######################################################################
-# SConscript for dri state_tracker
-
Import('*')
-if env['dri']:
-
- env = env.Clone()
-
- env.Append(CPPPATH = [
- '#/src/mesa',
- '#/src/mesa/drivers/dri/common',
- ])
-
- st_dri = env.ConvenienceLibrary(
- target = 'st_dri',
- source = [ 'dri_context.c',
- 'dri_drawable.c',
- 'dri_extensions.c',
- 'dri_screen.c',
- ]
- )
- Export('st_dri')
+SConscript([
+ 'sw/SConscript',
+ 'drm/SConscript',
+])
diff --git a/src/gallium/state_trackers/dri/common/dri1_helper.c b/src/gallium/state_trackers/dri/common/dri1_helper.c
new file mode 100644
index 0000000000..7eeb868d42
--- /dev/null
+++ b/src/gallium/state_trackers/dri/common/dri1_helper.c
@@ -0,0 +1,129 @@
+/**************************************************************************
+ *
+ * Copyright 2009, VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+/*
+ * Management of pipe objects (surface / pipe / fences) used by DRI1 and DRISW.
+ *
+ * Author: Keith Whitwell <keithw@vmware.com>
+ * Author: Jakob Bornecrantz <wallbraker@gmail.com>
+ */
+
+#include "util/u_inlines.h"
+#include "pipe/p_context.h"
+
+#include "dri_screen.h"
+#include "dri_context.h"
+#include "dri_drawable.h"
+#include "dri1_helper.h"
+
+struct pipe_fence_handle *
+dri1_swap_fences_pop_front(struct dri_drawable *draw)
+{
+ struct pipe_screen *screen = dri_screen(draw->sPriv)->pipe_screen;
+ struct pipe_fence_handle *fence = NULL;
+
+ if (draw->cur_fences >= draw->desired_fences) {
+ screen->fence_reference(screen, &fence, draw->swap_fences[draw->tail]);
+ screen->fence_reference(screen, &draw->swap_fences[draw->tail++], NULL);
+ --draw->cur_fences;
+ draw->tail &= DRI_SWAP_FENCES_MASK;
+ }
+ return fence;
+}
+
+void
+dri1_swap_fences_push_back(struct dri_drawable *draw,
+ struct pipe_fence_handle *fence)
+{
+ struct pipe_screen *screen = dri_screen(draw->sPriv)->pipe_screen;
+
+ if (!fence)
+ return;
+
+ if (draw->cur_fences < DRI_SWAP_FENCES_MAX) {
+ draw->cur_fences++;
+ screen->fence_reference(screen, &draw->swap_fences[draw->head++],
+ fence);
+ draw->head &= DRI_SWAP_FENCES_MASK;
+ }
+}
+
+void
+dri1_swap_fences_clear(struct dri_drawable *drawable)
+{
+ struct pipe_screen *screen = dri_screen(drawable->sPriv)->pipe_screen;
+ struct pipe_fence_handle *fence;
+
+ while (drawable->cur_fences) {
+ fence = dri1_swap_fences_pop_front(drawable);
+ screen->fence_reference(screen, &fence, NULL);
+ }
+}
+
+struct pipe_surface *
+dri1_get_pipe_surface(struct dri_drawable *drawable, struct pipe_texture *ptex)
+{
+ struct pipe_screen *pipe_screen = dri_screen(drawable->sPriv)->pipe_screen;
+ struct pipe_surface *psurf = drawable->dri1_surface;
+
+ if (!psurf || psurf->texture != ptex) {
+ pipe_surface_reference(&drawable->dri1_surface, NULL);
+
+ drawable->dri1_surface = pipe_screen->get_tex_surface(pipe_screen,
+ ptex, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_READ);
+
+ psurf = drawable->dri1_surface;
+ }
+
+ return psurf;
+}
+
+void
+dri1_destroy_pipe_surface(struct dri_drawable *drawable)
+{
+ pipe_surface_reference(&drawable->dri1_surface, NULL);
+}
+
+struct pipe_context *
+dri1_get_pipe_context(struct dri_screen *screen)
+{
+ struct pipe_context *pipe = screen->dri1_pipe;
+
+ if (!pipe) {
+ screen->dri1_pipe =
+ screen->pipe_screen->context_create(screen->pipe_screen, NULL);
+ pipe = screen->dri1_pipe;
+ }
+
+ return pipe;
+}
+
+void
+dri1_destroy_pipe_context(struct dri_screen *screen)
+{
+ if (screen->dri1_pipe)
+ screen->dri1_pipe->destroy(screen->dri1_pipe);
+}
diff --git a/src/gallium/state_trackers/dri/common/dri1_helper.h b/src/gallium/state_trackers/dri/common/dri1_helper.h
new file mode 100644
index 0000000000..3254b7ff87
--- /dev/null
+++ b/src/gallium/state_trackers/dri/common/dri1_helper.h
@@ -0,0 +1,61 @@
+/**************************************************************************
+ *
+ * Copyright 2009, VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+/*
+ * Author: Keith Whitwell <keithw@vmware.com>
+ * Author: Jakob Bornecrantz <wallbraker@gmail.com>
+ */
+
+#ifndef DRI1_HELPER_H
+#define DRI1_HELPER_H
+
+#include "dri_screen.h"
+#include "dri_context.h"
+#include "dri_drawable.h"
+
+struct pipe_fence_handle *
+dri1_swap_fences_pop_front(struct dri_drawable *draw);
+
+void
+dri1_swap_fences_push_back(struct dri_drawable *draw,
+ struct pipe_fence_handle *fence);
+
+void
+dri1_swap_fences_clear(struct dri_drawable *drawable);
+
+struct pipe_surface *
+dri1_get_pipe_surface(struct dri_drawable *drawable, struct pipe_texture *ptex);
+
+void
+dri1_destroy_pipe_surface(struct dri_drawable *drawable);
+
+struct pipe_context *
+dri1_get_pipe_context(struct dri_screen *screen);
+
+void
+dri1_destroy_pipe_context(struct dri_screen *screen);
+
+#endif /* DRI1_HELPER_H */
diff --git a/src/gallium/state_trackers/dri/dri_context.c b/src/gallium/state_trackers/dri/common/dri_context.c
index 908cef454e..f14f4130bf 100644
--- a/src/gallium/state_trackers/dri/dri_context.c
+++ b/src/gallium/state_trackers/dri/common/dri_context.c
@@ -29,27 +29,36 @@
* Author: Jakob Bornecrantz <wallbraker@gmail.com>
*/
-#include "dri_screen.h"
+#include "utils.h"
+#include "dri_screen.h"
#include "dri_drawable.h"
-#include "state_tracker/drm_api.h"
-#include "state_tracker/dri1_api.h"
-#include "state_tracker/st_public.h"
-#include "state_tracker/st_context.h"
+#include "dri_context.h"
+#include "dri_st_api.h"
+
#include "pipe/p_context.h"
+#include "state_tracker/st_context.h"
-#include "dri_context.h"
+static void
+dri_init_extensions(struct dri_context *ctx)
+{
+ struct st_context *st = (struct st_context *) ctx->st;
-#include "util/u_memory.h"
+ /* New extensions should be added in mesa/state_tracker/st_extensions.c
+ * and not in this file. */
+ driInitExtensions(st->ctx, NULL, GL_FALSE);
+}
GLboolean
dri_create_context(const __GLcontextModes * visual,
__DRIcontext * cPriv, void *sharedContextPrivate)
{
+ struct st_api *stapi = dri_get_st_api();
__DRIscreen *sPriv = cPriv->driScreenPriv;
struct dri_screen *screen = dri_screen(sPriv);
struct dri_context *ctx = NULL;
- struct st_context *st_share = NULL;
+ struct st_context_iface *st_share = NULL;
+ struct st_visual stvis;
if (sharedContextPrivate) {
st_share = ((struct dri_context *)sharedContextPrivate)->st;
@@ -63,21 +72,15 @@ dri_create_context(const __GLcontextModes * visual,
ctx->cPriv = cPriv;
ctx->sPriv = sPriv;
ctx->lock = screen->drmLock;
- ctx->d_stamp = -1;
- ctx->r_stamp = -1;
driParseConfigFiles(&ctx->optionCache,
&screen->optionCache, sPriv->myNum, "dri");
- ctx->pipe = screen->pipe_screen->context_create( screen->pipe_screen,
- ctx );
-
- if (ctx->pipe == NULL)
- goto fail;
-
- ctx->st = st_create_context(ctx->pipe, visual, st_share);
+ dri_fill_st_visual(&stvis, screen, visual);
+ ctx->st = stapi->create_context(stapi, screen->smapi, &stvis, st_share);
if (ctx->st == NULL)
goto fail;
+ ctx->st->st_manager_private = (void *) ctx;
dri_init_extensions(ctx);
@@ -85,10 +88,7 @@ dri_create_context(const __GLcontextModes * visual,
fail:
if (ctx && ctx->st)
- st_destroy_context(ctx->st);
-
- if (ctx && ctx->pipe)
- ctx->pipe->destroy(ctx->pipe);
+ ctx->st->destroy(ctx->st);
FREE(ctx);
return FALSE;
@@ -110,11 +110,8 @@ dri_destroy_context(__DRIcontext * cPriv)
* to avoid having to add code elsewhere to cope with flushing a
* partially destroyed context.
*/
- st_flush(ctx->st, 0, NULL);
-
- /* Also frees ctx->pipe?
- */
- st_destroy_context(ctx->st);
+ ctx->st->flush(ctx->st, 0, NULL);
+ ctx->st->destroy(ctx->st);
FREE(ctx);
}
@@ -122,14 +119,16 @@ dri_destroy_context(__DRIcontext * cPriv)
GLboolean
dri_unbind_context(__DRIcontext * cPriv)
{
+ struct st_api *stapi = dri_get_st_api();
+
if (cPriv) {
struct dri_context *ctx = dri_context(cPriv);
if (--ctx->bind_count == 0) {
- if (ctx->st && ctx->st == st_get_current()) {
- st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
- st_make_current(NULL, NULL, NULL);
- }
+ if (ctx->st == stapi->get_current(stapi)) {
+ ctx->st->flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
+ stapi->make_current(stapi, NULL, NULL, NULL);
+ }
}
}
@@ -141,77 +140,47 @@ dri_make_current(__DRIcontext * cPriv,
__DRIdrawable * driDrawPriv,
__DRIdrawable * driReadPriv)
{
+ struct st_api *stapi = dri_get_st_api();
+
if (cPriv) {
struct dri_context *ctx = dri_context(cPriv);
struct dri_drawable *draw = dri_drawable(driDrawPriv);
struct dri_drawable *read = dri_drawable(driReadPriv);
- struct st_context *old_st = st_get_current();
+ struct st_context_iface *old_st;
+ old_st = stapi->get_current(stapi);
if (old_st && old_st != ctx->st)
- st_flush(old_st, PIPE_FLUSH_RENDER_CACHE, NULL);
+ ctx->st->flush(old_st, PIPE_FLUSH_RENDER_CACHE, NULL);
++ctx->bind_count;
if (ctx->dPriv != driDrawPriv) {
ctx->dPriv = driDrawPriv;
- ctx->d_stamp = driDrawPriv->lastStamp - 1;
+ draw->texture_stamp = driDrawPriv->lastStamp - 1;
}
if (ctx->rPriv != driReadPriv) {
ctx->rPriv = driReadPriv;
- ctx->r_stamp = driReadPriv->lastStamp - 1;
+ read->texture_stamp = driReadPriv->lastStamp - 1;
}
- st_make_current(ctx->st, draw->stfb, read->stfb);
-
- if (__dri1_api_hooks) {
- dri1_update_drawables(ctx, draw, read);
- } else {
- dri_update_buffer(ctx->pipe->screen,
- ctx->pipe->priv);
- }
- } else {
- st_make_current(NULL, NULL, NULL);
+ stapi->make_current(stapi, ctx->st, draw->stfb, read->stfb);
+ }
+ else {
+ stapi->make_current(stapi, NULL, NULL, NULL);
}
return GL_TRUE;
}
-static void
-st_dri_lock(struct pipe_context *pipe)
+struct dri_context *
+dri_get_current(void)
{
- dri_lock((struct dri_context *)pipe->priv);
-}
+ struct st_api *stapi = dri_get_st_api();
+ struct st_context_iface *st;
-static void
-st_dri_unlock(struct pipe_context *pipe)
-{
- dri_unlock((struct dri_context *)pipe->priv);
-}
+ st = stapi->get_current(stapi);
-static boolean
-st_dri_is_locked(struct pipe_context *pipe)
-{
- return ((struct dri_context *)pipe->priv)->isLocked;
+ return (struct dri_context *) (st) ? st->st_manager_private : NULL;
}
-static boolean
-st_dri_lost_lock(struct pipe_context *pipe)
-{
- return ((struct dri_context *)pipe->priv)->wsLostLock;
-}
-
-static void
-st_dri_clear_lost_lock(struct pipe_context *pipe)
-{
- ((struct dri_context *)pipe->priv)->wsLostLock = FALSE;
-}
-
-struct dri1_api_lock_funcs dri1_lf = {
- .lock = st_dri_lock,
- .unlock = st_dri_unlock,
- .is_locked = st_dri_is_locked,
- .is_lock_lost = st_dri_lost_lock,
- .clear_lost_lock = st_dri_clear_lost_lock
-};
-
/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri/dri_context.h b/src/gallium/state_trackers/dri/common/dri_context.h
index 13f497462f..594618874a 100644
--- a/src/gallium/state_trackers/dri/dri_context.h
+++ b/src/gallium/state_trackers/dri/common/dri_context.h
@@ -33,8 +33,7 @@
#define DRI_CONTEXT_H
#include "pipe/p_compiler.h"
-#include "drm.h"
-#include "dri_util.h"
+#include "dri_wrapper.h"
struct pipe_context;
struct pipe_fence;
@@ -51,9 +50,6 @@ struct dri_context
driOptionCache optionCache;
- unsigned int d_stamp;
- unsigned int r_stamp;
-
drmLock *lock;
boolean isLocked;
boolean stLostLock;
@@ -62,8 +58,7 @@ struct dri_context
unsigned int bind_count;
/* gallium */
- struct st_context *st;
- struct pipe_context *pipe;
+ struct st_context_iface *st;
};
static INLINE struct dri_context *
@@ -72,33 +67,9 @@ dri_context(__DRIcontext * driContextPriv)
return (struct dri_context *)driContextPriv->driverPrivate;
}
-static INLINE void
-dri_lock(struct dri_context *ctx)
-{
- drm_context_t hw_context = ctx->cPriv->hHWContext;
- char ret = 0;
-
- DRM_CAS(ctx->lock, hw_context, DRM_LOCK_HELD | hw_context, ret);
- if (ret) {
- drmGetLock(ctx->sPriv->fd, hw_context, 0);
- ctx->stLostLock = TRUE;
- ctx->wsLostLock = TRUE;
- }
- ctx->isLocked = TRUE;
-}
-
-static INLINE void
-dri_unlock(struct dri_context *ctx)
-{
- ctx->isLocked = FALSE;
- DRM_UNLOCK(ctx->sPriv->fd, ctx->lock, ctx->cPriv->hHWContext);
-}
-
/***********************************************************************
* dri_context.c
*/
-extern struct dri1_api_lock_funcs dri1_lf;
-
void dri_destroy_context(__DRIcontext * driContextPriv);
boolean dri_unbind_context(__DRIcontext * driContextPriv);
@@ -108,16 +79,14 @@ dri_make_current(__DRIcontext * driContextPriv,
__DRIdrawable * driDrawPriv,
__DRIdrawable * driReadPriv);
+struct dri_context *
+dri_get_current(void);
+
boolean
dri_create_context(const __GLcontextModes * visual,
__DRIcontext * driContextPriv,
void *sharedContextPrivate);
-/***********************************************************************
- * dri_extensions.c
- */
-void dri_init_extensions(struct dri_context *ctx);
-
#endif
/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri/common/dri_drawable.c b/src/gallium/state_trackers/dri/common/dri_drawable.c
new file mode 100644
index 0000000000..88c17e81bf
--- /dev/null
+++ b/src/gallium/state_trackers/dri/common/dri_drawable.c
@@ -0,0 +1,93 @@
+/**************************************************************************
+ *
+ * Copyright 2009, VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+/*
+ * Author: Keith Whitwell <keithw@vmware.com>
+ * Author: Jakob Bornecrantz <wallbraker@gmail.com>
+ */
+
+#include "dri_screen.h"
+#include "dri_context.h"
+#include "dri_drawable.h"
+#include "dri_st_api.h"
+#include "dri1_helper.h"
+
+#include "pipe/p_screen.h"
+#include "util/u_format.h"
+#include "util/u_memory.h"
+
+/**
+ * This is called when we need to set up GL rendering to a new X window.
+ */
+boolean
+dri_create_buffer(__DRIscreen * sPriv,
+ __DRIdrawable * dPriv,
+ const __GLcontextModes * visual, boolean isPixmap)
+{
+ struct dri_screen *screen = sPriv->private;
+ struct dri_drawable *drawable = NULL;
+
+ if (isPixmap)
+ goto fail; /* not implemented */
+
+ drawable = CALLOC_STRUCT(dri_drawable);
+ if (drawable == NULL)
+ goto fail;
+
+ dri_fill_st_visual(&drawable->stvis, screen, visual);
+ drawable->stfb = dri_create_st_framebuffer(drawable);
+ if (drawable->stfb == NULL)
+ goto fail;
+
+ drawable->sPriv = sPriv;
+ drawable->dPriv = dPriv;
+ dPriv->driverPrivate = (void *)drawable;
+
+ drawable->desired_fences = 2;
+
+ return GL_TRUE;
+fail:
+ FREE(drawable);
+ return GL_FALSE;
+}
+
+void
+dri_destroy_buffer(__DRIdrawable * dPriv)
+{
+ struct dri_drawable *drawable = dri_drawable(dPriv);
+
+ dri1_swap_fences_clear(drawable);
+
+ dri1_destroy_pipe_surface(drawable);
+
+ dri_destroy_st_framebuffer(drawable->stfb);
+
+ drawable->desired_fences = 0;
+
+ FREE(drawable);
+}
+
+/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri/dri_drawable.h b/src/gallium/state_trackers/dri/common/dri_drawable.h
index 8bc59cb4c3..98abeb9ec0 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.h
+++ b/src/gallium/state_trackers/dri/common/dri_drawable.h
@@ -29,6 +29,8 @@
#define DRI_DRAWABLE_H
#include "pipe/p_compiler.h"
+#include "pipe/p_format.h"
+#include "state_tracker/st_api.h"
struct pipe_surface;
struct pipe_fence_handle;
@@ -44,26 +46,26 @@ struct dri_drawable
__DRIdrawable *dPriv;
__DRIscreen *sPriv;
- unsigned attachments[8];
- unsigned num_attachments;
-
- boolean is_pixmap;
+ /* gallium */
+ struct st_framebuffer_iface *stfb;
+ struct st_visual stvis;
__DRIbuffer old[8];
unsigned old_num;
unsigned old_w;
unsigned old_h;
- /* gallium */
- struct st_framebuffer *stfb;
+ struct pipe_texture *textures[ST_ATTACHMENT_COUNT];
+ unsigned int texture_mask, texture_stamp;
+
struct pipe_fence_handle *swap_fences[DRI_SWAP_FENCES_MAX];
unsigned int head;
unsigned int tail;
unsigned int desired_fences;
unsigned int cur_fences;
- enum pipe_format color_format;
- enum pipe_format depth_stencil_format;
+ /* used only by DRI1 */
+ struct pipe_surface *dri1_surface;
};
static INLINE struct dri_drawable *
@@ -80,35 +82,8 @@ dri_create_buffer(__DRIscreen * sPriv,
__DRIdrawable * dPriv,
const __GLcontextModes * visual, boolean isPixmap);
-void
-dri_update_buffer(struct pipe_screen *screen, void *context_private);
-
-void
-dri_flush_frontbuffer(struct pipe_screen *screen,
- struct pipe_surface *surf, void *context_private);
-
-void dri_swap_buffers(__DRIdrawable * dPriv);
-
-void
-dri_copy_sub_buffer(__DRIdrawable * dPriv, int x, int y, int w, int h);
-
-void dri_get_buffers(__DRIdrawable * dPriv);
-
void dri_destroy_buffer(__DRIdrawable * dPriv);
-void dri2_set_tex_buffer2(__DRIcontext *pDRICtx, GLint target,
- GLint glx_texture_format, __DRIdrawable *dPriv);
-
-void dri2_set_tex_buffer(__DRIcontext *pDRICtx, GLint target,
- __DRIdrawable *dPriv);
-
-void
-dri1_update_drawables(struct dri_context *ctx,
- struct dri_drawable *draw, struct dri_drawable *read);
-
-void
-dri1_flush_frontbuffer(struct pipe_screen *screen,
- struct pipe_surface *surf, void *context_private);
#endif
/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/common/dri_screen.c
index 7ccad8f5dd..6e1761443e 100644
--- a/src/gallium/state_trackers/dri/dri_screen.c
+++ b/src/gallium/state_trackers/dri/common/dri_screen.c
@@ -30,17 +30,26 @@
*/
#include "utils.h"
+#ifndef __NOT_HAVE_DRM_H
#include "vblank.h"
+#endif
#include "xmlpool.h"
#include "dri_screen.h"
#include "dri_context.h"
#include "dri_drawable.h"
-
+#include "dri_st_api.h"
+#include "dri1_helper.h"
+#ifndef __NOT_HAVE_DRM_H
+#include "dri1.h"
+#include "dri2.h"
+#else
+#include "drisw.h"
+#endif
+
+#include "util/u_inlines.h"
#include "pipe/p_screen.h"
#include "pipe/p_format.h"
-#include "state_tracker/drm_api.h"
-#include "state_tracker/dri1_api.h"
#include "util/u_debug.h"
@@ -49,41 +58,11 @@ PUBLIC const char __driConfigOptions[] =
DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
DRI_CONF_SECTION_END DRI_CONF_SECTION_QUALITY
- /*DRI_CONF_FORCE_S3TC_ENABLE(false) */
+/* DRI_CONF_FORCE_S3TC_ENABLE(false) */
DRI_CONF_ALLOW_LARGE_TEXTURES(1)
DRI_CONF_SECTION_END DRI_CONF_END;
- const uint __driNConfigOptions = 3;
-
-static const __DRItexBufferExtension dri2TexBufferExtension = {
- { __DRI_TEX_BUFFER, __DRI_TEX_BUFFER_VERSION },
- dri2_set_tex_buffer,
- dri2_set_tex_buffer2,
-};
-
-static void
-dri2_flush_drawable(__DRIdrawable *draw)
-{
-}
-
-static const __DRI2flushExtension dri2FlushExtension = {
- { __DRI2_FLUSH, __DRI2_FLUSH_VERSION },
- dri2_flush_drawable,
- dri2InvalidateDrawable,
-};
-
- static const __DRIextension *dri_screen_extensions[] = {
- &driReadDrawableExtension,
- &driCopySubBufferExtension.base,
- &driSwapControlExtension.base,
- &driFrameTrackingExtension.base,
- &driMediaStreamCounterExtension.base,
- &dri2TexBufferExtension.base,
- &dri2FlushExtension.base,
- NULL
- };
-
-struct dri1_api *__dri1_api_hooks = NULL;
+static const uint __driNConfigOptions = 3;
static const __DRIconfig **
dri_fill_in_modes(struct dri_screen *screen,
@@ -118,10 +97,10 @@ dri_fill_in_modes(struct dri_screen *screen,
pf_z24x8 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_X8Z24_UNORM,
PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0);
- pf_s8z24 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z24S8_UNORM,
+ pf_s8z24 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z24_UNORM_S8_USCALED,
PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0);
- pf_z24s8 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_S8Z24_UNORM,
+ pf_z24s8 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_S8_USCALED_Z24_UNORM,
PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0);
pf_a8r8g8b8 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_B8G8R8A8_UNORM,
@@ -135,9 +114,7 @@ dri_fill_in_modes(struct dri_screen *screen,
PIPE_TEXTURE_USAGE_RENDER_TARGET, 0);
/* We can only get a 16 or 32 bit depth buffer with getBuffersWithFormat */
- if (screen->sPriv->dri2.loader &&
- (screen->sPriv->dri2.loader->base.version > 2) &&
- (screen->sPriv->dri2.loader->getBuffersWithFormat != NULL)) {
+ if (dri_with_format(screen->sPriv)) {
pf_z16 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z16_UNORM,
PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0);
@@ -229,6 +206,70 @@ dri_fill_in_modes(struct dri_screen *screen,
}
/**
+ * Roughly the converse of dri_fill_in_modes.
+ */
+void
+dri_fill_st_visual(struct st_visual *stvis, struct dri_screen *screen,
+ const __GLcontextModes *mode)
+{
+ memset(stvis, 0, sizeof(*stvis));
+
+ stvis->samples = mode->samples;
+ stvis->render_buffer = ST_ATTACHMENT_INVALID;
+
+ if (mode->redBits == 8) {
+ if (mode->alphaBits == 8)
+ stvis->color_format = PIPE_FORMAT_B8G8R8A8_UNORM;
+ else
+ stvis->color_format = PIPE_FORMAT_B8G8R8X8_UNORM;
+ } else {
+ stvis->color_format = PIPE_FORMAT_B5G6R5_UNORM;
+ }
+
+ switch (mode->depthBits) {
+ default:
+ case 0:
+ stvis->depth_stencil_format = PIPE_FORMAT_NONE;
+ break;
+ case 16:
+ stvis->depth_stencil_format = PIPE_FORMAT_Z16_UNORM;
+ break;
+ case 24:
+ if (mode->stencilBits == 0) {
+ stvis->depth_stencil_format = (screen->d_depth_bits_last) ?
+ PIPE_FORMAT_Z24X8_UNORM:
+ PIPE_FORMAT_X8Z24_UNORM;
+ } else {
+ stvis->depth_stencil_format = (screen->sd_depth_bits_last) ?
+ PIPE_FORMAT_Z24_UNORM_S8_USCALED:
+ PIPE_FORMAT_S8_USCALED_Z24_UNORM;
+ }
+ break;
+ case 32:
+ stvis->depth_stencil_format = PIPE_FORMAT_Z32_UNORM;
+ break;
+ }
+
+ stvis->accum_format = (mode->haveAccumBuffer) ?
+ PIPE_FORMAT_R16G16B16A16_SNORM : PIPE_FORMAT_NONE;
+
+ stvis->buffer_mask |= ST_ATTACHMENT_FRONT_LEFT_MASK;
+ if (mode->doubleBufferMode)
+ stvis->buffer_mask |= ST_ATTACHMENT_BACK_LEFT_MASK;
+ if (mode->stereoMode) {
+ stvis->buffer_mask |= ST_ATTACHMENT_FRONT_RIGHT_MASK;
+ if (mode->doubleBufferMode)
+ stvis->buffer_mask |= ST_ATTACHMENT_BACK_RIGHT_MASK;
+ }
+
+ if (mode->haveDepthBuffer || mode->haveStencilBuffer)
+ stvis->buffer_mask |= ST_ATTACHMENT_DEPTH_STENCIL_MASK;
+ /* let the state tracker allocate the accum buffer */
+}
+
+#ifndef __NOT_HAVE_DRM_H
+
+/**
* Get information about previous buffer swaps.
*/
static int
@@ -240,164 +281,103 @@ dri_get_swap_info(__DRIdrawable * dPriv, __DRIswapInfo * sInfo)
return 0;
}
-static INLINE void
-dri_copy_version(struct dri1_api_version *dst,
- const struct __DRIversionRec *src)
-{
- dst->major = src->major;
- dst->minor = src->minor;
- dst->patch_level = src->patch;
-}
+#endif
-static const __DRIconfig **
-dri_init_screen(__DRIscreen * sPriv)
+static void
+dri_destroy_option_cache(struct dri_screen * screen)
{
- struct dri_screen *screen;
- const __DRIconfig **configs;
- struct dri1_create_screen_arg arg;
-
- screen = CALLOC_STRUCT(dri_screen);
- if (!screen)
- return NULL;
+ int i;
- screen->api = drm_api_create();
- screen->sPriv = sPriv;
- screen->fd = sPriv->fd;
- screen->drmLock = (drmLock *) & sPriv->pSAREA->lock;
-
- sPriv->private = (void *)screen;
- sPriv->extensions = dri_screen_extensions;
-
- arg.base.mode = DRM_CREATE_DRI1;
- arg.lf = &dri1_lf;
- arg.ddx_info = sPriv->pDevPriv;
- arg.ddx_info_size = sPriv->devPrivSize;
- arg.sarea = sPriv->pSAREA;
- dri_copy_version(&arg.ddx_version, &sPriv->ddx_version);
- dri_copy_version(&arg.dri_version, &sPriv->dri_version);
- dri_copy_version(&arg.drm_version, &sPriv->drm_version);
- arg.api = NULL;
-
- screen->pipe_screen = screen->api->create_screen(screen->api, screen->fd, &arg.base);
-
- if (!screen->pipe_screen || !arg.api) {
- debug_printf("%s: failed to create dri1 screen\n", __FUNCTION__);
- goto out_no_screen;
+ if (screen->optionCache.info) {
+ for (i = 0; i < (1 << screen->optionCache.tableSize); ++i) {
+ FREE(screen->optionCache.info[i].name);
+ FREE(screen->optionCache.info[i].ranges);
+ }
+ FREE(screen->optionCache.info);
}
- __dri1_api_hooks = arg.api;
-
- screen->pipe_screen->flush_frontbuffer = dri1_flush_frontbuffer;
- driParseOptionInfo(&screen->optionCache,
- __driConfigOptions, __driNConfigOptions);
-
- /**
- * FIXME: If the driver supports format conversion swapbuffer blits, we might
- * want to support other color bit depths than the server is currently
- * using.
- */
-
- configs = dri_fill_in_modes(screen, sPriv->fbBPP);
- if (!configs)
- goto out_no_configs;
-
- return configs;
- out_no_configs:
- screen->pipe_screen->destroy(screen->pipe_screen);
- out_no_screen:
- FREE(screen);
- return NULL;
+ FREE(screen->optionCache.values);
}
-/**
- * This is the driver specific part of the createNewScreen entry point.
- *
- * Returns the __GLcontextModes supported by this driver.
- */
-static const __DRIconfig **
-dri_init_screen2(__DRIscreen * sPriv)
+void
+dri_destroy_screen_helper(struct dri_screen * screen)
{
- struct dri_screen *screen;
- struct drm_create_screen_arg arg;
- const __DRIdri2LoaderExtension *dri2_ext =
- sPriv->dri2.loader;
-
- screen = CALLOC_STRUCT(dri_screen);
- if (!screen)
- goto fail;
-
- screen->api = drm_api_create();
- screen->sPriv = sPriv;
- screen->fd = sPriv->fd;
- sPriv->private = (void *)screen;
- sPriv->extensions = dri_screen_extensions;
- arg.mode = DRM_CREATE_NORMAL;
-
- screen->pipe_screen = screen->api->create_screen(screen->api, screen->fd, &arg);
- if (!screen->pipe_screen) {
- debug_printf("%s: failed to create pipe_screen\n", __FUNCTION__);
- goto fail;
- }
+ dri1_destroy_pipe_context(screen);
- /* We need to hook in here */
- screen->pipe_screen->update_buffer = dri_update_buffer;
- screen->pipe_screen->flush_frontbuffer = dri_flush_frontbuffer;
+ if (screen->smapi)
+ dri_destroy_st_manager(screen->smapi);
- driParseOptionInfo(&screen->optionCache,
- __driConfigOptions, __driNConfigOptions);
+ if (screen->pipe_screen)
+ screen->pipe_screen->destroy(screen->pipe_screen);
- screen->auto_fake_front = dri2_ext->base.version >= 3 &&
- dri2_ext->getBuffersWithFormat != NULL;
-
- return dri_fill_in_modes(screen, 32);
- fail:
- return NULL;
+ dri_destroy_option_cache(screen);
}
static void
dri_destroy_screen(__DRIscreen * sPriv)
{
struct dri_screen *screen = dri_screen(sPriv);
- int i;
- screen->pipe_screen->destroy(screen->pipe_screen);
-
- for (i = 0; i < (1 << screen->optionCache.tableSize); ++i) {
- FREE(screen->optionCache.info[i].name);
- FREE(screen->optionCache.info[i].ranges);
- }
-
- FREE(screen->optionCache.info);
- FREE(screen->optionCache.values);
+ dri_destroy_screen_helper(screen);
FREE(screen);
sPriv->private = NULL;
+ sPriv->extensions = NULL;
}
-PUBLIC const struct __DriverAPIRec driDriverAPI = {
- .InitScreen = dri_init_screen,
+const __DRIconfig **
+dri_init_screen_helper(struct dri_screen *screen,
+ struct drm_create_screen_arg *arg,
+ unsigned pixel_bits)
+{
+ screen->pipe_screen = screen->api->create_screen(screen->api, screen->fd, arg);
+ if (!screen->pipe_screen) {
+ debug_printf("%s: failed to create pipe_screen\n", __FUNCTION__);
+ return NULL;
+ }
+
+ screen->smapi = dri_create_st_manager(screen);
+ if (!screen->smapi)
+ return NULL;
+
+ driParseOptionInfo(&screen->optionCache,
+ __driConfigOptions, __driNConfigOptions);
+
+ return dri_fill_in_modes(screen, pixel_bits);
+}
+
+/**
+ * DRI driver virtual function table.
+ *
+ * DRI versions differ in their implementation of init_screen and swap_buffers.
+ */
+const struct __DriverAPIRec driDriverAPI = {
.DestroyScreen = dri_destroy_screen,
.CreateContext = dri_create_context,
.DestroyContext = dri_destroy_context,
.CreateBuffer = dri_create_buffer,
.DestroyBuffer = dri_destroy_buffer,
- .SwapBuffers = dri_swap_buffers,
.MakeCurrent = dri_make_current,
.UnbindContext = dri_unbind_context,
+
+#ifndef __NOT_HAVE_DRM_H
+
.GetSwapInfo = dri_get_swap_info,
.GetDrawableMSC = driDrawableGetMSC32,
.WaitForMSC = driWaitForMSC32,
- .CopySubBuffer = dri_copy_sub_buffer,
- .InitScreen = dri_init_screen,
- .InitScreen2 = dri_init_screen2,
-};
+ .InitScreen2 = dri2_init_screen,
+
+ .InitScreen = dri1_init_screen,
+ .SwapBuffers = dri1_swap_buffers,
+ .CopySubBuffer = dri1_copy_sub_buffer,
+
+#else
+
+ .InitScreen = drisw_init_screen,
+ .SwapBuffers = drisw_swap_buffers,
+
+#endif
-/* This is the table of extensions that the loader will dlsym() for. */
-PUBLIC const __DRIextension *__driDriverExtensions[] = {
- &driCoreExtension.base,
- &driLegacyExtension.base,
- &driDRI2Extension.base,
- NULL
};
/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri/dri_screen.h b/src/gallium/state_trackers/dri/common/dri_screen.h
index 75a0ee4250..e77bce17ae 100644
--- a/src/gallium/state_trackers/dri/dri_screen.h
+++ b/src/gallium/state_trackers/dri/common/dri_screen.h
@@ -32,12 +32,14 @@
#ifndef DRI_SCREEN_H
#define DRI_SCREEN_H
-#include "dri_util.h"
+#include "dri_wrapper.h"
#include "xmlconfig.h"
#include "pipe/p_compiler.h"
-
-#include "state_tracker/dri1_api.h"
+#include "pipe/p_context.h"
+#include "pipe/p_state.h"
+#include "state_tracker/st_api.h"
+#include "state_tracker/drm_api.h"
struct dri_screen
{
@@ -60,6 +62,11 @@ struct dri_screen
boolean d_depth_bits_last;
boolean sd_depth_bits_last;
boolean auto_fake_front;
+
+ struct st_manager *smapi;
+
+ /* used only by DRI1 */
+ struct pipe_context *dri1_pipe;
};
/** cast wrapper */
@@ -69,11 +76,39 @@ dri_screen(__DRIscreen * sPriv)
return (struct dri_screen *)sPriv->private;
}
-/***********************************************************************
- * dri_screen.c
- */
+#ifndef __NOT_HAVE_DRM_H
+
+static INLINE boolean
+dri_with_format(__DRIscreen * sPriv)
+{
+ const __DRIdri2LoaderExtension *loader = sPriv->dri2.loader;
+
+ return loader
+ && (loader->base.version >= 3)
+ && (loader->getBuffersWithFormat != NULL);
+}
+
+#else
+
+static INLINE boolean
+dri_with_format(__DRIscreen * sPriv)
+{
+ return TRUE;
+}
+
+#endif
+
+void
+dri_fill_st_visual(struct st_visual *stvis, struct dri_screen *screen,
+ const __GLcontextModes *mode);
+
+const __DRIconfig **
+dri_init_screen_helper(struct dri_screen *screen,
+ struct drm_create_screen_arg *arg,
+ unsigned pixel_bits);
-extern struct dri1_api *__dri1_api_hooks;
+void
+dri_destroy_screen_helper(struct dri_screen * screen);
#endif
diff --git a/src/gallium/state_trackers/dri/common/dri_st_api.c b/src/gallium/state_trackers/dri/common/dri_st_api.c
new file mode 100644
index 0000000000..1a5259c68b
--- /dev/null
+++ b/src/gallium/state_trackers/dri/common/dri_st_api.c
@@ -0,0 +1,262 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.9
+ *
+ * Copyright (C) 2010 LunarG Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Chia-I Wu <olv@lunarg.com>
+ */
+
+#include "util/u_memory.h"
+#include "util/u_inlines.h"
+#include "util/u_format.h"
+#include "util/u_debug.h"
+#include "state_tracker/st_manager.h" /* for st_manager_create_api */
+
+#include "dri_screen.h"
+#include "dri_context.h"
+#include "dri_drawable.h"
+#include "dri_st_api.h"
+#ifndef __NOT_HAVE_DRM_H
+#include "dri1.h"
+#include "dri2.h"
+#else
+#include "drisw.h"
+#endif
+
+static boolean
+dri_st_framebuffer_validate(struct st_framebuffer_iface *stfbi,
+ const enum st_attachment_type *statts,
+ unsigned count,
+ struct pipe_texture **out)
+{
+ struct dri_drawable *drawable =
+ (struct dri_drawable *) stfbi->st_manager_private;
+ unsigned statt_mask, new_mask;
+ boolean new_stamp;
+ int i;
+
+ statt_mask = 0x0;
+ for (i = 0; i < count; i++)
+ statt_mask |= (1 << statts[i]);
+
+ /* record newly allocated textures */
+ new_mask = (statt_mask & ~drawable->texture_mask);
+
+ /*
+ * dPriv->pStamp is the server stamp. It should be accessed with a lock, at
+ * least for DRI1. dPriv->lastStamp is the client stamp. It has the value
+ * of the server stamp when last checked.
+ */
+ new_stamp = (drawable->texture_stamp != drawable->dPriv->lastStamp);
+
+ if (new_stamp || new_mask) {
+
+#ifndef __NOT_HAVE_DRM_H
+ if (__dri1_api_hooks) {
+ dri1_allocate_textures(drawable, statt_mask);
+ }
+ else {
+ dri2_allocate_textures(drawable, statts, count);
+ }
+#else
+ if (new_stamp)
+ drisw_update_drawable_info(drawable);
+
+ drisw_allocate_textures(drawable, statt_mask);
+#endif
+
+ /* add existing textures */
+ for (i = 0; i < ST_ATTACHMENT_COUNT; i++) {
+ if (drawable->textures[i])
+ statt_mask |= (1 << i);
+ }
+
+ drawable->texture_stamp = drawable->dPriv->lastStamp;
+ drawable->texture_mask = statt_mask;
+ }
+
+ if (!out)
+ return TRUE;
+
+ for (i = 0; i < count; i++) {
+ out[i] = NULL;
+ pipe_texture_reference(&out[i], drawable->textures[statts[i]]);
+ }
+
+ return TRUE;
+}
+
+static boolean
+dri_st_framebuffer_flush_front(struct st_framebuffer_iface *stfbi,
+ enum st_attachment_type statt)
+{
+ struct dri_drawable *drawable =
+ (struct dri_drawable *) stfbi->st_manager_private;
+
+#ifndef __NOT_HAVE_DRM_H
+ if (__dri1_api_hooks) {
+ dri1_flush_frontbuffer(drawable, statt);
+ }
+ else {
+ dri2_flush_frontbuffer(drawable, statt);
+ }
+#else
+ drisw_flush_frontbuffer(drawable, statt);
+#endif
+
+ return TRUE;
+}
+
+/**
+ * Create a framebuffer from the given drawable.
+ */
+struct st_framebuffer_iface *
+dri_create_st_framebuffer(struct dri_drawable *drawable)
+{
+ struct st_framebuffer_iface *stfbi;
+
+ stfbi = CALLOC_STRUCT(st_framebuffer_iface);
+ if (stfbi) {
+ stfbi->visual = &drawable->stvis;
+ stfbi->flush_front = dri_st_framebuffer_flush_front;
+ stfbi->validate = dri_st_framebuffer_validate;
+ stfbi->st_manager_private = (void *) drawable;
+ }
+
+ return stfbi;
+}
+
+/**
+ * Destroy a framebuffer.
+ */
+void
+dri_destroy_st_framebuffer(struct st_framebuffer_iface *stfbi)
+{
+ struct dri_drawable *drawable =
+ (struct dri_drawable *) stfbi->st_manager_private;
+ int i;
+
+ for (i = 0; i < ST_ATTACHMENT_COUNT; i++)
+ pipe_texture_reference(&drawable->textures[i], NULL);
+
+ FREE(stfbi);
+}
+
+/**
+ * Validate the texture at an attachment. Allocate the texture if it does not
+ * exist.
+ */
+void
+dri_st_framebuffer_validate_att(struct st_framebuffer_iface *stfbi,
+ enum st_attachment_type statt)
+{
+ struct dri_drawable *drawable =
+ (struct dri_drawable *) stfbi->st_manager_private;
+ enum st_attachment_type statts[ST_ATTACHMENT_COUNT];
+ unsigned i, count = 0;
+
+ /* check if buffer already exists */
+ if (drawable->texture_mask & (1 << statt))
+ return;
+
+ /* make sure DRI2 does not destroy existing buffers */
+ for (i = 0; i < ST_ATTACHMENT_COUNT; i++) {
+ if (drawable->texture_mask & (1 << i)) {
+ statts[count++] = i;
+ }
+ }
+ statts[count++] = statt;
+
+ drawable->texture_stamp = drawable->dPriv->lastStamp - 1;
+
+ stfbi->validate(stfbi, statts, count, NULL);
+}
+
+/**
+ * Reference counted st_api.
+ */
+static struct {
+ int32_t refcnt;
+ struct st_api *stapi;
+} dri_st_api;
+
+/**
+ * Add a reference to the st_api of the state tracker.
+ */
+static void
+_dri_get_st_api(void)
+{
+ p_atomic_inc(&dri_st_api.refcnt);
+ if (p_atomic_read(&dri_st_api.refcnt) == 1)
+ dri_st_api.stapi = st_manager_create_api();
+}
+
+/**
+ * Remove a reference to the st_api of the state tracker.
+ */
+static void
+_dri_put_st_api(void)
+{
+ struct st_api *stapi = dri_st_api.stapi;
+
+ if (p_atomic_dec_zero(&dri_st_api.refcnt)) {
+ stapi->destroy(dri_st_api.stapi);
+ dri_st_api.stapi = NULL;
+ }
+}
+
+/**
+ * Create a state tracker manager from the given screen.
+ */
+struct st_manager *
+dri_create_st_manager(struct dri_screen *screen)
+{
+ struct st_manager *smapi;
+
+ smapi = CALLOC_STRUCT(st_manager);
+ if (smapi) {
+ smapi->screen = screen->pipe_screen;
+ _dri_get_st_api();
+ }
+
+ return smapi;
+}
+
+/**
+ * Destroy a state tracker manager.
+ */
+void
+dri_destroy_st_manager(struct st_manager *smapi)
+{
+ _dri_put_st_api();
+ FREE(smapi);
+}
+
+/**
+ * Return the st_api of OpenGL state tracker.
+ */
+struct st_api *
+dri_get_st_api(void)
+{
+ assert(dri_st_api.stapi);
+ return dri_st_api.stapi;
+}
diff --git a/src/gallium/state_trackers/dri/common/dri_st_api.h b/src/gallium/state_trackers/dri/common/dri_st_api.h
new file mode 100644
index 0000000000..99a217bfa7
--- /dev/null
+++ b/src/gallium/state_trackers/dri/common/dri_st_api.h
@@ -0,0 +1,55 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.9
+ *
+ * Copyright (C) 2010 LunarG Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Chia-I Wu <olv@lunarg.com>
+ */
+
+#ifndef _DRI_ST_API_H_
+#define _DRI_ST_API_H_
+
+#include "state_tracker/st_api.h"
+
+struct dri_screen;
+struct dri_drawable;
+
+struct st_api *
+dri_get_st_api(void);
+
+struct st_manager *
+dri_create_st_manager(struct dri_screen *screen);
+
+void
+dri_destroy_st_manager(struct st_manager *smapi);
+
+struct st_framebuffer_iface *
+dri_create_st_framebuffer(struct dri_drawable *drawable);
+
+void
+dri_destroy_st_framebuffer(struct st_framebuffer_iface *stfbi);
+
+void
+dri_st_framebuffer_validate_att(struct st_framebuffer_iface *stfbi,
+ enum st_attachment_type statt);
+
+#endif /* _DRI_ST_API_H_ */
diff --git a/src/gallium/state_trackers/dri/common/dri_wrapper.h b/src/gallium/state_trackers/dri/common/dri_wrapper.h
new file mode 100644
index 0000000000..141ba02706
--- /dev/null
+++ b/src/gallium/state_trackers/dri/common/dri_wrapper.h
@@ -0,0 +1,10 @@
+#ifndef DRI_WRAPPER_H
+#define DRI_WRAPPER_H
+
+#ifndef __NOT_HAVE_DRM_H
+#include "dri_util.h"
+#else
+#include "drisw_util.h"
+#endif
+
+#endif
diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c
deleted file mode 100644
index 173f4041c8..0000000000
--- a/src/gallium/state_trackers/dri/dri_drawable.c
+++ /dev/null
@@ -1,761 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2009, VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-/*
- * Author: Keith Whitwell <keithw@vmware.com>
- * Author: Jakob Bornecrantz <wallbraker@gmail.com>
- */
-
-#include "dri_screen.h"
-#include "dri_context.h"
-#include "dri_drawable.h"
-
-#include "pipe/p_context.h"
-#include "pipe/p_screen.h"
-#include "main/mtypes.h"
-#include "main/renderbuffer.h"
-#include "state_tracker/drm_api.h"
-#include "state_tracker/dri1_api.h"
-#include "state_tracker/st_public.h"
-#include "state_tracker/st_context.h"
-#include "state_tracker/st_cb_fbo.h"
-
-#include "util/u_format.h"
-#include "util/u_memory.h"
-#include "util/u_rect.h"
-#include "util/u_inlines.h"
-
-static struct pipe_surface *
-dri_surface_from_handle(struct drm_api *api,
- struct pipe_screen *screen,
- unsigned handle,
- enum pipe_format format,
- unsigned width, unsigned height, unsigned pitch)
-{
- struct pipe_surface *surface = NULL;
- struct pipe_texture *texture = NULL;
- struct pipe_texture templat;
-
- memset(&templat, 0, sizeof(templat));
- templat.tex_usage |= PIPE_TEXTURE_USAGE_RENDER_TARGET;
- templat.target = PIPE_TEXTURE_2D;
- templat.last_level = 0;
- templat.depth0 = 1;
- templat.format = format;
- templat.width0 = width;
- templat.height0 = height;
-
- texture = api->texture_from_shared_handle(api, screen, &templat,
- "dri2 buffer", pitch, handle);
-
- if (!texture) {
- debug_printf("%s: Failed to blanket the buffer with a texture\n", __func__);
- return NULL;
- }
-
- surface = screen->get_tex_surface(screen, texture, 0, 0, 0,
- PIPE_BUFFER_USAGE_GPU_READ |
- PIPE_BUFFER_USAGE_GPU_WRITE);
-
- /* we don't need the texture from this point on */
- pipe_texture_reference(&texture, NULL);
- return surface;
-}
-
-/**
- * Pixmaps have will have the same name of fake front and front.
- */
-static boolean
-dri2_check_if_pixmap(__DRIbuffer *buffers, int count)
-{
- boolean found = FALSE;
- boolean is_pixmap = FALSE;
- unsigned name;
- int i;
-
- for (i = 0; i < count; i++) {
- switch (buffers[i].attachment) {
- case __DRI_BUFFER_FRONT_LEFT:
- case __DRI_BUFFER_FAKE_FRONT_LEFT:
- if (found) {
- is_pixmap = buffers[i].name == name;
- } else {
- name = buffers[i].name;
- found = TRUE;
- }
- default:
- continue;
- }
- }
-
- return is_pixmap;
-}
-
-/**
- * This will be called a drawable is known to have been resized.
- */
-void
-dri_get_buffers(__DRIdrawable * dPriv)
-{
-
- struct dri_drawable *drawable = dri_drawable(dPriv);
- struct pipe_surface *surface = NULL;
- struct dri_screen *st_screen = dri_screen(drawable->sPriv);
- struct pipe_screen *screen = st_screen->pipe_screen;
- __DRIbuffer *buffers = NULL;
- __DRIscreen *dri_screen = drawable->sPriv;
- __DRIdrawable *dri_drawable = drawable->dPriv;
- struct drm_api *api = st_screen->api;
- boolean have_depth = FALSE;
- int i, count;
-
- if ((dri_screen->dri2.loader
- && (dri_screen->dri2.loader->base.version > 2)
- && (dri_screen->dri2.loader->getBuffersWithFormat != NULL))) {
- buffers = (*dri_screen->dri2.loader->getBuffersWithFormat)
- (dri_drawable, &dri_drawable->w, &dri_drawable->h,
- drawable->attachments, drawable->num_attachments,
- &count, dri_drawable->loaderPrivate);
- } else {
- assert(dri_screen->dri2.loader);
- buffers = (*dri_screen->dri2.loader->getBuffers) (dri_drawable,
- &dri_drawable->w,
- &dri_drawable->h,
- drawable->attachments,
- drawable->
- num_attachments, &count,
- dri_drawable->
- loaderPrivate);
- }
-
- if (buffers == NULL) {
- return;
- }
-
- /* set one cliprect to cover the whole dri_drawable */
- dri_drawable->x = 0;
- dri_drawable->y = 0;
- dri_drawable->backX = 0;
- dri_drawable->backY = 0;
- dri_drawable->numClipRects = 1;
- dri_drawable->pClipRects[0].x1 = 0;
- dri_drawable->pClipRects[0].y1 = 0;
- dri_drawable->pClipRects[0].x2 = dri_drawable->w;
- dri_drawable->pClipRects[0].y2 = dri_drawable->h;
- dri_drawable->numBackClipRects = 1;
- dri_drawable->pBackClipRects[0].x1 = 0;
- dri_drawable->pBackClipRects[0].y1 = 0;
- dri_drawable->pBackClipRects[0].x2 = dri_drawable->w;
- dri_drawable->pBackClipRects[0].y2 = dri_drawable->h;
-
- if (drawable->old_num == count &&
- drawable->old_w == dri_drawable->w &&
- drawable->old_h == dri_drawable->h &&
- memcmp(drawable->old, buffers, sizeof(__DRIbuffer) * count) == 0) {
- return;
- } else {
- drawable->old_num = count;
- drawable->old_w = dri_drawable->w;
- drawable->old_h = dri_drawable->h;
- memcpy(drawable->old, buffers, sizeof(__DRIbuffer) * count);
- }
-
- drawable->is_pixmap = dri2_check_if_pixmap(buffers, count);
-
- for (i = 0; i < count; i++) {
- enum pipe_format format = 0;
- int index = 0;
-
- switch (buffers[i].attachment) {
- case __DRI_BUFFER_FRONT_LEFT:
- if (!st_screen->auto_fake_front)
- continue;
- /* fallthrough */
- case __DRI_BUFFER_FAKE_FRONT_LEFT:
- index = ST_SURFACE_FRONT_LEFT;
- format = drawable->color_format;
- break;
- case __DRI_BUFFER_BACK_LEFT:
- index = ST_SURFACE_BACK_LEFT;
- format = drawable->color_format;
- break;
- case __DRI_BUFFER_DEPTH:
- case __DRI_BUFFER_DEPTH_STENCIL:
- case __DRI_BUFFER_STENCIL:
- index = ST_SURFACE_DEPTH;
- format = drawable->depth_stencil_format;
- break;
- case __DRI_BUFFER_ACCUM:
- default:
- assert(0);
- }
-
- if (index == ST_SURFACE_DEPTH) {
- if (have_depth)
- continue;
- else
- have_depth = TRUE;
- }
-
- surface = dri_surface_from_handle(api,
- screen,
- buffers[i].name,
- format,
- dri_drawable->w,
- dri_drawable->h, buffers[i].pitch);
-
- switch (buffers[i].attachment) {
- case __DRI_BUFFER_FRONT_LEFT:
- case __DRI_BUFFER_FAKE_FRONT_LEFT:
- case __DRI_BUFFER_BACK_LEFT:
- drawable->color_format = surface->format;
- break;
- case __DRI_BUFFER_DEPTH:
- case __DRI_BUFFER_DEPTH_STENCIL:
- case __DRI_BUFFER_STENCIL:
- drawable->depth_stencil_format = surface->format;
- break;
- case __DRI_BUFFER_ACCUM:
- default:
- assert(0);
- }
-
- st_set_framebuffer_surface(drawable->stfb, index, surface);
- pipe_surface_reference(&surface, NULL);
- }
- /* this needed, or else the state tracker fails to pick the new buffers */
- st_resize_framebuffer(drawable->stfb, dri_drawable->w, dri_drawable->h);
-}
-
-/**
- * These are used for GLX_EXT_texture_from_pixmap
- */
-void dri2_set_tex_buffer2(__DRIcontext *pDRICtx, GLint target,
- GLint format, __DRIdrawable *dPriv)
-{
- struct dri_drawable *drawable = dri_drawable(dPriv);
- struct pipe_surface *ps;
-
- if (!drawable->stfb->Base.Attachment[BUFFER_FRONT_LEFT].Renderbuffer) {
- struct gl_renderbuffer *rb =
- st_new_renderbuffer_fb(drawable->color_format, 0 /*XXX*/, FALSE);
- _mesa_add_renderbuffer(&drawable->stfb->Base, BUFFER_FRONT_LEFT, rb);
- }
-
- dri_get_buffers(drawable->dPriv);
- st_get_framebuffer_surface(drawable->stfb, ST_SURFACE_FRONT_LEFT, &ps);
-
- if (!ps)
- return;
-
- st_bind_texture_surface(ps, target == GL_TEXTURE_2D ? ST_TEXTURE_2D :
- ST_TEXTURE_RECT, 0, drawable->color_format);
-}
-
-void dri2_set_tex_buffer(__DRIcontext *pDRICtx, GLint target,
- __DRIdrawable *dPriv)
-{
- dri2_set_tex_buffer2(pDRICtx, target, __DRI_TEXTURE_FORMAT_RGBA, dPriv);
-}
-
-void
-dri_update_buffer(struct pipe_screen *screen, void *context_private)
-{
- struct dri_context *ctx = (struct dri_context *)context_private;
-
- if (ctx->d_stamp == *ctx->dPriv->pStamp &&
- ctx->r_stamp == *ctx->rPriv->pStamp)
- return;
-
- ctx->d_stamp = *ctx->dPriv->pStamp;
- ctx->r_stamp = *ctx->rPriv->pStamp;
-
- /* Ask the X server for new renderbuffers. */
- dri_get_buffers(ctx->dPriv);
- if (ctx->dPriv != ctx->rPriv)
- dri_get_buffers(ctx->rPriv);
-
-}
-
-void
-dri_flush_frontbuffer(struct pipe_screen *screen,
- struct pipe_surface *surf, void *context_private)
-{
- struct dri_context *ctx = (struct dri_context *)context_private;
- struct dri_drawable *drawable = dri_drawable(ctx->dPriv);
- __DRIdrawable *dri_drawable = ctx->dPriv;
- __DRIscreen *dri_screen = ctx->sPriv;
-
- /* XXX Does this function get called with DRI1? */
-
- if (ctx->dPriv == NULL) {
- debug_printf("%s: no drawable bound to context\n", __func__);
- return;
- }
-
-#if 0
- /* TODO if rendering to pixmaps is slow enable this code. */
- if (drawable->is_pixmap)
- return;
-#else
- (void)drawable;
-#endif
-
- (*dri_screen->dri2.loader->flushFrontBuffer)(dri_drawable,
- dri_drawable->loaderPrivate);
-}
-
-/**
- * This is called when we need to set up GL rendering to a new X window.
- */
-boolean
-dri_create_buffer(__DRIscreen * sPriv,
- __DRIdrawable * dPriv,
- const __GLcontextModes * visual, boolean isPixmap)
-{
- struct dri_screen *screen = sPriv->private;
- struct dri_drawable *drawable = NULL;
- int i;
-
- if (isPixmap)
- goto fail; /* not implemented */
-
- drawable = CALLOC_STRUCT(dri_drawable);
- if (drawable == NULL)
- goto fail;
-
- if (visual->redBits == 8) {
- if (visual->alphaBits == 8)
- drawable->color_format = PIPE_FORMAT_B8G8R8A8_UNORM;
- else
- drawable->color_format = PIPE_FORMAT_B8G8R8X8_UNORM;
- } else {
- drawable->color_format = PIPE_FORMAT_B5G6R5_UNORM;
- }
-
- switch(visual->depthBits) {
- default:
- case 0:
- drawable->depth_stencil_format = PIPE_FORMAT_NONE;
- break;
- case 16:
- drawable->depth_stencil_format = PIPE_FORMAT_Z16_UNORM;
- break;
- case 24:
- if (visual->stencilBits == 0) {
- drawable->depth_stencil_format = (screen->d_depth_bits_last) ?
- PIPE_FORMAT_Z24X8_UNORM:
- PIPE_FORMAT_X8Z24_UNORM;
- } else {
- drawable->depth_stencil_format = (screen->sd_depth_bits_last) ?
- PIPE_FORMAT_Z24S8_UNORM:
- PIPE_FORMAT_S8Z24_UNORM;
- }
- break;
- case 32:
- drawable->depth_stencil_format = PIPE_FORMAT_Z32_UNORM;
- break;
- }
-
- drawable->stfb = st_create_framebuffer(visual,
- drawable->color_format,
- drawable->depth_stencil_format,
- drawable->depth_stencil_format,
- dPriv->w,
- dPriv->h, (void *)drawable);
- if (drawable->stfb == NULL)
- goto fail;
-
- drawable->sPriv = sPriv;
- drawable->dPriv = dPriv;
- dPriv->driverPrivate = (void *)drawable;
-
- /* setup dri2 buffers information */
- /* TODO incase of double buffer visual, delay fake creation */
- i = 0;
- if (sPriv->dri2.loader
- && (sPriv->dri2.loader->base.version > 2)
- && (sPriv->dri2.loader->getBuffersWithFormat != NULL)) {
- drawable->attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
- drawable->attachments[i++] = visual->rgbBits;
- if (!screen->auto_fake_front) {
- drawable->attachments[i++] = __DRI_BUFFER_FAKE_FRONT_LEFT;
- drawable->attachments[i++] = visual->rgbBits;
- }
- if (visual->doubleBufferMode) {
- drawable->attachments[i++] = __DRI_BUFFER_BACK_LEFT;
- drawable->attachments[i++] = visual->rgbBits;
- }
- if (visual->depthBits && visual->stencilBits) {
- drawable->attachments[i++] = __DRI_BUFFER_DEPTH_STENCIL;
- drawable->attachments[i++] = visual->depthBits + visual->stencilBits;
- } else if (visual->depthBits) {
- drawable->attachments[i++] = __DRI_BUFFER_DEPTH;
- drawable->attachments[i++] = visual->depthBits;
- } else if (visual->stencilBits) {
- drawable->attachments[i++] = __DRI_BUFFER_STENCIL;
- drawable->attachments[i++] = visual->stencilBits;
- }
- drawable->num_attachments = i / 2;
- } else {
- drawable->attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
- if (!screen->auto_fake_front)
- drawable->attachments[i++] = __DRI_BUFFER_FAKE_FRONT_LEFT;
- if (visual->doubleBufferMode)
- drawable->attachments[i++] = __DRI_BUFFER_BACK_LEFT;
- if (visual->depthBits && visual->stencilBits)
- drawable->attachments[i++] = __DRI_BUFFER_DEPTH_STENCIL;
- else if (visual->depthBits)
- drawable->attachments[i++] = __DRI_BUFFER_DEPTH;
- else if (visual->stencilBits)
- drawable->attachments[i++] = __DRI_BUFFER_STENCIL;
- drawable->num_attachments = i;
- }
-
- drawable->desired_fences = 2;
-
- return GL_TRUE;
-fail:
- FREE(drawable);
- return GL_FALSE;
-}
-
-static struct pipe_fence_handle *
-dri_swap_fences_pop_front(struct dri_drawable *draw)
-{
- struct pipe_screen *screen = dri_screen(draw->sPriv)->pipe_screen;
- struct pipe_fence_handle *fence = NULL;
-
- if (draw->cur_fences >= draw->desired_fences) {
- screen->fence_reference(screen, &fence, draw->swap_fences[draw->tail]);
- screen->fence_reference(screen, &draw->swap_fences[draw->tail++], NULL);
- --draw->cur_fences;
- draw->tail &= DRI_SWAP_FENCES_MASK;
- }
- return fence;
-}
-
-static void
-dri_swap_fences_push_back(struct dri_drawable *draw,
- struct pipe_fence_handle *fence)
-{
- struct pipe_screen *screen = dri_screen(draw->sPriv)->pipe_screen;
-
- if (!fence)
- return;
-
- if (draw->cur_fences < DRI_SWAP_FENCES_MAX) {
- draw->cur_fences++;
- screen->fence_reference(screen, &draw->swap_fences[draw->head++],
- fence);
- draw->head &= DRI_SWAP_FENCES_MASK;
- }
-}
-
-void
-dri_destroy_buffer(__DRIdrawable * dPriv)
-{
- struct dri_drawable *drawable = dri_drawable(dPriv);
- struct pipe_fence_handle *fence;
- struct pipe_screen *screen = dri_screen(drawable->sPriv)->pipe_screen;
-
- st_unreference_framebuffer(drawable->stfb);
- drawable->desired_fences = 0;
- while (drawable->cur_fences) {
- fence = dri_swap_fences_pop_front(drawable);
- screen->fence_reference(screen, &fence, NULL);
- }
-
- FREE(drawable);
-}
-
-static void
-dri1_update_drawables_locked(struct dri_context *ctx,
- __DRIdrawable * driDrawPriv,
- __DRIdrawable * driReadPriv)
-{
- if (ctx->stLostLock) {
- ctx->stLostLock = FALSE;
- if (driDrawPriv == driReadPriv)
- DRI_VALIDATE_DRAWABLE_INFO(ctx->sPriv, driDrawPriv);
- else
- DRI_VALIDATE_TWO_DRAWABLES_INFO(ctx->sPriv, driDrawPriv,
- driReadPriv);
- }
-}
-
-/**
- * This ensures all contexts which bind to a drawable pick up the
- * drawable change and signal new buffer state.
- * Calling st_resize_framebuffer for each context may seem like overkill,
- * but no new buffers will actually be allocated if the dimensions don't
- * change.
- */
-
-static void
-dri1_propagate_drawable_change(struct dri_context *ctx)
-{
- __DRIdrawable *dPriv = ctx->dPriv;
- __DRIdrawable *rPriv = ctx->rPriv;
- boolean flushed = FALSE;
-
- if (dPriv && ctx->d_stamp != dPriv->lastStamp) {
-
- st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
- flushed = TRUE;
- ctx->d_stamp = dPriv->lastStamp;
- st_resize_framebuffer(dri_drawable(dPriv)->stfb, dPriv->w, dPriv->h);
-
- }
-
- if (rPriv && dPriv != rPriv && ctx->r_stamp != rPriv->lastStamp) {
-
- if (!flushed)
- st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
- ctx->r_stamp = rPriv->lastStamp;
- st_resize_framebuffer(dri_drawable(rPriv)->stfb, rPriv->w, rPriv->h);
-
- } else if (rPriv && dPriv == rPriv) {
-
- ctx->r_stamp = ctx->d_stamp;
-
- }
-}
-
-void
-dri1_update_drawables(struct dri_context *ctx,
- struct dri_drawable *draw, struct dri_drawable *read)
-{
- dri_lock(ctx);
- dri1_update_drawables_locked(ctx, draw->dPriv, read->dPriv);
- dri_unlock(ctx);
-
- dri1_propagate_drawable_change(ctx);
-}
-
-static INLINE boolean
-dri1_intersect_src_bbox(struct drm_clip_rect *dst,
- int dst_x,
- int dst_y,
- const struct drm_clip_rect *src,
- const struct drm_clip_rect *bbox)
-{
- int xy1;
- int xy2;
-
- xy1 = ((int)src->x1 > (int)bbox->x1 + dst_x) ? src->x1 :
- (int)bbox->x1 + dst_x;
- xy2 = ((int)src->x2 < (int)bbox->x2 + dst_x) ? src->x2 :
- (int)bbox->x2 + dst_x;
- if (xy1 >= xy2 || xy1 < 0)
- return FALSE;
-
- dst->x1 = xy1;
- dst->x2 = xy2;
-
- xy1 = ((int)src->y1 > (int)bbox->y1 + dst_y) ? src->y1 :
- (int)bbox->y1 + dst_y;
- xy2 = ((int)src->y2 < (int)bbox->y2 + dst_y) ? src->y2 :
- (int)bbox->y2 + dst_y;
- if (xy1 >= xy2 || xy1 < 0)
- return FALSE;
-
- dst->y1 = xy1;
- dst->y2 = xy2;
- return TRUE;
-}
-
-static void
-dri1_swap_copy(struct dri_context *ctx,
- struct pipe_surface *dst,
- struct pipe_surface *src,
- __DRIdrawable * dPriv, const struct drm_clip_rect *bbox)
-{
- struct pipe_context *pipe = ctx->pipe;
- struct drm_clip_rect clip;
- struct drm_clip_rect *cur;
- int i;
-
- cur = dPriv->pClipRects;
-
- for (i = 0; i < dPriv->numClipRects; ++i) {
- if (dri1_intersect_src_bbox(&clip, dPriv->x, dPriv->y, cur++, bbox)) {
- if (pipe->surface_copy) {
- pipe->surface_copy(pipe, dst, clip.x1, clip.y1,
- src,
- (int)clip.x1 - dPriv->x,
- (int)clip.y1 - dPriv->y,
- clip.x2 - clip.x1, clip.y2 - clip.y1);
- } else {
- util_surface_copy(pipe, FALSE, dst, clip.x1, clip.y1,
- src,
- (int)clip.x1 - dPriv->x,
- (int)clip.y1 - dPriv->y,
- clip.x2 - clip.x1, clip.y2 - clip.y1);
- }
- }
- }
-}
-
-static void
-dri1_copy_to_front(struct dri_context *ctx,
- struct pipe_surface *surf,
- __DRIdrawable * dPriv,
- const struct drm_clip_rect *sub_box,
- struct pipe_fence_handle **fence)
-{
- struct pipe_context *pipe = ctx->pipe;
- boolean save_lost_lock;
- uint cur_w;
- uint cur_h;
- struct drm_clip_rect bbox;
- boolean visible = TRUE;
-
- *fence = NULL;
-
- dri_lock(ctx);
- save_lost_lock = ctx->stLostLock;
- dri1_update_drawables_locked(ctx, dPriv, dPriv);
- st_get_framebuffer_dimensions(dri_drawable(dPriv)->stfb, &cur_w, &cur_h);
-
- bbox.x1 = 0;
- bbox.x2 = cur_w;
- bbox.y1 = 0;
- bbox.y2 = cur_h;
-
- if (sub_box)
- visible = dri1_intersect_src_bbox(&bbox, 0, 0, &bbox, sub_box);
-
- if (visible && __dri1_api_hooks->present_locked) {
-
- __dri1_api_hooks->present_locked(pipe,
- surf,
- dPriv->pClipRects,
- dPriv->numClipRects,
- dPriv->x, dPriv->y, &bbox, fence);
-
- } else if (visible && __dri1_api_hooks->front_srf_locked) {
-
- struct pipe_surface *front = __dri1_api_hooks->front_srf_locked(pipe);
-
- if (front)
- dri1_swap_copy(ctx, front, surf, dPriv, &bbox);
-
- st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, fence);
- }
-
- ctx->stLostLock = save_lost_lock;
-
- /**
- * FIXME: Revisit this: Update drawables on copy_sub_buffer ?
- */
-
- if (!sub_box)
- dri1_update_drawables_locked(ctx, ctx->dPriv, ctx->rPriv);
-
- dri_unlock(ctx);
- dri1_propagate_drawable_change(ctx);
-}
-
-void
-dri1_flush_frontbuffer(struct pipe_screen *screen,
- struct pipe_surface *surf, void *context_private)
-{
- struct dri_context *ctx = (struct dri_context *)context_private;
- struct pipe_fence_handle *dummy_fence;
-
- dri1_copy_to_front(ctx, surf, ctx->dPriv, NULL, &dummy_fence);
- screen->fence_reference(screen, &dummy_fence, NULL);
-
- /**
- * FIXME: Do we need swap throttling here?
- */
-}
-
-void
-dri_swap_buffers(__DRIdrawable * dPriv)
-{
- struct dri_context *ctx;
- struct pipe_surface *back_surf;
- struct dri_drawable *draw = dri_drawable(dPriv);
- struct pipe_screen *screen = dri_screen(draw->sPriv)->pipe_screen;
- struct pipe_fence_handle *fence;
- struct st_context *st = st_get_current();
-
- assert(__dri1_api_hooks != NULL);
-
- if (!st)
- return; /* For now */
-
- ctx = (struct dri_context *)st->pipe->priv;
-
- st_get_framebuffer_surface(draw->stfb, ST_SURFACE_BACK_LEFT, &back_surf);
- if (back_surf) {
- st_notify_swapbuffers(draw->stfb);
- st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
- fence = dri_swap_fences_pop_front(draw);
- if (fence) {
- (void)screen->fence_finish(screen, fence, 0);
- screen->fence_reference(screen, &fence, NULL);
- }
- dri1_copy_to_front(ctx, back_surf, dPriv, NULL, &fence);
- dri_swap_fences_push_back(draw, fence);
- screen->fence_reference(screen, &fence, NULL);
- }
-}
-
-void
-dri_copy_sub_buffer(__DRIdrawable * dPriv, int x, int y, int w, int h)
-{
- struct pipe_screen *screen = dri_screen(dPriv->driScreenPriv)->pipe_screen;
- struct drm_clip_rect sub_bbox;
- struct dri_context *ctx;
- struct pipe_surface *back_surf;
- struct dri_drawable *draw = dri_drawable(dPriv);
- struct pipe_fence_handle *dummy_fence;
- struct st_context *st = st_get_current();
-
- assert(__dri1_api_hooks != NULL);
-
- if (!st)
- return;
-
- ctx = (struct dri_context *)st->pipe->priv;
-
- sub_bbox.x1 = x;
- sub_bbox.x2 = x + w;
- sub_bbox.y1 = y;
- sub_bbox.y2 = y + h;
-
- st_get_framebuffer_surface(draw->stfb, ST_SURFACE_BACK_LEFT, &back_surf);
- if (back_surf) {
- st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
- dri1_copy_to_front(ctx, back_surf, dPriv, &sub_bbox, &dummy_fence);
- screen->fence_reference(screen, &dummy_fence, NULL);
- }
-}
-
-/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri/dri_extensions.c b/src/gallium/state_trackers/dri/dri_extensions.c
deleted file mode 100644
index 1259813a41..0000000000
--- a/src/gallium/state_trackers/dri/dri_extensions.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2009, VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-/*
- * Author: Keith Whitwell <keithw@vmware.com>
- * Author: Jakob Bornecrantz <wallbraker@gmail.com>
- */
-
-#include "dri_screen.h"
-#include "dri_context.h"
-#include "state_tracker/st_context.h"
-
-#define need_GL_ARB_map_buffer_range
-#define need_GL_ARB_multisample
-#define need_GL_ARB_occlusion_query
-#define need_GL_ARB_point_parameters
-#define need_GL_ARB_provoking_vertex
-#define need_GL_ARB_shader_objects
-#define need_GL_ARB_texture_compression
-#define need_GL_ARB_vertex_array_object
-#define need_GL_ARB_vertex_buffer_object
-#define need_GL_ARB_vertex_program
-#define need_GL_ARB_vertex_shader
-#define need_GL_ARB_window_pos
-#define need_GL_EXT_blend_color
-#define need_GL_EXT_blend_equation_separate
-#define need_GL_EXT_blend_func_separate
-#define need_GL_EXT_blend_minmax
-#define need_GL_EXT_cull_vertex
-#define need_GL_EXT_draw_buffers2
-#define need_GL_EXT_fog_coord
-#define need_GL_EXT_framebuffer_object
-#define need_GL_EXT_multi_draw_arrays
-#define need_GL_EXT_provoking_vertex
-#define need_GL_EXT_secondary_color
-#define need_GL_EXT_stencil_two_side
-#define need_GL_APPLE_vertex_array_object
-#define need_GL_NV_vertex_program
-#define need_GL_VERSION_2_0
-#define need_GL_VERSION_2_1
-#include "main/remap_helper.h"
-#include "utils.h"
-
-/**
- * Extension strings exported by the driver.
- */
-static const struct dri_extension card_extensions[] = {
- {"GL_ARB_fragment_shader", NULL},
- {"GL_ARB_map_buffer_range", GL_ARB_map_buffer_range_functions},
- {"GL_ARB_multisample", GL_ARB_multisample_functions},
- {"GL_ARB_multitexture", NULL},
- {"GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions},
- {"GL_ARB_pixel_buffer_object", NULL},
- {"GL_ARB_provoking_vertex", GL_ARB_provoking_vertex_functions},
- {"GL_ARB_point_parameters", GL_ARB_point_parameters_functions},
- {"GL_ARB_shading_language_100", GL_VERSION_2_0_functions },
- {"GL_ARB_shading_language_120", GL_VERSION_2_1_functions },
- {"GL_ARB_shader_objects", GL_ARB_shader_objects_functions},
- {"GL_ARB_texture_border_clamp", NULL},
- {"GL_ARB_texture_compression", GL_ARB_texture_compression_functions},
- {"GL_ARB_texture_cube_map", NULL},
- {"GL_ARB_texture_env_add", NULL},
- {"GL_ARB_texture_env_combine", NULL},
- {"GL_ARB_texture_env_dot3", NULL},
- {"GL_ARB_texture_mirrored_repeat", NULL},
- {"GL_ARB_texture_non_power_of_two", NULL},
- {"GL_ARB_texture_rectangle", NULL},
- {"GL_ARB_vertex_array_object", GL_ARB_vertex_array_object_functions},
- {"GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions},
- {"GL_ARB_vertex_shader", GL_ARB_vertex_shader_functions},
- {"GL_ARB_vertex_program", GL_ARB_vertex_program_functions},
- {"GL_ARB_window_pos", GL_ARB_window_pos_functions},
- {"GL_EXT_blend_color", GL_EXT_blend_color_functions},
- {"GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions},
- {"GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions},
- {"GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions},
- {"GL_EXT_blend_subtract", NULL},
- {"GL_EXT_cull_vertex", GL_EXT_cull_vertex_functions},
- {"GL_EXT_draw_buffers2", GL_EXT_draw_buffers2_functions},
- {"GL_EXT_fog_coord", GL_EXT_fog_coord_functions},
- {"GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions},
- {"GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions},
- {"GL_EXT_packed_depth_stencil", NULL},
- {"GL_EXT_pixel_buffer_object", NULL},
- {"GL_EXT_provoking_vertex", GL_EXT_provoking_vertex_functions},
- {"GL_EXT_secondary_color", GL_EXT_secondary_color_functions},
- {"GL_EXT_stencil_two_side", GL_EXT_stencil_two_side_functions},
- {"GL_EXT_stencil_wrap", NULL},
- {"GL_EXT_texture_edge_clamp", NULL},
- {"GL_EXT_texture_env_combine", NULL},
- {"GL_EXT_texture_env_dot3", NULL},
- {"GL_EXT_texture_filter_anisotropic", NULL},
- {"GL_EXT_texture_lod_bias", NULL},
- {"GL_3DFX_texture_compression_FXT1", NULL},
- {"GL_APPLE_client_storage", NULL},
- {"GL_APPLE_vertex_array_object", GL_APPLE_vertex_array_object_functions},
- {"GL_MESA_pack_invert", NULL},
- {"GL_MESA_ycbcr_texture", NULL},
- {"GL_NV_blend_square", NULL},
- {"GL_NV_vertex_program", GL_NV_vertex_program_functions},
- {"GL_NV_vertex_program1_1", NULL},
- {"GL_SGIS_generate_mipmap", NULL},
- {NULL, NULL}
-};
-
-void
-dri_init_extensions(struct dri_context *ctx)
-{
- /* The card_extensions list should be pruned according to the
- * capabilities of the pipe_screen. This is actually something
- * that can/should be done inside st_create_context().
- * XXX Not pruning is very bogus. Always all these extensions above
- * will be advertized, regardless what st_init_extensions
- * (which depends on the pipe cap bits) does.
- */
- driInitExtensions(ctx->st->ctx, card_extensions, GL_TRUE);
-}
-
-/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri/drm/Makefile b/src/gallium/state_trackers/dri/drm/Makefile
new file mode 100644
index 0000000000..7a236da0c0
--- /dev/null
+++ b/src/gallium/state_trackers/dri/drm/Makefile
@@ -0,0 +1,32 @@
+TOP = ../../../../..
+include $(TOP)/configs/current
+
+LIBNAME = dridrm
+
+LIBRARY_INCLUDES = \
+ -I$(TOP)/include \
+ -I$(TOP)/src/mesa \
+ -I$(TOP)/src/gallium/state_trackers/dri/common \
+ -I$(TOP)/src/mesa/drivers/dri/common \
+ -I$(TOP)/src/mesa/main \
+ $(shell pkg-config --cflags-only-I libdrm)
+
+
+C_SOURCES = \
+ dri_context.c \
+ dri_screen.c \
+ dri_drawable.c \
+ dri_st_api.c \
+ dri1_helper.c \
+ dri1.c \
+ dri2.c
+
+# $(TOP)/src/mesa/drivers/dri/common/utils.c \
+ $(TOP)/src/mesa/drivers/dri/common/vblank.c \
+ $(TOP)/src/mesa/drivers/dri/common/dri_util.c \
+ $(TOP)/src/mesa/drivers/dri/common/xmlconfig.c \
+ $(TOP)/src/mesa/drivers/common/driverfuncs.c \
+ $(TOP)/src/mesa/drivers/dri/common/texmem.c \
+ $(TOP)/src/mesa/drivers/dri/common/drirenderbuffer.c
+
+include ../../../Makefile.template
diff --git a/src/gallium/state_trackers/dri/drm/SConscript b/src/gallium/state_trackers/dri/drm/SConscript
new file mode 100644
index 0000000000..b9726ee311
--- /dev/null
+++ b/src/gallium/state_trackers/dri/drm/SConscript
@@ -0,0 +1,27 @@
+#######################################################################
+# SConscript for dri state_tracker
+
+Import('*')
+
+if env['dri']:
+
+ env = env.Clone()
+
+ env.Append(CPPPATH = [
+ '#/src/mesa',
+ '#/src/gallium/state_trackers/dri/common',
+ '#/src/mesa/drivers/dri/common',
+ ])
+
+ st_dri = env.ConvenienceLibrary(
+ target = 'st_dri',
+ source = [ 'dri_context.c',
+ 'dri_drawable.c',
+ 'dri_screen.c',
+ 'dri_st_api.c',
+ 'dri1_helper.c',
+ 'dri1.c',
+ 'dri2.c',
+ ]
+ )
+ Export('st_dri')
diff --git a/src/gallium/state_trackers/dri/drm/dri1.c b/src/gallium/state_trackers/dri/drm/dri1.c
new file mode 100644
index 0000000000..cca7cd8f0c
--- /dev/null
+++ b/src/gallium/state_trackers/dri/drm/dri1.c
@@ -0,0 +1,522 @@
+/**************************************************************************
+ *
+ * Copyright 2009, VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+/*
+ * Author: Keith Whitwell <keithw@vmware.com>
+ * Author: Jakob Bornecrantz <wallbraker@gmail.com>
+ */
+
+/* XXX DRI1 is untested after the switch to st_api.h */
+
+#include "util/u_memory.h"
+#include "util/u_rect.h"
+#include "util/u_inlines.h"
+#include "pipe/p_context.h"
+#include "state_tracker/dri1_api.h"
+
+#include "dri_screen.h"
+#include "dri_context.h"
+#include "dri_drawable.h"
+#include "dri_st_api.h"
+#include "dri1_helper.h"
+#include "dri1.h"
+
+static INLINE void
+dri1_lock(struct dri_context *ctx)
+{
+ drm_context_t hw_context = ctx->cPriv->hHWContext;
+ char ret = 0;
+
+ DRM_CAS(ctx->lock, hw_context, DRM_LOCK_HELD | hw_context, ret);
+ if (ret) {
+ drmGetLock(ctx->sPriv->fd, hw_context, 0);
+ ctx->stLostLock = TRUE;
+ ctx->wsLostLock = TRUE;
+ }
+ ctx->isLocked = TRUE;
+}
+
+static INLINE void
+dri1_unlock(struct dri_context *ctx)
+{
+ ctx->isLocked = FALSE;
+ DRM_UNLOCK(ctx->sPriv->fd, ctx->lock, ctx->cPriv->hHWContext);
+}
+
+static void
+dri1_update_drawables_locked(struct dri_context *ctx,
+ __DRIdrawable * driDrawPriv,
+ __DRIdrawable * driReadPriv)
+{
+ if (ctx->stLostLock) {
+ ctx->stLostLock = FALSE;
+ if (driDrawPriv == driReadPriv)
+ DRI_VALIDATE_DRAWABLE_INFO(ctx->sPriv, driDrawPriv);
+ else
+ DRI_VALIDATE_TWO_DRAWABLES_INFO(ctx->sPriv, driDrawPriv,
+ driReadPriv);
+ }
+}
+
+/**
+ * This ensures all contexts which bind to a drawable pick up the
+ * drawable change and signal new buffer state.
+ */
+static void
+dri1_propagate_drawable_change(struct dri_context *ctx)
+{
+ __DRIdrawable *dPriv = ctx->dPriv;
+ __DRIdrawable *rPriv = ctx->rPriv;
+ struct dri_drawable *draw = dri_drawable(dPriv);
+ struct dri_drawable *read = dri_drawable(rPriv);
+ boolean flushed = FALSE;
+
+ if (dPriv && draw->texture_stamp != dPriv->lastStamp) {
+ ctx->st->flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
+ flushed = TRUE;
+ ctx->st->notify_invalid_framebuffer(ctx->st, draw->stfb);
+ }
+
+ if (rPriv && dPriv != rPriv && read->texture_stamp != rPriv->lastStamp) {
+ if (!flushed)
+ ctx->st->flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
+ ctx->st->notify_invalid_framebuffer(ctx->st, read->stfb);
+ }
+}
+
+static INLINE boolean
+dri1_intersect_src_bbox(struct drm_clip_rect *dst,
+ int dst_x,
+ int dst_y,
+ const struct drm_clip_rect *src,
+ const struct drm_clip_rect *bbox)
+{
+ int xy1;
+ int xy2;
+
+ xy1 = ((int)src->x1 > (int)bbox->x1 + dst_x) ? src->x1 :
+ (int)bbox->x1 + dst_x;
+ xy2 = ((int)src->x2 < (int)bbox->x2 + dst_x) ? src->x2 :
+ (int)bbox->x2 + dst_x;
+ if (xy1 >= xy2 || xy1 < 0)
+ return FALSE;
+
+ dst->x1 = xy1;
+ dst->x2 = xy2;
+
+ xy1 = ((int)src->y1 > (int)bbox->y1 + dst_y) ? src->y1 :
+ (int)bbox->y1 + dst_y;
+ xy2 = ((int)src->y2 < (int)bbox->y2 + dst_y) ? src->y2 :
+ (int)bbox->y2 + dst_y;
+ if (xy1 >= xy2 || xy1 < 0)
+ return FALSE;
+
+ dst->y1 = xy1;
+ dst->y2 = xy2;
+ return TRUE;
+}
+
+static void
+dri1_swap_copy(struct pipe_context *pipe,
+ struct pipe_surface *dst,
+ struct pipe_surface *src,
+ __DRIdrawable * dPriv, const struct drm_clip_rect *bbox)
+{
+ struct drm_clip_rect clip;
+ struct drm_clip_rect *cur;
+ int i;
+
+ cur = dPriv->pClipRects;
+
+ for (i = 0; i < dPriv->numClipRects; ++i) {
+ if (dri1_intersect_src_bbox(&clip, dPriv->x, dPriv->y, cur++, bbox)) {
+ if (pipe->surface_copy) {
+ pipe->surface_copy(pipe, dst, clip.x1, clip.y1,
+ src,
+ (int)clip.x1 - dPriv->x,
+ (int)clip.y1 - dPriv->y,
+ clip.x2 - clip.x1, clip.y2 - clip.y1);
+ } else {
+ util_surface_copy(pipe, FALSE, dst, clip.x1, clip.y1,
+ src,
+ (int)clip.x1 - dPriv->x,
+ (int)clip.y1 - dPriv->y,
+ clip.x2 - clip.x1, clip.y2 - clip.y1);
+ }
+ }
+ }
+}
+
+static void
+dri1_present_texture_locked(__DRIdrawable * dPriv,
+ struct pipe_texture *ptex,
+ const struct drm_clip_rect *sub_box,
+ struct pipe_fence_handle **fence)
+{
+ struct dri_drawable *drawable = dri_drawable(dPriv);
+ struct dri_screen *screen = dri_screen(drawable->sPriv);
+ struct pipe_context *pipe;
+ struct pipe_surface *psurf;
+ struct drm_clip_rect bbox;
+ boolean visible = TRUE;
+
+ *fence = NULL;
+
+ bbox.x1 = 0;
+ bbox.x2 = ptex->width0;
+ bbox.y1 = 0;
+ bbox.y2 = ptex->height0;
+
+ if (sub_box)
+ visible = dri1_intersect_src_bbox(&bbox, 0, 0, &bbox, sub_box);
+ if (!visible)
+ return;
+
+ pipe = dri1_get_pipe_context(screen);
+ psurf = dri1_get_pipe_surface(drawable, ptex);
+ if (!pipe || !psurf)
+ return;
+
+ if (__dri1_api_hooks->present_locked) {
+ __dri1_api_hooks->present_locked(pipe, psurf,
+ dPriv->pClipRects, dPriv->numClipRects,
+ dPriv->x, dPriv->y, &bbox, fence);
+ } else if (__dri1_api_hooks->front_srf_locked) {
+ struct pipe_surface *front = __dri1_api_hooks->front_srf_locked(pipe);
+
+ if (front)
+ dri1_swap_copy(pipe, front, psurf, dPriv, &bbox);
+
+ pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, fence);
+ }
+}
+
+static void
+dri1_copy_to_front(struct dri_context *ctx,
+ struct pipe_texture *ptex,
+ __DRIdrawable * dPriv,
+ const struct drm_clip_rect *sub_box,
+ struct pipe_fence_handle **fence)
+{
+ boolean save_lost_lock;
+
+ dri1_lock(ctx);
+ save_lost_lock = ctx->stLostLock;
+ dri1_update_drawables_locked(ctx, dPriv, dPriv);
+
+ dri1_present_texture_locked(dPriv, ptex, sub_box, fence);
+
+ ctx->stLostLock = save_lost_lock;
+
+ /**
+ * FIXME: Revisit this: Update drawables on copy_sub_buffer ?
+ */
+
+ if (!sub_box)
+ dri1_update_drawables_locked(ctx, ctx->dPriv, ctx->rPriv);
+
+ dri1_unlock(ctx);
+ dri1_propagate_drawable_change(ctx);
+}
+
+/*
+ * Backend functions for st_framebuffer interface and swap_buffers.
+ */
+
+void
+dri1_flush_frontbuffer(struct dri_drawable *draw,
+ enum st_attachment_type statt)
+{
+ struct dri_context *ctx = dri_get_current();
+ struct dri_screen *screen = dri_screen(draw->sPriv);
+ struct pipe_screen *pipe_screen = screen->pipe_screen;
+ struct pipe_fence_handle *dummy_fence;
+ struct pipe_texture *ptex;
+
+ if (!ctx)
+ return; /* For now */
+
+ ptex = draw->textures[statt];
+ if (ptex) {
+ dri1_copy_to_front(ctx, ptex, ctx->dPriv, NULL, &dummy_fence);
+ pipe_screen->fence_reference(pipe_screen, &dummy_fence, NULL);
+ }
+
+ /**
+ * FIXME: Do we need swap throttling here?
+ */
+}
+
+void
+dri1_swap_buffers(__DRIdrawable * dPriv)
+{
+ struct dri_context *ctx = dri_get_current();
+ struct dri_drawable *draw = dri_drawable(dPriv);
+ struct dri_screen *screen = dri_screen(draw->sPriv);
+ struct pipe_screen *pipe_screen = screen->pipe_screen;
+ struct pipe_fence_handle *fence;
+ struct pipe_texture *ptex;
+
+ assert(__dri1_api_hooks != NULL);
+
+ if (!ctx)
+ return; /* For now */
+
+ ptex = draw->textures[ST_ATTACHMENT_BACK_LEFT];
+ if (ptex) {
+ ctx->st->flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
+ fence = dri1_swap_fences_pop_front(draw);
+ if (fence) {
+ (void)pipe_screen->fence_finish(pipe_screen, fence, 0);
+ pipe_screen->fence_reference(pipe_screen, &fence, NULL);
+ }
+ dri1_copy_to_front(ctx, ptex, dPriv, NULL, &fence);
+ dri1_swap_fences_push_back(draw, fence);
+ pipe_screen->fence_reference(pipe_screen, &fence, NULL);
+ }
+}
+
+void
+dri1_copy_sub_buffer(__DRIdrawable * dPriv, int x, int y, int w, int h)
+{
+ struct dri_context *ctx = dri_get_current();
+ struct dri_screen *screen = dri_screen(dPriv->driScreenPriv);
+ struct pipe_screen *pipe_screen = screen->pipe_screen;
+ struct drm_clip_rect sub_bbox;
+ struct dri_drawable *draw = dri_drawable(dPriv);
+ struct pipe_fence_handle *dummy_fence;
+ struct pipe_texture *ptex;
+
+ assert(__dri1_api_hooks != NULL);
+
+ if (!ctx)
+ return;
+
+ sub_bbox.x1 = x;
+ sub_bbox.x2 = x + w;
+ sub_bbox.y1 = y;
+ sub_bbox.y2 = y + h;
+
+ ptex = draw->textures[ST_ATTACHMENT_BACK_LEFT];
+ if (ptex) {
+ ctx->st->flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
+ dri1_copy_to_front(ctx, ptex, dPriv, &sub_bbox, &dummy_fence);
+ pipe_screen->fence_reference(pipe_screen, &dummy_fence, NULL);
+ }
+}
+
+/**
+ * Allocate framebuffer attachments.
+ *
+ * During fixed-size operation, the function keeps allocating new attachments
+ * as they are requested. Unused attachments are not removed, not until the
+ * framebuffer is resized or destroyed.
+ */
+void
+dri1_allocate_textures(struct dri_drawable *drawable,
+ unsigned mask)
+{
+ struct dri_screen *screen = dri_screen(drawable->sPriv);
+ struct pipe_texture templ;
+ unsigned width, height;
+ boolean resized;
+ int i;
+
+ width = drawable->dPriv->w;
+ height = drawable->dPriv->h;
+
+ resized = (drawable->old_w != width ||
+ drawable->old_h != height);
+
+ /* remove outdated textures */
+ if (resized) {
+ for (i = 0; i < ST_ATTACHMENT_COUNT; i++)
+ pipe_texture_reference(&drawable->textures[i], NULL);
+ }
+
+ memset(&templ, 0, sizeof(templ));
+ templ.target = PIPE_TEXTURE_2D;
+ templ.width0 = width;
+ templ.height0 = height;
+ templ.depth0 = 1;
+ templ.last_level = 0;
+
+ for (i = 0; i < ST_ATTACHMENT_COUNT; i++) {
+ enum pipe_format format;
+ unsigned tex_usage;
+
+ /* the texture already exists or not requested */
+ if (drawable->textures[i] || !(mask & (1 << i))) {
+ continue;
+ }
+
+ switch (i) {
+ case ST_ATTACHMENT_FRONT_LEFT:
+ case ST_ATTACHMENT_BACK_LEFT:
+ case ST_ATTACHMENT_FRONT_RIGHT:
+ case ST_ATTACHMENT_BACK_RIGHT:
+ format = drawable->stvis.color_format;
+ tex_usage = PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
+ PIPE_TEXTURE_USAGE_RENDER_TARGET;
+ break;
+ case ST_ATTACHMENT_DEPTH_STENCIL:
+ format = drawable->stvis.depth_stencil_format;
+ tex_usage = PIPE_TEXTURE_USAGE_DEPTH_STENCIL;
+ break;
+ default:
+ format = PIPE_FORMAT_NONE;
+ break;
+ }
+
+ if (format != PIPE_FORMAT_NONE) {
+ templ.format = format;
+ templ.tex_usage = tex_usage;
+
+ drawable->textures[i] =
+ screen->pipe_screen->texture_create(screen->pipe_screen, &templ);
+ }
+ }
+
+ drawable->old_w = width;
+ drawable->old_h = height;
+}
+
+/*
+ * Backend function for init_screen.
+ */
+
+static const __DRIextension *dri1_screen_extensions[] = {
+ &driReadDrawableExtension,
+ &driCopySubBufferExtension.base,
+ &driSwapControlExtension.base,
+ &driFrameTrackingExtension.base,
+ &driMediaStreamCounterExtension.base,
+ NULL
+};
+
+static void
+st_dri_lock(struct pipe_context *pipe)
+{
+ dri1_lock((struct dri_context *)pipe->priv);
+}
+
+static void
+st_dri_unlock(struct pipe_context *pipe)
+{
+ dri1_unlock((struct dri_context *)pipe->priv);
+}
+
+static boolean
+st_dri_is_locked(struct pipe_context *pipe)
+{
+ return ((struct dri_context *)pipe->priv)->isLocked;
+}
+
+static boolean
+st_dri_lost_lock(struct pipe_context *pipe)
+{
+ return ((struct dri_context *)pipe->priv)->wsLostLock;
+}
+
+static void
+st_dri_clear_lost_lock(struct pipe_context *pipe)
+{
+ ((struct dri_context *)pipe->priv)->wsLostLock = FALSE;
+}
+
+static struct dri1_api_lock_funcs dri1_lf = {
+ .lock = st_dri_lock,
+ .unlock = st_dri_unlock,
+ .is_locked = st_dri_is_locked,
+ .is_lock_lost = st_dri_lost_lock,
+ .clear_lost_lock = st_dri_clear_lost_lock
+};
+
+static INLINE void
+dri1_copy_version(struct dri1_api_version *dst,
+ const struct __DRIversionRec *src)
+{
+ dst->major = src->major;
+ dst->minor = src->minor;
+ dst->patch_level = src->patch;
+}
+
+struct dri1_api *__dri1_api_hooks = NULL;
+
+const __DRIconfig **
+dri1_init_screen(__DRIscreen * sPriv)
+{
+ const __DRIconfig **configs;
+ struct dri_screen *screen;
+ struct dri1_create_screen_arg arg;
+
+ screen = CALLOC_STRUCT(dri_screen);
+ if (!screen)
+ return NULL;
+
+ screen->api = drm_api_create();
+ screen->sPriv = sPriv;
+ screen->fd = sPriv->fd;
+ screen->drmLock = (drmLock *) & sPriv->pSAREA->lock;
+
+ sPriv->private = (void *)screen;
+ sPriv->extensions = dri1_screen_extensions;
+
+ arg.base.mode = DRM_CREATE_DRI1;
+ arg.lf = &dri1_lf;
+ arg.ddx_info = sPriv->pDevPriv;
+ arg.ddx_info_size = sPriv->devPrivSize;
+ arg.sarea = sPriv->pSAREA;
+ dri1_copy_version(&arg.ddx_version, &sPriv->ddx_version);
+ dri1_copy_version(&arg.dri_version, &sPriv->dri_version);
+ dri1_copy_version(&arg.drm_version, &sPriv->drm_version);
+ arg.api = NULL;
+
+ /**
+ * FIXME: If the driver supports format conversion swapbuffer blits, we might
+ * want to support other color bit depths than the server is currently
+ * using.
+ */
+
+ configs = dri_init_screen_helper(screen, &arg.base, sPriv->fbBPP);
+ if (!configs)
+ goto fail;
+
+ if (!arg.api) {
+ debug_printf("%s: failed to create dri1 screen\n", __FUNCTION__);
+ goto fail;
+ }
+
+ __dri1_api_hooks = arg.api;
+
+ return configs;
+fail:
+ if (configs)
+ FREE(configs);
+ dri_destroy_screen_helper(screen);
+ FREE(screen);
+ return NULL;
+}
diff --git a/src/gallium/state_trackers/dri/drm/dri1.h b/src/gallium/state_trackers/dri/drm/dri1.h
new file mode 100644
index 0000000000..f7441f98ab
--- /dev/null
+++ b/src/gallium/state_trackers/dri/drm/dri1.h
@@ -0,0 +1,59 @@
+/**************************************************************************
+ *
+ * Copyright 2009, VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+/*
+ * Author: Keith Whitwell <keithw@vmware.com>
+ * Author: Jakob Bornecrantz <wallbraker@gmail.com>
+ */
+
+#ifndef DRI1_H
+#define DRI1_H
+
+#include "dri_context.h"
+#include "dri_drawable.h"
+
+#include "state_tracker/st_api.h"
+#include "dri_wrapper.h"
+
+extern struct dri1_api *__dri1_api_hooks;
+
+const __DRIconfig **
+dri1_init_screen(__DRIscreen * sPriv);
+
+void
+dri1_flush_frontbuffer(struct dri_drawable *drawable,
+ enum st_attachment_type statt);
+
+void
+dri1_allocate_textures(struct dri_drawable *drawable,
+ unsigned mask);
+
+void dri1_swap_buffers(__DRIdrawable * dPriv);
+
+void
+dri1_copy_sub_buffer(__DRIdrawable * dPriv, int x, int y, int w, int h);
+
+#endif /* DRI1_H */
diff --git a/src/gallium/state_trackers/dri/drm/dri1_helper.c b/src/gallium/state_trackers/dri/drm/dri1_helper.c
new file mode 120000
index 0000000000..c45ebf5c10
--- /dev/null
+++ b/src/gallium/state_trackers/dri/drm/dri1_helper.c
@@ -0,0 +1 @@
+../common/dri1_helper.c \ No newline at end of file
diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c
new file mode 100644
index 0000000000..c632f0fe4f
--- /dev/null
+++ b/src/gallium/state_trackers/dri/drm/dri2.c
@@ -0,0 +1,416 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.9
+ *
+ * Copyright 2009, VMware, Inc.
+ * All Rights Reserved.
+ * Copyright (C) 2010 LunarG Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Keith Whitwell <keithw@vmware.com>
+ * Jakob Bornecrantz <wallbraker@gmail.com>
+ * Chia-I Wu <olv@lunarg.com>
+ */
+
+#include "util/u_memory.h"
+#include "util/u_inlines.h"
+#include "util/u_format.h"
+#include "util/u_debug.h"
+#include "state_tracker/drm_api.h"
+
+#include "dri_screen.h"
+#include "dri_context.h"
+#include "dri_drawable.h"
+#include "dri_st_api.h"
+#include "dri2.h"
+
+/**
+ * DRI2 flush extension.
+ */
+static void
+dri2_flush_drawable(__DRIdrawable *draw)
+{
+}
+
+static void
+dri2_invalidate_drawable(__DRIdrawable *dPriv)
+{
+ struct dri_drawable *drawable = dri_drawable(dPriv);
+ struct dri_context *ctx = dri_context(dPriv->driContextPriv);
+
+ dri2InvalidateDrawable(dPriv);
+ drawable->dPriv->lastStamp = *drawable->dPriv->pStamp;
+
+ if (ctx)
+ ctx->st->notify_invalid_framebuffer(ctx->st, drawable->stfb);
+}
+
+static const __DRI2flushExtension dri2FlushExtension = {
+ { __DRI2_FLUSH, __DRI2_FLUSH_VERSION },
+ dri2_flush_drawable,
+ dri2_invalidate_drawable,
+};
+
+/**
+ * These are used for GLX_EXT_texture_from_pixmap
+ */
+static void
+dri2_set_tex_buffer2(__DRIcontext *pDRICtx, GLint target,
+ GLint format, __DRIdrawable *dPriv)
+{
+ struct dri_context *ctx = dri_context(pDRICtx);
+ struct dri_drawable *drawable = dri_drawable(dPriv);
+ struct pipe_texture *pt;
+
+ dri_st_framebuffer_validate_att(drawable->stfb, ST_ATTACHMENT_FRONT_LEFT);
+
+ pt = drawable->textures[ST_ATTACHMENT_FRONT_LEFT];
+
+ if (pt) {
+ ctx->st->teximage(ctx->st,
+ (target == GL_TEXTURE_2D) ? ST_TEXTURE_2D : ST_TEXTURE_RECT,
+ 0, drawable->stvis.color_format, pt, FALSE);
+ }
+}
+
+static void
+dri2_set_tex_buffer(__DRIcontext *pDRICtx, GLint target,
+ __DRIdrawable *dPriv)
+{
+ dri2_set_tex_buffer2(pDRICtx, target, __DRI_TEXTURE_FORMAT_RGBA, dPriv);
+}
+
+static const __DRItexBufferExtension dri2TexBufferExtension = {
+ { __DRI_TEX_BUFFER, __DRI_TEX_BUFFER_VERSION },
+ dri2_set_tex_buffer,
+ dri2_set_tex_buffer2,
+};
+
+/**
+ * Get the format of an attachment.
+ */
+static INLINE enum pipe_format
+dri2_drawable_get_format(struct dri_drawable *drawable,
+ enum st_attachment_type statt)
+{
+ enum pipe_format format;
+
+ switch (statt) {
+ case ST_ATTACHMENT_FRONT_LEFT:
+ case ST_ATTACHMENT_BACK_LEFT:
+ case ST_ATTACHMENT_FRONT_RIGHT:
+ case ST_ATTACHMENT_BACK_RIGHT:
+ format = drawable->stvis.color_format;
+ break;
+ case ST_ATTACHMENT_DEPTH_STENCIL:
+ format = drawable->stvis.depth_stencil_format;
+ break;
+ default:
+ format = PIPE_FORMAT_NONE;
+ break;
+ }
+
+ return format;
+}
+
+/**
+ * Retrieve __DRIbuffer from the DRI loader.
+ */
+static __DRIbuffer *
+dri2_drawable_get_buffers(struct dri_drawable *drawable,
+ const enum st_attachment_type *statts,
+ unsigned *count)
+{
+ __DRIdrawable *dri_drawable = drawable->dPriv;
+ struct __DRIdri2LoaderExtensionRec *loader = drawable->sPriv->dri2.loader;
+ boolean with_format;
+ __DRIbuffer *buffers;
+ int num_buffers;
+ unsigned attachments[10];
+ unsigned num_attachments, i;
+
+ assert(loader);
+ with_format = dri_with_format(drawable->sPriv);
+
+ num_attachments = 0;
+
+ /* for Xserver 1.6.0 (DRI2 version 1) we always need to ask for the front */
+ if (!with_format)
+ attachments[num_attachments++] = __DRI_BUFFER_FRONT_LEFT;
+
+ for (i = 0; i < *count; i++) {
+ enum pipe_format format;
+ int att, bpp;
+
+ format = dri2_drawable_get_format(drawable, statts[i]);
+ if (format == PIPE_FORMAT_NONE)
+ continue;
+
+ switch (statts[i]) {
+ case ST_ATTACHMENT_FRONT_LEFT:
+ /* already added */
+ if (!with_format)
+ continue;
+ att = __DRI_BUFFER_FRONT_LEFT;
+ break;
+ case ST_ATTACHMENT_BACK_LEFT:
+ att = __DRI_BUFFER_BACK_LEFT;
+ break;
+ case ST_ATTACHMENT_FRONT_RIGHT:
+ att = __DRI_BUFFER_FRONT_RIGHT;
+ break;
+ case ST_ATTACHMENT_BACK_RIGHT:
+ att = __DRI_BUFFER_BACK_RIGHT;
+ break;
+ case ST_ATTACHMENT_DEPTH_STENCIL:
+ att = __DRI_BUFFER_DEPTH_STENCIL;
+ break;
+ default:
+ att = -1;
+ break;
+ }
+
+ bpp = util_format_get_blocksizebits(format);
+
+ if (att >= 0) {
+ attachments[num_attachments++] = att;
+ if (with_format) {
+ attachments[num_attachments++] = bpp;
+ }
+ }
+ }
+
+ if (with_format) {
+ num_attachments /= 2;
+ buffers = loader->getBuffersWithFormat(dri_drawable,
+ &dri_drawable->w, &dri_drawable->h,
+ attachments, num_attachments,
+ &num_buffers, dri_drawable->loaderPrivate);
+ }
+ else {
+ buffers = loader->getBuffers(dri_drawable,
+ &dri_drawable->w, &dri_drawable->h,
+ attachments, num_attachments,
+ &num_buffers, dri_drawable->loaderPrivate);
+ }
+
+ if (buffers) {
+ /* set one cliprect to cover the whole dri_drawable */
+ dri_drawable->x = 0;
+ dri_drawable->y = 0;
+ dri_drawable->backX = 0;
+ dri_drawable->backY = 0;
+ dri_drawable->numClipRects = 1;
+ dri_drawable->pClipRects[0].x1 = 0;
+ dri_drawable->pClipRects[0].y1 = 0;
+ dri_drawable->pClipRects[0].x2 = dri_drawable->w;
+ dri_drawable->pClipRects[0].y2 = dri_drawable->h;
+ dri_drawable->numBackClipRects = 1;
+ dri_drawable->pBackClipRects[0].x1 = 0;
+ dri_drawable->pBackClipRects[0].y1 = 0;
+ dri_drawable->pBackClipRects[0].x2 = dri_drawable->w;
+ dri_drawable->pBackClipRects[0].y2 = dri_drawable->h;
+
+ *count = num_buffers;
+ }
+
+ return buffers;
+}
+
+/**
+ * Process __DRIbuffer and convert them into pipe_textures.
+ */
+static void
+dri2_drawable_process_buffers(struct dri_drawable *drawable,
+ __DRIbuffer *buffers, unsigned count)
+{
+ struct dri_screen *screen = dri_screen(drawable->sPriv);
+ __DRIdrawable *dri_drawable = drawable->dPriv;
+ struct pipe_texture templ;
+ struct winsys_handle whandle;
+ boolean have_depth = FALSE;
+ unsigned i;
+
+ if (drawable->old_num == count &&
+ drawable->old_w == dri_drawable->w &&
+ drawable->old_h == dri_drawable->h &&
+ memcmp(drawable->old, buffers, sizeof(__DRIbuffer) * count) == 0)
+ return;
+
+ for (i = 0; i < ST_ATTACHMENT_COUNT; i++)
+ pipe_texture_reference(&drawable->textures[i], NULL);
+
+ memset(&templ, 0, sizeof(templ));
+ templ.tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET;
+ templ.target = PIPE_TEXTURE_2D;
+ templ.last_level = 0;
+ templ.width0 = dri_drawable->w;
+ templ.height0 = dri_drawable->h;
+ templ.depth0 = 1;
+
+ memset(&whandle, 0, sizeof(whandle));
+
+ for (i = 0; i < count; i++) {
+ __DRIbuffer *buf = &buffers[i];
+ enum st_attachment_type statt;
+ enum pipe_format format;
+
+ switch (buf->attachment) {
+ case __DRI_BUFFER_FRONT_LEFT:
+ if (!screen->auto_fake_front) {
+ statt = ST_ATTACHMENT_INVALID;
+ break;
+ }
+ /* fallthrough */
+ case __DRI_BUFFER_FAKE_FRONT_LEFT:
+ statt = ST_ATTACHMENT_FRONT_LEFT;
+ break;
+ case __DRI_BUFFER_BACK_LEFT:
+ statt = ST_ATTACHMENT_BACK_LEFT;
+ break;
+ case __DRI_BUFFER_DEPTH:
+ case __DRI_BUFFER_DEPTH_STENCIL:
+ case __DRI_BUFFER_STENCIL:
+ /* use only the first depth/stencil buffer */
+ if (!have_depth) {
+ have_depth = TRUE;
+ statt = ST_ATTACHMENT_DEPTH_STENCIL;
+ }
+ else {
+ statt = ST_ATTACHMENT_INVALID;
+ }
+ break;
+ default:
+ statt = ST_ATTACHMENT_INVALID;
+ break;
+ }
+
+ format = dri2_drawable_get_format(drawable, statt);
+ if (statt == ST_ATTACHMENT_INVALID || format == PIPE_FORMAT_NONE)
+ continue;
+
+ templ.format = format;
+ whandle.handle = buf->name;
+ whandle.stride = buf->pitch;
+
+ drawable->textures[statt] =
+ screen->pipe_screen->texture_from_handle(screen->pipe_screen,
+ &templ, &whandle);
+ }
+
+ drawable->old_num = count;
+ drawable->old_w = dri_drawable->w;
+ drawable->old_h = dri_drawable->h;
+ memcpy(drawable->old, buffers, sizeof(__DRIbuffer) * count);
+}
+
+/*
+ * Backend functions for st_framebuffer interface.
+ */
+
+void
+dri2_allocate_textures(struct dri_drawable *drawable,
+ const enum st_attachment_type *statts,
+ unsigned count)
+{
+ __DRIbuffer *buffers;
+ unsigned num_buffers = count;
+
+ buffers = dri2_drawable_get_buffers(drawable, statts, &num_buffers);
+ dri2_drawable_process_buffers(drawable, buffers, num_buffers);
+}
+
+void
+dri2_flush_frontbuffer(struct dri_drawable *drawable,
+ enum st_attachment_type statt)
+{
+ __DRIdrawable *dri_drawable = drawable->dPriv;
+ struct __DRIdri2LoaderExtensionRec *loader = drawable->sPriv->dri2.loader;
+
+ if (loader->flushFrontBuffer == NULL)
+ return;
+
+ if (statt == ST_ATTACHMENT_FRONT_LEFT) {
+ loader->flushFrontBuffer(dri_drawable, dri_drawable->loaderPrivate);
+ }
+}
+
+/*
+ * Backend function init_screen.
+ */
+
+static const __DRIextension *dri_screen_extensions[] = {
+ &driReadDrawableExtension,
+ &driCopySubBufferExtension.base,
+ &driSwapControlExtension.base,
+ &driFrameTrackingExtension.base,
+ &driMediaStreamCounterExtension.base,
+ &dri2TexBufferExtension.base,
+ &dri2FlushExtension.base,
+ NULL
+};
+
+/**
+ * This is the driver specific part of the createNewScreen entry point.
+ *
+ * Returns the __GLcontextModes supported by this driver.
+ */
+const __DRIconfig **
+dri2_init_screen(__DRIscreen * sPriv)
+{
+ const __DRIconfig **configs;
+ struct dri_screen *screen;
+ struct drm_create_screen_arg arg;
+
+ screen = CALLOC_STRUCT(dri_screen);
+ if (!screen)
+ return NULL;
+
+ screen->api = drm_api_create();
+ screen->sPriv = sPriv;
+ screen->fd = sPriv->fd;
+
+ sPriv->private = (void *)screen;
+ sPriv->extensions = dri_screen_extensions;
+
+ arg.mode = DRM_CREATE_NORMAL;
+
+ configs = dri_init_screen_helper(screen, &arg, 32);
+ if (!configs)
+ goto fail;
+
+ screen->auto_fake_front = dri_with_format(sPriv);
+
+ return configs;
+fail:
+ dri_destroy_screen_helper(screen);
+ FREE(screen);
+ return NULL;
+}
+
+/* This is the table of extensions that the loader will dlsym() for. */
+PUBLIC const __DRIextension *__driDriverExtensions[] = {
+ &driCoreExtension.base,
+ &driLegacyExtension.base,
+ &driDRI2Extension.base,
+ NULL
+};
+
+/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri/drm/dri2.h b/src/gallium/state_trackers/dri/drm/dri2.h
new file mode 100644
index 0000000000..379963431f
--- /dev/null
+++ b/src/gallium/state_trackers/dri/drm/dri2.h
@@ -0,0 +1,46 @@
+/**************************************************************************
+ *
+ * Copyright 2009, VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef DRI2_H
+#define DRI2_H
+
+#include "dri_drawable.h"
+#include "dri_wrapper.h"
+
+const __DRIconfig **
+dri2_init_screen(__DRIscreen * sPriv);
+
+void
+dri2_flush_frontbuffer(struct dri_drawable *drawable,
+ enum st_attachment_type statt);
+
+void
+dri2_allocate_textures(struct dri_drawable *drawable,
+ const enum st_attachment_type *statts,
+ unsigned count);
+
+#endif /* DRI2_H */
diff --git a/src/gallium/state_trackers/dri/drm/dri_context.c b/src/gallium/state_trackers/dri/drm/dri_context.c
new file mode 120000
index 0000000000..5cfbbaeb06
--- /dev/null
+++ b/src/gallium/state_trackers/dri/drm/dri_context.c
@@ -0,0 +1 @@
+../common/dri_context.c \ No newline at end of file
diff --git a/src/gallium/state_trackers/dri/drm/dri_drawable.c b/src/gallium/state_trackers/dri/drm/dri_drawable.c
new file mode 120000
index 0000000000..0fc19be6ea
--- /dev/null
+++ b/src/gallium/state_trackers/dri/drm/dri_drawable.c
@@ -0,0 +1 @@
+../common/dri_drawable.c \ No newline at end of file
diff --git a/src/gallium/state_trackers/dri/drm/dri_screen.c b/src/gallium/state_trackers/dri/drm/dri_screen.c
new file mode 120000
index 0000000000..847f6515f2
--- /dev/null
+++ b/src/gallium/state_trackers/dri/drm/dri_screen.c
@@ -0,0 +1 @@
+../common/dri_screen.c \ No newline at end of file
diff --git a/src/gallium/state_trackers/dri/drm/dri_st_api.c b/src/gallium/state_trackers/dri/drm/dri_st_api.c
new file mode 120000
index 0000000000..a8f6bd06b0
--- /dev/null
+++ b/src/gallium/state_trackers/dri/drm/dri_st_api.c
@@ -0,0 +1 @@
+../common/dri_st_api.c \ No newline at end of file
diff --git a/src/gallium/state_trackers/dri/sw/Makefile b/src/gallium/state_trackers/dri/sw/Makefile
new file mode 100644
index 0000000000..18d7aabd9f
--- /dev/null
+++ b/src/gallium/state_trackers/dri/sw/Makefile
@@ -0,0 +1,26 @@
+TOP = ../../../../..
+include $(TOP)/configs/current
+
+LIBNAME = drisw
+
+LIBRARY_DEFINES = -D__NOT_HAVE_DRM_H
+
+LIBRARY_INCLUDES = \
+ -I../dri \
+ -I$(TOP)/include \
+ -I$(TOP)/src/mesa \
+ -I$(TOP)/src/gallium/state_trackers/dri/common \
+ -I$(TOP)/src/mesa/drivers/dri/common \
+ -I$(TOP)/src/mesa/main \
+ -D__NOT_HAVE_DRM_H
+
+
+C_SOURCES = \
+ dri_context.c \
+ dri_screen.c \
+ dri_drawable.c \
+ dri_st_api.c \
+ dri1_helper.c \
+ drisw.c
+
+include ../../../Makefile.template
diff --git a/src/gallium/state_trackers/dri/sw/SConscript b/src/gallium/state_trackers/dri/sw/SConscript
new file mode 100644
index 0000000000..c97124c831
--- /dev/null
+++ b/src/gallium/state_trackers/dri/sw/SConscript
@@ -0,0 +1,28 @@
+#######################################################################
+# SConscript for dri state_tracker
+
+Import('*')
+
+if env['dri']:
+
+ env = env.Clone()
+
+ env.Append(CPPPATH = [
+ '#/src/mesa',
+ '#/src/gallium/state_trackers/dri/common',
+ '#/src/mesa/drivers/dri/common',
+ ])
+
+ env.Append(CPPDEFINES = [('__NOT_HAVE_DRM_H', '1')])
+
+ st_drisw = env.ConvenienceLibrary(
+ target = 'st_drisw',
+ source = [ 'dri_context.c',
+ 'dri_drawable.c',
+ 'dri_screen.c',
+ 'dri_st_api.c',
+ 'dri1_helper.c',
+ 'drisw.c',
+ ]
+ )
+ Export('st_drisw')
diff --git a/src/gallium/state_trackers/dri/sw/dri1_helper.c b/src/gallium/state_trackers/dri/sw/dri1_helper.c
new file mode 120000
index 0000000000..c45ebf5c10
--- /dev/null
+++ b/src/gallium/state_trackers/dri/sw/dri1_helper.c
@@ -0,0 +1 @@
+../common/dri1_helper.c \ No newline at end of file
diff --git a/src/gallium/state_trackers/dri/sw/dri_context.c b/src/gallium/state_trackers/dri/sw/dri_context.c
new file mode 120000
index 0000000000..5cfbbaeb06
--- /dev/null
+++ b/src/gallium/state_trackers/dri/sw/dri_context.c
@@ -0,0 +1 @@
+../common/dri_context.c \ No newline at end of file
diff --git a/src/gallium/state_trackers/dri/sw/dri_drawable.c b/src/gallium/state_trackers/dri/sw/dri_drawable.c
new file mode 120000
index 0000000000..0fc19be6ea
--- /dev/null
+++ b/src/gallium/state_trackers/dri/sw/dri_drawable.c
@@ -0,0 +1 @@
+../common/dri_drawable.c \ No newline at end of file
diff --git a/src/gallium/state_trackers/dri/sw/dri_screen.c b/src/gallium/state_trackers/dri/sw/dri_screen.c
new file mode 120000
index 0000000000..847f6515f2
--- /dev/null
+++ b/src/gallium/state_trackers/dri/sw/dri_screen.c
@@ -0,0 +1 @@
+../common/dri_screen.c \ No newline at end of file
diff --git a/src/gallium/state_trackers/dri/sw/dri_st_api.c b/src/gallium/state_trackers/dri/sw/dri_st_api.c
new file mode 120000
index 0000000000..a8f6bd06b0
--- /dev/null
+++ b/src/gallium/state_trackers/dri/sw/dri_st_api.c
@@ -0,0 +1 @@
+../common/dri_st_api.c \ No newline at end of file
diff --git a/src/gallium/state_trackers/dri/sw/drisw.c b/src/gallium/state_trackers/dri/sw/drisw.c
new file mode 100644
index 0000000000..42fa789aaf
--- /dev/null
+++ b/src/gallium/state_trackers/dri/sw/drisw.c
@@ -0,0 +1,298 @@
+/**************************************************************************
+ *
+ * Copyright 2009, VMware, Inc.
+ * All Rights Reserved.
+ * Copyright 2010 George Sapountzis <gsapountzis@gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+/* TODO:
+ *
+ * xshm / texture_from_pixmap / EGLImage:
+ *
+ * Allow the loaders to use the XSHM extension. It probably requires callbacks
+ * for createImage/destroyImage similar to DRI2 getBuffers.
+ */
+
+#include "util/u_format.h"
+#include "util/u_memory.h"
+#include "util/u_inlines.h"
+#include "pipe/p_context.h"
+#include "state_tracker/drisw_api.h"
+
+#include "dri_screen.h"
+#include "dri_context.h"
+#include "dri_drawable.h"
+#include "dri1_helper.h"
+#include "drisw.h"
+
+
+static INLINE void
+get_drawable_info(__DRIdrawable *dPriv, int *w, int *h)
+{
+ __DRIscreen *sPriv = dPriv->driScreenPriv;
+ const __DRIswrastLoaderExtension *loader = sPriv->swrast_loader;
+ int x, y;
+
+ loader->getDrawableInfo(dPriv,
+ &x, &y, w, h,
+ dPriv->loaderPrivate);
+}
+
+static INLINE void
+put_image(__DRIdrawable *dPriv, void *data, unsigned width, unsigned height)
+{
+ __DRIscreen *sPriv = dPriv->driScreenPriv;
+ const __DRIswrastLoaderExtension *loader = sPriv->swrast_loader;
+
+ loader->putImage(dPriv, __DRI_SWRAST_IMAGE_OP_SWAP,
+ 0, 0, width, height,
+ data, dPriv->loaderPrivate);
+}
+
+void
+drisw_update_drawable_info(struct dri_drawable *drawable)
+{
+ __DRIdrawable *dPriv = drawable->dPriv;
+
+ get_drawable_info(dPriv, &dPriv->w, &dPriv->h);
+}
+
+static void
+drisw_put_image(struct dri_drawable *drawable,
+ void *data, unsigned width, unsigned height)
+{
+ __DRIdrawable *dPriv = drawable->dPriv;
+
+ put_image(dPriv, data, width, height);
+}
+
+static INLINE void
+drisw_present_texture(__DRIdrawable *dPriv,
+ struct pipe_texture *ptex)
+{
+ struct dri_drawable *drawable = dri_drawable(dPriv);
+ struct dri_screen *screen = dri_screen(drawable->sPriv);
+ struct pipe_surface *psurf;
+
+ psurf = dri1_get_pipe_surface(drawable, ptex);
+ if (!psurf)
+ return;
+
+ screen->pipe_screen->flush_frontbuffer(screen->pipe_screen, psurf, drawable);
+}
+
+static INLINE void
+drisw_invalidate_drawable(__DRIdrawable *dPriv)
+{
+ struct dri_context *ctx = dri_get_current();
+ struct dri_drawable *drawable = dri_drawable(dPriv);
+
+ drawable->texture_stamp = dPriv->lastStamp - 1;
+
+ /* check if swapping currently bound buffer */
+ if (ctx && ctx->dPriv == dPriv)
+ ctx->st->notify_invalid_framebuffer(ctx->st, drawable->stfb);
+}
+
+static INLINE void
+drisw_copy_to_front(__DRIdrawable * dPriv,
+ struct pipe_texture *ptex)
+{
+ drisw_present_texture(dPriv, ptex);
+
+ drisw_invalidate_drawable(dPriv);
+}
+
+/*
+ * Backend functions for st_framebuffer interface and swap_buffers.
+ */
+
+void
+drisw_swap_buffers(__DRIdrawable *dPriv)
+{
+ struct dri_context *ctx = dri_get_current();
+ struct dri_drawable *drawable = dri_drawable(dPriv);
+ struct pipe_texture *ptex;
+
+ if (!ctx)
+ return;
+
+ ptex = drawable->textures[ST_ATTACHMENT_BACK_LEFT];
+
+ if (ptex) {
+ ctx->st->flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
+
+ drisw_copy_to_front(dPriv, ptex);
+ }
+}
+
+void
+drisw_flush_frontbuffer(struct dri_drawable *drawable,
+ enum st_attachment_type statt)
+{
+ struct dri_context *ctx = dri_get_current();
+ struct pipe_texture *ptex;
+
+ if (!ctx)
+ return;
+
+ ptex = drawable->textures[statt];
+
+ if (ptex) {
+ drisw_copy_to_front(ctx->dPriv, ptex);
+ }
+}
+
+/**
+ * Allocate framebuffer attachments.
+ *
+ * During fixed-size operation, the function keeps allocating new attachments
+ * as they are requested. Unused attachments are not removed, not until the
+ * framebuffer is resized or destroyed.
+ *
+ * It should be possible for DRI1 and DRISW to share this function, but it
+ * seems a better seperation and safer for each DRI version to provide its own
+ * function.
+ */
+void
+drisw_allocate_textures(struct dri_drawable *drawable,
+ unsigned mask)
+{
+ struct dri_screen *screen = dri_screen(drawable->sPriv);
+ struct pipe_texture templ;
+ unsigned width, height;
+ boolean resized;
+ int i;
+
+ width = drawable->dPriv->w;
+ height = drawable->dPriv->h;
+
+ resized = (drawable->old_w != width ||
+ drawable->old_h != height);
+
+ /* remove outdated textures */
+ if (resized) {
+ for (i = 0; i < ST_ATTACHMENT_COUNT; i++)
+ pipe_texture_reference(&drawable->textures[i], NULL);
+ }
+
+ memset(&templ, 0, sizeof(templ));
+ templ.target = PIPE_TEXTURE_2D;
+ templ.width0 = width;
+ templ.height0 = height;
+ templ.depth0 = 1;
+ templ.last_level = 0;
+
+ for (i = 0; i < ST_ATTACHMENT_COUNT; i++) {
+ enum pipe_format format;
+ unsigned tex_usage;
+
+ /* the texture already exists or not requested */
+ if (drawable->textures[i] || !(mask & (1 << i))) {
+ continue;
+ }
+
+ switch (i) {
+ case ST_ATTACHMENT_FRONT_LEFT:
+ case ST_ATTACHMENT_BACK_LEFT:
+ case ST_ATTACHMENT_FRONT_RIGHT:
+ case ST_ATTACHMENT_BACK_RIGHT:
+ format = drawable->stvis.color_format;
+ tex_usage = PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
+ PIPE_TEXTURE_USAGE_RENDER_TARGET;
+ break;
+ case ST_ATTACHMENT_DEPTH_STENCIL:
+ format = drawable->stvis.depth_stencil_format;
+ tex_usage = PIPE_TEXTURE_USAGE_DEPTH_STENCIL;
+ break;
+ default:
+ format = PIPE_FORMAT_NONE;
+ break;
+ }
+
+ if (format != PIPE_FORMAT_NONE) {
+ templ.format = format;
+ templ.tex_usage = tex_usage;
+
+ drawable->textures[i] =
+ screen->pipe_screen->texture_create(screen->pipe_screen, &templ);
+ }
+ }
+
+ drawable->old_w = width;
+ drawable->old_h = height;
+}
+
+/*
+ * Backend function for init_screen.
+ */
+
+static const __DRIextension *drisw_screen_extensions[] = {
+ NULL
+};
+
+static struct drisw_loader_funcs drisw_lf = {
+ .put_image = drisw_put_image
+};
+
+const __DRIconfig **
+drisw_init_screen(__DRIscreen * sPriv)
+{
+ const __DRIconfig **configs;
+ struct dri_screen *screen;
+ struct drisw_create_screen_arg arg;
+
+ screen = CALLOC_STRUCT(dri_screen);
+ if (!screen)
+ return NULL;
+
+ screen->api = drm_api_create();
+ screen->sPriv = sPriv;
+ screen->fd = -1;
+
+ sPriv->private = (void *)screen;
+ sPriv->extensions = drisw_screen_extensions;
+
+ arg.base.mode = DRM_CREATE_DRISW;
+ arg.lf = &drisw_lf;
+
+ configs = dri_init_screen_helper(screen, &arg.base, 32);
+ if (!configs)
+ goto fail;
+
+ return configs;
+fail:
+ dri_destroy_screen_helper(screen);
+ FREE(screen);
+ return NULL;
+}
+
+/* This is the table of extensions that the loader will dlsym() for. */
+PUBLIC const __DRIextension *__driDriverExtensions[] = {
+ &driCoreExtension.base,
+ &driSWRastExtension.base,
+ NULL
+};
+
+/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri/sw/drisw.h b/src/gallium/state_trackers/dri/sw/drisw.h
new file mode 100644
index 0000000000..c0c874f732
--- /dev/null
+++ b/src/gallium/state_trackers/dri/sw/drisw.h
@@ -0,0 +1,54 @@
+/**************************************************************************
+ *
+ * Copyright 2009, VMware, Inc.
+ * All Rights Reserved.
+ * Copyright 2010 George Sapountzis <gsapountzis@gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef DRISW_H
+#define DRISW_H
+
+#include "dri_context.h"
+#include "dri_drawable.h"
+
+#include "state_tracker/st_api.h"
+#include "dri_wrapper.h"
+
+const __DRIconfig **
+drisw_init_screen(__DRIscreen * sPriv);
+
+void
+drisw_update_drawable_info(struct dri_drawable *drawable);
+
+void
+drisw_flush_frontbuffer(struct dri_drawable *drawable,
+ enum st_attachment_type statt);
+
+void
+drisw_allocate_textures(struct dri_drawable *drawable,
+ unsigned mask);
+
+void drisw_swap_buffers(__DRIdrawable * dPriv);
+
+#endif /* DRISW_H */
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c
index 50774b03f3..5eabe10558 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d.c
@@ -36,234 +36,27 @@
#include "native.h"
#include "egl_g3d.h"
+#include "egl_g3d_st.h"
#include "egl_g3d_image.h"
-#include "egl_st.h"
-
-/**
- * Validate the draw/read surfaces of the context.
- */
-static void
-egl_g3d_validate_context(_EGLDisplay *dpy, _EGLContext *ctx)
-{
- struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
- struct pipe_screen *screen = gdpy->native->screen;
- struct egl_g3d_context *gctx = egl_g3d_context(ctx);
- const uint st_att_map[NUM_NATIVE_ATTACHMENTS] = {
- ST_SURFACE_FRONT_LEFT,
- ST_SURFACE_BACK_LEFT,
- ST_SURFACE_FRONT_RIGHT,
- ST_SURFACE_BACK_RIGHT,
- };
- EGLint num_surfaces, s;
-
- /* validate draw and/or read buffers */
- num_surfaces = (gctx->base.ReadSurface == gctx->base.DrawSurface) ? 1 : 2;
- for (s = 0; s < num_surfaces; s++) {
- struct pipe_texture *textures[NUM_NATIVE_ATTACHMENTS];
- struct egl_g3d_surface *gsurf;
- struct egl_g3d_buffer *gbuf;
- EGLint att;
-
- if (s == 0) {
- gsurf = egl_g3d_surface(gctx->base.DrawSurface);
- gbuf = &gctx->draw;
- }
- else {
- gsurf = egl_g3d_surface(gctx->base.ReadSurface);
- gbuf = &gctx->read;
- }
-
- if (!gctx->force_validate) {
- unsigned int seq_num;
-
- gsurf->native->validate(gsurf->native, gbuf->attachment_mask,
- &seq_num, NULL, NULL, NULL);
- /* skip validation */
- if (gsurf->sequence_number == seq_num)
- continue;
- }
-
- pipe_surface_reference(&gsurf->render_surface, NULL);
- memset(textures, 0, sizeof(textures));
-
- gsurf->native->validate(gsurf->native, gbuf->attachment_mask,
- &gsurf->sequence_number, textures,
- &gsurf->base.Width, &gsurf->base.Height);
- for (att = 0; att < NUM_NATIVE_ATTACHMENTS; att++) {
- struct pipe_texture *pt = textures[att];
- struct pipe_surface *ps;
-
- if (native_attachment_mask_test(gbuf->attachment_mask, att) && pt) {
- ps = screen->get_tex_surface(screen, pt, 0, 0, 0,
- PIPE_BUFFER_USAGE_GPU_READ |
- PIPE_BUFFER_USAGE_GPU_WRITE);
- gctx->stapi->st_set_framebuffer_surface(gbuf->st_fb,
- st_att_map[att], ps);
-
- if (gsurf->render_att == att)
- pipe_surface_reference(&gsurf->render_surface, ps);
-
- pipe_surface_reference(&ps, NULL);
- pipe_texture_reference(&pt, NULL);
- }
- }
-
- gctx->stapi->st_resize_framebuffer(gbuf->st_fb,
- gsurf->base.Width, gsurf->base.Height);
- }
-
- gctx->force_validate = EGL_FALSE;
-
-}
-
-/**
- * Create a st_framebuffer.
- */
-static struct st_framebuffer *
-create_framebuffer(_EGLContext *ctx, _EGLSurface *surf)
-{
- struct egl_g3d_context *gctx = egl_g3d_context(ctx);
- struct egl_g3d_surface *gsurf = egl_g3d_surface(surf);
- struct egl_g3d_config *gconf = egl_g3d_config(gsurf->base.Config);
-
- return gctx->stapi->st_create_framebuffer(&gconf->native->mode,
- gconf->native->color_format, gconf->native->depth_format,
- gconf->native->stencil_format,
- gsurf->base.Width, gsurf->base.Height, &gsurf->base);
-}
-
-/**
- * Update the attachments of draw/read surfaces.
- */
-static void
-egl_g3d_route_context(_EGLDisplay *dpy, _EGLContext *ctx)
-{
- struct egl_g3d_context *gctx = egl_g3d_context(ctx);
- EGLint s;
-
- /* route draw and read buffers' attachments */
- for (s = 0; s < 2; s++) {
- struct egl_g3d_surface *gsurf;
- struct egl_g3d_buffer *gbuf;
-
- if (s == 0) {
- gsurf = egl_g3d_surface(gctx->base.DrawSurface);
- gbuf = &gctx->draw;
- }
- else {
- gsurf = egl_g3d_surface(gctx->base.ReadSurface);
- gbuf = &gctx->read;
- }
-
- gbuf->attachment_mask = (1 << gsurf->render_att);
-
- /* FIXME OpenGL defaults to draw the front or back buffer when the
- * context is single-buffered or double-buffered respectively. In EGL,
- * however, the buffer to be drawn is determined by the surface, instead
- * of the context. As a result, rendering to a pixmap surface with a
- * double-buffered context does not work as expected.
- *
- * gctx->stapi->st_draw_front_buffer(gctx->st_ctx, natt ==
- * NATIVE_ATTACHMENT_FRONT_LEFT);
- */
-
- /*
- * FIXME If the back buffer is asked for here, and the front buffer is
- * later needed by the client API (e.g. glDrawBuffer is called to draw
- * the front buffer), it will create a new pipe texture and draw there.
- * One fix is to ask for both buffers here, but it would be a waste if
- * the front buffer is never used. A better fix is to add a callback to
- * the pipe screen with context private (just like flush_frontbuffer).
- */
- }
-}
-
-/**
- * Reallocate the context's framebuffers after draw/read surfaces change.
- */
-static EGLBoolean
-egl_g3d_realloc_context(_EGLDisplay *dpy, _EGLContext *ctx)
-{
- struct egl_g3d_context *gctx = egl_g3d_context(ctx);
- struct egl_g3d_surface *gdraw = egl_g3d_surface(gctx->base.DrawSurface);
- struct egl_g3d_surface *gread = egl_g3d_surface(gctx->base.ReadSurface);
-
- /* unreference the old framebuffers */
- if (gctx->draw.st_fb) {
- EGLBoolean is_equal = (gctx->draw.st_fb == gctx->read.st_fb);
- void *priv;
-
- priv = gctx->stapi->st_framebuffer_private(gctx->draw.st_fb);
- if (!gdraw || priv != (void *) &gdraw->base) {
- gctx->stapi->st_unreference_framebuffer(gctx->draw.st_fb);
- gctx->draw.st_fb = NULL;
- gctx->draw.attachment_mask = 0x0;
- }
-
- if (is_equal) {
- gctx->read.st_fb = NULL;
- gctx->draw.attachment_mask = 0x0;
- }
- else {
- priv = gctx->stapi->st_framebuffer_private(gctx->read.st_fb);
- if (!gread || priv != (void *) &gread->base) {
- gctx->stapi->st_unreference_framebuffer(gctx->read.st_fb);
- gctx->read.st_fb = NULL;
- gctx->draw.attachment_mask = 0x0;
- }
- }
- }
-
- if (!gdraw)
- return EGL_TRUE;
-
- /* create the draw fb */
- if (!gctx->draw.st_fb) {
- gctx->draw.st_fb = create_framebuffer(&gctx->base, &gdraw->base);
- if (!gctx->draw.st_fb)
- return EGL_FALSE;
- }
-
- /* create the read fb */
- if (!gctx->read.st_fb) {
- if (gread != gdraw) {
- gctx->read.st_fb = create_framebuffer(&gctx->base, &gread->base);
- if (!gctx->read.st_fb) {
- gctx->stapi->st_unreference_framebuffer(gctx->draw.st_fb);
- gctx->draw.st_fb = NULL;
- return EGL_FALSE;
- }
- }
- else {
- /* there is no st_reference_framebuffer... */
- gctx->read.st_fb = gctx->draw.st_fb;
- }
- }
-
- egl_g3d_route_context(dpy, &gctx->base);
- gctx->force_validate = EGL_TRUE;
-
- return EGL_TRUE;
-}
/**
* Return the state tracker for the given context.
*/
-static const struct egl_g3d_st *
+static struct st_api *
egl_g3d_choose_st(_EGLDriver *drv, _EGLContext *ctx)
{
struct egl_g3d_driver *gdrv = egl_g3d_driver(drv);
- const struct egl_g3d_st *stapi;
+ struct st_api *stapi;
EGLint idx = -1;
switch (ctx->ClientAPI) {
case EGL_OPENGL_ES_API:
switch (ctx->ClientVersion) {
case 1:
- idx = EGL_G3D_ST_OPENGL_ES;
+ idx = ST_API_OPENGL_ES1;
break;
case 2:
- idx = EGL_G3D_ST_OPENGL_ES2;
+ idx = ST_API_OPENGL_ES2;
break;
default:
_eglLog(_EGL_WARNING, "unknown client version %d",
@@ -272,10 +65,10 @@ egl_g3d_choose_st(_EGLDriver *drv, _EGLContext *ctx)
}
break;
case EGL_OPENVG_API:
- idx = EGL_G3D_ST_OPENVG;
+ idx = ST_API_OPENVG;
break;
case EGL_OPENGL_API:
- idx = EGL_G3D_ST_OPENGL;
+ idx = ST_API_OPENGL;
break;
default:
_eglLog(_EGL_WARNING, "unknown client API 0x%04x", ctx->ClientAPI);
@@ -299,10 +92,10 @@ egl_g3d_init_st(_EGLDriver *drv)
if (gdrv->api_mask)
return;
- for (i = 0; i < NUM_EGL_G3D_STS; i++) {
- gdrv->stapis[i] = egl_g3d_get_st(i);
+ for (i = 0; i < ST_API_COUNT; i++) {
+ gdrv->stapis[i] = egl_g3d_create_st_api(i);
if (gdrv->stapis[i])
- gdrv->api_mask |= gdrv->stapis[i]->api_bit;
+ gdrv->api_mask |= egl_g3d_st_api_bit(i);
}
if (gdrv->api_mask)
@@ -351,35 +144,6 @@ egl_g3d_destroy_probe(_EGLDriver *drv, _EGLDisplay *dpy)
}
}
-/**
- * Return an API mask that consists of the state trackers that supports the
- * given mode.
- *
- * FIXME add st_is_mode_supported()?
- */
-static EGLint
-get_mode_api_mask(const __GLcontextModes *mode, EGLint api_mask)
-{
- EGLint check;
-
- /* OpenGL ES 1.x and 2.x are checked together */
- check = EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT;
- if (api_mask & check) {
- /* this is required by EGL, not by OpenGL ES */
- if (mode->drawableType & GLX_WINDOW_BIT && !mode->doubleBufferMode)
- api_mask &= ~check;
- }
-
- check = EGL_OPENVG_BIT;
- if (api_mask & check) {
- /* vega st needs the depth/stencil rb */
- if (!mode->depthBits && !mode->stencilBits)
- api_mask &= ~check;
- }
-
- return api_mask;
-}
-
#ifdef EGL_MESA_screen_surface
static void
@@ -444,18 +208,88 @@ egl_g3d_add_screens(_EGLDriver *drv, _EGLDisplay *dpy)
#endif /* EGL_MESA_screen_surface */
/**
+ * Initialize an EGL config from the native config.
+ */
+static EGLBoolean
+egl_g3d_init_config(_EGLDriver *drv, _EGLDisplay *dpy,
+ _EGLConfig *conf, const struct native_config *nconf)
+{
+ struct egl_g3d_driver *gdrv = egl_g3d_driver(drv);
+ struct egl_g3d_config *gconf = egl_g3d_config(conf);
+ const __GLcontextModes *mode = &nconf->mode;
+ EGLint buffer_mask, api_mask;
+ EGLBoolean valid;
+ EGLint i;
+
+ buffer_mask = ST_ATTACHMENT_FRONT_LEFT_MASK;
+ if (mode->doubleBufferMode)
+ buffer_mask |= ST_ATTACHMENT_BACK_LEFT_MASK;
+ if (mode->stereoMode) {
+ buffer_mask |= ST_ATTACHMENT_FRONT_RIGHT_MASK;
+ if (mode->doubleBufferMode)
+ buffer_mask |= ST_ATTACHMENT_BACK_RIGHT_MASK;
+ }
+
+ gconf->stvis.buffer_mask = buffer_mask;
+ gconf->stvis.color_format = nconf->color_format;
+ gconf->stvis.depth_stencil_format = nconf->depth_format;
+ gconf->stvis.accum_format = PIPE_FORMAT_NONE;
+ gconf->stvis.samples = 0;
+
+ gconf->stvis.render_buffer = (buffer_mask & ST_ATTACHMENT_BACK_LEFT) ?
+ ST_ATTACHMENT_BACK_LEFT : ST_ATTACHMENT_FRONT_LEFT;
+
+ api_mask = 0;
+ for (i = 0; i < ST_API_COUNT; i++) {
+ struct st_api *stapi = gdrv->stapis[i];
+ if (stapi) {
+ if (stapi->is_visual_supported(stapi, &gconf->stvis))
+ api_mask |= egl_g3d_st_api_bit(i);
+ }
+ }
+ /* this is required by EGL, not by OpenGL ES */
+ if ((mode->drawableType & GLX_WINDOW_BIT) && !mode->doubleBufferMode)
+ api_mask &= ~(EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT);
+
+ if (!api_mask) {
+ _eglLog(_EGL_DEBUG, "no state tracker supports config 0x%x",
+ mode->visualID);
+ }
+
+ valid = _eglConfigFromContextModesRec(&gconf->base,
+ mode, api_mask, api_mask);
+ if (valid) {
+#ifdef EGL_MESA_screen_surface
+ /* check if scanout surface bit is set */
+ if (nconf->scanout_bit) {
+ EGLint val = GET_CONFIG_ATTRIB(&gconf->base, EGL_SURFACE_TYPE);
+ val |= EGL_SCREEN_BIT_MESA;
+ SET_CONFIG_ATTRIB(&gconf->base, EGL_SURFACE_TYPE, val);
+ }
+#endif
+ valid = _eglValidateConfig(&gconf->base, EGL_FALSE);
+ }
+ if (!valid) {
+ _eglLog(_EGL_DEBUG, "skip invalid config 0x%x", mode->visualID);
+ return EGL_FALSE;
+ }
+
+ gconf->native = nconf;
+
+ return EGL_TRUE;
+}
+
+/**
* Add configs to display and return the next config ID.
*/
static EGLint
egl_g3d_add_configs(_EGLDriver *drv, _EGLDisplay *dpy, EGLint id)
{
- struct egl_g3d_driver *gdrv = egl_g3d_driver(drv);
struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
const struct native_config **native_configs;
int num_configs, i;
- native_configs = gdpy->native->get_configs(gdpy->native,
- &num_configs);
+ native_configs = gdpy->native->get_configs(gdpy->native, &num_configs);
if (!num_configs) {
if (native_configs)
free(native_configs);
@@ -463,75 +297,25 @@ egl_g3d_add_configs(_EGLDriver *drv, _EGLDisplay *dpy, EGLint id)
}
for (i = 0; i < num_configs; i++) {
- EGLint api_mask;
struct egl_g3d_config *gconf;
- EGLBoolean valid;
gconf = CALLOC_STRUCT(egl_g3d_config);
- if (!gconf)
- continue;
-
- _eglInitConfig(&gconf->base, dpy, id);
-
- api_mask = get_mode_api_mask(&native_configs[i]->mode, gdrv->api_mask);
- if (!api_mask) {
- _eglLog(_EGL_DEBUG, "no state tracker supports config 0x%x",
- native_configs[i]->mode.visualID);
- }
-
- valid = _eglConfigFromContextModesRec(&gconf->base,
- &native_configs[i]->mode, api_mask, api_mask);
- if (valid) {
-#ifdef EGL_MESA_screen_surface
- /* check if scanout surface bit is set */
- if (native_configs[i]->scanout_bit) {
- EGLint val = GET_CONFIG_ATTRIB(&gconf->base, EGL_SURFACE_TYPE);
- val |= EGL_SCREEN_BIT_MESA;
- SET_CONFIG_ATTRIB(&gconf->base, EGL_SURFACE_TYPE, val);
+ if (gconf) {
+ _eglInitConfig(&gconf->base, dpy, id);
+ if (!egl_g3d_init_config(drv, dpy, &gconf->base, native_configs[i])) {
+ free(gconf);
+ continue;
}
-#endif
- valid = _eglValidateConfig(&gconf->base, EGL_FALSE);
- }
- if (!valid) {
- _eglLog(_EGL_DEBUG, "skip invalid config 0x%x",
- native_configs[i]->mode.visualID);
- free(gconf);
- continue;
- }
- gconf->native = native_configs[i];
- _eglAddConfig(dpy, &gconf->base);
- id++;
+ _eglAddConfig(dpy, &gconf->base);
+ id++;
+ }
}
free(native_configs);
return id;
}
-/**
- * Flush the front buffer of the context's draw surface.
- */
-static void
-egl_g3d_flush_frontbuffer(struct pipe_screen *screen,
- struct pipe_surface *surf, void *context_private)
-{
- struct egl_g3d_context *gctx = egl_g3d_context(context_private);
- struct egl_g3d_surface *gsurf = egl_g3d_surface(gctx->base.DrawSurface);
-
- if (gsurf)
- gsurf->native->flush_frontbuffer(gsurf->native);
-}
-
-/**
- * Re-validate the context.
- */
-static void
-egl_g3d_update_buffer(struct pipe_screen *screen, void *context_private)
-{
- struct egl_g3d_context *gctx = egl_g3d_context(context_private);
- egl_g3d_validate_context(gctx->base.Resource.Display, &gctx->base);
-}
-
static void
egl_g3d_invalid_surface(struct native_display *ndpy,
struct native_surface *nsurf,
@@ -539,11 +323,15 @@ egl_g3d_invalid_surface(struct native_display *ndpy,
{
/* XXX not thread safe? */
struct egl_g3d_surface *gsurf = egl_g3d_surface(nsurf->user_data);
- struct egl_g3d_context *gctx = egl_g3d_context(gsurf->base.CurrentContext);
-
- /* set force_validate to skip an unnecessary check */
+ struct egl_g3d_context *gctx;
+
+ /*
+ * Some functions such as egl_g3d_copy_buffers create a temporary native
+ * surface. There is no gsurf associated with it.
+ */
+ gctx = (gsurf) ? egl_g3d_context(gsurf->base.CurrentContext) : NULL;
if (gctx)
- gctx->force_validate = TRUE;
+ gctx->stctxi->notify_invalid_framebuffer(gctx->stctxi, gsurf->stfbi);
}
static struct native_event_handler egl_g3d_native_event_handler = {
@@ -559,6 +347,9 @@ egl_g3d_terminate(_EGLDriver *drv, _EGLDisplay *dpy)
_eglReleaseDisplayResources(drv, dpy);
_eglCleanupDisplay(dpy);
+ if (gdpy->pipe)
+ gdpy->pipe->destroy(gdpy->pipe);
+
if (dpy->Screens) {
for (i = 0; i < dpy->NumScreens; i++) {
struct egl_g3d_screen *gscr = egl_g3d_screen(dpy->Screens[i]);
@@ -568,6 +359,9 @@ egl_g3d_terminate(_EGLDriver *drv, _EGLDisplay *dpy)
free(dpy->Screens);
}
+ if (gdpy->smapi)
+ egl_g3d_destroy_st_manager(gdpy->smapi);
+
if (gdpy->native)
gdpy->native->destroy(gdpy->native);
@@ -602,12 +396,17 @@ egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy,
}
gdpy->native->user_data = (void *) dpy;
- gdpy->native->screen->flush_frontbuffer = egl_g3d_flush_frontbuffer;
- gdpy->native->screen->update_buffer = egl_g3d_update_buffer;
egl_g3d_init_st(&gdrv->base);
dpy->ClientAPIsMask = gdrv->api_mask;
+ gdpy->smapi = egl_g3d_create_st_manager(dpy);
+ if (!gdpy->smapi) {
+ _eglError(EGL_NOT_INITIALIZED,
+ "eglInitialize(failed to create st manager)");
+ goto fail;
+ }
+
#ifdef EGL_MESA_screen_surface
/* enable MESA_screen_surface before adding (and validating) configs */
if (gdpy->native->modeset) {
@@ -644,7 +443,6 @@ egl_g3d_create_context(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
struct egl_g3d_context *gshare = egl_g3d_context(share);
struct egl_g3d_config *gconf = egl_g3d_config(conf);
struct egl_g3d_context *gctx;
- const __GLcontextModes *mode;
gctx = CALLOC_STRUCT(egl_g3d_context);
if (!gctx) {
@@ -663,24 +461,14 @@ egl_g3d_create_context(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
return NULL;
}
- mode = &gconf->native->mode;
-
- gctx->pipe = gdpy->native->screen->context_create(
- gdpy->native->screen,
- (void *) &gctx->base);
-
- if (!gctx->pipe) {
+ gctx->stctxi = gctx->stapi->create_context(gctx->stapi, gdpy->smapi,
+ &gconf->stvis, (gshare) ? gshare->stctxi : NULL);
+ if (!gctx->stctxi) {
free(gctx);
return NULL;
}
- gctx->st_ctx = gctx->stapi->st_create_context(gctx->pipe, mode,
- (gshare) ? gshare->st_ctx : NULL);
- if (!gctx->st_ctx) {
- gctx->pipe->destroy(gctx->pipe);
- free(gctx);
- return NULL;
- }
+ gctx->stctxi->st_manager_private = (void *) &gctx->base;
return &gctx->base;
}
@@ -697,9 +485,7 @@ destroy_context(_EGLDisplay *dpy, _EGLContext *ctx)
if (!dpy->Initialized)
_eglLog(_EGL_FATAL, "destroy a context with an unitialized display");
- egl_g3d_realloc_context(dpy, &gctx->base);
- /* it will destroy the associated pipe context */
- gctx->stapi->st_destroy_context(gctx->st_ctx);
+ gctx->stctxi->destroy(gctx->stctxi);
free(gctx);
}
@@ -801,14 +587,20 @@ egl_g3d_create_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
return NULL;
}
+ gsurf->stvis = gconf->stvis;
+ if (gsurf->base.RenderBuffer == EGL_SINGLE_BUFFER)
+ gsurf->stvis.render_buffer = ST_ATTACHMENT_FRONT_LEFT;
+
+ gsurf->stfbi = egl_g3d_create_st_framebuffer(&gsurf->base);
+ if (!gsurf->stfbi) {
+ gsurf->native->destroy(gsurf->native);
+ free(gsurf);
+ return NULL;
+ }
+
nsurf->user_data = &gsurf->base;
gsurf->native = nsurf;
- gsurf->render_att = (gsurf->base.RenderBuffer == EGL_SINGLE_BUFFER) ?
- NATIVE_ATTACHMENT_FRONT_LEFT : NATIVE_ATTACHMENT_BACK_LEFT;
- if (!gconf->native->mode.doubleBufferMode)
- gsurf->render_att = NATIVE_ATTACHMENT_FRONT_LEFT;
-
return &gsurf->base;
}
@@ -864,7 +656,8 @@ destroy_surface(_EGLDisplay *dpy, _EGLSurface *surf)
if (!dpy->Initialized)
_eglLog(_EGL_FATAL, "destroy a surface with an unitialized display");
- pipe_surface_reference(&gsurf->render_surface, NULL);
+ pipe_texture_reference(&gsurf->render_texture, NULL);
+ egl_g3d_destroy_st_framebuffer(gsurf->stfbi);
gsurf->native->destroy(gsurf->native);
free(gsurf);
}
@@ -883,6 +676,7 @@ egl_g3d_make_current(_EGLDriver *drv, _EGLDisplay *dpy,
{
struct egl_g3d_context *gctx = egl_g3d_context(ctx);
struct egl_g3d_surface *gdraw = egl_g3d_surface(draw);
+ struct egl_g3d_surface *gread = egl_g3d_surface(read);
struct egl_g3d_context *old_gctx;
EGLBoolean ok = EGL_TRUE;
@@ -893,34 +687,29 @@ egl_g3d_make_current(_EGLDriver *drv, _EGLDisplay *dpy,
if (old_gctx) {
/* flush old context */
- old_gctx->stapi->st_flush(old_gctx->st_ctx,
+ old_gctx->stctxi->flush(old_gctx->stctxi,
PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, NULL);
-
- /*
- * The old context is no longer current, and egl_g3d_realloc_context()
- * should be called to destroy the framebuffers. However, it is possible
- * that it will be made current again with the same draw/read surfaces.
- * It might be better to keep it around.
- */
}
if (gctx) {
- ok = egl_g3d_realloc_context(dpy, &gctx->base);
+ ok = gctx->stapi->make_current(gctx->stapi, gctx->stctxi,
+ (gdraw) ? gdraw->stfbi : NULL, (gread) ? gread->stfbi : NULL);
if (ok) {
- ok = gctx->stapi->st_make_current(gctx->st_ctx,
- gctx->draw.st_fb, gctx->read.st_fb);
- if (ok) {
- egl_g3d_validate_context(dpy, &gctx->base);
- if (gdraw->base.Type == EGL_WINDOW_BIT) {
- gctx->base.WindowRenderBuffer =
- (gdraw->render_att == NATIVE_ATTACHMENT_FRONT_LEFT) ?
- EGL_SINGLE_BUFFER : EGL_BACK_BUFFER;
- }
+ gctx->stctxi->notify_invalid_framebuffer(gctx->stctxi, gdraw->stfbi);
+ if (gread != gdraw) {
+ gctx->stctxi->notify_invalid_framebuffer(gctx->stctxi,
+ gread->stfbi);
+ }
+
+ if (gdraw->base.Type == EGL_WINDOW_BIT) {
+ gctx->base.WindowRenderBuffer =
+ (gdraw->stvis.render_buffer == ST_ATTACHMENT_FRONT_LEFT) ?
+ EGL_SINGLE_BUFFER : EGL_BACK_BUFFER;
}
}
}
else if (old_gctx) {
- ok = old_gctx->stapi->st_make_current(NULL, NULL, NULL);
+ ok = old_gctx->stapi->make_current(old_gctx->stapi, NULL, NULL, NULL);
old_gctx->base.WindowRenderBuffer = EGL_NONE;
}
@@ -947,15 +736,17 @@ egl_g3d_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf)
return EGL_TRUE;
/* or when the surface is single-buffered */
- if (gsurf->render_att == NATIVE_ATTACHMENT_FRONT_LEFT)
+ if (gsurf->stvis.render_buffer == ST_ATTACHMENT_FRONT_LEFT)
return EGL_TRUE;
if (ctx && ctx->DrawSurface == surf)
gctx = egl_g3d_context(ctx);
/* flush if the surface is current */
- if (gctx)
- gctx->stapi->st_notify_swapbuffers(gctx->draw.st_fb);
+ if (gctx) {
+ gctx->stctxi->flush(gctx->stctxi,
+ PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, NULL);
+ }
return gsurf->native->swap_buffers(gsurf->native);
}
@@ -995,7 +786,7 @@ get_pipe_surface(struct native_display *ndpy, struct native_surface *nsurf,
return NULL;
psurf = ndpy->screen->get_tex_surface(ndpy->screen, textures[natt],
- 0, 0, 0, PIPE_BUFFER_USAGE_CPU_WRITE);
+ 0, 0, 0, PIPE_BUFFER_USAGE_GPU_WRITE);
pipe_texture_reference(&textures[natt], NULL);
return psurf;
@@ -1013,7 +804,7 @@ egl_g3d_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
struct pipe_screen *screen = gdpy->native->screen;
struct pipe_surface *psurf;
- if (!gsurf->render_surface)
+ if (!gsurf->render_texture)
return EGL_TRUE;
gconf = egl_g3d_config(egl_g3d_find_pixmap_config(dpy, target));
@@ -1028,26 +819,33 @@ egl_g3d_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
/* flush if the surface is current */
if (ctx && ctx->DrawSurface == &gsurf->base) {
struct egl_g3d_context *gctx = egl_g3d_context(ctx);
- gctx->stapi->st_flush(gctx->st_ctx,
+ gctx->stctxi->flush(gctx->stctxi,
PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, NULL);
}
+ /* create a pipe context to copy surfaces */
+ if (!gdpy->pipe) {
+ gdpy->pipe =
+ gdpy->native->screen->context_create(gdpy->native->screen, NULL);
+ if (!gdpy->pipe)
+ return EGL_FALSE;
+ }
+
psurf = get_pipe_surface(gdpy->native, nsurf, NATIVE_ATTACHMENT_FRONT_LEFT);
if (psurf) {
- struct pipe_context pipe;
+ struct pipe_surface *psrc;
- /**
- * XXX This is hacky. If we might allow the EGLDisplay to create a pipe
- * context of its own and use the blitter context for this.
- */
- memset(&pipe, 0, sizeof(pipe));
- pipe.screen = screen;
+ psrc = screen->get_tex_surface(screen, gsurf->render_texture,
+ 0, 0, 0, PIPE_BUFFER_USAGE_GPU_READ);
+ if (psrc) {
+ gdpy->pipe->surface_copy(gdpy->pipe, psurf, 0, 0,
+ psrc, 0, 0, psurf->width, psurf->height);
+ pipe_surface_reference(&psrc, NULL);
- util_surface_copy(&pipe, FALSE, psurf, 0, 0,
- gsurf->render_surface, 0, 0, psurf->width, psurf->height);
+ nsurf->flush_frontbuffer(nsurf);
+ }
pipe_surface_reference(&psurf, NULL);
- nsurf->flush_frontbuffer(nsurf);
}
nsurf->destroy(nsurf);
@@ -1058,8 +856,16 @@ egl_g3d_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
static EGLBoolean
egl_g3d_wait_client(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx)
{
+ struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
struct egl_g3d_context *gctx = egl_g3d_context(ctx);
- gctx->stapi->st_finish(gctx->st_ctx);
+ struct pipe_screen *screen = gdpy->native->screen;
+ struct pipe_fence_handle *fence = NULL;
+
+ gctx->stctxi->flush(gctx->stctxi,
+ PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, &fence);
+ screen->fence_finish(screen, fence, 0);
+ screen->fence_reference(screen, &fence, NULL);
+
return EGL_TRUE;
}
@@ -1089,10 +895,10 @@ egl_g3d_get_proc_address(_EGLDriver *drv, const char *procname)
/* in case this is called before a display is initialized */
egl_g3d_init_st(&gdrv->base);
- for (i = 0; i < NUM_EGL_G3D_STS; i++) {
- const struct egl_g3d_st *stapi = gdrv->stapis[i];
+ for (i = 0; i < ST_API_COUNT; i++) {
+ struct st_api *stapi = gdrv->stapis[i];
if (stapi) {
- proc = (_EGLProc) stapi->st_get_proc_address(procname);
+ proc = (_EGLProc) stapi->get_proc_address(stapi, procname);
if (proc)
return proc;
}
@@ -1108,8 +914,8 @@ egl_g3d_bind_tex_image(_EGLDriver *drv, _EGLDisplay *dpy,
struct egl_g3d_surface *gsurf = egl_g3d_surface(surf);
_EGLContext *es1 = _eglGetAPIContext(EGL_OPENGL_ES_API);
struct egl_g3d_context *gctx;
- enum pipe_format target_format;
- int target;
+ enum pipe_format internal_format;
+ enum st_texture_type target;
if (!gsurf || gsurf->base.Type != EGL_PBUFFER_BIT)
return _eglError(EGL_BAD_SURFACE, "eglBindTexImage");
@@ -1120,10 +926,10 @@ egl_g3d_bind_tex_image(_EGLDriver *drv, _EGLDisplay *dpy,
switch (gsurf->base.TextureFormat) {
case EGL_TEXTURE_RGB:
- target_format = PIPE_FORMAT_R8G8B8_UNORM;
+ internal_format = PIPE_FORMAT_R8G8B8_UNORM;
break;
case EGL_TEXTURE_RGBA:
- target_format = PIPE_FORMAT_B8G8R8A8_UNORM;
+ internal_format = PIPE_FORMAT_B8G8R8A8_UNORM;
break;
default:
return _eglError(EGL_BAD_MATCH, "eglBindTexImage");
@@ -1139,21 +945,24 @@ egl_g3d_bind_tex_image(_EGLDriver *drv, _EGLDisplay *dpy,
if (!es1)
return EGL_TRUE;
- if (!gsurf->render_surface)
+ if (!gsurf->render_texture)
return EGL_FALSE;
/* flush properly if the surface is bound */
if (gsurf->base.CurrentContext) {
gctx = egl_g3d_context(gsurf->base.CurrentContext);
- gctx->stapi->st_flush(gctx->st_ctx,
+ gctx->stctxi->flush(gctx->stctxi,
PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, NULL);
}
gctx = egl_g3d_context(es1);
- gctx->stapi->st_bind_texture_surface(gsurf->render_surface,
- target, gsurf->base.MipmapLevel, target_format);
-
- gsurf->base.BoundToTexture = EGL_TRUE;
+ if (gctx->stctxi->teximage) {
+ if (!gctx->stctxi->teximage(gctx->stctxi, target,
+ gsurf->base.MipmapLevel, internal_format,
+ gsurf->render_texture, gsurf->base.MipmapTexture))
+ return EGL_FALSE;
+ gsurf->base.BoundToTexture = EGL_TRUE;
+ }
return EGL_TRUE;
}
@@ -1170,14 +979,15 @@ egl_g3d_release_tex_image(_EGLDriver *drv, _EGLDisplay *dpy,
if (buffer != EGL_BACK_BUFFER)
return _eglError(EGL_BAD_PARAMETER, "eglReleaseTexImage");
- if (gsurf->render_surface) {
+ if (gsurf->render_texture) {
_EGLContext *ctx = _eglGetAPIContext(EGL_OPENGL_ES_API);
struct egl_g3d_context *gctx = egl_g3d_context(ctx);
/* what if the context the surface binds to is no longer current? */
- if (gctx)
- gctx->stapi->st_unbind_texture_surface(gsurf->render_surface,
- ST_TEXTURE_2D, gsurf->base.MipmapLevel);
+ if (gctx) {
+ gctx->stctxi->teximage(gctx->stctxi, ST_TEXTURE_2D,
+ gsurf->base.MipmapLevel, PIPE_FORMAT_NONE, NULL, FALSE);
+ }
}
gsurf->base.BoundToTexture = EGL_FALSE;
@@ -1289,6 +1099,12 @@ static void
egl_g3d_unload(_EGLDriver *drv)
{
struct egl_g3d_driver *gdrv = egl_g3d_driver(drv);
+ EGLint i;
+
+ for (i = 0; i < ST_API_COUNT; i++) {
+ if (gdrv->stapis[i])
+ gdrv->stapis[i]->destroy(gdrv->stapis[i]);
+ }
egl_g3d_destroy_probe(drv, NULL);
free(gdrv);
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.h b/src/gallium/state_trackers/egl/common/egl_g3d.h
index e3e55e46d3..2788f1bf4a 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d.h
+++ b/src/gallium/state_trackers/egl/common/egl_g3d.h
@@ -39,11 +39,11 @@
#include "eglmode.h"
#include "native.h"
-#include "egl_st.h"
+#include "egl_g3d_st.h"
struct egl_g3d_driver {
_EGLDriver base;
- const struct egl_g3d_st *stapis[NUM_EGL_G3D_STS];
+ struct st_api *stapis[ST_API_COUNT];
EGLint api_mask;
EGLint probe_key;
@@ -51,35 +51,34 @@ struct egl_g3d_driver {
struct egl_g3d_display {
struct native_display *native;
-};
-struct egl_g3d_buffer {
- struct st_framebuffer *st_fb;
- uint attachment_mask;
+ struct st_manager *smapi;
+ struct pipe_context *pipe;
};
struct egl_g3d_context {
_EGLContext base;
- const struct egl_g3d_st *stapi;
- struct pipe_context *pipe;
+ struct st_api *stapi;
- struct st_context *st_ctx;
- EGLBoolean force_validate;
- struct egl_g3d_buffer draw, read;
+ struct st_context_iface *stctxi;
};
struct egl_g3d_surface {
_EGLSurface base;
+
+ struct st_visual stvis;
+ struct st_framebuffer_iface *stfbi;
+
struct native_surface *native;
- enum native_attachment render_att;
- struct pipe_surface *render_surface;
+ struct pipe_texture *render_texture;
unsigned int sequence_number;
};
struct egl_g3d_config {
_EGLConfig base;
const struct native_config *native;
+ struct st_visual stvis;
};
struct egl_g3d_image {
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_st.c b/src/gallium/state_trackers/egl/common/egl_g3d_st.c
new file mode 100644
index 0000000000..9573ba09d1
--- /dev/null
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_st.c
@@ -0,0 +1,260 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.9
+ *
+ * Copyright (C) 2010 LunarG Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Chia-I Wu <olv@lunarg.com>
+ */
+
+#include "util/u_memory.h"
+#include "util/u_inlines.h"
+#include "util/u_dl.h"
+#include "eglimage.h"
+#include "eglmutex.h"
+
+#include "egl_g3d.h"
+#include "egl_g3d_st.h"
+
+struct egl_g3d_st_manager {
+ struct st_manager base;
+ _EGLDisplay *display;
+};
+
+static INLINE struct egl_g3d_st_manager *
+egl_g3d_st_manager(struct st_manager *smapi)
+{
+ return (struct egl_g3d_st_manager *) smapi;
+}
+
+struct st_api *
+egl_g3d_create_st_api(enum st_api_type api)
+{
+ const char *stmod_name;
+ struct util_dl_library *lib;
+ const struct st_module *mod;
+
+ switch (api) {
+ case ST_API_OPENGL:
+ stmod_name = ST_MODULE_OPENGL_SYMBOL;
+ break;
+ case ST_API_OPENGL_ES1:
+ stmod_name = ST_MODULE_OPENGL_ES1_SYMBOL;
+ break;
+ case ST_API_OPENGL_ES2:
+ stmod_name = ST_MODULE_OPENGL_ES2_SYMBOL;
+ break;
+ case ST_API_OPENVG:
+ stmod_name = ST_MODULE_OPENVG_SYMBOL;
+ break;
+ default:
+ stmod_name = NULL;
+ break;
+ }
+ if (!stmod_name)
+ return NULL;
+
+ mod = NULL;
+ lib = util_dl_open(NULL);
+ if (lib) {
+ mod = (const struct st_module *)
+ util_dl_get_proc_address(lib, stmod_name);
+ util_dl_close(lib);
+ }
+ if (!mod || mod->api != api)
+ return NULL;
+
+ return mod->create_api();
+}
+
+static boolean
+egl_g3d_st_manager_get_egl_image(struct st_manager *smapi,
+ struct st_egl_image *stimg)
+{
+ struct egl_g3d_st_manager *gsmapi = egl_g3d_st_manager(smapi);
+ EGLImageKHR handle = (EGLImageKHR) stimg->egl_image;
+ _EGLImage *img;
+ struct egl_g3d_image *gimg;
+
+ /* this is called from state trackers */
+ _eglLockMutex(&gsmapi->display->Mutex);
+
+ img = _eglLookupImage(handle, gsmapi->display);
+ if (!img) {
+ _eglUnlockMutex(&gsmapi->display->Mutex);
+ return FALSE;
+ }
+
+ gimg = egl_g3d_image(img);
+
+ stimg->texture = NULL;
+ pipe_texture_reference(&stimg->texture, gimg->texture);
+ stimg->face = gimg->face;
+ stimg->level = gimg->level;
+ stimg->zslice = gimg->zslice;
+
+ _eglUnlockMutex(&gsmapi->display->Mutex);
+
+ return TRUE;
+}
+
+struct st_manager *
+egl_g3d_create_st_manager(_EGLDisplay *dpy)
+{
+ struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
+ struct egl_g3d_st_manager *gsmapi;
+
+ gsmapi = CALLOC_STRUCT(egl_g3d_st_manager);
+ if (gsmapi) {
+ gsmapi->display = dpy;
+
+ gsmapi->base.screen = gdpy->native->screen;
+ gsmapi->base.get_egl_image = egl_g3d_st_manager_get_egl_image;
+ }
+
+ return &gsmapi->base;;
+}
+
+void
+egl_g3d_destroy_st_manager(struct st_manager *smapi)
+{
+ struct egl_g3d_st_manager *gsmapi = egl_g3d_st_manager(smapi);
+ free(gsmapi);
+}
+
+static boolean
+egl_g3d_st_framebuffer_flush_front(struct st_framebuffer_iface *stfbi,
+ enum st_attachment_type statt)
+{
+ _EGLSurface *surf = (_EGLSurface *) stfbi->st_manager_private;
+ struct egl_g3d_surface *gsurf = egl_g3d_surface(surf);
+
+ return gsurf->native->flush_frontbuffer(gsurf->native);
+}
+
+static boolean
+egl_g3d_st_framebuffer_validate(struct st_framebuffer_iface *stfbi,
+ const enum st_attachment_type *statts,
+ unsigned count,
+ struct pipe_texture **out)
+{
+ _EGLSurface *surf = (_EGLSurface *) stfbi->st_manager_private;
+ struct egl_g3d_surface *gsurf = egl_g3d_surface(surf);
+ struct pipe_texture *textures[NUM_NATIVE_ATTACHMENTS];
+ uint attachment_mask = 0;
+ unsigned i;
+
+ for (i = 0; i < count; i++) {
+ int natt;
+
+ switch (statts[i]) {
+ case ST_ATTACHMENT_FRONT_LEFT:
+ natt = NATIVE_ATTACHMENT_FRONT_LEFT;
+ break;
+ case ST_ATTACHMENT_BACK_LEFT:
+ natt = NATIVE_ATTACHMENT_BACK_LEFT;
+ break;
+ case ST_ATTACHMENT_FRONT_RIGHT:
+ natt = NATIVE_ATTACHMENT_FRONT_RIGHT;
+ break;
+ case ST_ATTACHMENT_BACK_RIGHT:
+ natt = NATIVE_ATTACHMENT_BACK_RIGHT;
+ break;
+ default:
+ natt = -1;
+ break;
+ }
+
+ if (natt >= 0)
+ attachment_mask |= 1 << natt;
+ }
+
+ if (!gsurf->native->validate(gsurf->native, attachment_mask,
+ &gsurf->sequence_number, textures, &gsurf->base.Width,
+ &gsurf->base.Height))
+ return FALSE;
+
+ for (i = 0; i < count; i++) {
+ struct pipe_texture *tex;
+ int natt;
+
+ switch (statts[i]) {
+ case ST_ATTACHMENT_FRONT_LEFT:
+ natt = NATIVE_ATTACHMENT_FRONT_LEFT;
+ break;
+ case ST_ATTACHMENT_BACK_LEFT:
+ natt = NATIVE_ATTACHMENT_BACK_LEFT;
+ break;
+ case ST_ATTACHMENT_FRONT_RIGHT:
+ natt = NATIVE_ATTACHMENT_FRONT_RIGHT;
+ break;
+ case ST_ATTACHMENT_BACK_RIGHT:
+ natt = NATIVE_ATTACHMENT_BACK_RIGHT;
+ break;
+ default:
+ natt = -1;
+ break;
+ }
+
+ if (natt >= 0) {
+ tex = textures[natt];
+
+ if (statts[i] == stfbi->visual->render_buffer)
+ pipe_texture_reference(&gsurf->render_texture, tex);
+
+ if (attachment_mask & (1 << natt)) {
+ /* transfer the ownership to the caller */
+ out[i] = tex;
+ attachment_mask &= ~(1 << natt);
+ }
+ else {
+ /* the attachment is listed more than once */
+ pipe_texture_reference(&out[i], tex);
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+struct st_framebuffer_iface *
+egl_g3d_create_st_framebuffer(_EGLSurface *surf)
+{
+ struct egl_g3d_surface *gsurf = egl_g3d_surface(surf);
+ struct st_framebuffer_iface *stfbi;
+
+ stfbi = CALLOC_STRUCT(st_framebuffer_iface);
+ if (!stfbi)
+ return NULL;
+
+ stfbi->visual = &gsurf->stvis;
+ stfbi->flush_front = egl_g3d_st_framebuffer_flush_front;
+ stfbi->validate = egl_g3d_st_framebuffer_validate;
+ stfbi->st_manager_private = (void *) &gsurf->base;
+
+ return stfbi;
+}
+
+void
+egl_g3d_destroy_st_framebuffer(struct st_framebuffer_iface *stfbi)
+{
+ free(stfbi);
+}
diff --git a/src/gallium/state_trackers/egl/common/egl_st.h b/src/gallium/state_trackers/egl/common/egl_g3d_st.h
index 8fb464bd3d..ea8b4068cd 100644
--- a/src/gallium/state_trackers/egl/common/egl_st.h
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_st.h
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 7.8
+ * Version: 7.9
*
- * Copyright (C) 2009-2010 Chia-I Wu <olv@0xlab.org>
+ * Copyright (C) 2010 LunarG Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -20,54 +20,60 @@
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Chia-I Wu <olv@lunarg.com>
*/
-#ifndef _EGL_ST_H_
-#define _EGL_ST_H_
-
-#include "GL/gl.h" /* for GL types */
-#include "GL/internal/glcore.h" /* for __GLcontextModes */
+#ifndef _EGL_G3D_ST_H_
+#define _EGL_G3D_ST_H_
#include "pipe/p_compiler.h"
-#include "pipe/p_format.h"
-#include "pipe/p_context.h"
+#include "state_tracker/st_api.h"
+#include "egltypedefs.h"
-/* avoid calling st functions directly */
-#if 1
+struct st_api *
+egl_g3d_create_st_api(enum st_api_type api);
-#define ST_SURFACE_FRONT_LEFT 0
-#define ST_SURFACE_BACK_LEFT 1
-#define ST_SURFACE_FRONT_RIGHT 2
-#define ST_SURFACE_BACK_RIGHT 3
+struct st_manager *
+egl_g3d_create_st_manager(_EGLDisplay *dpy);
-#define ST_TEXTURE_2D 0x2
+void
+egl_g3d_destroy_st_manager(struct st_manager *smapi);
-struct st_context;
-struct st_framebuffer;
-typedef void (*st_proc)();
+struct st_framebuffer_iface *
+egl_g3d_create_st_framebuffer(_EGLSurface *surf);
-#else
-#include "state_tracker/st_public.h"
-#endif
+void
+egl_g3d_destroy_st_framebuffer(struct st_framebuffer_iface *stfbi);
-/* remember to update egl_g3d_get_st() when update the enums */
-enum egl_g3d_st_api {
- EGL_G3D_ST_OPENGL_ES = 0,
- EGL_G3D_ST_OPENVG,
- EGL_G3D_ST_OPENGL_ES2,
- EGL_G3D_ST_OPENGL,
-
- NUM_EGL_G3D_STS
-};
+/**
+ * Return the EGL_<api>_BIT of the st api.
+ */
+static INLINE int
+egl_g3d_st_api_bit(enum st_api_type api)
+{
+ int bit;
-struct egl_g3d_st {
-#define ST_PUBLIC(name, ret, ...) ret (*name)(__VA_ARGS__);
-#include "st_public_tmp.h"
- /* fields must be added here */
- EGLint api_bit;
-};
+ switch (api) {
+ case ST_API_OPENGL:
+ bit = EGL_OPENGL_BIT;
+ break;
+ case ST_API_OPENGL_ES1:
+ bit = EGL_OPENGL_ES_BIT;
+ break;
+ case ST_API_OPENGL_ES2:
+ bit = EGL_OPENGL_ES2_BIT;
+ break;
+ case ST_API_OPENVG:
+ bit = EGL_OPENVG_BIT;
+ break;
+ default:
+ bit = 0;
+ break;
+ }
-const struct egl_g3d_st *
-egl_g3d_get_st(enum egl_g3d_st_api api);
+ return bit;
+}
-#endif /* _EGL_ST_H_ */
+#endif /* _EGL_G3D_ST_H_ */
diff --git a/src/gallium/state_trackers/egl/common/egl_st.c b/src/gallium/state_trackers/egl/common/egl_st.c
deleted file mode 100644
index a88ff911cd..0000000000
--- a/src/gallium/state_trackers/egl/common/egl_st.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.8
- *
- * Copyright (C) 2009-2010 Chia-I Wu <olv@0xlab.org>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include <dlfcn.h>
-#include "pipe/p_compiler.h"
-#include "util/u_memory.h"
-#include "egllog.h"
-#include "EGL/egl.h" /* for EGL_api_BIT */
-
-#include "egl_st.h"
-
-#ifndef HAVE_DLADDR
-#define HAVE_DLADDR 1
-#endif
-
-#if HAVE_DLADDR
-
-static const char *
-egl_g3d_st_names[] = {
-#define ST_PUBLIC(name, ...) #name,
-#include "st_public_tmp.h"
- NULL
-};
-
-static boolean
-egl_g3d_fill_st(struct egl_g3d_st *stapi, void *sym)
-{
- st_proc *procs = (st_proc *) stapi;
- void *handle;
- Dl_info info;
- const char **name;
-
- if (!dladdr(sym, &info))
- return FALSE;
- handle = dlopen(info.dli_fname, RTLD_LAZY | RTLD_LOCAL | RTLD_NODELETE);
- if (!handle)
- return FALSE;
-
- for (name = egl_g3d_st_names; *name; name++) {
- st_proc proc = (st_proc) dlsym(handle, *name);
- if (!proc) {
- _eglLog(_EGL_WARNING, "%s is missing in %s", *name, info.dli_fname);
- memset(stapi, 0, sizeof(*stapi));
- dlclose(handle);
- return FALSE;
- }
- *procs++ = proc;
- }
-
- dlclose(handle);
- return TRUE;
-}
-
-#else /* HAVE_DLADDR */
-
-static boolean
-egl_g3d_fill_st(struct egl_g3d_st *stapi, void *sym)
-{
-#define ST_PUBLIC(name, ...) stapi->name = name;
-#include "st_public_tmp.h"
- return TRUE;
-}
-
-#endif /* HAVE_DLADDR */
-
-static boolean
-egl_g3d_init_st(struct egl_g3d_st *stapi, const char *api)
-{
- void *handle, *sym;
- boolean res = FALSE;
-
- /* already initialized */
- if (stapi->st_notify_swapbuffers != NULL)
- return TRUE;
-
- handle = dlopen(NULL, RTLD_LAZY | RTLD_LOCAL);
- if (!handle)
- return FALSE;
-
- sym = dlsym(handle, api);
- if (sym && egl_g3d_fill_st(stapi, sym))
- res = TRUE;
-
- dlclose(handle);
- return res;
-}
-
-static struct {
- const char *symbol;
- EGLint api_bit;
-} egl_g3d_st_info[NUM_EGL_G3D_STS] = {
- { "st_api_OpenGL_ES1", EGL_OPENGL_ES_BIT },
- { "st_api_OpenVG", EGL_OPENVG_BIT },
- { "st_api_OpenGL_ES2", EGL_OPENGL_ES2_BIT },
- { "st_api_OpenGL", EGL_OPENGL_BIT },
-};
-
-const struct egl_g3d_st *
-egl_g3d_get_st(enum egl_g3d_st_api api)
-{
- static struct egl_g3d_st all_trackers[NUM_EGL_G3D_STS];
-
- if (egl_g3d_init_st(&all_trackers[api], egl_g3d_st_info[api].symbol)) {
- all_trackers[api].api_bit = egl_g3d_st_info[api].api_bit;
- return &all_trackers[api];
- }
- else {
- return NULL;
- }
-}
diff --git a/src/gallium/state_trackers/egl/common/native.h b/src/gallium/state_trackers/egl/common/native.h
index 9c22ff3e43..93c81b26e1 100644
--- a/src/gallium/state_trackers/egl/common/native.h
+++ b/src/gallium/state_trackers/egl/common/native.h
@@ -140,9 +140,6 @@ struct native_config {
struct native_display {
/**
* The pipe screen of the native display.
- *
- * Note that the "flush_frontbuffer" and "update_buffer" callbacks will be
- * overridden.
*/
struct pipe_screen *screen;
diff --git a/src/gallium/state_trackers/egl/common/st_public_tmp.h b/src/gallium/state_trackers/egl/common/st_public_tmp.h
deleted file mode 100644
index 507a0ec402..0000000000
--- a/src/gallium/state_trackers/egl/common/st_public_tmp.h
+++ /dev/null
@@ -1,20 +0,0 @@
-ST_PUBLIC(st_create_context, struct st_context *, struct pipe_context *pipe, const __GLcontextModes *visual, struct st_context *share)
-ST_PUBLIC(st_destroy_context, void, struct st_context *st)
-ST_PUBLIC(st_copy_context_state, void, struct st_context *dst, struct st_context *src, uint mask)
-ST_PUBLIC(st_create_framebuffer, struct st_framebuffer *, const __GLcontextModes *visual, enum pipe_format colorFormat, enum pipe_format depthFormat, enum pipe_format stencilFormat, uint width, uint height, void *privateData)
-ST_PUBLIC(st_resize_framebuffer, void, struct st_framebuffer *stfb, uint width, uint height)
-ST_PUBLIC(st_set_framebuffer_surface, void, struct st_framebuffer *stfb, uint surfIndex, struct pipe_surface *surf)
-ST_PUBLIC(st_get_framebuffer_dimensions, void, struct st_framebuffer *stfb, uint *width, uint *height)
-ST_PUBLIC(st_get_framebuffer_surface, int, struct st_framebuffer *stfb, uint surfIndex, struct pipe_surface **surface)
-ST_PUBLIC(st_get_framebuffer_texture, int, struct st_framebuffer *stfb, uint surfIndex, struct pipe_texture **texture)
-ST_PUBLIC(st_framebuffer_private, void *, struct st_framebuffer *stfb)
-ST_PUBLIC(st_unreference_framebuffer, void, struct st_framebuffer *stfb)
-ST_PUBLIC(st_make_current, GLboolean, struct st_context *st, struct st_framebuffer *draw, struct st_framebuffer *read)
-ST_PUBLIC(st_get_current, struct st_context *, void)
-ST_PUBLIC(st_flush, void, struct st_context *st, uint pipeFlushFlags, struct pipe_fence_handle **fence)
-ST_PUBLIC(st_finish, void, struct st_context *st)
-ST_PUBLIC(st_notify_swapbuffers, void, struct st_framebuffer *stfb)
-ST_PUBLIC(st_bind_texture_surface, int, struct pipe_surface *ps, int target, int level, enum pipe_format format)
-ST_PUBLIC(st_unbind_texture_surface, int, struct pipe_surface *ps, int target, int level)
-ST_PUBLIC(st_get_proc_address, st_proc, const char *procname)
-#undef ST_PUBLIC
diff --git a/src/gallium/state_trackers/egl/kms/native_kms.c b/src/gallium/state_trackers/egl/kms/native_kms.c
index 94588bfa74..3174774490 100644
--- a/src/gallium/state_trackers/egl/kms/native_kms.c
+++ b/src/gallium/state_trackers/egl/kms/native_kms.c
@@ -55,7 +55,7 @@ kms_surface_validate(struct native_surface *nsurf, uint attachment_mask,
templ.format = ksurf->color_format;
templ.tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET;
if (ksurf->type == KMS_SURFACE_TYPE_SCANOUT)
- templ.tex_usage |= PIPE_TEXTURE_USAGE_PRIMARY;
+ templ.tex_usage |= PIPE_TEXTURE_USAGE_SCANOUT;
}
/* create textures */
@@ -100,7 +100,7 @@ kms_surface_init_framebuffers(struct native_surface *nsurf, boolean need_back)
for (i = 0; i < num_framebuffers; i++) {
struct kms_framebuffer *fb;
enum native_attachment natt;
- unsigned int handle, stride;
+ struct winsys_handle whandle;
uint block_bits;
if (i == 0) {
@@ -128,13 +128,17 @@ kms_surface_init_framebuffers(struct native_surface *nsurf, boolean need_back)
/* TODO detect the real value */
fb->is_passive = TRUE;
- if (!kdpy->api->local_handle_from_texture(kdpy->api,
- kdpy->base.screen, fb->texture, &stride, &handle))
+ memset(&whandle, 0, sizeof(whandle));
+ whandle.type = DRM_API_HANDLE_TYPE_KMS;
+
+ if (!kdpy->base.screen->texture_get_handle(kdpy->base.screen,
+ fb->texture, &whandle))
return FALSE;
block_bits = util_format_get_blocksizebits(ksurf->color_format);
err = drmModeAddFB(kdpy->fd, ksurf->width, ksurf->height,
- block_bits, block_bits, stride, handle, &fb->buffer_id);
+ block_bits, block_bits, whandle.stride, whandle.handle,
+ &fb->buffer_id);
if (err) {
fb->buffer_id = 0;
return FALSE;
@@ -627,9 +631,9 @@ kms_display_get_configs(struct native_display *ndpy, int *num_configs)
nconf->mode.alphaBits = 8;
nconf->mode.rgbBits = 32;
- format = PIPE_FORMAT_Z24S8_UNORM;
+ format = PIPE_FORMAT_Z24_UNORM_S8_USCALED;
if (!kms_display_is_format_supported(&kdpy->base, format, FALSE)) {
- format = PIPE_FORMAT_S8Z24_UNORM;
+ format = PIPE_FORMAT_S8_USCALED_Z24_UNORM;
if (!kms_display_is_format_supported(&kdpy->base, format, FALSE))
format = PIPE_FORMAT_NONE;
}
diff --git a/src/gallium/state_trackers/egl/x11/native_dri2.c b/src/gallium/state_trackers/egl/x11/native_dri2.c
index 8d2a8b1dff..8c0553ce0d 100644
--- a/src/gallium/state_trackers/egl/x11/native_dri2.c
+++ b/src/gallium/state_trackers/egl/x11/native_dri2.c
@@ -114,6 +114,7 @@ dri2_surface_process_drawable_buffers(struct native_surface *nsurf,
struct dri2_surface *dri2surf = dri2_surface(nsurf);
struct dri2_display *dri2dpy = dri2surf->dri2dpy;
struct pipe_texture templ;
+ struct winsys_handle whandle;
uint valid_mask;
int i;
@@ -171,9 +172,11 @@ dri2_surface_process_drawable_buffers(struct native_surface *nsurf,
continue;
}
- dri2surf->textures[natt] =
- dri2dpy->api->texture_from_shared_handle(dri2dpy->api,
- dri2dpy->base.screen, &templ, desc, xbuf->pitch, xbuf->name);
+ memset(&whandle, 0, sizeof(whandle));
+ whandle.stride = xbuf->pitch;
+ whandle.handle = xbuf->name;
+ dri2surf->textures[natt] = dri2dpy->base.screen->texture_from_handle(
+ dri2dpy->base.screen, &templ, &whandle);
if (dri2surf->textures[natt])
valid_mask |= 1 << natt;
}
@@ -555,8 +558,8 @@ choose_depth_stencil_format(const __GLcontextModes *mode,
break;
case 24:
if (mode->stencilBits) {
- formats[count++] = PIPE_FORMAT_Z24S8_UNORM;
- formats[count++] = PIPE_FORMAT_S8Z24_UNORM;
+ formats[count++] = PIPE_FORMAT_Z24_UNORM_S8_USCALED;
+ formats[count++] = PIPE_FORMAT_S8_USCALED_Z24_UNORM;
}
else {
formats[count++] = PIPE_FORMAT_Z24X8_UNORM;
diff --git a/src/gallium/state_trackers/egl/x11/native_x11.c b/src/gallium/state_trackers/egl/x11/native_x11.c
index 7b4fe63fa0..c6eb17ab1a 100644
--- a/src/gallium/state_trackers/egl/x11/native_x11.c
+++ b/src/gallium/state_trackers/egl/x11/native_x11.c
@@ -142,16 +142,9 @@ native_create_display(EGLNativeDisplayType dpy,
if (!ndpy) {
EGLint level = (force_sw) ? _EGL_INFO : _EGL_WARNING;
- boolean use_shm;
-
- /*
- * XXX st/mesa calls pipe_screen::update_buffer in st_validate_state.
- * When SHM is used, there is a good chance that the shared memory
- * segment is detached before the softpipe tile cache is flushed.
- */
- use_shm = FALSE;
- _eglLog(level, "use software%s fallback", (use_shm) ? " (SHM)" : "");
- ndpy = x11_create_ximage_display(dpy, event_handler, use_shm);
+
+ _eglLog(level, "use software fallback");
+ ndpy = x11_create_ximage_display(dpy, event_handler);
}
return ndpy;
diff --git a/src/gallium/state_trackers/egl/x11/native_x11.h b/src/gallium/state_trackers/egl/x11/native_x11.h
index 8c6a7d9349..1566524926 100644
--- a/src/gallium/state_trackers/egl/x11/native_x11.h
+++ b/src/gallium/state_trackers/egl/x11/native_x11.h
@@ -30,8 +30,7 @@
struct native_display *
x11_create_ximage_display(EGLNativeDisplayType dpy,
- struct native_event_handler *event_handler,
- boolean use_xshm);
+ struct native_event_handler *event_handler);
struct native_display *
x11_create_dri2_display(EGLNativeDisplayType dpy,
diff --git a/src/gallium/state_trackers/egl/x11/native_ximage.c b/src/gallium/state_trackers/egl/x11/native_ximage.c
index 3421c1951a..d69011ac5e 100644
--- a/src/gallium/state_trackers/egl/x11/native_ximage.c
+++ b/src/gallium/state_trackers/egl/x11/native_ximage.c
@@ -28,17 +28,19 @@
#include <sys/shm.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
-#include <X11/extensions/XShm.h>
#include "util/u_memory.h"
#include "util/u_math.h"
#include "util/u_format.h"
#include "pipe/p_compiler.h"
-#include "util/u_simple_screen.h"
#include "util/u_inlines.h"
-#include "softpipe/sp_winsys.h"
+#include "state_tracker/xlib_sw_winsys.h"
+#include "target-helpers/wrap_screen.h"
+#include "util/u_debug.h"
+#include "softpipe/sp_public.h"
+#include "llvmpipe/lp_public.h"
+#include "cell/ppu/cell_public.h"
#include "egllog.h"
-#include "sw_winsys.h"
#include "native_x11.h"
#include "x11_screen.h"
@@ -53,24 +55,18 @@ struct ximage_display {
Display *dpy;
boolean own_dpy;
- struct x11_screen *xscr;
- int xscr_number;
-
struct native_event_handler *event_handler;
- boolean use_xshm;
+ struct x11_screen *xscr;
+ int xscr_number;
- struct pipe_winsys *winsys;
struct ximage_config *configs;
int num_configs;
};
struct ximage_buffer {
- XImage *ximage;
-
struct pipe_texture *texture;
- XShmSegmentInfo *shm_info;
- boolean xshm_attached;
+ struct xlib_drawable xdraw;
};
struct ximage_surface {
@@ -81,13 +77,13 @@ struct ximage_surface {
XVisualInfo visual;
struct ximage_display *xdpy;
- GC gc;
-
unsigned int server_stamp;
unsigned int client_stamp;
int width, height;
struct ximage_buffer buffers[NUM_NATIVE_ATTACHMENTS];
uint valid_mask;
+
+ struct pipe_surface *draw_surface;
};
struct ximage_config {
@@ -121,18 +117,6 @@ ximage_surface_free_buffer(struct native_surface *nsurf,
struct ximage_buffer *xbuf = &xsurf->buffers[which];
pipe_texture_reference(&xbuf->texture, NULL);
-
- if (xbuf->shm_info) {
- if (xbuf->xshm_attached)
- XShmDetach(xsurf->xdpy->dpy, xbuf->shm_info);
- if (xbuf->shm_info->shmaddr != (void *) -1)
- shmdt(xbuf->shm_info->shmaddr);
- if (xbuf->shm_info->shmid != -1)
- shmctl(xbuf->shm_info->shmid, IPC_RMID, 0);
-
- xbuf->shm_info->shmaddr = (void *) -1;
- xbuf->shm_info->shmid = -1;
- }
}
static boolean
@@ -156,40 +140,25 @@ ximage_surface_alloc_buffer(struct native_surface *nsurf,
templ.depth0 = 1;
templ.tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET;
- if (xbuf->shm_info) {
- struct pipe_buffer *pbuf;
- unsigned stride, size;
- void *addr = NULL;
-
- stride = util_format_get_stride(xsurf->color_format, xsurf->width);
- /* alignment should depend on visual? */
- stride = align(stride, 4);
- size = stride * xsurf->height;
-
- /* create and attach shm object */
- xbuf->shm_info->shmid = shmget(IPC_PRIVATE, size, 0755);
- if (xbuf->shm_info->shmid != -1) {
- xbuf->shm_info->shmaddr =
- shmat(xbuf->shm_info->shmid, NULL, 0);
- if (xbuf->shm_info->shmaddr != (void *) -1) {
- if (XShmAttach(xsurf->xdpy->dpy, xbuf->shm_info)) {
- addr = xbuf->shm_info->shmaddr;
- xbuf->xshm_attached = TRUE;
- }
- }
- }
-
- if (addr) {
- pbuf = screen->user_buffer_create(screen, addr, size);
- if (pbuf) {
- xbuf->texture =
- screen->texture_blanket(screen, &templ, &stride, pbuf);
- pipe_buffer_reference(&pbuf, NULL);
- }
+ if (xsurf->type != XIMAGE_SURFACE_TYPE_PBUFFER) {
+ switch (which) {
+ case NATIVE_ATTACHMENT_FRONT_LEFT:
+ case NATIVE_ATTACHMENT_FRONT_RIGHT:
+ templ.tex_usage |= PIPE_TEXTURE_USAGE_SCANOUT;
+ break;
+ case NATIVE_ATTACHMENT_BACK_LEFT:
+ case NATIVE_ATTACHMENT_BACK_RIGHT:
+ templ.tex_usage |= PIPE_TEXTURE_USAGE_DISPLAY_TARGET;
+ break;
+ default:
+ break;
}
}
- else {
- xbuf->texture = screen->texture_create(screen, &templ);
+ xbuf->texture = screen->texture_create(screen, &templ);
+ if (xbuf->texture) {
+ xbuf->xdraw.visual = xsurf->visual.visual;
+ xbuf->xdraw.depth = xsurf->visual.depth;
+ xbuf->xdraw.drawable = xsurf->drawable;
}
/* clean up the buffer if allocation failed */
@@ -269,18 +238,10 @@ ximage_surface_update_buffers(struct native_surface *nsurf, uint buffer_mask)
new_valid = 0x0;
for (att = 0; att < NUM_NATIVE_ATTACHMENTS; att++) {
if (native_attachment_mask_test(buffer_mask, att)) {
- struct ximage_buffer *xbuf = &xsurf->buffers[att];
-
/* reallocate the texture */
if (!ximage_surface_alloc_buffer(&xsurf->base, att))
break;
- /* update ximage */
- if (xbuf->ximage) {
- xbuf->ximage->width = xsurf->width;
- xbuf->ximage->height = xsurf->height;
- }
-
new_valid |= (1 << att);
if (buffer_mask == new_valid)
break;
@@ -300,43 +261,26 @@ ximage_surface_draw_buffer(struct native_surface *nsurf,
struct ximage_surface *xsurf = ximage_surface(nsurf);
struct ximage_buffer *xbuf = &xsurf->buffers[which];
struct pipe_screen *screen = xsurf->xdpy->base.screen;
- struct pipe_transfer *transfer;
+ struct pipe_surface *psurf;
if (xsurf->type == XIMAGE_SURFACE_TYPE_PBUFFER)
return TRUE;
- assert(xsurf->drawable && xbuf->ximage && xbuf->texture);
+ assert(xsurf->drawable && xbuf->texture);
- transfer = screen->get_tex_transfer(screen, xbuf->texture,
- 0, 0, 0, PIPE_TRANSFER_READ, 0, 0, xsurf->width, xsurf->height);
- if (!transfer)
- return FALSE;
+ psurf = xsurf->draw_surface;
+ if (!psurf || psurf->texture != xbuf->texture) {
+ pipe_surface_reference(&xsurf->draw_surface, NULL);
- xbuf->ximage->bytes_per_line = transfer->stride;
- xbuf->ximage->data = screen->transfer_map(screen, transfer);
- if (!xbuf->ximage->data) {
- screen->tex_transfer_destroy(transfer);
- return FALSE;
- }
-
-
- if (xbuf->shm_info)
- XShmPutImage(xsurf->xdpy->dpy, xsurf->drawable, xsurf->gc,
- xbuf->ximage, 0, 0, 0, 0, xsurf->width, xsurf->height, False);
- else
- XPutImage(xsurf->xdpy->dpy, xsurf->drawable, xsurf->gc,
- xbuf->ximage, 0, 0, 0, 0, xsurf->width, xsurf->height);
-
- xbuf->ximage->data = NULL;
- screen->transfer_unmap(screen, transfer);
+ psurf = screen->get_tex_surface(screen,
+ xbuf->texture, 0, 0, 0, PIPE_BUFFER_USAGE_CPU_READ);
+ if (!psurf)
+ return FALSE;
- /*
- * softpipe allows the pipe transfer to be re-used, but we don't want to
- * rely on that behavior.
- */
- screen->tex_transfer_destroy(transfer);
+ xsurf->draw_surface = psurf;
+ }
- XSync(xsurf->xdpy->dpy, FALSE);
+ screen->flush_frontbuffer(screen, psurf, &xbuf->xdraw);
return TRUE;
}
@@ -364,7 +308,8 @@ ximage_surface_swap_buffers(struct native_surface *nsurf)
boolean ret;
/* display the back buffer first */
- ret = ximage_surface_draw_buffer(nsurf, NATIVE_ATTACHMENT_BACK_LEFT);
+ ret = ximage_surface_draw_buffer(&xsurf->base,
+ NATIVE_ATTACHMENT_BACK_LEFT);
/* force buffers to be updated in next validation call */
xsurf->server_stamp++;
ximage_surface_notify_invalid(&xsurf->base);
@@ -372,13 +317,12 @@ ximage_surface_swap_buffers(struct native_surface *nsurf)
xfront = &xsurf->buffers[NATIVE_ATTACHMENT_FRONT_LEFT];
xback = &xsurf->buffers[NATIVE_ATTACHMENT_BACK_LEFT];
- /* skip swapping so that the front buffer is allocated only when needed */
- if (!xfront->texture)
- return ret;
-
- xtmp = *xfront;
- *xfront = *xback;
- *xback = xtmp;
+ /* skip swapping unless there is a front buffer */
+ if (xfront->texture) {
+ xtmp = *xfront;
+ *xfront = *xback;
+ *xback = xtmp;
+ }
return ret;
}
@@ -433,18 +377,11 @@ ximage_surface_destroy(struct native_surface *nsurf)
struct ximage_surface *xsurf = ximage_surface(nsurf);
int i;
- for (i = 0; i < NUM_NATIVE_ATTACHMENTS; i++) {
- struct ximage_buffer *xbuf = &xsurf->buffers[i];
+ pipe_surface_reference(&xsurf->draw_surface, NULL);
+
+ for (i = 0; i < NUM_NATIVE_ATTACHMENTS; i++)
ximage_surface_free_buffer(&xsurf->base, i);
- /* xbuf->shm_info is owned by xbuf->ximage? */
- if (xbuf->ximage) {
- XDestroyImage(xbuf->ximage);
- xbuf->ximage = NULL;
- }
- }
- if (xsurf->type != XIMAGE_SURFACE_TYPE_PBUFFER)
- XFreeGC(xsurf->xdpy->dpy, xsurf->gc);
free(xsurf);
}
@@ -457,7 +394,6 @@ ximage_display_create_surface(struct native_display *ndpy,
struct ximage_display *xdpy = ximage_display(ndpy);
struct ximage_config *xconf = ximage_config(nconf);
struct ximage_surface *xsurf;
- int i;
xsurf = CALLOC_STRUCT(ximage_surface);
if (!xsurf)
@@ -471,52 +407,8 @@ ximage_display_create_surface(struct native_display *ndpy,
if (xsurf->type != XIMAGE_SURFACE_TYPE_PBUFFER) {
xsurf->drawable = drawable;
xsurf->visual = *xconf->visual;
-
- xsurf->gc = XCreateGC(xdpy->dpy, xsurf->drawable, 0, NULL);
- if (!xsurf->gc) {
- free(xsurf);
- return NULL;
- }
-
/* initialize the geometry */
ximage_surface_update_buffers(&xsurf->base, 0x0);
-
- for (i = 0; i < NUM_NATIVE_ATTACHMENTS; i++) {
- struct ximage_buffer *xbuf = &xsurf->buffers[i];
-
- if (xdpy->use_xshm) {
- xbuf->shm_info = calloc(1, sizeof(*xbuf->shm_info));
- if (xbuf->shm_info) {
- /* initialize shm info */
- xbuf->shm_info->shmid = -1;
- xbuf->shm_info->shmaddr = (void *) -1;
- xbuf->shm_info->readOnly = TRUE;
-
- xbuf->ximage = XShmCreateImage(xsurf->xdpy->dpy,
- xsurf->visual.visual,
- xsurf->visual.depth,
- ZPixmap, NULL,
- xbuf->shm_info,
- 0, 0);
- }
- }
- else {
- xbuf->ximage = XCreateImage(xsurf->xdpy->dpy,
- xsurf->visual.visual,
- xsurf->visual.depth,
- ZPixmap, 0, /* format, offset */
- NULL, /* data */
- 0, 0, /* size */
- 8, /* bitmap_pad */
- 0); /* bytes_per_line */
- }
-
- if (!xbuf->ximage) {
- XFreeGC(xdpy->dpy, xsurf->gc);
- free(xsurf);
- return NULL;
- }
- }
}
xsurf->base.destroy = ximage_surface_destroy;
@@ -634,8 +526,8 @@ ximage_display_get_configs(struct native_display *ndpy, int *num_configs)
xconf->base.stencil_format = PIPE_FORMAT_NONE;
/* create the second config with depth/stencil buffer */
if (j == 1) {
- xconf->base.depth_format = PIPE_FORMAT_Z24S8_UNORM;
- xconf->base.stencil_format = PIPE_FORMAT_Z24S8_UNORM;
+ xconf->base.depth_format = PIPE_FORMAT_Z24_UNORM_S8_USCALED;
+ xconf->base.stencil_format = PIPE_FORMAT_Z24_UNORM_S8_USCALED;
mode->depthBits = 24;
mode->stencilBits = 8;
mode->haveDepthBuffer = TRUE;
@@ -727,7 +619,6 @@ ximage_display_destroy(struct native_display *ndpy)
free(xdpy->configs);
xdpy->base.screen->destroy(xdpy->base.screen);
- free(xdpy->winsys);
x11_screen_destroy(xdpy->xscr);
if (xdpy->own_dpy)
@@ -735,10 +626,63 @@ ximage_display_destroy(struct native_display *ndpy)
free(xdpy);
}
+
+/* Helper function to build a subset of a driver stack consisting of
+ * one of the software rasterizers (cell, llvmpipe, softpipe) and the
+ * xlib winsys.
+ *
+ * This function could be shared, but currently causes headaches for
+ * the build systems, particularly scons if we try.
+ *
+ * Long term, want to avoid having global #defines for things like
+ * GALLIUM_LLVMPIPE, GALLIUM_CELL, etc. Scons already eliminates
+ * those #defines, so things that are painful for it now are likely to
+ * be painful for other build systems in the future.
+ */
+static struct pipe_screen *
+swrast_xlib_create_screen( Display *display )
+{
+ struct sw_winsys *winsys;
+ struct pipe_screen *screen = NULL;
+
+ /* Create the underlying winsys, which performs presents to Xlib
+ * drawables:
+ */
+ winsys = xlib_create_sw_winsys( display );
+ if (winsys == NULL)
+ return NULL;
+
+ /* Create a software rasterizer on top of that winsys. Use
+ * llvmpipe if it is available.
+ */
+#if defined(GALLIUM_LLVMPIPE)
+ if (screen == NULL &&
+ !debug_get_bool_option("GALLIUM_NO_LLVM", FALSE))
+ screen = llvmpipe_create_screen( winsys );
+#endif
+
+ if (screen == NULL)
+ screen = softpipe_create_screen( winsys );
+
+ if (screen == NULL)
+ goto fail;
+
+ /* Inject any wrapping layers we want to here:
+ */
+ return gallium_wrap_screen( screen );
+
+fail:
+ if (winsys)
+ winsys->destroy( winsys );
+
+ return NULL;
+}
+
+
+
struct native_display *
x11_create_ximage_display(EGLNativeDisplayType dpy,
- struct native_event_handler *event_handler,
- boolean use_xshm)
+ struct native_event_handler *event_handler)
{
struct ximage_display *xdpy;
@@ -756,6 +700,8 @@ x11_create_ximage_display(EGLNativeDisplayType dpy,
xdpy->own_dpy = TRUE;
}
+ xdpy->event_handler = event_handler;
+
xdpy->xscr_number = DefaultScreen(xdpy->dpy);
xdpy->xscr = x11_screen_create(xdpy->dpy, xdpy->xscr_number);
if (!xdpy->xscr) {
@@ -763,13 +709,7 @@ x11_create_ximage_display(EGLNativeDisplayType dpy,
return NULL;
}
- xdpy->event_handler = event_handler;
-
- xdpy->use_xshm =
- (use_xshm && x11_screen_support(xdpy->xscr, X11_SCREEN_EXTENSION_XSHM));
-
- xdpy->winsys = create_sw_winsys();
- xdpy->base.screen = softpipe_create_screen(xdpy->winsys);
+ xdpy->base.screen = swrast_xlib_create_screen(xdpy->dpy);
xdpy->base.destroy = ximage_display_destroy;
xdpy->base.get_param = ximage_display_get_param;
diff --git a/src/gallium/state_trackers/egl/x11/sw_winsys.c b/src/gallium/state_trackers/egl/x11/sw_winsys.c
deleted file mode 100644
index 33328aadf2..0000000000
--- a/src/gallium/state_trackers/egl/x11/sw_winsys.c
+++ /dev/null
@@ -1,231 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-/**
- * Totally software-based winsys layer.
- * Note that the one winsys function that we can't implement here
- * is flush_frontbuffer().
- * Whoever uses this code will have to provide that.
- *
- * Authors: Brian Paul
- */
-
-
-#include "util/u_simple_screen.h"
-#include "pipe/p_state.h"
-#include "util/u_inlines.h"
-#include "util/u_format.h"
-#include "util/u_math.h"
-#include "util/u_memory.h"
-
-#include "sw_winsys.h"
-
-
-
-/** Subclass of pipe_winsys */
-struct sw_pipe_winsys
-{
- struct pipe_winsys Base;
- /* no extra fields for now */
-};
-
-
-/** subclass of pipe_buffer */
-struct sw_pipe_buffer
-{
- struct pipe_buffer Base;
- boolean UserBuffer; /** Is this a user-space buffer? */
- void *Data;
- void *Mapped;
-};
-
-
-/** cast wrapper */
-static INLINE struct sw_pipe_buffer *
-sw_pipe_buffer(struct pipe_buffer *b)
-{
- return (struct sw_pipe_buffer *) b;
-}
-
-
-static const char *
-get_name(struct pipe_winsys *pws)
-{
- return "software";
-}
-
-
-/** Create new pipe_buffer and allocate storage of given size */
-static struct pipe_buffer *
-buffer_create(struct pipe_winsys *pws,
- unsigned alignment,
- unsigned usage,
- unsigned size)
-{
- struct sw_pipe_buffer *buffer = CALLOC_STRUCT(sw_pipe_buffer);
- if (!buffer)
- return NULL;
-
- pipe_reference_init(&buffer->Base.reference, 1);
- buffer->Base.alignment = alignment;
- buffer->Base.usage = usage;
- buffer->Base.size = size;
-
- /* align to 16-byte multiple for Cell */
- buffer->Data = align_malloc(size, MAX2(alignment, 16));
-
- return &buffer->Base;
-}
-
-
-/**
- * Create buffer which wraps user-space data.
- */
-static struct pipe_buffer *
-user_buffer_create(struct pipe_winsys *pws, void *ptr, unsigned bytes)
-{
- struct sw_pipe_buffer *buffer = CALLOC_STRUCT(sw_pipe_buffer);
- if (!buffer)
- return NULL;
-
- pipe_reference_init(&buffer->Base.reference, 1);
- buffer->Base.size = bytes;
- buffer->UserBuffer = TRUE;
- buffer->Data = ptr;
-
- return &buffer->Base;
-}
-
-
-static void *
-buffer_map(struct pipe_winsys *pws, struct pipe_buffer *buf, unsigned flags)
-{
- struct sw_pipe_buffer *buffer = sw_pipe_buffer(buf);
- buffer->Mapped = buffer->Data;
- return buffer->Mapped;
-}
-
-
-static void
-buffer_unmap(struct pipe_winsys *pws, struct pipe_buffer *buf)
-{
- struct sw_pipe_buffer *buffer = sw_pipe_buffer(buf);
- buffer->Mapped = NULL;
-}
-
-
-static void
-buffer_destroy(struct pipe_buffer *buf)
-{
- struct sw_pipe_buffer *buffer = sw_pipe_buffer(buf);
-
- if (buffer->Data && !buffer->UserBuffer) {
- align_free(buffer->Data);
- buffer->Data = NULL;
- }
-
- free(buffer);
-}
-
-
-static struct pipe_buffer *
-surface_buffer_create(struct pipe_winsys *winsys,
- unsigned width, unsigned height,
- enum pipe_format format,
- unsigned usage,
- unsigned tex_usage,
- unsigned *stride)
-{
- const unsigned alignment = 64;
- unsigned nblocksy;
-
- nblocksy = util_format_get_nblocksy(format, height);
- *stride = align(util_format_get_stride(format, width), alignment);
-
- return winsys->buffer_create(winsys, alignment,
- usage,
- *stride * nblocksy);
-}
-
-
-static void
-fence_reference(struct pipe_winsys *sws, struct pipe_fence_handle **ptr,
- struct pipe_fence_handle *fence)
-{
- /* no-op */
-}
-
-
-static int
-fence_signalled(struct pipe_winsys *sws, struct pipe_fence_handle *fence,
- unsigned flag)
-{
- /* no-op */
- return 0;
-}
-
-
-static int
-fence_finish(struct pipe_winsys *sws, struct pipe_fence_handle *fence,
- unsigned flag)
-{
- /* no-op */
- return 0;
-}
-
-
-/**
- * Create/return a new pipe_winsys object.
- */
-struct pipe_winsys *
-create_sw_winsys(void)
-{
- struct sw_pipe_winsys *ws = CALLOC_STRUCT(sw_pipe_winsys);
- if (!ws)
- return NULL;
-
- /* Fill in this struct with callbacks that pipe will need to
- * communicate with the window system, buffer manager, etc.
- */
- ws->Base.buffer_create = buffer_create;
- ws->Base.user_buffer_create = user_buffer_create;
- ws->Base.buffer_map = buffer_map;
- ws->Base.buffer_unmap = buffer_unmap;
- ws->Base.buffer_destroy = buffer_destroy;
-
- ws->Base.surface_buffer_create = surface_buffer_create;
-
- ws->Base.fence_reference = fence_reference;
- ws->Base.fence_signalled = fence_signalled;
- ws->Base.fence_finish = fence_finish;
-
- ws->Base.flush_frontbuffer = NULL; /* not implemented here! */
-
- ws->Base.get_name = get_name;
-
- return &ws->Base;
-}
diff --git a/src/gallium/state_trackers/es/Makefile b/src/gallium/state_trackers/es/Makefile
index b036551271..089d441167 100644
--- a/src/gallium/state_trackers/es/Makefile
+++ b/src/gallium/state_trackers/es/Makefile
@@ -38,6 +38,8 @@ SYS_LIBS = -lm -pthread
INCLUDE_DIRS = \
+ -I$(TOP)/include \
+ -I$(TOP)/src/mesa \
-I$(TOP)/src/gallium/include
.c.o:
diff --git a/src/gallium/state_trackers/es/st_es1.c b/src/gallium/state_trackers/es/st_es1.c
index 25bc53b21e..4e89e06b34 100644
--- a/src/gallium/state_trackers/es/st_es1.c
+++ b/src/gallium/state_trackers/es/st_es1.c
@@ -1,3 +1,8 @@
-#include "pipe/p_compiler.h"
+#include "state_tracker/st_manager.h"
PUBLIC const int st_api_OpenGL_ES1 = 1;
+
+PUBLIC const struct st_module st_module_OpenGL_ES1 = {
+ .api = ST_API_OPENGL_ES1,
+ .create_api = st_manager_create_api
+};
diff --git a/src/gallium/state_trackers/es/st_es2.c b/src/gallium/state_trackers/es/st_es2.c
index 171ea62b97..82e88b176a 100644
--- a/src/gallium/state_trackers/es/st_es2.c
+++ b/src/gallium/state_trackers/es/st_es2.c
@@ -1,3 +1,8 @@
-#include "pipe/p_compiler.h"
+#include "state_tracker/st_manager.h"
PUBLIC const int st_api_OpenGL_ES2 = 1;
+
+PUBLIC const struct st_module st_module_OpenGL_ES2 = {
+ .api = ST_API_OPENGL_ES2,
+ .create_api = st_manager_create_api
+};
diff --git a/src/gallium/state_trackers/glx/xlib/Makefile b/src/gallium/state_trackers/glx/xlib/Makefile
index 7b2adc62c3..35509fd708 100644
--- a/src/gallium/state_trackers/glx/xlib/Makefile
+++ b/src/gallium/state_trackers/glx/xlib/Makefile
@@ -5,12 +5,14 @@ LIBNAME = xlib
LIBRARY_INCLUDES = \
-I$(TOP)/include \
- -I$(TOP)/src/mesa
+ -I$(TOP)/src/mesa \
+ $(X11_CFLAGS)
C_SOURCES = \
glx_api.c \
glx_getproc.c \
glx_usefont.c \
- xm_api.c
+ xm_api.c \
+ xm_st.c
include ../../../Makefile.template
diff --git a/src/gallium/state_trackers/glx/xlib/SConscript b/src/gallium/state_trackers/glx/xlib/SConscript
index fa96df357d..d6c16ad2f5 100644
--- a/src/gallium/state_trackers/glx/xlib/SConscript
+++ b/src/gallium/state_trackers/glx/xlib/SConscript
@@ -13,8 +13,6 @@ if env['platform'] == 'linux' \
'#/src/mesa/main',
])
- env.Append(CPPDEFINES = ['USE_XSHM'])
-
st_xlib = env.ConvenienceLibrary(
target = 'st_xlib',
source = [
@@ -22,6 +20,7 @@ if env['platform'] == 'linux' \
'glx_getproc.c',
'glx_usefont.c',
'xm_api.c',
+ 'xm_st.c',
]
)
Export('st_xlib')
diff --git a/src/gallium/state_trackers/glx/xlib/glx_api.c b/src/gallium/state_trackers/glx/xlib/glx_api.c
index 08bf624b5c..eb8d6a1933 100644
--- a/src/gallium/state_trackers/glx/xlib/glx_api.c
+++ b/src/gallium/state_trackers/glx/xlib/glx_api.c
@@ -35,12 +35,9 @@
#include "xm_api.h"
#include "main/context.h"
-#include "main/config.h"
#include "main/macros.h"
#include "main/imports.h"
#include "main/version.h"
-#include "state_tracker/st_context.h"
-#include "state_tracker/st_public.h"
/* This indicates the client-side GLX API and GLX encoder version. */
@@ -689,7 +686,7 @@ choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig )
int desiredVisualID = -1;
int numAux = 0;
- xmesa_init();
+ xmesa_init( dpy );
parselist = list;
@@ -1304,7 +1301,7 @@ glXCopyContext( Display *dpy, GLXContext src, GLXContext dst,
if (MakeCurrent_PrevContext == src) {
_mesa_Flush();
}
- st_copy_context_state( xm_src->st, xm_dst->st, (GLuint) mask );
+ XMesaCopyContext(xm_src, xm_dst, mask);
}
@@ -1761,6 +1758,10 @@ glXGetFBConfigs( Display *dpy, int screen, int *nelements )
}
for (i = 0; i < *nelements; i++) {
results[i] = create_glx_visual(dpy, visuals + i);
+ if (!results[i]) {
+ *nelements = i;
+ break;
+ }
}
return (GLXFBConfig *) results;
}
diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c
index e8524a21c2..c394430b94 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.c
@@ -35,10 +35,6 @@
* corner of the window. Therefore, most drawing functions in this
* file have to flip Y coordinates.
*
- * Define USE_XSHM in the Makefile with -DUSE_XSHM if you want to compile
- * in support for the MIT Shared Memory extension. If enabled, when you
- * use an Ximage for the back buffer in double buffered mode, the "swap"
- * operation will be faster. You must also link with -lXext.
*
* Byte swapping: If the Mesa host and the X display use a different
* byte order then there's some trickiness to be aware of when using
@@ -58,20 +54,14 @@
#endif
#include "xm_api.h"
-#include "main/context.h"
-#include "main/framebuffer.h"
+#include "xm_st.h"
-#include "state_tracker/st_public.h"
-#include "state_tracker/st_context.h"
+#include "main/context.h"
#include "pipe/p_defines.h"
#include "pipe/p_screen.h"
#include "pipe/p_context.h"
-#include "trace/tr_screen.h"
-#include "trace/tr_context.h"
-#include "trace/tr_texture.h"
-
-#include "xm_winsys.h"
+#include "xm_public.h"
#include <GL/glx.h>
@@ -80,20 +70,78 @@
* global.
*/
static struct xm_driver driver;
+static struct st_api *stapi;
void xmesa_set_driver( const struct xm_driver *templ )
{
driver = *templ;
+ stapi = driver.create_st_api();
}
-/**
- * Global X driver lock
+
+/*
+ * XXX replace this with a linked list, or better yet, try to attach the
+ * gallium/mesa extra bits to the X Display object with XAddExtension().
*/
-pipe_mutex _xmesa_lock;
+#define MAX_DISPLAYS 10
+static struct xmesa_display Displays[MAX_DISPLAYS];
+static int NumDisplays = 0;
+
-static struct pipe_screen *_screen = NULL;
-static struct pipe_screen *screen = NULL;
+static XMesaDisplay
+xmesa_init_display( Display *display )
+{
+ pipe_static_mutex(init_mutex);
+ XMesaDisplay xmdpy;
+ int i;
+
+ pipe_mutex_lock(init_mutex);
+
+ /* Look for XMesaDisplay which corresponds to 'display' */
+ for (i = 0; i < NumDisplays; i++) {
+ if (Displays[i].display == display) {
+ /* Found it */
+ pipe_mutex_unlock(init_mutex);
+ return &Displays[i];
+ }
+ }
+
+ /* Create new XMesaDisplay */
+ assert(NumDisplays < MAX_DISPLAYS);
+ xmdpy = &Displays[NumDisplays];
+ NumDisplays++;
+
+ if (!xmdpy->display && display) {
+ xmdpy->display = display;
+ xmdpy->screen = driver.create_pipe_screen(display);
+ xmdpy->smapi = CALLOC_STRUCT(st_manager);
+ if (xmdpy->smapi)
+ xmdpy->smapi->screen = xmdpy->screen;
+
+ if (xmdpy->screen && xmdpy->smapi) {
+ pipe_mutex_init(xmdpy->mutex);
+ }
+ else {
+ if (xmdpy->screen) {
+ xmdpy->screen->destroy(xmdpy->screen);
+ xmdpy->screen = NULL;
+ }
+ if (xmdpy->smapi) {
+ FREE(xmdpy->smapi);
+ xmdpy->smapi = NULL;
+ }
+
+ xmdpy->display = NULL;
+ }
+ }
+ if (!xmdpy->display || xmdpy->display != display)
+ xmdpy = NULL;
+
+ pipe_mutex_unlock(init_mutex);
+
+ return xmdpy;
+}
/**********************************************************************/
/***** X Utility Functions *****/
@@ -111,41 +159,6 @@ static int host_byte_order( void )
}
-/**
- * Check if the X Shared Memory extension is available.
- * Return: 0 = not available
- * 1 = shared XImage support available
- * 2 = shared Pixmap support available also
- */
-int xmesa_check_for_xshm( Display *display )
-{
-#if defined(USE_XSHM)
- int major, minor, ignore;
- Bool pixmaps;
-
- if (getenv("SP_NO_RAST"))
- return 0;
-
- if (getenv("MESA_NOSHM")) {
- return 0;
- }
-
- if (XQueryExtension( display, "MIT-SHM", &ignore, &ignore, &ignore )) {
- if (XShmQueryVersion( display, &major, &minor, &pixmaps )==True) {
- return (pixmaps==True) ? 2 : 1;
- }
- else {
- return 0;
- }
- }
- else {
- return 0;
- }
-#else
- /* No XSHM support */
- return 0;
-#endif
-}
/**
@@ -238,12 +251,13 @@ void
xmesa_get_window_size(Display *dpy, XMesaBuffer b,
GLuint *width, GLuint *height)
{
+ XMesaDisplay xmdpy = xmesa_init_display(dpy);
Status stat;
- pipe_mutex_lock(_xmesa_lock);
+ pipe_mutex_lock(xmdpy->mutex);
XSync(b->xm_visual->display, 0); /* added for Chromium */
- stat = get_drawable_size(dpy, b->drawable, width, height);
- pipe_mutex_unlock(_xmesa_lock);
+ stat = get_drawable_size(dpy, b->ws.drawable, width, height);
+ pipe_mutex_unlock(xmdpy->mutex);
if (!stat) {
/* probably querying a window that's recently been destroyed */
@@ -313,26 +327,22 @@ choose_pixel_format(XMesaVisual v)
return PIPE_FORMAT_B5G6R5_UNORM;
}
- assert(0);
- return 0;
+ return PIPE_FORMAT_NONE;
}
-
/**
- * Query the default gallium screen for a Z/Stencil format that
- * at least matches the given depthBits and stencilBits.
+ * Choose a depth/stencil format that satisfies the given depth and
+ * stencil sizes.
*/
-static void
-xmesa_choose_z_stencil_format(int depth, int stencil,
- enum pipe_format *depthFormat,
- enum pipe_format *stencilFormat)
+static enum pipe_format
+choose_depth_stencil_format(XMesaDisplay xmdpy, int depth, int stencil)
{
const enum pipe_texture_target target = PIPE_TEXTURE_2D;
const unsigned tex_usage = PIPE_TEXTURE_USAGE_DEPTH_STENCIL;
const unsigned geom_flags = (PIPE_TEXTURE_GEOM_NON_SQUARE |
PIPE_TEXTURE_GEOM_NON_POWER_OF_TWO);
- enum pipe_format formats[8];
+ enum pipe_format formats[8], fmt;
int count, i;
count = 0;
@@ -345,28 +355,23 @@ xmesa_choose_z_stencil_format(int depth, int stencil,
formats[count++] = PIPE_FORMAT_Z24X8_UNORM;
}
if (depth <= 24 && stencil <= 8) {
- formats[count++] = PIPE_FORMAT_S8Z24_UNORM;
- formats[count++] = PIPE_FORMAT_Z24S8_UNORM;
+ formats[count++] = PIPE_FORMAT_S8_USCALED_Z24_UNORM;
+ formats[count++] = PIPE_FORMAT_Z24_UNORM_S8_USCALED;
}
if (depth <= 32 && stencil == 0) {
formats[count++] = PIPE_FORMAT_Z32_UNORM;
}
- *depthFormat = PIPE_FORMAT_NONE;
+ fmt = PIPE_FORMAT_NONE;
for (i = 0; i < count; i++) {
- if (screen->is_format_supported(screen, formats[i],
+ if (xmdpy->screen->is_format_supported(xmdpy->screen, formats[i],
target, tex_usage, geom_flags)) {
- *depthFormat = formats[i];
+ fmt = formats[i];
break;
}
}
- if (stencil) {
- *stencilFormat = *depthFormat;
- }
- else {
- *stencilFormat = PIPE_FORMAT_NONE;
- }
+ return fmt;
}
@@ -375,7 +380,7 @@ xmesa_choose_z_stencil_format(int depth, int stencil,
/***** Linked list of XMesaBuffers *****/
/**********************************************************************/
-XMesaBuffer XMesaBufferList = NULL;
+static XMesaBuffer XMesaBufferList = NULL;
/**
@@ -393,53 +398,33 @@ static XMesaBuffer
create_xmesa_buffer(Drawable d, BufferType type,
XMesaVisual vis, Colormap cmap)
{
+ XMesaDisplay xmdpy = xmesa_init_display(vis->display);
XMesaBuffer b;
- GLframebuffer *fb;
- enum pipe_format colorFormat, depthFormat, stencilFormat;
uint width, height;
ASSERT(type == WINDOW || type == PIXMAP || type == PBUFFER);
+ if (!xmdpy)
+ return NULL;
+
b = (XMesaBuffer) CALLOC_STRUCT(xmesa_buffer);
if (!b)
return NULL;
- b->drawable = d;
+ b->ws.drawable = d;
+ b->ws.visual = vis->visinfo->visual;
+ b->ws.depth = vis->visinfo->depth;
b->xm_visual = vis;
b->type = type;
b->cmap = cmap;
- /* determine PIPE_FORMATs for buffers */
- colorFormat = choose_pixel_format(vis);
-
- xmesa_choose_z_stencil_format(vis->mesa_visual.depthBits,
- vis->mesa_visual.stencilBits,
- &depthFormat, &stencilFormat);
-
-
get_drawable_size(vis->display, d, &width, &height);
/*
* Create framebuffer, but we'll plug in our own renderbuffers below.
*/
- b->stfb = st_create_framebuffer(&vis->mesa_visual,
- colorFormat, depthFormat, stencilFormat,
- width, height,
- (void *) b);
- fb = &b->stfb->Base;
-
- /*
- * Create scratch XImage for xmesa_display_surface()
- */
- b->tempImage = XCreateImage(vis->display,
- vis->visinfo->visual,
- vis->visinfo->depth,
- ZPixmap, 0, /* format, offset */
- NULL, /* data */
- 0, 0, /* size */
- 32, /* bitmap_pad */
- 0); /* bytes_per_line */
+ b->stfb = xmesa_create_st_framebuffer(xmdpy, b);
/* GLX_EXT_texture_from_pixmap */
b->TextureTarget = 0;
@@ -483,29 +468,21 @@ xmesa_free_buffer(XMesaBuffer buffer)
for (b = XMesaBufferList; b; b = b->Next) {
if (b == buffer) {
- struct gl_framebuffer *fb = &buffer->stfb->Base;
-
/* unlink buffer from list */
if (prev)
prev->Next = buffer->Next;
else
XMesaBufferList = buffer->Next;
- /* mark as delete pending */
- fb->DeletePending = GL_TRUE;
-
/* Since the X window for the XMesaBuffer is going away, we don't
* want to dereference this pointer in the future.
*/
- b->drawable = 0;
-
- buffer->tempImage->data = NULL;
- XDestroyImage(buffer->tempImage);
+ b->ws.drawable = 0;
- /* Unreference. If count = zero we'll really delete the buffer */
- _mesa_reference_framebuffer(&fb, NULL);
-
- XFreeGC(b->xm_visual->display, b->gc);
+ /* XXX we should move the buffer to a delete-pending list and destroy
+ * the buffer until it is no longer current.
+ */
+ xmesa_destroy_st_framebuffer(buffer->stfb);
free(buffer);
@@ -583,21 +560,6 @@ initialize_visual_and_buffer(XMesaVisual v, XMesaBuffer b,
printf("X/Mesa bits per pixel = %d\n", v->BitsPerPixel);
}
- if (b && window) {
- /* these should have been set in create_xmesa_buffer */
- ASSERT(b->drawable == window);
-
- /* Setup for single/double buffering */
- if (v->mesa_visual.doubleBufferMode) {
- /* Double buffered */
- b->shm = xmesa_check_for_xshm( v->display );
- }
-
- /* X11 graphics context */
- b->gc = XCreateGC( v->display, window, 0, NULL );
- XSetFunction( v->display, b->gc, GXcopy );
- }
-
return GL_TRUE;
}
@@ -677,10 +639,12 @@ XMesaVisual XMesaCreateVisual( Display *display,
GLint level,
GLint visualCaveat )
{
+ XMesaDisplay xmdpy = xmesa_init_display(display);
XMesaVisual v;
GLint red_bits, green_bits, blue_bits, alpha_bits;
- xmesa_init();
+ if (!xmdpy)
+ return NULL;
/* For debugging only */
if (_mesa_getenv("MESA_XSYNC")) {
@@ -762,6 +726,32 @@ XMesaVisual XMesaCreateVisual( Display *display,
accum_blue_size, accum_alpha_size,
0 );
+ v->stvis.buffer_mask = ST_ATTACHMENT_FRONT_LEFT_MASK;
+ if (db_flag)
+ v->stvis.buffer_mask |= ST_ATTACHMENT_BACK_LEFT_MASK;
+ if (stereo_flag) {
+ v->stvis.buffer_mask |= ST_ATTACHMENT_FRONT_RIGHT_MASK;
+ if (db_flag)
+ v->stvis.buffer_mask |= ST_ATTACHMENT_BACK_RIGHT_MASK;
+ }
+
+ v->stvis.color_format = choose_pixel_format(v);
+ if (v->stvis.color_format == PIPE_FORMAT_NONE) {
+ FREE(v->visinfo);
+ FREE(v);
+ return NULL;
+ }
+
+ v->stvis.depth_stencil_format =
+ choose_depth_stencil_format(xmdpy, depth_size, stencil_size);
+
+ v->stvis.accum_format = (accum_red_size +
+ accum_green_size + accum_blue_size + accum_alpha_size) ?
+ PIPE_FORMAT_R16G16B16A16_SNORM : PIPE_FORMAT_NONE;
+
+ v->stvis.samples = num_samples;
+ v->stvis.render_buffer = ST_ATTACHMENT_INVALID;
+
/* XXX minor hack */
v->mesa_visual.level = level;
return v;
@@ -777,18 +767,12 @@ void XMesaDestroyVisual( XMesaVisual v )
/**
- * Do one-time initializations.
+ * Do per-display initializations.
*/
void
-xmesa_init(void)
+xmesa_init( Display *display )
{
- static GLboolean firstTime = GL_TRUE;
- if (firstTime) {
- pipe_mutex_init(_xmesa_lock);
- _screen = driver.create_pipe_screen();
- screen = trace_screen_create( _screen );
- firstTime = GL_FALSE;
- }
+ xmesa_init_display(display);
}
@@ -802,51 +786,33 @@ xmesa_init(void)
PUBLIC
XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
{
- struct pipe_context *pipe = NULL;
+ XMesaDisplay xmdpy = xmesa_init_display(v->display);
XMesaContext c;
- GLcontext *mesaCtx;
- uint pf;
- xmesa_init();
+ if (!xmdpy)
+ return NULL;
/* Note: the XMesaContext contains a Mesa GLcontext struct (inheritance) */
c = (XMesaContext) CALLOC_STRUCT(xmesa_context);
if (!c)
return NULL;
- pf = choose_pixel_format(v);
- assert(pf);
-
c->xm_visual = v;
c->xm_buffer = NULL; /* set later by XMesaMakeCurrent */
c->xm_read_buffer = NULL;
- if (screen == NULL)
- goto fail;
-
- /* Trace screen knows how to properly wrap context creation in the
- * wrapped screen, so nothing special to do here:
- */
- pipe = screen->context_create(screen, (void *) c);
- if (pipe == NULL)
- goto fail;
-
- c->st = st_create_context(pipe,
- &v->mesa_visual,
- share_list ? share_list->st : NULL);
+ c->st = stapi->create_context(stapi, xmdpy->smapi,
+ &v->stvis, (share_list) ? share_list->st : NULL);
if (c->st == NULL)
goto fail;
- mesaCtx = c->st->ctx;
- c->st->ctx->DriverCtx = c;
+ c->st->st_manager_private = (void *) c;
return c;
fail:
if (c->st)
- st_destroy_context(c->st);
- else if (pipe)
- pipe->destroy(pipe);
+ c->st->destroy(c->st);
free(c);
return NULL;
@@ -857,7 +823,7 @@ fail:
PUBLIC
void XMesaDestroyContext( XMesaContext c )
{
- st_destroy_context(c->st);
+ c->st->destroy(c->st);
/* FIXME: We should destroy the screen here, but if we do so, surfaces may
* outlive it, causing segfaults
@@ -963,7 +929,6 @@ XMesaCreatePixmapTextureBuffer(XMesaVisual v, Pixmap p,
{
GET_CURRENT_CONTEXT(ctx);
XMesaBuffer b;
- GLuint width, height;
assert(v);
@@ -971,19 +936,18 @@ XMesaCreatePixmapTextureBuffer(XMesaVisual v, Pixmap p,
if (!b)
return NULL;
- /* get pixmap size, update framebuffer/renderbuffer dims */
- xmesa_get_window_size(v->display, b, &width, &height);
- _mesa_resize_framebuffer(NULL, &(b->stfb->Base), width, height);
+ /* get pixmap size */
+ xmesa_get_window_size(v->display, b, &b->width, &b->height);
if (target == 0) {
/* examine dims */
if (ctx->Extensions.ARB_texture_non_power_of_two) {
target = GLX_TEXTURE_2D_EXT;
}
- else if ( _mesa_bitcount(width) == 1
- && _mesa_bitcount(height) == 1) {
+ else if ( _mesa_bitcount(b->width) == 1
+ && _mesa_bitcount(b->height) == 1) {
/* power of two size */
- if (height == 1) {
+ if (b->height == 1) {
target = GLX_TEXTURE_1D_EXT;
}
else {
@@ -1056,23 +1020,20 @@ XMesaDestroyBuffer(XMesaBuffer b)
/**
- * Query the current window size and update the corresponding GLframebuffer
- * and all attached renderbuffers.
- * Called when:
- * 1. the first time a buffer is bound to a context.
- * 2. SwapBuffers. XXX probabaly from xm_flush_frontbuffer() too...
- * Note: it's possible (and legal) for xmctx to be NULL. That can happen
- * when resizing a buffer when no rendering context is bound.
+ * Query the current drawable size and notify the binding context.
*/
void
-xmesa_check_and_update_buffer_size(XMesaContext xmctx, XMesaBuffer drawBuffer)
+xmesa_check_buffer_size(XMesaBuffer b)
{
- GLuint width, height;
- xmesa_get_window_size(drawBuffer->xm_visual->display, drawBuffer, &width, &height);
- st_resize_framebuffer(drawBuffer->stfb, width, height);
-}
+ XMesaContext xmctx = XMesaGetCurrentContext();
+ if (b->type == PBUFFER)
+ return;
+ xmesa_get_window_size(b->xm_visual->display, b, &b->width, &b->height);
+ if (xmctx && xmctx->xm_buffer == b)
+ xmctx->st->notify_invalid_framebuffer(xmctx->st, b->stfb);
+}
/*
@@ -1099,21 +1060,21 @@ GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer,
c->xm_read_buffer == readBuffer)
return GL_TRUE;
+ xmesa_check_buffer_size(drawBuffer);
+ if (readBuffer != drawBuffer)
+ xmesa_check_buffer_size(readBuffer);
+
c->xm_buffer = drawBuffer;
c->xm_read_buffer = readBuffer;
- st_make_current(c->st, drawBuffer->stfb, readBuffer->stfb);
-
- xmesa_check_and_update_buffer_size(c, drawBuffer);
- if (readBuffer != drawBuffer)
- xmesa_check_and_update_buffer_size(c, readBuffer);
+ stapi->make_current(stapi, c->st, drawBuffer->stfb, readBuffer->stfb);
/* Solution to Stephane Rehel's problem with glXReleaseBuffersMESA(): */
drawBuffer->wasCurrent = GL_TRUE;
}
else {
/* Detach */
- st_make_current( NULL, NULL, NULL );
+ stapi->make_current(stapi, NULL, NULL, NULL);
}
return GL_TRUE;
@@ -1132,14 +1093,8 @@ GLboolean XMesaUnbindContext( XMesaContext c )
XMesaContext XMesaGetCurrentContext( void )
{
- GET_CURRENT_CONTEXT(ctx);
- if (ctx) {
- XMesaContext xmesa = xmesa_context(ctx);
- return xmesa;
- }
- else {
- return 0;
- }
+ struct st_context_iface *st = stapi->get_current(stapi);
+ return (XMesaContext) (st) ? st->st_manager_private : NULL;
}
@@ -1151,21 +1106,17 @@ XMesaContext XMesaGetCurrentContext( void )
PUBLIC
void XMesaSwapBuffers( XMesaBuffer b )
{
- struct pipe_surface *frontLeftSurf;
-
- st_swapbuffers(b->stfb, &frontLeftSurf, NULL);
-
- if (frontLeftSurf) {
- if (_screen != screen) {
- struct trace_surface *tr_surf = trace_surface( frontLeftSurf );
- struct pipe_surface *surf = tr_surf->surface;
- frontLeftSurf = surf;
- }
-
- driver.display_surface(b, frontLeftSurf);
+ XMesaContext xmctx = XMesaGetCurrentContext();
+
+ if (xmctx && xmctx->xm_buffer == b) {
+ xmctx->st->flush( xmctx->st,
+ PIPE_FLUSH_RENDER_CACHE |
+ PIPE_FLUSH_SWAPBUFFERS |
+ PIPE_FLUSH_FRAME,
+ NULL);
}
- xmesa_check_and_update_buffer_size(NULL, b);
+ xmesa_swap_st_framebuffer(b->stfb);
}
@@ -1175,21 +1126,9 @@ void XMesaSwapBuffers( XMesaBuffer b )
*/
void XMesaCopySubBuffer( XMesaBuffer b, int x, int y, int width, int height )
{
- struct pipe_surface *surf_front;
- struct pipe_surface *surf_back;
- struct pipe_context *pipe = NULL; /* XXX fix */
-
- st_get_framebuffer_surface(b->stfb, ST_SURFACE_FRONT_LEFT, &surf_front);
- st_get_framebuffer_surface(b->stfb, ST_SURFACE_BACK_LEFT, &surf_back);
-
- if (!surf_front || !surf_back)
- return;
-
- assert(pipe);
- pipe->surface_copy(pipe,
- surf_front, x, y, /* dest */
- surf_back, x, y, /* src */
- width, height);
+ xmesa_copy_st_framebuffer(b->stfb,
+ ST_ATTACHMENT_BACK_LEFT, ST_ATTACHMENT_FRONT_LEFT,
+ x, y, width, height);
}
@@ -1197,7 +1136,14 @@ void XMesaCopySubBuffer( XMesaBuffer b, int x, int y, int width, int height )
void XMesaFlush( XMesaContext c )
{
if (c && c->xm_visual->display) {
- st_finish(c->st);
+ XMesaDisplay xmdpy = xmesa_init_display(c->xm_visual->display);
+ struct pipe_fence_handle *fence = NULL;
+
+ c->st->flush(c->st, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, &fence);
+ if (fence) {
+ xmdpy->screen->fence_finish(xmdpy->screen, fence, 0);
+ xmdpy->screen->fence_reference(xmdpy->screen, &fence, NULL);
+ }
XSync( c->xm_visual->display, False );
}
}
@@ -1210,7 +1156,7 @@ XMesaBuffer XMesaFindBuffer( Display *dpy, Drawable d )
{
XMesaBuffer b;
for (b = XMesaBufferList; b; b = b->Next) {
- if (b->drawable == d && b->xm_visual->display == dpy) {
+ if (b->ws.drawable == d && b->xm_visual->display == dpy) {
return b;
}
}
@@ -1244,10 +1190,10 @@ void XMesaGarbageCollect( void )
next = b->Next;
if (b->xm_visual &&
b->xm_visual->display &&
- b->drawable &&
+ b->ws.drawable &&
b->type == WINDOW) {
XSync(b->xm_visual->display, False);
- if (!window_exists( b->xm_visual->display, b->drawable )) {
+ if (!window_exists( b->xm_visual->display, b->ws.drawable )) {
/* found a dead window, free the ancillary info */
XMesaDestroyBuffer( b );
}
@@ -1271,3 +1217,10 @@ XMesaReleaseTexImage(Display *dpy, XMesaBuffer drawable, int buffer)
{
}
+
+void
+XMesaCopyContext(XMesaContext src, XMesaContext dst, unsigned long mask)
+{
+ if (dst->st->copy)
+ dst->st->copy(dst->st, src->st, mask);
+}
diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.h b/src/gallium/state_trackers/glx/xlib/xm_api.h
index 004cb260dc..4f2c8a6e6a 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.h
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.h
@@ -58,25 +58,31 @@ and create a window, you must do the following to use the X/Mesa interface:
#include "main/mtypes.h"
-#include "state_tracker/st_context.h"
-#include "state_tracker/st_public.h"
+#include "state_tracker/st_api.h"
#include "os/os_thread.h"
+#include "state_tracker/xlib_sw_winsys.h"
# include <X11/Xlib.h>
# include <X11/Xlibint.h>
# include <X11/Xutil.h>
-# ifdef USE_XSHM /* was SHM */
-# include <sys/ipc.h>
-# include <sys/shm.h>
-# include <X11/extensions/XShm.h>
-# endif
+typedef struct xmesa_display *XMesaDisplay;
typedef struct xmesa_buffer *XMesaBuffer;
typedef struct xmesa_context *XMesaContext;
typedef struct xmesa_visual *XMesaVisual;
+struct xmesa_display {
+ pipe_mutex mutex;
+
+ Display *display;
+ struct pipe_screen *screen;
+ struct st_manager *smapi;
+
+ struct pipe_context *pipe;
+};
+
/*
* Create a new X/Mesa visual.
@@ -262,16 +268,13 @@ XMesaCreatePixmapTextureBuffer(XMesaVisual v, Pixmap p,
int format, int target, int mipmap);
+extern void
+XMesaCopyContext(XMesaContext src, XMesaContext dst, unsigned long mask);
/***********************************************************************
*/
-extern pipe_mutex _xmesa_lock;
-
-extern struct xmesa_buffer *XMesaBufferList;
-
-
/**
* Visual inforation, derived from GLvisual.
* Basically corresponds to an XVisualInfo.
@@ -284,6 +287,8 @@ struct xmesa_visual {
GLint BitsPerPixel; /* True bits per pixel for XImages */
GLboolean ximage_flag; /* Use XImage for back buffer (not pixmap)? */
+
+ struct st_visual stvis;
};
@@ -292,7 +297,7 @@ struct xmesa_visual {
* Basically corresponds to a GLXContext.
*/
struct xmesa_context {
- struct st_context *st;
+ struct st_context_iface *st;
XMesaVisual xm_visual; /** pixel format info */
XMesaBuffer xm_buffer; /** current drawbuffer */
XMesaBuffer xm_read_buffer; /** current readbuffer */
@@ -315,7 +320,8 @@ typedef enum {
* Basically corresponds to a GLXDrawable.
*/
struct xmesa_buffer {
- struct st_framebuffer *stfb;
+ struct st_framebuffer_iface *stfb;
+ struct xlib_drawable ws;
GLboolean wasCurrent; /* was ever the current buffer? */
XMesaVisual xm_visual; /* the X/Mesa visual */
@@ -329,13 +335,6 @@ struct xmesa_buffer {
XImage *tempImage;
unsigned long selectedEvents;/* for pbuffers only */
- GLuint shm; /* X Shared Memory extension status: */
- /* 0 = not available */
- /* 1 = XImage support available */
- /* 2 = Pixmap support available too */
-#if defined(USE_XSHM)
- XShmSegmentInfo shminfo;
-#endif
GC gc; /* scratch GC for span, line, tri drawing */
@@ -345,32 +344,14 @@ struct xmesa_buffer {
GLint TextureMipmap; /** 0 or 1 */
struct xmesa_buffer *Next; /* Linked list pointer: */
-};
+ unsigned width, height;
+};
-/** cast wrapper */
-static INLINE XMesaContext
-xmesa_context(GLcontext *ctx)
-{
- return (XMesaContext) ctx->DriverCtx;
-}
-
-
-/** cast wrapper */
-static INLINE XMesaBuffer
-xmesa_buffer(GLframebuffer *fb)
-{
- struct st_framebuffer *stfb = (struct st_framebuffer *) fb;
- return (XMesaBuffer) st_framebuffer_private(stfb);
-}
-
-
-extern void
-xmesa_init(void);
extern void
-xmesa_delete_framebuffer(struct gl_framebuffer *fb);
+xmesa_init(Display *dpy);
extern XMesaBuffer
xmesa_find_buffer(Display *dpy, Colormap cmap, XMesaBuffer notThis);
@@ -380,7 +361,7 @@ xmesa_get_window_size(Display *dpy, XMesaBuffer b,
GLuint *width, GLuint *height);
extern void
-xmesa_check_and_update_buffer_size(XMesaContext xmctx, XMesaBuffer drawBuffer);
+xmesa_check_buffer_size(XMesaBuffer b);
extern void
xmesa_destroy_buffers_on_display(Display *dpy);
@@ -388,17 +369,15 @@ xmesa_destroy_buffers_on_display(Display *dpy);
static INLINE GLuint
xmesa_buffer_width(XMesaBuffer b)
{
- return b->stfb->Base.Width;
+ return b->width;
}
static INLINE GLuint
xmesa_buffer_height(XMesaBuffer b)
{
- return b->stfb->Base.Height;
+ return b->height;
}
-extern int
-xmesa_check_for_xshm(Display *display);
#endif
diff --git a/src/gallium/state_trackers/glx/xlib/xm_winsys.h b/src/gallium/state_trackers/glx/xlib/xm_public.h
index 4bd5b5c8d3..950eb21521 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_winsys.h
+++ b/src/gallium/state_trackers/glx/xlib/xm_public.h
@@ -26,27 +26,23 @@
*
**************************************************************************/
-#ifndef XM_WINSYS_H
-#define XM_WINSYS_H
+#ifndef XM_PUBLIC_H
+#define XM_PUBLIC_H
-struct pipe_context;
-struct pipe_screen;
-struct pipe_surface;
-struct xmesa_buffer;
+#include <X11/Xlib.h>
+struct pipe_screen;
+struct st_api;
+/* This is the driver interface required by the glx/xlib state tracker.
+ */
struct xm_driver {
-
- struct pipe_screen *(*create_pipe_screen)( void );
-
- void (*display_surface)( struct xmesa_buffer *,
- struct pipe_surface * );
-
+ struct pipe_screen *(*create_pipe_screen)( Display *display );
+ struct st_api *(*create_st_api)( void );
};
-
extern void
xmesa_set_driver( const struct xm_driver *driver );
-#endif
+#endif /* XM_PUBLIC_H */
diff --git a/src/gallium/state_trackers/glx/xlib/xm_st.c b/src/gallium/state_trackers/glx/xlib/xm_st.c
new file mode 100644
index 0000000000..b6ed7e8e1e
--- /dev/null
+++ b/src/gallium/state_trackers/glx/xlib/xm_st.c
@@ -0,0 +1,332 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.9
+ *
+ * Copyright (C) 2010 LunarG Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Chia-I Wu <olv@lunarg.com>
+ */
+
+#include "util/u_memory.h"
+#include "util/u_inlines.h"
+
+#include "xm_api.h"
+#include "xm_st.h"
+
+struct xmesa_st_framebuffer {
+ XMesaDisplay display;
+ XMesaBuffer buffer;
+ struct pipe_screen *screen;
+
+ struct st_visual stvis;
+
+ unsigned texture_width, texture_height, texture_mask;
+ struct pipe_texture *textures[ST_ATTACHMENT_COUNT];
+
+ struct pipe_surface *display_surface;
+};
+
+static INLINE struct xmesa_st_framebuffer *
+xmesa_st_framebuffer(struct st_framebuffer_iface *stfbi)
+{
+ return (struct xmesa_st_framebuffer *) stfbi->st_manager_private;
+}
+
+/**
+ * Display an attachment to the xlib_drawable of the framebuffer.
+ */
+static boolean
+xmesa_st_framebuffer_display(struct st_framebuffer_iface *stfbi,
+ enum st_attachment_type statt)
+{
+ struct xmesa_st_framebuffer *xstfb = xmesa_st_framebuffer(stfbi);
+ struct pipe_texture *ptex = xstfb->textures[statt];
+ struct pipe_surface *psurf;
+
+ if (!ptex)
+ return TRUE;
+
+ psurf = xstfb->display_surface;
+ /* (re)allocate the surface for the texture to be displayed */
+ if (!psurf || psurf->texture != ptex) {
+ pipe_surface_reference(&xstfb->display_surface, NULL);
+
+ psurf = xstfb->screen->get_tex_surface(xstfb->screen,
+ ptex, 0, 0, 0, PIPE_BUFFER_USAGE_CPU_READ);
+ if (!psurf)
+ return FALSE;
+
+ xstfb->display_surface = psurf;
+ }
+
+ xstfb->screen->flush_frontbuffer(xstfb->screen, psurf, &xstfb->buffer->ws);
+
+ return TRUE;
+}
+
+/**
+ * Copy the contents between the attachments.
+ */
+static void
+xmesa_st_framebuffer_copy_textures(struct st_framebuffer_iface *stfbi,
+ enum st_attachment_type src_statt,
+ enum st_attachment_type dst_statt,
+ unsigned x, unsigned y,
+ unsigned width, unsigned height)
+{
+ struct xmesa_st_framebuffer *xstfb = xmesa_st_framebuffer(stfbi);
+ struct pipe_texture *src_ptex = xstfb->textures[src_statt];
+ struct pipe_texture *dst_ptex = xstfb->textures[dst_statt];
+ struct pipe_surface *src, *dst;
+ struct pipe_context *pipe;
+
+ if (!src_ptex || !dst_ptex)
+ return;
+
+ pipe = xstfb->display->pipe;
+ if (!pipe) {
+ pipe = xstfb->screen->context_create(xstfb->screen, NULL);
+ if (!pipe)
+ return;
+ xstfb->display->pipe = pipe;
+ }
+
+ src = xstfb->screen->get_tex_surface(xstfb->screen,
+ src_ptex, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_READ);
+ dst = xstfb->screen->get_tex_surface(xstfb->screen,
+ dst_ptex, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_WRITE);
+
+ if (src && dst)
+ pipe->surface_copy(pipe, dst, x, y, src, x, y, width, height);
+
+ pipe_surface_reference(&src, NULL);
+ pipe_surface_reference(&dst, NULL);
+}
+
+/**
+ * Remove outdated textures and create the requested ones.
+ */
+static void
+xmesa_st_framebuffer_validate_textures(struct st_framebuffer_iface *stfbi,
+ unsigned width, unsigned height,
+ unsigned mask)
+{
+ struct xmesa_st_framebuffer *xstfb = xmesa_st_framebuffer(stfbi);
+ struct pipe_texture templ;
+ unsigned i;
+
+ /* remove outdated textures */
+ if (xstfb->texture_width != width || xstfb->texture_height != height) {
+ for (i = 0; i < ST_ATTACHMENT_COUNT; i++)
+ pipe_texture_reference(&xstfb->textures[i], NULL);
+ }
+
+ memset(&templ, 0, sizeof(templ));
+ templ.target = PIPE_TEXTURE_2D;
+ templ.width0 = width;
+ templ.height0 = height;
+ templ.depth0 = 1;
+ templ.last_level = 0;
+
+ for (i = 0; i < ST_ATTACHMENT_COUNT; i++) {
+ enum pipe_format format;
+ unsigned tex_usage;
+
+ /* the texture already exists or not requested */
+ if (xstfb->textures[i] || !(mask & (1 << i))) {
+ /* remember the texture */
+ if (xstfb->textures[i])
+ mask |= (1 << i);
+ continue;
+ }
+
+ switch (i) {
+ case ST_ATTACHMENT_FRONT_LEFT:
+ case ST_ATTACHMENT_BACK_LEFT:
+ case ST_ATTACHMENT_FRONT_RIGHT:
+ case ST_ATTACHMENT_BACK_RIGHT:
+ format = xstfb->stvis.color_format;
+ tex_usage = PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
+ PIPE_TEXTURE_USAGE_RENDER_TARGET;
+ break;
+ case ST_ATTACHMENT_DEPTH_STENCIL:
+ format = xstfb->stvis.depth_stencil_format;
+ tex_usage = PIPE_TEXTURE_USAGE_DEPTH_STENCIL;
+ break;
+ default:
+ format = PIPE_FORMAT_NONE;
+ break;
+ }
+
+ if (format != PIPE_FORMAT_NONE) {
+ templ.format = format;
+ templ.tex_usage = tex_usage;
+
+ xstfb->textures[i] =
+ xstfb->screen->texture_create(xstfb->screen, &templ);
+ }
+ }
+
+ xstfb->texture_width = width;
+ xstfb->texture_height = height;
+ xstfb->texture_mask = mask;
+}
+
+static boolean
+xmesa_st_framebuffer_validate(struct st_framebuffer_iface *stfbi,
+ const enum st_attachment_type *statts,
+ unsigned count,
+ struct pipe_texture **out)
+{
+ struct xmesa_st_framebuffer *xstfb = xmesa_st_framebuffer(stfbi);
+ unsigned statt_mask, new_mask, i;
+ boolean resized;
+
+ statt_mask = 0x0;
+ for (i = 0; i < count; i++)
+ statt_mask |= 1 << statts[i];
+ /* record newly allocated textures */
+ new_mask = statt_mask & ~xstfb->texture_mask;
+
+ resized = (xstfb->buffer->width != xstfb->texture_width ||
+ xstfb->buffer->height != xstfb->texture_height);
+
+ /* revalidate textures */
+ if (resized || new_mask) {
+ xmesa_st_framebuffer_validate_textures(stfbi,
+ xstfb->buffer->width, xstfb->buffer->height, statt_mask);
+
+ if (!resized) {
+ enum st_attachment_type back, front;
+
+ back = ST_ATTACHMENT_BACK_LEFT;
+ front = ST_ATTACHMENT_FRONT_LEFT;
+ /* copy the contents if front is newly allocated and back is not */
+ if ((statt_mask & (1 << back)) &&
+ (new_mask & (1 << front)) &&
+ !(new_mask & (1 << back))) {
+ xmesa_st_framebuffer_copy_textures(stfbi, back, front,
+ 0, 0, xstfb->texture_width, xstfb->texture_height);
+ }
+ }
+ }
+
+ for (i = 0; i < count; i++) {
+ out[i] = NULL;
+ pipe_texture_reference(&out[i], xstfb->textures[statts[i]]);
+ }
+
+ return TRUE;
+}
+
+static boolean
+xmesa_st_framebuffer_flush_front(struct st_framebuffer_iface *stfbi,
+ enum st_attachment_type statt)
+{
+ struct xmesa_st_framebuffer *xstfb = xmesa_st_framebuffer(stfbi);
+ boolean ret;
+
+ ret = xmesa_st_framebuffer_display(stfbi, statt);
+ if (ret)
+ xmesa_check_buffer_size(xstfb->buffer);
+
+ return ret;
+}
+
+struct st_framebuffer_iface *
+xmesa_create_st_framebuffer(XMesaDisplay xmdpy, XMesaBuffer b)
+{
+ struct st_framebuffer_iface *stfbi;
+ struct xmesa_st_framebuffer *xstfb;
+
+ assert(xmdpy->display == b->xm_visual->display);
+
+ stfbi = CALLOC_STRUCT(st_framebuffer_iface);
+ xstfb = CALLOC_STRUCT(xmesa_st_framebuffer);
+ if (!stfbi || !xstfb) {
+ if (stfbi)
+ FREE(stfbi);
+ if (xstfb)
+ FREE(xstfb);
+ return NULL;
+ }
+
+ xstfb->display = xmdpy;
+ xstfb->buffer = b;
+ xstfb->screen = xmdpy->screen;
+ xstfb->stvis = b->xm_visual->stvis;
+
+ stfbi->visual = &xstfb->stvis;
+ stfbi->flush_front = xmesa_st_framebuffer_flush_front;
+ stfbi->validate = xmesa_st_framebuffer_validate;
+ stfbi->st_manager_private = (void *) xstfb;
+
+ return stfbi;
+}
+
+void
+xmesa_destroy_st_framebuffer(struct st_framebuffer_iface *stfbi)
+{
+ struct xmesa_st_framebuffer *xstfb = xmesa_st_framebuffer(stfbi);
+ int i;
+
+ pipe_surface_reference(&xstfb->display_surface, NULL);
+
+ for (i = 0; i < ST_ATTACHMENT_COUNT; i++)
+ pipe_texture_reference(&xstfb->textures[i], NULL);
+
+ FREE(xstfb);
+ FREE(stfbi);
+}
+
+void
+xmesa_swap_st_framebuffer(struct st_framebuffer_iface *stfbi)
+{
+ struct xmesa_st_framebuffer *xstfb = xmesa_st_framebuffer(stfbi);
+ boolean ret;
+
+ ret = xmesa_st_framebuffer_display(stfbi, ST_ATTACHMENT_BACK_LEFT);
+ if (ret) {
+ struct pipe_texture **front, **back, *tmp;
+
+ front = &xstfb->textures[ST_ATTACHMENT_FRONT_LEFT];
+ back = &xstfb->textures[ST_ATTACHMENT_BACK_LEFT];
+ /* swap textures only if the front texture has been allocated */
+ if (*front) {
+ tmp = *front;
+ *front = *back;
+ *back = tmp;
+ }
+
+ xmesa_check_buffer_size(xstfb->buffer);
+ }
+}
+
+void
+xmesa_copy_st_framebuffer(struct st_framebuffer_iface *stfbi,
+ enum st_attachment_type src,
+ enum st_attachment_type dst,
+ int x, int y, int w, int h)
+{
+ xmesa_st_framebuffer_copy_textures(stfbi, src, dst, x, y, w, h);
+ if (dst == ST_ATTACHMENT_FRONT_LEFT)
+ xmesa_st_framebuffer_display(stfbi, dst);
+}
diff --git a/src/gallium/state_trackers/glx/xlib/xm_st.h b/src/gallium/state_trackers/glx/xlib/xm_st.h
new file mode 100644
index 0000000000..396495c189
--- /dev/null
+++ b/src/gallium/state_trackers/glx/xlib/xm_st.h
@@ -0,0 +1,51 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.9
+ *
+ * Copyright (C) 2010 LunarG Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Chia-I Wu <olv@lunarg.com>
+ */
+
+#ifndef _XM_ST_H_
+#define _XM_ST_H_
+
+#include "pipe/p_compiler.h"
+#include "state_tracker/st_api.h"
+
+#include "xm_api.h"
+
+struct st_framebuffer_iface *
+xmesa_create_st_framebuffer(XMesaDisplay xmdpy, XMesaBuffer b);
+
+void
+xmesa_destroy_st_framebuffer(struct st_framebuffer_iface *stfbi);
+
+void
+xmesa_swap_st_framebuffer(struct st_framebuffer_iface *stfbi);
+
+void
+xmesa_copy_st_framebuffer(struct st_framebuffer_iface *stfbi,
+ enum st_attachment_type src,
+ enum st_attachment_type dst,
+ int x, int y, int w, int h);
+
+#endif /* _XM_ST_H_ */
diff --git a/src/gallium/state_trackers/python/SConscript b/src/gallium/state_trackers/python/SConscript
index 527e065cd9..781f54bf2b 100644
--- a/src/gallium/state_trackers/python/SConscript
+++ b/src/gallium/state_trackers/python/SConscript
@@ -24,6 +24,7 @@ if 'python' in env['statetrackers']:
'ws2_32',
])
else:
+ env.Append(CPPDEFINES = ['GCC_HASCLASSVISIBILITY'])
env.Append(LIBS = [
'GL',
'X11',
@@ -33,31 +34,27 @@ if 'python' in env['statetrackers']:
'gallium.i',
'st_device.c',
'st_sample.c',
+ 'st_hardpipe_winsys.c',
+ 'st_softpipe_winsys.c',
]
- drivers = [
- trace
- ]
+ env.Prepend(LIBS = [
+ ws_null,
+ trace,
+ gallium,
+ ])
if 'llvmpipe' in env['drivers']:
+ env.Append(CPPDEFINES = ['HAVE_LLVMPIPE'])
env.Tool('llvm')
- sources += ['st_llvmpipe_winsys.c']
- drivers += [llvmpipe]
- else:
- sources += ['st_softpipe_winsys.c']
- drivers += [softpipe]
-
- pyst = env.ConvenienceLibrary(
- target = 'pyst',
- source = sources,
- )
+ env.Prepend(LIBS = [llvmpipe])
+ if 'softpipe' in env['drivers']:
+ env.Append(CPPDEFINES = ['HAVE_SOFTPIPE'])
+ env.Prepend(LIBS = [softpipe])
env['no_import_lib'] = 1
env.SharedLibrary(
target = '_gallium',
- source = [
- 'st_hardpipe_winsys.c',
- ],
- LIBS = [pyst] + drivers + gallium + env['LIBS'],
+ source = sources,
)
diff --git a/src/gallium/state_trackers/python/gallium.i b/src/gallium/state_trackers/python/gallium.i
index ffb084e358..aeed1cd118 100644
--- a/src/gallium/state_trackers/python/gallium.i
+++ b/src/gallium/state_trackers/python/gallium.i
@@ -49,6 +49,7 @@
#include "util/u_format.h"
#include "util/u_dump.h"
#include "util/u_memory.h"
+#include "util/u_sampler.h"
#include "cso_cache/cso_context.h"
#include "tgsi/tgsi_text.h"
#include "tgsi/tgsi_dump.h"
@@ -94,7 +95,7 @@
%include "p_compiler.i"
-%include "p_defines.h";
+%include "p_defines.h"
%include "p_format.h"
%include "p_device.i"
@@ -102,3 +103,4 @@
%include "p_texture.i"
%include "p_state.i"
+%include "u_format.i"
diff --git a/src/gallium/state_trackers/python/p_context.i b/src/gallium/state_trackers/python/p_context.i
index 3f36ccb621..02ce5647eb 100644
--- a/src/gallium/state_trackers/python/p_context.i
+++ b/src/gallium/state_trackers/python/p_context.i
@@ -51,7 +51,7 @@ struct st_context {
void set_blend( const struct pipe_blend_state *state ) {
cso_set_blend($self->cso, state);
}
-
+
void set_fragment_sampler( unsigned index, const struct pipe_sampler_state *state ) {
cso_single_sampler($self->cso, index, state);
cso_single_sampler_done($self->cso);
@@ -169,22 +169,39 @@ struct st_context {
void set_fragment_sampler_texture(unsigned index,
struct pipe_texture *texture) {
+ struct pipe_sampler_view templ;
+
if(!texture)
texture = $self->default_texture;
- pipe_texture_reference(&$self->fragment_sampler_textures[index], texture);
- $self->pipe->set_fragment_sampler_textures($self->pipe,
- PIPE_MAX_SAMPLERS,
- $self->fragment_sampler_textures);
+ pipe_sampler_view_reference(&$self->fragment_sampler_views[index], NULL);
+ u_sampler_view_default_template(&templ,
+ texture,
+ texture->format);
+ $self->fragment_sampler_views[index] = $self->pipe->create_sampler_view($self->pipe,
+ texture,
+ &templ);
+ $self->pipe->set_fragment_sampler_views($self->pipe,
+ PIPE_MAX_SAMPLERS,
+ $self->fragment_sampler_views);
}
void set_vertex_sampler_texture(unsigned index,
struct pipe_texture *texture) {
+ struct pipe_sampler_view templ;
+
if(!texture)
texture = $self->default_texture;
- pipe_texture_reference(&$self->vertex_sampler_textures[index], texture);
- $self->pipe->set_vertex_sampler_textures($self->pipe,
- PIPE_MAX_VERTEX_SAMPLERS,
- $self->vertex_sampler_textures);
+ pipe_sampler_view_reference(&$self->vertex_sampler_views[index], NULL);
+ u_sampler_view_default_template(&templ,
+ texture,
+ texture->format);
+ $self->vertex_sampler_views[index] = $self->pipe->create_sampler_view($self->pipe,
+ texture,
+ &templ);
+
+ $self->pipe->set_vertex_sampler_views($self->pipe,
+ PIPE_MAX_VERTEX_SAMPLERS,
+ $self->vertex_sampler_views);
}
void set_vertex_buffer(unsigned index,
@@ -222,9 +239,9 @@ struct st_context {
void set_vertex_elements(unsigned num)
{
$self->num_vertex_elements = num;
- $self->pipe->set_vertex_elements($self->pipe,
- $self->num_vertex_elements,
- $self->vertex_elements);
+ cso_set_vertex_elements($self->cso,
+ $self->num_vertex_elements,
+ $self->vertex_elements);
}
/*
@@ -263,8 +280,11 @@ struct st_context {
struct pipe_context *pipe = $self->pipe;
struct pipe_screen *screen = pipe->screen;
struct pipe_buffer *vbuf;
+ struct pipe_vertex_element velements[PIPE_MAX_ATTRIBS];
+ struct pipe_vertex_buffer vbuffer;
float *map;
unsigned size;
+ unsigned i;
size = num_verts * num_attribs * 4 * sizeof(float);
@@ -280,9 +300,31 @@ struct st_context {
goto error2;
memcpy(map, vertices, size);
pipe_buffer_unmap(screen, vbuf);
-
- util_draw_vertex_buffer(pipe, vbuf, 0, prim, num_verts, num_attribs);
-
+
+ cso_save_vertex_elements($self->cso);
+
+ /* tell pipe about the vertex attributes */
+ for (i = 0; i < num_attribs; i++) {
+ velements[i].src_offset = i * 4 * sizeof(float);
+ velements[i].instance_divisor = 0;
+ velements[i].vertex_buffer_index = 0;
+ velements[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+ }
+ cso_set_vertex_elements($self->cso, num_attribs, velements);
+
+ /* tell pipe about the vertex buffer */
+ memset(&vbuffer, 0, sizeof(vbuffer));
+ vbuffer.buffer = vbuf;
+ vbuffer.stride = num_attribs * 4 * sizeof(float); /* vertex size */
+ vbuffer.buffer_offset = 0;
+ vbuffer.max_index = num_verts - 1;
+ pipe->set_vertex_buffers(pipe, 1, &vbuffer);
+
+ /* draw */
+ pipe->draw_arrays(pipe, prim, 0, num_verts);
+
+ cso_restore_vertex_elements($self->cso);
+
error2:
pipe_buffer_reference(&vbuf, NULL);
error1:
@@ -290,6 +332,13 @@ error1:
}
void
+ clear(unsigned buffers, const float *rgba, double depth = 0.0f,
+ unsigned stencil = 0)
+ {
+ $self->pipe->clear($self->pipe, buffers, rgba, depth, stencil);
+ }
+
+ void
flush(unsigned flags = 0) {
struct pipe_fence_handle *fence = NULL;
$self->pipe->flush($self->pipe, flags | PIPE_FLUSH_RENDER_CACHE, &fence);
@@ -345,10 +394,254 @@ error1:
pipe_surface_reference(&_dst, NULL);
}
- void clear(unsigned buffers, const float *rgba, double depth = 0.0f,
- unsigned stencil = 0)
+ %cstring_output_allocate_size(char **STRING, int *LENGTH, free(*$1));
+ void
+ surface_read_raw(struct st_surface *surface,
+ unsigned x, unsigned y, unsigned w, unsigned h,
+ char **STRING, int *LENGTH)
{
- $self->pipe->clear($self->pipe, buffers, rgba, depth, stencil);
+ struct pipe_texture *texture = surface->texture;
+ struct pipe_context *pipe = $self->pipe;
+ struct pipe_transfer *transfer;
+ unsigned stride;
+
+ stride = util_format_get_stride(texture->format, w);
+ *LENGTH = util_format_get_nblocksy(texture->format, h) * stride;
+ *STRING = (char *) malloc(*LENGTH);
+ if(!*STRING)
+ return;
+
+ transfer = pipe->get_tex_transfer(pipe,
+ surface->texture,
+ surface->face,
+ surface->level,
+ surface->zslice,
+ PIPE_TRANSFER_READ,
+ x, y, w, h);
+ if(transfer) {
+ pipe_get_tile_raw(pipe, transfer, 0, 0, w, h, *STRING, stride);
+ pipe->tex_transfer_destroy(pipe, transfer);
+ }
+ }
+
+ %cstring_input_binary(const char *STRING, unsigned LENGTH);
+ void
+ surface_write_raw(struct st_surface *surface,
+ unsigned x, unsigned y, unsigned w, unsigned h,
+ const char *STRING, unsigned LENGTH, unsigned stride = 0)
+ {
+ struct pipe_texture *texture = surface->texture;
+ struct pipe_context *pipe = $self->pipe;
+ struct pipe_transfer *transfer;
+
+ if(stride == 0)
+ stride = util_format_get_stride(texture->format, w);
+
+ if(LENGTH < util_format_get_nblocksy(texture->format, h) * stride)
+ SWIG_exception(SWIG_ValueError, "offset must be smaller than buffer size");
+
+ transfer = pipe->get_tex_transfer(pipe,
+ surface->texture,
+ surface->face,
+ surface->level,
+ surface->zslice,
+ PIPE_TRANSFER_WRITE,
+ x, y, w, h);
+ if(!transfer)
+ SWIG_exception(SWIG_MemoryError, "couldn't initiate transfer");
+
+ pipe_put_tile_raw(pipe, transfer, 0, 0, w, h, STRING, stride);
+ pipe->tex_transfer_destroy(pipe, transfer);
+
+ fail:
+ return;
+ }
+
+ void
+ surface_read_rgba(struct st_surface *surface,
+ unsigned x, unsigned y, unsigned w, unsigned h,
+ float *rgba)
+ {
+ struct pipe_context *pipe = $self->pipe;
+ struct pipe_transfer *transfer;
+ transfer = pipe->get_tex_transfer(pipe,
+ surface->texture,
+ surface->face,
+ surface->level,
+ surface->zslice,
+ PIPE_TRANSFER_READ,
+ x, y, w, h);
+ if(transfer) {
+ pipe_get_tile_rgba(pipe, transfer, 0, 0, w, h, rgba);
+ pipe->tex_transfer_destroy(pipe, transfer);
+ }
+ }
+
+ void
+ surface_write_rgba(struct st_surface *surface,
+ unsigned x, unsigned y, unsigned w, unsigned h,
+ const float *rgba)
+ {
+ struct pipe_context *pipe = $self->pipe;
+ struct pipe_transfer *transfer;
+ transfer = pipe->get_tex_transfer(pipe,
+ surface->texture,
+ surface->face,
+ surface->level,
+ surface->zslice,
+ PIPE_TRANSFER_WRITE,
+ x, y, w, h);
+ if(transfer) {
+ pipe_put_tile_rgba(pipe, transfer, 0, 0, w, h, rgba);
+ pipe->tex_transfer_destroy(pipe, transfer);
+ }
+ }
+
+ %cstring_output_allocate_size(char **STRING, int *LENGTH, free(*$1));
+ void
+ surface_read_rgba8(struct st_surface *surface,
+ unsigned x, unsigned y, unsigned w, unsigned h,
+ char **STRING, int *LENGTH)
+ {
+ struct pipe_context *pipe = $self->pipe;
+ struct pipe_transfer *transfer;
+ float *rgba;
+ unsigned char *rgba8;
+ unsigned i, j, k;
+
+ *LENGTH = 0;
+ *STRING = NULL;
+
+ if (!surface)
+ return;
+
+ *LENGTH = h*w*4;
+ *STRING = (char *) malloc(*LENGTH);
+ if(!*STRING)
+ return;
+
+ rgba = malloc(h*w*4*sizeof(float));
+ if(!rgba)
+ return;
+
+ rgba8 = (unsigned char *) *STRING;
+
+ transfer = pipe->get_tex_transfer(pipe,
+ surface->texture,
+ surface->face,
+ surface->level,
+ surface->zslice,
+ PIPE_TRANSFER_READ,
+ x, y,
+ w, h);
+ if(transfer) {
+ pipe_get_tile_rgba(pipe, transfer, 0, 0, w, h, rgba);
+ for(j = 0; j < h; ++j) {
+ for(i = 0; i < w; ++i)
+ for(k = 0; k <4; ++k)
+ rgba8[j*w*4 + i*4 + k] = float_to_ubyte(rgba[j*w*4 + i*4 + k]);
+ }
+ pipe->tex_transfer_destroy(pipe, transfer);
+ }
+
+ free(rgba);
+ }
+
+ void
+ surface_read_z(struct st_surface *surface,
+ unsigned x, unsigned y, unsigned w, unsigned h,
+ unsigned *z)
+ {
+ struct pipe_context *pipe = $self->pipe;
+ struct pipe_transfer *transfer;
+ transfer = pipe->get_tex_transfer(pipe,
+ surface->texture,
+ surface->face,
+ surface->level,
+ surface->zslice,
+ PIPE_TRANSFER_READ,
+ x, y, w, h);
+ if(transfer) {
+ pipe_get_tile_z(pipe, transfer, 0, 0, w, h, z);
+ pipe->tex_transfer_destroy(pipe, transfer);
+ }
+ }
+
+ void
+ surface_write_z(struct st_surface *surface,
+ unsigned x, unsigned y, unsigned w, unsigned h,
+ const unsigned *z)
+ {
+ struct pipe_context *pipe = $self->pipe;
+ struct pipe_transfer *transfer;
+ transfer = pipe->get_tex_transfer(pipe,
+ surface->texture,
+ surface->face,
+ surface->level,
+ surface->zslice,
+ PIPE_TRANSFER_WRITE,
+ x, y, w, h);
+ if(transfer) {
+ pipe_put_tile_z(pipe, transfer, 0, 0, w, h, z);
+ pipe->tex_transfer_destroy(pipe, transfer);
+ }
+ }
+
+ void
+ surface_sample_rgba(struct st_surface *surface,
+ float *rgba,
+ int norm = 0)
+ {
+ st_sample_surface($self->pipe, surface, rgba, norm != 0);
+ }
+
+ unsigned
+ surface_compare_rgba(struct st_surface *surface,
+ unsigned x, unsigned y, unsigned w, unsigned h,
+ const float *rgba, float tol = 0.0)
+ {
+ struct pipe_context *pipe = $self->pipe;
+ struct pipe_transfer *transfer;
+ float *rgba2;
+ const float *p1;
+ const float *p2;
+ unsigned i, j, n;
+
+ rgba2 = MALLOC(h*w*4*sizeof(float));
+ if(!rgba2)
+ return ~0;
+
+ transfer = pipe->get_tex_transfer(pipe,
+ surface->texture,
+ surface->face,
+ surface->level,
+ surface->zslice,
+ PIPE_TRANSFER_READ,
+ x, y, w, h);
+ if(!transfer) {
+ FREE(rgba2);
+ return ~0;
+ }
+
+ pipe_get_tile_rgba(pipe, transfer, 0, 0, w, h, rgba2);
+ pipe->tex_transfer_destroy(pipe, transfer);
+
+ p1 = rgba;
+ p2 = rgba2;
+ n = 0;
+ for(i = h*w; i; --i) {
+ unsigned differs = 0;
+ for(j = 4; j; --j) {
+ float delta = *p2++ - *p1++;
+ if (delta < -tol || delta > tol)
+ differs = 1;
+ }
+ n += differs;
+ }
+
+ FREE(rgba2);
+
+ return n;
}
};
diff --git a/src/gallium/state_trackers/python/p_texture.i b/src/gallium/state_trackers/python/p_texture.i
index 761587dc53..923a628528 100644
--- a/src/gallium/state_trackers/python/p_texture.i
+++ b/src/gallium/state_trackers/python/p_texture.i
@@ -124,234 +124,6 @@ struct st_surface
FREE($self);
}
- %cstring_output_allocate_size(char **STRING, int *LENGTH, free(*$1));
- void get_tile_raw(unsigned x, unsigned y, unsigned w, unsigned h, char **STRING, int *LENGTH)
- {
- struct pipe_texture *texture = $self->texture;
- struct pipe_screen *screen = texture->screen;
- struct pipe_transfer *transfer;
- unsigned stride;
-
- stride = util_format_get_stride(texture->format, w);
- *LENGTH = util_format_get_nblocksy(texture->format, h) * stride;
- *STRING = (char *) malloc(*LENGTH);
- if(!*STRING)
- return;
-
- transfer = screen->get_tex_transfer(screen,
- $self->texture,
- $self->face,
- $self->level,
- $self->zslice,
- PIPE_TRANSFER_READ,
- x, y, w, h);
- if(transfer) {
- pipe_get_tile_raw(transfer, 0, 0, w, h, *STRING, stride);
- screen->tex_transfer_destroy(transfer);
- }
- }
-
- %cstring_input_binary(const char *STRING, unsigned LENGTH);
- void put_tile_raw(unsigned x, unsigned y, unsigned w, unsigned h, const char *STRING, unsigned LENGTH, unsigned stride = 0)
- {
- struct pipe_texture *texture = $self->texture;
- struct pipe_screen *screen = texture->screen;
- struct pipe_transfer *transfer;
-
- if(stride == 0)
- stride = util_format_get_stride(texture->format, w);
-
- if(LENGTH < util_format_get_nblocksy(texture->format, h) * stride)
- SWIG_exception(SWIG_ValueError, "offset must be smaller than buffer size");
-
- transfer = screen->get_tex_transfer(screen,
- $self->texture,
- $self->face,
- $self->level,
- $self->zslice,
- PIPE_TRANSFER_WRITE,
- x, y, w, h);
- if(!transfer)
- SWIG_exception(SWIG_MemoryError, "couldn't initiate transfer");
-
- pipe_put_tile_raw(transfer, 0, 0, w, h, STRING, stride);
- screen->tex_transfer_destroy(transfer);
-
- fail:
- return;
- }
-
- void
- get_tile_rgba(unsigned x, unsigned y, unsigned w, unsigned h, float *rgba)
- {
- struct pipe_screen *screen = $self->texture->screen;
- struct pipe_transfer *transfer;
- transfer = screen->get_tex_transfer(screen,
- $self->texture,
- $self->face,
- $self->level,
- $self->zslice,
- PIPE_TRANSFER_READ,
- x, y, w, h);
- if(transfer) {
- pipe_get_tile_rgba(transfer, 0, 0, w, h, rgba);
- screen->tex_transfer_destroy(transfer);
- }
- }
-
- void
- put_tile_rgba(unsigned x, unsigned y, unsigned w, unsigned h, const float *rgba)
- {
- struct pipe_screen *screen = $self->texture->screen;
- struct pipe_transfer *transfer;
- transfer = screen->get_tex_transfer(screen,
- $self->texture,
- $self->face,
- $self->level,
- $self->zslice,
- PIPE_TRANSFER_WRITE,
- x, y, w, h);
- if(transfer) {
- pipe_put_tile_rgba(transfer, 0, 0, w, h, rgba);
- screen->tex_transfer_destroy(transfer);
- }
- }
-
- %cstring_output_allocate_size(char **STRING, int *LENGTH, free(*$1));
- void
- get_tile_rgba8(unsigned x, unsigned y, unsigned w, unsigned h, char **STRING, int *LENGTH)
- {
- struct pipe_screen *screen = $self->texture->screen;
- struct pipe_transfer *transfer;
- float *rgba;
- unsigned char *rgba8;
- unsigned i, j, k;
-
- *LENGTH = 0;
- *STRING = NULL;
-
- if (!$self)
- return;
-
- *LENGTH = h*w*4;
- *STRING = (char *) malloc(*LENGTH);
- if(!*STRING)
- return;
-
- rgba = malloc(h*w*4*sizeof(float));
- if(!rgba)
- return;
-
- rgba8 = (unsigned char *) *STRING;
-
- transfer = screen->get_tex_transfer(screen,
- $self->texture,
- $self->face,
- $self->level,
- $self->zslice,
- PIPE_TRANSFER_READ,
- x, y,
- w, h);
- if(transfer) {
- pipe_get_tile_rgba(transfer, 0, 0, w, h, rgba);
- for(j = 0; j < h; ++j) {
- for(i = 0; i < w; ++i)
- for(k = 0; k <4; ++k)
- rgba8[j*w*4 + i*4 + k] = float_to_ubyte(rgba[j*w*4 + i*4 + k]);
- }
- screen->tex_transfer_destroy(transfer);
- }
-
- free(rgba);
- }
-
- void
- get_tile_z(unsigned x, unsigned y, unsigned w, unsigned h, unsigned *z)
- {
- struct pipe_screen *screen = $self->texture->screen;
- struct pipe_transfer *transfer;
- transfer = screen->get_tex_transfer(screen,
- $self->texture,
- $self->face,
- $self->level,
- $self->zslice,
- PIPE_TRANSFER_READ,
- x, y, w, h);
- if(transfer) {
- pipe_get_tile_z(transfer, 0, 0, w, h, z);
- screen->tex_transfer_destroy(transfer);
- }
- }
-
- void
- put_tile_z(unsigned x, unsigned y, unsigned w, unsigned h, const unsigned *z)
- {
- struct pipe_screen *screen = $self->texture->screen;
- struct pipe_transfer *transfer;
- transfer = screen->get_tex_transfer(screen,
- $self->texture,
- $self->face,
- $self->level,
- $self->zslice,
- PIPE_TRANSFER_WRITE,
- x, y, w, h);
- if(transfer) {
- pipe_put_tile_z(transfer, 0, 0, w, h, z);
- screen->tex_transfer_destroy(transfer);
- }
- }
-
- void
- sample_rgba(float *rgba) {
- st_sample_surface($self, rgba);
- }
-
- unsigned
- compare_tile_rgba(unsigned x, unsigned y, unsigned w, unsigned h, const float *rgba, float tol = 0.0)
- {
- struct pipe_screen *screen = $self->texture->screen;
- struct pipe_transfer *transfer;
- float *rgba2;
- const float *p1;
- const float *p2;
- unsigned i, j, n;
-
- rgba2 = MALLOC(h*w*4*sizeof(float));
- if(!rgba2)
- return ~0;
-
- transfer = screen->get_tex_transfer(screen,
- $self->texture,
- $self->face,
- $self->level,
- $self->zslice,
- PIPE_TRANSFER_READ,
- x, y, w, h);
- if(!transfer) {
- FREE(rgba2);
- return ~0;
- }
-
- pipe_get_tile_rgba(transfer, 0, 0, w, h, rgba2);
- screen->tex_transfer_destroy(transfer);
-
- p1 = rgba;
- p2 = rgba2;
- n = 0;
- for(i = h*w; i; --i) {
- unsigned differs = 0;
- for(j = 4; j; --j) {
- float delta = *p2++ - *p1++;
- if (delta < -tol || delta > tol)
- differs = 1;
- }
- n += differs;
- }
-
- FREE(rgba2);
-
- return n;
- }
};
diff --git a/src/gallium/state_trackers/python/st_device.c b/src/gallium/state_trackers/python/st_device.c
index 45e7841750..4f227a092c 100644
--- a/src/gallium/state_trackers/python/st_device.c
+++ b/src/gallium/state_trackers/python/st_device.c
@@ -31,11 +31,12 @@
#include "pipe/p_shader_tokens.h"
#include "util/u_inlines.h"
#include "cso_cache/cso_context.h"
+#include "util/u_inlines.h"
#include "util/u_math.h"
#include "util/u_memory.h"
+#include "util/u_sampler.h"
#include "util/u_simple_shaders.h"
-#include "trace/tr_screen.h"
-#include "trace/tr_context.h"
+#include "trace/tr_public.h"
#include "st_device.h"
#include "st_winsys.h"
@@ -75,43 +76,34 @@ st_device_destroy(struct st_device *st_dev)
}
-static struct st_device *
-st_device_create_from_st_winsys(const struct st_winsys *st_ws)
+struct st_device *
+st_device_create(boolean hardware)
{
+ struct pipe_screen *screen;
struct st_device *st_dev;
-
- if(!st_ws->screen_create)
- return NULL;
-
+
+ if (hardware)
+ screen = st_hardware_screen_create();
+ else
+ screen = st_software_screen_create("softpipe");
+
+ screen = trace_screen_create(screen);
+ if (!screen)
+ goto no_screen;
+
st_dev = CALLOC_STRUCT(st_device);
- if(!st_dev)
- return NULL;
+ if (!st_dev)
+ goto no_device;
pipe_reference_init(&st_dev->reference, 1);
- st_dev->st_ws = st_ws;
-
- st_dev->real_screen = st_ws->screen_create();
- if(!st_dev->real_screen) {
- st_device_destroy(st_dev);
- return NULL;
- }
-
- st_dev->screen = trace_screen_create(st_dev->real_screen);
- if(!st_dev->screen) {
- st_device_destroy(st_dev);
- return NULL;
- }
+ st_dev->screen = screen;
return st_dev;
-}
-
-struct st_device *
-st_device_create(boolean hardware) {
- if(hardware)
- return st_device_create_from_st_winsys(&st_hardpipe_winsys);
- else
- return st_device_create_from_st_winsys(&st_softpipe_winsys);
+no_device:
+ screen->destroy(screen);
+no_screen:
+ return NULL;
}
@@ -134,9 +126,9 @@ st_context_destroy(struct st_context *st_ctx)
st_ctx->pipe->destroy(st_ctx->pipe);
for(i = 0; i < PIPE_MAX_SAMPLERS; ++i)
- pipe_texture_reference(&st_ctx->fragment_sampler_textures[i], NULL);
+ pipe_sampler_view_reference(&st_ctx->fragment_sampler_views[i], NULL);
for(i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; ++i)
- pipe_texture_reference(&st_ctx->vertex_sampler_textures[i], NULL);
+ pipe_sampler_view_reference(&st_ctx->vertex_sampler_views[i], NULL);
pipe_texture_reference(&st_ctx->default_texture, NULL);
FREE(st_ctx);
@@ -237,9 +229,12 @@ st_context_create(struct st_device *st_dev)
/* default textures */
{
+ struct pipe_context *pipe = st_ctx->pipe;
struct pipe_screen *screen = st_dev->screen;
struct pipe_texture templat;
struct pipe_transfer *transfer;
+ struct pipe_sampler_view view_templ;
+ struct pipe_sampler_view *view;
unsigned i;
memset( &templat, 0, sizeof( templat ) );
@@ -252,31 +247,44 @@ st_context_create(struct st_device *st_dev)
st_ctx->default_texture = screen->texture_create( screen, &templat );
if(st_ctx->default_texture) {
- transfer = screen->get_tex_transfer(screen,
- st_ctx->default_texture,
- 0, 0, 0,
- PIPE_TRANSFER_WRITE,
- 0, 0,
- st_ctx->default_texture->width0,
- st_ctx->default_texture->height0);
+ transfer = pipe->get_tex_transfer(pipe,
+ st_ctx->default_texture,
+ 0, 0, 0,
+ PIPE_TRANSFER_WRITE,
+ 0, 0,
+ st_ctx->default_texture->width0,
+ st_ctx->default_texture->height0);
if (transfer) {
uint32_t *map;
- map = (uint32_t *) screen->transfer_map(screen, transfer);
+ map = (uint32_t *) pipe->transfer_map(pipe, transfer);
if(map) {
*map = 0x00000000;
- screen->transfer_unmap(screen, transfer);
+ pipe->transfer_unmap(pipe, transfer);
}
- screen->tex_transfer_destroy(transfer);
+ pipe->tex_transfer_destroy(pipe, transfer);
}
}
-
+
+ u_sampler_view_default_template(&view_templ,
+ st_ctx->default_texture,
+ st_ctx->default_texture->format);
+ view = st_ctx->pipe->create_sampler_view(st_ctx->pipe,
+ st_ctx->default_texture,
+ &view_templ);
+
for (i = 0; i < PIPE_MAX_SAMPLERS; i++)
- pipe_texture_reference(&st_ctx->fragment_sampler_textures[i], st_ctx->default_texture);
+ pipe_sampler_view_reference(&st_ctx->fragment_sampler_views[i], view);
for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++)
- pipe_texture_reference(&st_ctx->vertex_sampler_textures[i], st_ctx->default_texture);
-
- cso_set_sampler_textures(st_ctx->cso, PIPE_MAX_SAMPLERS, st_ctx->fragment_sampler_textures);
- cso_set_vertex_sampler_textures(st_ctx->cso, PIPE_MAX_VERTEX_SAMPLERS, st_ctx->vertex_sampler_textures);
+ pipe_sampler_view_reference(&st_ctx->vertex_sampler_views[i], view);
+
+ st_ctx->pipe->set_fragment_sampler_views(st_ctx->pipe,
+ PIPE_MAX_SAMPLERS,
+ st_ctx->fragment_sampler_views);
+ st_ctx->pipe->set_vertex_sampler_views(st_ctx->pipe,
+ PIPE_MAX_VERTEX_SAMPLERS,
+ st_ctx->vertex_sampler_views);
+
+ pipe_sampler_view_reference(&view, NULL);
}
/* vertex shader */
diff --git a/src/gallium/state_trackers/python/st_device.h b/src/gallium/state_trackers/python/st_device.h
index de9e0215d8..dcd0dc6e27 100644
--- a/src/gallium/state_trackers/python/st_device.h
+++ b/src/gallium/state_trackers/python/st_device.h
@@ -47,7 +47,8 @@ struct st_surface
};
-struct st_context {
+struct st_context
+{
struct st_device *st_dev;
struct pipe_context *pipe;
@@ -59,8 +60,8 @@ struct st_context {
void *gs;
struct pipe_texture *default_texture;
- struct pipe_texture *fragment_sampler_textures[PIPE_MAX_SAMPLERS];
- struct pipe_texture *vertex_sampler_textures[PIPE_MAX_VERTEX_SAMPLERS];
+ struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS];
+ struct pipe_sampler_view *vertex_sampler_views[PIPE_MAX_VERTEX_SAMPLERS];
unsigned num_vertex_buffers;
struct pipe_vertex_buffer vertex_buffers[PIPE_MAX_ATTRIBS];
@@ -72,13 +73,11 @@ struct st_context {
};
-struct st_device {
+struct st_device
+{
/* FIXME: we also need to refcount for textures and surfaces... */
struct pipe_reference reference;
- const struct st_winsys *st_ws;
-
- struct pipe_screen *real_screen;
struct pipe_screen *screen;
};
diff --git a/src/gallium/state_trackers/python/st_hardpipe_winsys.c b/src/gallium/state_trackers/python/st_hardpipe_winsys.c
index a3110a19d5..c6743dbd9c 100644
--- a/src/gallium/state_trackers/python/st_hardpipe_winsys.c
+++ b/src/gallium/state_trackers/python/st_hardpipe_winsys.c
@@ -54,11 +54,6 @@ static PFNGETGALLIUMSCREENMESAPROC pfnGetGalliumScreenMESA = NULL;
static PFNCREATEGALLIUMCONTEXTMESAPROC pfnCreateGalliumContextMESA = NULL;
-/* XXX: Force init_gallium symbol to be linked */
-extern void init_gallium(void);
-void (*force_init_gallium_linkage)(void) = &init_gallium;
-
-
#ifdef PIPE_OS_WINDOWS
static INLINE boolean
@@ -207,16 +202,11 @@ st_hardpipe_load(void)
#endif
-static struct pipe_screen *
-st_hardpipe_screen_create(void)
+struct pipe_screen *
+st_hardware_screen_create(void)
{
if(st_hardpipe_load())
return pfnGetGalliumScreenMESA();
else
- return st_softpipe_winsys.screen_create();
+ return st_software_screen_create(NULL);
}
-
-
-const struct st_winsys st_hardpipe_winsys = {
- &st_hardpipe_screen_create
-};
diff --git a/src/gallium/state_trackers/python/st_llvmpipe_winsys.c b/src/gallium/state_trackers/python/st_llvmpipe_winsys.c
deleted file mode 100644
index 5d83b5a9e1..0000000000
--- a/src/gallium/state_trackers/python/st_llvmpipe_winsys.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2010 VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- *
- **************************************************************************/
-
-/**
- * @file
- * Llvmpipe support.
- *
- * @author Jose Fonseca
- */
-
-
-#include "pipe/p_format.h"
-#include "pipe/p_context.h"
-#include "util/u_inlines.h"
-#include "util/u_math.h"
-#include "util/u_memory.h"
-#include "llvmpipe/lp_winsys.h"
-#include "st_winsys.h"
-
-
-static boolean
-llvmpipe_ws_is_displaytarget_format_supported( struct llvmpipe_winsys *ws,
- enum pipe_format format )
-{
- return FALSE;
-}
-
-
-static void *
-llvmpipe_ws_displaytarget_map(struct llvmpipe_winsys *ws,
- struct llvmpipe_displaytarget *dt,
- unsigned flags )
-{
- assert(0);
- return NULL;
-}
-
-
-static void
-llvmpipe_ws_displaytarget_unmap(struct llvmpipe_winsys *ws,
- struct llvmpipe_displaytarget *dt )
-{
- assert(0);
-}
-
-
-static void
-llvmpipe_ws_displaytarget_destroy(struct llvmpipe_winsys *winsys,
- struct llvmpipe_displaytarget *dt)
-{
- assert(0);
-}
-
-
-static struct llvmpipe_displaytarget *
-llvmpipe_ws_displaytarget_create(struct llvmpipe_winsys *winsys,
- enum pipe_format format,
- unsigned width, unsigned height,
- unsigned alignment,
- unsigned *stride)
-{
- return NULL;
-}
-
-
-static void
-llvmpipe_ws_displaytarget_display(struct llvmpipe_winsys *winsys,
- struct llvmpipe_displaytarget *dt,
- void *context_private)
-{
- assert(0);
-}
-
-
-static void
-llvmpipe_ws_destroy(struct llvmpipe_winsys *winsys)
-{
- FREE(winsys);
-}
-
-
-static struct pipe_screen *
-st_llvmpipe_screen_create(void)
-{
- static struct llvmpipe_winsys *winsys;
- struct pipe_screen *screen;
-
- winsys = CALLOC_STRUCT(llvmpipe_winsys);
- if (!winsys)
- goto no_winsys;
-
- winsys->destroy = llvmpipe_ws_destroy;
- winsys->is_displaytarget_format_supported = llvmpipe_ws_is_displaytarget_format_supported;
- winsys->displaytarget_create = llvmpipe_ws_displaytarget_create;
- winsys->displaytarget_map = llvmpipe_ws_displaytarget_map;
- winsys->displaytarget_unmap = llvmpipe_ws_displaytarget_unmap;
- winsys->displaytarget_display = llvmpipe_ws_displaytarget_display;
- winsys->displaytarget_destroy = llvmpipe_ws_displaytarget_destroy;
-
- screen = llvmpipe_create_screen(winsys);
- if (!screen)
- goto no_screen;
-
- return screen;
-
-no_screen:
- FREE(winsys);
-no_winsys:
- return NULL;
-}
-
-
-
-const struct st_winsys st_softpipe_winsys = {
- &st_llvmpipe_screen_create
-};
diff --git a/src/gallium/state_trackers/python/st_sample.c b/src/gallium/state_trackers/python/st_sample.c
index e180815346..218a77fb0a 100644
--- a/src/gallium/state_trackers/python/st_sample.c
+++ b/src/gallium/state_trackers/python/st_sample.c
@@ -50,7 +50,7 @@ static uint32_t st_random(void) {
seed = UINT64_C(134775813) * seed + UINT64_C(1);
- return (uint16_t)(seed >> 32);
+ return (uint32_t)(seed >> 32);
}
@@ -470,25 +470,42 @@ static INLINE void
st_sample_generic_pixel_block(enum pipe_format format,
uint8_t *raw,
float *rgba, unsigned rgba_stride,
- unsigned w, unsigned h)
+ unsigned w, unsigned h,
+ boolean norm)
{
unsigned i;
unsigned x, y, ch;
int blocksize = util_format_get_blocksize(format);
- for(i = 0; i < blocksize; ++i)
- raw[i] = (uint8_t)st_random();
-
-
- pipe_tile_raw_to_rgba(format,
- raw,
- w, h,
- rgba, rgba_stride);
-
- if(format == PIPE_FORMAT_UYVY || format == PIPE_FORMAT_YUYV) {
- for(y = 0; y < h; ++y) {
- for(x = 0; x < w; ++x) {
- for(ch = 0; ch < 4; ++ch) {
+ if (norm) {
+ for (y = 0; y < h; ++y) {
+ for (x = 0; x < w; ++x) {
+ for (ch = 0; ch < 4; ++ch) {
+ unsigned offset = y*rgba_stride + x*4 + ch;
+ rgba[offset] = (st_random() & 0xff) / (double)0xff;
+ }
+ }
+ }
+
+ util_format_write_4f(format,
+ rgba, rgba_stride * sizeof(float),
+ raw, util_format_get_stride(format, w),
+ 0, 0, w, h);
+
+ } else {
+ for (i = 0; i < blocksize; ++i)
+ raw[i] = (uint8_t)st_random();
+ }
+
+ util_format_read_4f(format,
+ rgba, rgba_stride * sizeof(float),
+ raw, util_format_get_stride(format, w),
+ 0, 0, w, h);
+
+ if (format == PIPE_FORMAT_UYVY || format == PIPE_FORMAT_YUYV) {
+ for (y = 0; y < h; ++y) {
+ for (x = 0; x < w; ++x) {
+ for (ch = 0; ch < 4; ++ch) {
unsigned offset = y*rgba_stride + x*4 + ch;
rgba[offset] = CLAMP(rgba[offset], 0.0f, 1.0f);
}
@@ -505,7 +522,8 @@ void
st_sample_pixel_block(enum pipe_format format,
void *raw,
float *rgba, unsigned rgba_stride,
- unsigned w, unsigned h)
+ unsigned w, unsigned h,
+ boolean norm)
{
switch(format) {
case PIPE_FORMAT_DXT1_RGB:
@@ -516,36 +534,38 @@ st_sample_pixel_block(enum pipe_format format,
break;
default:
- st_sample_generic_pixel_block(format, raw, rgba, rgba_stride, w, h);
+ st_sample_generic_pixel_block(format, raw, rgba, rgba_stride, w, h, norm);
break;
}
}
void
-st_sample_surface(struct st_surface *surface, float *rgba)
+st_sample_surface(struct pipe_context *pipe,
+ struct st_surface *surface,
+ float *rgba,
+ boolean norm)
{
struct pipe_texture *texture = surface->texture;
- struct pipe_screen *screen = texture->screen;
unsigned width = u_minify(texture->width0, surface->level);
unsigned height = u_minify(texture->height0, surface->level);
uint rgba_stride = width * 4;
struct pipe_transfer *transfer;
void *raw;
- transfer = screen->get_tex_transfer(screen,
- surface->texture,
- surface->face,
- surface->level,
- surface->zslice,
- PIPE_TRANSFER_WRITE,
- 0, 0,
- width,
- height);
+ transfer = pipe->get_tex_transfer(pipe,
+ surface->texture,
+ surface->face,
+ surface->level,
+ surface->zslice,
+ PIPE_TRANSFER_WRITE,
+ 0, 0,
+ width,
+ height);
if (!transfer)
return;
- raw = screen->transfer_map(screen, transfer);
+ raw = pipe->transfer_map(pipe, transfer);
if (raw) {
enum pipe_format format = texture->format;
uint x, y;
@@ -563,12 +583,13 @@ st_sample_surface(struct st_surface *surface, float *rgba)
rgba + y * blockheight * rgba_stride + x * blockwidth * 4,
rgba_stride,
MIN2(blockwidth, width - x*blockwidth),
- MIN2(blockheight, height - y*blockheight));
+ MIN2(blockheight, height - y*blockheight),
+ norm);
}
}
- screen->transfer_unmap(screen, transfer);
+ pipe->transfer_unmap(pipe, transfer);
}
- screen->tex_transfer_destroy(transfer);
+ pipe->tex_transfer_destroy(pipe, transfer);
}
diff --git a/src/gallium/state_trackers/python/st_sample.h b/src/gallium/state_trackers/python/st_sample.h
index 888114d302..2fdbb391f3 100644
--- a/src/gallium/state_trackers/python/st_sample.h
+++ b/src/gallium/state_trackers/python/st_sample.h
@@ -32,15 +32,22 @@
#include "pipe/p_format.h"
+struct pipe_context;
+struct st_surface;
+
void
st_sample_pixel_block(enum pipe_format format,
void *raw,
float *rgba, unsigned rgba_stride,
- unsigned w, unsigned h);
+ unsigned w, unsigned h,
+ boolean norm);
void
-st_sample_surface(struct st_surface *surface, float *rgba);
+st_sample_surface(struct pipe_context *pipe,
+ struct st_surface *surface,
+ float *rgba,
+ boolean norm);
#endif /* ST_SAMPLE_H_ */
diff --git a/src/gallium/state_trackers/python/st_softpipe_winsys.c b/src/gallium/state_trackers/python/st_softpipe_winsys.c
index 81676bc3a4..8584bad467 100644
--- a/src/gallium/state_trackers/python/st_softpipe_winsys.c
+++ b/src/gallium/state_trackers/python/st_softpipe_winsys.c
@@ -26,18 +26,53 @@
*
**************************************************************************/
-/**
- * @file
- * Softpipe support.
- *
- * @author Keith Whitwell
- * @author Brian Paul
- * @author Jose Fonseca
- */
-
-#include "softpipe/sp_winsys.h"
+#include "util/u_debug.h"
+#include "softpipe/sp_public.h"
+#include "llvmpipe/lp_public.h"
+#include "state_tracker/sw_winsys.h"
+#include "sw/null/null_sw_winsys.h"
#include "st_winsys.h"
-const struct st_winsys st_softpipe_winsys = {
- &softpipe_create_screen_malloc
-};
+
+struct pipe_screen *
+st_software_screen_create(const char *driver)
+{
+ struct sw_winsys *ws;
+ struct pipe_screen *screen = NULL;
+
+ if (!driver) {
+ const char *default_driver;
+
+#if defined(HAVE_LLVMPIPE)
+ default_driver = "llvmpipe";
+#elif defined(HAVE_SOFTPIPE)
+ default_driver = "softpipe";
+#else
+ default_driver = "";
+#endif
+
+ driver = debug_get_option("GALLIUM_DRIVER", default_driver);
+ }
+
+ ws = null_sw_create();
+ if(!ws)
+ return NULL;
+
+#ifdef HAVE_LLVMPIPE
+ if (strcmp(driver, "llvmpipe") == 0) {
+ screen = llvmpipe_create_screen(ws);
+ }
+#endif
+
+#ifdef HAVE_SOFTPIPE
+ if (strcmp(driver, "softpipe") == 0) {
+ screen = softpipe_create_screen(ws);
+ }
+#endif
+
+ if (!screen) {
+ ws->destroy(ws);
+ }
+
+ return screen;
+}
diff --git a/src/gallium/state_trackers/python/st_winsys.h b/src/gallium/state_trackers/python/st_winsys.h
index 0c7b6a200e..7d4066d947 100644
--- a/src/gallium/state_trackers/python/st_winsys.h
+++ b/src/gallium/state_trackers/python/st_winsys.h
@@ -31,19 +31,13 @@
struct pipe_screen;
-struct pipe_context;
-struct st_winsys
-{
- struct pipe_screen *
- (*screen_create)(void);
-};
+struct pipe_screen *
+st_hardware_screen_create(void);
-
-extern const struct st_winsys st_softpipe_winsys;
-
-extern const struct st_winsys st_hardpipe_winsys;
+struct pipe_screen *
+st_software_screen_create(const char *driver);
#endif /* ST_WINSYS_H_ */
diff --git a/src/gallium/state_trackers/python/u_format.i b/src/gallium/state_trackers/python/u_format.i
new file mode 100644
index 0000000000..2184b42084
--- /dev/null
+++ b/src/gallium/state_trackers/python/u_format.i
@@ -0,0 +1,88 @@
+/**************************************************************************
+ *
+ * Copyright 2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ **************************************************************************/
+
+
+static INLINE const char *
+util_format_name(enum pipe_format format);
+
+static INLINE boolean
+util_format_is_s3tc(enum pipe_format format);
+
+static INLINE boolean
+util_format_is_depth_or_stencil(enum pipe_format format);
+
+static INLINE boolean
+util_format_is_depth_and_stencil(enum pipe_format format);
+
+
+uint
+util_format_get_blocksizebits(enum pipe_format format);
+
+uint
+util_format_get_blocksize(enum pipe_format format);
+
+uint
+util_format_get_blockwidth(enum pipe_format format);
+
+uint
+util_format_get_blockheight(enum pipe_format format);
+
+unsigned
+util_format_get_nblocksx(enum pipe_format format,
+ unsigned x);
+
+unsigned
+util_format_get_nblocksy(enum pipe_format format,
+ unsigned y);
+
+unsigned
+util_format_get_nblocks(enum pipe_format format,
+ unsigned width,
+ unsigned height);
+
+size_t
+util_format_get_stride(enum pipe_format format,
+ unsigned width);
+
+size_t
+util_format_get_2d_size(enum pipe_format format,
+ size_t stride,
+ unsigned height);
+
+uint
+util_format_get_component_bits(enum pipe_format format,
+ enum util_format_colorspace colorspace,
+ uint component);
+
+boolean
+util_format_has_alpha(enum pipe_format format);
+
+
+unsigned
+util_format_get_nr_components(enum pipe_format format);
+
+
diff --git a/src/gallium/state_trackers/vega/Makefile b/src/gallium/state_trackers/vega/Makefile
index f6d1ea029c..8b5a31cf31 100644
--- a/src/gallium/state_trackers/vega/Makefile
+++ b/src/gallium/state_trackers/vega/Makefile
@@ -25,6 +25,7 @@ VG_SOURCES = \
api_transform.c \
vgu.c \
vg_context.c \
+ vg_manager.c \
vg_state.c \
vg_tracker.c \
vg_translate.c \
@@ -54,7 +55,7 @@ INCLUDE_DIRS = \
.c.o:
- $(CC) -c $(INCLUDE_DIRS) $(DEFINES) $(CFLAGS) $< -o $@
+ $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
default: depend $(TOP)/$(LIB_DIR)/$(VG_LIB_NAME)
diff --git a/src/gallium/state_trackers/vega/api_context.c b/src/gallium/state_trackers/vega/api_context.c
index 47db102dd2..eb2fbe26e7 100644
--- a/src/gallium/state_trackers/vega/api_context.c
+++ b/src/gallium/state_trackers/vega/api_context.c
@@ -26,6 +26,7 @@
#include "VG/openvg.h"
+#include "vg_manager.h"
#include "vg_context.h"
#include "pipe/p_context.h"
@@ -55,6 +56,8 @@ void vgFlush(void)
pipe = ctx->pipe;
pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
+
+ vg_manager_flush_frontbuffer(ctx);
}
void vgFinish(void)
diff --git a/src/gallium/state_trackers/vega/api_filters.c b/src/gallium/state_trackers/vega/api_filters.c
index 02248ad433..a643f38624 100644
--- a/src/gallium/state_trackers/vega/api_filters.c
+++ b/src/gallium/state_trackers/vega/api_filters.c
@@ -40,6 +40,7 @@
#include "util/u_format.h"
#include "util/u_memory.h"
+#include "util/u_sampler.h"
#include "asm_filters.h"
@@ -53,7 +54,7 @@ struct filter_info {
const void *const_buffer;
VGint const_buffer_len;
VGTilingMode tiling_mode;
- struct pipe_texture *extra_texture;
+ struct pipe_sampler_view *extra_texture_view;
};
static INLINE struct pipe_texture *create_texture_1d(struct vg_context *ctx,
@@ -78,26 +79,48 @@ static INLINE struct pipe_texture *create_texture_1d(struct vg_context *ctx,
{ /* upload color_data */
struct pipe_transfer *transfer =
- screen->get_tex_transfer(screen, tex,
- 0, 0, 0,
- PIPE_TRANSFER_READ_WRITE ,
- 0, 0, tex->width0, tex->height0);
- void *map = screen->transfer_map(screen, transfer);
+ pipe->get_tex_transfer(pipe, tex,
+ 0, 0, 0,
+ PIPE_TRANSFER_READ_WRITE ,
+ 0, 0, tex->width0, tex->height0);
+ void *map = pipe->transfer_map(pipe, transfer);
memcpy(map, color_data, sizeof(VGint)*color_data_len);
- screen->transfer_unmap(screen, transfer);
- screen->tex_transfer_destroy(transfer);
+ pipe->transfer_unmap(pipe, transfer);
+ pipe->tex_transfer_destroy(pipe, transfer);
}
return tex;
}
+static INLINE struct pipe_sampler_view *create_texture_1d_view(struct vg_context *ctx,
+ const VGuint *color_data,
+ const VGint color_data_len)
+{
+ struct pipe_context *pipe = ctx->pipe;
+ struct pipe_texture *texture;
+ struct pipe_sampler_view view_templ;
+ struct pipe_sampler_view *view;
+
+ texture = create_texture_1d(ctx, color_data, color_data_len);
+
+ if (!texture)
+ return NULL;
+
+ u_sampler_view_default_template(&view_templ, texture, texture->format);
+ view = pipe->create_sampler_view(pipe, texture, &view_templ);
+ /* want the texture to go away if the view is freed */
+ pipe_texture_reference(&texture, NULL);
+
+ return view;
+}
+
static INLINE struct pipe_surface * setup_framebuffer(struct vg_image *dst)
{
struct vg_context *ctx = vg_current_context();
struct pipe_context *pipe = ctx->pipe;
struct pipe_framebuffer_state fb;
struct pipe_surface *dst_surf = pipe->screen->get_tex_surface(
- pipe->screen, dst->texture, 0, 0, 0,
+ pipe->screen, dst->sampler_view->texture, 0, 0, 0,
PIPE_BUFFER_USAGE_GPU_WRITE);
/* drawing dest */
@@ -168,7 +191,7 @@ static void setup_constant_buffer(struct vg_context *ctx, const void *buffer,
static void setup_samplers(struct vg_context *ctx, struct filter_info *info)
{
struct pipe_sampler_state *samplers[PIPE_MAX_SAMPLERS];
- struct pipe_texture *textures[PIPE_MAX_SAMPLERS];
+ struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS];
struct pipe_sampler_state sampler[3];
int num_samplers = 0;
int num_textures = 0;
@@ -177,10 +200,10 @@ static void setup_samplers(struct vg_context *ctx, struct filter_info *info)
samplers[1] = NULL;
samplers[2] = NULL;
samplers[3] = NULL;
- textures[0] = NULL;
- textures[1] = NULL;
- textures[2] = NULL;
- textures[3] = NULL;
+ sampler_views[0] = NULL;
+ sampler_views[1] = NULL;
+ sampler_views[2] = NULL;
+ sampler_views[3] = NULL;
memset(&sampler[0], 0, sizeof(struct pipe_sampler_state));
sampler[0].wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
@@ -215,21 +238,21 @@ static void setup_samplers(struct vg_context *ctx, struct filter_info *info)
}
samplers[0] = &sampler[0];
- textures[0] = info->src->texture;
+ sampler_views[0] = info->src->sampler_view;
++num_samplers;
++num_textures;
- if (info->extra_texture) {
+ if (info->extra_texture_view) {
memcpy(&sampler[1], &sampler[0], sizeof(struct pipe_sampler_state));
samplers[1] = &sampler[1];
- textures[1] = info->extra_texture;
+ sampler_views[1] = info->extra_texture_view;
++num_samplers;
++num_textures;
}
cso_set_samplers(ctx->cso_context, num_samplers, (const struct pipe_sampler_state **)samplers);
- cso_set_sampler_textures(ctx->cso_context, num_textures, textures);
+ cso_set_fragment_sampler_views(ctx->cso_context, num_textures, sampler_views);
}
static struct vg_shader * setup_color_matrix(struct vg_context *ctx, void *user_data)
@@ -308,7 +331,7 @@ static void execute_filter(struct vg_context *ctx,
cso_save_viewport(ctx->cso_context);
cso_save_blend(ctx->cso_context);
cso_save_samplers(ctx->cso_context);
- cso_save_sampler_textures(ctx->cso_context);
+ cso_save_fragment_sampler_views(ctx->cso_context);
dst_surf = setup_framebuffer(info->dst);
setup_viewport(info->dst);
@@ -318,7 +341,7 @@ static void execute_filter(struct vg_context *ctx,
setup_samplers(ctx, info);
renderer_draw_texture(ctx->renderer,
- info->src->texture,
+ info->src->sampler_view->texture,
info->dst->x, info->dst->y,
info->dst->x + info->dst->width,
info->dst->y + info->dst->height,
@@ -331,7 +354,7 @@ static void execute_filter(struct vg_context *ctx,
cso_restore_viewport(ctx->cso_context);
cso_restore_blend(ctx->cso_context);
cso_restore_samplers(ctx->cso_context);
- cso_restore_sampler_textures(ctx->cso_context);
+ cso_restore_fragment_sampler_views(ctx->cso_context);
vg_shader_destroy(ctx, shader);
@@ -369,7 +392,7 @@ void vgColorMatrix(VGImage dst, VGImage src,
info.const_buffer = matrix;
info.const_buffer_len = 20 * sizeof(VGfloat);
info.tiling_mode = VG_TILE_PAD;
- info.extra_texture = 0;
+ info.extra_texture_view = NULL;
execute_filter(ctx, &info);
}
@@ -479,7 +502,7 @@ void vgConvolve(VGImage dst, VGImage src,
info.const_buffer = buffer;
info.const_buffer_len = buffer_len * sizeof(VGfloat);
info.tiling_mode = tilingMode;
- info.extra_texture = 0;
+ info.extra_texture_view = NULL;
execute_filter(ctx, &info);
free(buffer);
@@ -669,7 +692,7 @@ void vgGaussianBlur(VGImage dst, VGImage src,
info.const_buffer = buffer;
info.const_buffer_len = buffer_len * sizeof(VGfloat);
info.tiling_mode = tilingMode;
- info.extra_texture = 0;
+ info.extra_texture_view = NULL;
execute_filter(ctx, &info);
free(buffer);
@@ -688,7 +711,7 @@ void vgLookup(VGImage dst, VGImage src,
struct vg_image *d, *s;
VGuint color_data[256];
VGint i;
- struct pipe_texture *lut_texture;
+ struct pipe_sampler_view *lut_texture_view;
VGfloat buffer[4];
struct filter_info info;
@@ -714,7 +737,7 @@ void vgLookup(VGImage dst, VGImage src,
color_data[i] = blueLUT[i] << 24 | greenLUT[i] << 16 |
redLUT[i] << 8 | alphaLUT[i];
}
- lut_texture = create_texture_1d(ctx, color_data, 255);
+ lut_texture_view = create_texture_1d_view(ctx, color_data, 255);
buffer[0] = 0.f;
buffer[1] = 0.f;
@@ -728,11 +751,11 @@ void vgLookup(VGImage dst, VGImage src,
info.const_buffer = buffer;
info.const_buffer_len = 4 * sizeof(VGfloat);
info.tiling_mode = VG_TILE_PAD;
- info.extra_texture = lut_texture;
+ info.extra_texture_view = lut_texture_view;
execute_filter(ctx, &info);
- pipe_texture_reference(&lut_texture, NULL);
+ pipe_sampler_view_reference(&lut_texture_view, NULL);
}
void vgLookupSingle(VGImage dst, VGImage src,
@@ -743,7 +766,7 @@ void vgLookupSingle(VGImage dst, VGImage src,
{
struct vg_context *ctx = vg_current_context();
struct vg_image *d, *s;
- struct pipe_texture *lut_texture;
+ struct pipe_sampler_view *lut_texture_view;
VGfloat buffer[4];
struct filter_info info;
VGuint color_data[256];
@@ -783,7 +806,7 @@ void vgLookupSingle(VGImage dst, VGImage src,
color_data[i] = blue << 24 | green << 16 |
red << 8 | alpha;
}
- lut_texture = create_texture_1d(ctx, color_data, 256);
+ lut_texture_view = create_texture_1d_view(ctx, color_data, 256);
buffer[0] = 0.f;
buffer[1] = 0.f;
@@ -797,9 +820,9 @@ void vgLookupSingle(VGImage dst, VGImage src,
info.const_buffer = buffer;
info.const_buffer_len = 4 * sizeof(VGfloat);
info.tiling_mode = VG_TILE_PAD;
- info.extra_texture = lut_texture;
+ info.extra_texture_view = lut_texture_view;
execute_filter(ctx, &info);
- pipe_texture_reference(&lut_texture, NULL);
+ pipe_sampler_view_reference(&lut_texture_view, NULL);
}
diff --git a/src/gallium/state_trackers/vega/api_images.c b/src/gallium/state_trackers/vega/api_images.c
index 015241498e..fec473d9d2 100644
--- a/src/gallium/state_trackers/vega/api_images.c
+++ b/src/gallium/state_trackers/vega/api_images.c
@@ -397,7 +397,6 @@ void vgReadPixels(void * data, VGint dataStride,
{
struct vg_context *ctx = vg_current_context();
struct pipe_context *pipe = ctx->pipe;
- struct pipe_screen *screen = pipe->screen;
struct st_framebuffer *stfb = ctx->draw_buffer;
struct st_renderbuffer *strb = stfb->strb;
@@ -442,7 +441,7 @@ void vgReadPixels(void * data, VGint dataStride,
{
struct pipe_transfer *transfer;
- transfer = screen->get_tex_transfer(screen, strb->texture, 0, 0, 0,
+ transfer = pipe->get_tex_transfer(pipe, strb->texture, 0, 0, 0,
PIPE_TRANSFER_READ,
0, 0, width, height);
@@ -451,14 +450,14 @@ void vgReadPixels(void * data, VGint dataStride,
#if 0
debug_printf("%d-%d == %d\n", sy, height, y);
#endif
- pipe_get_tile_rgba(transfer, sx, y, width, 1, df);
+ pipe_get_tile_rgba(pipe, transfer, sx, y, width, 1, df);
y += yStep;
_vega_pack_rgba_span_float(ctx, width, temp, dataFormat,
dst + yoffset + xoffset);
dst += dataStride;
}
- screen->tex_transfer_destroy(transfer);
+ pipe->tex_transfer_destroy(pipe, transfer);
}
}
diff --git a/src/gallium/state_trackers/vega/api_masks.c b/src/gallium/state_trackers/vega/api_masks.c
index 9c123a4cf9..2f2d925252 100644
--- a/src/gallium/state_trackers/vega/api_masks.c
+++ b/src/gallium/state_trackers/vega/api_masks.c
@@ -86,6 +86,8 @@ draw_clear_quad(struct vg_context *st,
/* draw */
if (buf) {
+ cso_set_vertex_elements(st->cso_context, 2, st->velems);
+
util_draw_vertex_buffer(pipe, buf, 0,
PIPE_PRIM_TRIANGLE_FAN,
4, /* verts */
@@ -115,10 +117,6 @@ clear_with_quad(struct vg_context *st, float x0, float y0,
x1, y1);
*/
- if (st->pipe->screen && st->pipe->screen->update_buffer)
- st->pipe->screen->update_buffer( st->pipe->screen,
- st->pipe->priv );
-
cso_save_blend(st->cso_context);
cso_save_rasterizer(st->cso_context);
cso_save_fragment_shader(st->cso_context);
diff --git a/src/gallium/state_trackers/vega/image.c b/src/gallium/state_trackers/vega/image.c
index 41c979bfec..c3268a84a6 100644
--- a/src/gallium/state_trackers/vega/image.c
+++ b/src/gallium/state_trackers/vega/image.c
@@ -43,6 +43,7 @@
#include "util/u_tile.h"
#include "util/u_memory.h"
#include "util/u_math.h"
+#include "util/u_sampler.h"
static enum pipe_format vg_format_to_pipe(VGImageFormat format)
{
@@ -81,7 +82,7 @@ static INLINE void vg_sync_size(VGfloat *src_loc, VGfloat *dst_loc)
static void vg_copy_texture(struct vg_context *ctx,
struct pipe_texture *dst, VGint dx, VGint dy,
- struct pipe_texture *src, VGint sx, VGint sy,
+ struct pipe_sampler_view *src, VGint sx, VGint sy,
VGint width, VGint height)
{
VGfloat dst_loc[4], src_loc[4];
@@ -103,8 +104,8 @@ static void vg_copy_texture(struct vg_context *ctx,
src_loc[3] = height;
src_bounds[0] = 0.f;
src_bounds[1] = 0.f;
- src_bounds[2] = src->width0;
- src_bounds[3] = src->height0;
+ src_bounds[2] = src->texture->width0;
+ src_bounds[3] = src->texture->height0;
vg_bound_rect(src_loc, src_bounds, src_shift);
vg_bound_rect(dst_loc, dst_bounds, dst_shift);
@@ -218,7 +219,7 @@ void vg_copy_surface(struct vg_context *ctx,
static struct pipe_texture *image_texture(struct vg_image *img)
{
- struct pipe_texture *tex = img->texture;
+ struct pipe_texture *tex = img->sampler_view->texture;
return tex;
}
@@ -247,9 +248,12 @@ struct vg_image * image_create(VGImageFormat format,
VGint width, VGint height)
{
struct vg_context *ctx = vg_current_context();
+ struct pipe_context *pipe = ctx->pipe;
struct vg_image *image = CALLOC_STRUCT(vg_image);
enum pipe_format pformat = vg_format_to_pipe(format);
struct pipe_texture pt, *newtex;
+ struct pipe_sampler_view view_templ;
+ struct pipe_sampler_view *view;
struct pipe_screen *screen = ctx->pipe->screen;
vg_init_object(&image->base, ctx, VG_OBJECT_IMAGE);
@@ -281,7 +285,12 @@ struct vg_image * image_create(VGImageFormat format,
debug_assert(newtex);
- image->texture = newtex;
+ u_sampler_view_default_template(&view_templ, newtex, newtex->format);
+ view = pipe->create_sampler_view(pipe, newtex, &view_templ);
+ /* want the texture to go away if the view is freed */
+ pipe_texture_reference(&newtex, NULL);
+
+ image->sampler_view = view;
vg_context_add_object(ctx, VG_OBJECT_IMAGE, image);
@@ -345,7 +354,7 @@ void image_destroy(struct vg_image *img)
array_destroy(img->children_array);
}
- pipe_texture_reference(&img->texture, NULL);
+ pipe_sampler_view_reference(&img->sampler_view, NULL);
free(img);
}
@@ -378,7 +387,7 @@ void image_sub_data(struct vg_image *image,
VGfloat *df = (VGfloat*)temp;
VGint i;
struct vg_context *ctx = vg_current_context();
- struct pipe_screen *screen = ctx->pipe->screen;
+ struct pipe_context *pipe = ctx->pipe;
struct pipe_texture *texture = image_texture(image);
VGint xoffset = 0, yoffset = 0;
@@ -412,17 +421,17 @@ void image_sub_data(struct vg_image *image,
}
{ /* upload color_data */
- struct pipe_transfer *transfer = screen->get_tex_transfer(
- screen, texture, 0, 0, 0,
+ struct pipe_transfer *transfer = pipe->get_tex_transfer(
+ pipe, texture, 0, 0, 0,
PIPE_TRANSFER_WRITE, 0, 0, texture->width0, texture->height0);
src += (dataStride * yoffset);
for (i = 0; i < height; i++) {
_vega_unpack_float_span_rgba(ctx, width, xoffset, src, dataFormat, temp);
- pipe_put_tile_rgba(transfer, x+image->x, y+image->y, width, 1, df);
+ pipe_put_tile_rgba(pipe, transfer, x+image->x, y+image->y, width, 1, df);
y += yStep;
src += dataStride;
}
- screen->tex_transfer_destroy(transfer);
+ pipe->tex_transfer_destroy(pipe, transfer);
}
}
@@ -435,7 +444,6 @@ void image_get_sub_data(struct vg_image * image,
{
struct vg_context *ctx = vg_current_context();
struct pipe_context *pipe = ctx->pipe;
- struct pipe_screen *screen = pipe->screen;
VGfloat temp[VEGA_MAX_IMAGE_WIDTH][4];
VGfloat *df = (VGfloat*)temp;
VGint y = 0, yStep = 1;
@@ -444,8 +452,8 @@ void image_get_sub_data(struct vg_image * image,
{
struct pipe_transfer *transfer =
- screen->get_tex_transfer(screen,
- image->texture, 0, 0, 0,
+ pipe->get_tex_transfer(pipe,
+ image->sampler_view->texture, 0, 0, 0,
PIPE_TRANSFER_READ,
0, 0,
image->x + image->width,
@@ -455,13 +463,13 @@ void image_get_sub_data(struct vg_image * image,
#if 0
debug_printf("%d-%d == %d\n", sy, height, y);
#endif
- pipe_get_tile_rgba(transfer, sx+image->x, y, width, 1, df);
+ pipe_get_tile_rgba(pipe, transfer, sx+image->x, y, width, 1, df);
y += yStep;
_vega_pack_rgba_span_float(ctx, width, temp, dataFormat, dst);
dst += dataStride;
}
- screen->tex_transfer_destroy(transfer);
+ pipe->tex_transfer_destroy(pipe, transfer);
}
}
@@ -479,9 +487,9 @@ struct vg_image * image_child_image(struct vg_image *parent,
image->width = width;
image->height = height;
image->parent = parent;
- image->texture = 0;
- pipe_texture_reference(&image->texture,
- parent->texture);
+ image->sampler_view = NULL;
+ pipe_sampler_view_reference(&image->sampler_view,
+ parent->sampler_view);
image->sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
image->sampler.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
@@ -515,8 +523,8 @@ void image_copy(struct vg_image *dst, VGint dx, VGint dy,
}
/* make sure rendering has completed */
ctx->pipe->flush(ctx->pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
- vg_copy_texture(ctx, dst->texture, dst->x + dx, dst->y + dy,
- src->texture, src->x + sx, src->y + sy, width, height);
+ vg_copy_texture(ctx, dst->sampler_view->texture, dst->x + dx, dst->y + dy,
+ src->sampler_view, src->x + sx, src->y + sy, width, height);
}
void image_draw(struct vg_image *img)
@@ -625,12 +633,12 @@ VGboolean vg_image_overlaps(struct vg_image *dst,
}
VGint image_bind_samplers(struct vg_image *img, struct pipe_sampler_state **samplers,
- struct pipe_texture **textures)
+ struct pipe_sampler_view **sampler_views)
{
img->sampler.min_img_filter = image_sampler_filter(img->base.ctx);
img->sampler.mag_img_filter = image_sampler_filter(img->base.ctx);
samplers[3] = &img->sampler;
- textures[3] = img->texture;
+ sampler_views[3] = img->sampler_view;
return 1;
}
diff --git a/src/gallium/state_trackers/vega/image.h b/src/gallium/state_trackers/vega/image.h
index 78e17cffa6..805b35fab9 100644
--- a/src/gallium/state_trackers/vega/image.h
+++ b/src/gallium/state_trackers/vega/image.h
@@ -43,7 +43,7 @@ struct vg_image {
struct vg_image *parent;
- struct pipe_texture *texture;
+ struct pipe_sampler_view *sampler_view;
struct pipe_sampler_state sampler;
struct array *children_array;
@@ -89,7 +89,7 @@ void image_get_pixels(struct vg_image *dst, VGint dx, VGint dy,
VGint width, VGint height);
VGint image_bind_samplers(struct vg_image *dst, struct pipe_sampler_state **samplers,
- struct pipe_texture **textures);
+ struct pipe_sampler_view **sampler_views);
VGboolean vg_image_overlaps(struct vg_image *dst,
struct vg_image *src);
diff --git a/src/gallium/state_trackers/vega/mask.c b/src/gallium/state_trackers/vega/mask.c
index 839dc19a3b..316ea7a9c9 100644
--- a/src/gallium/state_trackers/vega/mask.c
+++ b/src/gallium/state_trackers/vega/mask.c
@@ -45,7 +45,7 @@ struct vg_mask_layer {
VGint width;
VGint height;
- struct pipe_texture *texture;
+ struct pipe_sampler_view *sampler_view;
};
static INLINE struct pipe_surface *
@@ -54,7 +54,7 @@ alpha_mask_surface(struct vg_context *ctx, int usage)
struct pipe_screen *screen = ctx->pipe->screen;
struct st_framebuffer *stfb = ctx->draw_buffer;
return screen->get_tex_surface(screen,
- stfb->alpha_mask,
+ stfb->alpha_mask_view->texture,
0, 0, 0,
usage);
}
@@ -284,35 +284,33 @@ static void setup_mask_operation(VGMaskOperation operation)
cso_set_fragment_shader_handle(ctx->cso_context, shader);
}
-static void setup_mask_samplers(struct pipe_texture *umask)
+static void setup_mask_samplers(struct pipe_sampler_view *umask)
{
struct vg_context *ctx = vg_current_context();
struct pipe_sampler_state *samplers[PIPE_MAX_SAMPLERS];
- struct pipe_texture *textures[PIPE_MAX_SAMPLERS];
+ struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS];
struct st_framebuffer *fb_buffers = ctx->draw_buffer;
- struct pipe_texture *uprev = NULL;
+ struct pipe_sampler_view *uprev = NULL;
struct pipe_sampler_state sampler;
- uprev = fb_buffers->blend_texture;
+ uprev = fb_buffers->blend_texture_view;
sampler = ctx->mask.sampler;
sampler.normalized_coords = 1;
samplers[0] = NULL;
samplers[1] = NULL;
- samplers[2] = NULL;
- textures[0] = NULL;
- textures[1] = NULL;
- textures[2] = NULL;
+ sampler_views[0] = NULL;
+ sampler_views[1] = NULL;
samplers[0] = &sampler;
samplers[1] = &ctx->mask.sampler;
- textures[0] = umask;
- textures[1] = uprev;
+ sampler_views[0] = umask;
+ sampler_views[1] = uprev;
cso_set_samplers(ctx->cso_context, 2,
(const struct pipe_sampler_state **)samplers);
- cso_set_sampler_textures(ctx->cso_context, 2, textures);
+ cso_set_fragment_sampler_views(ctx->cso_context, 2, sampler_views);
}
@@ -411,12 +409,13 @@ static void surface_fill(struct pipe_surface *surf,
}
-static void mask_using_texture(struct pipe_texture *texture,
+static void mask_using_texture(struct pipe_sampler_view *sampler_view,
VGMaskOperation operation,
VGint x, VGint y,
VGint width, VGint height)
{
struct vg_context *ctx = vg_current_context();
+ struct pipe_texture *texture = sampler_view->texture;
struct pipe_surface *surface =
alpha_mask_surface(ctx, PIPE_BUFFER_USAGE_GPU_WRITE);
VGint offsets[4], loc[4];
@@ -439,13 +438,13 @@ static void mask_using_texture(struct pipe_texture *texture,
vg_prepare_blend_surface_from_mask(ctx);
cso_save_samplers(ctx->cso_context);
- cso_save_sampler_textures(ctx->cso_context);
+ cso_save_fragment_sampler_views(ctx->cso_context);
cso_save_framebuffer(ctx->cso_context);
cso_save_blend(ctx->cso_context);
cso_save_fragment_shader(ctx->cso_context);
cso_save_viewport(ctx->cso_context);
- setup_mask_samplers(texture);
+ setup_mask_samplers(sampler_view);
setup_mask_blend();
setup_mask_operation(operation);
setup_mask_framebuffer(surface, surface->width, surface->height);
@@ -463,7 +462,7 @@ static void mask_using_texture(struct pipe_texture *texture,
cso_restore_framebuffer(ctx->cso_context);
cso_restore_fragment_shader(ctx->cso_context);
cso_restore_samplers(ctx->cso_context);
- cso_restore_sampler_textures(ctx->cso_context);
+ cso_restore_fragment_sampler_views(ctx->cso_context);
cso_restore_viewport(ctx->cso_context);
pipe_surface_reference(&surface, NULL);
@@ -484,7 +483,11 @@ struct vg_mask_layer * mask_layer_create(VGint width, VGint height)
{
struct pipe_texture pt;
+ struct pipe_context *pipe = ctx->pipe;
struct pipe_screen *screen = ctx->pipe->screen;
+ struct pipe_sampler_view view_templ;
+ struct pipe_sampler_view *view = NULL;
+ struct pipe_texture *texture;
memset(&pt, 0, sizeof(pt));
pt.target = PIPE_TEXTURE_2D;
@@ -496,7 +499,14 @@ struct vg_mask_layer * mask_layer_create(VGint width, VGint height)
pt.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER;
pt.compressed = 0;
- mask->texture = screen->texture_create(screen, &pt);
+ texture = screen->texture_create(screen, &pt);
+
+ if (texture) {
+ u_sampler_view_default_template(&view_templ, texture, texture->format);
+ view = pipe->create_sampler_view(pipe, texture, &view_templ);
+ }
+ pipe_texture_reference(&texture, NULL);
+ mask->sampler_view = view;
}
vg_context_add_object(ctx, VG_OBJECT_MASK, mask);
@@ -525,7 +535,7 @@ void mask_layer_fill(struct vg_mask_layer *layer,
alpha_color[3] = value;
surface = ctx->pipe->screen->get_tex_surface(
- ctx->pipe->screen, layer->texture,
+ ctx->pipe->screen, layer->sampler_view->texture,
0, 0, 0,
PIPE_BUFFER_USAGE_GPU_WRITE);
@@ -545,10 +555,10 @@ void mask_copy(struct vg_mask_layer *layer,
struct st_framebuffer *fb_buffers = ctx->draw_buffer;
renderer_copy_texture(ctx->renderer,
- layer->texture,
+ layer->sampler_view,
sx, sy,
sx + width, sy + height,
- fb_buffers->alpha_mask,
+ fb_buffers->alpha_mask_view->texture,
dx, dy,
dx + width, dy + height);
}
@@ -562,7 +572,7 @@ static void mask_layer_render_to(struct vg_mask_layer *layer,
struct pipe_screen *screen = ctx->pipe->screen;
struct pipe_surface *surface;
- surface = screen->get_tex_surface(screen, layer->texture, 0, 0, 0,
+ surface = screen->get_tex_surface(screen, layer->sampler_view->texture, 0, 0, 0,
PIPE_BUFFER_USAGE_GPU_WRITE);
cso_save_framebuffer(ctx->cso_context);
@@ -604,8 +614,8 @@ void mask_render_to(struct path *path,
struct vg_mask_layer *temp_layer;
VGint width, height;
- width = fb_buffers->alpha_mask->width0;
- height = fb_buffers->alpha_mask->width0;
+ width = fb_buffers->alpha_mask_view->texture->width0;
+ height = fb_buffers->alpha_mask_view->texture->width0;
temp_layer = mask_layer_create(width, height);
@@ -622,7 +632,7 @@ void mask_using_layer(struct vg_mask_layer *layer,
VGint x, VGint y,
VGint width, VGint height)
{
- mask_using_texture(layer->texture, operation,
+ mask_using_texture(layer->sampler_view, operation,
x, y, width, height);
}
@@ -644,7 +654,7 @@ void mask_using_image(struct vg_image *image,
VGint x, VGint y,
VGint width, VGint height)
{
- mask_using_texture(image->texture, operation,
+ mask_using_texture(image->sampler_view, operation,
x, y, width, height);
}
@@ -672,7 +682,7 @@ void mask_fill(VGint x, VGint y, VGint width, VGint height,
}
VGint mask_bind_samplers(struct pipe_sampler_state **samplers,
- struct pipe_texture **textures)
+ struct pipe_sampler_view **sampler_views)
{
struct vg_context *ctx = vg_current_context();
@@ -680,7 +690,7 @@ VGint mask_bind_samplers(struct pipe_sampler_state **samplers,
struct st_framebuffer *fb_buffers = ctx->draw_buffer;
samplers[1] = &ctx->mask.sampler;
- textures[1] = fb_buffers->alpha_mask;
+ sampler_views[1] = fb_buffers->alpha_mask_view;
return 1;
} else
return 0;
diff --git a/src/gallium/state_trackers/vega/mask.h b/src/gallium/state_trackers/vega/mask.h
index 5eaaede0e3..4feacbefda 100644
--- a/src/gallium/state_trackers/vega/mask.h
+++ b/src/gallium/state_trackers/vega/mask.h
@@ -63,6 +63,6 @@ void mask_fill(VGint x, VGint y,
VGfloat value);
VGint mask_bind_samplers(struct pipe_sampler_state **samplers,
- struct pipe_texture **textures);
+ struct pipe_sampler_view **sampler_views);
#endif
diff --git a/src/gallium/state_trackers/vega/paint.c b/src/gallium/state_trackers/vega/paint.c
index cdb87d3bf6..508e1863a5 100644
--- a/src/gallium/state_trackers/vega/paint.c
+++ b/src/gallium/state_trackers/vega/paint.c
@@ -37,6 +37,7 @@
#include "util/u_format.h"
#include "util/u_memory.h"
#include "util/u_math.h"
+#include "util/u_sampler.h"
#include "cso_cache/cso_context.h"
@@ -61,7 +62,7 @@ struct vg_paint {
VGfloat vals[5];
VGint valsi[5];
} radial;
- struct pipe_texture *texture;
+ struct pipe_sampler_view *sampler_view;
struct pipe_sampler_state sampler;
VGfloat *ramp_stops;
@@ -72,7 +73,7 @@ struct vg_paint {
} gradient;
struct {
- struct pipe_texture *texture;
+ struct pipe_sampler_view *sampler_view;
VGTilingMode tiling_mode;
struct pipe_sampler_state sampler;
} pattern;
@@ -164,15 +165,35 @@ static INLINE struct pipe_texture *create_gradient_texture(struct vg_paint *p)
struct pipe_transfer *transfer =
st_no_flush_get_tex_transfer(p->base.ctx, tex, 0, 0, 0,
PIPE_TRANSFER_WRITE, 0, 0, 1024, 1);
- void *map = screen->transfer_map(screen, transfer);
+ void *map = pipe->transfer_map(pipe, transfer);
memcpy(map, p->gradient.color_data, sizeof(VGint)*1024);
- screen->transfer_unmap(screen, transfer);
- screen->tex_transfer_destroy(transfer);
+ pipe->transfer_unmap(pipe, transfer);
+ pipe->tex_transfer_destroy(pipe, transfer);
}
return tex;
}
+static INLINE struct pipe_sampler_view *create_gradient_sampler_view(struct vg_paint *p)
+{
+ struct pipe_context *pipe = p->base.ctx->pipe;
+ struct pipe_texture *texture;
+ struct pipe_sampler_view view_templ;
+ struct pipe_sampler_view *view;
+
+ texture = create_gradient_texture(p);
+
+ if (!texture)
+ return NULL;
+
+ u_sampler_view_default_template(&view_templ, texture, texture->format);
+ view = pipe->create_sampler_view(pipe, texture, &view_templ);
+ /* want the texture to go away if the view is freed */
+ pipe_texture_reference(&texture, NULL);
+
+ return view;
+}
+
struct vg_paint * paint_create(struct vg_context *ctx)
{
struct vg_paint *paint = CALLOC_STRUCT(vg_paint);
@@ -207,8 +228,9 @@ struct vg_paint * paint_create(struct vg_context *ctx)
void paint_destroy(struct vg_paint *paint)
{
struct vg_context *ctx = paint->base.ctx;
- if (paint->pattern.texture)
- pipe_texture_reference(&paint->pattern.texture, NULL);
+ pipe_sampler_view_reference(&paint->gradient.sampler_view, NULL);
+ if (paint->pattern.sampler_view)
+ pipe_sampler_view_reference(&paint->pattern.sampler_view, NULL);
if (ctx)
vg_context_remove_object(ctx, VG_OBJECT_PAINT, paint);
@@ -329,8 +351,8 @@ static INLINE void paint_pattern_buffer(struct vg_paint *paint, void *buffer)
map[4] = 0.f;
map[5] = 1.f;
- map[6] = paint->pattern.texture->width0;
- map[7] = paint->pattern.texture->height0;
+ map[6] = paint->pattern.sampler_view->texture->width0;
+ map[7] = paint->pattern.sampler_view->texture->height0;
{
struct matrix mat;
memcpy(&mat, &ctx->state.vg.fill_paint_to_user_matrix,
@@ -394,12 +416,12 @@ void paint_set_ramp_stops(struct vg_paint *paint, const VGfloat *stops,
create_gradient_data(stops, num / 5, paint->gradient.color_data,
1024);
- if (paint->gradient.texture) {
- pipe_texture_reference(&paint->gradient.texture, NULL);
- paint->gradient.texture = 0;
+ if (paint->gradient.sampler_view) {
+ pipe_sampler_view_reference(&paint->gradient.sampler_view, NULL);
+ paint->gradient.sampler_view = NULL;
}
- paint->gradient.texture = create_gradient_texture(paint);
+ paint->gradient.sampler_view = create_gradient_sampler_view(paint);
}
void paint_set_colori(struct vg_paint *p,
@@ -459,12 +481,12 @@ void paint_set_radial_gradient(struct vg_paint *paint,
void paint_set_pattern(struct vg_paint *paint,
struct vg_image *img)
{
- if (paint->pattern.texture)
- pipe_texture_reference(&paint->pattern.texture, NULL);
+ if (paint->pattern.sampler_view)
+ pipe_sampler_view_reference(&paint->pattern.sampler_view, NULL);
- paint->pattern.texture = 0;
- pipe_texture_reference(&paint->pattern.texture,
- img->texture);
+ paint->pattern.sampler_view = NULL;
+ pipe_sampler_view_reference(&paint->pattern.sampler_view,
+ img->sampler_view);
}
void paint_set_pattern_tiling(struct vg_paint *paint,
@@ -611,18 +633,18 @@ VGTilingMode paint_pattern_tiling(struct vg_paint *paint)
}
VGint paint_bind_samplers(struct vg_paint *paint, struct pipe_sampler_state **samplers,
- struct pipe_texture **textures)
+ struct pipe_sampler_view **sampler_views)
{
struct vg_context *ctx = vg_current_context();
switch(paint->type) {
case VG_PAINT_TYPE_LINEAR_GRADIENT:
case VG_PAINT_TYPE_RADIAL_GRADIENT: {
- if (paint->gradient.texture) {
+ if (paint->gradient.sampler_view) {
paint->gradient.sampler.min_img_filter = image_sampler_filter(ctx);
paint->gradient.sampler.mag_img_filter = image_sampler_filter(ctx);
samplers[0] = &paint->gradient.sampler;
- textures[0] = paint->gradient.texture;
+ sampler_views[0] = paint->gradient.sampler_view;
return 1;
}
}
@@ -634,7 +656,7 @@ VGint paint_bind_samplers(struct vg_paint *paint, struct pipe_sampler_state **sa
paint->pattern.sampler.min_img_filter = image_sampler_filter(ctx);
paint->pattern.sampler.mag_img_filter = image_sampler_filter(ctx);
samplers[0] = &paint->pattern.sampler;
- textures[0] = paint->pattern.texture;
+ sampler_views[0] = paint->pattern.sampler_view;
return 1;
}
break;
@@ -647,7 +669,7 @@ VGint paint_bind_samplers(struct vg_paint *paint, struct pipe_sampler_state **sa
void paint_resolve_type(struct vg_paint *paint)
{
if (paint->type == VG_PAINT_TYPE_PATTERN &&
- !paint->pattern.texture) {
+ !paint->pattern.sampler_view) {
paint->type = VG_PAINT_TYPE_COLOR;
}
}
diff --git a/src/gallium/state_trackers/vega/paint.h b/src/gallium/state_trackers/vega/paint.h
index 999b5c167c..9ea67c4b1e 100644
--- a/src/gallium/state_trackers/vega/paint.h
+++ b/src/gallium/state_trackers/vega/paint.h
@@ -108,7 +108,7 @@ VGboolean paint_color_ramp_premultiplied(struct vg_paint *paint);
VGint paint_bind_samplers(struct vg_paint *paint, struct pipe_sampler_state **samplers,
- struct pipe_texture **textures);
+ struct pipe_sampler_view **sampler_views);
VGint paint_constant_buffer_size(struct vg_paint *paint);
void paint_fill_constant_buffer(struct vg_paint *paint,
diff --git a/src/gallium/state_trackers/vega/polygon.c b/src/gallium/state_trackers/vega/polygon.c
index c06dbf5206..eef2c1eb87 100644
--- a/src/gallium/state_trackers/vega/polygon.c
+++ b/src/gallium/state_trackers/vega/polygon.c
@@ -292,12 +292,12 @@ static void draw_polygon(struct vg_context *ctx,
pipe->set_vertex_buffers(pipe, 1, &vbuffer);
/* tell pipe about the vertex attributes */
+ memset(&velement, 0, sizeof(velement));
velement.src_offset = 0;
velement.instance_divisor = 0;
velement.vertex_buffer_index = 0;
velement.src_format = PIPE_FORMAT_R32G32_FLOAT;
- velement.nr_components = COMPONENTS;
- pipe->set_vertex_elements(pipe, 1, &velement);
+ cso_set_vertex_elements(ctx->cso_context, 1, &velement);
/* draw */
pipe->draw_arrays(pipe, PIPE_PRIM_TRIANGLE_FAN,
diff --git a/src/gallium/state_trackers/vega/renderer.c b/src/gallium/state_trackers/vega/renderer.c
index 05620efa9c..2bb4c8bc75 100644
--- a/src/gallium/state_trackers/vega/renderer.c
+++ b/src/gallium/state_trackers/vega/renderer.c
@@ -39,6 +39,7 @@
#include "util/u_simple_shaders.h"
#include "util/u_memory.h"
#include "util/u_rect.h"
+#include "util/u_sampler.h"
#include "cso_cache/cso_context.h"
@@ -210,6 +211,7 @@ void renderer_draw_quad(struct renderer *r,
buf = setup_vertex_data(r, x1, y1, x2, y2, depth);
if (buf) {
+ cso_set_vertex_elements(r->cso, 2, r->owner->velems);
util_draw_vertex_buffer(r->pipe, buf, 0,
PIPE_PRIM_TRIANGLE_FAN,
4, /* verts */
@@ -248,6 +250,7 @@ void renderer_draw_texture(struct renderer *r,
s0, t0, s1, t1, 0.0f);
if (buf) {
+ cso_set_vertex_elements(r->cso, 2, r->owner->velems);
util_draw_vertex_buffer(pipe, buf, 0,
PIPE_PRIM_TRIANGLE_FAN,
4, /* verts */
@@ -261,7 +264,7 @@ void renderer_draw_texture(struct renderer *r,
}
void renderer_copy_texture(struct renderer *ctx,
- struct pipe_texture *src,
+ struct pipe_sampler_view *src,
VGfloat sx1, VGfloat sy1,
VGfloat sx2, VGfloat sy2,
struct pipe_texture *dst,
@@ -270,6 +273,7 @@ void renderer_copy_texture(struct renderer *ctx,
{
struct pipe_context *pipe = ctx->pipe;
struct pipe_screen *screen = pipe->screen;
+ struct pipe_texture *tex = src->texture;
struct pipe_buffer *buf;
struct pipe_surface *dst_surf = screen->get_tex_surface(
screen, dst, 0, 0, 0,
@@ -277,8 +281,8 @@ void renderer_copy_texture(struct renderer *ctx,
struct pipe_framebuffer_state fb;
float s0, t0, s1, t1;
- assert(src->width0 != 0);
- assert(src->height0 != 0);
+ assert(tex->width0 != 0);
+ assert(tex->height0 != 0);
assert(dst->width0 != 0);
assert(dst->height0 != 0);
@@ -288,10 +292,10 @@ void renderer_copy_texture(struct renderer *ctx,
#endif
#if 1
- s0 = sx1 / src->width0;
- s1 = sx2 / src->width0;
- t0 = sy1 / src->height0;
- t1 = sy2 / src->height0;
+ s0 = sx1 / tex->width0;
+ s1 = sx2 / tex->width0;
+ t0 = sy1 / tex->height0;
+ t1 = sy2 / tex->height0;
#else
s0 = 0;
s1 = 1;
@@ -305,7 +309,7 @@ void renderer_copy_texture(struct renderer *ctx,
/* save state (restored below) */
cso_save_blend(ctx->cso);
cso_save_samplers(ctx->cso);
- cso_save_sampler_textures(ctx->cso);
+ cso_save_fragment_sampler_views(ctx->cso);
cso_save_framebuffer(ctx->cso);
cso_save_fragment_shader(ctx->cso);
cso_save_vertex_shader(ctx->cso);
@@ -343,7 +347,7 @@ void renderer_copy_texture(struct renderer *ctx,
vg_set_viewport(ctx->owner, VEGA_Y0_TOP);
/* texture */
- cso_set_sampler_textures(ctx->cso, 1, &src);
+ cso_set_fragment_sampler_views(ctx->cso, 1, &src);
/* shaders */
cso_set_vertex_shader_handle(ctx->cso, vg_texture_vs(ctx->owner));
@@ -370,6 +374,7 @@ void renderer_copy_texture(struct renderer *ctx,
0.0f);
if (buf) {
+ cso_set_vertex_elements(ctx->cso, 2, ctx->owner->velems);
util_draw_vertex_buffer(ctx->pipe, buf, 0,
PIPE_PRIM_TRIANGLE_FAN,
4, /* verts */
@@ -382,7 +387,7 @@ void renderer_copy_texture(struct renderer *ctx,
/* restore state we changed */
cso_restore_blend(ctx->cso);
cso_restore_samplers(ctx->cso);
- cso_restore_sampler_textures(ctx->cso);
+ cso_restore_fragment_sampler_views(ctx->cso);
cso_restore_framebuffer(ctx->cso);
cso_restore_vertex_shader(ctx->cso);
cso_restore_fragment_shader(ctx->cso);
@@ -403,6 +408,8 @@ void renderer_copy_surface(struct renderer *ctx,
struct pipe_context *pipe = ctx->pipe;
struct pipe_screen *screen = pipe->screen;
struct pipe_buffer *buf;
+ struct pipe_sampler_view view_templ;
+ struct pipe_sampler_view *view;
struct pipe_texture texTemp, *tex;
struct pipe_surface *texSurf;
struct pipe_framebuffer_state fb;
@@ -454,6 +461,12 @@ void renderer_copy_surface(struct renderer *ctx,
if (!tex)
return;
+ u_sampler_view_default_template(&view_templ, tex, tex->format);
+ view = pipe->create_sampler_view(pipe, tex, &view_templ);
+
+ if (!view)
+ return;
+
texSurf = screen->get_tex_surface(screen, tex, 0, 0, 0,
PIPE_BUFFER_USAGE_GPU_WRITE);
@@ -476,7 +489,7 @@ void renderer_copy_surface(struct renderer *ctx,
/* save state (restored below) */
cso_save_blend(ctx->cso);
cso_save_samplers(ctx->cso);
- cso_save_sampler_textures(ctx->cso);
+ cso_save_fragment_sampler_views(ctx->cso);
cso_save_framebuffer(ctx->cso);
cso_save_fragment_shader(ctx->cso);
cso_save_vertex_shader(ctx->cso);
@@ -512,7 +525,7 @@ void renderer_copy_surface(struct renderer *ctx,
}
/* texture */
- cso_set_sampler_textures(ctx->cso, 1, &tex);
+ cso_set_fragment_sampler_views(ctx->cso, 1, &view);
/* shaders */
cso_set_fragment_shader_handle(ctx->cso, ctx->fs);
@@ -535,6 +548,7 @@ void renderer_copy_surface(struct renderer *ctx,
(float) dstX1, (float) dstY1, z);
if (buf) {
+ cso_set_vertex_elements(ctx->cso, 2, ctx->owner->velems);
util_draw_vertex_buffer(ctx->pipe, buf, 0,
PIPE_PRIM_TRIANGLE_FAN,
4, /* verts */
@@ -548,13 +562,14 @@ void renderer_copy_surface(struct renderer *ctx,
/* restore state we changed */
cso_restore_blend(ctx->cso);
cso_restore_samplers(ctx->cso);
- cso_restore_sampler_textures(ctx->cso);
+ cso_restore_fragment_sampler_views(ctx->cso);
cso_restore_framebuffer(ctx->cso);
cso_restore_fragment_shader(ctx->cso);
cso_restore_vertex_shader(ctx->cso);
cso_restore_viewport(ctx->cso);
pipe_texture_reference(&tex, NULL);
+ pipe_sampler_view_reference(&view, NULL);
}
void renderer_texture_quad(struct renderer *r,
@@ -587,6 +602,7 @@ void renderer_texture_quad(struct renderer *r,
s0, t0, s1, t1, 0.0f);
if (buf) {
+ cso_set_vertex_elements(r->cso, 2, r->owner->velems);
util_draw_vertex_buffer(pipe, buf, 0,
PIPE_PRIM_TRIANGLE_FAN,
4, /* verts */
diff --git a/src/gallium/state_trackers/vega/renderer.h b/src/gallium/state_trackers/vega/renderer.h
index 990cd32c31..03366f1361 100644
--- a/src/gallium/state_trackers/vega/renderer.h
+++ b/src/gallium/state_trackers/vega/renderer.h
@@ -33,6 +33,7 @@ struct renderer;
struct vg_context;
struct pipe_texture;
+struct pipe_sampler_view;
struct pipe_surface;
struct renderer *renderer_create(struct vg_context *owner);
@@ -57,7 +58,7 @@ void renderer_texture_quad(struct renderer *,
VGfloat x3, VGfloat y3,
VGfloat x4, VGfloat y4);
void renderer_copy_texture(struct renderer *r,
- struct pipe_texture *src,
+ struct pipe_sampler_view *src,
VGfloat sx1, VGfloat sy1,
VGfloat sx2, VGfloat sy2,
struct pipe_texture *dst,
diff --git a/src/gallium/state_trackers/vega/shader.c b/src/gallium/state_trackers/vega/shader.c
index 0e71a507bf..f2ec24c57f 100644
--- a/src/gallium/state_trackers/vega/shader.c
+++ b/src/gallium/state_trackers/vega/shader.c
@@ -119,7 +119,7 @@ static void setup_constant_buffer(struct shader *shader)
static VGint blend_bind_samplers(struct vg_context *ctx,
struct pipe_sampler_state **samplers,
- struct pipe_texture **textures)
+ struct pipe_sampler_view **sampler_views)
{
VGBlendMode bmode = ctx->state.vg.blend_mode;
@@ -132,15 +132,15 @@ static VGint blend_bind_samplers(struct vg_context *ctx,
vg_prepare_blend_surface(ctx);
samplers[2] = &ctx->blend_sampler;
- textures[2] = stfb->blend_texture;
+ sampler_views[2] = stfb->blend_texture_view;
- if (!samplers[0] || !textures[0]) {
+ if (!samplers[0] || !sampler_views[0]) {
samplers[0] = samplers[2];
- textures[0] = textures[2];
+ sampler_views[0] = sampler_views[2];
}
- if (!samplers[1] || !textures[1]) {
+ if (!samplers[1] || !sampler_views[1]) {
samplers[1] = samplers[0];
- textures[1] = textures[0];
+ sampler_views[1] = sampler_views[0];
}
return 1;
@@ -151,7 +151,7 @@ static VGint blend_bind_samplers(struct vg_context *ctx,
static void setup_samplers(struct shader *shader)
{
struct pipe_sampler_state *samplers[PIPE_MAX_SAMPLERS];
- struct pipe_texture *textures[PIPE_MAX_SAMPLERS];
+ struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS];
struct vg_context *ctx = shader->context;
/* a little wonky: we use the num as a boolean that just says
* whether any sampler/textures have been set. the actual numbering
@@ -167,20 +167,20 @@ static void setup_samplers(struct shader *shader)
samplers[1] = NULL;
samplers[2] = NULL;
samplers[3] = NULL;
- textures[0] = NULL;
- textures[1] = NULL;
- textures[2] = NULL;
- textures[3] = NULL;
-
- num += paint_bind_samplers(shader->paint, samplers, textures);
- num += mask_bind_samplers(samplers, textures);
- num += blend_bind_samplers(ctx, samplers, textures);
+ sampler_views[0] = NULL;
+ sampler_views[1] = NULL;
+ sampler_views[2] = NULL;
+ sampler_views[3] = NULL;
+
+ num += paint_bind_samplers(shader->paint, samplers, sampler_views);
+ num += mask_bind_samplers(samplers, sampler_views);
+ num += blend_bind_samplers(ctx, samplers, sampler_views);
if (shader->drawing_image && shader->image)
- num += image_bind_samplers(shader->image, samplers, textures);
+ num += image_bind_samplers(shader->image, samplers, sampler_views);
if (num) {
cso_set_samplers(ctx->cso_context, 4, (const struct pipe_sampler_state **)samplers);
- cso_set_sampler_textures(ctx->cso_context, 4, textures);
+ cso_set_fragment_sampler_views(ctx->cso_context, 4, sampler_views);
}
}
diff --git a/src/gallium/state_trackers/vega/st_inlines.h b/src/gallium/state_trackers/vega/st_inlines.h
index 419151c3ae..4d12a4efdd 100644
--- a/src/gallium/state_trackers/vega/st_inlines.h
+++ b/src/gallium/state_trackers/vega/st_inlines.h
@@ -51,7 +51,6 @@ st_cond_flush_get_tex_transfer(struct vg_context *st,
unsigned int x, unsigned int y,
unsigned int w, unsigned int h)
{
- struct pipe_screen *screen = st->pipe->screen;
struct pipe_context *pipe = st->pipe;
unsigned referenced =
pipe->is_texture_referenced(pipe, pt, face, level);
@@ -60,7 +59,7 @@ st_cond_flush_get_tex_transfer(struct vg_context *st,
(usage & PIPE_TRANSFER_WRITE)))
vgFlush();
- return screen->get_tex_transfer(screen, pt, face, level, zslice, usage,
+ return pipe->get_tex_transfer(pipe, pt, face, level, zslice, usage,
x, y, w, h);
}
@@ -74,10 +73,10 @@ st_no_flush_get_tex_transfer(struct vg_context *st,
unsigned int x, unsigned int y,
unsigned int w, unsigned int h)
{
- struct pipe_screen *screen = st->pipe->screen;
+ struct pipe_context *pipe = st->pipe;
- return screen->get_tex_transfer(screen, pt, face, level,
- zslice, usage, x, y, w, h);
+ return pipe->get_tex_transfer(pipe, pt, face, level,
+ zslice, usage, x, y, w, h);
}
static INLINE void *
diff --git a/src/gallium/state_trackers/vega/vg_context.c b/src/gallium/state_trackers/vega/vg_context.c
index 426bf9bc62..11ebbbe544 100644
--- a/src/gallium/state_trackers/vega/vg_context.c
+++ b/src/gallium/state_trackers/vega/vg_context.c
@@ -32,6 +32,7 @@
#include "shader.h"
#include "asm_util.h"
#include "st_inlines.h"
+#include "vg_manager.h"
#include "pipe/p_context.h"
#include "util/u_inlines.h"
@@ -42,6 +43,7 @@
#include "util/u_simple_shaders.h"
#include "util/u_memory.h"
#include "util/u_blit.h"
+#include "util/u_sampler.h"
struct vg_context *_vg_context = 0;
@@ -72,6 +74,7 @@ struct vg_context * vg_create_context(struct pipe_context *pipe,
struct vg_context *share)
{
struct vg_context *ctx;
+ unsigned i;
ctx = CALLOC_STRUCT(vg_context);
@@ -103,6 +106,13 @@ struct vg_context * vg_create_context(struct pipe_context *pipe,
ctx->blend_sampler.mag_img_filter = PIPE_TEX_FILTER_NEAREST;
ctx->blend_sampler.normalized_coords = 0;
+ for (i = 0; i < 2; i++) {
+ ctx->velems[i].src_offset = i * 4 * sizeof(float);
+ ctx->velems[i].instance_divisor = 0;
+ ctx->velems[i].vertex_buffer_index = 0;
+ ctx->velems[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+ }
+
vg_set_error(ctx, VG_NO_ERROR);
ctx->owned_objects[VG_OBJECT_PAINT] = cso_hash_create();
@@ -297,6 +307,8 @@ static void update_clip_state(struct vg_context *ctx)
void vg_validate_state(struct vg_context *ctx)
{
+ vg_manager_validate_framebuffer(ctx);
+
if ((ctx->state.dirty & BLEND_DIRTY)) {
struct pipe_blend_state *blend = &ctx->state.g3d.blend;
memset(blend, 0, sizeof(struct pipe_blend_state));
@@ -425,19 +437,24 @@ void vg_prepare_blend_surface(struct vg_context *ctx)
{
struct pipe_surface *dest_surface = NULL;
struct pipe_context *pipe = ctx->pipe;
+ struct pipe_sampler_view *view;
+ struct pipe_sampler_view view_templ;
struct st_framebuffer *stfb = ctx->draw_buffer;
struct st_renderbuffer *strb = stfb->strb;
/* first finish all pending rendering */
vgFinish();
+ u_sampler_view_default_template(&view_templ, strb->texture, strb->texture->format);
+ view = pipe->create_sampler_view(pipe, strb->texture, &view_templ);
+
dest_surface = pipe->screen->get_tex_surface(pipe->screen,
- stfb->blend_texture,
+ stfb->blend_texture_view->texture,
0, 0, 0,
PIPE_BUFFER_USAGE_GPU_WRITE);
/* flip it, because we want to use it as a sampler */
util_blit_pixels_tex(ctx->blit,
- strb->texture,
+ view,
0, strb->height,
strb->width, 0,
dest_surface,
@@ -450,6 +467,8 @@ void vg_prepare_blend_surface(struct vg_context *ctx)
/* make sure it's complete */
vgFinish();
+
+ pipe_sampler_view_reference(&view, NULL);
}
@@ -466,13 +485,13 @@ void vg_prepare_blend_surface_from_mask(struct vg_context *ctx)
vgFinish();
dest_surface = pipe->screen->get_tex_surface(pipe->screen,
- stfb->blend_texture,
+ stfb->blend_texture_view->texture,
0, 0, 0,
PIPE_BUFFER_USAGE_GPU_WRITE);
/* flip it, because we want to use it as a sampler */
util_blit_pixels_tex(ctx->blit,
- stfb->alpha_mask,
+ stfb->alpha_mask_view,
0, strb->height,
strb->width, 0,
dest_surface,
diff --git a/src/gallium/state_trackers/vega/vg_context.h b/src/gallium/state_trackers/vega/vg_context.h
index bc88c8d139..c9e36d7d76 100644
--- a/src/gallium/state_trackers/vega/vg_context.h
+++ b/src/gallium/state_trackers/vega/vg_context.h
@@ -33,6 +33,7 @@
#include "pipe/p_state.h"
#include "util/u_pointer.h"
#include "util/u_math.h"
+#include "state_tracker/st_api.h"
#include "cso_cache/cso_hash.h"
#include "cso_cache/cso_context.h"
@@ -54,9 +55,13 @@ struct st_framebuffer {
struct st_renderbuffer *strb;
struct st_renderbuffer *dsrb;
- struct pipe_texture *alpha_mask;
+ struct pipe_sampler_view *alpha_mask_view;
- struct pipe_texture *blend_texture;
+ struct pipe_sampler_view *blend_texture_view;
+
+
+ struct st_framebuffer_iface *iface;
+ enum st_attachment_type strb_att;
void *privateData;
};
@@ -84,6 +89,8 @@ enum dirty_state {
struct vg_context
{
+ struct st_context_iface iface;
+
struct pipe_context *pipe;
struct {
@@ -101,6 +108,7 @@ struct vg_context
VGErrorCode _error;
struct st_framebuffer *draw_buffer;
+ int32_t draw_buffer_invalid;
struct cso_hash *owned_objects[VG_OBJECT_LAST];
@@ -146,6 +154,7 @@ struct vg_context
struct vg_shader *clear_vs;
struct vg_shader *texture_vs;
struct pipe_buffer *vs_const_buffer;
+ struct pipe_vertex_element velems[2];
};
struct vg_object {
diff --git a/src/gallium/state_trackers/vega/vg_manager.c b/src/gallium/state_trackers/vega/vg_manager.c
new file mode 100644
index 0000000000..25c2e853f2
--- /dev/null
+++ b/src/gallium/state_trackers/vega/vg_manager.c
@@ -0,0 +1,373 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.9
+ *
+ * Copyright (C) 2010 LunarG Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Chia-I Wu <olv@lunarg.com>
+ */
+
+#include "state_tracker/st_api.h"
+
+#include "pipe/p_context.h"
+#include "pipe/p_screen.h"
+#include "util/u_memory.h"
+#include "util/u_inlines.h"
+
+#include "vg_manager.h"
+#include "vg_context.h"
+#include "vg_tracker.h" /* for st_resize_framebuffer */
+#include "image.h"
+
+/**
+ * Flush the front buffer if the current context renders to the front buffer.
+ */
+void
+vg_manager_flush_frontbuffer(struct vg_context *ctx)
+{
+ struct st_framebuffer *stfb = ctx->draw_buffer;
+
+ if (!stfb)
+ return;
+
+ /* st_public.h is used */
+ if (!stfb->iface) {
+ struct pipe_screen *screen = ctx->pipe->screen;
+ if (screen->flush_frontbuffer) {
+ screen->flush_frontbuffer(screen,
+ stfb->strb->surface, ctx->pipe->priv);
+ }
+ return;
+ }
+
+ switch (stfb->strb_att) {
+ case ST_ATTACHMENT_FRONT_LEFT:
+ case ST_ATTACHMENT_FRONT_RIGHT:
+ stfb->iface->flush_front(stfb->iface, stfb->strb_att);
+ break;
+ default:
+ break;
+ }
+}
+
+/**
+ * Re-validate the framebuffer.
+ */
+void
+vg_manager_validate_framebuffer(struct vg_context *ctx)
+{
+ struct pipe_screen *screen = ctx->pipe->screen;
+ struct st_framebuffer *stfb = ctx->draw_buffer;
+ struct st_renderbuffer *rb;
+ struct pipe_texture *pt;
+
+ /* no binding surface */
+ if (!stfb)
+ return;
+
+ /* st_public.h is used */
+ if (!stfb->iface) {
+ struct pipe_screen *screen = ctx->pipe->screen;
+ if (screen->update_buffer)
+ screen->update_buffer(screen, ctx->pipe->priv);
+ return;
+ }
+
+ if (!p_atomic_read(&ctx->draw_buffer_invalid))
+ return;
+
+ /* validate the fb */
+ if (!stfb->iface->validate(stfb->iface, &stfb->strb_att, 1, &pt) || !pt)
+ return;
+
+ rb = stfb->strb;
+ if (rb->texture == pt) {
+ pipe_texture_reference(&pt, NULL);
+ return;
+ }
+
+ /* unreference existing ones */
+ pipe_surface_reference(&rb->surface, NULL);
+ pipe_texture_reference(&rb->texture, NULL);
+
+ rb->texture = pt;
+ rb->surface = screen->get_tex_surface(screen, rb->texture, 0, 0, 0,
+ PIPE_BUFFER_USAGE_GPU_READ | PIPE_BUFFER_USAGE_GPU_WRITE);
+
+ rb->width = rb->surface->width;
+ rb->height = rb->surface->height;
+
+ st_resize_framebuffer(stfb, rb->width, rb->height);
+
+ p_atomic_set(&ctx->draw_buffer_invalid, FALSE);
+}
+
+
+static void
+vg_context_notify_invalid_framebuffer(struct st_context_iface *stctxi,
+ struct st_framebuffer_iface *stfbi)
+{
+ struct vg_context *ctx = (struct vg_context *) stctxi;
+ p_atomic_set(&ctx->draw_buffer_invalid, TRUE);
+}
+
+static void
+vg_context_flush(struct st_context_iface *stctxi, unsigned flags,
+ struct pipe_fence_handle **fence)
+{
+ struct vg_context *ctx = (struct vg_context *) stctxi;
+ ctx->pipe->flush(ctx->pipe, flags, fence);
+ if (flags & PIPE_FLUSH_RENDER_CACHE)
+ vg_manager_flush_frontbuffer(ctx);
+}
+
+static void
+vg_context_destroy(struct st_context_iface *stctxi)
+{
+ struct vg_context *ctx = (struct vg_context *) stctxi;
+ vg_destroy_context(ctx);
+}
+
+static struct st_context_iface *
+vg_api_create_context(struct st_api *stapi, struct st_manager *smapi,
+ const struct st_visual *visual,
+ struct st_context_iface *shared_stctxi)
+{
+ struct vg_context *shared_ctx = (struct vg_context *) shared_stctxi;
+ struct vg_context *ctx;
+ struct pipe_context *pipe;
+
+ pipe = smapi->screen->context_create(smapi->screen, NULL);
+ if (!pipe)
+ return NULL;
+ ctx = vg_create_context(pipe, NULL, shared_ctx);
+ if (!ctx) {
+ pipe->destroy(pipe);
+ return NULL;
+ }
+
+ ctx->iface.destroy = vg_context_destroy;
+
+ ctx->iface.notify_invalid_framebuffer =
+ vg_context_notify_invalid_framebuffer;
+ ctx->iface.flush = vg_context_flush;
+
+ ctx->iface.teximage = NULL;
+ ctx->iface.copy = NULL;
+
+ ctx->iface.st_context_private = (void *) smapi;
+
+ return &ctx->iface;
+}
+
+static struct st_renderbuffer *
+create_renderbuffer(enum pipe_format format)
+{
+ struct st_renderbuffer *strb;
+
+ strb = CALLOC_STRUCT(st_renderbuffer);
+ if (strb)
+ strb->format = format;
+
+ return strb;
+}
+
+static void
+destroy_renderbuffer(struct st_renderbuffer *strb)
+{
+ pipe_surface_reference(&strb->surface, NULL);
+ pipe_texture_reference(&strb->texture, NULL);
+ free(strb);
+}
+
+/**
+ * Decide the buffer to render to.
+ */
+static enum st_attachment_type
+choose_attachment(struct st_framebuffer_iface *stfbi)
+{
+ enum st_attachment_type statt;
+
+ statt = stfbi->visual->render_buffer;
+ if (statt != ST_ATTACHMENT_INVALID) {
+ /* use the buffer given by the visual, unless it is unavailable */
+ if (!st_visual_have_buffers(stfbi->visual, 1 << statt)) {
+ switch (statt) {
+ case ST_ATTACHMENT_BACK_LEFT:
+ statt = ST_ATTACHMENT_FRONT_LEFT;
+ break;
+ case ST_ATTACHMENT_BACK_RIGHT:
+ statt = ST_ATTACHMENT_FRONT_RIGHT;
+ break;
+ default:
+ break;
+ }
+
+ if (!st_visual_have_buffers(stfbi->visual, 1 << statt))
+ statt = ST_ATTACHMENT_INVALID;
+ }
+ }
+
+ return statt;
+}
+
+/**
+ * Bind the context to the given framebuffers.
+ */
+static boolean
+vg_context_bind_framebuffers(struct st_context_iface *stctxi,
+ struct st_framebuffer_iface *stdrawi,
+ struct st_framebuffer_iface *streadi)
+{
+ struct vg_context *ctx = (struct vg_context *) stctxi;
+ struct st_framebuffer *stfb;
+ enum st_attachment_type strb_att;
+
+ /* the draw and read framebuffers must be the same */
+ if (stdrawi != streadi)
+ return FALSE;
+
+ p_atomic_set(&ctx->draw_buffer_invalid, TRUE);
+
+ strb_att = (stdrawi) ? choose_attachment(stdrawi) : ST_ATTACHMENT_INVALID;
+
+ if (ctx->draw_buffer) {
+ stfb = ctx->draw_buffer;
+
+ /* free the existing fb */
+ if (!stdrawi ||
+ stfb->strb_att != strb_att ||
+ stfb->strb->format != stdrawi->visual->color_format ||
+ stfb->dsrb->format != stdrawi->visual->depth_stencil_format) {
+ destroy_renderbuffer(stfb->strb);
+ destroy_renderbuffer(stfb->dsrb);
+ free(stfb);
+
+ ctx->draw_buffer = NULL;
+ }
+ }
+
+ if (!stdrawi)
+ return TRUE;
+
+ if (strb_att == ST_ATTACHMENT_INVALID)
+ return FALSE;
+
+ /* create a new fb */
+ if (!ctx->draw_buffer) {
+ stfb = CALLOC_STRUCT(st_framebuffer);
+ if (!stfb)
+ return FALSE;
+
+ stfb->strb = create_renderbuffer(stdrawi->visual->color_format);
+ if (!stfb->strb) {
+ free(stfb);
+ return FALSE;
+ }
+
+ stfb->dsrb = create_renderbuffer(stdrawi->visual->depth_stencil_format);
+ if (!stfb->dsrb) {
+ free(stfb->strb);
+ free(stfb);
+ return FALSE;
+ }
+
+ stfb->width = 0;
+ stfb->height = 0;
+ stfb->strb_att = strb_att;
+
+ ctx->draw_buffer = stfb;
+ }
+
+ ctx->draw_buffer->iface = stdrawi;
+
+ return TRUE;
+}
+
+static boolean
+vg_api_make_current(struct st_api *stapi, struct st_context_iface *stctxi,
+ struct st_framebuffer_iface *stdrawi,
+ struct st_framebuffer_iface *streadi)
+{
+ struct vg_context *ctx = (struct vg_context *) stctxi;
+
+ if (stctxi)
+ vg_context_bind_framebuffers(stctxi, stdrawi, streadi);
+ vg_set_current_context(ctx);
+
+ return TRUE;
+}
+
+static struct st_context_iface *
+vg_api_get_current(struct st_api *stapi)
+{
+ struct vg_context *ctx = vg_current_context();
+
+ return (ctx) ? &ctx->iface : NULL;
+}
+
+static boolean
+vg_api_is_visual_supported(struct st_api *stapi,
+ const struct st_visual *visual)
+{
+ /* the impl requires a depth/stencil buffer */
+ if (visual->depth_stencil_format == PIPE_FORMAT_NONE)
+ return FALSE;
+
+ return TRUE;
+}
+
+static st_proc_t
+vg_api_get_proc_address(struct st_api *stapi, const char *procname)
+{
+ /* TODO */
+ return (st_proc_t) NULL;
+}
+
+static void
+vg_api_destroy(struct st_api *stapi)
+{
+ free(stapi);
+}
+
+static struct st_api *
+vg_module_create_api(void)
+{
+ struct st_api *stapi;
+
+ stapi = CALLOC_STRUCT(st_api);
+ if (stapi) {
+ stapi->destroy = vg_api_destroy;
+ stapi->get_proc_address = vg_api_get_proc_address;
+ stapi->is_visual_supported = vg_api_is_visual_supported;
+
+ stapi->create_context = vg_api_create_context;
+ stapi->make_current = vg_api_make_current;
+ stapi->get_current = vg_api_get_current;
+ }
+
+ return stapi;
+}
+
+PUBLIC const struct st_module st_module_OpenVG = {
+ .api = ST_API_OPENVG,
+ .create_api = vg_module_create_api,
+};
diff --git a/progs/es1/screen/winsys.h b/src/gallium/state_trackers/vega/vg_manager.h
index 679c7e0bd6..1a276c0f35 100644
--- a/progs/es1/screen/winsys.h
+++ b/src/gallium/state_trackers/vega/vg_manager.h
@@ -1,5 +1,8 @@
/*
- * Copyright (C) 2009 Chia-I Wu <olv@0xlab.org>
+ * Mesa 3-D graphics library
+ * Version: 7.9
+ *
+ * Copyright (C) 2010 LunarG Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -17,20 +20,21 @@
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Chia-I Wu <olv@lunarg.com>
*/
-#ifndef _WINSYS_H_
-#define _WINSYS_H_
-
-#include <EGL/egl.h>
+#ifndef VG_MANAGER_H
+#define VG_MANAGER_H
-EGLBoolean winsysInitScreen(void);
-EGLBoolean winsysQueryScreenSize(EGLint *width, EGLint *height);
-void winsysFiniScreen(void);
+#include "state_tracker/st_api.h"
+#include "vg_context.h"
-void winsysSwapBuffers(void);
-double winsysNow(void);
+void
+vg_manager_flush_frontbuffer(struct vg_context *ctx);
-void winsysRun(double seconds, void (*draw_frame)(void *data), void *data);
+void
+vg_manager_validate_framebuffer(struct vg_context *ctx);
-#endif /* _WINSYS_H_ */
+#endif /* VG_MANAGER_H */
diff --git a/src/gallium/state_trackers/vega/vg_tracker.c b/src/gallium/state_trackers/vega/vg_tracker.c
index 57d3baad7f..108dd6a975 100644
--- a/src/gallium/state_trackers/vega/vg_tracker.c
+++ b/src/gallium/state_trackers/vega/vg_tracker.c
@@ -32,6 +32,7 @@
#include "util/u_inlines.h"
#include "pipe/p_screen.h"
#include "util/u_format.h"
+#include "util/u_sampler.h"
#include "util/u_memory.h"
#include "util/u_math.h"
#include "util/u_rect.h"
@@ -41,7 +42,7 @@ PUBLIC const int st_api_OpenVG = 1;
static struct pipe_texture *
create_texture(struct pipe_context *pipe, enum pipe_format format,
- VGint width, VGint height)
+ VGint width, VGint height)
{
struct pipe_texture templ;
@@ -71,6 +72,27 @@ create_texture(struct pipe_context *pipe, enum pipe_format format,
return pipe->screen->texture_create(pipe->screen, &templ);
}
+static struct pipe_sampler_view *
+create_tex_and_view(struct pipe_context *pipe, enum pipe_format format,
+ VGint width, VGint height)
+{
+ struct pipe_texture *texture;
+ struct pipe_sampler_view view_templ;
+ struct pipe_sampler_view *view;
+
+ texture = create_texture(pipe, format, width, height);
+
+ if (!texture)
+ return NULL;
+
+ u_sampler_view_default_template(&view_templ, texture, texture->format);
+ view = pipe->create_sampler_view(pipe, texture, &view_templ);
+ /* want the texture to go away if the view is freed */
+ pipe_texture_reference(&texture, NULL);
+
+ return view;
+}
+
/**
* Allocate a renderbuffer for a an on-screen window (not a user-created
* renderbuffer). The window system code determines the format.
@@ -115,8 +137,8 @@ st_renderbuffer_alloc_storage(struct vg_context * ctx,
surface_usage = (PIPE_BUFFER_USAGE_GPU_READ |
PIPE_BUFFER_USAGE_GPU_WRITE);
- strb->texture = create_texture(pipe, strb->format,
- width, height);
+ strb->texture = create_texture(pipe, strb->format, width, height);
+
if (!strb->texture)
return FALSE;
@@ -186,12 +208,12 @@ struct st_framebuffer * st_create_framebuffer(const void *visual,
if (stencilFormat == depthFormat)
stfb->dsrb = st_new_renderbuffer_fb(stencilFormat);
else
- stfb->dsrb = st_new_renderbuffer_fb(PIPE_FORMAT_Z24S8_UNORM);
+ stfb->dsrb = st_new_renderbuffer_fb(PIPE_FORMAT_Z24_UNORM_S8_USCALED);
/*### currently we always allocate it but it's possible it's
not necessary if EGL_ALPHA_MASK_SIZE was 0
*/
- stfb->alpha_mask = 0;
+ stfb->alpha_mask_view = NULL;
stfb->width = width;
stfb->height = height;
@@ -206,19 +228,19 @@ static void setup_new_alpha_mask(struct vg_context *ctx,
uint width, uint height)
{
struct pipe_context *pipe = ctx->pipe;
- struct pipe_texture *old_texture = stfb->alpha_mask;
+ struct pipe_sampler_view *old_sampler_view = stfb->alpha_mask_view;
/*
we use PIPE_FORMAT_B8G8R8A8_UNORM because we want to render to
this texture and use it as a sampler, so while this wastes some
space it makes both of those a lot simpler
*/
- stfb->alpha_mask =
- create_texture(pipe, PIPE_FORMAT_B8G8R8A8_UNORM, width, height);
+ stfb->alpha_mask_view =
+ create_tex_and_view(pipe, PIPE_FORMAT_B8G8R8A8_UNORM, width, height);
- if (!stfb->alpha_mask) {
- if (old_texture)
- pipe_texture_reference(&old_texture, NULL);
+ if (!stfb->alpha_mask_view) {
+ if (old_sampler_view)
+ pipe_sampler_view_reference(&old_sampler_view, NULL);
return;
}
@@ -228,15 +250,15 @@ static void setup_new_alpha_mask(struct vg_context *ctx,
mask_fill(0, 0, width, height, 1.f);
/* if we had an old surface copy it over */
- if (old_texture) {
+ if (old_sampler_view) {
struct pipe_surface *surface = pipe->screen->get_tex_surface(
pipe->screen,
- stfb->alpha_mask,
+ stfb->alpha_mask_view->texture,
0, 0, 0,
PIPE_BUFFER_USAGE_GPU_WRITE);
struct pipe_surface *old_surface = pipe->screen->get_tex_surface(
pipe->screen,
- old_texture,
+ old_sampler_view->texture,
0, 0, 0,
PIPE_BUFFER_USAGE_GPU_READ);
if (pipe->surface_copy) {
@@ -264,8 +286,8 @@ static void setup_new_alpha_mask(struct vg_context *ctx,
/* Free the old texture
*/
- if (old_texture)
- pipe_texture_reference(&old_texture, NULL);
+ if (old_sampler_view)
+ pipe_sampler_view_reference(&old_sampler_view, NULL);
}
void st_resize_framebuffer(struct st_framebuffer *stfb,
@@ -326,9 +348,9 @@ void st_resize_framebuffer(struct st_framebuffer *stfb,
setup_new_alpha_mask(ctx, stfb, width, height);
- pipe_texture_reference( &stfb->blend_texture, NULL );
- stfb->blend_texture = create_texture(ctx->pipe, PIPE_FORMAT_B8G8R8A8_UNORM,
- width, height);
+ pipe_sampler_view_reference( &stfb->blend_texture_view, NULL );
+ stfb->blend_texture_view = create_tex_and_view(ctx->pipe, PIPE_FORMAT_B8G8R8A8_UNORM,
+ width, height);
}
void st_set_framebuffer_surface(struct st_framebuffer *stfb,
@@ -376,12 +398,12 @@ void st_unreference_framebuffer(struct st_framebuffer *stfb)
boolean st_make_current(struct vg_context *st,
struct st_framebuffer *draw,
- struct st_framebuffer *read)
+ struct st_framebuffer *read,
+ void *winsys_drawable_handle)
{
vg_set_current_context(st);
- if (st) {
+ if (st)
st->draw_buffer = draw;
- }
return VG_TRUE;
}
diff --git a/src/gallium/state_trackers/vega/vg_tracker.h b/src/gallium/state_trackers/vega/vg_tracker.h
index c1196954a7..165a6b7a33 100644
--- a/src/gallium/state_trackers/vega/vg_tracker.h
+++ b/src/gallium/state_trackers/vega/vg_tracker.h
@@ -101,7 +101,8 @@ void st_unreference_framebuffer(struct st_framebuffer *stfb);
PUBLIC
boolean st_make_current(struct vg_context *st,
struct st_framebuffer *draw,
- struct st_framebuffer *read);
+ struct st_framebuffer *read,
+ void *winsys_drawable_handle);
PUBLIC
struct vg_context *st_get_current(void);
diff --git a/src/gallium/state_trackers/wgl/stw_context.c b/src/gallium/state_trackers/wgl/stw_context.c
index 05ccd5febc..1f11b649c3 100644
--- a/src/gallium/state_trackers/wgl/stw_context.c
+++ b/src/gallium/state_trackers/wgl/stw_context.c
@@ -226,7 +226,7 @@ DrvDeleteContext(
/* Unbind current if deleting current context. */
if (curctx == ctx)
- st_make_current( NULL, NULL, NULL );
+ st_make_current( NULL, NULL, NULL, NULL );
st_destroy_context(ctx->st);
FREE(ctx);
@@ -317,7 +317,7 @@ stw_make_current(
}
if (hdc == NULL || dhglrc == 0) {
- return st_make_current( NULL, NULL, NULL );
+ return st_make_current( NULL, NULL, NULL, NULL );
}
pipe_mutex_lock( stw_dev->ctx_mutex );
@@ -352,7 +352,7 @@ stw_make_current(
/* pass to stw_flush_frontbuffer as context_private */
ctx->st->pipe->priv = hdc;
- if(!st_make_current( ctx->st, fb->stfb, fb->stfb ))
+ if(!st_make_current( ctx->st, fb->stfb, fb->stfb, hdc ))
goto fail;
success:
@@ -367,7 +367,7 @@ success:
fail:
if(fb)
stw_framebuffer_release(fb);
- st_make_current( NULL, NULL, NULL );
+ st_make_current( NULL, NULL, NULL, NULL );
return FALSE;
}
diff --git a/src/gallium/state_trackers/wgl/stw_device.c b/src/gallium/state_trackers/wgl/stw_device.c
index 472a2a5379..ea300f27cb 100644
--- a/src/gallium/state_trackers/wgl/stw_device.c
+++ b/src/gallium/state_trackers/wgl/stw_device.c
@@ -33,11 +33,6 @@
#include "pipe/p_screen.h"
#include "state_tracker/st_public.h"
-#ifdef DEBUG
-#include "trace/tr_screen.h"
-#include "trace/tr_texture.h"
-#endif
-
#include "stw_device.h"
#include "stw_winsys.h"
#include "stw_pixelformat.h"
@@ -107,13 +102,10 @@ stw_init(const struct stw_winsys *stw_winsys)
if(stw_winsys->get_adapter_luid)
stw_winsys->get_adapter_luid(screen, &stw_dev->AdapterLuid);
-#ifdef DEBUG
- stw_dev->screen = trace_screen_create(screen);
- stw_dev->trace_running = stw_dev->screen != screen ? TRUE : FALSE;
-#else
stw_dev->screen = screen;
-#endif
-
+
+ /* XXX
+ */
stw_dev->screen->flush_frontbuffer = &stw_flush_frontbuffer;
pipe_mutex_init( stw_dev->ctx_mutex );
diff --git a/src/gallium/state_trackers/wgl/stw_device.h b/src/gallium/state_trackers/wgl/stw_device.h
index a83841f6b7..2e9ba197df 100644
--- a/src/gallium/state_trackers/wgl/stw_device.h
+++ b/src/gallium/state_trackers/wgl/stw_device.h
@@ -48,10 +48,6 @@ struct stw_device
struct pipe_screen *screen;
-#ifdef DEBUG
- boolean trace_running;
-#endif
-
LUID AdapterLuid;
struct stw_pixelformat_info pixelformats[STW_MAX_PIXELFORMATS];
diff --git a/src/gallium/state_trackers/wgl/stw_ext_gallium.c b/src/gallium/state_trackers/wgl/stw_ext_gallium.c
index 8dd63f124a..5ecbd8048d 100644
--- a/src/gallium/state_trackers/wgl/stw_ext_gallium.c
+++ b/src/gallium/state_trackers/wgl/stw_ext_gallium.c
@@ -31,11 +31,6 @@
#include "stw_winsys.h"
#include "stw_ext_gallium.h"
-#ifdef DEBUG
-#include "trace/tr_screen.h"
-#include "trace/tr_context.h"
-#endif
-
struct pipe_screen * APIENTRY
wglGetGalliumScreenMESA(void)
diff --git a/src/gallium/state_trackers/wgl/stw_framebuffer.c b/src/gallium/state_trackers/wgl/stw_framebuffer.c
index 02de21ccb2..4f1629de2f 100644
--- a/src/gallium/state_trackers/wgl/stw_framebuffer.c
+++ b/src/gallium/state_trackers/wgl/stw_framebuffer.c
@@ -34,11 +34,6 @@
#include "state_tracker/st_context.h"
#include "state_tracker/st_public.h"
-#ifdef DEBUG
-#include "trace/tr_screen.h"
-#include "trace/tr_texture.h"
-#endif
-
#include "stw_icd.h"
#include "stw_framebuffer.h"
#include "stw_device.h"
@@ -495,13 +490,6 @@ DrvPresentBuffers(HDC hdc, PGLPRESENTBUFFERSDATA data)
surface = (struct pipe_surface *)data->pPrivateData;
-#ifdef DEBUG
- if(stw_dev->trace_running) {
- screen = trace_screen(screen)->screen;
- surface = trace_surface(surface)->surface;
- }
-#endif
-
if(data->hSharedSurface != fb->hSharedSurface) {
if(fb->shared_surface) {
stw_dev->stw_winsys->shared_surface_close(screen, fb->shared_surface);
@@ -563,13 +551,6 @@ stw_framebuffer_present_locked(HDC hdc,
else {
struct pipe_screen *screen = stw_dev->screen;
-#ifdef DEBUG
- if(stw_dev->trace_running) {
- screen = trace_screen(screen)->screen;
- surface = trace_surface(surface)->surface;
- }
-#endif
-
stw_dev->stw_winsys->present( screen, surface, hdc );
stw_framebuffer_update(fb);
diff --git a/src/gallium/state_trackers/wgl/stw_pixelformat.c b/src/gallium/state_trackers/wgl/stw_pixelformat.c
index bc28f31ed1..02ff89a388 100644
--- a/src/gallium/state_trackers/wgl/stw_pixelformat.c
+++ b/src/gallium/state_trackers/wgl/stw_pixelformat.c
@@ -96,8 +96,8 @@ stw_pf_depth_stencil[] = {
{ PIPE_FORMAT_Z24X8_UNORM, {24, 0} },
{ PIPE_FORMAT_Z16_UNORM, {16, 0} },
/* combined depth-stencil */
- { PIPE_FORMAT_Z24S8_UNORM, {24, 8} },
- { PIPE_FORMAT_S8Z24_UNORM, {24, 8} }
+ { PIPE_FORMAT_Z24_UNORM_S8_USCALED, {24, 8} },
+ { PIPE_FORMAT_S8_USCALED_Z24_UNORM, {24, 8} }
};
diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c
index c50873c150..4ff48026e5 100644
--- a/src/gallium/state_trackers/xorg/xorg_composite.c
+++ b/src/gallium/state_trackers/xorg/xorg_composite.c
@@ -4,6 +4,7 @@
#include "xorg_exa_tgsi.h"
#include "cso_cache/cso_context.h"
+#include "util/u_sampler.h"
/*XXX also in Xrender.h but the including it here breaks compilition */
@@ -356,17 +357,12 @@ bind_samplers(struct exa_context *exa, int op,
{
struct pipe_sampler_state *samplers[PIPE_MAX_SAMPLERS];
struct pipe_sampler_state src_sampler, mask_sampler;
+ struct pipe_sampler_view view_templ;
+ struct pipe_sampler_view *src_view;
+ struct pipe_context *pipe = exa->pipe;
exa->num_bound_samplers = 0;
-#if 0
- if ((pSrc && (exa->pipe->is_texture_referenced(exa->pipe, pSrc->tex, 0, 0) &
- PIPE_REFERENCED_FOR_WRITE)) ||
- (pMask && (exa->pipe->is_texture_referenced(exa->pipe, pMask->tex, 0, 0) &
- PIPE_REFERENCED_FOR_WRITE)))
- xorg_exa_flush(exa, PIPE_FLUSH_RENDER_CACHE, NULL);
-#endif
-
memset(&src_sampler, 0, sizeof(struct pipe_sampler_state));
memset(&mask_sampler, 0, sizeof(struct pipe_sampler_state));
@@ -374,7 +370,7 @@ bind_samplers(struct exa_context *exa, int op,
if (exa->has_solid_color) {
debug_assert(!"solid color with textures");
samplers[0] = NULL;
- exa->bound_textures[0] = NULL;
+ pipe_sampler_view_reference(&exa->bound_sampler_views[0], NULL);
} else {
unsigned src_wrap = render_repeat_to_gallium(
pSrcPicture->repeatType);
@@ -389,8 +385,13 @@ bind_samplers(struct exa_context *exa, int op,
src_sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST;
src_sampler.normalized_coords = 1;
samplers[0] = &src_sampler;
- exa->bound_textures[0] = pSrc->tex;
exa->num_bound_samplers = 1;
+ u_sampler_view_default_template(&view_templ,
+ pSrc->tex,
+ pSrc->tex->format);
+ src_view = pipe->create_sampler_view(pipe, pSrc->tex, &view_templ);
+ pipe_sampler_view_reference(&exa->bound_sampler_views[0], NULL);
+ exa->bound_sampler_views[0] = src_view;
}
}
@@ -408,14 +409,19 @@ bind_samplers(struct exa_context *exa, int op,
src_sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST;
mask_sampler.normalized_coords = 1;
samplers[1] = &mask_sampler;
- exa->bound_textures[1] = pMask->tex;
exa->num_bound_samplers = 2;
+ u_sampler_view_default_template(&view_templ,
+ pMask->tex,
+ pMask->tex->format);
+ src_view = pipe->create_sampler_view(pipe, pMask->tex, &view_templ);
+ pipe_sampler_view_reference(&exa->bound_sampler_views[1], NULL);
+ exa->bound_sampler_views[1] = src_view;
}
cso_set_samplers(exa->renderer->cso, exa->num_bound_samplers,
(const struct pipe_sampler_state **)samplers);
- cso_set_sampler_textures(exa->renderer->cso, exa->num_bound_samplers,
- exa->bound_textures);
+ cso_set_fragment_sampler_views(exa->renderer->cso, exa->num_bound_samplers,
+ exa->bound_sampler_views);
}
@@ -484,7 +490,6 @@ boolean xorg_composite_bind_state(struct exa_context *exa,
renderer_begin_solid(exa->renderer);
} else {
renderer_begin_textures(exa->renderer,
- exa->bound_textures,
exa->num_bound_samplers);
}
@@ -514,7 +519,7 @@ void xorg_composite(struct exa_context *exa,
renderer_texture(exa->renderer,
pos, width, height,
- exa->bound_textures,
+ exa->bound_sampler_views,
exa->num_bound_samplers,
src_matrix, mask_matrix);
}
@@ -546,7 +551,7 @@ boolean xorg_solid_bind_state(struct exa_context *exa,
pixmap->width, pixmap->height);
bind_blend_state(exa, PictOpSrc, NULL, NULL, NULL);
cso_set_samplers(exa->renderer->cso, 0, NULL);
- cso_set_sampler_textures(exa->renderer->cso, 0, NULL);
+ cso_set_fragment_sampler_views(exa->renderer->cso, 0, NULL);
shader = xorg_shaders_get(exa->renderer->shaders, vs_traits, fs_traits);
cso_set_vertex_shader_handle(exa->renderer->cso, shader.vs);
diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c
index a428fa8d94..eef428232b 100644
--- a/src/gallium/state_trackers/xorg/xorg_crtc.c
+++ b/src/gallium/state_trackers/xorg/xorg_crtc.c
@@ -198,11 +198,11 @@ crtc_load_cursor_argb_ga3d(xf86CrtcPtr crtc, CARD32 * image)
if (!crtcp->cursor_tex) {
struct pipe_texture templat;
- unsigned pitch;
+ struct winsys_handle whandle;
memset(&templat, 0, sizeof(templat));
templat.tex_usage |= PIPE_TEXTURE_USAGE_RENDER_TARGET;
- templat.tex_usage |= PIPE_TEXTURE_USAGE_PRIMARY;
+ templat.tex_usage |= PIPE_TEXTURE_USAGE_SCANOUT;
templat.target = PIPE_TEXTURE_2D;
templat.last_level = 0;
templat.depth0 = 1;
@@ -210,25 +210,26 @@ crtc_load_cursor_argb_ga3d(xf86CrtcPtr crtc, CARD32 * image)
templat.width0 = 64;
templat.height0 = 64;
+ memset(&whandle, 0, sizeof(whandle));
+ whandle.type = DRM_API_HANDLE_TYPE_KMS;
+
crtcp->cursor_tex = ms->screen->texture_create(ms->screen,
&templat);
- ms->api->local_handle_from_texture(ms->api,
- ms->screen,
- crtcp->cursor_tex,
- &pitch,
- &crtcp->cursor_handle);
+ ms->screen->texture_get_handle(ms->screen, crtcp->cursor_tex, &whandle);
+
+ crtcp->cursor_handle = whandle.handle;
}
- transfer = ms->screen->get_tex_transfer(ms->screen, crtcp->cursor_tex,
- 0, 0, 0,
- PIPE_TRANSFER_WRITE,
- 0, 0, 64, 64);
- ptr = ms->screen->transfer_map(ms->screen, transfer);
+ transfer = ms->ctx->get_tex_transfer(ms->ctx, crtcp->cursor_tex,
+ 0, 0, 0,
+ PIPE_TRANSFER_WRITE,
+ 0, 0, 64, 64);
+ ptr = ms->ctx->transfer_map(ms->ctx, transfer);
util_copy_rect(ptr, crtcp->cursor_tex->format,
transfer->stride, 0, 0,
64, 64, (void*)image, 64 * 4, 0, 0);
- ms->screen->transfer_unmap(ms->screen, transfer);
- ms->screen->tex_transfer_destroy(transfer);
+ ms->ctx->transfer_unmap(ms->ctx, transfer);
+ ms->ctx->tex_transfer_destroy(ms->ctx, transfer);
}
#if HAVE_LIBKMS
diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c
index 5fc85c0e98..91c251bb4f 100644
--- a/src/gallium/state_trackers/xorg/xorg_dri2.c
+++ b/src/gallium/state_trackers/xorg/xorg_dri2.c
@@ -67,7 +67,7 @@ dri2_do_create_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer, unsigned int form
struct exa_pixmap_priv *exa_priv;
BufferPrivatePtr private = buffer->driverPrivate;
PixmapPtr pPixmap;
- unsigned stride, handle;
+ struct winsys_handle whandle;
if (pDraw->type == DRAWABLE_PIXMAP)
pPixmap = (PixmapPtr) pDraw;
@@ -75,6 +75,7 @@ dri2_do_create_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer, unsigned int form
pPixmap = (*pScreen->GetWindowPixmap)((WindowPtr) pDraw);
exa_priv = exaGetPixmapDriverPrivate(pPixmap);
+
switch (buffer->attachment) {
default:
if (buffer->attachment != DRI2BufferFakeFrontLeft ||
@@ -121,14 +122,14 @@ dri2_do_create_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer, unsigned int form
}
} else {
template.format = ms->ds_depth_bits_last ?
- PIPE_FORMAT_Z24S8_UNORM : PIPE_FORMAT_S8Z24_UNORM;
+ PIPE_FORMAT_Z24_UNORM_S8_USCALED : PIPE_FORMAT_S8_USCALED_Z24_UNORM;
}
template.width0 = pDraw->width;
template.height0 = pDraw->height;
template.depth0 = 1;
template.last_level = 0;
template.tex_usage = PIPE_TEXTURE_USAGE_DEPTH_STENCIL |
- PIPE_TEXTURE_USAGE_DISPLAY_TARGET;
+ PIPE_TEXTURE_USAGE_SHARED;
tex = ms->screen->texture_create(ms->screen, &template);
pipe_texture_reference(&exa_priv->depth_stencil_tex, tex);
}
@@ -153,10 +154,13 @@ dri2_do_create_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer, unsigned int form
if (!tex)
FatalError("NO TEXTURE IN DRI2\n");
- ms->api->shared_handle_from_texture(ms->api, ms->screen, tex, &stride, &handle);
+ memset(&whandle, 0, sizeof(whandle));
+ whandle.type = DRM_API_HANDLE_TYPE_SHARED;
+
+ ms->screen->texture_get_handle(ms->screen, tex, &whandle);
- buffer->name = handle;
- buffer->pitch = stride;
+ buffer->name = whandle.handle;
+ buffer->pitch = whandle.stride;
buffer->cpp = 4;
buffer->driverPrivate = private;
buffer->flags = 0; /* not tiled */
@@ -435,7 +439,7 @@ xorg_dri2_init(ScreenPtr pScreen)
PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0);
ms->ds_depth_bits_last =
- ms->screen->is_format_supported(ms->screen, PIPE_FORMAT_Z24S8_UNORM,
+ ms->screen->is_format_supported(ms->screen, PIPE_FORMAT_Z24_UNORM_S8_USCALED,
PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0);
diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c
index d7c67463d2..8ac5179545 100644
--- a/src/gallium/state_trackers/xorg/xorg_driver.c
+++ b/src/gallium/state_trackers/xorg/xorg_driver.c
@@ -994,8 +994,9 @@ static Bool
drv_create_front_buffer_ga3d(ScrnInfoPtr pScrn)
{
modesettingPtr ms = modesettingPTR(pScrn);
- unsigned handle, stride, fb_id;
struct pipe_texture *tex;
+ struct winsys_handle whandle;
+ unsigned fb_id;
int ret;
ms->noEvict = TRUE;
@@ -1006,10 +1007,10 @@ drv_create_front_buffer_ga3d(ScrnInfoPtr pScrn)
if (!tex)
return FALSE;
- if (!ms->api->local_handle_from_texture(ms->api, ms->screen,
- tex,
- &stride,
- &handle))
+ memset(&whandle, 0, sizeof(whandle));
+ whandle.type = DRM_API_HANDLE_TYPE_KMS;
+
+ if (!ms->screen->texture_get_handle(ms->screen, tex, &whandle))
goto err_destroy;
ret = drmModeAddFB(ms->fd,
@@ -1017,8 +1018,8 @@ drv_create_front_buffer_ga3d(ScrnInfoPtr pScrn)
pScrn->virtualY,
pScrn->depth,
pScrn->bitsPerPixel,
- stride,
- handle,
+ whandle.stride,
+ whandle.handle,
&fb_id);
if (ret) {
debug_printf("%s: failed to create framebuffer (%i, %s)\n",
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c
index a242e02ee7..76e6411bb8 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa.c
+++ b/src/gallium/state_trackers/xorg/xorg_exa.c
@@ -188,11 +188,7 @@ ExaDownloadFromScreen(PixmapPtr pPix, int x, int y, int w, int h, char *dst,
if (!priv || !priv->tex)
return FALSE;
- if (exa->pipe->is_texture_referenced(exa->pipe, priv->tex, 0, 0) &
- PIPE_REFERENCED_FOR_WRITE)
- exa->pipe->flush(exa->pipe, 0, NULL);
-
- transfer = exa->scrn->get_tex_transfer(exa->scrn, priv->tex, 0, 0, 0,
+ transfer = exa->pipe->get_tex_transfer(exa->pipe, priv->tex, 0, 0, 0,
PIPE_TRANSFER_READ, x, y, w, h);
if (!transfer)
return FALSE;
@@ -203,11 +199,11 @@ ExaDownloadFromScreen(PixmapPtr pPix, int x, int y, int w, int h, char *dst,
#endif
util_copy_rect((unsigned char*)dst, priv->tex->format, dst_pitch, 0, 0,
- w, h, exa->scrn->transfer_map(exa->scrn, transfer),
+ w, h, exa->pipe->transfer_map(exa->pipe, transfer),
transfer->stride, 0, 0);
- exa->scrn->transfer_unmap(exa->scrn, transfer);
- exa->scrn->tex_transfer_destroy(transfer);
+ exa->pipe->transfer_unmap(exa->pipe, transfer);
+ exa->pipe->tex_transfer_destroy(exa->pipe, transfer);
return TRUE;
}
@@ -226,12 +222,7 @@ ExaUploadToScreen(PixmapPtr pPix, int x, int y, int w, int h, char *src,
if (!priv || !priv->tex)
return FALSE;
- /* make sure that any pending operations are flushed to hardware */
- if (exa->pipe->is_texture_referenced(exa->pipe, priv->tex, 0, 0) &
- (PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE))
- xorg_exa_flush(exa, 0, NULL);
-
- transfer = exa->scrn->get_tex_transfer(exa->scrn, priv->tex, 0, 0, 0,
+ transfer = exa->pipe->get_tex_transfer(exa->pipe, priv->tex, 0, 0, 0,
PIPE_TRANSFER_WRITE, x, y, w, h);
if (!transfer)
return FALSE;
@@ -241,12 +232,12 @@ ExaUploadToScreen(PixmapPtr pPix, int x, int y, int w, int h, char *src,
x, y, w, h, src_pitch);
#endif
- util_copy_rect(exa->scrn->transfer_map(exa->scrn, transfer),
+ util_copy_rect(exa->pipe->transfer_map(exa->pipe, transfer),
priv->tex->format, transfer->stride, 0, 0, w, h,
(unsigned char*)src, src_pitch, 0, 0);
- exa->scrn->transfer_unmap(exa->scrn, transfer);
- exa->scrn->tex_transfer_destroy(transfer);
+ exa->pipe->transfer_unmap(exa->pipe, transfer);
+ exa->pipe->tex_transfer_destroy(exa->pipe, transfer);
return TRUE;
}
@@ -270,15 +261,11 @@ ExaPrepareAccess(PixmapPtr pPix, int index)
if (priv->map_count == 0)
{
- if (exa->pipe->is_texture_referenced(exa->pipe, priv->tex, 0, 0) &
- PIPE_REFERENCED_FOR_WRITE)
- exa->pipe->flush(exa->pipe, 0, NULL);
-
assert(pPix->drawable.width <= priv->tex->width0);
assert(pPix->drawable.height <= priv->tex->height0);
priv->map_transfer =
- exa->scrn->get_tex_transfer(exa->scrn, priv->tex, 0, 0, 0,
+ exa->pipe->get_tex_transfer(exa->pipe, priv->tex, 0, 0, 0,
#ifdef EXA_MIXED_PIXMAPS
PIPE_TRANSFER_MAP_DIRECTLY |
#endif
@@ -294,7 +281,7 @@ ExaPrepareAccess(PixmapPtr pPix, int index)
#endif
pPix->devPrivate.ptr =
- exa->scrn->transfer_map(exa->scrn, priv->map_transfer);
+ exa->pipe->transfer_map(exa->pipe, priv->map_transfer);
pPix->devKind = priv->map_transfer->stride;
}
@@ -321,8 +308,8 @@ ExaFinishAccess(PixmapPtr pPix, int index)
if (--priv->map_count == 0) {
assert(priv->map_transfer);
- exa->scrn->transfer_unmap(exa->scrn, priv->map_transfer);
- exa->scrn->tex_transfer_destroy(priv->map_transfer);
+ exa->pipe->transfer_unmap(exa->pipe, priv->map_transfer);
+ exa->pipe->tex_transfer_destroy(exa->pipe, priv->map_transfer);
priv->map_transfer = NULL;
pPix->devPrivate.ptr = NULL;
}
@@ -789,7 +776,7 @@ xorg_exa_set_displayed_usage(PixmapPtr pPixmap)
return 0;
}
- priv->flags |= PIPE_TEXTURE_USAGE_PRIMARY;
+ priv->flags |= PIPE_TEXTURE_USAGE_SCANOUT;
return 0;
}
@@ -805,7 +792,7 @@ xorg_exa_set_shared_usage(PixmapPtr pPixmap)
return 0;
}
- priv->flags |= PIPE_TEXTURE_USAGE_DISPLAY_TARGET;
+ priv->flags |= PIPE_TEXTURE_USAGE_SHARED;
return 0;
}
@@ -943,7 +930,7 @@ xorg_exa_set_texture(PixmapPtr pPixmap, struct pipe_texture *tex)
{
struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPixmap);
- int mask = PIPE_TEXTURE_USAGE_PRIMARY | PIPE_TEXTURE_USAGE_DISPLAY_TARGET;
+ int mask = PIPE_TEXTURE_USAGE_SHARED | PIPE_TEXTURE_USAGE_SCANOUT;
if (!priv)
return FALSE;
@@ -976,8 +963,8 @@ xorg_exa_create_root_texture(ScrnInfoPtr pScrn,
template.depth0 = 1;
template.last_level = 0;
template.tex_usage |= PIPE_TEXTURE_USAGE_RENDER_TARGET;
- template.tex_usage |= PIPE_TEXTURE_USAGE_PRIMARY;
- template.tex_usage |= PIPE_TEXTURE_USAGE_DISPLAY_TARGET;
+ template.tex_usage |= PIPE_TEXTURE_USAGE_SCANOUT;
+ template.tex_usage |= PIPE_TEXTURE_USAGE_SHARED;
return exa->scrn->texture_create(exa->scrn, &template);
}
@@ -988,6 +975,9 @@ xorg_exa_close(ScrnInfoPtr pScrn)
modesettingPtr ms = modesettingPTR(pScrn);
struct exa_context *exa = ms->exa;
+ pipe_sampler_view_reference(&exa->bound_sampler_views[0], NULL);
+ pipe_sampler_view_reference(&exa->bound_sampler_views[1], NULL);
+
renderer_destroy(exa->renderer);
if (exa->pipe)
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.h b/src/gallium/state_trackers/xorg/xorg_exa.h
index f2cefe23b9..41b1906159 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa.h
+++ b/src/gallium/state_trackers/xorg/xorg_exa.h
@@ -18,7 +18,7 @@ struct exa_context
struct pipe_screen *scrn;
struct xorg_renderer *renderer;
- struct pipe_texture *bound_textures[MAX_EXA_SAMPLERS];
+ struct pipe_sampler_view *bound_sampler_views[MAX_EXA_SAMPLERS];
int num_bound_samplers;
float solid_color[4];
diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c
index 83b0d31e38..81b0dcf656 100644
--- a/src/gallium/state_trackers/xorg/xorg_renderer.c
+++ b/src/gallium/state_trackers/xorg/xorg_renderer.c
@@ -8,6 +8,7 @@
#include "util/u_math.h"
#include "util/u_memory.h"
#include "util/u_rect.h"
+#include "util/u_sampler.h"
#include "util/u_inlines.h"
@@ -68,6 +69,8 @@ renderer_draw(struct xorg_renderer *r)
if (buf) {
+ cso_set_vertex_elements(r->cso, r->attrs_per_vertex, r->velems);
+
util_draw_vertex_buffer(pipe, buf, 0,
PIPE_PRIM_QUADS,
num_verts, /* verts */
@@ -92,6 +95,7 @@ renderer_init_state(struct xorg_renderer *r)
{
struct pipe_depth_stencil_alpha_state dsa;
struct pipe_rasterizer_state raster;
+ unsigned i;
/* set common initial clip state */
memset(&dsa, 0, sizeof(struct pipe_depth_stencil_alpha_state));
@@ -103,6 +107,14 @@ renderer_init_state(struct xorg_renderer *r)
raster.gl_rasterization_rules = 1;
cso_set_rasterizer(r->cso, &raster);
+ /* vertex elements state */
+ memset(&r->velems[0], 0, sizeof(r->velems[0]) * 3);
+ for (i = 0; i < 3; i++) {
+ r->velems[i].src_offset = i * 4 * sizeof(float);
+ r->velems[i].instance_divisor = 0;
+ r->velems[i].vertex_buffer_index = 0;
+ r->velems[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+ }
}
@@ -471,8 +483,17 @@ void renderer_copy_prepare(struct xorg_renderer *r,
dst_surface->width,
dst_surface->height);
- /* texture */
- cso_set_sampler_textures(r->cso, 1, &src_texture);
+ /* texture/sampler view */
+ {
+ struct pipe_sampler_view templ;
+ struct pipe_sampler_view *src_view;
+ u_sampler_view_default_template(&templ,
+ src_texture,
+ src_texture->format);
+ src_view = pipe->create_sampler_view(pipe, src_texture, &templ);
+ cso_set_fragment_sampler_views(r->cso, 1, &src_view);
+ pipe_sampler_view_reference(&src_view, NULL);
+ }
/* shaders */
shader = xorg_shaders_get(r->shaders,
@@ -600,6 +621,8 @@ void renderer_draw_yuv(struct xorg_renderer *r,
if (buf) {
const int num_attribs = 2; /*pos + tex coord*/
+ cso_set_vertex_elements(r->cso, num_attribs, r->velems);
+
util_draw_vertex_buffer(pipe, buf, 0,
PIPE_PRIM_QUADS,
4, /* verts */
@@ -642,7 +665,6 @@ void renderer_draw_flush(struct xorg_renderer *r)
}
void renderer_begin_textures(struct xorg_renderer *r,
- struct pipe_texture **textures,
int num_textures)
{
r->attrs_per_vertex = 1 + num_textures;
@@ -652,7 +674,7 @@ void renderer_begin_textures(struct xorg_renderer *r,
void renderer_texture(struct xorg_renderer *r,
int *pos,
int width, int height,
- struct pipe_texture **textures,
+ struct pipe_sampler_view **sampler_view,
int num_textures,
float *src_matrix,
float *mask_matrix)
@@ -680,7 +702,7 @@ void renderer_texture(struct xorg_renderer *r,
pos[0], pos[1], /* src */
pos[4], pos[5], /* dst */
width, height,
- textures[0], src_matrix);
+ sampler_view[0]->texture, src_matrix);
break;
case 3:
renderer_draw_conditional(r, 4 * 12);
@@ -689,7 +711,7 @@ void renderer_texture(struct xorg_renderer *r,
pos[2], pos[3], /* mask */
pos[4], pos[5], /* dst */
width, height,
- textures[0], textures[1],
+ sampler_view[0]->texture, sampler_view[1]->texture,
src_matrix, mask_matrix);
break;
default:
diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.h b/src/gallium/state_trackers/xorg/xorg_renderer.h
index af6aa0567d..cc5802e79b 100644
--- a/src/gallium/state_trackers/xorg/xorg_renderer.h
+++ b/src/gallium/state_trackers/xorg/xorg_renderer.h
@@ -28,6 +28,7 @@ struct xorg_renderer {
float buffer[BUF_SIZE];
int buffer_size;
+ struct pipe_vertex_element velems[3];
/* number of attributes per vertex for the current
* draw operation */
@@ -64,12 +65,12 @@ void renderer_solid(struct xorg_renderer *r,
float *color);
void renderer_begin_textures(struct xorg_renderer *r,
- struct pipe_texture **textures,
int num_textures);
+
void renderer_texture(struct xorg_renderer *r,
int *pos,
int width, int height,
- struct pipe_texture **textures,
+ struct pipe_sampler_view **textures,
int num_textures,
float *src_matrix,
float *mask_matrix);
diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c
index e37a1c3959..5efda6837d 100644
--- a/src/gallium/state_trackers/xorg/xorg_xv.c
+++ b/src/gallium/state_trackers/xorg/xorg_xv.c
@@ -9,6 +9,7 @@
#include "xorg_exa_tgsi.h"
#include "cso_cache/cso_context.h"
+#include "util/u_sampler.h"
#include "pipe/p_screen.h"
@@ -91,6 +92,7 @@ struct xorg_xv_port_priv {
/* juggle two sets of seperate Y, U and V
* textures */
struct pipe_texture *yuv[2][3];
+ struct pipe_sampler_view *yuv_views[2][3];
};
@@ -180,32 +182,60 @@ static int
check_yuv_textures(struct xorg_xv_port_priv *priv, int width, int height)
{
struct pipe_texture **dst = priv->yuv[priv->current_set];
+ struct pipe_sampler_view **dst_view = priv->yuv_views[priv->current_set];
+ struct pipe_sampler_view view_templ;
+ struct pipe_context *pipe = priv->r->pipe;
+
if (!dst[0] ||
dst[0]->width0 != width ||
dst[0]->height0 != height) {
pipe_texture_reference(&dst[0], NULL);
+ pipe_sampler_view_reference(&dst_view[0], NULL);
}
if (!dst[1] ||
dst[1]->width0 != width ||
dst[1]->height0 != height) {
pipe_texture_reference(&dst[1], NULL);
+ pipe_sampler_view_reference(&dst_view[1], NULL);
}
if (!dst[2] ||
dst[2]->width0 != width ||
dst[2]->height0 != height) {
pipe_texture_reference(&dst[2], NULL);
+ pipe_sampler_view_reference(&dst_view[2], NULL);
}
- if (!dst[0])
+ if (!dst[0]) {
dst[0] = create_component_texture(priv->r->pipe, width, height);
+ if (dst[0]) {
+ u_sampler_view_default_template(&view_templ,
+ dst[0],
+ dst[0]->format);
+ dst_view[0] = pipe->create_sampler_view(pipe, dst[0], &view_templ);
+ }
+ }
- if (!dst[1])
+ if (!dst[1]) {
dst[1] = create_component_texture(priv->r->pipe, width, height);
+ if (dst[1]) {
+ u_sampler_view_default_template(&view_templ,
+ dst[1],
+ dst[1]->format);
+ dst_view[1] = pipe->create_sampler_view(pipe, dst[1], &view_templ);
+ }
+ }
- if (!dst[2])
+ if (!dst[2]) {
dst[2] = create_component_texture(priv->r->pipe, width, height);
+ if (dst[2]) {
+ u_sampler_view_default_template(&view_templ,
+ dst[2],
+ dst[2]->format);
+ dst_view[2] = pipe->create_sampler_view(pipe, dst[2], &view_templ);
+ }
+ }
- if (!dst[0] || !dst[1] || !dst[2])
+ if (!dst[0] || !dst[1] || !dst[2] || !dst_view[0] || !dst_view[1] || !dst_view[2] )
return BadAlloc;
return Success;
@@ -275,28 +305,28 @@ copy_packed_data(ScrnInfoPtr pScrn,
int i, j;
struct pipe_texture **dst = port->yuv[port->current_set];
struct pipe_transfer *ytrans, *utrans, *vtrans;
- struct pipe_screen *screen = port->r->pipe->screen;
+ struct pipe_context *pipe = port->r->pipe;
char *ymap, *vmap, *umap;
unsigned char y1, y2, u, v;
int yidx, uidx, vidx;
int y_array_size = w * h;
- ytrans = screen->get_tex_transfer(screen, dst[0],
- 0, 0, 0,
- PIPE_TRANSFER_WRITE,
- left, top, w, h);
- utrans = screen->get_tex_transfer(screen, dst[1],
- 0, 0, 0,
- PIPE_TRANSFER_WRITE,
- left, top, w, h);
- vtrans = screen->get_tex_transfer(screen, dst[2],
- 0, 0, 0,
- PIPE_TRANSFER_WRITE,
- left, top, w, h);
-
- ymap = (char*)screen->transfer_map(screen, ytrans);
- umap = (char*)screen->transfer_map(screen, utrans);
- vmap = (char*)screen->transfer_map(screen, vtrans);
+ ytrans = pipe->get_tex_transfer(pipe, dst[0],
+ 0, 0, 0,
+ PIPE_TRANSFER_WRITE,
+ left, top, w, h);
+ utrans = pipe->get_tex_transfer(pipe, dst[1],
+ 0, 0, 0,
+ PIPE_TRANSFER_WRITE,
+ left, top, w, h);
+ vtrans = pipe->get_tex_transfer(pipe, dst[2],
+ 0, 0, 0,
+ PIPE_TRANSFER_WRITE,
+ left, top, w, h);
+
+ ymap = (char*)pipe->transfer_map(pipe, ytrans);
+ umap = (char*)pipe->transfer_map(pipe, utrans);
+ vmap = (char*)pipe->transfer_map(pipe, vtrans);
yidx = uidx = vidx = 0;
@@ -362,12 +392,12 @@ copy_packed_data(ScrnInfoPtr pScrn,
break;
}
- screen->transfer_unmap(screen, ytrans);
- screen->transfer_unmap(screen, utrans);
- screen->transfer_unmap(screen, vtrans);
- screen->tex_transfer_destroy(ytrans);
- screen->tex_transfer_destroy(utrans);
- screen->tex_transfer_destroy(vtrans);
+ pipe->transfer_unmap(pipe, ytrans);
+ pipe->transfer_unmap(pipe, utrans);
+ pipe->transfer_unmap(pipe, vtrans);
+ pipe->tex_transfer_destroy(pipe, ytrans);
+ pipe->tex_transfer_destroy(pipe, utrans);
+ pipe->tex_transfer_destroy(pipe, vtrans);
}
@@ -450,6 +480,7 @@ bind_samplers(struct xorg_xv_port_priv *port)
struct pipe_sampler_state *samplers[PIPE_MAX_SAMPLERS];
struct pipe_sampler_state sampler;
struct pipe_texture **dst = port->yuv[port->current_set];
+ struct pipe_sampler_view **dst_views = port->yuv_views[port->current_set];
memset(&sampler, 0, sizeof(struct pipe_sampler_state));
@@ -469,8 +500,7 @@ bind_samplers(struct xorg_xv_port_priv *port)
cso_set_samplers(port->r->cso, 3,
(const struct pipe_sampler_state **)samplers);
- cso_set_sampler_textures(port->r->cso, 3,
- dst);
+ cso_set_fragment_sampler_views(port->r->cso, 3, dst_views);
}
static int
diff --git a/src/gallium/state_trackers/xorg/xvmc/surface.c b/src/gallium/state_trackers/xorg/xvmc/surface.c
index 87d1dfaace..12d94e0c5c 100644
--- a/src/gallium/state_trackers/xorg/xvmc/surface.c
+++ b/src/gallium/state_trackers/xorg/xvmc/surface.c
@@ -106,7 +106,7 @@ CreateOrResizeBackBuffer(struct pipe_video_context *vpipe, unsigned int width, u
template.width0 = width;
template.height0 = height;
template.depth0 = 1;
- template.tex_usage = PIPE_TEXTURE_USAGE_DISPLAY_TARGET;
+ template.tex_usage = PIPE_TEXTURE_USAGE_SHARED;
tex = vpipe->screen->texture_create(vpipe->screen, &template);
if (!tex)
diff --git a/src/gallium/winsys/drm/Makefile b/src/gallium/targets/Makefile
index fee0191643..a0bc5eb14f 100644
--- a/src/gallium/winsys/drm/Makefile
+++ b/src/gallium/targets/Makefile
@@ -1,8 +1,8 @@
# src/gallium/winsys/Makefile
-TOP = ../../../..
+TOP = ../../..
include $(TOP)/configs/current
-SUBDIRS = $(GALLIUM_WINSYS_DRM_DIRS)
+SUBDIRS = $(GALLIUM_TARGET_DIRS)
default install clean:
@for dir in $(SUBDIRS) ; do \
diff --git a/src/gallium/winsys/drm/Makefile.template b/src/gallium/targets/Makefile.dri
index f4cc0def47..6d9b81aa24 100644
--- a/src/gallium/winsys/drm/Makefile.template
+++ b/src/gallium/targets/Makefile.dri
@@ -64,11 +64,14 @@ SHARED_INCLUDES = \
default: depend symlinks $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME)
$(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(PIPE_DRIVERS) Makefile \
- $(TOP)/src/mesa/drivers/dri/Makefile.template
- $(MKLIB) -o $@ -noprefix -linker '$(CC)' -ldflags '$(LDFLAGS)' \
+ $(TOP)/src/mesa/drivers/dri/Makefile.template $(TOP)/src/mesa/drivers/dri/common/dri_test.o
+ $(MKLIB) -o $@.tmp -noprefix -linker '$(CC)' -ldflags '$(LDFLAGS)' \
$(OBJECTS) $(PIPE_DRIVERS) \
-Wl,--start-group $(MESA_MODULES) -Wl,--end-group \
$(DRI_LIB_DEPS) $(DRIVER_EXTRAS)
+ $(CC) -o $@.test $(TOP)/src/mesa/drivers/dri/common/dri_test.o $@.tmp $(DRI_LIB_DEPS)
+ @rm -f $@.test
+ mv -f $@.tmp $@
$(TOP)/$(LIB_DIR)/gallium:
mkdir -p $@
diff --git a/src/gallium/winsys/drm/Makefile.egl b/src/gallium/targets/Makefile.egl
index 8363de6e97..9265e2eb7b 100644
--- a/src/gallium/winsys/drm/Makefile.egl
+++ b/src/gallium/targets/Makefile.egl
@@ -13,7 +13,14 @@ EGL_DRIVER_OBJECTS = $(EGL_DRIVER_SOURCES:.c=.o)
common_LIBS = -ldrm -lm -ldl
-x11_ST = $(TOP)/src/gallium/state_trackers/egl/libeglx11.a
+# ximage backend calls gallium_wrap_screen, which requires libidentity.a and
+# libtrace.a
+x11_ST = $(TOP)/src/gallium/state_trackers/egl/libeglx11.a \
+ $(TOP)/src/gallium/winsys/sw/xlib/libws_xlib.a \
+ $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
+ $(TOP)/src/gallium/drivers/identity/libidentity.a \
+ $(TOP)/src/gallium/drivers/trace/libtrace.a
+
x11_LIBS = $(common_LIBS) -lX11 -lXext -lXfixes
kms_ST = $(TOP)/src/gallium/state_trackers/egl/libeglkms.a
@@ -38,8 +45,10 @@ $(EGL_DISPLAY_LIBS): $(TOP)/$(LIB_DIR)/%.so: %.so
define mklib-egl
$(MKLIB) -o $@ -noprefix -linker '$(CC)' -ldflags '$(LDFLAGS)' \
- $(MKLIB_OPTIONS) $(EGL_DRIVER_OBJECTS) $($(1)_ST) \
- $(EGL_DRIVER_PIPES) $(GALLIUM_AUXILIARIES) $($(1)_LIBS) $(EGL_DRIVER_LIBS)
+ $(MKLIB_OPTIONS) $(EGL_DRIVER_OBJECTS) \
+ -Wl,--start-group $($(1)_ST) $(EGL_DRIVER_PIPES) \
+ $(GALLIUM_AUXILIARIES) -Wl,--end-group \
+ $($(1)_LIBS) $(EGL_DRIVER_LIBS)
endef
egl_x11_$(EGL_DRIVER_NAME).so: $(EGL_DRIVER_OBJECTS) $(x11_ST) $(EGL_DRIVER_PIPES) $(GALLIUM_AUXILIARIES) Makefile
diff --git a/src/gallium/targets/SConscript b/src/gallium/targets/SConscript
new file mode 100644
index 0000000000..1292d4f619
--- /dev/null
+++ b/src/gallium/targets/SConscript
@@ -0,0 +1,27 @@
+Import('*')
+
+if 'xlib' in env['winsys']:
+ SConscript([
+ 'libgl-xlib/SConscript',
+ ])
+
+if 'gdi' in env['winsys']:
+ SConscript([
+ 'libgl-gdi/SConscript',
+ ])
+
+if 'graw-xlib' in env['winsys']:
+ SConscript([
+ 'graw-xlib/SConscript',
+ ])
+
+if env['dri']:
+ SConscript([
+ 'SConscript.dri'
+ ])
+
+if 'xorg' in env['statetrackers']:
+ if 'vmware' in env['winsys']:
+ SConscript([
+ 'xorg-vmwgfx/SConscript',
+ ])
diff --git a/src/gallium/targets/SConscript.dri b/src/gallium/targets/SConscript.dri
new file mode 100644
index 0000000000..210af13720
--- /dev/null
+++ b/src/gallium/targets/SConscript.dri
@@ -0,0 +1,96 @@
+###################################
+# SConcscript file for dri targets
+
+Import('*')
+
+drienv = env.Clone()
+
+drienv.Replace(CPPPATH = [
+ '#src/mesa/drivers/dri/common',
+ '#include',
+ '#include/GL/internal',
+ '#src/gallium/include',
+ '#src/gallium/auxiliary',
+ '#src/gallium/drivers',
+ '#src/mesa',
+ '#src/mesa/main',
+ '#src/mesa/glapi',
+ '#src/mesa/math',
+ '#src/mesa/transform',
+ '#src/mesa/shader',
+ '#src/mesa/swrast',
+ '#src/mesa/swrast_setup',
+ '#src/egl/main',
+ '#src/egl/drivers/dri',
+])
+
+drienv.ParseConfig('pkg-config --cflags --libs libdrm')
+
+dri_common_utils = drienv.SharedObject(
+ target = 'utils.o',
+ source = '#src/mesa/drivers/dri/common/utils.c'
+)
+
+dri_common_xmlconfig = drienv.SharedObject(
+ target = 'xmlconfig.o',
+ source = '#src/mesa/drivers/dri/common/xmlconfig.c'
+)
+
+dri_common_vblank = drienv.SharedObject(
+ target = 'vblank.o',
+ source = '#src/mesa/drivers/dri/common/vblank.c'
+)
+
+dri_common_dri_util = drienv.SharedObject(
+ target = 'dri_util.o',
+ source = '#src/mesa/drivers/dri/common/dri_util.c'
+)
+
+dri_common_drisw_util = drienv.SharedObject(
+ target = 'drisw_util.o',
+ source = '#src/mesa/drivers/dri/common/drisw_util.c'
+)
+
+
+COMMON_DRI_SW_OBJECTS = [
+ dri_common_utils,
+ dri_common_xmlconfig,
+ dri_common_drisw_util,
+]
+
+COMMON_DRI_DRM_OBJECTS = [
+ dri_common_utils,
+ dri_common_xmlconfig,
+ dri_common_vblank,
+ dri_common_dri_util,
+]
+
+Export([
+ 'drienv',
+ 'COMMON_DRI_SW_OBJECTS',
+ 'COMMON_DRI_DRM_OBJECTS',
+])
+
+SConscript([
+ 'dri-swrast/SConscript',
+])
+
+if 'vmware' in env['winsys']:
+ SConscript([
+ 'dri-vmwgfx/SConscript',
+ ])
+
+if 'i915' in env['winsys']:
+ SConscript([
+ 'dri-i915/SConscript',
+ ])
+
+if 'i965' in env['winsys']:
+ SConscript([
+ 'dri-i965/SConscript',
+ ])
+
+if 'radeon' in env['winsys']:
+ SConscript([
+ 'dri-radeong/SConscript',
+ ])
diff --git a/src/gallium/winsys/drm/intel/dri/Makefile b/src/gallium/targets/dri-i915/Makefile
index 26aae4122e..50a8e11e17 100644
--- a/src/gallium/winsys/drm/intel/dri/Makefile
+++ b/src/gallium/targets/dri-i915/Makefile
@@ -1,26 +1,22 @@
-TOP = ../../../../../..
+TOP = ../../../..
include $(TOP)/configs/current
LIBNAME = i915_dri.so
PIPE_DRIVERS = \
- $(TOP)/src/gallium/state_trackers/dri/libdridrm.a \
- $(TOP)/src/gallium/winsys/drm/intel/gem/libinteldrm.a \
+ $(TOP)/src/gallium/state_trackers/dri/drm/libdridrm.a \
+ $(TOP)/src/gallium/winsys/i915/drm/libi915drm.a \
$(TOP)/src/gallium/drivers/trace/libtrace.a \
$(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
$(TOP)/src/gallium/drivers/identity/libidentity.a \
$(TOP)/src/gallium/drivers/i915/libi915.a
-
-DRIVER_SOURCES =
-
C_SOURCES = \
$(COMMON_GALLIUM_SOURCES) \
$(DRIVER_SOURCES)
-include ../../Makefile.template
+include ../Makefile.dri
DRI_LIB_DEPS += -ldrm_intel
-symlinks: $(TOP)/$(LIB_DIR)/gallium
- @rm -f $(TOP)/$(LIB_DIR)/gallium/i965_dri.so
+symlinks:
diff --git a/src/gallium/targets/dri-i915/SConscript b/src/gallium/targets/dri-i915/SConscript
new file mode 100644
index 0000000000..2fcc8028f1
--- /dev/null
+++ b/src/gallium/targets/dri-i915/SConscript
@@ -0,0 +1,26 @@
+Import('*')
+
+if not 'i915' in env['drivers']:
+ print 'warning: i915 pipe driver not built skipping i915_dri.so'
+ Return()
+
+env = drienv.Clone()
+
+env.ParseConfig('pkg-config --cflags --libs libdrm_intel')
+
+env.Prepend(LIBS = [
+ st_dri,
+ i915drm,
+ i915,
+ trace,
+ mesa,
+ glsl,
+ gallium,
+ COMMON_DRI_DRM_OBJECTS
+])
+
+env.LoadableModule(
+ target = 'i915_dri.so',
+ source = 'dummy.c',
+ SHLIBPREFIX = '',
+)
diff --git a/src/gallium/targets/dri-i915/dummy.c b/src/gallium/targets/dri-i915/dummy.c
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/src/gallium/targets/dri-i915/dummy.c
diff --git a/src/gallium/winsys/drm/i965/dri/Makefile b/src/gallium/targets/dri-i965/Makefile
index f7e81eed87..e267ba3a02 100644
--- a/src/gallium/winsys/drm/i965/dri/Makefile
+++ b/src/gallium/targets/dri-i965/Makefile
@@ -1,26 +1,24 @@
-TOP = ../../../../../..
+TOP = ../../../..
include $(TOP)/configs/current
LIBNAME = i965_dri.so
PIPE_DRIVERS = \
- $(TOP)/src/gallium/state_trackers/dri/libdridrm.a \
- $(TOP)/src/gallium/winsys/drm/i965/gem/libi965drm.a \
+ $(TOP)/src/gallium/state_trackers/dri/drm/libdridrm.a \
+ $(TOP)/src/gallium/winsys/i965/drm/libi965drm.a \
$(TOP)/src/gallium/drivers/trace/libtrace.a \
+ $(TOP)/src/gallium/winsys/sw/drm/libswdrm.a \
+ $(TOP)/src/gallium/winsys/sw/wrapper/libwsw.a \
$(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
$(TOP)/src/gallium/drivers/identity/libidentity.a \
$(TOP)/src/gallium/drivers/i965/libi965.a
-
-DRIVER_SOURCES =
-
C_SOURCES = \
$(COMMON_GALLIUM_SOURCES) \
$(DRIVER_SOURCES)
-include ../../Makefile.template
+include ../Makefile.dri
DRI_LIB_DEPS += -ldrm_intel
-symlinks: $(TOP)/$(LIB_DIR)/gallium
- @rm -f $(TOP)/$(LIB_DIR)/gallium/i965_dri.so
+symlinks:
diff --git a/src/gallium/targets/dri-i965/SConscript b/src/gallium/targets/dri-i965/SConscript
new file mode 100644
index 0000000000..eb9e6cd172
--- /dev/null
+++ b/src/gallium/targets/dri-i965/SConscript
@@ -0,0 +1,26 @@
+Import('*')
+
+if not 'i965' in env['drivers']:
+ print 'warning: i965 pipe driver not built skipping i965_dri.so'
+ Return()
+
+env = drienv.Clone()
+
+env.ParseConfig('pkg-config --cflags --libs libdrm_intel')
+
+env.Prepend(LIBS = [
+ st_dri,
+ i965drm,
+ i965,
+ trace,
+ mesa,
+ glsl,
+ gallium,
+ COMMON_DRI_DRM_OBJECTS
+])
+
+env.LoadableModule(
+ target = 'i965_dri.so',
+ source = 'dummy.c',
+ SHLIBPREFIX = '',
+)
diff --git a/src/gallium/targets/dri-i965/dummy.c b/src/gallium/targets/dri-i965/dummy.c
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/src/gallium/targets/dri-i965/dummy.c
diff --git a/src/gallium/winsys/drm/nouveau/dri/Makefile b/src/gallium/targets/dri-nouveau/Makefile
index 7e95f79d03..74d352c6a7 100644
--- a/src/gallium/winsys/drm/nouveau/dri/Makefile
+++ b/src/gallium/targets/dri-nouveau/Makefile
@@ -1,23 +1,20 @@
-TOP = ../../../../../..
+TOP = ../../../..
include $(TOP)/configs/current
LIBNAME = nouveau_dri.so
PIPE_DRIVERS = \
- $(TOP)/src/gallium/state_trackers/dri/libdridrm.a \
- $(TOP)/src/gallium/winsys/drm/nouveau/drm/libnouveaudrm.a \
- $(TOP)/src/gallium/drivers/nv30/libnv30.a \
- $(TOP)/src/gallium/drivers/nv40/libnv40.a \
+ $(TOP)/src/gallium/state_trackers/dri/drm/libdridrm.a \
+ $(TOP)/src/gallium/winsys/nouveau/drm/libnouveaudrm.a \
+ $(TOP)/src/gallium/drivers/nvfx/libnvfx.a \
$(TOP)/src/gallium/drivers/nv50/libnv50.a \
$(TOP)/src/gallium/drivers/nouveau/libnouveau.a
-DRIVER_SOURCES =
-
C_SOURCES = \
$(COMMON_GALLIUM_SOURCES) \
$(DRIVER_SOURCES)
-include ../../Makefile.template
+include ../Makefile.dri
DRI_LIB_DEPS += $(shell pkg-config libdrm_nouveau --libs)
diff --git a/src/gallium/winsys/drm/radeon/dri/Makefile b/src/gallium/targets/dri-radeong/Makefile
index d75f7dd6da..66dd392b68 100644
--- a/src/gallium/winsys/drm/radeon/dri/Makefile
+++ b/src/gallium/targets/dri-radeong/Makefile
@@ -1,12 +1,11 @@
-
-TOP = ../../../../../..
+TOP = ../../../..
include $(TOP)/configs/current
LIBNAME = radeong_dri.so
PIPE_DRIVERS = \
- $(TOP)/src/gallium/state_trackers/dri/libdridrm.a \
- $(TOP)/src/gallium/winsys/drm/radeon/core/libradeonwinsys.a \
+ $(TOP)/src/gallium/state_trackers/dri/drm/libdridrm.a \
+ $(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
$(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
$(TOP)/src/gallium/drivers/trace/libtrace.a \
$(TOP)/src/gallium/drivers/r300/libr300.a
@@ -15,9 +14,7 @@ C_SOURCES = \
$(COMMON_GALLIUM_SOURCES) \
$(DRIVER_SOURCES)
-ASM_SOURCES =
-
-include ../../Makefile.template
+include ../Makefile.dri
DRI_LIB_DEPS += -ldrm_radeon
diff --git a/src/gallium/targets/dri-radeong/SConscript b/src/gallium/targets/dri-radeong/SConscript
new file mode 100644
index 0000000000..d926c27288
--- /dev/null
+++ b/src/gallium/targets/dri-radeong/SConscript
@@ -0,0 +1,26 @@
+Import('*')
+
+if not 'r300' in env['drivers']:
+ print 'warning: r300 pipe driver not built skipping radeong_dri.so'
+ Return()
+
+env = drienv.Clone()
+
+env.ParseConfig('pkg-config --cflags --libs libdrm_radeon')
+
+env.Prepend(LIBS = [
+ st_dri,
+ radeonwinsys,
+ r300,
+ trace,
+ mesa,
+ glsl,
+ gallium,
+ COMMON_DRI_DRM_OBJECTS
+])
+
+env.SharedLibrary(
+ target ='radeon_dri.so',
+ source = 'dummy.c',
+ SHLIBPREFIX = '',
+)
diff --git a/src/gallium/targets/dri-radeong/dummy.c b/src/gallium/targets/dri-radeong/dummy.c
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/src/gallium/targets/dri-radeong/dummy.c
diff --git a/src/gallium/targets/dri-swrast/Makefile b/src/gallium/targets/dri-swrast/Makefile
new file mode 100644
index 0000000000..fcfd690e43
--- /dev/null
+++ b/src/gallium/targets/dri-swrast/Makefile
@@ -0,0 +1,30 @@
+TOP = ../../../..
+include $(TOP)/configs/current
+
+LIBNAME = swrastg_dri.so
+
+DRIVER_DEFINES = -D__NOT_HAVE_DRM_H -DGALLIUM_SOFTPIPE
+
+PIPE_DRIVERS = \
+ $(TOP)/src/gallium/state_trackers/dri/sw/libdrisw.a \
+ $(TOP)/src/gallium/winsys/sw/dri/libswdri.a \
+ $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a
+
+SWRAST_COMMON_GALLIUM_SOURCES = \
+ $(TOP)/src/mesa/drivers/dri/common/utils.c \
+ $(TOP)/src/mesa/drivers/dri/common/drisw_util.c \
+ $(TOP)/src/mesa/drivers/dri/common/xmlconfig.c
+
+C_SOURCES = \
+ swrast_drm_api.c \
+ $(SWRAST_COMMON_GALLIUM_SOURCES) \
+ $(DRIVER_SOURCES)
+
+ASM_SOURCES =
+
+include ../Makefile.dri
+
+INCLUDES += \
+ -I$(TOP)/src/gallium/winsys/sw/dri
+
+symlinks:
diff --git a/src/gallium/targets/dri-swrast/SConscript b/src/gallium/targets/dri-swrast/SConscript
new file mode 100644
index 0000000000..94ff99a0a9
--- /dev/null
+++ b/src/gallium/targets/dri-swrast/SConscript
@@ -0,0 +1,42 @@
+Import('*')
+
+if not set(('softpipe', 'llvmpipe')).intersection(env['drivers']):
+ print 'warning: no supported pipe driver: skipping build of swrastg_dri.so'
+ Return()
+
+env = drienv.Clone()
+
+env.Append(CPPPATH = [
+ '#/src/gallium/winsys/sw/dri',
+])
+
+env.Prepend(LIBS = [
+ st_drisw,
+ ws_dri,
+ trace,
+ mesa,
+ glsl,
+ gallium,
+ COMMON_DRI_SW_OBJECTS
+])
+
+if 'softpipe' in env['drivers']:
+ env.Append(CPPDEFINES = 'GALLIUM_SOFTPIPE')
+ env.Prepend(LIBS = [softpipe])
+
+if 'llvmpipe' in env['drivers']:
+ env.Tool('llvm')
+ if 'LLVM_VERSION' in env:
+ env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE')
+ env.Tool('udis86')
+ env.Prepend(LIBS = [llvmpipe])
+
+swrastg_sources = [
+ 'swrast_drm_api.c'
+]
+
+env.LoadableModule(
+ target ='swrastg_dri.so',
+ source = swrastg_sources,
+ SHLIBPREFIX = '',
+)
diff --git a/src/gallium/targets/dri-swrast/swrast_drm_api.c b/src/gallium/targets/dri-swrast/swrast_drm_api.c
new file mode 100644
index 0000000000..99c25543a7
--- /dev/null
+++ b/src/gallium/targets/dri-swrast/swrast_drm_api.c
@@ -0,0 +1,147 @@
+/**************************************************************************
+ *
+ * Copyright 2009, VMware, Inc.
+ * All Rights Reserved.
+ * Copyright 2010 George Sapountzis <gsapountzis@gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#include "pipe/p_compiler.h"
+#include "util/u_memory.h"
+#include "state_tracker/drm_api.h"
+#include "state_tracker/sw_winsys.h"
+#include "dri_sw_winsys.h"
+
+/* Copied from targets/libgl-xlib */
+
+#ifdef GALLIUM_SOFTPIPE
+#include "softpipe/sp_public.h"
+#endif
+
+#ifdef GALLIUM_LLVMPIPE
+#include "llvmpipe/lp_public.h"
+#endif
+
+#ifdef GALLIUM_CELL
+#include "cell/ppu/cell_public.h"
+#endif
+
+static struct pipe_screen *
+swrast_create_screen(struct sw_winsys *winsys)
+{
+ const char *default_driver;
+ const char *driver;
+ struct pipe_screen *screen = NULL;
+
+#if defined(GALLIUM_CELL)
+ default_driver = "cell";
+#elif defined(GALLIUM_LLVMPIPE)
+ default_driver = "llvmpipe";
+#elif defined(GALLIUM_SOFTPIPE)
+ default_driver = "softpipe";
+#else
+ default_driver = "";
+#endif
+
+ driver = debug_get_option("GALLIUM_DRIVER", default_driver);
+
+#if defined(GALLIUM_CELL)
+ if (screen == NULL && strcmp(driver, "cell") == 0)
+ screen = cell_create_screen( winsys );
+#elif defined(GALLIUM_LLVMPIPE)
+ if (screen == NULL && strcmp(driver, "llvmpipe") == 0)
+ screen = llvmpipe_create_screen( winsys );
+#elif defined(GALLIUM_SOFTPIPE)
+ if (screen == NULL)
+ screen = softpipe_create_screen( winsys );
+
+ (void) driver;
+#else
+ (void) driver;
+#endif
+
+ return screen;
+}
+
+static struct pipe_screen *
+swrast_drm_create_screen(struct drm_api *api,
+ int drmFD,
+ struct drm_create_screen_arg *arg)
+{
+ struct sw_winsys *winsys = NULL;
+ struct pipe_screen *screen = NULL;
+ struct drisw_create_screen_arg *drisw;
+
+ (void) drmFD;
+
+ if (arg != NULL) {
+ switch(arg->mode) {
+ case DRM_CREATE_DRISW:
+ drisw = (struct drisw_create_screen_arg *)arg;
+ break;
+ default:
+ return NULL;
+ }
+ }
+ else {
+ return NULL;
+ }
+
+ winsys = dri_create_sw_winsys(drisw->lf);
+ if (winsys == NULL)
+ return NULL;
+
+ screen = swrast_create_screen(winsys);
+ if (!screen)
+ goto fail;
+
+ return screen;
+
+fail:
+ if (winsys)
+ winsys->destroy(winsys);
+
+ return NULL;
+}
+
+static void
+swrast_drm_api_destroy(struct drm_api *api)
+{
+ return;
+}
+
+static struct drm_api swrast_drm_api =
+{
+ .name = "swrast",
+ .driver_name = "swrast",
+ .create_screen = swrast_drm_create_screen,
+ .destroy = swrast_drm_api_destroy,
+};
+
+struct drm_api *
+drm_api_create()
+{
+ return &swrast_drm_api;
+}
+
+/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/winsys/drm/vmware/dri/Makefile b/src/gallium/targets/dri-vmwgfx/Makefile
index 8a39e23da6..4b002e828f 100644
--- a/src/gallium/winsys/drm/vmware/dri/Makefile
+++ b/src/gallium/targets/dri-vmwgfx/Makefile
@@ -1,18 +1,17 @@
-
-TOP = ../../../../../..
+TOP = ../../../..
include $(TOP)/configs/current
LIBNAME = vmwgfx_dri.so
PIPE_DRIVERS = \
- $(TOP)/src/gallium/state_trackers/dri/libdridrm.a \
- $(TOP)/src/gallium/winsys/drm/vmware/core/libsvgadrm.a \
+ $(TOP)/src/gallium/state_trackers/dri/drm/libdridrm.a \
+ $(TOP)/src/gallium/winsys/svga/drm/libsvgadrm.a \
$(TOP)/src/gallium/drivers/trace/libtrace.a \
$(TOP)/src/gallium/drivers/svga/libsvga.a
C_SOURCES = \
$(COMMON_GALLIUM_SOURCES)
-include ../../Makefile.template
+include ../Makefile.dri
symlinks:
diff --git a/src/gallium/targets/dri-vmwgfx/SConscript b/src/gallium/targets/dri-vmwgfx/SConscript
new file mode 100644
index 0000000000..6a1f8827bc
--- /dev/null
+++ b/src/gallium/targets/dri-vmwgfx/SConscript
@@ -0,0 +1,24 @@
+Import('*')
+
+if not 'svga' in env['drivers']:
+ print 'warning: svga pipe driver not built skipping vmwgfx_dri.so'
+ Return()
+
+env = drienv.Clone()
+
+env.Prepend(LIBS = [
+ st_dri,
+ svgadrm,
+ svga,
+ trace,
+ mesa,
+ glsl,
+ gallium,
+ COMMON_DRI_DRM_OBJECTS
+])
+
+env.LoadableModule(
+ target = 'vmwgfx_dri.so',
+ source = 'dummy.c',
+ SHLIBPREFIX = '',
+)
diff --git a/src/gallium/targets/dri-vmwgfx/dummy.c b/src/gallium/targets/dri-vmwgfx/dummy.c
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/src/gallium/targets/dri-vmwgfx/dummy.c
diff --git a/src/gallium/winsys/drm/intel/egl/Makefile b/src/gallium/targets/egl-i915/Makefile
index 60d675ca73..02258fb69a 100644
--- a/src/gallium/winsys/drm/intel/egl/Makefile
+++ b/src/gallium/targets/egl-i915/Makefile
@@ -1,4 +1,4 @@
-TOP = ../../../../../..
+TOP = ../../../..
include $(TOP)/configs/current
EGL_DRIVER_NAME = i915
@@ -6,9 +6,8 @@ EGL_DRIVER_SOURCES = dummy.c
EGL_DRIVER_LIBS = -ldrm_intel
EGL_DRIVER_PIPES = \
- $(TOP)/src/gallium/winsys/drm/intel/gem/libinteldrm.a \
- $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
+ $(TOP)/src/gallium/winsys/i915/drm/libi915drm.a \
$(TOP)/src/gallium/drivers/trace/libtrace.a \
$(TOP)/src/gallium/drivers/i915/libi915.a
-include ../../Makefile.egl
+include ../Makefile.egl
diff --git a/src/gallium/winsys/drm/i965/egl/dummy.c b/src/gallium/targets/egl-i915/dummy.c
index 3181d0ba7e..3181d0ba7e 100644
--- a/src/gallium/winsys/drm/i965/egl/dummy.c
+++ b/src/gallium/targets/egl-i915/dummy.c
diff --git a/src/gallium/targets/egl-i965/Makefile b/src/gallium/targets/egl-i965/Makefile
new file mode 100644
index 0000000000..fad56ef555
--- /dev/null
+++ b/src/gallium/targets/egl-i965/Makefile
@@ -0,0 +1,16 @@
+TOP = ../../../..
+include $(TOP)/configs/current
+
+EGL_DRIVER_NAME = i965
+EGL_DRIVER_SOURCES = dummy.c
+EGL_DRIVER_LIBS = -ldrm_intel
+
+EGL_DRIVER_PIPES = \
+ $(TOP)/src/gallium/winsys/i965/drm/libi965drm.a \
+ $(TOP)/src/gallium/drivers/trace/libtrace.a \
+ $(TOP)/src/gallium/drivers/i965/libi965.a \
+ $(TOP)/src/gallium/winsys/sw/drm/libswdrm.a \
+ $(TOP)/src/gallium/winsys/sw/wrapper/libwsw.a \
+ $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a
+
+include ../Makefile.egl
diff --git a/src/gallium/winsys/drm/intel/egl/dummy.c b/src/gallium/targets/egl-i965/dummy.c
index 3181d0ba7e..3181d0ba7e 100644
--- a/src/gallium/winsys/drm/intel/egl/dummy.c
+++ b/src/gallium/targets/egl-i965/dummy.c
diff --git a/src/gallium/targets/egl-nouveau/Makefile b/src/gallium/targets/egl-nouveau/Makefile
new file mode 100644
index 0000000000..e3fa8937e8
--- /dev/null
+++ b/src/gallium/targets/egl-nouveau/Makefile
@@ -0,0 +1,14 @@
+TOP = ../../../..
+include $(TOP)/configs/current
+
+EGL_DRIVER_NAME = nouveau
+EGL_DRIVER_SOURCES = dummy.c
+EGL_DRIVER_LIBS = -ldrm_nouveau
+
+EGL_DRIVER_PIPES = \
+ $(TOP)/src/gallium/winsys/nouveau/drm/libnouveaudrm.a \
+ $(TOP)/src/gallium/drivers/nvfx/libnvfx.a \
+ $(TOP)/src/gallium/drivers/nv50/libnv50.a \
+ $(TOP)/src/gallium/drivers/nouveau/libnouveau.a
+
+include ../Makefile.egl
diff --git a/src/gallium/winsys/drm/nouveau/egl/dummy.c b/src/gallium/targets/egl-nouveau/dummy.c
index 3181d0ba7e..3181d0ba7e 100644
--- a/src/gallium/winsys/drm/nouveau/egl/dummy.c
+++ b/src/gallium/targets/egl-nouveau/dummy.c
diff --git a/src/gallium/winsys/drm/radeon/egl/Makefile b/src/gallium/targets/egl-radeon/Makefile
index cd4f9b20f0..8daadb5979 100644
--- a/src/gallium/winsys/drm/radeon/egl/Makefile
+++ b/src/gallium/targets/egl-radeon/Makefile
@@ -1,4 +1,4 @@
-TOP = ../../../../../..
+TOP = ../../../..
include $(TOP)/configs/current
EGL_DRIVER_NAME = radeon
@@ -6,9 +6,8 @@ EGL_DRIVER_SOURCES = dummy.c
EGL_DRIVER_LIBS = -ldrm_radeon
EGL_DRIVER_PIPES = \
- $(TOP)/src/gallium/winsys/drm/radeon/core/libradeonwinsys.a \
- $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
+ $(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
$(TOP)/src/gallium/drivers/trace/libtrace.a \
$(TOP)/src/gallium/drivers/r300/libr300.a
-include ../../Makefile.egl
+include ../Makefile.egl
diff --git a/src/gallium/winsys/drm/radeon/egl/dummy.c b/src/gallium/targets/egl-radeon/dummy.c
index 3181d0ba7e..3181d0ba7e 100644
--- a/src/gallium/winsys/drm/radeon/egl/dummy.c
+++ b/src/gallium/targets/egl-radeon/dummy.c
diff --git a/src/gallium/targets/egl-swrast/Makefile b/src/gallium/targets/egl-swrast/Makefile
new file mode 100644
index 0000000000..7d4f505498
--- /dev/null
+++ b/src/gallium/targets/egl-swrast/Makefile
@@ -0,0 +1,12 @@
+TOP = ../../../..
+include $(TOP)/configs/current
+
+# Do propperly
+CFLAGS+="-I$(TOP)/src/gallium/include"
+
+EGL_DRIVER_NAME = swrast
+EGL_DRIVER_SOURCES = swrast_glue.c
+EGL_DRIVER_LIBS =
+EGL_DRIVER_PIPES =
+
+include ../Makefile.egl
diff --git a/src/gallium/winsys/drm/swrast/core/swrast_drm_api.c b/src/gallium/targets/egl-swrast/swrast_glue.c
index 8c9f80e2c1..9db8089a66 100644
--- a/src/gallium/winsys/drm/swrast/core/swrast_drm_api.c
+++ b/src/gallium/targets/egl-swrast/swrast_glue.c
@@ -11,3 +11,7 @@ drm_api_create()
(void) swrast_drm_api;
return NULL;
}
+
+/* A poor man's --whole-archive for EGL drivers */
+void *_eglMain(void *);
+void *_eglWholeArchive = (void *) _eglMain;
diff --git a/src/gallium/winsys/drm/vmware/egl/Makefile b/src/gallium/targets/egl-vmwgfx/Makefile
index a3e73131c3..5f9385f42b 100644
--- a/src/gallium/winsys/drm/vmware/egl/Makefile
+++ b/src/gallium/targets/egl-vmwgfx/Makefile
@@ -1,4 +1,4 @@
-TOP = ../../../../../..
+TOP = ../../../..
include $(TOP)/configs/current
EGL_DRIVER_NAME = vmwgfx
@@ -6,9 +6,8 @@ EGL_DRIVER_SOURCES = dummy.c
EGL_DRIVER_LIBS =
EGL_DRIVER_PIPES = \
- $(TOP)/src/gallium/winsys/drm/vmware/core/libsvgadrm.a \
- $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
+ $(TOP)/src/gallium/winsys/svga/drm/libsvgadrm.a \
$(TOP)/src/gallium/drivers/trace/libtrace.a \
$(TOP)/src/gallium/drivers/svga/libsvga.a
-include ../../Makefile.egl
+include ../Makefile.egl
diff --git a/src/gallium/winsys/drm/swrast/egl/dummy.c b/src/gallium/targets/egl-vmwgfx/dummy.c
index 3181d0ba7e..3181d0ba7e 100644
--- a/src/gallium/winsys/drm/swrast/egl/dummy.c
+++ b/src/gallium/targets/egl-vmwgfx/dummy.c
diff --git a/src/gallium/targets/graw-xlib/SConscript b/src/gallium/targets/graw-xlib/SConscript
new file mode 100644
index 0000000000..24cea92f90
--- /dev/null
+++ b/src/gallium/targets/graw-xlib/SConscript
@@ -0,0 +1,57 @@
+#######################################################################
+# SConscript for xlib winsys
+
+Import('*')
+
+if env['platform'] != 'linux':
+ Return()
+
+if not set(('softpipe', 'llvmpipe', 'cell')).intersection(env['drivers']):
+ print 'warning: no supported pipe driver: skipping build of xlib libGL.so'
+ Return()
+
+env = env.Clone()
+
+env.Prepend(LIBS = [
+ ws_xlib,
+ trace,
+ identity,
+# gallium,
+])
+
+env.Append(CPPPATH = [
+ '#src/gallium/drivers',
+])
+
+
+sources = [
+ 'graw_xlib.c',
+]
+
+if 'softpipe' in env['drivers']:
+ env.Append(CPPDEFINES = 'GALLIUM_SOFTPIPE')
+ env.Prepend(LIBS = [softpipe])
+
+if 'llvmpipe' in env['drivers']:
+ env.Tool('llvm')
+ if 'LLVM_VERSION' in env:
+ env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE')
+ env.Tool('udis86')
+ env.Prepend(LIBS = [llvmpipe])
+
+# Need this for trace, identity drivers referenced by
+# gallium_wrap_screen().
+#
+env.Prepend(LIBS = [gallium])
+
+# TODO: write a wrapper function http://www.scons.org/wiki/WrapperFunctions
+graw = env.SharedLibrary(
+ target ='graw',
+ source = sources,
+)
+
+env.InstallSharedLibrary(graw, version=(1, 0))
+
+graw = env.FindIxes(graw, 'SHLIBPREFIX', 'SHLIBSUFFIX')
+
+Export('graw')
diff --git a/src/gallium/targets/graw-xlib/graw.h b/src/gallium/targets/graw-xlib/graw.h
new file mode 100644
index 0000000000..a58e18e473
--- /dev/null
+++ b/src/gallium/targets/graw-xlib/graw.h
@@ -0,0 +1,36 @@
+#ifndef GALLIUM_RAW_H
+#define GALLIUM_RAW_H
+
+/* This is an API for exercising gallium functionality in a
+ * platform-neutral fashion. Whatever platform integration is
+ * necessary to implement this interface is orchestrated by the
+ * individual target building this entity.
+ *
+ * For instance, the graw-xlib target includes code to implent these
+ * interfaces on top of the X window system.
+ *
+ * Programs using this interface may additionally benefit from some of
+ * the utilities currently in the libgallium.a library, especially
+ * those for parsing text representations of TGSI shaders.
+ */
+
+#include "pipe/p_format.h"
+
+struct pipe_screen;
+
+struct pipe_screen *graw_init( void );
+
+/* Returns a handle to be used with flush_frontbuffer()/present().
+ *
+ * Query format support with screen::is_format_supported and usage
+ * XXX.
+ */
+void *graw_create_window( int x,
+ int y,
+ unsigned width,
+ unsigned height,
+ enum pipe_format format );
+
+void graw_destroy_window( void *handle );
+
+#endif
diff --git a/src/gallium/targets/graw-xlib/graw_xlib.c b/src/gallium/targets/graw-xlib/graw_xlib.c
new file mode 100644
index 0000000000..fb8ef9d78b
--- /dev/null
+++ b/src/gallium/targets/graw-xlib/graw_xlib.c
@@ -0,0 +1,181 @@
+#include "pipe/p_compiler.h"
+#include "util/u_debug.h"
+#include "util/u_memory.h"
+#include "target-helpers/wrap_screen.h"
+#include "state_tracker/xlib_sw_winsys.h"
+
+#ifdef GALLIUM_SOFTPIPE
+#include "softpipe/sp_public.h"
+#endif
+
+#ifdef GALLIUM_LLVMPIPE
+#include "llvmpipe/lp_public.h"
+#endif
+
+/* Haven't figured out a decent way to build the helper code yet -
+ * #include it here temporarily.
+ */
+#include "sw/sw_public.h"
+#include "sw/sw.c"
+
+#include "graw.h"
+
+#include <X11/Xlib.h>
+#include <X11/Xlibint.h>
+#include <X11/Xutil.h>
+#include <stdio.h>
+
+static struct {
+ Display *display;
+} graw;
+
+
+struct pipe_screen *
+graw_init( void )
+{
+ const char *default_driver;
+ const char *driver;
+ struct pipe_screen *screen = NULL;
+ struct sw_winsys *winsys = NULL;
+
+ graw.display = XOpenDisplay(NULL);
+ if (graw.display == NULL)
+ return NULL;
+
+ /* Create the underlying winsys, which performs presents to Xlib
+ * drawables:
+ */
+ winsys = xlib_create_sw_winsys( graw.display );
+ if (winsys == NULL)
+ return NULL;
+
+#if defined(GALLIUM_LLVMPIPE)
+ default_driver = "llvmpipe";
+#elif defined(GALLIUM_SOFTPIPE)
+ default_driver = "softpipe";
+#else
+ default_driver = "";
+#endif
+
+ driver = debug_get_option("GALLIUM_DRIVER", default_driver);
+
+#if defined(GALLIUM_LLVMPIPE)
+ if (screen == NULL && strcmp(driver, "llvmpipe") == 0)
+ screen = llvmpipe_create_screen( winsys );
+#endif
+
+#if defined(GALLIUM_SOFTPIPE)
+ if (screen == NULL)
+ screen = softpipe_create_screen( winsys );
+#endif
+
+ /* Inject any wrapping layers we want to here:
+ */
+ return gallium_wrap_screen( screen );
+}
+
+
+
+
+
+void *
+graw_create_window( int x,
+ int y,
+ unsigned width,
+ unsigned height,
+ enum pipe_format format )
+{
+ struct xlib_drawable *handle = NULL;
+ XSetWindowAttributes attr;
+ Window root;
+ Window win = 0;
+ XVisualInfo templat, *visinfo = NULL;
+ unsigned mask;
+ int n;
+ int scrnum;
+
+
+ scrnum = DefaultScreen( graw.display );
+ root = RootWindow( graw.display, scrnum );
+
+
+ if (format != PIPE_FORMAT_R8G8B8A8_UNORM)
+ goto fail;
+
+ if (graw.display == NULL)
+ goto fail;
+
+ handle = CALLOC_STRUCT(xlib_drawable);
+ if (handle == NULL)
+ goto fail;
+
+
+ mask = VisualScreenMask | VisualDepthMask | VisualClassMask;
+ templat.screen = DefaultScreen(graw.display);
+ templat.depth = 32;
+ templat.class = TrueColor;
+
+ visinfo = XGetVisualInfo(graw.display, mask, &templat, &n);
+ if (!visinfo) {
+ printf("Error: couldn't get an RGB, Double-buffered visual\n");
+ exit(1);
+ }
+
+ /* window attributes */
+ attr.background_pixel = 0;
+ attr.border_pixel = 0;
+ attr.colormap = XCreateColormap( graw.display, root, visinfo->visual, AllocNone);
+ attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
+ /* XXX this is a bad way to get a borderless window! */
+ mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
+
+ win = XCreateWindow( graw.display, root, x, y, width, height,
+ 0, visinfo->depth, InputOutput,
+ visinfo->visual, mask, &attr );
+
+
+ /* set hints and properties */
+ {
+ char *name = NULL;
+ XSizeHints sizehints;
+ sizehints.x = x;
+ sizehints.y = y;
+ sizehints.width = width;
+ sizehints.height = height;
+ sizehints.flags = USSize | USPosition;
+ XSetNormalHints(graw.display, win, &sizehints);
+ XSetStandardProperties(graw.display, win, name, name,
+ None, (char **)NULL, 0, &sizehints);
+ }
+
+ XFree(visinfo);
+ XMapWindow(graw.display, win);
+ while (1) {
+ XEvent e;
+ XNextEvent( graw.display, &e );
+ if (e.type == MapNotify && e.xmap.window == win) {
+ break;
+ }
+ }
+
+ handle->visual = visinfo->visual;
+ handle->drawable = (Drawable)win;
+ handle->depth = visinfo->depth;
+ return (void *)handle;
+
+fail:
+ FREE(handle);
+ XFree(visinfo);
+
+ if (win)
+ XDestroyWindow(graw.display, win);
+
+ return NULL;
+}
+
+
+void
+graw_destroy_window( void *xlib_drawable )
+{
+}
+
diff --git a/src/gallium/winsys/gdi/SConscript b/src/gallium/targets/libgl-gdi/SConscript
index 4cbc86f331..21b4eb2abe 100644
--- a/src/gallium/winsys/gdi/SConscript
+++ b/src/gallium/targets/libgl-gdi/SConscript
@@ -9,6 +9,7 @@ if env['platform'] == 'windows':
env.Append(CPPPATH = [
'#src/gallium/state_trackers/wgl',
+ '#src/gallium/winsys/sw',
])
env.Append(LIBS = [
@@ -47,5 +48,5 @@ if env['platform'] == 'windows':
env.SharedLibrary(
target ='opengl32',
source = sources,
- LIBS = wgl + glapi + mesa + drivers + gallium + glsl + env['LIBS'],
+ LIBS = wgl + ws_gdi + glapi + mesa + drivers + gallium + glsl + env['LIBS'],
)
diff --git a/src/gallium/targets/libgl-gdi/gdi_llvmpipe_winsys.c b/src/gallium/targets/libgl-gdi/gdi_llvmpipe_winsys.c
new file mode 100644
index 0000000000..29316a1ce2
--- /dev/null
+++ b/src/gallium/targets/libgl-gdi/gdi_llvmpipe_winsys.c
@@ -0,0 +1,124 @@
+/**************************************************************************
+ *
+ * Copyright 2009 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ *
+ **************************************************************************/
+
+/**
+ * @file
+ * LLVMpipe support.
+ *
+ * @author Jose Fonseca <jfonseca@vmware.com>
+ */
+
+
+#include <windows.h>
+
+#include "stw_winsys.h"
+#include "gdi/gdi_sw_winsys.h"
+#include "llvmpipe/lp_texture.h"
+#include "llvmpipe/lp_screen.h"
+#include "llvmpipe/lp_public.h"
+
+
+static struct pipe_screen *
+gdi_llvmpipe_screen_create(void)
+{
+ static struct sw_winsys *winsys;
+ struct pipe_screen *screen;
+
+ winsys = gdi_create_sw_winsys();
+ if(!winsys)
+ goto no_winsys;
+
+ screen = llvmpipe_create_screen(winsys);
+ if(!screen)
+ goto no_screen;
+
+ return screen;
+
+no_screen:
+ winsys->destroy(winsys);
+no_winsys:
+ return NULL;
+}
+
+
+
+
+static void
+gdi_llvmpipe_present(struct pipe_screen *screen,
+ struct pipe_surface *surface,
+ HDC hDC)
+{
+ /* This will fail if any interposing layer (trace, debug, etc) has
+ * been introduced between the state-trackers and llvmpipe.
+ *
+ * Ideally this would get replaced with a call to
+ * pipe_screen::flush_frontbuffer().
+ *
+ * Failing that, it may be necessary for intervening layers to wrap
+ * other structs such as this stw_winsys as well...
+ */
+ gdi_sw_display(llvmpipe_screen(screen)->winsys,
+ llvmpipe_texture(surface->texture)->dt,
+ hDC);
+}
+
+
+static const struct stw_winsys stw_winsys = {
+ &gdi_llvmpipe_screen_create,
+ &gdi_llvmpipe_present,
+ NULL, /* get_adapter_luid */
+ NULL, /* shared_surface_open */
+ NULL, /* shared_surface_close */
+ NULL /* compose */
+};
+
+
+BOOL WINAPI
+DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
+{
+ switch (fdwReason) {
+ case DLL_PROCESS_ATTACH:
+ stw_init(&stw_winsys);
+ stw_init_thread();
+ break;
+
+ case DLL_THREAD_ATTACH:
+ stw_init_thread();
+ break;
+
+ case DLL_THREAD_DETACH:
+ stw_cleanup_thread();
+ break;
+
+ case DLL_PROCESS_DETACH:
+ stw_cleanup_thread();
+ stw_cleanup();
+ break;
+ }
+ return TRUE;
+}
diff --git a/src/gallium/targets/libgl-gdi/gdi_softpipe_winsys.c b/src/gallium/targets/libgl-gdi/gdi_softpipe_winsys.c
new file mode 100644
index 0000000000..dfe60195d9
--- /dev/null
+++ b/src/gallium/targets/libgl-gdi/gdi_softpipe_winsys.c
@@ -0,0 +1,124 @@
+/**************************************************************************
+ *
+ * Copyright 2009 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ *
+ **************************************************************************/
+
+/**
+ * @file
+ * LLVMpipe support.
+ *
+ * @author Jose Fonseca <jfonseca@vmware.com>
+ */
+
+
+#include <windows.h>
+
+#include "stw_winsys.h"
+#include "gdi/gdi_sw_winsys.h"
+#include "softpipe/sp_texture.h"
+#include "softpipe/sp_screen.h"
+#include "softpipe/sp_public.h"
+
+
+static struct pipe_screen *
+gdi_softpipe_screen_create(void)
+{
+ static struct sw_winsys *winsys;
+ struct pipe_screen *screen;
+
+ winsys = gdi_create_sw_winsys();
+ if(!winsys)
+ goto no_winsys;
+
+ screen = softpipe_create_screen(winsys);
+ if(!screen)
+ goto no_screen;
+
+ return screen;
+
+no_screen:
+ winsys->destroy(winsys);
+no_winsys:
+ return NULL;
+}
+
+
+
+
+static void
+gdi_softpipe_present(struct pipe_screen *screen,
+ struct pipe_surface *surface,
+ HDC hDC)
+{
+ /* This will fail if any interposing layer (trace, debug, etc) has
+ * been introduced between the state-trackers and softpipe.
+ *
+ * Ideally this would get replaced with a call to
+ * pipe_screen::flush_frontbuffer().
+ *
+ * Failing that, it may be necessary for intervening layers to wrap
+ * other structs such as this stw_winsys as well...
+ */
+ gdi_sw_display(softpipe_screen(screen)->winsys,
+ softpipe_texture(surface->texture)->dt,
+ hDC);
+}
+
+
+static const struct stw_winsys stw_winsys = {
+ &gdi_softpipe_screen_create,
+ &gdi_softpipe_present,
+ NULL, /* get_adapter_luid */
+ NULL, /* shared_surface_open */
+ NULL, /* shared_surface_close */
+ NULL /* compose */
+};
+
+
+BOOL WINAPI
+DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
+{
+ switch (fdwReason) {
+ case DLL_PROCESS_ATTACH:
+ stw_init(&stw_winsys);
+ stw_init_thread();
+ break;
+
+ case DLL_THREAD_ATTACH:
+ stw_init_thread();
+ break;
+
+ case DLL_THREAD_DETACH:
+ stw_cleanup_thread();
+ break;
+
+ case DLL_PROCESS_DETACH:
+ stw_cleanup_thread();
+ stw_cleanup();
+ break;
+ }
+ return TRUE;
+}
diff --git a/src/gallium/winsys/xlib/Makefile b/src/gallium/targets/libgl-xlib/Makefile
index 824c666ae3..6cd00cad45 100644
--- a/src/gallium/winsys/xlib/Makefile
+++ b/src/gallium/targets/libgl-xlib/Makefile
@@ -1,4 +1,4 @@
-# src/gallium/winsys/xlib/Makefile
+# src/gallium/targets/libgl-xlib/Makefile
# This makefile produces a "stand-alone" libGL.so which is based on
# Xlib (no DRI HW acceleration)
@@ -26,14 +26,11 @@ DEFINES += \
-DGALLIUM_SOFTPIPE
#-DGALLIUM_CELL will be defined by the config */
-XLIB_WINSYS_SOURCES = \
- xlib.c \
- xlib_cell.c \
- xlib_llvmpipe.c \
- xlib_softpipe.c
+XLIB_TARGET_SOURCES = \
+ xlib.c
-XLIB_WINSYS_OBJECTS = $(XLIB_WINSYS_SOURCES:.c=.o)
+XLIB_TARGET_OBJECTS = $(XLIB_TARGET_SOURCES:.c=.o)
# Note: CELL_SPU_LIB is only defined for cell configs
@@ -41,6 +38,9 @@ XLIB_WINSYS_OBJECTS = $(XLIB_WINSYS_SOURCES:.c=.o)
LIBS = \
$(GALLIUM_DRIVERS) \
$(TOP)/src/gallium/state_trackers/glx/xlib/libxlib.a \
+ $(TOP)/src/gallium/winsys/sw/xlib/libws_xlib.a \
+ $(TOP)/src/gallium/drivers/trace/libtrace.a \
+ $(TOP)/src/gallium/drivers/identity/libidentity.a \
$(TOP)/src/mesa/libglapi.a \
$(TOP)/src/mesa/libmesagallium.a \
$(GALLIUM_AUXILIARIES) \
@@ -63,20 +63,20 @@ $(TOP)/$(LIB_DIR)/gallium:
@ mkdir -p $(TOP)/$(LIB_DIR)/gallium
# Make the libGL.so library
-$(TOP)/$(LIB_DIR)/gallium/$(GL_LIB_NAME): $(XLIB_WINSYS_OBJECTS) $(LIBS) Makefile
+$(TOP)/$(LIB_DIR)/gallium/$(GL_LIB_NAME): $(XLIB_TARGET_OBJECTS) $(LIBS) Makefile
$(TOP)/bin/mklib -o $(GL_LIB) \
-linker "$(CC)" \
-major $(GL_MAJOR) -minor $(GL_MINOR) -patch $(GL_TINY) \
-install $(TOP)/$(LIB_DIR)/gallium \
- $(MKLIB_OPTIONS) $(XLIB_WINSYS_OBJECTS) \
+ $(MKLIB_OPTIONS) $(XLIB_TARGET_OBJECTS) \
-Wl,--start-group $(LIBS) -Wl,--end-group $(GL_LIB_DEPS)
-depend: $(XLIB_WINSYS_SOURCES)
+depend: $(XLIB_TARGET_SOURCES)
@ echo "running $(MKDEP)"
@ rm -f depend # workaround oops on gutsy?!?
@ touch depend
- $(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) $(XLIB_WINSYS_SOURCES) \
+ $(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) $(XLIB_TARGET_SOURCES) \
> /dev/null 2>/dev/null
diff --git a/src/gallium/winsys/xlib/SConscript b/src/gallium/targets/libgl-xlib/SConscript
index 8c9d318af2..c1614d4a9f 100644
--- a/src/gallium/winsys/xlib/SConscript
+++ b/src/gallium/targets/libgl-xlib/SConscript
@@ -28,35 +28,42 @@ env.Append(CPPPATH = [
env.Append(CPPDEFINES = ['USE_XSHM'])
+env.Prepend(LIBS = [
+ st_xlib,
+ ws_xlib,
+ trace,
+ identity,
+ glapi,
+ mesa,
+ glsl,
+ gallium,
+])
+
sources = [
'xlib.c',
]
-drivers = [trace]
-
+env.Tool('x11')
+
if 'softpipe' in env['drivers']:
env.Append(CPPDEFINES = 'GALLIUM_SOFTPIPE')
- sources += ['xlib_softpipe.c']
- drivers += [softpipe]
+ env.Prepend(LIBS = [softpipe])
if 'llvmpipe' in env['drivers']:
env.Tool('llvm')
if 'LLVM_VERSION' in env:
env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE')
env.Tool('udis86')
- sources += ['xlib_llvmpipe.c']
- drivers += [llvmpipe]
+ env.Prepend(LIBS = [llvmpipe])
if 'cell' in env['drivers']:
env.Append(CPPDEFINES = 'GALLIUM_CELL')
- sources += ['xlib_cell.c']
- drivers += [cell]
+ env.Prepend(LIBS = [cell])
# TODO: write a wrapper function http://www.scons.org/wiki/WrapperFunctions
libgl = env.SharedLibrary(
target ='GL',
source = sources,
- LIBS = st_xlib + glapi + mesa + glsl + drivers + gallium + env['LIBS'],
)
if not env['dri']:
diff --git a/src/gallium/targets/libgl-xlib/xlib.c b/src/gallium/targets/libgl-xlib/xlib.c
new file mode 100644
index 0000000000..48e5bdff42
--- /dev/null
+++ b/src/gallium/targets/libgl-xlib/xlib.c
@@ -0,0 +1,211 @@
+/**************************************************************************
+ *
+ * Copyright 2007 Tungsten Graphics, Inc., Bismarck, ND., USA
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ *
+ **************************************************************************/
+
+/*
+ * Authors:
+ * Keith Whitwell
+ */
+#include "pipe/p_compiler.h"
+#include "util/u_debug.h"
+#include "target-helpers/wrap_screen.h"
+#include "state_tracker/xlib_sw_winsys.h"
+#include "xm_public.h"
+
+#include "state_tracker/st_manager.h"
+
+/* advertise OpenGL support */
+PUBLIC const int st_api_OpenGL = 1;
+
+PUBLIC const struct st_module st_module_OpenGL = {
+ .api = ST_API_OPENGL,
+ .create_api = st_manager_create_api
+};
+
+/* Helper function to choose and instantiate one of the software rasterizers:
+ * cell, llvmpipe, softpipe.
+ *
+ * This function could be shared, but currently causes headaches for
+ * the build systems, particularly scons if we try. Long term, want
+ * to avoid having global #defines for things like GALLIUM_LLVMPIPE,
+ * GALLIUM_CELL, etc. Scons already eliminates those #defines, so
+ * things that are painful for it now are likely to be painful for
+ * other build systems in the future.
+ *
+ * Copies (full or partial):
+ * targets/libgl-xlib
+ * targets/graw-xlib
+ * targets/dri-swrast
+ * winsys/sw/drm
+ * drivers/sw
+ *
+ */
+
+#ifdef GALLIUM_SOFTPIPE
+#include "softpipe/sp_public.h"
+#endif
+
+#ifdef GALLIUM_LLVMPIPE
+#include "llvmpipe/lp_public.h"
+#endif
+
+#ifdef GALLIUM_CELL
+#include "cell/ppu/cell_public.h"
+#endif
+
+static struct pipe_screen *
+swrast_create_screen(struct sw_winsys *winsys)
+{
+ const char *default_driver;
+ const char *driver;
+ struct pipe_screen *screen = NULL;
+
+#if defined(GALLIUM_CELL)
+ default_driver = "cell";
+#elif defined(GALLIUM_LLVMPIPE)
+ default_driver = "llvmpipe";
+#elif defined(GALLIUM_SOFTPIPE)
+ default_driver = "softpipe";
+#else
+ default_driver = "";
+#endif
+
+ driver = debug_get_option("GALLIUM_DRIVER", default_driver);
+
+#if defined(GALLIUM_CELL)
+ if (screen == NULL && strcmp(driver, "cell") == 0)
+ screen = cell_create_screen( winsys );
+#endif
+
+#if defined(GALLIUM_LLVMPIPE)
+ if (screen == NULL && strcmp(driver, "llvmpipe") == 0)
+ screen = llvmpipe_create_screen( winsys );
+#endif
+
+#if defined(GALLIUM_SOFTPIPE)
+ if (screen == NULL)
+ screen = softpipe_create_screen( winsys );
+#endif
+
+ return screen;
+}
+
+/* Helper function to build a subset of a driver stack consisting of
+ * one of the software rasterizers (cell, llvmpipe, softpipe) and the
+ * xlib winsys.
+ */
+static struct pipe_screen *
+swrast_xlib_create_screen( Display *display )
+{
+ struct sw_winsys *winsys;
+ struct pipe_screen *screen = NULL;
+
+ /* Create the underlying winsys, which performs presents to Xlib
+ * drawables:
+ */
+ winsys = xlib_create_sw_winsys( display );
+ if (winsys == NULL)
+ return NULL;
+
+ /* Create a software rasterizer on top of that winsys:
+ */
+ screen = swrast_create_screen( winsys );
+ if (screen == NULL)
+ goto fail;
+
+ /* Inject any wrapping layers we want to here:
+ */
+ return gallium_wrap_screen( screen );
+
+fail:
+ if (winsys)
+ winsys->destroy( winsys );
+
+ return NULL;
+}
+
+static struct xm_driver xlib_driver =
+{
+ .create_pipe_screen = swrast_xlib_create_screen,
+ .create_st_api = st_manager_create_api,
+};
+
+
+/* Build the rendering stack.
+ */
+static void _init( void ) __attribute__((constructor));
+static void _init( void )
+{
+ /* Initialize the xlib libgl code, pass in the winsys:
+ */
+ xmesa_set_driver( &xlib_driver );
+}
+
+
+/***********************************************************************
+ *
+ * Butt-ugly hack to convince the linker not to throw away public GL
+ * symbols (they are all referenced from getprocaddress, I guess).
+ */
+extern void (*linker_foo(const unsigned char *procName))();
+extern void (*glXGetProcAddress(const unsigned char *procName))();
+
+extern void (*linker_foo(const unsigned char *procName))()
+{
+ return glXGetProcAddress(procName);
+}
+
+
+/**
+ * When GLX_INDIRECT_RENDERING is defined, some symbols are missing in
+ * libglapi.a. We need to define them here.
+ */
+#ifdef GLX_INDIRECT_RENDERING
+
+#define GL_GLEXT_PROTOTYPES
+#include "GL/gl.h"
+#include "glapi/glapi.h"
+#include "glapi/glapitable.h"
+#include "glapi/glapidispatch.h"
+
+#if defined(USE_MGL_NAMESPACE)
+#define NAME(func) mgl##func
+#else
+#define NAME(func) gl##func
+#endif
+
+#define DISPATCH(FUNC, ARGS, MESSAGE) \
+ CALL_ ## FUNC(GET_DISPATCH(), ARGS);
+
+#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \
+ return CALL_ ## FUNC(GET_DISPATCH(), ARGS);
+
+/* skip normal ones */
+#define _GLAPI_SKIP_NORMAL_ENTRY_POINTS
+#include "glapi/glapitemp.h"
+
+#endif /* GLX_INDIRECT_RENDERING */
diff --git a/src/gallium/winsys/drm/intel/xorg/Makefile b/src/gallium/targets/xorg-i915/Makefile
index 14c2462524..52a9e97b40 100644
--- a/src/gallium/winsys/drm/intel/xorg/Makefile
+++ b/src/gallium/targets/xorg-i915/Makefile
@@ -1,13 +1,13 @@
+TOP = ../../../..
+include $(TOP)/configs/current
+
TARGET = modesetting_drv.so
CFILES = $(wildcard ./*.c)
OBJECTS = $(patsubst ./%.c,./%.o,$(CFILES))
-TOP = ../../../../../..
-
-include $(TOP)/configs/current
INCLUDES = \
$(shell pkg-config --cflags-only-I pixman-1 xorg-server libdrm xproto) \
- -I../gem \
+ -I$(TOP)/src/gallium/winsys/drm/intel/gem \
-I$(TOP)/src/gallium/include \
-I$(TOP)/src/gallium/drivers \
-I$(TOP)/src/gallium/auxiliary \
@@ -17,7 +17,7 @@ INCLUDES = \
LIBS = \
$(TOP)/src/gallium/state_trackers/xorg/libxorgtracker.a \
- $(TOP)/src/gallium/winsys/drm/intel/gem/libinteldrm.a \
+ $(TOP)/src/gallium/winsys/i915/drm/libi915drm.a \
$(TOP)/src/gallium/drivers/i915/libi915.a \
$(TOP)/src/gallium/drivers/trace/libtrace.a \
$(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
diff --git a/src/gallium/winsys/drm/intel/xorg/intel_xorg.c b/src/gallium/targets/xorg-i915/intel_xorg.c
index 369dc356cf..08f3b08863 100644
--- a/src/gallium/winsys/drm/intel/xorg/intel_xorg.c
+++ b/src/gallium/targets/xorg-i915/intel_xorg.c
@@ -28,7 +28,7 @@
*
*/
-#include "../../../../state_trackers/xorg/xorg_winsys.h"
+#include "../../state_trackers/xorg/xorg_winsys.h"
static void intel_xorg_identify(int flags);
static Bool intel_xorg_pci_probe(DriverPtr driver,
diff --git a/src/gallium/winsys/drm/i965/xorg/Makefile b/src/gallium/targets/xorg-i965/Makefile
index c25726b0bb..104a1434a8 100644
--- a/src/gallium/winsys/drm/i965/xorg/Makefile
+++ b/src/gallium/targets/xorg-i965/Makefile
@@ -1,29 +1,23 @@
-TOP = ../../../../../..
-
-
-GALLIUMDIR = $(TOP)/src/gallium
+TOP = ../../../..
+include $(TOP)/configs/current
TARGET = i965g_drv.so
-
CFILES = $(wildcard ./*.c)
-
-include ${TOP}/configs/current
-
OBJECTS = $(patsubst ./%.c,./%.o,$(CFILES))
CFLAGS = -DHAVE_CONFIG_H \
-g -Wall -Wimplicit-function-declaration -fPIC \
$(shell pkg-config --cflags pixman-1 xorg-server libdrm xproto) \
- -I${GALLIUMDIR}/include \
- -I${GALLIUMDIR}/drivers \
- -I${GALLIUMDIR}/auxiliary \
- -I${TOP}/src/mesa \
+ -I$(TOP)/src/gallium/include \
+ -I$(TOP)/src/gallium/drivers \
+ -I$(TOP)/src/gallium/auxiliary \
+ -I$(TOP)/src/mesa \
-I$(TOP)/include \
-I$(TOP)/src/egl/main
LIBS = \
$(TOP)/src/gallium/state_trackers/xorg/libxorgtracker.a \
- $(TOP)/src/gallium/winsys/drm/i965/gem/libi965drm.a \
+ $(TOP)/src/gallium/winsys/i965/drm/libi965drm.a \
$(TOP)/src/gallium/drivers/i965/libi965.a \
$(TOP)/src/gallium/drivers/trace/libtrace.a \
$(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
@@ -34,7 +28,7 @@ TARGET_STAGING = $(TOP)/$(LIB_DIR)/gallium/$(TARGET)
all default: $(TARGET) $(TARGET_STAGING)
-$(TARGET): $(OBJECTS) Makefile $(GALLIUMDIR)/state_trackers/xorg/libxorgtracker.a $(LIBS)
+$(TARGET): $(OBJECTS) Makefile $(TOP)/src/gallium/state_trackers/xorg/libxorgtracker.a $(LIBS)
$(TOP)/bin/mklib -noprefix -o $@ \
$(OBJECTS) $(LIBS) $(shell pkg-config --libs libdrm) -ldrm_intel
diff --git a/src/gallium/winsys/drm/i965/xorg/intel_xorg.c b/src/gallium/targets/xorg-i965/intel_xorg.c
index ac691cb76b..f4608f0eb4 100644
--- a/src/gallium/winsys/drm/i965/xorg/intel_xorg.c
+++ b/src/gallium/targets/xorg-i965/intel_xorg.c
@@ -28,7 +28,7 @@
*
*/
-#include "../../../../state_trackers/xorg/xorg_winsys.h"
+#include "../../state_trackers/xorg/xorg_winsys.h"
static void intel_xorg_identify(int flags);
static Bool intel_xorg_pci_probe(DriverPtr driver,
diff --git a/src/gallium/winsys/drm/nouveau/xorg/Makefile b/src/gallium/targets/xorg-nouveau/Makefile
index 179b50230b..b514b57000 100644
--- a/src/gallium/winsys/drm/nouveau/xorg/Makefile
+++ b/src/gallium/targets/xorg-nouveau/Makefile
@@ -1,13 +1,12 @@
+TOP = ../../../..
+include $(TOP)/configs/current
+
TARGET = modesetting_drv.so
CFILES = $(wildcard ./*.c)
OBJECTS = $(patsubst ./%.c,./%.o,$(CFILES))
-TOP = ../../../../../..
-
-include $(TOP)/configs/current
INCLUDES = \
$(shell pkg-config --cflags-only-I pixman-1 xorg-server libdrm xproto) \
- -I../gem \
-I$(TOP)/src/gallium/include \
-I$(TOP)/src/gallium/drivers \
-I$(TOP)/src/gallium/auxiliary \
@@ -17,9 +16,8 @@ INCLUDES = \
LIBS = \
$(TOP)/src/gallium/state_trackers/xorg/libxorgtracker.a \
- $(TOP)/src/gallium/winsys/drm/nouveau/drm/libnouveaudrm.a \
- $(TOP)/src/gallium/drivers/nv30/libnv30.a \
- $(TOP)/src/gallium/drivers/nv40/libnv40.a \
+ $(TOP)/src/gallium/winsys/nouveau/drm/libnouveaudrm.a \
+ $(TOP)/src/gallium/drivers/nvfx/libnvfx.a \
$(TOP)/src/gallium/drivers/nv50/libnv50.a \
$(TOP)/src/gallium/drivers/nouveau/libnouveau.a \
$(GALLIUM_AUXILIARIES)
diff --git a/src/gallium/winsys/drm/nouveau/xorg/nouveau_xorg.c b/src/gallium/targets/xorg-nouveau/nouveau_xorg.c
index a669b3080a..699af09029 100644
--- a/src/gallium/winsys/drm/nouveau/xorg/nouveau_xorg.c
+++ b/src/gallium/targets/xorg-nouveau/nouveau_xorg.c
@@ -28,7 +28,7 @@
*
*/
-#include "../../../../state_trackers/xorg/xorg_winsys.h"
+#include "../../state_trackers/xorg/xorg_winsys.h"
static void nouveau_xorg_identify(int flags);
static Bool nouveau_xorg_pci_probe(DriverPtr driver, int entity_num,
diff --git a/src/gallium/winsys/drm/radeon/xorg/Makefile b/src/gallium/targets/xorg-radeon/Makefile
index 0eb1b3988f..cd32914c0d 100644
--- a/src/gallium/winsys/drm/radeon/xorg/Makefile
+++ b/src/gallium/targets/xorg-radeon/Makefile
@@ -1,29 +1,23 @@
-TOP = ../../../../../..
-
-
-GALLIUMDIR = $(TOP)/src/gallium
+TOP = ../../../..
+include $(TOP)/configs/current
TARGET = radeong_drv.so
-
CFILES = $(wildcard ./*.c)
-
-include ${TOP}/configs/current
-
OBJECTS = $(patsubst ./%.c,./%.o,$(CFILES))
CFLAGS = -DHAVE_CONFIG_H \
-g -Wall -Wimplicit-function-declaration -fPIC \
$(shell pkg-config --cflags pixman-1 xorg-server libdrm xproto) \
- -I${GALLIUMDIR}/include \
- -I${GALLIUMDIR}/drivers \
- -I${GALLIUMDIR}/auxiliary \
+ -I$(TOP)/src/gallium/include \
+ -I$(TOP)/src/gallium/drivers \
+ -I$(TOP)/src/gallium/auxiliary \
-I${TOP}/src/mesa \
-I$(TOP)/include \
-I$(TOP)/src/egl/main
LIBS = \
- $(GALLIUMDIR)/state_trackers/xorg/libxorgtracker.a \
- $(GALLIUMDIR)/winsys/drm/radeon/core/libradeonwinsys.a \
+ $(TOP)/src/gallium/state_trackers/xorg/libxorgtracker.a \
+ $(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
$(TOP)/src/gallium/drivers/r300/libr300.a \
$(TOP)/src/gallium/drivers/trace/libtrace.a \
$(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
@@ -34,7 +28,7 @@ TARGET_STAGING = $(TOP)/$(LIB_DIR)/gallium/$(TARGET)
all default: $(TARGET) $(TARGET_STAGING)
-$(TARGET): $(OBJECTS) Makefile $(GALLIUMDIR)/state_trackers/xorg/libxorgtracker.a $(LIBS)
+$(TARGET): $(OBJECTS) Makefile $(TOP)/src/gallium/state_trackers/xorg/libxorgtracker.a $(LIBS)
$(TOP)/bin/mklib -noprefix -o $@ \
$(OBJECTS) $(LIBS) $(shell pkg-config --libs libdrm) -ldrm_radeon
diff --git a/src/gallium/winsys/drm/radeon/xorg/radeon_xorg.c b/src/gallium/targets/xorg-radeon/radeon_xorg.c
index bb76cc0349..0d6aa56722 100644
--- a/src/gallium/winsys/drm/radeon/xorg/radeon_xorg.c
+++ b/src/gallium/targets/xorg-radeon/radeon_xorg.c
@@ -29,7 +29,7 @@
*
*/
-#include "../../../../state_trackers/xorg/xorg_winsys.h"
+#include "../../state_trackers/xorg/xorg_winsys.h"
static void radeon_xorg_identify(int flags);
static Bool radeon_xorg_pci_probe(DriverPtr driver,
diff --git a/src/gallium/winsys/drm/vmware/xorg/Makefile b/src/gallium/targets/xorg-vmwgfx/Makefile
index 49e28ae17f..12bc307ef9 100644
--- a/src/gallium/winsys/drm/vmware/xorg/Makefile
+++ b/src/gallium/targets/xorg-vmwgfx/Makefile
@@ -1,5 +1,4 @@
-TOP = ../../../../../..
-
+TOP = ../../../..
include $(TOP)/configs/current
TARGET = vmwgfx_drv.so
@@ -21,7 +20,7 @@ INCLUDES = \
LIBS = \
$(TOP)/src/gallium/state_trackers/xorg/libxorgtracker.a \
- $(TOP)/src/gallium/winsys/drm/vmware/core/libsvgadrm.a \
+ $(TOP)/src/gallium/winsys/svga/drm/libsvgadrm.a \
$(TOP)/src/gallium/drivers/trace/libtrace.a \
$(TOP)/src/gallium/drivers/svga/libsvga.a \
$(GALLIUM_AUXILIARIES)
diff --git a/src/gallium/winsys/drm/vmware/xorg/SConscript b/src/gallium/targets/xorg-vmwgfx/SConscript
index 1e5d8ff7fe..b63ab99e05 100644
--- a/src/gallium/winsys/drm/vmware/xorg/SConscript
+++ b/src/gallium/targets/xorg-vmwgfx/SConscript
@@ -2,6 +2,10 @@ import os.path
Import('*')
+if not 'svga' in env['drivers']:
+ print 'warning: svga pipe driver not built skipping vmwgfx_drv.so'
+ Return()
+
if env['platform'] == 'linux':
env = env.Clone()
diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_driver.h b/src/gallium/targets/xorg-vmwgfx/vmw_driver.h
index ba754b51e4..ba754b51e4 100644
--- a/src/gallium/winsys/drm/vmware/xorg/vmw_driver.h
+++ b/src/gallium/targets/xorg-vmwgfx/vmw_driver.h
diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_hook.h b/src/gallium/targets/xorg-vmwgfx/vmw_hook.h
index 224a2d9299..224a2d9299 100644
--- a/src/gallium/winsys/drm/vmware/xorg/vmw_hook.h
+++ b/src/gallium/targets/xorg-vmwgfx/vmw_hook.h
diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c b/src/gallium/targets/xorg-vmwgfx/vmw_ioctl.c
index 521578ab35..96ee4ff82b 100644
--- a/src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c
+++ b/src/gallium/targets/xorg-vmwgfx/vmw_ioctl.c
@@ -42,7 +42,7 @@
#include <sys/mman.h>
#include "xf86drm.h"
-#include "../core/vmwgfx_drm.h"
+#include "../../winsys/svga/drm/vmwgfx_drm.h"
#include "vmw_driver.h"
#include "util/u_debug.h"
diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_screen.c b/src/gallium/targets/xorg-vmwgfx/vmw_screen.c
index f43f91e5c0..f43f91e5c0 100644
--- a/src/gallium/winsys/drm/vmware/xorg/vmw_screen.c
+++ b/src/gallium/targets/xorg-vmwgfx/vmw_screen.c
diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_video.c b/src/gallium/targets/xorg-vmwgfx/vmw_video.c
index de28f06a47..eced60d0ec 100644
--- a/src/gallium/winsys/drm/vmware/xorg/vmw_video.c
+++ b/src/gallium/targets/xorg-vmwgfx/vmw_video.c
@@ -62,7 +62,7 @@ typedef uint8_t uint8;
#include <X11/extensions/Xv.h>
#include "xf86drm.h"
-#include "../core/vmwgfx_drm.h"
+#include "../../winsys/svga/drm/vmwgfx_drm.h"
#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE)
diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_xorg.c b/src/gallium/targets/xorg-vmwgfx/vmw_xorg.c
index 87aad25b24..87aad25b24 100644
--- a/src/gallium/winsys/drm/vmware/xorg/vmw_xorg.c
+++ b/src/gallium/targets/xorg-vmwgfx/vmw_xorg.c
diff --git a/src/gallium/winsys/SConscript b/src/gallium/winsys/SConscript
index 30c3378dff..2013ee97c1 100644
--- a/src/gallium/winsys/SConscript
+++ b/src/gallium/winsys/SConscript
@@ -1,16 +1,36 @@
Import('*')
-if env['dri']:
- SConscript([
- 'drm/SConscript',
- ])
-
if 'xlib' in env['winsys']:
SConscript([
- 'xlib/SConscript',
+ 'sw/xlib/SConscript',
])
if 'gdi' in env['winsys']:
SConscript([
- 'gdi/SConscript',
+ 'sw/gdi/SConscript',
])
+
+if env['dri']:
+ SConscript([
+ 'sw/dri/SConscript',
+ ])
+
+ if 'vmware' in env['winsys']:
+ SConscript([
+ 'svga/drm/SConscript',
+ ])
+
+ if 'i915' in env['winsys']:
+ SConscript([
+ 'i915/drm/SConscript',
+ ])
+
+ if 'i965' in env['winsys']:
+ SConscript([
+ 'i965/drm/SConscript',
+ ])
+
+ if 'radeon' in env['winsys']:
+ SConscript([
+ 'radeon/drm/SConscript',
+ ])
diff --git a/src/gallium/winsys/drm/SConscript b/src/gallium/winsys/drm/SConscript
deleted file mode 100644
index 66b73a8bf9..0000000000
--- a/src/gallium/winsys/drm/SConscript
+++ /dev/null
@@ -1,69 +0,0 @@
-Import('*')
-
-if env['dri']:
-
- drienv = env.Clone()
-
- drienv.Replace(CPPPATH = [
- '#src/mesa/drivers/dri/common',
- '#include',
- '#include/GL/internal',
- '#src/gallium/include',
- '#src/gallium/auxiliary',
- '#src/gallium/drivers',
- '#src/mesa',
- '#src/mesa/main',
- '#src/mesa/glapi',
- '#src/mesa/math',
- '#src/mesa/transform',
- '#src/mesa/shader',
- '#src/mesa/swrast',
- '#src/mesa/swrast_setup',
- '#src/egl/main',
- '#src/egl/drivers/dri',
- ])
-
- drienv.ParseConfig('pkg-config --cflags --libs libdrm')
-
- COMMON_GALLIUM_SOURCES = [
- '#src/mesa/drivers/dri/common/utils.c',
- '#src/mesa/drivers/dri/common/vblank.c',
- '#src/mesa/drivers/dri/common/dri_util.c',
- '#src/mesa/drivers/dri/common/xmlconfig.c',
- ]
-
- COMMON_BM_SOURCES = [
- '#src/mesa/drivers/dri/common/dri_bufmgr.c',
- '#src/mesa/drivers/dri/common/dri_drmpool.c',
- ]
-
- Export([
- 'drienv',
- 'COMMON_GALLIUM_SOURCES',
- 'COMMON_BM_SOURCES',
- ])
-
- # TODO: Installation
- #install: $(LIBNAME)
- # $(INSTALL) -d $(DRI_DRIVER_INSTALL_DIR)
- # $(INSTALL) -m 755 $(LIBNAME) $(DRI_DRIVER_INSTALL_DIR)
-
- if 'vmware' in env['winsys']:
- SConscript([
- 'vmware/SConscript',
- ])
-
- if 'intel' in env['winsys']:
- SConscript([
- 'intel/SConscript',
- ])
-
- if 'i965' in env['winsys']:
- SConscript([
- 'i965/SConscript',
- ])
-
- if 'radeon' in env['winsys']:
- SConscript([
- 'radeon/SConscript',
- ])
diff --git a/src/gallium/winsys/drm/i965/SConscript b/src/gallium/winsys/drm/i965/SConscript
deleted file mode 100644
index 50d7b75ed6..0000000000
--- a/src/gallium/winsys/drm/i965/SConscript
+++ /dev/null
@@ -1,7 +0,0 @@
-Import('*')
-
-SConscript(['gem/SConscript',])
-
-if 'mesa' in env['statetrackers']:
-
- SConscript(['dri/SConscript'])
diff --git a/src/gallium/winsys/drm/i965/dri/SConscript b/src/gallium/winsys/drm/i965/dri/SConscript
deleted file mode 100644
index a99533fd24..0000000000
--- a/src/gallium/winsys/drm/i965/dri/SConscript
+++ /dev/null
@@ -1,19 +0,0 @@
-Import('*')
-
-env = drienv.Clone()
-
-env.ParseConfig('pkg-config --cflags --libs libdrm_intel')
-
-drivers = [
- st_dri,
- i965drm,
- i965,
- trace,
-]
-
-env.LoadableModule(
- target ='i965_dri.so',
- source = COMMON_GALLIUM_SOURCES,
- LIBS = drivers + mesa + gallium + env['LIBS'],
- SHLIBPREFIX = '',
-)
diff --git a/src/gallium/winsys/drm/i965/egl/Makefile b/src/gallium/winsys/drm/i965/egl/Makefile
deleted file mode 100644
index 1c13258200..0000000000
--- a/src/gallium/winsys/drm/i965/egl/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-TOP = ../../../../../..
-include $(TOP)/configs/current
-
-EGL_DRIVER_NAME = i965
-EGL_DRIVER_SOURCES = dummy.c
-EGL_DRIVER_LIBS = -ldrm_intel
-
-EGL_DRIVER_PIPES = \
- $(TOP)/src/gallium/winsys/drm/i965/gem/libi965drm.a \
- $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
- $(TOP)/src/gallium/drivers/trace/libtrace.a \
- $(TOP)/src/gallium/drivers/i965/libi965.a
-
-include ../../Makefile.egl
diff --git a/src/gallium/winsys/drm/i965/gem/i965_drm_api.c b/src/gallium/winsys/drm/i965/gem/i965_drm_api.c
deleted file mode 100644
index a061eef0be..0000000000
--- a/src/gallium/winsys/drm/i965/gem/i965_drm_api.c
+++ /dev/null
@@ -1,238 +0,0 @@
-
-#include <stdio.h>
-#include "state_tracker/drm_api.h"
-
-#include "i965_drm_winsys.h"
-#include "util/u_memory.h"
-
-#include "i965/brw_context.h" /* XXX: shouldn't be doing this */
-#include "i965/brw_screen.h" /* XXX: shouldn't be doing this */
-
-#include "trace/tr_drm.h"
-
-/*
- * Helper functions
- */
-
-
-static void
-i965_libdrm_get_device_id(unsigned int *device_id)
-{
- char path[512];
- FILE *file;
- void *shutup_gcc;
-
- /*
- * FIXME: Fix this up to use a drm ioctl or whatever.
- */
-
- snprintf(path, sizeof(path), "/sys/class/drm/card0/device/device");
- file = fopen(path, "r");
- if (!file) {
- return;
- }
-
- shutup_gcc = fgets(path, sizeof(path), file);
- sscanf(path, "%x", device_id);
- fclose(file);
-}
-
-static struct i965_libdrm_buffer *
-i965_libdrm_buffer_from_handle(struct i965_libdrm_winsys *idws,
- const char* name, unsigned handle)
-{
- struct i965_libdrm_buffer *buf = CALLOC_STRUCT(i965_libdrm_buffer);
- uint32_t swizzle = 0;
-
- if (BRW_DUMP)
- debug_printf("%s\n", __FUNCTION__);
-
- if (!buf)
- return NULL;
- pipe_reference_init(&buf->base.reference, 1);
- buf->bo = drm_intel_bo_gem_create_from_name(idws->gem, name, handle);
- buf->base.size = buf->bo->size;
- buf->base.sws = &idws->base;
- buf->flinked = TRUE;
- buf->flink = handle;
-
-
- if (!buf->bo)
- goto err;
-
- drm_intel_bo_get_tiling(buf->bo, &buf->tiling, &swizzle);
- if (buf->tiling != 0)
- buf->map_gtt = TRUE;
-
- return buf;
-
-err:
- FREE(buf);
- return NULL;
-}
-
-
-/*
- * Exported functions
- */
-
-
-static struct pipe_texture *
-i965_libdrm_texture_from_shared_handle(struct drm_api *api,
- struct pipe_screen *screen,
- struct pipe_texture *template,
- const char* name,
- unsigned pitch,
- unsigned handle)
-{
- /* XXX: this is silly -- there should be a way to get directly from
- * the "drm_api" struct to ourselves, without peering into
- * unrelated code:
- */
- struct i965_libdrm_winsys *idws = i965_libdrm_winsys(brw_screen(screen)->sws);
- struct i965_libdrm_buffer *buffer;
-
- if (BRW_DUMP)
- debug_printf("%s %s pitch %d handle 0x%x\n", __FUNCTION__,
- name, pitch, handle);
-
- buffer = i965_libdrm_buffer_from_handle(idws, name, handle);
- if (!buffer)
- return NULL;
-
- return brw_texture_blanket_winsys_buffer(screen, template, pitch,
- buffer->tiling,
- &buffer->base);
-}
-
-
-static boolean
-i965_libdrm_shared_handle_from_texture(struct drm_api *api,
- struct pipe_screen *screen,
- struct pipe_texture *texture,
- unsigned *pitch,
- unsigned *handle)
-{
- struct i965_libdrm_buffer *buf = NULL;
- struct brw_winsys_buffer *buffer = NULL;
-
- if (BRW_DUMP)
- debug_printf("%s\n", __FUNCTION__);
-
- if (!brw_texture_get_winsys_buffer(texture, &buffer, pitch))
- return FALSE;
-
- buf = i965_libdrm_buffer(buffer);
- if (!buf->flinked) {
- if (drm_intel_bo_flink(buf->bo, &buf->flink))
- return FALSE;
- buf->flinked = TRUE;
- }
-
- *handle = buf->flink;
-
- if (BRW_DUMP)
- debug_printf(" -> pitch %d handle 0x%x\n", *pitch, *handle);
-
- return TRUE;
-}
-
-static boolean
-i965_libdrm_local_handle_from_texture(struct drm_api *api,
- struct pipe_screen *screen,
- struct pipe_texture *texture,
- unsigned *pitch,
- unsigned *handle)
-{
- struct brw_winsys_buffer *buffer = NULL;
-
- if (BRW_DUMP)
- debug_printf("%s\n", __FUNCTION__);
-
- if (!brw_texture_get_winsys_buffer(texture, &buffer, pitch))
- return FALSE;
-
- *handle = i965_libdrm_buffer(buffer)->bo->handle;
-
- if (BRW_DUMP)
- debug_printf(" -> pitch %d handle 0x%x\n", *pitch, *handle);
-
- return TRUE;
-}
-
-static void
-i965_libdrm_winsys_destroy(struct brw_winsys_screen *iws)
-{
- struct i965_libdrm_winsys *idws = i965_libdrm_winsys(iws);
-
- if (BRW_DUMP)
- debug_printf("%s\n", __FUNCTION__);
-
- drm_intel_bufmgr_destroy(idws->gem);
-
- FREE(idws);
-}
-
-static struct pipe_screen *
-i965_libdrm_create_screen(struct drm_api *api, int drmFD,
- struct drm_create_screen_arg *arg)
-{
- struct i965_libdrm_winsys *idws;
- unsigned int deviceID;
-
- debug_printf("%s\n", __FUNCTION__);
-
- if (arg != NULL) {
- switch(arg->mode) {
- case DRM_CREATE_NORMAL:
- break;
- default:
- return NULL;
- }
- }
-
- idws = CALLOC_STRUCT(i965_libdrm_winsys);
- if (!idws)
- return NULL;
-
- i965_libdrm_get_device_id(&deviceID);
-
- i965_libdrm_winsys_init_buffer_functions(idws);
-
- idws->fd = drmFD;
- idws->id = deviceID;
-
- idws->base.destroy = i965_libdrm_winsys_destroy;
-
- idws->gem = drm_intel_bufmgr_gem_init(idws->fd, BRW_BATCH_SIZE);
- drm_intel_bufmgr_gem_enable_reuse(idws->gem);
-
- idws->send_cmd = !debug_get_bool_option("BRW_NO_HW", FALSE);
-
- return brw_create_screen(&idws->base, deviceID);
-}
-
-
-static void
-destroy(struct drm_api *api)
-{
- if (BRW_DUMP)
- debug_printf("%s\n", __FUNCTION__);
-
-}
-
-struct drm_api i965_libdrm_api =
-{
- .name = "i965",
- .create_screen = i965_libdrm_create_screen,
- .texture_from_shared_handle = i965_libdrm_texture_from_shared_handle,
- .shared_handle_from_texture = i965_libdrm_shared_handle_from_texture,
- .local_handle_from_texture = i965_libdrm_local_handle_from_texture,
- .destroy = destroy,
-};
-
-struct drm_api *
-drm_api_create()
-{
- return trace_drm_create(&i965_libdrm_api);
-}
diff --git a/src/gallium/winsys/drm/intel/Makefile b/src/gallium/winsys/drm/intel/Makefile
deleted file mode 100644
index d8feef6824..0000000000
--- a/src/gallium/winsys/drm/intel/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-# src/gallium/winsys/drm/intel/Makefile
-TOP = ../../../../..
-include $(TOP)/configs/current
-
-SUBDIRS = gem $(GALLIUM_STATE_TRACKERS_DIRS)
-
-default install clean:
- @for dir in $(SUBDIRS) ; do \
- if [ -d $$dir ] ; then \
- (cd $$dir && $(MAKE) $@) || exit 1; \
- fi \
- done
diff --git a/src/gallium/winsys/drm/intel/SConscript b/src/gallium/winsys/drm/intel/SConscript
deleted file mode 100644
index 50d7b75ed6..0000000000
--- a/src/gallium/winsys/drm/intel/SConscript
+++ /dev/null
@@ -1,7 +0,0 @@
-Import('*')
-
-SConscript(['gem/SConscript',])
-
-if 'mesa' in env['statetrackers']:
-
- SConscript(['dri/SConscript'])
diff --git a/src/gallium/winsys/drm/intel/dri/SConscript b/src/gallium/winsys/drm/intel/dri/SConscript
deleted file mode 100644
index 0df841d879..0000000000
--- a/src/gallium/winsys/drm/intel/dri/SConscript
+++ /dev/null
@@ -1,21 +0,0 @@
-Import('*')
-
-env = drienv.Clone()
-
-env.ParseConfig('pkg-config --cflags --libs libdrm_intel')
-
-env.Prepend(LIBS = [
- st_dri,
- inteldrm,
- i915,
- trace,
- mesa,
- glsl,
- gallium
-])
-
-env.LoadableModule(
- target ='i915_dri.so',
- source = COMMON_GALLIUM_SOURCES,
- SHLIBPREFIX = '',
-)
diff --git a/src/gallium/winsys/drm/intel/gem/SConscript b/src/gallium/winsys/drm/intel/gem/SConscript
deleted file mode 100644
index 26717f391f..0000000000
--- a/src/gallium/winsys/drm/intel/gem/SConscript
+++ /dev/null
@@ -1,17 +0,0 @@
-Import('*')
-
-env = drienv.Clone()
-
-inteldrm_sources = [
- 'intel_drm_api.c',
- 'intel_drm_batchbuffer.c',
- 'intel_drm_buffer.c',
- 'intel_drm_fence.c',
-]
-
-inteldrm = env.ConvenienceLibrary(
- target ='inteldrm',
- source = inteldrm_sources,
-)
-
-Export('inteldrm')
diff --git a/src/gallium/winsys/drm/intel/gem/intel_drm_api.c b/src/gallium/winsys/drm/intel/gem/intel_drm_api.c
deleted file mode 100644
index 377ed25513..0000000000
--- a/src/gallium/winsys/drm/intel/gem/intel_drm_api.c
+++ /dev/null
@@ -1,205 +0,0 @@
-#include <stdio.h>
-
-#include "state_tracker/drm_api.h"
-
-#include "intel_drm_winsys.h"
-#include "util/u_memory.h"
-
-#include "i915/i915_context.h"
-#include "i915/i915_screen.h"
-
-#include "trace/tr_drm.h"
-
-/*
- * Helper functions
- */
-
-
-static void
-intel_drm_get_device_id(unsigned int *device_id)
-{
- char path[512];
- FILE *file;
- void *shutup_gcc;
-
- /*
- * FIXME: Fix this up to use a drm ioctl or whatever.
- */
-
- snprintf(path, sizeof(path), "/sys/class/drm/card0/device/device");
- file = fopen(path, "r");
- if (!file) {
- return;
- }
-
- shutup_gcc = fgets(path, sizeof(path), file);
- (void) shutup_gcc;
- sscanf(path, "%x", device_id);
- fclose(file);
-}
-
-static struct intel_buffer *
-intel_drm_buffer_from_handle(struct intel_drm_winsys *idws,
- const char* name, unsigned handle)
-{
- struct intel_drm_buffer *buf = CALLOC_STRUCT(intel_drm_buffer);
- uint32_t tile = 0, swizzle = 0;
-
- if (!buf)
- return NULL;
-
- buf->magic = 0xDEAD1337;
- buf->bo = drm_intel_bo_gem_create_from_name(idws->pools.gem, name, handle);
- buf->flinked = TRUE;
- buf->flink = handle;
-
- if (!buf->bo)
- goto err;
-
- drm_intel_bo_get_tiling(buf->bo, &tile, &swizzle);
- if (tile != INTEL_TILE_NONE)
- buf->map_gtt = TRUE;
-
- return (struct intel_buffer *)buf;
-
-err:
- FREE(buf);
- return NULL;
-}
-
-
-/*
- * Exported functions
- */
-
-
-static struct pipe_texture *
-intel_drm_texture_from_shared_handle(struct drm_api *api,
- struct pipe_screen *screen,
- struct pipe_texture *templ,
- const char* name,
- unsigned pitch,
- unsigned handle)
-{
- struct intel_drm_winsys *idws = intel_drm_winsys(i915_screen(screen)->iws);
- struct intel_buffer *buffer;
-
- buffer = intel_drm_buffer_from_handle(idws, name, handle);
- if (!buffer)
- return NULL;
-
- return i915_texture_blanket_intel(screen, templ, pitch, buffer);
-}
-
-static boolean
-intel_drm_shared_handle_from_texture(struct drm_api *api,
- struct pipe_screen *screen,
- struct pipe_texture *texture,
- unsigned *pitch,
- unsigned *handle)
-{
- struct intel_drm_buffer *buf = NULL;
- struct intel_buffer *buffer = NULL;
- if (!i915_get_texture_buffer_intel(texture, &buffer, pitch))
- return FALSE;
-
- buf = intel_drm_buffer(buffer);
- if (!buf->flinked) {
- if (drm_intel_bo_flink(buf->bo, &buf->flink))
- return FALSE;
- buf->flinked = TRUE;
- }
-
- *handle = buf->flink;
-
- return TRUE;
-}
-
-static boolean
-intel_drm_local_handle_from_texture(struct drm_api *api,
- struct pipe_screen *screen,
- struct pipe_texture *texture,
- unsigned *pitch,
- unsigned *handle)
-{
- struct intel_buffer *buffer = NULL;
- if (!i915_get_texture_buffer_intel(texture, &buffer, pitch))
- return FALSE;
-
- *handle = intel_drm_buffer(buffer)->bo->handle;
-
- return TRUE;
-}
-
-static void
-intel_drm_winsys_destroy(struct intel_winsys *iws)
-{
- struct intel_drm_winsys *idws = intel_drm_winsys(iws);
-
- drm_intel_bufmgr_destroy(idws->pools.gem);
-
- FREE(idws);
-}
-
-static struct pipe_screen *
-intel_drm_create_screen(struct drm_api *api, int drmFD,
- struct drm_create_screen_arg *arg)
-{
- struct intel_drm_winsys *idws;
- unsigned int deviceID;
-
- if (arg != NULL) {
- switch(arg->mode) {
- case DRM_CREATE_NORMAL:
- break;
- default:
- return NULL;
- }
- }
-
- idws = CALLOC_STRUCT(intel_drm_winsys);
- if (!idws)
- return NULL;
-
- intel_drm_get_device_id(&deviceID);
-
- intel_drm_winsys_init_batchbuffer_functions(idws);
- intel_drm_winsys_init_buffer_functions(idws);
- intel_drm_winsys_init_fence_functions(idws);
-
- idws->fd = drmFD;
- idws->id = deviceID;
- idws->max_batch_size = 16 * 4096;
-
- idws->base.destroy = intel_drm_winsys_destroy;
-
- idws->pools.gem = drm_intel_bufmgr_gem_init(idws->fd, idws->max_batch_size);
- drm_intel_bufmgr_gem_enable_reuse(idws->pools.gem);
-
- idws->dump_cmd = debug_get_bool_option("INTEL_DUMP_CMD", FALSE);
-
- return i915_create_screen(&idws->base, deviceID);
-}
-
-static void
-destroy(struct drm_api *api)
-{
-
-}
-
-struct drm_api intel_drm_api =
-{
- .name = "i915",
- .driver_name = "i915",
- .create_screen = intel_drm_create_screen,
- .texture_from_shared_handle = intel_drm_texture_from_shared_handle,
- .shared_handle_from_texture = intel_drm_shared_handle_from_texture,
- .local_handle_from_texture = intel_drm_local_handle_from_texture,
- .destroy = destroy,
-};
-
-struct drm_api *
-drm_api_create()
-{
- return trace_drm_create(&intel_drm_api);
-}
diff --git a/src/gallium/winsys/drm/intel/gem/intel_drm_buffer.c b/src/gallium/winsys/drm/intel/gem/intel_drm_buffer.c
deleted file mode 100644
index ac4dd6e00e..0000000000
--- a/src/gallium/winsys/drm/intel/gem/intel_drm_buffer.c
+++ /dev/null
@@ -1,154 +0,0 @@
-
-#include "intel_drm_winsys.h"
-#include "util/u_memory.h"
-
-#include "i915_drm.h"
-
-static struct intel_buffer *
-intel_drm_buffer_create(struct intel_winsys *iws,
- unsigned size, unsigned alignment,
- enum intel_buffer_type type)
-{
- struct intel_drm_buffer *buf = CALLOC_STRUCT(intel_drm_buffer);
- struct intel_drm_winsys *idws = intel_drm_winsys(iws);
- drm_intel_bufmgr *pool;
- char *name;
-
- if (!buf)
- return NULL;
-
- buf->magic = 0xDEAD1337;
- buf->flinked = FALSE;
- buf->flink = 0;
- buf->map_gtt = FALSE;
-
- if (type == INTEL_NEW_TEXTURE) {
- name = "gallium3d_texture";
- pool = idws->pools.gem;
- } else if (type == INTEL_NEW_VERTEX) {
- name = "gallium3d_vertex";
- pool = idws->pools.gem;
- buf->map_gtt = TRUE;
- } else if (type == INTEL_NEW_SCANOUT) {
- name = "gallium3d_scanout";
- pool = idws->pools.gem;
- buf->map_gtt = TRUE;
- } else {
- assert(0);
- name = "gallium3d_unknown";
- pool = idws->pools.gem;
- }
-
- buf->bo = drm_intel_bo_alloc(pool, name, size, alignment);
-
- if (!buf->bo)
- goto err;
-
- return (struct intel_buffer *)buf;
-
-err:
- assert(0);
- FREE(buf);
- return NULL;
-}
-
-static int
-intel_drm_buffer_set_fence_reg(struct intel_winsys *iws,
- struct intel_buffer *buffer,
- unsigned stride,
- enum intel_buffer_tile tile)
-{
- struct intel_drm_buffer *buf = intel_drm_buffer(buffer);
- assert(I915_TILING_NONE == INTEL_TILE_NONE);
- assert(I915_TILING_X == INTEL_TILE_X);
- assert(I915_TILING_Y == INTEL_TILE_Y);
-
- if (tile != INTEL_TILE_NONE) {
- assert(buf->map_count == 0);
- buf->map_gtt = TRUE;
- }
-
- return drm_intel_bo_set_tiling(buf->bo, &tile, stride);
-}
-
-static void *
-intel_drm_buffer_map(struct intel_winsys *iws,
- struct intel_buffer *buffer,
- boolean write)
-{
- struct intel_drm_buffer *buf = intel_drm_buffer(buffer);
- drm_intel_bo *bo = intel_bo(buffer);
- int ret = 0;
-
- assert(bo);
-
- if (buf->map_count)
- goto out;
-
- if (buf->map_gtt)
- ret = drm_intel_gem_bo_map_gtt(bo);
- else
- ret = drm_intel_bo_map(bo, write);
-
- buf->ptr = bo->virtual;
-
- assert(ret == 0);
-out:
- if (ret)
- return NULL;
-
- buf->map_count++;
- return buf->ptr;
-}
-
-static void
-intel_drm_buffer_unmap(struct intel_winsys *iws,
- struct intel_buffer *buffer)
-{
- struct intel_drm_buffer *buf = intel_drm_buffer(buffer);
-
- if (--buf->map_count)
- return;
-
- if (buf->map_gtt)
- drm_intel_gem_bo_unmap_gtt(intel_bo(buffer));
- else
- drm_intel_bo_unmap(intel_bo(buffer));
-}
-
-static int
-intel_drm_buffer_write(struct intel_winsys *iws,
- struct intel_buffer *buffer,
- size_t offset,
- size_t size,
- const void *data)
-{
- struct intel_drm_buffer *buf = intel_drm_buffer(buffer);
-
- return drm_intel_bo_subdata(buf->bo, offset, size, (void*)data);
-}
-
-static void
-intel_drm_buffer_destroy(struct intel_winsys *iws,
- struct intel_buffer *buffer)
-{
- drm_intel_bo_unreference(intel_bo(buffer));
-
-#ifdef DEBUG
- intel_drm_buffer(buffer)->magic = 0;
- intel_drm_buffer(buffer)->bo = NULL;
-#endif
-
- FREE(buffer);
-}
-
-void
-intel_drm_winsys_init_buffer_functions(struct intel_drm_winsys *idws)
-{
- idws->base.buffer_create = intel_drm_buffer_create;
- idws->base.buffer_set_fence_reg = intel_drm_buffer_set_fence_reg;
- idws->base.buffer_map = intel_drm_buffer_map;
- idws->base.buffer_unmap = intel_drm_buffer_unmap;
- idws->base.buffer_write = intel_drm_buffer_write;
- idws->base.buffer_destroy = intel_drm_buffer_destroy;
-}
diff --git a/src/gallium/winsys/drm/intel/gem/intel_drm_winsys.h b/src/gallium/winsys/drm/intel/gem/intel_drm_winsys.h
deleted file mode 100644
index 9786ee9365..0000000000
--- a/src/gallium/winsys/drm/intel/gem/intel_drm_winsys.h
+++ /dev/null
@@ -1,77 +0,0 @@
-
-#ifndef INTEL_DRM_WINSYS_H
-#define INTEL_DRM_WINSYS_H
-
-#include "i915/intel_batchbuffer.h"
-
-#include "drm.h"
-#include "intel_bufmgr.h"
-
-
-/*
- * Winsys
- */
-
-
-struct intel_drm_winsys
-{
- struct intel_winsys base;
-
- boolean dump_cmd;
-
- int fd; /**< Drm file discriptor */
-
- unsigned id;
-
- size_t max_batch_size;
-
- struct {
- drm_intel_bufmgr *gem;
- } pools;
-};
-
-static INLINE struct intel_drm_winsys *
-intel_drm_winsys(struct intel_winsys *iws)
-{
- return (struct intel_drm_winsys *)iws;
-}
-
-struct intel_drm_winsys * intel_drm_winsys_create(int fd, unsigned pci_id);
-struct pipe_fence_handle * intel_drm_fence_create(drm_intel_bo *bo);
-
-void intel_drm_winsys_init_batchbuffer_functions(struct intel_drm_winsys *idws);
-void intel_drm_winsys_init_buffer_functions(struct intel_drm_winsys *idws);
-void intel_drm_winsys_init_fence_functions(struct intel_drm_winsys *idws);
-
-
-/*
- * Buffer
- */
-
-
-struct intel_drm_buffer {
- unsigned magic;
-
- drm_intel_bo *bo;
-
- void *ptr;
- unsigned map_count;
- boolean map_gtt;
-
- boolean flinked;
- unsigned flink;
-};
-
-static INLINE struct intel_drm_buffer *
-intel_drm_buffer(struct intel_buffer *buffer)
-{
- return (struct intel_drm_buffer *)buffer;
-}
-
-static INLINE drm_intel_bo *
-intel_bo(struct intel_buffer *buffer)
-{
- return intel_drm_buffer(buffer)->bo;
-}
-
-#endif
diff --git a/src/gallium/winsys/drm/nouveau/Makefile b/src/gallium/winsys/drm/nouveau/Makefile
deleted file mode 100644
index 6c9cbef26d..0000000000
--- a/src/gallium/winsys/drm/nouveau/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-# src/gallium/winsys/drm/nouveau/Makefile
-TOP = ../../../../..
-include $(TOP)/configs/current
-
-SUBDIRS = drm $(GALLIUM_STATE_TRACKERS_DIRS)
-
-default install clean:
- @for dir in $(SUBDIRS) ; do \
- if [ -d $$dir ] ; then \
- (cd $$dir && $(MAKE) $@) || exit 1; \
- fi \
- done
diff --git a/src/gallium/winsys/drm/nouveau/egl/Makefile b/src/gallium/winsys/drm/nouveau/egl/Makefile
deleted file mode 100644
index 2c35260332..0000000000
--- a/src/gallium/winsys/drm/nouveau/egl/Makefile
+++ /dev/null
@@ -1,16 +0,0 @@
-TOP = ../../../../../..
-include $(TOP)/configs/current
-
-EGL_DRIVER_NAME = nouveau
-EGL_DRIVER_SOURCES = dummy.c
-EGL_DRIVER_LIBS = -ldrm_nouveau
-
-EGL_DRIVER_PIPES = \
- $(TOP)/src/gallium/winsys/drm/nouveau/drm/libnouveaudrm.a \
- $(TOP)/src/gallium/drivers/nv30/libnv30.a \
- $(TOP)/src/gallium/drivers/nv40/libnv40.a \
- $(TOP)/src/gallium/drivers/nv50/libnv50.a \
- $(TOP)/src/gallium/drivers/nouveau/libnouveau.a \
- $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a
-
-include ../../Makefile.egl
diff --git a/src/gallium/winsys/drm/radeon/Makefile b/src/gallium/winsys/drm/radeon/Makefile
deleted file mode 100644
index bacdf3de28..0000000000
--- a/src/gallium/winsys/drm/radeon/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-# src/gallium/winsys/drm/radeon/Makefile
-TOP = ../../../../..
-include $(TOP)/configs/current
-
-SUBDIRS = core $(GALLIUM_STATE_TRACKERS_DIRS)
-
-default install clean:
- @for dir in $(SUBDIRS) ; do \
- if [ -d $$dir ] ; then \
- (cd $$dir && $(MAKE) $@) || exit 1; \
- fi \
- done
diff --git a/src/gallium/winsys/drm/radeon/SConscript b/src/gallium/winsys/drm/radeon/SConscript
deleted file mode 100644
index b2dfd504d4..0000000000
--- a/src/gallium/winsys/drm/radeon/SConscript
+++ /dev/null
@@ -1,7 +0,0 @@
-Import('*')
-
-SConscript(['core/SConscript',])
-
-if 'mesa' in env['statetrackers']:
-
- SConscript(['dri/SConscript'])
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c
deleted file mode 100644
index e5c6919933..0000000000
--- a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
- * Copyright © 2008 Jérôme Glisse
- * 2009 Corbin Simpson
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
- * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- */
-/*
- * Authors:
- * Jérôme Glisse <glisse@freedesktop.org>
- * Corbin Simpson <MostAwesomeDude@gmail.com>
- */
-
-#include "radeon_buffer.h"
-#include "radeon_drm.h"
-
-#include "util/u_format.h"
-#include "util/u_math.h"
-#include "util/u_memory.h"
-
-#include "radeon_bo_gem.h"
-#include <X11/Xutil.h>
-
-struct radeon_vl_context
-{
- Display *display;
- int screen;
- Drawable drawable;
-};
-
-static const char *radeon_get_name(struct pipe_winsys *ws)
-{
- return "Radeon/GEM+KMS";
-}
-
-static uint32_t radeon_domain_from_usage(unsigned usage)
-{
- uint32_t domain = 0;
-
- if (usage & PIPE_BUFFER_USAGE_GPU_WRITE) {
- domain |= RADEON_GEM_DOMAIN_VRAM;
- }
- if (usage & PIPE_BUFFER_USAGE_PIXEL) {
- domain |= RADEON_GEM_DOMAIN_VRAM;
- }
- if (usage & PIPE_BUFFER_USAGE_VERTEX) {
- domain |= RADEON_GEM_DOMAIN_GTT;
- }
- if (usage & PIPE_BUFFER_USAGE_INDEX) {
- domain |= RADEON_GEM_DOMAIN_GTT;
- }
-
- return domain;
-}
-
-static struct pipe_buffer *radeon_buffer_create(struct pipe_winsys *ws,
- unsigned alignment,
- unsigned usage,
- unsigned size)
-{
- struct radeon_winsys *radeon_ws = (struct radeon_winsys *)ws;
- struct radeon_pipe_buffer *radeon_buffer;
- struct pb_desc desc;
- uint32_t domain;
-
- radeon_buffer = CALLOC_STRUCT(radeon_pipe_buffer);
- if (radeon_buffer == NULL) {
- return NULL;
- }
-
- pipe_reference_init(&radeon_buffer->base.reference, 1);
- radeon_buffer->base.alignment = alignment;
- radeon_buffer->base.usage = usage;
- radeon_buffer->base.size = size;
-
- if (usage & PIPE_BUFFER_USAGE_CONSTANT && is_r3xx(radeon_ws->pci_id)) {
- /* Don't bother allocating a BO, as it'll never get to the card. */
- desc.alignment = alignment;
- desc.usage = usage;
- radeon_buffer->pb = pb_malloc_buffer_create(size, &desc);
- return &radeon_buffer->base;
- }
-
- domain = radeon_domain_from_usage(usage);
-
- radeon_buffer->bo = radeon_bo_open(radeon_ws->priv->bom, 0, size,
- alignment, domain, 0);
- if (radeon_buffer->bo == NULL) {
- FREE(radeon_buffer);
- return NULL;
- }
- return &radeon_buffer->base;
-}
-
-static struct pipe_buffer *radeon_buffer_user_create(struct pipe_winsys *ws,
- void *ptr,
- unsigned bytes)
-{
- struct radeon_pipe_buffer *radeon_buffer;
-
- radeon_buffer =
- (struct radeon_pipe_buffer*)radeon_buffer_create(ws, 0, 0, bytes);
- if (radeon_buffer == NULL) {
- return NULL;
- }
- radeon_bo_map(radeon_buffer->bo, 1);
- memcpy(radeon_buffer->bo->ptr, ptr, bytes);
- radeon_bo_unmap(radeon_buffer->bo);
- return &radeon_buffer->base;
-}
-
-static struct pipe_buffer *radeon_surface_buffer_create(struct pipe_winsys *ws,
- unsigned width,
- unsigned height,
- enum pipe_format format,
- unsigned usage,
- unsigned tex_usage,
- unsigned *stride)
-{
- /* Radeons enjoy things in multiples of 32. */
- /* XXX this can be 32 when POT */
- const unsigned alignment = 64;
- unsigned nblocksy, size;
-
- nblocksy = util_format_get_nblocksy(format, height);
- *stride = align(util_format_get_stride(format, width), alignment);
- size = *stride * nblocksy;
-
- return radeon_buffer_create(ws, 64, usage, size);
-}
-
-static void radeon_buffer_del(struct pipe_buffer *buffer)
-{
- struct radeon_pipe_buffer *radeon_buffer =
- (struct radeon_pipe_buffer*)buffer;
-
- if (radeon_buffer->pb) {
- pipe_reference_init(&radeon_buffer->pb->base.reference, 0);
- pb_destroy(radeon_buffer->pb);
- }
-
- if (radeon_buffer->bo) {
- radeon_bo_unref(radeon_buffer->bo);
- }
-
- FREE(radeon_buffer);
-}
-
-static void *radeon_buffer_map(struct pipe_winsys *ws,
- struct pipe_buffer *buffer,
- unsigned flags)
-{
- struct radeon_winsys_priv *priv = ((struct radeon_winsys *)ws)->priv;
- struct radeon_pipe_buffer *radeon_buffer =
- (struct radeon_pipe_buffer*)buffer;
- int write = 0;
-
- if (radeon_buffer->pb) {
- return pb_map(radeon_buffer->pb, flags);
- }
-
- if (flags & PIPE_BUFFER_USAGE_DONTBLOCK) {
- uint32_t domain;
-
- if (radeon_bo_is_busy(radeon_buffer->bo, &domain))
- return NULL;
- }
-
- if (radeon_bo_is_referenced_by_cs(radeon_buffer->bo, priv->cs)) {
- priv->flush_cb(priv->flush_data);
- }
-
- if (flags & PIPE_BUFFER_USAGE_CPU_WRITE) {
- write = 1;
- }
-
- if (radeon_bo_map(radeon_buffer->bo, write)) {
- return NULL;
- }
-
- return radeon_buffer->bo->ptr;
-}
-
-static void radeon_buffer_unmap(struct pipe_winsys *ws,
- struct pipe_buffer *buffer)
-{
- struct radeon_pipe_buffer *radeon_buffer =
- (struct radeon_pipe_buffer*)buffer;
-
- if (radeon_buffer->pb) {
- pb_unmap(radeon_buffer->pb);
- } else {
- radeon_bo_unmap(radeon_buffer->bo);
- }
-}
-
-static void radeon_buffer_set_tiling(struct radeon_winsys *ws,
- struct pipe_buffer *buffer,
- uint32_t pitch,
- boolean microtiled,
- boolean macrotiled)
-{
- struct radeon_winsys_priv *priv = ((struct radeon_winsys *)ws)->priv;
- struct radeon_pipe_buffer *radeon_buffer =
- (struct radeon_pipe_buffer*)buffer;
- uint32_t flags = 0, old_flags, old_pitch;
-
- if (microtiled) {
- flags |= RADEON_BO_FLAGS_MICRO_TILE;
- }
- if (macrotiled) {
- flags |= RADEON_BO_FLAGS_MACRO_TILE;
- }
-
- radeon_bo_get_tiling(radeon_buffer->bo, &old_flags, &old_pitch);
-
- if (flags != old_flags || pitch != old_pitch) {
- /* Tiling determines how DRM treats the buffer data.
- * We must flush CS when changing it if the buffer is referenced. */
- if (radeon_bo_is_referenced_by_cs(radeon_buffer->bo, priv->cs)) {
- priv->flush_cb(priv->flush_data);
- }
-
- radeon_bo_set_tiling(radeon_buffer->bo, flags, pitch);
- }
-}
-
-static void radeon_fence_reference(struct pipe_winsys *ws,
- struct pipe_fence_handle **ptr,
- struct pipe_fence_handle *pfence)
-{
-}
-
-static int radeon_fence_signalled(struct pipe_winsys *ws,
- struct pipe_fence_handle *pfence,
- unsigned flag)
-{
- return 1;
-}
-
-static int radeon_fence_finish(struct pipe_winsys *ws,
- struct pipe_fence_handle *pfence,
- unsigned flag)
-{
- return 0;
-}
-
-struct radeon_winsys* radeon_pipe_winsys(int fd)
-{
- struct radeon_winsys* radeon_ws;
-
- radeon_ws = CALLOC_STRUCT(radeon_winsys);
- if (radeon_ws == NULL) {
- return NULL;
- }
-
- radeon_ws->priv = CALLOC_STRUCT(radeon_winsys_priv);
- if (radeon_ws->priv == NULL) {
- FREE(radeon_ws);
- return NULL;
- }
-
- radeon_ws->priv->fd = fd;
- radeon_ws->priv->bom = radeon_bo_manager_gem_ctor(fd);
-
- radeon_ws->base.flush_frontbuffer = NULL; /* overriden by co-state tracker */
-
- radeon_ws->base.buffer_create = radeon_buffer_create;
- radeon_ws->base.user_buffer_create = radeon_buffer_user_create;
- radeon_ws->base.surface_buffer_create = radeon_surface_buffer_create;
- radeon_ws->base.buffer_map = radeon_buffer_map;
- radeon_ws->base.buffer_unmap = radeon_buffer_unmap;
- radeon_ws->base.buffer_destroy = radeon_buffer_del;
-
- radeon_ws->base.fence_reference = radeon_fence_reference;
- radeon_ws->base.fence_signalled = radeon_fence_signalled;
- radeon_ws->base.fence_finish = radeon_fence_finish;
-
- radeon_ws->base.get_name = radeon_get_name;
-
- radeon_ws->buffer_set_tiling = radeon_buffer_set_tiling;
-
- return radeon_ws;
-}
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c
deleted file mode 100644
index 122bd21354..0000000000
--- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE. */
-
-#include "radeon_r300.h"
-#include "radeon_buffer.h"
-
-#include "radeon_cs_gem.h"
-
-static void radeon_set_flush_cb(struct radeon_winsys *winsys,
- void (*flush_cb)(void *),
- void *data)
-{
- winsys->priv->flush_cb = flush_cb;
- winsys->priv->flush_data = data;
- radeon_cs_space_set_flush(winsys->priv->cs, flush_cb, data);
-}
-
-static boolean radeon_add_buffer(struct radeon_winsys* winsys,
- struct pipe_buffer* pbuffer,
- uint32_t rd,
- uint32_t wd)
-{
- struct radeon_bo* bo = ((struct radeon_pipe_buffer*)pbuffer)->bo;
-
- radeon_cs_space_add_persistent_bo(winsys->priv->cs, bo, rd, wd);
- return TRUE;
-}
-
-static boolean radeon_validate(struct radeon_winsys* winsys)
-{
- if (radeon_cs_space_check(winsys->priv->cs) < 0) {
- return FALSE;
- }
-
- /* Things are fine, we can proceed as normal. */
- return TRUE;
-}
-
-static boolean radeon_check_cs(struct radeon_winsys* winsys, int size)
-{
- struct radeon_cs* cs = winsys->priv->cs;
-
- return radeon_validate(winsys) && cs->cdw + size <= cs->ndw;
-}
-
-static void radeon_begin_cs(struct radeon_winsys* winsys,
- int size,
- const char* file,
- const char* function,
- int line)
-{
- radeon_cs_begin(winsys->priv->cs, size, file, function, line);
-}
-
-static void radeon_write_cs_dword(struct radeon_winsys* winsys,
- uint32_t dword)
-{
- radeon_cs_write_dword(winsys->priv->cs, dword);
-}
-
-static void radeon_write_cs_reloc(struct radeon_winsys* winsys,
- struct pipe_buffer* pbuffer,
- uint32_t rd,
- uint32_t wd,
- uint32_t flags)
-{
- int retval = 0;
- struct radeon_pipe_buffer* radeon_buffer =
- (struct radeon_pipe_buffer*)pbuffer;
-
- assert(!radeon_buffer->pb);
-
- retval = radeon_cs_write_reloc(winsys->priv->cs, radeon_buffer->bo,
- rd, wd, flags);
-
- if (retval) {
- debug_printf("radeon: Relocation of %p (%d, %d, %d) failed!\n",
- pbuffer, rd, wd, flags);
- }
-}
-
-static void radeon_reset_bos(struct radeon_winsys *winsys)
-{
- radeon_cs_space_reset_bos(winsys->priv->cs);
-}
-
-static void radeon_end_cs(struct radeon_winsys* winsys,
- const char* file,
- const char* function,
- int line)
-{
- radeon_cs_end(winsys->priv->cs, file, function, line);
-}
-
-static void radeon_flush_cs(struct radeon_winsys* winsys)
-{
- int retval;
-
- /* Don't flush a zero-sized CS. */
- if (!winsys->priv->cs->cdw) {
- return;
- }
-
- /* Emit the CS. */
- retval = radeon_cs_emit(winsys->priv->cs);
- if (retval) {
- debug_printf("radeon: Bad CS, dumping...\n");
- radeon_cs_print(winsys->priv->cs, stderr);
- }
-
- /* Reset CS.
- * Someday, when we care about performance, we should really find a way
- * to rotate between two or three CS objects so that the GPU can be
- * spinning through one CS while another one is being filled. */
- radeon_cs_erase(winsys->priv->cs);
-}
-
-void
-radeon_setup_winsys(int fd, struct radeon_winsys* winsys)
-{
- struct radeon_winsys_priv* priv = winsys->priv;
-
- priv->csm = radeon_cs_manager_gem_ctor(fd);
-
- /* Size limit on IBs is 64 kibibytes. */
- priv->cs = radeon_cs_create(priv->csm, 1024 * 64 / 4);
- radeon_cs_set_limit(priv->cs,
- RADEON_GEM_DOMAIN_GTT, winsys->gart_size);
- radeon_cs_set_limit(priv->cs,
- RADEON_GEM_DOMAIN_VRAM, winsys->vram_size);
-
- winsys->add_buffer = radeon_add_buffer;
- winsys->validate = radeon_validate;
-
- winsys->check_cs = radeon_check_cs;
- winsys->begin_cs = radeon_begin_cs;
- winsys->write_cs_dword = radeon_write_cs_dword;
- winsys->write_cs_reloc = radeon_write_cs_reloc;
- winsys->end_cs = radeon_end_cs;
- winsys->flush_cs = radeon_flush_cs;
- winsys->reset_bos = radeon_reset_bos;
- winsys->set_flush_cb = radeon_set_flush_cb;
-}
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_winsys.h b/src/gallium/winsys/drm/radeon/core/radeon_winsys.h
deleted file mode 100644
index 4901080ca7..0000000000
--- a/src/gallium/winsys/drm/radeon/core/radeon_winsys.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright © 2009 Corbin Simpson
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
- * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- */
-/*
- * Authors:
- * Corbin Simpson <MostAwesomeDude@gmail.com>
- */
-#ifndef RADEON_WINSYS_H
-#define RADEON_WINSYS_H
-
-#include "util/u_simple_screen.h"
-
-struct radeon_winsys_priv;
-
-struct radeon_winsys {
- /* Parent class. */
- struct pipe_winsys base;
-
- /* Winsys private */
- struct radeon_winsys_priv* priv;
-
- /* PCI ID */
- uint32_t pci_id;
-
- /* GB pipe count */
- uint32_t gb_pipes;
-
- /* Z pipe count (rv530 only) */
- uint32_t z_pipes;
-
- /* GART size. */
- uint32_t gart_size;
-
- /* VRAM size. */
- uint32_t vram_size;
-
- /* Add a pipe_buffer to the list of buffer objects to validate. */
- boolean (*add_buffer)(struct radeon_winsys* winsys,
- struct pipe_buffer* pbuffer,
- uint32_t rd,
- uint32_t wd);
-
- /* Revalidate all currently setup pipe_buffers.
- * Returns TRUE if a flush is required. */
- boolean (*validate)(struct radeon_winsys* winsys);
-
- /* Check to see if there's room for commands. */
- boolean (*check_cs)(struct radeon_winsys* winsys, int size);
-
- /* Start a command emit. */
- void (*begin_cs)(struct radeon_winsys* winsys,
- int size,
- const char* file,
- const char* function,
- int line);
-
- /* Write a dword to the command buffer. */
- void (*write_cs_dword)(struct radeon_winsys* winsys, uint32_t dword);
-
- /* Write a relocated dword to the command buffer. */
- void (*write_cs_reloc)(struct radeon_winsys* winsys,
- struct pipe_buffer* bo,
- uint32_t rd,
- uint32_t wd,
- uint32_t flags);
-
- /* Finish a command emit. */
- void (*end_cs)(struct radeon_winsys* winsys,
- const char* file,
- const char* function,
- int line);
-
- /* Flush the CS. */
- void (*flush_cs)(struct radeon_winsys* winsys);
-
- /* winsys flush - callback from winsys when flush required */
- void (*set_flush_cb)(struct radeon_winsys *winsys,
- void (*flush_cb)(void *), void *data);
-
- void (*reset_bos)(struct radeon_winsys *winsys);
-
- void (*buffer_set_tiling)(struct radeon_winsys* winsys,
- struct pipe_buffer* buffer,
- uint32_t pitch,
- boolean microtiled,
- boolean macrotiled);
-};
-
-#endif
diff --git a/src/gallium/winsys/drm/radeon/dri/SConscript b/src/gallium/winsys/drm/radeon/dri/SConscript
deleted file mode 100644
index c4989d1b59..0000000000
--- a/src/gallium/winsys/drm/radeon/dri/SConscript
+++ /dev/null
@@ -1,17 +0,0 @@
-Import('*')
-
-env = drienv.Clone()
-
-env.ParseConfig('pkg-config --cflags --libs libdrm_radeon')
-
-drivers = [
- trace,
- softpipe,
- r300
-]
-
-env.SharedLibrary(
- target ='radeon_dri.so',
- source = COMMON_GALLIUM_SOURCES,
- LIBS = st_dri + radeonwinsys + mesa + drivers + gallium + env['LIBS'],
-)
diff --git a/src/gallium/winsys/drm/radeon/python/README b/src/gallium/winsys/drm/radeon/python/README
deleted file mode 100644
index 339836a592..0000000000
--- a/src/gallium/winsys/drm/radeon/python/README
+++ /dev/null
@@ -1,15 +0,0 @@
-Python bindings for the radeon gallium driver.
-
-
-See gallium/src/gallium/state_trackers/python/README for more information.
-
-
-Build as:
-
- scons debug=1 statetrackers=python winsys=drm/radeon/python
-
-Run as:
-
- export PYTHONPATH=$PWD/build/linux-x86-debug/gallium/winsys/drm/radeon/python:$PWD/build/linux-x86-debug/gallium/state_trackers/python
-
- python progs/gallium/python/samples/tri.py
diff --git a/src/gallium/winsys/drm/radeon/python/SConscript b/src/gallium/winsys/drm/radeon/python/SConscript
deleted file mode 100644
index 91cae98697..0000000000
--- a/src/gallium/winsys/drm/radeon/python/SConscript
+++ /dev/null
@@ -1,33 +0,0 @@
-import os.path
-
-Import('*')
-
-if env['platform'] == 'linux':
-
- env = env.Clone()
-
- env.Tool('python')
-
- env.ParseConfig('pkg-config --cflags --libs libdrm')
-
- env.Prepend(CPPPATH = [
- '#src/gallium/state_trackers/python',
- '../core',
- ])
-
- drivers = [
- softpipe,
- radeon,
- trace,
- ]
-
- sources = [
- 'radeon_hardpipe_winsys.c',
- 'xf86dri.c',
- ]
-
- env.SharedLibrary(
- target ='_gallium',
- source = sources,
- LIBS = [pyst] + drivers + gallium + env['LIBS'],
- )
diff --git a/src/gallium/winsys/drm/radeon/python/radeon_hardpipe_winsys.c b/src/gallium/winsys/drm/radeon/python/radeon_hardpipe_winsys.c
deleted file mode 100644
index fc63081a4c..0000000000
--- a/src/gallium/winsys/drm/radeon/python/radeon_hardpipe_winsys.c
+++ /dev/null
@@ -1,132 +0,0 @@
- /**************************************************************************
- *
- * Copyright 2009 VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <X11/X.h>
-#include <X11/Xlib.h>
-#include <drm/drm.h>
-
-#include "pipe/p_screen.h"
-#include "pipe/p_context.h"
-
-#include "st_winsys.h"
-
-#include "radeon_winsys.h"
-
-#include "xf86dri.h"
-
-
-/* XXX: Force init_gallium symbol to be linked */
-extern void init_gallium(void);
-void (*force_init_gallium_linkage)(void) = &init_gallium;
-
-
-static struct pipe_screen *
-radeon_hardpipe_screen_create(void)
-{
- Display *dpy;
- Window rootWin;
- XWindowAttributes winAttr;
- int isCapable;
- int screen;
- char *driverName;
- char *curBusID;
- unsigned magic;
- int ddxDriverMajor;
- int ddxDriverMinor;
- int ddxDriverPatch;
- drm_handle_t sAreaOffset;
- int ret;
- int drmFD;
- drm_context_t hHWContext;
- XID id;
-
- dpy = XOpenDisplay(":0");
- if (!dpy) {
- fprintf(stderr, "Open Display Failed\n");
- return NULL;
- }
-
- screen = DefaultScreen(dpy);
- rootWin = RootWindow(dpy, screen);
- XGetWindowAttributes(dpy, rootWin, &winAttr);
-
- ret = uniDRIQueryDirectRenderingCapable(dpy, screen, &isCapable);
- if (!ret || !isCapable) {
- fprintf(stderr, "No DRI on this display:sceen\n");
- goto error;
- }
-
- if (!uniDRIOpenConnection(dpy, screen, &sAreaOffset,
- &curBusID)) {
- fprintf(stderr, "Could not open DRI connection.\n");
- goto error;
- }
-
- if (!uniDRIGetClientDriverName(dpy, screen, &ddxDriverMajor,
- &ddxDriverMinor, &ddxDriverPatch,
- &driverName)) {
- fprintf(stderr, "Could not get DRI driver name.\n");
- goto error;
- }
-
- if ((drmFD = drmOpen(NULL, curBusID)) < 0) {
- perror("DRM Device could not be opened");
- goto error;
- }
-
- drmGetMagic(drmFD, &magic);
- if (!uniDRIAuthConnection(dpy, screen, magic)) {
- fprintf(stderr, "Could not get X server to authenticate us.\n");
- goto error;
- }
-
- if (!uniDRICreateContext(dpy, screen, winAttr.visual,
- &id, &hHWContext)) {
- fprintf(stderr, "Could not create DRI context.\n");
- goto error;
- }
-
- /* FIXME: create a radeon pipe_screen from drmFD and hHWContext */
-
- return NULL;
-
-error:
- return NULL;
-}
-
-
-
-
-const struct st_winsys st_hardpipe_winsys = {
- &radeon_hardpipe_screen_create,
-};
-
diff --git a/src/gallium/winsys/drm/radeon/python/xf86dri.c b/src/gallium/winsys/drm/radeon/python/xf86dri.c
deleted file mode 100644
index 1736f1e54f..0000000000
--- a/src/gallium/winsys/drm/radeon/python/xf86dri.c
+++ /dev/null
@@ -1,605 +0,0 @@
-/**************************************************************************
-
-Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-Copyright 2000 VA Linux Systems, Inc.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Jens Owen <jens@tungstengraphics.com>
- * Rickard E. (Rik) Faith <faith@valinux.com>
- *
- */
-
-/* THIS IS NOT AN X CONSORTIUM STANDARD */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#define NEED_REPLIES
-#include <X11/Xlibint.h>
-#include <X11/extensions/Xext.h>
-#include <X11/extensions/extutil.h>
-#include "xf86dristr.h"
-
-static XExtensionInfo _xf86dri_info_data;
-static XExtensionInfo *xf86dri_info = &_xf86dri_info_data;
-static char xf86dri_extension_name[] = XF86DRINAME;
-
-#define uniDRICheckExtension(dpy,i,val) \
- XextCheckExtension (dpy, i, xf86dri_extension_name, val)
-
-/*****************************************************************************
- * *
- * private utility routines *
- * *
- *****************************************************************************/
-
-static int close_display(Display * dpy, XExtCodes * extCodes);
-static /* const */ XExtensionHooks xf86dri_extension_hooks = {
- NULL, /* create_gc */
- NULL, /* copy_gc */
- NULL, /* flush_gc */
- NULL, /* free_gc */
- NULL, /* create_font */
- NULL, /* free_font */
- close_display, /* close_display */
- NULL, /* wire_to_event */
- NULL, /* event_to_wire */
- NULL, /* error */
- NULL, /* error_string */
-};
-
-static
-XEXT_GENERATE_FIND_DISPLAY(find_display, xf86dri_info,
- xf86dri_extension_name, &xf86dri_extension_hooks,
- 0, NULL)
-
- static XEXT_GENERATE_CLOSE_DISPLAY(close_display, xf86dri_info)
-
-/*****************************************************************************
- * *
- * public XFree86-DRI Extension routines *
- * *
- *****************************************************************************/
-#if 0
-#include <stdio.h>
-#define TRACE(msg) fprintf(stderr,"uniDRI%s\n", msg);
-#else
-#define TRACE(msg)
-#endif
- Bool uniDRIQueryExtension(dpy, event_basep, error_basep)
- Display *dpy;
- int *event_basep, *error_basep;
-{
- XExtDisplayInfo *info = find_display(dpy);
-
- TRACE("QueryExtension...");
- if (XextHasExtension(info)) {
- *event_basep = info->codes->first_event;
- *error_basep = info->codes->first_error;
- TRACE("QueryExtension... return True");
- return True;
- } else {
- TRACE("QueryExtension... return False");
- return False;
- }
-}
-
-Bool
-uniDRIQueryVersion(dpy, majorVersion, minorVersion, patchVersion)
- Display *dpy;
- int *majorVersion;
- int *minorVersion;
- int *patchVersion;
-{
- XExtDisplayInfo *info = find_display(dpy);
- xXF86DRIQueryVersionReply rep;
- xXF86DRIQueryVersionReq *req;
-
- TRACE("QueryVersion...");
- uniDRICheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRIQueryVersion, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRIQueryVersion;
- if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("QueryVersion... return False");
- return False;
- }
- *majorVersion = rep.majorVersion;
- *minorVersion = rep.minorVersion;
- *patchVersion = rep.patchVersion;
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("QueryVersion... return True");
- return True;
-}
-
-Bool
-uniDRIQueryDirectRenderingCapable(dpy, screen, isCapable)
- Display *dpy;
- int screen;
- Bool *isCapable;
-{
- XExtDisplayInfo *info = find_display(dpy);
- xXF86DRIQueryDirectRenderingCapableReply rep;
- xXF86DRIQueryDirectRenderingCapableReq *req;
-
- TRACE("QueryDirectRenderingCapable...");
- uniDRICheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRIQueryDirectRenderingCapable, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRIQueryDirectRenderingCapable;
- req->screen = screen;
- if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("QueryDirectRenderingCapable... return False");
- return False;
- }
- *isCapable = rep.isCapable;
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("QueryDirectRenderingCapable... return True");
- return True;
-}
-
-Bool
-uniDRIOpenConnection(dpy, screen, hSAREA, busIdString)
- Display *dpy;
- int screen;
- drm_handle_t *hSAREA;
- char **busIdString;
-{
- XExtDisplayInfo *info = find_display(dpy);
- xXF86DRIOpenConnectionReply rep;
- xXF86DRIOpenConnectionReq *req;
-
- TRACE("OpenConnection...");
- uniDRICheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRIOpenConnection, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRIOpenConnection;
- req->screen = screen;
- if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("OpenConnection... return False");
- return False;
- }
-
- *hSAREA = rep.hSAREALow;
-#ifdef LONG64
- if (sizeof(drm_handle_t) == 8) {
- *hSAREA |= ((unsigned long)rep.hSAREAHigh) << 32;
- }
-#endif
- if (rep.length) {
- if (!(*busIdString = (char *)Xcalloc(rep.busIdStringLength + 1, 1))) {
- _XEatData(dpy, ((rep.busIdStringLength + 3) & ~3));
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("OpenConnection... return False");
- return False;
- }
- _XReadPad(dpy, *busIdString, rep.busIdStringLength);
- } else {
- *busIdString = NULL;
- }
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("OpenConnection... return True");
- return True;
-}
-
-Bool
-uniDRIAuthConnection(dpy, screen, magic)
- Display *dpy;
- int screen;
- drm_magic_t magic;
-{
- XExtDisplayInfo *info = find_display(dpy);
- xXF86DRIAuthConnectionReq *req;
- xXF86DRIAuthConnectionReply rep;
-
- TRACE("AuthConnection...");
- uniDRICheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRIAuthConnection, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRIAuthConnection;
- req->screen = screen;
- req->magic = magic;
- rep.authenticated = 0;
- if (!_XReply(dpy, (xReply *) & rep, 0, xFalse) || !rep.authenticated) {
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("AuthConnection... return False");
- return False;
- }
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("AuthConnection... return True");
- return True;
-}
-
-Bool
-uniDRICloseConnection(dpy, screen)
- Display *dpy;
- int screen;
-{
- XExtDisplayInfo *info = find_display(dpy);
- xXF86DRICloseConnectionReq *req;
-
- TRACE("CloseConnection...");
-
- uniDRICheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRICloseConnection, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRICloseConnection;
- req->screen = screen;
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("CloseConnection... return True");
- return True;
-}
-
-Bool
-uniDRIGetClientDriverName(dpy, screen, ddxDriverMajorVersion,
- ddxDriverMinorVersion, ddxDriverPatchVersion,
- clientDriverName)
- Display *dpy;
- int screen;
- int *ddxDriverMajorVersion;
- int *ddxDriverMinorVersion;
- int *ddxDriverPatchVersion;
- char **clientDriverName;
-{
- XExtDisplayInfo *info = find_display(dpy);
- xXF86DRIGetClientDriverNameReply rep;
- xXF86DRIGetClientDriverNameReq *req;
-
- TRACE("GetClientDriverName...");
- uniDRICheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRIGetClientDriverName, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRIGetClientDriverName;
- req->screen = screen;
- if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("GetClientDriverName... return False");
- return False;
- }
-
- *ddxDriverMajorVersion = rep.ddxDriverMajorVersion;
- *ddxDriverMinorVersion = rep.ddxDriverMinorVersion;
- *ddxDriverPatchVersion = rep.ddxDriverPatchVersion;
-
- if (rep.length) {
- if (!(*clientDriverName =
- (char *)Xcalloc(rep.clientDriverNameLength + 1, 1))) {
- _XEatData(dpy, ((rep.clientDriverNameLength + 3) & ~3));
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("GetClientDriverName... return False");
- return False;
- }
- _XReadPad(dpy, *clientDriverName, rep.clientDriverNameLength);
- } else {
- *clientDriverName = NULL;
- }
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("GetClientDriverName... return True");
- return True;
-}
-
-Bool
-uniDRICreateContextWithConfig(dpy, screen, configID, context, hHWContext)
- Display *dpy;
- int screen;
- int configID;
- XID *context;
- drm_context_t *hHWContext;
-{
- XExtDisplayInfo *info = find_display(dpy);
- xXF86DRICreateContextReply rep;
- xXF86DRICreateContextReq *req;
-
- TRACE("CreateContext...");
- uniDRICheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRICreateContext, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRICreateContext;
- req->visual = configID;
- req->screen = screen;
- *context = XAllocID(dpy);
- req->context = *context;
- if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("CreateContext... return False");
- return False;
- }
- *hHWContext = rep.hHWContext;
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("CreateContext... return True");
- return True;
-}
-
-Bool
-uniDRICreateContext(dpy, screen, visual, context, hHWContext)
- Display *dpy;
- int screen;
- Visual *visual;
- XID *context;
- drm_context_t *hHWContext;
-{
- return uniDRICreateContextWithConfig(dpy, screen, visual->visualid,
- context, hHWContext);
-}
-
-Bool
-uniDRIDestroyContext(Display * ndpy, int screen, XID context)
-{
- Display *const dpy = (Display *) ndpy;
- XExtDisplayInfo *info = find_display(dpy);
- xXF86DRIDestroyContextReq *req;
-
- TRACE("DestroyContext...");
- uniDRICheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRIDestroyContext, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRIDestroyContext;
- req->screen = screen;
- req->context = context;
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("DestroyContext... return True");
- return True;
-}
-
-Bool
-uniDRICreateDrawable(Display * ndpy, int screen,
- Drawable drawable, drm_drawable_t * hHWDrawable)
-{
- Display *const dpy = (Display *) ndpy;
- XExtDisplayInfo *info = find_display(dpy);
- xXF86DRICreateDrawableReply rep;
- xXF86DRICreateDrawableReq *req;
-
- TRACE("CreateDrawable...");
- uniDRICheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRICreateDrawable, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRICreateDrawable;
- req->screen = screen;
- req->drawable = drawable;
- if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("CreateDrawable... return False");
- return False;
- }
- *hHWDrawable = rep.hHWDrawable;
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("CreateDrawable... return True");
- return True;
-}
-
-Bool
-uniDRIDestroyDrawable(Display * ndpy, int screen, Drawable drawable)
-{
- Display *const dpy = (Display *) ndpy;
- XExtDisplayInfo *info = find_display(dpy);
- xXF86DRIDestroyDrawableReq *req;
-
- TRACE("DestroyDrawable...");
- uniDRICheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRIDestroyDrawable, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRIDestroyDrawable;
- req->screen = screen;
- req->drawable = drawable;
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("DestroyDrawable... return True");
- return True;
-}
-
-Bool
-uniDRIGetDrawableInfo(Display * dpy, int screen, Drawable drawable,
- unsigned int *index, unsigned int *stamp,
- int *X, int *Y, int *W, int *H,
- int *numClipRects, drm_clip_rect_t ** pClipRects,
- int *backX, int *backY,
- int *numBackClipRects,
- drm_clip_rect_t ** pBackClipRects)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xXF86DRIGetDrawableInfoReply rep;
- xXF86DRIGetDrawableInfoReq *req;
- int total_rects;
-
- TRACE("GetDrawableInfo...");
- uniDRICheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRIGetDrawableInfo, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRIGetDrawableInfo;
- req->screen = screen;
- req->drawable = drawable;
-
- if (!_XReply(dpy, (xReply *) & rep, 1, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("GetDrawableInfo... return False");
- return False;
- }
- *index = rep.drawableTableIndex;
- *stamp = rep.drawableTableStamp;
- *X = (int)rep.drawableX;
- *Y = (int)rep.drawableY;
- *W = (int)rep.drawableWidth;
- *H = (int)rep.drawableHeight;
- *numClipRects = rep.numClipRects;
- total_rects = *numClipRects;
-
- *backX = rep.backX;
- *backY = rep.backY;
- *numBackClipRects = rep.numBackClipRects;
- total_rects += *numBackClipRects;
-
-#if 0
- /* Because of the fix in Xserver/GL/dri/xf86dri.c, this check breaks
- * backwards compatibility (Because of the >> 2 shift) but the fix
- * enables multi-threaded apps to work.
- */
- if (rep.length != ((((SIZEOF(xXF86DRIGetDrawableInfoReply) -
- SIZEOF(xGenericReply) +
- total_rects * sizeof(drm_clip_rect_t)) +
- 3) & ~3) >> 2)) {
- _XEatData(dpy, rep.length);
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("GetDrawableInfo... return False");
- return False;
- }
-#endif
-
- if (*numClipRects) {
- int len = sizeof(drm_clip_rect_t) * (*numClipRects);
-
- *pClipRects = (drm_clip_rect_t *) Xcalloc(len, 1);
- if (*pClipRects)
- _XRead(dpy, (char *)*pClipRects, len);
- } else {
- *pClipRects = NULL;
- }
-
- if (*numBackClipRects) {
- int len = sizeof(drm_clip_rect_t) * (*numBackClipRects);
-
- *pBackClipRects = (drm_clip_rect_t *) Xcalloc(len, 1);
- if (*pBackClipRects)
- _XRead(dpy, (char *)*pBackClipRects, len);
- } else {
- *pBackClipRects = NULL;
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("GetDrawableInfo... return True");
- return True;
-}
-
-Bool
-uniDRIGetDeviceInfo(dpy, screen, hFrameBuffer,
- fbOrigin, fbSize, fbStride, devPrivateSize, pDevPrivate)
- Display *dpy;
- int screen;
- drm_handle_t *hFrameBuffer;
- int *fbOrigin;
- int *fbSize;
- int *fbStride;
- int *devPrivateSize;
- void **pDevPrivate;
-{
- XExtDisplayInfo *info = find_display(dpy);
- xXF86DRIGetDeviceInfoReply rep;
- xXF86DRIGetDeviceInfoReq *req;
-
- TRACE("GetDeviceInfo...");
- uniDRICheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DRIGetDeviceInfo, req);
- req->reqType = info->codes->major_opcode;
- req->driReqType = X_XF86DRIGetDeviceInfo;
- req->screen = screen;
- if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("GetDeviceInfo... return False");
- return False;
- }
-
- *hFrameBuffer = rep.hFrameBufferLow;
-#ifdef LONG64
- if (sizeof(drm_handle_t) == 8) {
- *hFrameBuffer |= ((unsigned long)rep.hFrameBufferHigh) << 32;
- }
-#endif
-
- *fbOrigin = rep.framebufferOrigin;
- *fbSize = rep.framebufferSize;
- *fbStride = rep.framebufferStride;
- *devPrivateSize = rep.devPrivateSize;
-
- if (rep.length) {
- if (!(*pDevPrivate = (void *)Xcalloc(rep.devPrivateSize, 1))) {
- _XEatData(dpy, ((rep.devPrivateSize + 3) & ~3));
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("GetDeviceInfo... return False");
- return False;
- }
- _XRead(dpy, (char *)*pDevPrivate, rep.devPrivateSize);
- } else {
- *pDevPrivate = NULL;
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
- TRACE("GetDeviceInfo... return True");
- return True;
-}
diff --git a/src/gallium/winsys/drm/radeon/python/xf86dri.h b/src/gallium/winsys/drm/radeon/python/xf86dri.h
deleted file mode 100644
index bf6de37d9d..0000000000
--- a/src/gallium/winsys/drm/radeon/python/xf86dri.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/**************************************************************************
-
-Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-Copyright 2000 VA Linux Systems, Inc.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/**
- * \file xf86dri.h
- * Protocol numbers and function prototypes for DRI X protocol.
- *
- * \author Kevin E. Martin <martin@valinux.com>
- * \author Jens Owen <jens@tungstengraphics.com>
- * \author Rickard E. (Rik) Faith <faith@valinux.com>
- */
-
-#ifndef _XF86DRI_H_
-#define _XF86DRI_H_
-
-#include <stdint.h>
-#include <X11/Xfuncproto.h>
-#include <drm/drm.h>
-
-#define X_XF86DRIQueryVersion 0
-#define X_XF86DRIQueryDirectRenderingCapable 1
-#define X_XF86DRIOpenConnection 2
-#define X_XF86DRICloseConnection 3
-#define X_XF86DRIGetClientDriverName 4
-#define X_XF86DRICreateContext 5
-#define X_XF86DRIDestroyContext 6
-#define X_XF86DRICreateDrawable 7
-#define X_XF86DRIDestroyDrawable 8
-#define X_XF86DRIGetDrawableInfo 9
-#define X_XF86DRIGetDeviceInfo 10
-#define X_XF86DRIAuthConnection 11
-#define X_XF86DRIOpenFullScreen 12 /* Deprecated */
-#define X_XF86DRICloseFullScreen 13 /* Deprecated */
-
-#define XF86DRINumberEvents 0
-
-#define XF86DRIClientNotLocal 0
-#define XF86DRIOperationNotSupported 1
-#define XF86DRINumberErrors (XF86DRIOperationNotSupported + 1)
-
-#ifndef _XF86DRI_SERVER_
-
-_XFUNCPROTOBEGIN
- Bool uniDRIQueryExtension(Display * dpy, int *event_base,
- int *error_base);
-
-Bool uniDRIQueryVersion(Display * dpy, int *majorVersion, int *minorVersion,
- int *patchVersion);
-
-Bool uniDRIQueryDirectRenderingCapable(Display * dpy, int screen,
- Bool * isCapable);
-
-Bool uniDRIOpenConnection(Display * dpy, int screen, drm_handle_t * hSAREA,
- char **busIDString);
-
-Bool uniDRIAuthConnection(Display * dpy, int screen, drm_magic_t magic);
-
-Bool uniDRICloseConnection(Display * dpy, int screen);
-
-Bool uniDRIGetClientDriverName(Display * dpy, int screen,
- int *ddxDriverMajorVersion,
- int *ddxDriverMinorVersion,
- int *ddxDriverPatchVersion,
- char **clientDriverName);
-
-Bool uniDRICreateContext(Display * dpy, int screen, Visual * visual,
- XID * ptr_to_returned_context_id,
- drm_context_t * hHWContext);
-
-Bool uniDRICreateContextWithConfig(Display * dpy, int screen, int configID,
- XID * ptr_to_returned_context_id,
- drm_context_t * hHWContext);
-
-extern Bool uniDRIDestroyContext(Display * dpy, int screen, XID context_id);
-
-extern Bool uniDRICreateDrawable(Display * dpy, int screen,
- Drawable drawable,
- drm_drawable_t * hHWDrawable);
-
-extern Bool uniDRIDestroyDrawable(Display * dpy, int screen,
- Drawable drawable);
-
-Bool uniDRIGetDrawableInfo(Display * dpy, int screen, Drawable drawable,
- unsigned int *index, unsigned int *stamp,
- int *X, int *Y, int *W, int *H,
- int *numClipRects, drm_clip_rect_t ** pClipRects,
- int *backX, int *backY,
- int *numBackClipRects,
- drm_clip_rect_t ** pBackClipRects);
-
-Bool uniDRIGetDeviceInfo(Display * dpy, int screen,
- drm_handle_t * hFrameBuffer, int *fbOrigin,
- int *fbSize, int *fbStride, int *devPrivateSize,
- void **pDevPrivate);
-
-_XFUNCPROTOEND
-#endif /* _XF86DRI_SERVER_ */
-#endif /* _XF86DRI_H_ */
diff --git a/src/gallium/winsys/drm/radeon/python/xf86dristr.h b/src/gallium/winsys/drm/radeon/python/xf86dristr.h
deleted file mode 100644
index d898996360..0000000000
--- a/src/gallium/winsys/drm/radeon/python/xf86dristr.h
+++ /dev/null
@@ -1,389 +0,0 @@
-/**************************************************************************
-
-Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-Copyright 2000 VA Linux Systems, Inc.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Jens Owen <jens@tungstengraphics.com>
- * Rickard E. (Rik) Fiath <faith@valinux.com>
- *
- */
-
-#ifndef _XF86DRISTR_H_
-#define _XF86DRISTR_H_
-
-#include "xf86dri.h"
-
-#define XF86DRINAME "XFree86-DRI"
-
-/* The DRI version number. This was originally set to be the same of the
- * XFree86 version number. However, this version is really indepedent of
- * the XFree86 version.
- *
- * Version History:
- * 4.0.0: Original
- * 4.0.1: Patch to bump clipstamp when windows are destroyed, 28 May 02
- * 4.1.0: Add transition from single to multi in DRMInfo rec, 24 Jun 02
- */
-#define XF86DRI_MAJOR_VERSION 4
-#define XF86DRI_MINOR_VERSION 1
-#define XF86DRI_PATCH_VERSION 0
-
-typedef struct _XF86DRIQueryVersion
-{
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRIQueryVersion */
- CARD16 length B16;
-} xXF86DRIQueryVersionReq;
-
-#define sz_xXF86DRIQueryVersionReq 4
-
-typedef struct
-{
- BYTE type; /* X_Reply */
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD16 majorVersion B16; /* major version of DRI protocol */
- CARD16 minorVersion B16; /* minor version of DRI protocol */
- CARD32 patchVersion B32; /* patch version of DRI protocol */
- CARD32 pad3 B32;
- CARD32 pad4 B32;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
-} xXF86DRIQueryVersionReply;
-
-#define sz_xXF86DRIQueryVersionReply 32
-
-typedef struct _XF86DRIQueryDirectRenderingCapable
-{
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* X_DRIQueryDirectRenderingCapable */
- CARD16 length B16;
- CARD32 screen B32;
-} xXF86DRIQueryDirectRenderingCapableReq;
-
-#define sz_xXF86DRIQueryDirectRenderingCapableReq 8
-
-typedef struct
-{
- BYTE type; /* X_Reply */
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- BOOL isCapable;
- BOOL pad2;
- BOOL pad3;
- BOOL pad4;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
- CARD32 pad7 B32;
- CARD32 pad8 B32;
- CARD32 pad9 B32;
-} xXF86DRIQueryDirectRenderingCapableReply;
-
-#define sz_xXF86DRIQueryDirectRenderingCapableReply 32
-
-typedef struct _XF86DRIOpenConnection
-{
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRIOpenConnection */
- CARD16 length B16;
- CARD32 screen B32;
-} xXF86DRIOpenConnectionReq;
-
-#define sz_xXF86DRIOpenConnectionReq 8
-
-typedef struct
-{
- BYTE type; /* X_Reply */
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 hSAREALow B32;
- CARD32 hSAREAHigh B32;
- CARD32 busIdStringLength B32;
- CARD32 pad6 B32;
- CARD32 pad7 B32;
- CARD32 pad8 B32;
-} xXF86DRIOpenConnectionReply;
-
-#define sz_xXF86DRIOpenConnectionReply 32
-
-typedef struct _XF86DRIAuthConnection
-{
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRICloseConnection */
- CARD16 length B16;
- CARD32 screen B32;
- CARD32 magic B32;
-} xXF86DRIAuthConnectionReq;
-
-#define sz_xXF86DRIAuthConnectionReq 12
-
-typedef struct
-{
- BYTE type;
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 authenticated B32;
- CARD32 pad2 B32;
- CARD32 pad3 B32;
- CARD32 pad4 B32;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
-} xXF86DRIAuthConnectionReply;
-
-#define zx_xXF86DRIAuthConnectionReply 32
-
-typedef struct _XF86DRICloseConnection
-{
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRICloseConnection */
- CARD16 length B16;
- CARD32 screen B32;
-} xXF86DRICloseConnectionReq;
-
-#define sz_xXF86DRICloseConnectionReq 8
-
-typedef struct _XF86DRIGetClientDriverName
-{
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRIGetClientDriverName */
- CARD16 length B16;
- CARD32 screen B32;
-} xXF86DRIGetClientDriverNameReq;
-
-#define sz_xXF86DRIGetClientDriverNameReq 8
-
-typedef struct
-{
- BYTE type; /* X_Reply */
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 ddxDriverMajorVersion B32;
- CARD32 ddxDriverMinorVersion B32;
- CARD32 ddxDriverPatchVersion B32;
- CARD32 clientDriverNameLength B32;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
-} xXF86DRIGetClientDriverNameReply;
-
-#define sz_xXF86DRIGetClientDriverNameReply 32
-
-typedef struct _XF86DRICreateContext
-{
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRICreateContext */
- CARD16 length B16;
- CARD32 screen B32;
- CARD32 visual B32;
- CARD32 context B32;
-} xXF86DRICreateContextReq;
-
-#define sz_xXF86DRICreateContextReq 16
-
-typedef struct
-{
- BYTE type; /* X_Reply */
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 hHWContext B32;
- CARD32 pad2 B32;
- CARD32 pad3 B32;
- CARD32 pad4 B32;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
-} xXF86DRICreateContextReply;
-
-#define sz_xXF86DRICreateContextReply 32
-
-typedef struct _XF86DRIDestroyContext
-{
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRIDestroyContext */
- CARD16 length B16;
- CARD32 screen B32;
- CARD32 context B32;
-} xXF86DRIDestroyContextReq;
-
-#define sz_xXF86DRIDestroyContextReq 12
-
-typedef struct _XF86DRICreateDrawable
-{
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRICreateDrawable */
- CARD16 length B16;
- CARD32 screen B32;
- CARD32 drawable B32;
-} xXF86DRICreateDrawableReq;
-
-#define sz_xXF86DRICreateDrawableReq 12
-
-typedef struct
-{
- BYTE type; /* X_Reply */
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 hHWDrawable B32;
- CARD32 pad2 B32;
- CARD32 pad3 B32;
- CARD32 pad4 B32;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
-} xXF86DRICreateDrawableReply;
-
-#define sz_xXF86DRICreateDrawableReply 32
-
-typedef struct _XF86DRIDestroyDrawable
-{
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRIDestroyDrawable */
- CARD16 length B16;
- CARD32 screen B32;
- CARD32 drawable B32;
-} xXF86DRIDestroyDrawableReq;
-
-#define sz_xXF86DRIDestroyDrawableReq 12
-
-typedef struct _XF86DRIGetDrawableInfo
-{
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRIGetDrawableInfo */
- CARD16 length B16;
- CARD32 screen B32;
- CARD32 drawable B32;
-} xXF86DRIGetDrawableInfoReq;
-
-#define sz_xXF86DRIGetDrawableInfoReq 12
-
-typedef struct
-{
- BYTE type; /* X_Reply */
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 drawableTableIndex B32;
- CARD32 drawableTableStamp B32;
- INT16 drawableX B16;
- INT16 drawableY B16;
- INT16 drawableWidth B16;
- INT16 drawableHeight B16;
- CARD32 numClipRects B32;
- INT16 backX B16;
- INT16 backY B16;
- CARD32 numBackClipRects B32;
-} xXF86DRIGetDrawableInfoReply;
-
-#define sz_xXF86DRIGetDrawableInfoReply 36
-
-typedef struct _XF86DRIGetDeviceInfo
-{
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRIGetDeviceInfo */
- CARD16 length B16;
- CARD32 screen B32;
-} xXF86DRIGetDeviceInfoReq;
-
-#define sz_xXF86DRIGetDeviceInfoReq 8
-
-typedef struct
-{
- BYTE type; /* X_Reply */
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 hFrameBufferLow B32;
- CARD32 hFrameBufferHigh B32;
- CARD32 framebufferOrigin B32;
- CARD32 framebufferSize B32;
- CARD32 framebufferStride B32;
- CARD32 devPrivateSize B32;
-} xXF86DRIGetDeviceInfoReply;
-
-#define sz_xXF86DRIGetDeviceInfoReply 32
-
-typedef struct _XF86DRIOpenFullScreen
-{
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRIOpenFullScreen */
- CARD16 length B16;
- CARD32 screen B32;
- CARD32 drawable B32;
-} xXF86DRIOpenFullScreenReq;
-
-#define sz_xXF86DRIOpenFullScreenReq 12
-
-typedef struct
-{
- BYTE type;
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 isFullScreen B32;
- CARD32 pad2 B32;
- CARD32 pad3 B32;
- CARD32 pad4 B32;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
-} xXF86DRIOpenFullScreenReply;
-
-#define sz_xXF86DRIOpenFullScreenReply 32
-
-typedef struct _XF86DRICloseFullScreen
-{
- CARD8 reqType; /* always DRIReqCode */
- CARD8 driReqType; /* always X_DRICloseFullScreen */
- CARD16 length B16;
- CARD32 screen B32;
- CARD32 drawable B32;
-} xXF86DRICloseFullScreenReq;
-
-#define sz_xXF86DRICloseFullScreenReq 12
-
-typedef struct
-{
- BYTE type;
- BOOL pad1;
- CARD16 sequenceNumber B16;
- CARD32 length B32;
- CARD32 pad2 B32;
- CARD32 pad3 B32;
- CARD32 pad4 B32;
- CARD32 pad5 B32;
- CARD32 pad6 B32;
- CARD32 pad7 B32;
-} xXF86DRICloseFullScreenReply;
-
-#define sz_xXF86DRICloseFullScreenReply 32
-
-#endif /* _XF86DRISTR_H_ */
diff --git a/src/gallium/winsys/drm/swrast/Makefile b/src/gallium/winsys/drm/swrast/Makefile
deleted file mode 100644
index 363b89584f..0000000000
--- a/src/gallium/winsys/drm/swrast/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-# src/gallium/winsys/drm/swrast/Makefile
-TOP = ../../../../..
-include $(TOP)/configs/current
-
-SUBDIRS = core $(GALLIUM_STATE_TRACKERS_DIRS)
-
-default install clean:
- @for dir in $(SUBDIRS) ; do \
- if [ -d $$dir ] ; then \
- (cd $$dir && $(MAKE) $@) || exit 1; \
- fi \
- done
diff --git a/src/gallium/winsys/drm/swrast/core/Makefile b/src/gallium/winsys/drm/swrast/core/Makefile
deleted file mode 100644
index 93931ae22b..0000000000
--- a/src/gallium/winsys/drm/swrast/core/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-# src/gallium/winsys/drm/swrast/core/Makefile
-
-TOP = ../../../../../..
-include $(TOP)/configs/current
-
-LIBNAME = swrastdrm
-
-C_SOURCES = swrast_drm_api.c
-
-include ../../../../Makefile.template
diff --git a/src/gallium/winsys/drm/swrast/egl/Makefile b/src/gallium/winsys/drm/swrast/egl/Makefile
deleted file mode 100644
index 26fe2d2805..0000000000
--- a/src/gallium/winsys/drm/swrast/egl/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-TOP = ../../../../../..
-include $(TOP)/configs/current
-
-EGL_DRIVER_NAME = swrast
-EGL_DRIVER_SOURCES = dummy.c
-EGL_DRIVER_LIBS =
-
-EGL_DRIVER_PIPES = \
- $(TOP)/src/gallium/winsys/drm/swrast/core/libswrastdrm.a \
- $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a
-
-include ../../Makefile.egl
diff --git a/src/gallium/winsys/drm/vmware/Makefile b/src/gallium/winsys/drm/vmware/Makefile
deleted file mode 100644
index 2ae6dead5c..0000000000
--- a/src/gallium/winsys/drm/vmware/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-# src/gallium/winsys/drm/vmware/Makefile
-TOP = ../../../../..
-include $(TOP)/configs/current
-
-SUBDIRS = core $(GALLIUM_STATE_TRACKERS_DIRS)
-
-default install clean:
- @for dir in $(SUBDIRS) ; do \
- if [ -d $$dir ] ; then \
- (cd $$dir && $(MAKE) $@) || exit 1; \
- fi \
- done
diff --git a/src/gallium/winsys/drm/vmware/SConscript b/src/gallium/winsys/drm/vmware/SConscript
deleted file mode 100644
index 06e6d5be9c..0000000000
--- a/src/gallium/winsys/drm/vmware/SConscript
+++ /dev/null
@@ -1,11 +0,0 @@
-Import('*')
-
-SConscript(['core/SConscript',])
-
-if 'mesa' in env['statetrackers']:
-
- SConscript(['dri/SConscript'])
-
-if 'xorg' in env['statetrackers']:
-
- SConscript(['xorg/SConscript'])
diff --git a/src/gallium/winsys/drm/vmware/dri/SConscript b/src/gallium/winsys/drm/vmware/dri/SConscript
deleted file mode 100644
index d26d0cd748..0000000000
--- a/src/gallium/winsys/drm/vmware/dri/SConscript
+++ /dev/null
@@ -1,63 +0,0 @@
-import os
-import os.path
-
-Import('*')
-
-if env['platform'] == 'linux':
-
- if env['dri']:
- env = env.Clone()
-
- sources = [
- '#/src/mesa/drivers/dri/common/utils.c',
- '#/src/mesa/drivers/dri/common/vblank.c',
- '#/src/mesa/drivers/dri/common/dri_util.c',
- '#/src/mesa/drivers/dri/common/xmlconfig.c',
- ]
-
-
- env.ParseConfig('pkg-config --cflags --libs libdrm')
-
- env.Prepend(CPPPATH = [
- '#/src/mesa/state_tracker',
- '#/src/mesa/drivers/dri/common',
- '#/src/mesa/main',
- '#/src/mesa/glapi',
- '#/src/mesa',
- '#/include',
- '#/src/gallium/drivers/svga',
- '#/src/gallium/drivers/svga/include',
- ])
-
- env.Append(CPPDEFINES = [
- 'HAVE_STDINT_H',
- 'HAVE_SYS_TYPES_H',
- ])
-
- env.Append(CFLAGS = [
- '-std=gnu99',
- '-D_FILE_OFFSET_BITS=64',
- ])
-
- env.Prepend(LIBPATH = [
- ])
-
- env.Prepend(LIBS = [
- trace,
- st_dri,
- svgadrm,
- svga,
- mesa,
- glsl,
- gallium,
- ])
-
- # TODO: write a wrapper function http://www.scons.org/wiki/WrapperFunctions
- env.LoadableModule(
- target ='vmwgfx_dri.so',
- source = sources,
- LIBS = env['LIBS'],
- SHLIBPREFIX = '',
- )
-
-
diff --git a/src/gallium/winsys/drm/vmware/egl/dummy.c b/src/gallium/winsys/drm/vmware/egl/dummy.c
deleted file mode 100644
index 3181d0ba7e..0000000000
--- a/src/gallium/winsys/drm/vmware/egl/dummy.c
+++ /dev/null
@@ -1,3 +0,0 @@
-/* A poor man's --whole-archive for EGL drivers */
-void *_eglMain(void *);
-void *_eglWholeArchive = (void *) _eglMain;
diff --git a/src/gallium/winsys/gdi/gdi_softpipe_winsys.c b/src/gallium/winsys/gdi/gdi_softpipe_winsys.c
deleted file mode 100644
index 71360e55aa..0000000000
--- a/src/gallium/winsys/gdi/gdi_softpipe_winsys.c
+++ /dev/null
@@ -1,318 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2008 Tungsten Graphics, Inc., Bismarck, ND., USA
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- *
- **************************************************************************/
-
-/**
- * @file
- * Softpipe support.
- *
- * @author Keith Whitwell
- * @author Brian Paul
- * @author Jose Fonseca
- */
-
-
-#include <windows.h>
-
-#include "util/u_simple_screen.h"
-#include "pipe/p_format.h"
-#include "pipe/p_context.h"
-#include "util/u_inlines.h"
-#include "util/u_format.h"
-#include "util/u_math.h"
-#include "util/u_memory.h"
-#include "softpipe/sp_winsys.h"
-#include "softpipe/sp_texture.h"
-#include "stw_winsys.h"
-
-
-struct gdi_softpipe_buffer
-{
- struct pipe_buffer base;
- boolean userBuffer; /** Is this a user-space buffer? */
- void *data;
- void *mapped;
-};
-
-
-/** Cast wrapper */
-static INLINE struct gdi_softpipe_buffer *
-gdi_softpipe_buffer( struct pipe_buffer *buf )
-{
- return (struct gdi_softpipe_buffer *)buf;
-}
-
-
-static void *
-gdi_softpipe_buffer_map(struct pipe_winsys *winsys,
- struct pipe_buffer *buf,
- unsigned flags)
-{
- struct gdi_softpipe_buffer *gdi_softpipe_buf = gdi_softpipe_buffer(buf);
- gdi_softpipe_buf->mapped = gdi_softpipe_buf->data;
- return gdi_softpipe_buf->mapped;
-}
-
-
-static void
-gdi_softpipe_buffer_unmap(struct pipe_winsys *winsys,
- struct pipe_buffer *buf)
-{
- struct gdi_softpipe_buffer *gdi_softpipe_buf = gdi_softpipe_buffer(buf);
- gdi_softpipe_buf->mapped = NULL;
-}
-
-
-static void
-gdi_softpipe_buffer_destroy(struct pipe_buffer *buf)
-{
- struct gdi_softpipe_buffer *oldBuf = gdi_softpipe_buffer(buf);
-
- if (oldBuf->data) {
- if (!oldBuf->userBuffer)
- align_free(oldBuf->data);
-
- oldBuf->data = NULL;
- }
-
- FREE(oldBuf);
-}
-
-
-static const char *
-gdi_softpipe_get_name(struct pipe_winsys *winsys)
-{
- return "softpipe";
-}
-
-
-static struct pipe_buffer *
-gdi_softpipe_buffer_create(struct pipe_winsys *winsys,
- unsigned alignment,
- unsigned usage,
- unsigned size)
-{
- struct gdi_softpipe_buffer *buffer = CALLOC_STRUCT(gdi_softpipe_buffer);
-
- pipe_reference_init(&buffer->base.reference, 1);
- buffer->base.alignment = alignment;
- buffer->base.usage = usage;
- buffer->base.size = size;
-
- buffer->data = align_malloc(size, alignment);
-
- return &buffer->base;
-}
-
-
-/**
- * Create buffer which wraps user-space data.
- */
-static struct pipe_buffer *
-gdi_softpipe_user_buffer_create(struct pipe_winsys *winsys,
- void *ptr,
- unsigned bytes)
-{
- struct gdi_softpipe_buffer *buffer;
-
- buffer = CALLOC_STRUCT(gdi_softpipe_buffer);
- if(!buffer)
- return NULL;
-
- pipe_reference_init(&buffer->base.reference, 1);
- buffer->base.size = bytes;
- buffer->userBuffer = TRUE;
- buffer->data = ptr;
-
- return &buffer->base;
-}
-
-
-static struct pipe_buffer *
-gdi_softpipe_surface_buffer_create(struct pipe_winsys *winsys,
- unsigned width, unsigned height,
- enum pipe_format format,
- unsigned usage,
- unsigned tex_usage,
- unsigned *stride)
-{
- const unsigned alignment = 64;
- unsigned nblocksy;
-
- nblocksy = util_format_get_nblocksy(format, height);
- *stride = align(util_format_get_stride(format, width), alignment);
-
- return winsys->buffer_create(winsys, alignment,
- usage,
- *stride * nblocksy);
-}
-
-
-static void
-gdi_softpipe_dummy_flush_frontbuffer(struct pipe_winsys *winsys,
- struct pipe_surface *surface,
- void *context_private)
-{
- assert(0);
-}
-
-
-static void
-gdi_softpipe_fence_reference(struct pipe_winsys *winsys,
- struct pipe_fence_handle **ptr,
- struct pipe_fence_handle *fence)
-{
-}
-
-
-static int
-gdi_softpipe_fence_signalled(struct pipe_winsys *winsys,
- struct pipe_fence_handle *fence,
- unsigned flag)
-{
- return 0;
-}
-
-
-static int
-gdi_softpipe_fence_finish(struct pipe_winsys *winsys,
- struct pipe_fence_handle *fence,
- unsigned flag)
-{
- return 0;
-}
-
-
-static void
-gdi_softpipe_destroy(struct pipe_winsys *winsys)
-{
- FREE(winsys);
-}
-
-
-static struct pipe_screen *
-gdi_softpipe_screen_create(void)
-{
- static struct pipe_winsys *winsys;
- struct pipe_screen *screen;
-
- winsys = CALLOC_STRUCT(pipe_winsys);
- if(!winsys)
- return NULL;
-
- winsys->destroy = gdi_softpipe_destroy;
-
- winsys->buffer_create = gdi_softpipe_buffer_create;
- winsys->user_buffer_create = gdi_softpipe_user_buffer_create;
- winsys->buffer_map = gdi_softpipe_buffer_map;
- winsys->buffer_unmap = gdi_softpipe_buffer_unmap;
- winsys->buffer_destroy = gdi_softpipe_buffer_destroy;
-
- winsys->surface_buffer_create = gdi_softpipe_surface_buffer_create;
-
- winsys->fence_reference = gdi_softpipe_fence_reference;
- winsys->fence_signalled = gdi_softpipe_fence_signalled;
- winsys->fence_finish = gdi_softpipe_fence_finish;
-
- winsys->flush_frontbuffer = gdi_softpipe_dummy_flush_frontbuffer;
- winsys->get_name = gdi_softpipe_get_name;
-
- screen = softpipe_create_screen(winsys);
- if(!screen)
- gdi_softpipe_destroy(winsys);
-
- return screen;
-}
-
-
-static void
-gdi_softpipe_present(struct pipe_screen *screen,
- struct pipe_surface *surface,
- HDC hDC)
-{
- struct softpipe_texture *texture;
- struct gdi_softpipe_buffer *buffer;
- BITMAPINFO bmi;
-
- texture = softpipe_texture(surface->texture);
-
- buffer = gdi_softpipe_buffer(texture->buffer);
-
- memset(&bmi, 0, sizeof(BITMAPINFO));
- bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
- bmi.bmiHeader.biWidth = texture->stride[surface->level] / util_format_get_blocksize(surface->format);
- bmi.bmiHeader.biHeight= -(long)surface->height;
- bmi.bmiHeader.biPlanes = 1;
- bmi.bmiHeader.biBitCount = util_format_get_blocksizebits(surface->format);
- bmi.bmiHeader.biCompression = BI_RGB;
- bmi.bmiHeader.biSizeImage = 0;
- bmi.bmiHeader.biXPelsPerMeter = 0;
- bmi.bmiHeader.biYPelsPerMeter = 0;
- bmi.bmiHeader.biClrUsed = 0;
- bmi.bmiHeader.biClrImportant = 0;
-
- StretchDIBits(hDC,
- 0, 0, surface->width, surface->height,
- 0, 0, surface->width, surface->height,
- buffer->data, &bmi, 0, SRCCOPY);
-}
-
-
-static const struct stw_winsys stw_winsys = {
- &gdi_softpipe_screen_create,
- &gdi_softpipe_present,
- NULL, /* get_adapter_luid */
- NULL, /* shared_surface_open */
- NULL, /* shared_surface_close */
- NULL /* compose */
-};
-
-
-BOOL WINAPI
-DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
-{
- switch (fdwReason) {
- case DLL_PROCESS_ATTACH:
- stw_init(&stw_winsys);
- stw_init_thread();
- break;
-
- case DLL_THREAD_ATTACH:
- stw_init_thread();
- break;
-
- case DLL_THREAD_DETACH:
- stw_cleanup_thread();
- break;
-
- case DLL_PROCESS_DETACH:
- stw_cleanup_thread();
- stw_cleanup();
- break;
- }
- return TRUE;
-}
diff --git a/src/gallium/winsys/drm/intel/gem/Makefile b/src/gallium/winsys/i915/drm/Makefile
index 0d6d4e37db..a67b9e8a52 100644
--- a/src/gallium/winsys/drm/intel/gem/Makefile
+++ b/src/gallium/winsys/i915/drm/Makefile
@@ -1,16 +1,16 @@
-TOP = ../../../../../..
+TOP = ../../../../..
include $(TOP)/configs/current
-LIBNAME = inteldrm
+LIBNAME = i915drm
C_SOURCES = \
- intel_drm_batchbuffer.c \
- intel_drm_buffer.c \
- intel_drm_fence.c \
- intel_drm_api.c
+ i915_drm_batchbuffer.c \
+ i915_drm_buffer.c \
+ i915_drm_fence.c \
+ i915_drm_api.c
LIBRARY_INCLUDES = $(shell pkg-config libdrm --cflags-only-I)
LIBRARY_DEFINES = $(shell pkg-config libdrm --cflags-only-other)
-include ../../../../Makefile.template
+include ../../../Makefile.template
diff --git a/src/gallium/winsys/i915/drm/SConscript b/src/gallium/winsys/i915/drm/SConscript
new file mode 100644
index 0000000000..ba29ac72fe
--- /dev/null
+++ b/src/gallium/winsys/i915/drm/SConscript
@@ -0,0 +1,17 @@
+Import('*')
+
+env = env.Clone()
+
+i915drm_sources = [
+ 'i915_drm_api.c',
+ 'i915_drm_batchbuffer.c',
+ 'i915_drm_buffer.c',
+ 'i915_drm_fence.c',
+]
+
+i915drm = env.ConvenienceLibrary(
+ target ='i915drm',
+ source = i915drm_sources,
+)
+
+Export('i915drm')
diff --git a/src/gallium/winsys/i915/drm/i915_drm_api.c b/src/gallium/winsys/i915/drm/i915_drm_api.c
new file mode 100644
index 0000000000..6bb0aec1a6
--- /dev/null
+++ b/src/gallium/winsys/i915/drm/i915_drm_api.c
@@ -0,0 +1,109 @@
+#include <stdio.h>
+
+#include "state_tracker/drm_api.h"
+
+#include "i915_drm_winsys.h"
+#include "util/u_memory.h"
+
+#include "i915/i915_context.h"
+#include "i915/i915_screen.h"
+
+#include "trace/tr_drm.h"
+
+/*
+ * Helper functions
+ */
+
+
+static void
+i915_drm_get_device_id(unsigned int *device_id)
+{
+ char path[512];
+ FILE *file;
+ void *shutup_gcc;
+
+ /*
+ * FIXME: Fix this up to use a drm ioctl or whatever.
+ */
+
+ snprintf(path, sizeof(path), "/sys/class/drm/card0/device/device");
+ file = fopen(path, "r");
+ if (!file) {
+ return;
+ }
+
+ shutup_gcc = fgets(path, sizeof(path), file);
+ (void) shutup_gcc;
+ sscanf(path, "%x", device_id);
+ fclose(file);
+}
+
+static void
+i915_drm_winsys_destroy(struct i915_winsys *iws)
+{
+ struct i915_drm_winsys *idws = i915_drm_winsys(iws);
+
+ drm_intel_bufmgr_destroy(idws->pools.gem);
+
+ FREE(idws);
+}
+
+static struct pipe_screen *
+i915_drm_create_screen(struct drm_api *api, int drmFD,
+ struct drm_create_screen_arg *arg)
+{
+ struct i915_drm_winsys *idws;
+ unsigned int deviceID;
+
+ if (arg != NULL) {
+ switch(arg->mode) {
+ case DRM_CREATE_NORMAL:
+ break;
+ default:
+ return NULL;
+ }
+ }
+
+ idws = CALLOC_STRUCT(i915_drm_winsys);
+ if (!idws)
+ return NULL;
+
+ i915_drm_get_device_id(&deviceID);
+
+ i915_drm_winsys_init_batchbuffer_functions(idws);
+ i915_drm_winsys_init_buffer_functions(idws);
+ i915_drm_winsys_init_fence_functions(idws);
+
+ idws->fd = drmFD;
+ idws->id = deviceID;
+ idws->max_batch_size = 16 * 4096;
+
+ idws->base.destroy = i915_drm_winsys_destroy;
+
+ idws->pools.gem = drm_intel_bufmgr_gem_init(idws->fd, idws->max_batch_size);
+ drm_intel_bufmgr_gem_enable_reuse(idws->pools.gem);
+
+ idws->dump_cmd = debug_get_bool_option("INTEL_DUMP_CMD", FALSE);
+
+ return i915_create_screen(&idws->base, deviceID);
+}
+
+static void
+destroy(struct drm_api *api)
+{
+
+}
+
+struct drm_api intel_drm_api =
+{
+ .name = "i915",
+ .driver_name = "i915",
+ .create_screen = i915_drm_create_screen,
+ .destroy = destroy,
+};
+
+struct drm_api *
+drm_api_create()
+{
+ return trace_drm_create(&intel_drm_api);
+}
diff --git a/src/gallium/winsys/drm/intel/gem/intel_drm_batchbuffer.c b/src/gallium/winsys/i915/drm/i915_drm_batchbuffer.c
index 5b4dafc8e4..102f59dc54 100644
--- a/src/gallium/winsys/drm/intel/gem/intel_drm_batchbuffer.c
+++ b/src/gallium/winsys/i915/drm/i915_drm_batchbuffer.c
@@ -1,5 +1,5 @@
-#include "intel_drm_winsys.h"
+#include "i915_drm_winsys.h"
#include "util/u_memory.h"
#include "i915_drm.h"
@@ -17,25 +17,25 @@
#undef INTEL_MAP_GTT
#define INTEL_ALWAYS_FLUSH
-struct intel_drm_batchbuffer
+struct i915_drm_batchbuffer
{
- struct intel_batchbuffer base;
+ struct i915_winsys_batchbuffer base;
size_t actual_size;
drm_intel_bo *bo;
};
-static INLINE struct intel_drm_batchbuffer *
-intel_drm_batchbuffer(struct intel_batchbuffer *batch)
+static INLINE struct i915_drm_batchbuffer *
+i915_drm_batchbuffer(struct i915_winsys_batchbuffer *batch)
{
- return (struct intel_drm_batchbuffer *)batch;
+ return (struct i915_drm_batchbuffer *)batch;
}
static void
-intel_drm_batchbuffer_reset(struct intel_drm_batchbuffer *batch)
+i915_drm_batchbuffer_reset(struct i915_drm_batchbuffer *batch)
{
- struct intel_drm_winsys *idws = intel_drm_winsys(batch->base.iws);
+ struct i915_drm_winsys *idws = i915_drm_winsys(batch->base.iws);
int ret;
if (batch->bo)
@@ -63,11 +63,11 @@ intel_drm_batchbuffer_reset(struct intel_drm_batchbuffer *batch)
batch->base.relocs = 0;
}
-static struct intel_batchbuffer *
-intel_drm_batchbuffer_create(struct intel_winsys *iws)
+static struct i915_winsys_batchbuffer *
+i915_drm_batchbuffer_create(struct i915_winsys *iws)
{
- struct intel_drm_winsys *idws = intel_drm_winsys(iws);
- struct intel_drm_batchbuffer *batch = CALLOC_STRUCT(intel_drm_batchbuffer);
+ struct i915_drm_winsys *idws = i915_drm_winsys(iws);
+ struct i915_drm_batchbuffer *batch = CALLOC_STRUCT(i915_drm_batchbuffer);
batch->actual_size = idws->max_batch_size;
@@ -84,18 +84,18 @@ intel_drm_batchbuffer_create(struct intel_winsys *iws)
batch->base.iws = iws;
- intel_drm_batchbuffer_reset(batch);
+ i915_drm_batchbuffer_reset(batch);
return &batch->base;
}
static int
-intel_drm_batchbuffer_reloc(struct intel_batchbuffer *ibatch,
- struct intel_buffer *buffer,
- enum intel_buffer_usage usage,
+i915_drm_batchbuffer_reloc(struct i915_winsys_batchbuffer *ibatch,
+ struct i915_winsys_buffer *buffer,
+ enum i915_winsys_buffer_usage usage,
unsigned pre_add)
{
- struct intel_drm_batchbuffer *batch = intel_drm_batchbuffer(ibatch);
+ struct i915_drm_batchbuffer *batch = i915_drm_batchbuffer(ibatch);
unsigned write_domain = 0;
unsigned read_domain = 0;
unsigned offset;
@@ -103,23 +103,23 @@ intel_drm_batchbuffer_reloc(struct intel_batchbuffer *ibatch,
assert(batch->base.relocs < batch->base.max_relocs);
- if (usage == INTEL_USAGE_SAMPLER) {
+ if (usage == I915_USAGE_SAMPLER) {
write_domain = 0;
read_domain = I915_GEM_DOMAIN_SAMPLER;
- } else if (usage == INTEL_USAGE_RENDER) {
+ } else if (usage == I915_USAGE_RENDER) {
write_domain = I915_GEM_DOMAIN_RENDER;
read_domain = I915_GEM_DOMAIN_RENDER;
- } else if (usage == INTEL_USAGE_2D_TARGET) {
+ } else if (usage == I915_USAGE_2D_TARGET) {
write_domain = I915_GEM_DOMAIN_RENDER;
read_domain = I915_GEM_DOMAIN_RENDER;
- } else if (usage == INTEL_USAGE_2D_SOURCE) {
+ } else if (usage == I915_USAGE_2D_SOURCE) {
write_domain = 0;
read_domain = I915_GEM_DOMAIN_RENDER;
- } else if (usage == INTEL_USAGE_VERTEX) {
+ } else if (usage == I915_USAGE_VERTEX) {
write_domain = 0;
read_domain = I915_GEM_DOMAIN_VERTEX;
@@ -145,15 +145,15 @@ intel_drm_batchbuffer_reloc(struct intel_batchbuffer *ibatch,
}
static void
-intel_drm_batchbuffer_flush(struct intel_batchbuffer *ibatch,
+i915_drm_batchbuffer_flush(struct i915_winsys_batchbuffer *ibatch,
struct pipe_fence_handle **fence)
{
- struct intel_drm_batchbuffer *batch = intel_drm_batchbuffer(ibatch);
+ struct i915_drm_batchbuffer *batch = i915_drm_batchbuffer(ibatch);
unsigned used = 0;
int ret = 0;
int i;
- assert(intel_batchbuffer_space(ibatch) >= 0);
+ assert(i915_winsys_batchbuffer_space(ibatch) >= 0);
used = batch->base.ptr - batch->base.map;
assert((used & 3) == 0);
@@ -161,16 +161,16 @@ intel_drm_batchbuffer_flush(struct intel_batchbuffer *ibatch,
#ifdef INTEL_ALWAYS_FLUSH
/* MI_FLUSH | FLUSH_MAP_CACHE */
- intel_batchbuffer_dword(ibatch, (0x4<<23)|(1<<0));
+ i915_winsys_batchbuffer_dword(ibatch, (0x4<<23)|(1<<0));
used += 4;
#endif
if ((used & 4) == 0) {
/* MI_NOOP */
- intel_batchbuffer_dword(ibatch, 0);
+ i915_winsys_batchbuffer_dword(ibatch, 0);
}
/* MI_BATCH_BUFFER_END */
- intel_batchbuffer_dword(ibatch, (0xA<<23));
+ i915_winsys_batchbuffer_dword(ibatch, (0xA<<23));
used = batch->base.ptr - batch->base.map;
assert((used & 4) == 0);
@@ -189,7 +189,7 @@ intel_drm_batchbuffer_flush(struct intel_batchbuffer *ibatch,
ret = drm_intel_bo_exec(batch->bo, used, NULL, 0, 0);
assert(ret == 0);
- if (intel_drm_winsys(ibatch->iws)->dump_cmd) {
+ if (i915_drm_winsys(ibatch->iws)->dump_cmd) {
unsigned *ptr;
drm_intel_bo_map(batch->bo, FALSE);
ptr = (unsigned*)batch->bo->virtual;
@@ -212,19 +212,19 @@ intel_drm_batchbuffer_flush(struct intel_batchbuffer *ibatch,
#ifdef INTEL_RUN_SYNC
/* we run synced to GPU so just pass null */
- (*fence) = intel_drm_fence_create(NULL);
+ (*fence) = i915_drm_fence_create(NULL);
#else
- (*fence) = intel_drm_fence_create(batch->bo);
+ (*fence) = i915_drm_fence_create(batch->bo);
#endif
}
- intel_drm_batchbuffer_reset(batch);
+ i915_drm_batchbuffer_reset(batch);
}
static void
-intel_drm_batchbuffer_destroy(struct intel_batchbuffer *ibatch)
+i915_drm_batchbuffer_destroy(struct i915_winsys_batchbuffer *ibatch)
{
- struct intel_drm_batchbuffer *batch = intel_drm_batchbuffer(ibatch);
+ struct i915_drm_batchbuffer *batch = i915_drm_batchbuffer(ibatch);
if (batch->bo)
drm_intel_bo_unreference(batch->bo);
@@ -235,10 +235,10 @@ intel_drm_batchbuffer_destroy(struct intel_batchbuffer *ibatch)
FREE(batch);
}
-void intel_drm_winsys_init_batchbuffer_functions(struct intel_drm_winsys *idws)
+void i915_drm_winsys_init_batchbuffer_functions(struct i915_drm_winsys *idws)
{
- idws->base.batchbuffer_create = intel_drm_batchbuffer_create;
- idws->base.batchbuffer_reloc = intel_drm_batchbuffer_reloc;
- idws->base.batchbuffer_flush = intel_drm_batchbuffer_flush;
- idws->base.batchbuffer_destroy = intel_drm_batchbuffer_destroy;
+ idws->base.batchbuffer_create = i915_drm_batchbuffer_create;
+ idws->base.batchbuffer_reloc = i915_drm_batchbuffer_reloc;
+ idws->base.batchbuffer_flush = i915_drm_batchbuffer_flush;
+ idws->base.batchbuffer_destroy = i915_drm_batchbuffer_destroy;
}
diff --git a/src/gallium/winsys/i915/drm/i915_drm_buffer.c b/src/gallium/winsys/i915/drm/i915_drm_buffer.c
new file mode 100644
index 0000000000..3bd85026b2
--- /dev/null
+++ b/src/gallium/winsys/i915/drm/i915_drm_buffer.c
@@ -0,0 +1,217 @@
+
+#include "state_tracker/drm_api.h"
+#include "i915_drm_winsys.h"
+#include "util/u_memory.h"
+
+#include "i915_drm.h"
+
+static struct i915_winsys_buffer *
+i915_drm_buffer_create(struct i915_winsys *iws,
+ unsigned size, unsigned alignment,
+ enum i915_winsys_buffer_type type)
+{
+ struct i915_drm_buffer *buf = CALLOC_STRUCT(i915_drm_buffer);
+ struct i915_drm_winsys *idws = i915_drm_winsys(iws);
+ drm_intel_bufmgr *pool;
+ char *name;
+
+ if (!buf)
+ return NULL;
+
+ buf->magic = 0xDEAD1337;
+ buf->flinked = FALSE;
+ buf->flink = 0;
+ buf->map_gtt = FALSE;
+
+ if (type == I915_NEW_TEXTURE) {
+ name = "gallium3d_texture";
+ pool = idws->pools.gem;
+ } else if (type == I915_NEW_VERTEX) {
+ name = "gallium3d_vertex";
+ pool = idws->pools.gem;
+ buf->map_gtt = TRUE;
+ } else if (type == I915_NEW_SCANOUT) {
+ name = "gallium3d_scanout";
+ pool = idws->pools.gem;
+ buf->map_gtt = TRUE;
+ } else {
+ assert(0);
+ name = "gallium3d_unknown";
+ pool = idws->pools.gem;
+ }
+
+ buf->bo = drm_intel_bo_alloc(pool, name, size, alignment);
+
+ if (!buf->bo)
+ goto err;
+
+ return (struct i915_winsys_buffer *)buf;
+
+err:
+ assert(0);
+ FREE(buf);
+ return NULL;
+}
+
+static struct i915_winsys_buffer *
+i915_drm_buffer_from_handle(struct i915_winsys *iws,
+ struct winsys_handle *whandle,
+ unsigned *stride)
+{
+ struct i915_drm_winsys *idws = i915_drm_winsys(iws);
+ struct i915_drm_buffer *buf = CALLOC_STRUCT(i915_drm_buffer);
+ uint32_t tile = 0, swizzle = 0;
+
+ if (!buf)
+ return NULL;
+
+ buf->magic = 0xDEAD1337;
+ buf->bo = drm_intel_bo_gem_create_from_name(idws->pools.gem, "gallium3d_from_handle", whandle->handle);
+ buf->flinked = TRUE;
+ buf->flink = whandle->handle;
+
+ if (!buf->bo)
+ goto err;
+
+ drm_intel_bo_get_tiling(buf->bo, &tile, &swizzle);
+ if (tile != I915_TILE_NONE)
+ buf->map_gtt = TRUE;
+
+ *stride = whandle->stride;
+
+ return (struct i915_winsys_buffer *)buf;
+
+err:
+ FREE(buf);
+ return NULL;
+}
+
+static boolean
+i915_drm_buffer_get_handle(struct i915_winsys *iws,
+ struct i915_winsys_buffer *buffer,
+ struct winsys_handle *whandle,
+ unsigned stride)
+{
+ struct i915_drm_buffer *buf = i915_drm_buffer(buffer);
+
+ if (whandle->type == DRM_API_HANDLE_TYPE_SHARED) {
+ if (!buf->flinked) {
+ if (drm_intel_bo_flink(buf->bo, &buf->flink))
+ return FALSE;
+ buf->flinked = TRUE;
+ }
+
+ whandle->handle = buf->flink;
+ } else if (whandle->type == DRM_API_HANDLE_TYPE_KMS) {
+ whandle->handle = buf->bo->handle;
+ } else {
+ assert(!"unknown usage");
+ return FALSE;
+ }
+
+ whandle->stride = stride;
+ return TRUE;
+}
+
+static int
+i915_drm_buffer_set_fence_reg(struct i915_winsys *iws,
+ struct i915_winsys_buffer *buffer,
+ unsigned stride,
+ enum i915_winsys_buffer_tile tile)
+{
+ struct i915_drm_buffer *buf = i915_drm_buffer(buffer);
+ assert(I915_TILING_NONE == I915_TILE_NONE);
+ assert(I915_TILING_X == I915_TILE_X);
+ assert(I915_TILING_Y == I915_TILE_Y);
+
+ if (tile != I915_TILE_NONE) {
+ assert(buf->map_count == 0);
+ buf->map_gtt = TRUE;
+ }
+
+ return drm_intel_bo_set_tiling(buf->bo, &tile, stride);
+}
+
+static void *
+i915_drm_buffer_map(struct i915_winsys *iws,
+ struct i915_winsys_buffer *buffer,
+ boolean write)
+{
+ struct i915_drm_buffer *buf = i915_drm_buffer(buffer);
+ drm_intel_bo *bo = intel_bo(buffer);
+ int ret = 0;
+
+ assert(bo);
+
+ if (buf->map_count)
+ goto out;
+
+ if (buf->map_gtt)
+ ret = drm_intel_gem_bo_map_gtt(bo);
+ else
+ ret = drm_intel_bo_map(bo, write);
+
+ buf->ptr = bo->virtual;
+
+ assert(ret == 0);
+out:
+ if (ret)
+ return NULL;
+
+ buf->map_count++;
+ return buf->ptr;
+}
+
+static void
+i915_drm_buffer_unmap(struct i915_winsys *iws,
+ struct i915_winsys_buffer *buffer)
+{
+ struct i915_drm_buffer *buf = i915_drm_buffer(buffer);
+
+ if (--buf->map_count)
+ return;
+
+ if (buf->map_gtt)
+ drm_intel_gem_bo_unmap_gtt(intel_bo(buffer));
+ else
+ drm_intel_bo_unmap(intel_bo(buffer));
+}
+
+static int
+i915_drm_buffer_write(struct i915_winsys *iws,
+ struct i915_winsys_buffer *buffer,
+ size_t offset,
+ size_t size,
+ const void *data)
+{
+ struct i915_drm_buffer *buf = i915_drm_buffer(buffer);
+
+ return drm_intel_bo_subdata(buf->bo, offset, size, (void*)data);
+}
+
+static void
+i915_drm_buffer_destroy(struct i915_winsys *iws,
+ struct i915_winsys_buffer *buffer)
+{
+ drm_intel_bo_unreference(intel_bo(buffer));
+
+#ifdef DEBUG
+ i915_drm_buffer(buffer)->magic = 0;
+ i915_drm_buffer(buffer)->bo = NULL;
+#endif
+
+ FREE(buffer);
+}
+
+void
+i915_drm_winsys_init_buffer_functions(struct i915_drm_winsys *idws)
+{
+ idws->base.buffer_create = i915_drm_buffer_create;
+ idws->base.buffer_from_handle = i915_drm_buffer_from_handle;
+ idws->base.buffer_get_handle = i915_drm_buffer_get_handle;
+ idws->base.buffer_set_fence_reg = i915_drm_buffer_set_fence_reg;
+ idws->base.buffer_map = i915_drm_buffer_map;
+ idws->base.buffer_unmap = i915_drm_buffer_unmap;
+ idws->base.buffer_write = i915_drm_buffer_write;
+ idws->base.buffer_destroy = i915_drm_buffer_destroy;
+}
diff --git a/src/gallium/winsys/drm/intel/gem/intel_drm_fence.c b/src/gallium/winsys/i915/drm/i915_drm_fence.c
index 102faedfea..30ebf4835e 100644
--- a/src/gallium/winsys/drm/intel/gem/intel_drm_fence.c
+++ b/src/gallium/winsys/i915/drm/i915_drm_fence.c
@@ -1,5 +1,5 @@
-#include "intel_drm_winsys.h"
+#include "i915_drm_winsys.h"
#include "util/u_memory.h"
#include "util/u_atomic.h"
#include "util/u_inlines.h"
@@ -10,7 +10,7 @@
* They work by keeping the batchbuffer around and checking if that has
* been idled. If bo is NULL fence has expired.
*/
-struct intel_drm_fence
+struct i915_drm_fence
{
struct pipe_reference reference;
drm_intel_bo *bo;
@@ -18,9 +18,9 @@ struct intel_drm_fence
struct pipe_fence_handle *
-intel_drm_fence_create(drm_intel_bo *bo)
+i915_drm_fence_create(drm_intel_bo *bo)
{
- struct intel_drm_fence *fence = CALLOC_STRUCT(intel_drm_fence);
+ struct i915_drm_fence *fence = CALLOC_STRUCT(i915_drm_fence);
pipe_reference_init(&fence->reference, 1);
/* bo is null if fence already expired */
@@ -33,14 +33,14 @@ intel_drm_fence_create(drm_intel_bo *bo)
}
static void
-intel_drm_fence_reference(struct intel_winsys *iws,
+i915_drm_fence_reference(struct i915_winsys *iws,
struct pipe_fence_handle **ptr,
struct pipe_fence_handle *fence)
{
- struct intel_drm_fence *old = (struct intel_drm_fence *)*ptr;
- struct intel_drm_fence *f = (struct intel_drm_fence *)fence;
+ struct i915_drm_fence *old = (struct i915_drm_fence *)*ptr;
+ struct i915_drm_fence *f = (struct i915_drm_fence *)fence;
- if (pipe_reference(&((struct intel_drm_fence *)(*ptr))->reference, &f->reference)) {
+ if (pipe_reference(&((struct i915_drm_fence *)(*ptr))->reference, &f->reference)) {
if (old->bo)
drm_intel_bo_unreference(old->bo);
FREE(old);
@@ -49,7 +49,7 @@ intel_drm_fence_reference(struct intel_winsys *iws,
}
static int
-intel_drm_fence_signalled(struct intel_winsys *iws,
+i915_drm_fence_signalled(struct i915_winsys *iws,
struct pipe_fence_handle *fence)
{
assert(0);
@@ -58,10 +58,10 @@ intel_drm_fence_signalled(struct intel_winsys *iws,
}
static int
-intel_drm_fence_finish(struct intel_winsys *iws,
+i915_drm_fence_finish(struct i915_winsys *iws,
struct pipe_fence_handle *fence)
{
- struct intel_drm_fence *f = (struct intel_drm_fence *)fence;
+ struct i915_drm_fence *f = (struct i915_drm_fence *)fence;
/* fence already expired */
if (!f->bo)
@@ -75,9 +75,9 @@ intel_drm_fence_finish(struct intel_winsys *iws,
}
void
-intel_drm_winsys_init_fence_functions(struct intel_drm_winsys *idws)
+i915_drm_winsys_init_fence_functions(struct i915_drm_winsys *idws)
{
- idws->base.fence_reference = intel_drm_fence_reference;
- idws->base.fence_signalled = intel_drm_fence_signalled;
- idws->base.fence_finish = intel_drm_fence_finish;
+ idws->base.fence_reference = i915_drm_fence_reference;
+ idws->base.fence_signalled = i915_drm_fence_signalled;
+ idws->base.fence_finish = i915_drm_fence_finish;
}
diff --git a/src/gallium/winsys/i915/drm/i915_drm_winsys.h b/src/gallium/winsys/i915/drm/i915_drm_winsys.h
new file mode 100644
index 0000000000..217c4a7eaf
--- /dev/null
+++ b/src/gallium/winsys/i915/drm/i915_drm_winsys.h
@@ -0,0 +1,77 @@
+
+#ifndef INTEL_DRM_WINSYS_H
+#define INTEL_DRM_WINSYS_H
+
+#include "i915/i915_batchbuffer.h"
+
+#include "drm.h"
+#include "intel_bufmgr.h"
+
+
+/*
+ * Winsys
+ */
+
+
+struct i915_drm_winsys
+{
+ struct i915_winsys base;
+
+ boolean dump_cmd;
+
+ int fd; /**< Drm file discriptor */
+
+ unsigned id;
+
+ size_t max_batch_size;
+
+ struct {
+ drm_intel_bufmgr *gem;
+ } pools;
+};
+
+static INLINE struct i915_drm_winsys *
+i915_drm_winsys(struct i915_winsys *iws)
+{
+ return (struct i915_drm_winsys *)iws;
+}
+
+struct i915_drm_winsys * i915_drm_winsys_create(int fd, unsigned pci_id);
+struct pipe_fence_handle * i915_drm_fence_create(drm_intel_bo *bo);
+
+void i915_drm_winsys_init_batchbuffer_functions(struct i915_drm_winsys *idws);
+void i915_drm_winsys_init_buffer_functions(struct i915_drm_winsys *idws);
+void i915_drm_winsys_init_fence_functions(struct i915_drm_winsys *idws);
+
+
+/*
+ * Buffer
+ */
+
+
+struct i915_drm_buffer {
+ unsigned magic;
+
+ drm_intel_bo *bo;
+
+ void *ptr;
+ unsigned map_count;
+ boolean map_gtt;
+
+ boolean flinked;
+ unsigned flink;
+};
+
+static INLINE struct i915_drm_buffer *
+i915_drm_buffer(struct i915_winsys_buffer *buffer)
+{
+ return (struct i915_drm_buffer *)buffer;
+}
+
+static INLINE drm_intel_bo *
+intel_bo(struct i915_winsys_buffer *buffer)
+{
+ return i915_drm_buffer(buffer)->bo;
+}
+
+#endif
diff --git a/src/gallium/winsys/drm/i965/gem/Makefile b/src/gallium/winsys/i965/drm/Makefile
index 6a7497b6be..bbb71e25d8 100644
--- a/src/gallium/winsys/drm/i965/gem/Makefile
+++ b/src/gallium/winsys/i965/drm/Makefile
@@ -1,4 +1,4 @@
-TOP = ../../../../../..
+TOP = ../../../../..
include $(TOP)/configs/current
LIBNAME = i965drm
@@ -11,4 +11,4 @@ LIBRARY_INCLUDES = $(shell pkg-config libdrm --cflags-only-I)
LIBRARY_DEFINES = $(shell pkg-config libdrm --cflags-only-other)
-include ../../../../Makefile.template
+include ../../../Makefile.template
diff --git a/src/gallium/winsys/drm/i965/gem/SConscript b/src/gallium/winsys/i965/drm/SConscript
index 6256ec6eaf..150ab19a33 100644
--- a/src/gallium/winsys/drm/i965/gem/SConscript
+++ b/src/gallium/winsys/i965/drm/SConscript
@@ -1,6 +1,6 @@
Import('*')
-env = drienv.Clone()
+env = env.Clone()
i965drm_sources = [
'i965_drm_api.c',
diff --git a/src/gallium/winsys/i965/drm/i965_drm_api.c b/src/gallium/winsys/i965/drm/i965_drm_api.c
new file mode 100644
index 0000000000..9072a18638
--- /dev/null
+++ b/src/gallium/winsys/i965/drm/i965_drm_api.c
@@ -0,0 +1,122 @@
+
+#include <stdio.h>
+#include "state_tracker/drm_api.h"
+
+#include "i965_drm_winsys.h"
+#include "util/u_memory.h"
+
+#include "i965/brw_context.h" /* XXX: shouldn't be doing this */
+#include "i965/brw_screen.h" /* XXX: shouldn't be doing this */
+
+#include "trace/tr_drm.h"
+
+#include "../../sw/drm/sw_drm_api.h"
+
+/*
+ * Helper functions
+ */
+
+
+static void
+i965_libdrm_get_device_id(unsigned int *device_id)
+{
+ char path[512];
+ FILE *file;
+ void *shutup_gcc;
+
+ /*
+ * FIXME: Fix this up to use a drm ioctl or whatever.
+ */
+
+ snprintf(path, sizeof(path), "/sys/class/drm/card0/device/device");
+ file = fopen(path, "r");
+ if (!file) {
+ return;
+ }
+
+ shutup_gcc = fgets(path, sizeof(path), file);
+ sscanf(path, "%x", device_id);
+ fclose(file);
+}
+
+static void
+i965_libdrm_winsys_destroy(struct brw_winsys_screen *iws)
+{
+ struct i965_libdrm_winsys *idws = i965_libdrm_winsys(iws);
+
+ if (BRW_DUMP)
+ debug_printf("%s\n", __FUNCTION__);
+
+ drm_intel_bufmgr_destroy(idws->gem);
+
+ FREE(idws);
+}
+
+static struct pipe_screen *
+i965_libdrm_create_screen(struct drm_api *api, int drmFD,
+ struct drm_create_screen_arg *arg)
+{
+ struct i965_libdrm_winsys *idws;
+ unsigned int deviceID;
+
+ debug_printf("%s\n", __FUNCTION__);
+
+ if (arg != NULL) {
+ switch(arg->mode) {
+ case DRM_CREATE_NORMAL:
+ break;
+ default:
+ return NULL;
+ }
+ }
+
+ idws = CALLOC_STRUCT(i965_libdrm_winsys);
+ if (!idws)
+ return NULL;
+
+ i965_libdrm_get_device_id(&deviceID);
+
+ i965_libdrm_winsys_init_buffer_functions(idws);
+
+ idws->fd = drmFD;
+ idws->id = deviceID;
+
+ idws->base.destroy = i965_libdrm_winsys_destroy;
+
+ idws->gem = drm_intel_bufmgr_gem_init(idws->fd, BRW_BATCH_SIZE);
+ drm_intel_bufmgr_gem_enable_reuse(idws->gem);
+
+ idws->send_cmd = !debug_get_bool_option("BRW_NO_HW", FALSE);
+
+ return brw_create_screen(&idws->base, deviceID);
+}
+
+
+static void
+destroy(struct drm_api *api)
+{
+ if (BRW_DUMP)
+ debug_printf("%s\n", __FUNCTION__);
+
+}
+
+struct drm_api i965_libdrm_api =
+{
+ .name = "i965",
+ .create_screen = i965_libdrm_create_screen,
+ .destroy = destroy,
+};
+
+struct drm_api *
+drm_api_create()
+{
+ struct drm_api *api = NULL;
+
+ if (api == NULL && debug_get_bool_option("BRW_SOFTPIPE", FALSE))
+ api = sw_drm_api_create(&i965_libdrm_api);
+
+ if (api == NULL)
+ api = &i965_libdrm_api;
+
+ return trace_drm_create(api);
+}
diff --git a/src/gallium/winsys/drm/i965/gem/i965_drm_buffer.c b/src/gallium/winsys/i965/drm/i965_drm_buffer.c
index 07be1df87f..33a17496b2 100644
--- a/src/gallium/winsys/drm/i965/gem/i965_drm_buffer.c
+++ b/src/gallium/winsys/i965/drm/i965_drm_buffer.c
@@ -1,4 +1,5 @@
+#include "state_tracker/drm_api.h"
#include "i965_drm_winsys.h"
#include "util/u_memory.h"
#include "util/u_inlines.h"
@@ -122,6 +123,78 @@ err:
return PIPE_ERROR_OUT_OF_MEMORY;
}
+static enum pipe_error
+i965_libdrm_bo_from_handle(struct brw_winsys_screen *sws,
+ struct winsys_handle *whandle,
+ unsigned *stride,
+ unsigned *tile,
+ struct brw_winsys_buffer **bo_out)
+{
+ struct i965_libdrm_winsys *idws = i965_libdrm_winsys(sws);
+ struct i965_libdrm_buffer *buf = CALLOC_STRUCT(i965_libdrm_buffer);
+ uint32_t swizzle = 0;
+
+ if (BRW_DUMP)
+ debug_printf("%s\n", __FUNCTION__);
+
+ if (!buf)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+
+ pipe_reference_init(&buf->base.reference, 1);
+ buf->bo = drm_intel_bo_gem_create_from_name(idws->gem, "FROM_HANDLE", whandle->handle);
+ buf->base.size = buf->bo->size;
+ buf->base.sws = &idws->base;
+ buf->flinked = TRUE;
+ buf->flink = whandle->handle;
+
+
+ if (!buf->bo)
+ goto err;
+
+ drm_intel_bo_get_tiling(buf->bo, &buf->tiling, &swizzle);
+ if (buf->tiling != 0)
+ buf->map_gtt = TRUE;
+
+ *tile = buf->tiling;
+ *stride = whandle->stride;
+
+ *bo_out = &buf->base;
+ return PIPE_OK;
+
+err:
+ FREE(buf);
+ return PIPE_ERROR_OUT_OF_MEMORY;
+}
+
+static enum pipe_error
+i965_libdrm_bo_get_handle(struct brw_winsys_buffer *buffer,
+ struct winsys_handle *whandle,
+ unsigned stride)
+{
+ struct i965_libdrm_buffer *buf = i965_libdrm_buffer(buffer);
+
+ if (BRW_DUMP)
+ debug_printf("%s\n", __FUNCTION__);
+
+ if (whandle->type == DRM_API_HANDLE_TYPE_SHARED) {
+ if (!buf->flinked) {
+ if (drm_intel_bo_flink(buf->bo, &buf->flink))
+ return PIPE_ERROR_BAD_INPUT;
+ buf->flinked = TRUE;
+ }
+
+ whandle->handle = buf->flink;
+ } else if (whandle->type == DRM_API_HANDLE_TYPE_KMS) {
+ whandle->handle = buf->bo->handle;
+ } else {
+ assert(!"unknown usage");
+ return PIPE_ERROR_BAD_INPUT;
+ }
+
+ whandle->stride = stride;
+ return PIPE_OK;
+}
+
static void
i965_libdrm_bo_destroy(struct brw_winsys_buffer *buffer)
{
@@ -415,6 +488,8 @@ void
i965_libdrm_winsys_init_buffer_functions(struct i965_libdrm_winsys *idws)
{
idws->base.bo_alloc = i965_libdrm_bo_alloc;
+ idws->base.bo_from_handle = i965_libdrm_bo_from_handle;
+ idws->base.bo_get_handle = i965_libdrm_bo_get_handle;
idws->base.bo_destroy = i965_libdrm_bo_destroy;
idws->base.bo_emit_reloc = i965_libdrm_bo_emit_reloc;
idws->base.bo_exec = i965_libdrm_bo_exec;
diff --git a/src/gallium/winsys/drm/i965/gem/i965_drm_winsys.h b/src/gallium/winsys/i965/drm/i965_drm_winsys.h
index c6a7d4a8c5..c6a7d4a8c5 100644
--- a/src/gallium/winsys/drm/i965/gem/i965_drm_winsys.h
+++ b/src/gallium/winsys/i965/drm/i965_drm_winsys.h
diff --git a/src/gallium/winsys/drm/i965/xlib/Makefile b/src/gallium/winsys/i965/xlib/Makefile
index 0efa0ca6f9..3730db6997 100644
--- a/src/gallium/winsys/drm/i965/xlib/Makefile
+++ b/src/gallium/winsys/i965/xlib/Makefile
@@ -1,10 +1,10 @@
-# src/gallium/winsys/xlib/Makefile
+# src/gallium/winsys/i965/xlib/Makefile
# This makefile produces a "stand-alone" libGL.so which is based on
# Xlib (no DRI HW acceleration)
-TOP = ../../../../../..
+TOP = ../../../../..
include $(TOP)/configs/current
diff --git a/src/gallium/winsys/drm/i965/xlib/xlib_i965.c b/src/gallium/winsys/i965/xlib/xlib_i965.c
index 74501eeb16..063e9f600b 100644
--- a/src/gallium/winsys/drm/i965/xlib/xlib_i965.c
+++ b/src/gallium/winsys/i965/xlib/xlib_i965.c
@@ -38,7 +38,7 @@
#include "pipe/p_error.h"
#include "pipe/p_context.h"
-#include "xm_winsys.h"
+#include "xm_public.h"
#include "i965/brw_winsys.h"
#include "i965/brw_screen.h"
diff --git a/src/gallium/winsys/drm/nouveau/drm/Makefile b/src/gallium/winsys/nouveau/drm/Makefile
index 54c3b26c75..71029858f7 100644
--- a/src/gallium/winsys/drm/nouveau/drm/Makefile
+++ b/src/gallium/winsys/nouveau/drm/Makefile
@@ -1,4 +1,4 @@
-TOP = ../../../../../..
+TOP = ../../../../..
include $(TOP)/configs/current
LIBNAME = nouveaudrm
@@ -8,4 +8,4 @@ C_SOURCES = nouveau_drm_api.c
LIBRARY_INCLUDES = $(shell pkg-config libdrm libdrm_nouveau --cflags-only-I)
LIBRARY_DEFINES = $(shell pkg-config libdrm libdrm_nouveau --cflags-only-other)
-include ../../../../Makefile.template
+include ../../../Makefile.template
diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_dri.h b/src/gallium/winsys/nouveau/drm/nouveau_dri.h
index 1207c2d609..1207c2d609 100644
--- a/src/gallium/winsys/drm/nouveau/drm/nouveau_dri.h
+++ b/src/gallium/winsys/nouveau/drm/nouveau_dri.h
diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c b/src/gallium/winsys/nouveau/drm/nouveau_drm_api.c
index 0d05f316c4..716d4bacd3 100644
--- a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c
+++ b/src/gallium/winsys/nouveau/drm/nouveau_drm_api.c
@@ -21,9 +21,10 @@ dri_surface_from_handle(struct drm_api *api, struct pipe_screen *pscreen,
struct pipe_surface *ps = NULL;
struct pipe_texture *pt = NULL;
struct pipe_texture tmpl;
+ struct winsys_handle whandle;
memset(&tmpl, 0, sizeof(tmpl));
- tmpl.tex_usage = PIPE_TEXTURE_USAGE_PRIMARY;
+ tmpl.tex_usage = PIPE_TEXTURE_USAGE_SCANOUT;
tmpl.target = PIPE_TEXTURE_2D;
tmpl.last_level = 0;
tmpl.depth0 = 1;
@@ -31,8 +32,11 @@ dri_surface_from_handle(struct drm_api *api, struct pipe_screen *pscreen,
tmpl.width0 = width;
tmpl.height0 = height;
- pt = api->texture_from_shared_handle(api, pscreen, &tmpl,
- "front buffer", pitch, handle);
+ memset(&whandle, 0, sizeof(whandle));
+ whandle.stride = pitch;
+ whandle.handle = handle;
+
+ pt = pscreen->texture_from_handle(pscreen, &tmpl, &whandle);
if (!pt)
return NULL;
@@ -82,11 +86,9 @@ nouveau_drm_create_screen(struct drm_api *api, int fd,
switch (dev->chipset & 0xf0) {
case 0x30:
- init = nv30_screen_create;
- break;
case 0x40:
case 0x60:
- init = nv40_screen_create;
+ init = nvfx_screen_create;
break;
case 0x50:
case 0x80:
@@ -142,74 +144,10 @@ nouveau_drm_create_screen(struct drm_api *api, int fd,
return nvws->pscreen;
}
-static struct pipe_texture *
-nouveau_drm_pt_from_name(struct drm_api *api, struct pipe_screen *pscreen,
- struct pipe_texture *templ, const char *name,
- unsigned stride, unsigned handle)
-{
- struct nouveau_device *dev = nouveau_screen(pscreen)->device;
- struct pipe_texture *pt;
- struct pipe_buffer *pb;
- int ret;
-
- pb = CALLOC(1, sizeof(struct pipe_buffer) + sizeof(struct nouveau_bo*));
- if (!pb)
- return NULL;
-
- ret = nouveau_bo_handle_ref(dev, handle, (struct nouveau_bo**)(pb+1));
- if (ret) {
- debug_printf("%s: ref name 0x%08x failed with %d\n",
- __func__, handle, ret);
- FREE(pb);
- return NULL;
- }
-
- pipe_reference_init(&pb->reference, 1);
- pb->screen = pscreen;
- pb->alignment = 0;
- pb->usage = PIPE_BUFFER_USAGE_GPU_READ_WRITE |
- PIPE_BUFFER_USAGE_CPU_READ_WRITE;
- pb->size = nouveau_bo(pb)->size;
- pt = pscreen->texture_blanket(pscreen, templ, &stride, pb);
- pipe_buffer_reference(&pb, NULL);
- return pt;
-}
-
-static boolean
-nouveau_drm_name_from_pt(struct drm_api *api, struct pipe_screen *pscreen,
- struct pipe_texture *pt, unsigned *stride,
- unsigned *handle)
-{
- struct nouveau_miptree *mt = nouveau_miptree(pt);
-
- if (!mt || !mt->bo)
- return false;
-
- return nouveau_bo_handle_get(mt->bo, handle) == 0;
-}
-
-static boolean
-nouveau_drm_handle_from_pt(struct drm_api *api, struct pipe_screen *pscreen,
- struct pipe_texture *pt, unsigned *stride,
- unsigned *handle)
-{
- struct nouveau_miptree *mt = nouveau_miptree(pt);
-
- if (!mt || !mt->bo)
- return false;
-
- *handle = mt->bo->handle;
- *stride = util_format_get_stride(mt->base.format, mt->base.width0);
- return true;
-}
-
struct drm_api drm_api_hooks = {
.name = "nouveau",
.driver_name = "nouveau",
.create_screen = nouveau_drm_create_screen,
- .texture_from_shared_handle = nouveau_drm_pt_from_name,
- .shared_handle_from_texture = nouveau_drm_name_from_pt,
- .local_handle_from_texture = nouveau_drm_handle_from_pt,
};
struct drm_api *
diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.h b/src/gallium/winsys/nouveau/drm/nouveau_drm_api.h
index a91aad7df8..a91aad7df8 100644
--- a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.h
+++ b/src/gallium/winsys/nouveau/drm/nouveau_drm_api.h
diff --git a/src/gallium/winsys/drm/radeon/core/Makefile b/src/gallium/winsys/radeon/drm/Makefile
index 860cbb6dbf..7f69e39273 100644
--- a/src/gallium/winsys/drm/radeon/core/Makefile
+++ b/src/gallium/winsys/radeon/drm/Makefile
@@ -1,17 +1,17 @@
-TOP = ../../../../../..
+TOP = ../../../../..
include $(TOP)/configs/current
LIBNAME = radeonwinsys
C_SOURCES = \
- radeon_buffer.c \
+ radeon_drm_buffer.c \
radeon_drm.c \
radeon_r300.c
LIBRARY_INCLUDES = -I$(TOP)/src/gallium/drivers/r300 \
$(shell pkg-config libdrm --cflags-only-I)
-include ../../../../Makefile.template
+include ../../../Makefile.template
symlinks:
diff --git a/src/gallium/winsys/drm/radeon/core/SConscript b/src/gallium/winsys/radeon/drm/SConscript
index f4e9c397bd..fab4292951 100644
--- a/src/gallium/winsys/drm/radeon/core/SConscript
+++ b/src/gallium/winsys/radeon/drm/SConscript
@@ -1,9 +1,9 @@
Import('*')
-env = drienv.Clone()
+env = env.Clone()
radeon_sources = [
- 'radeon_buffer.c',
+ 'radeon_drm_buffer.c',
'radeon_drm.c',
'radeon_r300.c',
]
diff --git a/src/gallium/winsys/radeon/drm/radeon_buffer.h b/src/gallium/winsys/radeon/drm/radeon_buffer.h
new file mode 100644
index 0000000000..8782d675df
--- /dev/null
+++ b/src/gallium/winsys/radeon/drm/radeon_buffer.h
@@ -0,0 +1,90 @@
+/*
+ * Copyright © 2008 Jérôme Glisse
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
+ * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ */
+/*
+ * Authors:
+ * Jérôme Glisse <glisse@freedesktop.org>
+ */
+#ifndef RADEON_BUFFER_H
+#define RADEON_BUFFER_H
+
+#include <stdio.h>
+
+#include "pipe/p_defines.h"
+#include "util/u_inlines.h"
+
+#include "pipebuffer/pb_buffer.h"
+#include "pipebuffer/pb_bufmgr.h"
+
+#include "radeon_bo.h"
+#include "radeon_cs.h"
+
+#include "radeon_winsys.h"
+
+
+#define RADEON_MAX_BOS 24
+
+static INLINE struct pb_buffer *
+radeon_pb_buffer(struct r300_winsys_buffer *buffer)
+{
+ return (struct pb_buffer *)buffer;
+}
+
+static INLINE struct r300_winsys_buffer *
+radeon_libdrm_winsys_buffer(struct pb_buffer *buffer)
+{
+ return (struct r300_winsys_buffer *)buffer;
+}
+
+struct pb_manager *
+radeon_drm_bufmgr_create(struct radeon_libdrm_winsys *rws);
+
+boolean radeon_drm_bufmgr_add_buffer(struct pb_buffer *_buf,
+ uint32_t rd, uint32_t wd);
+
+
+void radeon_drm_bufmgr_write_reloc(struct pb_buffer *_buf,
+ uint32_t rd, uint32_t wd,
+ uint32_t flags);
+
+struct pb_buffer *radeon_drm_bufmgr_create_buffer_from_handle(struct pb_manager *_mgr,
+ uint32_t handle);
+
+void radeon_drm_bufmgr_get_tiling(struct pb_buffer *_buf,
+ enum r300_buffer_tiling *microtiled,
+ enum r300_buffer_tiling *macrotiled);
+
+void radeon_drm_bufmgr_set_tiling(struct pb_buffer *_buf,
+ enum r300_buffer_tiling microtiled,
+ enum r300_buffer_tiling macrotiled,
+ uint32_t pitch);
+
+void radeon_drm_bufmgr_flush_maps(struct pb_manager *_mgr);
+
+boolean radeon_drm_bufmgr_get_handle(struct pb_buffer *_buf,
+ struct winsys_handle *whandle);
+
+boolean radeon_drm_bufmgr_is_buffer_referenced(struct pb_buffer *_buf);
+#endif
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm.c b/src/gallium/winsys/radeon/drm/radeon_drm.c
index e817a26da6..3dfcc5aef0 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_drm.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm.c
@@ -41,8 +41,22 @@
#include "xf86drm.h"
#include <sys/ioctl.h>
+static struct radeon_libdrm_winsys *
+radeon_winsys_create(int fd)
+{
+ struct radeon_libdrm_winsys *rws;
+
+ rws = CALLOC_STRUCT(radeon_libdrm_winsys);
+ if (rws == NULL) {
+ return NULL;
+ }
+
+ rws->fd = fd;
+ return rws;
+}
+
/* Helper function to do the ioctls needed for setup and init. */
-static void do_ioctls(int fd, struct radeon_winsys* winsys)
+static void do_ioctls(int fd, struct radeon_libdrm_winsys* winsys)
{
struct drm_radeon_gem_info gem_info = {0};
struct drm_radeon_info info = {0};
@@ -79,6 +93,13 @@ static void do_ioctls(int fd, struct radeon_winsys* winsys)
exit(1);
}
+/* XXX Remove this ifdef when libdrm version 2.4.19 becomes mandatory. */
+#ifdef RADEON_BO_FLAGS_MICRO_TILE_SQUARE
+ // Supported since 2.1.0.
+ winsys->squaretiling = version->version_major > 2 ||
+ version->version_minor >= 1;
+#endif
+
info.request = RADEON_INFO_DEVICE_ID;
retval = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info));
if (retval) {
@@ -133,137 +154,28 @@ struct pipe_screen* radeon_create_screen(struct drm_api* api,
int drmFB,
struct drm_create_screen_arg *arg)
{
- struct radeon_winsys* rwinsys = radeon_pipe_winsys(drmFB);
- do_ioctls(drmFB, rwinsys);
+ struct radeon_libdrm_winsys* rws;
+ boolean ret;
+
+ rws = radeon_winsys_create(drmFB);
+ if (!rws)
+ return NULL;
+
+ do_ioctls(drmFB, rws);
/* The state tracker can organize a softpipe fallback if no hw
* driver is found.
*/
- if (is_r3xx(rwinsys->pci_id)) {
- radeon_setup_winsys(drmFB, rwinsys);
- return r300_create_screen(rwinsys);
- } else {
- FREE(rwinsys);
- return NULL;
- }
-}
-
-
-boolean radeon_buffer_from_texture(struct drm_api* api,
- struct pipe_screen* screen,
- struct pipe_texture* texture,
- struct pipe_buffer** buffer,
- unsigned* stride)
-{
- /* XXX fix this */
- return r300_get_texture_buffer(screen, texture, buffer, stride);
-}
-
-/* Create a buffer from a handle. */
-/* XXX what's up with name? */
-struct pipe_buffer* radeon_buffer_from_handle(struct drm_api* api,
- struct pipe_screen* screen,
- const char* name,
- unsigned handle)
-{
- struct radeon_bo_manager* bom =
- ((struct radeon_winsys*)screen->winsys)->priv->bom;
- struct radeon_pipe_buffer* radeon_buffer;
- struct radeon_bo* bo = NULL;
-
- bo = radeon_bo_open(bom, handle, 0, 0, 0, 0);
- if (bo == NULL) {
- return NULL;
- }
-
- radeon_buffer = CALLOC_STRUCT(radeon_pipe_buffer);
- if (radeon_buffer == NULL) {
- radeon_bo_unref(bo);
- return NULL;
- }
-
- pipe_reference_init(&radeon_buffer->base.reference, 1);
- radeon_buffer->base.screen = screen;
- radeon_buffer->base.usage = PIPE_BUFFER_USAGE_PIXEL;
- radeon_buffer->bo = bo;
- return &radeon_buffer->base;
-}
-
-static struct pipe_texture*
-radeon_texture_from_shared_handle(struct drm_api *api,
- struct pipe_screen *screen,
- struct pipe_texture *templ,
- const char *name,
- unsigned stride,
- unsigned handle)
-{
- struct pipe_buffer *buffer;
- struct pipe_texture *blanket;
-
- buffer = radeon_buffer_from_handle(api, screen, name, handle);
- if (!buffer) {
- return NULL;
- }
-
- blanket = screen->texture_blanket(screen, templ, &stride, buffer);
-
- pipe_buffer_reference(&buffer, NULL);
-
- return blanket;
-}
-
-static boolean radeon_shared_handle_from_texture(struct drm_api *api,
- struct pipe_screen *screen,
- struct pipe_texture *texture,
- unsigned *stride,
- unsigned *handle)
-{
- int retval, fd;
- struct drm_gem_flink flink;
- struct radeon_pipe_buffer* radeon_buffer;
- struct pipe_buffer *buffer = NULL;
-
- if (!radeon_buffer_from_texture(api, screen, texture, &buffer, stride)) {
- return FALSE;
+ if (is_r3xx(rws->pci_id)) {
+ ret = radeon_setup_winsys(drmFB, rws);
+ if (ret == FALSE)
+ goto fail;
+ return r300_create_screen(&rws->base);
}
- radeon_buffer = (struct radeon_pipe_buffer*)buffer;
- if (!radeon_buffer->flinked) {
- fd = ((struct radeon_winsys*)screen->winsys)->priv->fd;
-
- flink.handle = radeon_buffer->bo->handle;
-
- retval = ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink);
- if (retval) {
- debug_printf("radeon: DRM_IOCTL_GEM_FLINK failed, error %d\n",
- retval);
- return FALSE;
- }
-
- radeon_buffer->flink = flink.name;
- radeon_buffer->flinked = TRUE;
- }
-
- *handle = radeon_buffer->flink;
- return TRUE;
-}
-
-static boolean radeon_local_handle_from_texture(struct drm_api *api,
- struct pipe_screen *screen,
- struct pipe_texture *texture,
- unsigned *stride,
- unsigned *handle)
-{
- struct pipe_buffer *buffer = NULL;
- if (!radeon_buffer_from_texture(api, screen, texture, &buffer, stride)) {
- return FALSE;
- }
-
- *handle = ((struct radeon_pipe_buffer*)buffer)->bo->handle;
-
- pipe_buffer_reference(&buffer, NULL);
-
- return TRUE;
+fail:
+ FREE(rws);
+ return NULL;
}
static void radeon_drm_api_destroy(struct drm_api *api)
@@ -275,9 +187,6 @@ struct drm_api drm_api_hooks = {
.name = "radeon",
.driver_name = "radeon",
.create_screen = radeon_create_screen,
- .texture_from_shared_handle = radeon_texture_from_shared_handle,
- .shared_handle_from_texture = radeon_shared_handle_from_texture,
- .local_handle_from_texture = radeon_local_handle_from_texture,
.destroy = radeon_drm_api_destroy,
};
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm.h b/src/gallium/winsys/radeon/drm/radeon_drm.h
index f62a9b8048..2dc077c052 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_drm.h
+++ b/src/gallium/winsys/radeon/drm/radeon_drm.h
@@ -37,18 +37,12 @@ struct pipe_screen* radeon_create_screen(struct drm_api* api,
int drmFB,
struct drm_create_screen_arg *arg);
-
boolean radeon_buffer_from_texture(struct drm_api* api,
struct pipe_screen* screen,
struct pipe_texture* texture,
struct pipe_buffer** buffer,
unsigned* stride);
-struct pipe_buffer* radeon_buffer_from_handle(struct drm_api* api,
- struct pipe_screen* screen,
- const char* name,
- unsigned handle);
-
boolean radeon_handle_from_buffer(struct drm_api* api,
struct pipe_screen* screen,
struct pipe_buffer* buffer,
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_buffer.c b/src/gallium/winsys/radeon/drm/radeon_drm_buffer.c
new file mode 100644
index 0000000000..5fd20cc775
--- /dev/null
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_buffer.c
@@ -0,0 +1,402 @@
+
+#include <sys/ioctl.h>
+#include "radeon_drm.h"
+#include "radeon_bo_gem.h"
+#include "radeon_cs_gem.h"
+#include "radeon_buffer.h"
+
+#include "util/u_inlines.h"
+#include "util/u_memory.h"
+#include "util/u_simple_list.h"
+#include "pipebuffer/pb_buffer.h"
+#include "pipebuffer/pb_bufmgr.h"
+
+#include "radeon_winsys.h"
+struct radeon_drm_bufmgr;
+
+struct radeon_drm_buffer {
+ struct pb_buffer base;
+ struct radeon_drm_bufmgr *mgr;
+
+ struct radeon_bo *bo;
+
+ boolean flinked;
+ uint32_t flink;
+
+ struct radeon_drm_buffer *next, *prev;
+};
+
+extern const struct pb_vtbl radeon_drm_buffer_vtbl;
+
+
+static INLINE struct radeon_drm_buffer *
+radeon_drm_buffer(struct pb_buffer *buf)
+{
+ assert(buf);
+ assert(buf->vtbl == &radeon_drm_buffer_vtbl);
+ return (struct radeon_drm_buffer *)buf;
+}
+
+struct radeon_drm_bufmgr {
+ struct pb_manager base;
+ struct radeon_libdrm_winsys *rws;
+ struct radeon_drm_buffer buffer_map_list;
+};
+
+static INLINE struct radeon_drm_bufmgr *
+radeon_drm_bufmgr(struct pb_manager *mgr)
+{
+ assert(mgr);
+ return (struct radeon_drm_bufmgr *)mgr;
+}
+
+static void
+radeon_drm_buffer_destroy(struct pb_buffer *_buf)
+{
+ struct radeon_drm_buffer *buf = radeon_drm_buffer(_buf);
+
+ if (buf->bo->ptr != NULL) {
+ remove_from_list(buf);
+ radeon_bo_unmap(buf->bo);
+ buf->bo->ptr = NULL;
+ }
+ radeon_bo_unref(buf->bo);
+
+ FREE(buf);
+}
+
+static void *
+radeon_drm_buffer_map(struct pb_buffer *_buf,
+ unsigned flags)
+{
+ struct radeon_drm_buffer *buf = radeon_drm_buffer(_buf);
+ int write = 0;
+
+ if (flags & PIPE_BUFFER_USAGE_DONTBLOCK) {
+ if ((_buf->base.usage & PIPE_BUFFER_USAGE_VERTEX) ||
+ (_buf->base.usage & PIPE_BUFFER_USAGE_INDEX))
+ if (radeon_bo_is_referenced_by_cs(buf->bo, buf->mgr->rws->cs))
+ return NULL;
+ }
+
+ if (buf->bo->ptr != NULL)
+ return buf->bo->ptr;
+
+ if (flags & PIPE_BUFFER_USAGE_DONTBLOCK) {
+ uint32_t domain;
+ if (radeon_bo_is_busy(buf->bo, &domain))
+ return NULL;
+ }
+
+ if (radeon_bo_is_referenced_by_cs(buf->bo, buf->mgr->rws->cs)) {
+ buf->mgr->rws->flush_cb(buf->mgr->rws->flush_data);
+ }
+
+ if (flags & PIPE_BUFFER_USAGE_CPU_WRITE) {
+ write = 1;
+ }
+
+ if (radeon_bo_map(buf->bo, write)) {
+ return NULL;
+ }
+ insert_at_tail(&buf->mgr->buffer_map_list, buf);
+ return buf->bo->ptr;
+}
+
+static void
+radeon_drm_buffer_unmap(struct pb_buffer *_buf)
+{
+ (void)_buf;
+}
+
+static void
+radeon_drm_buffer_get_base_buffer(struct pb_buffer *buf,
+ struct pb_buffer **base_buf,
+ unsigned *offset)
+{
+ *base_buf = buf;
+ *offset = 0;
+}
+
+
+static enum pipe_error
+radeon_drm_buffer_validate(struct pb_buffer *_buf,
+ struct pb_validate *vl,
+ unsigned flags)
+{
+ /* Always pinned */
+ return PIPE_OK;
+}
+
+static void
+radeon_drm_buffer_fence(struct pb_buffer *buf,
+ struct pipe_fence_handle *fence)
+{
+}
+
+const struct pb_vtbl radeon_drm_buffer_vtbl = {
+ radeon_drm_buffer_destroy,
+ radeon_drm_buffer_map,
+ radeon_drm_buffer_unmap,
+ radeon_drm_buffer_validate,
+ radeon_drm_buffer_fence,
+ radeon_drm_buffer_get_base_buffer,
+};
+
+
+static uint32_t radeon_domain_from_usage(unsigned usage)
+{
+ uint32_t domain = 0;
+
+ if (usage & PIPE_BUFFER_USAGE_GPU_WRITE) {
+ domain |= RADEON_GEM_DOMAIN_VRAM;
+ }
+ if (usage & PIPE_BUFFER_USAGE_PIXEL) {
+ domain |= RADEON_GEM_DOMAIN_VRAM;
+ }
+ if (usage & PIPE_BUFFER_USAGE_VERTEX) {
+ domain |= RADEON_GEM_DOMAIN_GTT;
+ }
+ if (usage & PIPE_BUFFER_USAGE_INDEX) {
+ domain |= RADEON_GEM_DOMAIN_GTT;
+ }
+
+ return domain;
+}
+
+struct pb_buffer *radeon_drm_bufmgr_create_buffer_from_handle(struct pb_manager *_mgr,
+ uint32_t handle)
+{
+ struct radeon_drm_bufmgr *mgr = radeon_drm_bufmgr(_mgr);
+ struct radeon_libdrm_winsys *rws = mgr->rws;
+ struct radeon_drm_buffer *buf;
+ struct radeon_bo *bo;
+
+ bo = radeon_bo_open(rws->bom, handle, 0,
+ 0, 0, 0);
+ if (bo == NULL)
+ return NULL;
+
+ buf = CALLOC_STRUCT(radeon_drm_buffer);
+ if (!buf) {
+ radeon_bo_unref(bo);
+ return NULL;
+ }
+
+ make_empty_list(buf);
+
+ pipe_reference_init(&buf->base.base.reference, 1);
+ buf->base.base.alignment = 0;
+ buf->base.base.usage = PIPE_BUFFER_USAGE_PIXEL;
+ buf->base.base.size = 0;
+ buf->base.vtbl = &radeon_drm_buffer_vtbl;
+ buf->mgr = mgr;
+
+ buf->bo = bo;
+
+ return &buf->base;
+}
+
+static struct pb_buffer *
+radeon_drm_bufmgr_create_buffer(struct pb_manager *_mgr,
+ pb_size size,
+ const struct pb_desc *desc)
+{
+ struct radeon_drm_bufmgr *mgr = radeon_drm_bufmgr(_mgr);
+ struct radeon_libdrm_winsys *rws = mgr->rws;
+ struct radeon_drm_buffer *buf;
+ uint32_t domain;
+
+ buf = CALLOC_STRUCT(radeon_drm_buffer);
+ if (!buf)
+ goto error1;
+
+ pipe_reference_init(&buf->base.base.reference, 1);
+ buf->base.base.alignment = desc->alignment;
+ buf->base.base.usage = desc->usage;
+ buf->base.base.size = size;
+ buf->base.vtbl = &radeon_drm_buffer_vtbl;
+ buf->mgr = mgr;
+
+ make_empty_list(buf);
+ domain = radeon_domain_from_usage(desc->usage);
+ buf->bo = radeon_bo_open(rws->bom, 0, size,
+ desc->alignment, domain, 0);
+ if (buf->bo == NULL)
+ goto error2;
+
+ return &buf->base;
+
+ error2:
+ FREE(buf);
+ error1:
+ return NULL;
+}
+
+static void
+radeon_drm_bufmgr_flush(struct pb_manager *mgr)
+{
+ /* NOP */
+}
+
+static void
+radeon_drm_bufmgr_destroy(struct pb_manager *_mgr)
+{
+ struct radeon_drm_bufmgr *mgr = radeon_drm_bufmgr(_mgr);
+ FREE(mgr);
+}
+
+struct pb_manager *
+radeon_drm_bufmgr_create(struct radeon_libdrm_winsys *rws)
+{
+ struct radeon_drm_bufmgr *mgr;
+
+ mgr = CALLOC_STRUCT(radeon_drm_bufmgr);
+ if (!mgr)
+ return NULL;
+
+ mgr->base.destroy = radeon_drm_bufmgr_destroy;
+ mgr->base.create_buffer = radeon_drm_bufmgr_create_buffer;
+ mgr->base.flush = radeon_drm_bufmgr_flush;
+
+ mgr->rws = rws;
+ make_empty_list(&mgr->buffer_map_list);
+ return &mgr->base;
+}
+
+static struct radeon_drm_buffer *get_drm_buffer(struct pb_buffer *_buf)
+{
+ struct radeon_drm_buffer *buf;
+ if (_buf->vtbl == &radeon_drm_buffer_vtbl) {
+ buf = radeon_drm_buffer(_buf);
+ } else {
+ struct pb_buffer *base_buf;
+ pb_size offset;
+ pb_get_base_buffer(_buf, &base_buf, &offset);
+
+ buf = radeon_drm_buffer(base_buf);
+ }
+ return buf;
+}
+
+boolean radeon_drm_bufmgr_get_handle(struct pb_buffer *_buf,
+ struct winsys_handle *whandle)
+{
+ int retval, fd;
+ struct drm_gem_flink flink;
+ struct radeon_drm_buffer *buf = get_drm_buffer(_buf);
+ if (whandle->type == DRM_API_HANDLE_TYPE_SHARED) {
+ if (!buf->flinked) {
+ fd = buf->mgr->rws->fd;
+ flink.handle = buf->bo->handle;
+
+ retval = ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink);
+ if (retval) {
+ return FALSE;
+ }
+
+ buf->flinked = TRUE;
+ buf->flink = flink.name;
+ }
+ whandle->handle = buf->flink;
+ } else if (whandle->type == DRM_API_HANDLE_TYPE_KMS) {
+ whandle->handle = buf->bo->handle;
+ }
+ return TRUE;
+}
+
+void radeon_drm_bufmgr_get_tiling(struct pb_buffer *_buf,
+ enum r300_buffer_tiling *microtiled,
+ enum r300_buffer_tiling *macrotiled)
+{
+ struct radeon_drm_buffer *buf = get_drm_buffer(_buf);
+ uint32_t flags = 0, pitch;
+
+ radeon_bo_get_tiling(buf->bo, &flags, &pitch);
+
+ *microtiled = R300_BUFFER_LINEAR;
+ *macrotiled = R300_BUFFER_LINEAR;
+ if (flags & RADEON_BO_FLAGS_MICRO_TILE)
+ *microtiled = R300_BUFFER_TILED;
+
+ if (flags & RADEON_BO_FLAGS_MACRO_TILE)
+ *macrotiled = R300_BUFFER_TILED;
+}
+
+void radeon_drm_bufmgr_set_tiling(struct pb_buffer *_buf,
+ enum r300_buffer_tiling microtiled,
+ enum r300_buffer_tiling macrotiled,
+ uint32_t pitch)
+{
+ struct radeon_drm_buffer *buf = get_drm_buffer(_buf);
+ uint32_t flags = 0, old_flags, old_pitch;
+ if (microtiled == R300_BUFFER_TILED)
+ flags |= RADEON_BO_FLAGS_MICRO_TILE;
+/* XXX Remove this ifdef when libdrm version 2.4.19 becomes mandatory. */
+#ifdef RADEON_BO_FLAGS_MICRO_TILE_SQUARE
+ else if (microtiled == R300_BUFFER_SQUARETILED)
+ flags |= RADEON_BO_FLAGS_MICRO_TILE_SQUARE;
+#endif
+ if (macrotiled == R300_BUFFER_TILED)
+ flags |= RADEON_BO_FLAGS_MACRO_TILE;
+
+ radeon_bo_get_tiling(buf->bo, &old_flags, &old_pitch);
+
+ if (flags != old_flags || pitch != old_pitch) {
+ /* Tiling determines how DRM treats the buffer data.
+ * We must flush CS when changing it if the buffer is referenced. */
+ if (radeon_bo_is_referenced_by_cs(buf->bo, buf->mgr->rws->cs)) {
+ buf->mgr->rws->flush_cb(buf->mgr->rws->flush_data);
+ }
+ }
+ radeon_bo_set_tiling(buf->bo, flags, pitch);
+
+}
+
+boolean radeon_drm_bufmgr_add_buffer(struct pb_buffer *_buf,
+ uint32_t rd, uint32_t wd)
+{
+ struct radeon_drm_buffer *buf = get_drm_buffer(_buf);
+ radeon_cs_space_add_persistent_bo(buf->mgr->rws->cs, buf->bo,
+ rd, wd);
+ return TRUE;
+}
+
+void radeon_drm_bufmgr_write_reloc(struct pb_buffer *_buf,
+ uint32_t rd, uint32_t wd,
+ uint32_t flags)
+{
+ struct radeon_drm_buffer *buf = get_drm_buffer(_buf);
+ int retval;
+
+ retval = radeon_cs_write_reloc(buf->mgr->rws->cs,
+ buf->bo, rd, wd, flags);
+ if (retval) {
+ debug_printf("radeon: Relocation of %p (%d, %d, %d) failed!\n",
+ buf, rd, wd, flags);
+ }
+}
+
+boolean radeon_drm_bufmgr_is_buffer_referenced(struct pb_buffer *_buf)
+{
+ struct radeon_drm_buffer *buf = get_drm_buffer(_buf);
+ uint32_t domain;
+
+ return (radeon_bo_is_referenced_by_cs(buf->bo, buf->mgr->rws->cs) ||
+ radeon_bo_is_busy(buf->bo, &domain));
+}
+
+
+void radeon_drm_bufmgr_flush_maps(struct pb_manager *_mgr)
+{
+ struct radeon_drm_bufmgr *mgr = radeon_drm_bufmgr(_mgr);
+ struct radeon_drm_buffer *rpb, *t_rpb;
+
+ foreach_s(rpb, t_rpb, &mgr->buffer_map_list) {
+ radeon_bo_unmap(rpb->bo);
+ rpb->bo->ptr = NULL;
+ remove_from_list(rpb);
+ }
+
+ make_empty_list(&mgr->buffer_map_list);
+}
diff --git a/src/gallium/winsys/radeon/drm/radeon_r300.c b/src/gallium/winsys/radeon/drm/radeon_r300.c
new file mode 100644
index 0000000000..935c1d84d0
--- /dev/null
+++ b/src/gallium/winsys/radeon/drm/radeon_r300.c
@@ -0,0 +1,358 @@
+/*
+ * Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "radeon_r300.h"
+#include "radeon_buffer.h"
+
+#include "radeon_bo_gem.h"
+#include "radeon_cs_gem.h"
+#include "state_tracker/drm_api.h"
+
+static struct r300_winsys_buffer *
+radeon_r300_winsys_buffer_create(struct r300_winsys_screen *rws,
+ unsigned alignment,
+ unsigned usage,
+ unsigned size)
+{
+ struct radeon_libdrm_winsys *ws = radeon_winsys_screen(rws);
+ struct pb_desc desc;
+ struct pb_manager *provider;
+ struct pb_buffer *buffer;
+
+ memset(&desc, 0, sizeof(desc));
+ desc.alignment = alignment;
+ desc.usage = usage;
+
+ if (usage & PIPE_BUFFER_USAGE_CONSTANT)
+ provider = ws->mman;
+ else if ((usage & PIPE_BUFFER_USAGE_VERTEX) ||
+ (usage & PIPE_BUFFER_USAGE_INDEX))
+ provider = ws->cman;
+ else
+ provider = ws->kman;
+ buffer = provider->create_buffer(provider, size, &desc);
+ if (!buffer)
+ return NULL;
+
+ return radeon_libdrm_winsys_buffer(buffer);
+}
+
+static void radeon_r300_winsys_buffer_destroy(struct r300_winsys_buffer *buf)
+{
+ struct pb_buffer *_buf = radeon_pb_buffer(buf);
+
+ pb_destroy(_buf);
+}
+static void radeon_r300_winsys_buffer_set_tiling(struct r300_winsys_screen *rws,
+ struct r300_winsys_buffer *buf,
+ uint32_t pitch,
+ enum r300_buffer_tiling microtiled,
+ enum r300_buffer_tiling macrotiled)
+{
+ struct pb_buffer *_buf = radeon_pb_buffer(buf);
+ radeon_drm_bufmgr_set_tiling(_buf, microtiled, macrotiled, pitch);
+}
+
+static void radeon_r300_winsys_buffer_get_tiling(struct r300_winsys_screen *rws,
+ struct r300_winsys_buffer *buf,
+ enum r300_buffer_tiling *microtiled,
+ enum r300_buffer_tiling *macrotiled)
+{
+ struct pb_buffer *_buf = radeon_pb_buffer(buf);
+ radeon_drm_bufmgr_get_tiling(_buf, microtiled, macrotiled);
+}
+
+static void *radeon_r300_winsys_buffer_map(struct r300_winsys_screen *ws,
+ struct r300_winsys_buffer *buf,
+ unsigned usage)
+{
+ struct pb_buffer *_buf = radeon_pb_buffer(buf);
+
+ return pb_map(_buf, usage);
+}
+
+static void radeon_r300_winsys_buffer_unmap(struct r300_winsys_screen *ws,
+ struct r300_winsys_buffer *buf)
+{
+ struct pb_buffer *_buf = radeon_pb_buffer(buf);
+
+ pb_unmap(_buf);
+}
+
+static void radeon_r300_winsys_buffer_reference(struct r300_winsys_screen *rws,
+ struct r300_winsys_buffer **pdst,
+ struct r300_winsys_buffer *src)
+{
+ struct pb_buffer *_src = radeon_pb_buffer(src);
+ struct pb_buffer *_dst = radeon_pb_buffer(*pdst);
+
+ pb_reference(&_dst, _src);
+
+ *pdst = radeon_libdrm_winsys_buffer(_dst);
+}
+
+static boolean radeon_r300_winsys_is_buffer_referenced(struct r300_winsys_screen *rws,
+ struct r300_winsys_buffer *buf)
+{
+ struct pb_buffer *_buf = radeon_pb_buffer(buf);
+
+ return radeon_drm_bufmgr_is_buffer_referenced(_buf);
+}
+
+static struct r300_winsys_buffer *radeon_r300_winsys_buffer_from_handle(struct r300_winsys_screen *rws,
+ struct pipe_screen *screen,
+ struct winsys_handle *whandle,
+ unsigned *stride)
+{
+ struct radeon_libdrm_winsys *ws = radeon_winsys_screen(rws);
+ struct pb_buffer *_buf;
+
+ _buf = radeon_drm_bufmgr_create_buffer_from_handle(ws->kman, whandle->handle);
+ *stride = whandle->stride;
+ return radeon_libdrm_winsys_buffer(_buf);
+}
+
+static boolean radeon_r300_winsys_buffer_get_handle(struct r300_winsys_screen *rws,
+ struct r300_winsys_buffer *buffer,
+ unsigned stride,
+ struct winsys_handle *whandle)
+{
+ struct pb_buffer *_buf = radeon_pb_buffer(buffer);
+ boolean ret;
+ ret = radeon_drm_bufmgr_get_handle(_buf, whandle);
+ if (ret)
+ whandle->stride = stride;
+ return ret;
+}
+
+static void radeon_set_flush_cb(struct r300_winsys_screen *rws,
+ void (*flush_cb)(void *),
+ void *data)
+{
+ struct radeon_libdrm_winsys *ws = radeon_winsys_screen(rws);
+ ws->flush_cb = flush_cb;
+ ws->flush_data = data;
+ radeon_cs_space_set_flush(ws->cs, flush_cb, data);
+}
+
+static boolean radeon_add_buffer(struct r300_winsys_screen *rws,
+ struct r300_winsys_buffer *buf,
+ uint32_t rd,
+ uint32_t wd)
+{
+ struct pb_buffer *_buf = radeon_pb_buffer(buf);
+
+ return radeon_drm_bufmgr_add_buffer(_buf, rd, wd);
+}
+
+static boolean radeon_validate(struct r300_winsys_screen *rws)
+{
+ struct radeon_libdrm_winsys *ws = radeon_winsys_screen(rws);
+ if (radeon_cs_space_check(ws->cs) < 0) {
+ return FALSE;
+ }
+
+ /* Things are fine, we can proceed as normal. */
+ return TRUE;
+}
+
+static boolean radeon_check_cs(struct r300_winsys_screen *rws, int size)
+{
+ struct radeon_libdrm_winsys *ws = radeon_winsys_screen(rws);
+ struct radeon_cs *cs = ws->cs;
+
+ return radeon_validate(rws) && cs->cdw + size <= cs->ndw;
+}
+
+static void radeon_begin_cs(struct r300_winsys_screen *rws,
+ int size,
+ const char* file,
+ const char* function,
+ int line)
+{
+ struct radeon_libdrm_winsys *ws = radeon_winsys_screen(rws);
+ radeon_cs_begin(ws->cs, size, file, function, line);
+}
+
+static void radeon_write_cs_dword(struct r300_winsys_screen *rws,
+ uint32_t dword)
+{
+ struct radeon_libdrm_winsys *ws = radeon_winsys_screen(rws);
+ radeon_cs_write_dword(ws->cs, dword);
+}
+
+static void radeon_write_cs_reloc(struct r300_winsys_screen *rws,
+ struct r300_winsys_buffer *buf,
+ uint32_t rd,
+ uint32_t wd,
+ uint32_t flags)
+{
+ struct pb_buffer *_buf = radeon_pb_buffer(buf);
+ radeon_drm_bufmgr_write_reloc(_buf, rd, wd, flags);
+}
+
+static void radeon_reset_bos(struct r300_winsys_screen *rws)
+{
+ struct radeon_libdrm_winsys *ws = radeon_winsys_screen(rws);
+ radeon_cs_space_reset_bos(ws->cs);
+}
+
+static void radeon_end_cs(struct r300_winsys_screen *rws,
+ const char* file,
+ const char* function,
+ int line)
+{
+ struct radeon_libdrm_winsys *ws = radeon_winsys_screen(rws);
+ radeon_cs_end(ws->cs, file, function, line);
+}
+
+static void radeon_flush_cs(struct r300_winsys_screen *rws)
+{
+ struct radeon_libdrm_winsys *ws = radeon_winsys_screen(rws);
+ int retval;
+
+ /* Don't flush a zero-sized CS. */
+ if (!ws->cs->cdw) {
+ return;
+ }
+
+ radeon_drm_bufmgr_flush_maps(ws->kman);
+ /* Emit the CS. */
+ retval = radeon_cs_emit(ws->cs);
+ if (retval) {
+ debug_printf("radeon: Bad CS, dumping...\n");
+ radeon_cs_print(ws->cs, stderr);
+ }
+
+ /* Reset CS.
+ * Someday, when we care about performance, we should really find a way
+ * to rotate between two or three CS objects so that the GPU can be
+ * spinning through one CS while another one is being filled. */
+ radeon_cs_erase(ws->cs);
+}
+
+static uint32_t radeon_get_value(struct r300_winsys_screen *rws,
+ enum r300_value_id id)
+{
+ struct radeon_libdrm_winsys *ws = (struct radeon_libdrm_winsys *)rws;
+
+ switch(id) {
+ case R300_VID_PCI_ID:
+ return ws->pci_id;
+ case R300_VID_GB_PIPES:
+ return ws->gb_pipes;
+ case R300_VID_Z_PIPES:
+ return ws->z_pipes;
+ case R300_VID_SQUARE_TILING_SUPPORT:
+ return ws->squaretiling;
+ }
+ return 0;
+}
+
+static void
+radeon_winsys_destroy(struct r300_winsys_screen *rws)
+{
+ struct radeon_libdrm_winsys *ws = (struct radeon_libdrm_winsys *)rws;
+ radeon_cs_destroy(ws->cs);
+
+ ws->cman->destroy(ws->cman);
+ ws->kman->destroy(ws->kman);
+ ws->mman->destroy(ws->mman);
+
+ radeon_bo_manager_gem_dtor(ws->bom);
+ radeon_cs_manager_gem_dtor(ws->csm);
+}
+
+boolean
+radeon_setup_winsys(int fd, struct radeon_libdrm_winsys* ws)
+{
+
+ ws->csm = radeon_cs_manager_gem_ctor(fd);
+ if (!ws->csm)
+ goto fail;
+ ws->bom = radeon_bo_manager_gem_ctor(fd);
+ if (!ws->bom)
+ goto fail;
+ ws->kman = radeon_drm_bufmgr_create(ws);
+ if (!ws->kman)
+ goto fail;
+
+ ws->cman = pb_cache_manager_create(ws->kman, 100000);
+ if (!ws->cman)
+ goto fail;
+
+ ws->mman = pb_malloc_bufmgr_create();
+ if (!ws->mman)
+ goto fail;
+
+ /* Size limit on IBs is 64 kibibytes. */
+ ws->cs = radeon_cs_create(ws->csm, 1024 * 64 / 4);
+ if (!ws->cs)
+ goto fail;
+ radeon_cs_set_limit(ws->cs,
+ RADEON_GEM_DOMAIN_GTT, ws->gart_size);
+ radeon_cs_set_limit(ws->cs,
+ RADEON_GEM_DOMAIN_VRAM, ws->vram_size);
+
+ ws->base.add_buffer = radeon_add_buffer;
+ ws->base.validate = radeon_validate;
+ ws->base.destroy = radeon_winsys_destroy;
+ ws->base.check_cs = radeon_check_cs;
+ ws->base.begin_cs = radeon_begin_cs;
+ ws->base.write_cs_dword = radeon_write_cs_dword;
+ ws->base.write_cs_reloc = radeon_write_cs_reloc;
+ ws->base.end_cs = radeon_end_cs;
+ ws->base.flush_cs = radeon_flush_cs;
+ ws->base.reset_bos = radeon_reset_bos;
+ ws->base.set_flush_cb = radeon_set_flush_cb;
+ ws->base.get_value = radeon_get_value;
+
+ ws->base.buffer_create = radeon_r300_winsys_buffer_create;
+ ws->base.buffer_destroy = radeon_r300_winsys_buffer_destroy;
+ ws->base.buffer_set_tiling = radeon_r300_winsys_buffer_set_tiling;
+ ws->base.buffer_get_tiling = radeon_r300_winsys_buffer_get_tiling;
+ ws->base.buffer_map = radeon_r300_winsys_buffer_map;
+ ws->base.buffer_unmap = radeon_r300_winsys_buffer_unmap;
+ ws->base.buffer_reference = radeon_r300_winsys_buffer_reference;
+ ws->base.buffer_from_handle = radeon_r300_winsys_buffer_from_handle;
+ ws->base.buffer_get_handle = radeon_r300_winsys_buffer_get_handle;
+ ws->base.is_buffer_referenced = radeon_r300_winsys_is_buffer_referenced;
+ return TRUE;
+
+fail:
+ if (ws->csm)
+ radeon_cs_manager_gem_dtor(ws->csm);
+
+ if (ws->bom)
+ radeon_bo_manager_gem_dtor(ws->bom);
+
+ if (ws->cman)
+ ws->cman->destroy(ws->cman);
+ if (ws->kman)
+ ws->kman->destroy(ws->kman);
+ if (ws->mman)
+ ws->mman->destroy(ws->mman);
+
+ if (ws->cs)
+ radeon_cs_destroy(ws->cs);
+ return FALSE;
+}
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.h b/src/gallium/winsys/radeon/drm/radeon_r300.h
index e655dc32c8..2703464ad8 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_r300.h
+++ b/src/gallium/winsys/radeon/drm/radeon_r300.h
@@ -25,6 +25,6 @@
#include "radeon_winsys.h"
-void radeon_setup_winsys(int fd, struct radeon_winsys* winsys);
+boolean radeon_setup_winsys(int fd, struct radeon_libdrm_winsys* winsys);
#endif /* RADEON_R300_H */
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.h b/src/gallium/winsys/radeon/drm/radeon_winsys.h
index f776e2d900..4260dbaad7 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_buffer.h
+++ b/src/gallium/winsys/radeon/drm/radeon_winsys.h
@@ -1,5 +1,5 @@
/*
- * Copyright © 2008 Jérôme Glisse
+ * Copyright © 2009 Corbin Simpson
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining
@@ -25,53 +25,62 @@
*/
/*
* Authors:
- * Jérôme Glisse <glisse@freedesktop.org>
+ * Corbin Simpson <MostAwesomeDude@gmail.com>
*/
-#ifndef RADEON_BUFFER_H
-#define RADEON_BUFFER_H
+#ifndef RADEON_WINSYS_H
+#define RADEON_WINSYS_H
-#include "pipebuffer/pb_buffer.h"
+#include "r300_winsys.h"
-#include "radeon_bo.h"
-#include "radeon_cs.h"
+struct radeon_libdrm_winsys {
+ /* Parent class. */
+ struct r300_winsys_screen base;
-#include "radeon_winsys.h"
+ struct pb_manager *kman;
-struct radeon_pipe_buffer {
- struct pipe_buffer base;
- /* Pointer to GPU-backed BO. */
- struct radeon_bo *bo;
- /* Pointer to fallback PB buffer. */
- struct pb_buffer *pb;
- boolean flinked;
- uint32_t flink;
-};
+ struct pb_manager *cman;
+
+ struct pb_manager *mman;
+
+ /* PCI ID */
+ uint32_t pci_id;
+
+ /* GB pipe count */
+ uint32_t gb_pipes;
+
+ /* Z pipe count (rv530 only) */
+ uint32_t z_pipes;
-#define RADEON_MAX_BOS 24
+ /* GART size. */
+ uint32_t gart_size;
+
+ /* VRAM size. */
+ uint32_t vram_size;
+
+ /* Square tiling support. */
+ boolean squaretiling;
-struct radeon_winsys_priv {
/* DRM FD */
int fd;
/* Radeon BO manager. */
- struct radeon_bo_manager* bom;
+ struct radeon_bo_manager *bom;
/* Radeon CS manager. */
- struct radeon_cs_manager* csm;
+ struct radeon_cs_manager *csm;
/* Current CS. */
- struct radeon_cs* cs;
+ struct radeon_cs *cs;
/* Flush CB */
void (*flush_cb)(void *);
void *flush_data;
};
-struct radeon_winsys* radeon_pipe_winsys(int fb);
-#if 0
-struct pipe_surface *radeon_surface_from_handle(struct radeon_context *radeon_context,
- uint32_t handle,
- enum pipe_format format,
- int w, int h, int pitch);
-#endif
+static INLINE struct radeon_libdrm_winsys *
+radeon_winsys_screen(struct r300_winsys_screen *base)
+{
+ return (struct radeon_libdrm_winsys *)base;
+}
+
#endif
diff --git a/src/gallium/winsys/drm/vmware/core/Makefile b/src/gallium/winsys/svga/drm/Makefile
index a52957c1a5..c2f59e01b0 100644
--- a/src/gallium/winsys/drm/vmware/core/Makefile
+++ b/src/gallium/winsys/svga/drm/Makefile
@@ -1,4 +1,4 @@
-TOP = ../../../../../..
+TOP = ../../../../..
include $(TOP)/configs/current
LIBNAME = svgadrm
@@ -17,14 +17,6 @@ C_SOURCES = \
LIBRARY_INCLUDES = \
-I$(TOP)/src/gallium/drivers/svga \
-I$(TOP)/src/gallium/drivers/svga/include \
- -I$(GALLIUM)/src/mesa/drivers/dri/common \
- -I$(GALLIUM)/include \
- -I$(GALLIUM)/include/GL/internal \
- -I$(GALLIUM)/src/mesa \
- -I$(GALLIUM)/src/mesa/main \
- -I$(GALLIUM)/src/mesa/glapi \
- -I$(GALLIUM)/src/egl/main \
- -I$(GALLIUM)/src/egl/drivers/dri \
$(shell pkg-config libdrm --cflags-only-I)
LIBRARY_DEFINES = \
@@ -32,4 +24,4 @@ LIBRARY_DEFINES = \
-DHAVE_STDINT_H -D_FILE_OFFSET_BITS=64 \
$(shell pkg-config libdrm --cflags-only-other)
-include ../../../../Makefile.template
+include ../../../Makefile.template
diff --git a/src/gallium/winsys/drm/vmware/core/SConscript b/src/gallium/winsys/svga/drm/SConscript
index edaf9458be..edaf9458be 100644
--- a/src/gallium/winsys/drm/vmware/core/SConscript
+++ b/src/gallium/winsys/svga/drm/SConscript
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_buffer.c b/src/gallium/winsys/svga/drm/vmw_buffer.c
index eca174a6c5..eca174a6c5 100644
--- a/src/gallium/winsys/drm/vmware/core/vmw_buffer.c
+++ b/src/gallium/winsys/svga/drm/vmw_buffer.c
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_buffer.h b/src/gallium/winsys/svga/drm/vmw_buffer.h
index 41fb4476da..41fb4476da 100644
--- a/src/gallium/winsys/drm/vmware/core/vmw_buffer.h
+++ b/src/gallium/winsys/svga/drm/vmw_buffer.h
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_context.c b/src/gallium/winsys/svga/drm/vmw_context.c
index 90ffc4868f..90ffc4868f 100644
--- a/src/gallium/winsys/drm/vmware/core/vmw_context.c
+++ b/src/gallium/winsys/svga/drm/vmw_context.c
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_context.h b/src/gallium/winsys/svga/drm/vmw_context.h
index d4884d24e9..d4884d24e9 100644
--- a/src/gallium/winsys/drm/vmware/core/vmw_context.h
+++ b/src/gallium/winsys/svga/drm/vmw_context.h
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_fence.c b/src/gallium/winsys/svga/drm/vmw_fence.c
index 873dd51166..873dd51166 100644
--- a/src/gallium/winsys/drm/vmware/core/vmw_fence.c
+++ b/src/gallium/winsys/svga/drm/vmw_fence.c
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_fence.h b/src/gallium/winsys/svga/drm/vmw_fence.h
index 5357b4f61d..5357b4f61d 100644
--- a/src/gallium/winsys/drm/vmware/core/vmw_fence.h
+++ b/src/gallium/winsys/svga/drm/vmw_fence.h
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_screen.c b/src/gallium/winsys/svga/drm/vmw_screen.c
index 6cc9b38293..6cc9b38293 100644
--- a/src/gallium/winsys/drm/vmware/core/vmw_screen.c
+++ b/src/gallium/winsys/svga/drm/vmw_screen.c
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_screen.h b/src/gallium/winsys/svga/drm/vmw_screen.h
index d3f2c2c7f5..d3f2c2c7f5 100644
--- a/src/gallium/winsys/drm/vmware/core/vmw_screen.h
+++ b/src/gallium/winsys/svga/drm/vmw_screen.h
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_screen_dri.c b/src/gallium/winsys/svga/drm/vmw_screen_dri.c
index a7c6e88b9e..e8ebe9ac89 100644
--- a/src/gallium/winsys/drm/vmware/core/vmw_screen_dri.c
+++ b/src/gallium/winsys/svga/drm/vmw_screen_dri.c
@@ -39,11 +39,21 @@
#include <state_tracker/dri1_api.h>
#include <state_tracker/drm_api.h>
-#include <vmwgfx_drm.h>
+#include "vmwgfx_drm.h"
#include <xf86drm.h>
#include <stdio.h>
+static struct svga_winsys_surface *
+vmw_drm_surface_from_handle(struct svga_winsys_screen *sws,
+ struct winsys_handle *whandle,
+ SVGA3dSurfaceFormat *format);
+static boolean
+vmw_drm_surface_get_handle(struct svga_winsys_screen *sws,
+ struct svga_winsys_surface *surface,
+ unsigned stride,
+ struct winsys_handle *whandle);
+
static struct dri1_api dri1_api_hooks;
static struct dri1_api_version ddx_required = { 0, 1, 0 };
static struct dri1_api_version ddx_compat = { 0, 0, 0 };
@@ -129,7 +139,12 @@ vmw_drm_create_screen(struct drm_api *drm_api,
&drm_compat, "use old scanout field (not a error)"))
use_old_scanout_flag = TRUE;
dri1->api = &dri1_api_hooks;
+#if 0
break;
+#else
+ assert(!"No dri 1 support for now\n");
+ return NULL;
+#endif
default:
return NULL;
}
@@ -139,6 +154,10 @@ vmw_drm_create_screen(struct drm_api *drm_api,
if (!vws)
goto out_no_vws;
+ /* XXX do this properly */
+ vws->base.surface_from_handle = vmw_drm_surface_from_handle;
+ vws->base.surface_get_handle = vmw_drm_surface_get_handle;
+
screen = svga_screen_create( &vws->base );
if (!screen)
goto out_no_screen;
@@ -200,6 +219,7 @@ vmw_dri1_present_locked(struct pipe_context *locked_pipe,
const struct drm_clip_rect *bbox,
struct pipe_fence_handle **p_fence)
{
+#if 0
struct svga_winsys_surface *srf =
svga_screen_texture_get_winsys_surface(surf->texture);
struct vmw_svga_winsys_surface *vsrf = vmw_svga_winsys_surface(srf);
@@ -246,21 +266,19 @@ vmw_dri1_present_locked(struct pipe_context *locked_pipe,
*p_fence = (visible) ? vmw_pipe_fence(fence_seq) : NULL;
vmw_svga_winsys_surface_reference(&vsrf, NULL);
+#else
+ assert(!"No dri 1 support for now\n");
+#endif
}
-static struct pipe_texture *
-vmw_drm_texture_from_handle(struct drm_api *drm_api,
- struct pipe_screen *screen,
- struct pipe_texture *templat,
- const char *name,
- unsigned stride,
- unsigned handle)
+static struct svga_winsys_surface *
+vmw_drm_surface_from_handle(struct svga_winsys_screen *sws,
+ struct winsys_handle *whandle,
+ SVGA3dSurfaceFormat *format)
{
struct vmw_svga_winsys_surface *vsrf;
struct svga_winsys_surface *ssrf;
- struct vmw_winsys_screen *vws =
- vmw_winsys_screen(svga_winsys_screen(screen));
- struct pipe_texture *tex;
+ struct vmw_winsys_screen *vws = vmw_winsys_screen(sws);
union drm_vmw_surface_reference_arg arg;
struct drm_vmw_surface_arg *req = &arg.req;
struct drm_vmw_surface_create_req *rep = &arg.rep;
@@ -273,7 +291,7 @@ vmw_drm_texture_from_handle(struct drm_api *drm_api,
*/
memset(&arg, 0, sizeof(arg));
- req->sid = handle;
+ req->sid = whandle->handle;
ret = drmCommandWriteRead(vws->ioctl.drm_fd, DRM_VMW_REF_SURFACE,
&arg, sizeof(arg));
@@ -281,14 +299,14 @@ vmw_drm_texture_from_handle(struct drm_api *drm_api,
if (ret) {
fprintf(stderr, "Failed referencing shared surface. SID %d.\n"
"Error %d (%s).\n",
- handle, ret, strerror(-ret));
+ whandle->handle, ret, strerror(-ret));
return NULL;
}
if (rep->mip_levels[0] != 1) {
fprintf(stderr, "Incorrect number of mipmap levels on shared surface."
" SID %d, levels %d\n",
- handle, rep->mip_levels[0]);
+ whandle->handle, rep->mip_levels[0]);
goto out_mip;
}
@@ -296,7 +314,7 @@ vmw_drm_texture_from_handle(struct drm_api *drm_api,
if (rep->mip_levels[i] != 0) {
fprintf(stderr, "Incorrect number of faces levels on shared surface."
" SID %d, face %d present.\n",
- handle, i);
+ whandle->handle, i);
goto out_mip;
}
}
@@ -308,38 +326,32 @@ vmw_drm_texture_from_handle(struct drm_api *drm_api,
pipe_reference_init(&vsrf->refcnt, 1);
p_atomic_set(&vsrf->validated, 0);
vsrf->screen = vws;
- vsrf->sid = handle;
+ vsrf->sid = whandle->handle;
ssrf = svga_winsys_surface(vsrf);
- tex = svga_screen_texture_wrap_surface(screen, templat, rep->format, ssrf);
- if (!tex)
- vmw_svga_winsys_surface_reference(&vsrf, NULL);
+ *format = rep->format;
+
+ return ssrf;
- return tex;
- out_mip:
- vmw_ioctl_surface_destroy(vws, handle);
+out_mip:
+ vmw_ioctl_surface_destroy(vws, whandle->handle);
return NULL;
}
static boolean
-vmw_drm_handle_from_texture(struct drm_api *drm_api,
- struct pipe_screen *screen,
- struct pipe_texture *texture,
- unsigned *stride,
- unsigned *handle)
+vmw_drm_surface_get_handle(struct svga_winsys_screen *sws,
+ struct svga_winsys_surface *surface,
+ unsigned stride,
+ struct winsys_handle *whandle)
{
- struct svga_winsys_surface *surface =
- svga_screen_texture_get_winsys_surface(texture);
struct vmw_svga_winsys_surface *vsrf;
if (!surface)
return FALSE;
vsrf = vmw_svga_winsys_surface(surface);
- *handle = vsrf->sid;
- *stride = util_format_get_nblocksx(texture->format, texture->width0) *
- util_format_get_blocksize(texture->format);
+ whandle->handle = vsrf->sid;
+ whandle->stride = stride;
- vmw_svga_winsys_surface_reference(&vsrf, NULL);
return TRUE;
}
@@ -353,9 +365,6 @@ static struct drm_api vmw_drm_api_hooks = {
.name = "vmwgfx",
.driver_name = "vmwgfx",
.create_screen = vmw_drm_create_screen,
- .texture_from_shared_handle = vmw_drm_texture_from_handle,
- .shared_handle_from_texture = vmw_drm_handle_from_texture,
- .local_handle_from_texture = vmw_drm_handle_from_texture,
};
struct drm_api* drm_api_create()
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_screen_ioctl.c b/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c
index 5d81fa8c4a..5d81fa8c4a 100644
--- a/src/gallium/winsys/drm/vmware/core/vmw_screen_ioctl.c
+++ b/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_screen_pools.c b/src/gallium/winsys/svga/drm/vmw_screen_pools.c
index b9823d7857..b9823d7857 100644
--- a/src/gallium/winsys/drm/vmware/core/vmw_screen_pools.c
+++ b/src/gallium/winsys/svga/drm/vmw_screen_pools.c
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_screen_svga.c b/src/gallium/winsys/svga/drm/vmw_screen_svga.c
index 2b4e80f003..2b4e80f003 100644
--- a/src/gallium/winsys/drm/vmware/core/vmw_screen_svga.c
+++ b/src/gallium/winsys/svga/drm/vmw_screen_svga.c
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_surface.c b/src/gallium/winsys/svga/drm/vmw_surface.c
index 5f1b9ad577..5f1b9ad577 100644
--- a/src/gallium/winsys/drm/vmware/core/vmw_surface.c
+++ b/src/gallium/winsys/svga/drm/vmw_surface.c
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_surface.h b/src/gallium/winsys/svga/drm/vmw_surface.h
index 3d61595c28..3d61595c28 100644
--- a/src/gallium/winsys/drm/vmware/core/vmw_surface.h
+++ b/src/gallium/winsys/svga/drm/vmw_surface.h
diff --git a/src/gallium/winsys/drm/vmware/core/vmwgfx_drm.h b/src/gallium/winsys/svga/drm/vmwgfx_drm.h
index 47914bdb71..47914bdb71 100644
--- a/src/gallium/winsys/drm/vmware/core/vmwgfx_drm.h
+++ b/src/gallium/winsys/svga/drm/vmwgfx_drm.h
diff --git a/src/gallium/winsys/drm/i965/Makefile b/src/gallium/winsys/sw/Makefile
index d8feef6824..e9182ea5b1 100644
--- a/src/gallium/winsys/drm/i965/Makefile
+++ b/src/gallium/winsys/sw/Makefile
@@ -1,8 +1,8 @@
-# src/gallium/winsys/drm/intel/Makefile
-TOP = ../../../../..
+# src/gallium/winsys/sw/Makefile
+TOP = ../../../..
include $(TOP)/configs/current
-SUBDIRS = gem $(GALLIUM_STATE_TRACKERS_DIRS)
+SUBDIRS = null wrapper
default install clean:
@for dir in $(SUBDIRS) ; do \
diff --git a/src/gallium/winsys/sw/dri/Makefile b/src/gallium/winsys/sw/dri/Makefile
new file mode 100644
index 0000000000..a3fca6be88
--- /dev/null
+++ b/src/gallium/winsys/sw/dri/Makefile
@@ -0,0 +1,13 @@
+TOP = ../../../../..
+include $(TOP)/configs/current
+
+LIBNAME = swdri
+
+LIBRARY_INCLUDES =
+
+LIBRARY_DEFINES =
+
+C_SOURCES = \
+ dri_sw_winsys.c
+
+include ../../../Makefile.template
diff --git a/src/gallium/winsys/sw/dri/SConscript b/src/gallium/winsys/sw/dri/SConscript
new file mode 100644
index 0000000000..b255d725f9
--- /dev/null
+++ b/src/gallium/winsys/sw/dri/SConscript
@@ -0,0 +1,23 @@
+#######################################################################
+# SConscript for xlib winsys
+
+
+Import('*')
+
+if env['platform'] == 'linux':
+
+ env = env.Clone()
+
+ env.Append(CPPPATH = [
+ '#/src/gallium/include',
+ '#/src/gallium/auxiliary',
+ '#/src/gallium/drivers',
+ ])
+
+ ws_dri = env.ConvenienceLibrary(
+ target = 'ws_dri',
+ source = [
+ 'dri_sw_winsys.c',
+ ]
+ )
+ Export('ws_dri')
diff --git a/src/gallium/winsys/sw/dri/dri_sw_winsys.c b/src/gallium/winsys/sw/dri/dri_sw_winsys.c
new file mode 100644
index 0000000000..870c6afc12
--- /dev/null
+++ b/src/gallium/winsys/sw/dri/dri_sw_winsys.c
@@ -0,0 +1,225 @@
+/**************************************************************************
+ *
+ * Copyright 2009, VMware, Inc.
+ * All Rights Reserved.
+ * Copyright 2010 George Sapountzis <gsapountzis@gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#include "pipe/p_compiler.h"
+#include "pipe/p_format.h"
+#include "util/u_inlines.h"
+#include "util/u_format.h"
+#include "util/u_math.h"
+#include "util/u_memory.h"
+
+#include "state_tracker/sw_winsys.h"
+#include "dri_sw_winsys.h"
+
+
+struct dri_sw_displaytarget
+{
+ enum pipe_format format;
+ unsigned width;
+ unsigned height;
+ unsigned stride;
+
+ void *data;
+ void *mapped;
+};
+
+struct dri_sw_winsys
+{
+ struct sw_winsys base;
+
+ struct drisw_loader_funcs *lf;
+};
+
+static INLINE struct dri_sw_displaytarget *
+dri_sw_displaytarget( struct sw_displaytarget *dt )
+{
+ return (struct dri_sw_displaytarget *)dt;
+}
+
+static INLINE struct dri_sw_winsys *
+dri_sw_winsys( struct sw_winsys *ws )
+{
+ return (struct dri_sw_winsys *)ws;
+}
+
+
+static boolean
+dri_sw_is_displaytarget_format_supported( struct sw_winsys *ws,
+ unsigned tex_usage,
+ enum pipe_format format )
+{
+ /* TODO: check visuals or other sensible thing here */
+ return TRUE;
+}
+
+static struct sw_displaytarget *
+dri_sw_displaytarget_create(struct sw_winsys *winsys,
+ unsigned tex_usage,
+ enum pipe_format format,
+ unsigned width, unsigned height,
+ unsigned alignment,
+ unsigned *stride)
+{
+ struct dri_sw_displaytarget *dri_sw_dt;
+ unsigned nblocksy, size, format_stride;
+
+ dri_sw_dt = CALLOC_STRUCT(dri_sw_displaytarget);
+ if(!dri_sw_dt)
+ goto no_dt;
+
+ dri_sw_dt->format = format;
+ dri_sw_dt->width = width;
+ dri_sw_dt->height = height;
+
+ format_stride = util_format_get_stride(format, width);
+ dri_sw_dt->stride = align(format_stride, alignment);
+
+ nblocksy = util_format_get_nblocksy(format, height);
+ size = dri_sw_dt->stride * nblocksy;
+
+ dri_sw_dt->data = align_malloc(size, alignment);
+ if(!dri_sw_dt->data)
+ goto no_data;
+
+ *stride = dri_sw_dt->stride;
+ return (struct sw_displaytarget *)dri_sw_dt;
+
+no_data:
+ FREE(dri_sw_dt);
+no_dt:
+ return NULL;
+}
+
+static void
+dri_sw_displaytarget_destroy(struct sw_winsys *ws,
+ struct sw_displaytarget *dt)
+{
+ struct dri_sw_displaytarget *dri_sw_dt = dri_sw_displaytarget(dt);
+
+ if (dri_sw_dt->data) {
+ FREE(dri_sw_dt->data);
+ }
+
+ FREE(dri_sw_dt);
+}
+
+static void *
+dri_sw_displaytarget_map(struct sw_winsys *ws,
+ struct sw_displaytarget *dt,
+ unsigned flags)
+{
+ struct dri_sw_displaytarget *dri_sw_dt = dri_sw_displaytarget(dt);
+ dri_sw_dt->mapped = dri_sw_dt->data;
+ return dri_sw_dt->mapped;
+}
+
+static void
+dri_sw_displaytarget_unmap(struct sw_winsys *ws,
+ struct sw_displaytarget *dt)
+{
+ struct dri_sw_displaytarget *dri_sw_dt = dri_sw_displaytarget(dt);
+ dri_sw_dt->mapped = NULL;
+}
+
+static struct sw_displaytarget *
+dri_sw_displaytarget_from_handle(struct sw_winsys *winsys,
+ const struct pipe_texture *templ,
+ struct winsys_handle *whandle,
+ unsigned *stride)
+{
+ assert(0);
+ return NULL;
+}
+
+static boolean
+dri_sw_displaytarget_get_handle(struct sw_winsys *winsys,
+ struct sw_displaytarget *dt,
+ struct winsys_handle *whandle)
+{
+ assert(0);
+ return FALSE;
+}
+
+static void
+dri_sw_displaytarget_display(struct sw_winsys *ws,
+ struct sw_displaytarget *dt,
+ void *context_private)
+{
+ struct dri_sw_winsys *dri_sw_ws = dri_sw_winsys(ws);
+ struct dri_sw_displaytarget *dri_sw_dt = dri_sw_displaytarget(dt);
+ struct dri_drawable *dri_drawable = (struct dri_drawable *)context_private;
+ unsigned width, height;
+
+ /* Set the width to 'stride / cpp'.
+ *
+ * PutImage correctly clips to the width of the dst drawable.
+ */
+ width = dri_sw_dt->stride / util_format_get_blocksize(dri_sw_dt->format);
+
+ height = dri_sw_dt->height;
+
+ dri_sw_ws->lf->put_image(dri_drawable, dri_sw_dt->data, width, height);
+}
+
+
+static void
+dri_destroy_sw_winsys(struct sw_winsys *winsys)
+{
+ FREE(winsys);
+}
+
+struct sw_winsys *
+dri_create_sw_winsys(struct drisw_loader_funcs *lf)
+{
+ struct dri_sw_winsys *ws;
+
+ ws = CALLOC_STRUCT(dri_sw_winsys);
+ if (!ws)
+ return NULL;
+
+ ws->lf = lf;
+ ws->base.destroy = dri_destroy_sw_winsys;
+
+ ws->base.is_displaytarget_format_supported = dri_sw_is_displaytarget_format_supported;
+
+ /* screen texture functions */
+ ws->base.displaytarget_create = dri_sw_displaytarget_create;
+ ws->base.displaytarget_destroy = dri_sw_displaytarget_destroy;
+ ws->base.displaytarget_from_handle = dri_sw_displaytarget_from_handle;
+ ws->base.displaytarget_get_handle = dri_sw_displaytarget_get_handle;
+
+ /* texture functions */
+ ws->base.displaytarget_map = dri_sw_displaytarget_map;
+ ws->base.displaytarget_unmap = dri_sw_displaytarget_unmap;
+
+ ws->base.displaytarget_display = dri_sw_displaytarget_display;
+
+ return &ws->base;
+}
+
+/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/egl/x11/sw_winsys.h b/src/gallium/winsys/sw/dri/dri_sw_winsys.h
index f96c5a14b0..329ac06a05 100644
--- a/src/gallium/state_trackers/egl/x11/sw_winsys.h
+++ b/src/gallium/winsys/sw/dri/dri_sw_winsys.h
@@ -1,8 +1,9 @@
/**************************************************************************
- *
- * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ *
+ * Copyright 2009, VMware, Inc.
* All Rights Reserved.
- *
+ * Copyright 2010 George Sapountzis <gsapountzis@gmail.com>
+ *
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
@@ -10,31 +11,28 @@
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
- *
+ *
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
+ *
**************************************************************************/
+#ifndef DRI_SW_WINSYS
+#define DRI_SW_WINSYS
-#ifndef SW_WINSYS_H
-#define SW_WINSYS_H
+#include "state_tracker/drisw_api.h"
+struct sw_winsys;
-struct pipe_winsys;
+struct sw_winsys *dri_create_sw_winsys(struct drisw_loader_funcs *lf);
-
-extern struct pipe_winsys *
-create_sw_winsys(void);
-
-
-#endif /* SW_WINSYS_H */
+#endif
diff --git a/src/gallium/winsys/sw/drm/Makefile b/src/gallium/winsys/sw/drm/Makefile
new file mode 100644
index 0000000000..79664536aa
--- /dev/null
+++ b/src/gallium/winsys/sw/drm/Makefile
@@ -0,0 +1,12 @@
+TOP = ../../../../..
+include $(TOP)/configs/current
+
+LIBNAME = swdrm
+
+C_SOURCES = sw_drm_api.c
+
+LIBRARY_INCLUDES =
+
+LIBRARY_DEFINES =
+
+include ../../../Makefile.template
diff --git a/src/gallium/winsys/sw/drm/sw_drm_api.c b/src/gallium/winsys/sw/drm/sw_drm_api.c
new file mode 100644
index 0000000000..eb81d26a59
--- /dev/null
+++ b/src/gallium/winsys/sw/drm/sw_drm_api.c
@@ -0,0 +1,97 @@
+/**********************************************************
+ * Copyright 2010 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+
+#include "util/u_memory.h"
+#include "softpipe/sp_public.h"
+#include "state_tracker/drm_api.h"
+#include "../../sw/wrapper/wrapper_sw_winsys.h"
+#include "sw_drm_api.h"
+
+
+/*
+ * Defines
+ */
+
+
+struct sw_drm_api
+{
+ struct drm_api base;
+ struct drm_api *api;
+ struct sw_winsys *sw;
+};
+
+static INLINE struct sw_drm_api *
+sw_drm_api(struct drm_api *api)
+{
+ return (struct sw_drm_api *)api;
+}
+
+
+/*
+ * Exported functions
+ */
+
+
+static struct pipe_screen *
+sw_drm_create_screen(struct drm_api *_api, int drmFD,
+ struct drm_create_screen_arg *arg)
+{
+ struct sw_drm_api *swapi = sw_drm_api(_api);
+ struct drm_api *api = swapi->api;
+ struct sw_winsys *sww;
+ struct pipe_screen *screen;
+
+ screen = api->create_screen(api, drmFD, arg);
+
+ sww = wrapper_sw_winsys_warp_pipe_screen(screen);
+
+ return softpipe_create_screen(sww);
+}
+
+static void
+sw_drm_destroy(struct drm_api *api)
+{
+ struct sw_drm_api *swapi = sw_drm_api(api);
+ if (swapi->api->destroy)
+ swapi->api->destroy(swapi->api);
+
+ FREE(swapi);
+}
+
+struct drm_api *
+sw_drm_api_create(struct drm_api *api)
+{
+ struct sw_drm_api *swapi = CALLOC_STRUCT(sw_drm_api);
+
+ swapi->base.name = "sw";
+ swapi->base.driver_name = api->driver_name;
+ swapi->base.create_screen = sw_drm_create_screen;
+ swapi->base.destroy = sw_drm_destroy;
+
+ swapi->api = api;
+
+ return &swapi->base;
+}
diff --git a/src/gallium/winsys/sw/drm/sw_drm_api.h b/src/gallium/winsys/sw/drm/sw_drm_api.h
new file mode 100644
index 0000000000..ce90a04ae0
--- /dev/null
+++ b/src/gallium/winsys/sw/drm/sw_drm_api.h
@@ -0,0 +1,34 @@
+/**********************************************************
+ * Copyright 2010 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+
+#ifndef SW_DRM_API_H
+#define SW_DRM_API_H
+
+struct drm_api;
+
+struct drm_api * sw_drm_api_create(struct drm_api *api);
+
+#endif
diff --git a/src/gallium/winsys/sw/gdi/SConscript b/src/gallium/winsys/sw/gdi/SConscript
new file mode 100644
index 0000000000..1267fc6eea
--- /dev/null
+++ b/src/gallium/winsys/sw/gdi/SConscript
@@ -0,0 +1,23 @@
+#######################################################################
+# SConscript for xlib winsys
+
+
+Import('*')
+
+if env['platform'] == 'windows':
+
+ env = env.Clone()
+
+ env.Append(CPPPATH = [
+ '#/src/gallium/include',
+ '#/src/gallium/auxiliary',
+ '#/src/gallium/drivers',
+ ])
+
+ ws_gdi = env.ConvenienceLibrary(
+ target = 'ws_gdi',
+ source = [
+ 'gdi_sw_winsys.c',
+ ]
+ )
+ Export('ws_gdi')
diff --git a/src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c b/src/gallium/winsys/sw/gdi/gdi_sw_winsys.c
index a9fa03b8e5..4dba4b577b 100644
--- a/src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c
+++ b/src/gallium/winsys/sw/gdi/gdi_sw_winsys.c
@@ -28,7 +28,7 @@
/**
* @file
- * LLVMpipe support.
+ * GDI software rasterizer support.
*
* @author Jose Fonseca <jfonseca@vmware.com>
*/
@@ -42,12 +42,11 @@
#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
-#include "llvmpipe/lp_winsys.h"
-#include "llvmpipe/lp_texture.h"
-#include "stw_winsys.h"
+#include "state_tracker/sw_winsys.h"
+#include "gdi_sw_winsys.h"
-struct gdi_llvmpipe_displaytarget
+struct gdi_sw_displaytarget
{
enum pipe_format format;
unsigned width;
@@ -63,15 +62,16 @@ struct gdi_llvmpipe_displaytarget
/** Cast wrapper */
-static INLINE struct gdi_llvmpipe_displaytarget *
-gdi_llvmpipe_displaytarget( struct llvmpipe_displaytarget *buf )
+static INLINE struct gdi_sw_displaytarget *
+gdi_sw_displaytarget( struct sw_displaytarget *buf )
{
- return (struct gdi_llvmpipe_displaytarget *)buf;
+ return (struct gdi_sw_displaytarget *)buf;
}
static boolean
-gdi_llvmpipe_is_displaytarget_format_supported( struct llvmpipe_winsys *ws,
+gdi_sw_is_displaytarget_format_supported( struct sw_winsys *ws,
+ unsigned tex_usage,
enum pipe_format format )
{
switch(format) {
@@ -89,47 +89,48 @@ gdi_llvmpipe_is_displaytarget_format_supported( struct llvmpipe_winsys *ws,
static void *
-gdi_llvmpipe_displaytarget_map(struct llvmpipe_winsys *ws,
- struct llvmpipe_displaytarget *dt,
+gdi_sw_displaytarget_map(struct sw_winsys *ws,
+ struct sw_displaytarget *dt,
unsigned flags )
{
- struct gdi_llvmpipe_displaytarget *gdt = gdi_llvmpipe_displaytarget(dt);
+ struct gdi_sw_displaytarget *gdt = gdi_sw_displaytarget(dt);
return gdt->data;
}
static void
-gdi_llvmpipe_displaytarget_unmap(struct llvmpipe_winsys *ws,
- struct llvmpipe_displaytarget *dt )
+gdi_sw_displaytarget_unmap(struct sw_winsys *ws,
+ struct sw_displaytarget *dt )
{
}
static void
-gdi_llvmpipe_displaytarget_destroy(struct llvmpipe_winsys *winsys,
- struct llvmpipe_displaytarget *dt)
+gdi_sw_displaytarget_destroy(struct sw_winsys *winsys,
+ struct sw_displaytarget *dt)
{
- struct gdi_llvmpipe_displaytarget *gdt = gdi_llvmpipe_displaytarget(dt);
+ struct gdi_sw_displaytarget *gdt = gdi_sw_displaytarget(dt);
align_free(gdt->data);
FREE(gdt);
}
-static struct llvmpipe_displaytarget *
-gdi_llvmpipe_displaytarget_create(struct llvmpipe_winsys *winsys,
+static struct sw_displaytarget *
+gdi_sw_displaytarget_create(struct sw_winsys *winsys,
+ unsigned tex_usage,
enum pipe_format format,
unsigned width, unsigned height,
unsigned alignment,
unsigned *stride)
{
- struct gdi_llvmpipe_displaytarget *gdt;
+ struct gdi_sw_displaytarget *gdt;
unsigned cpp;
unsigned bpp;
- gdt = CALLOC_STRUCT(gdi_llvmpipe_displaytarget);
+ gdt = CALLOC_STRUCT(gdi_sw_displaytarget);
if(!gdt)
goto no_gdt;
@@ -160,7 +161,7 @@ gdi_llvmpipe_displaytarget_create(struct llvmpipe_winsys *winsys,
gdt->bmi.bmiHeader.biClrImportant = 0;
*stride = gdt->stride;
- return (struct llvmpipe_displaytarget *)gdt;
+ return (struct sw_displaytarget *)gdt;
no_data:
FREE(gdt);
@@ -169,65 +170,33 @@ no_gdt:
}
-static void
-gdi_llvmpipe_displaytarget_display(struct llvmpipe_winsys *winsys,
- struct llvmpipe_displaytarget *dt,
- void *context_private)
+static struct sw_displaytarget *
+gdi_sw_displaytarget_from_handle(struct sw_winsys *winsys,
+ const struct pipe_texture *templet,
+ struct winsys_handle *whandle,
+ unsigned *stride)
{
assert(0);
+ return NULL;
}
-static void
-gdi_llvmpipe_destroy(struct llvmpipe_winsys *winsys)
+static boolean
+gdi_sw_displaytarget_get_handle(struct sw_winsys *winsys,
+ struct sw_displaytarget *dt,
+ struct winsys_handle *whandle)
{
- FREE(winsys);
+ assert(0);
+ return FALSE;
}
-static struct pipe_screen *
-gdi_llvmpipe_screen_create(void)
+void
+gdi_sw_display( struct sw_winsys *winsys,
+ struct sw_displaytarget *dt,
+ HDC hDC )
{
- static struct llvmpipe_winsys *winsys;
- struct pipe_screen *screen;
-
- winsys = CALLOC_STRUCT(llvmpipe_winsys);
- if(!winsys)
- goto no_winsys;
-
- winsys->destroy = gdi_llvmpipe_destroy;
- winsys->is_displaytarget_format_supported = gdi_llvmpipe_is_displaytarget_format_supported;
- winsys->displaytarget_create = gdi_llvmpipe_displaytarget_create;
- winsys->displaytarget_map = gdi_llvmpipe_displaytarget_map;
- winsys->displaytarget_unmap = gdi_llvmpipe_displaytarget_unmap;
- winsys->displaytarget_display = gdi_llvmpipe_displaytarget_display;
- winsys->displaytarget_destroy = gdi_llvmpipe_displaytarget_destroy;
-
- screen = llvmpipe_create_screen(winsys);
- if(!screen)
- goto no_screen;
-
- return screen;
-
-no_screen:
- FREE(winsys);
-no_winsys:
- return NULL;
-}
-
-
-
-
-static void
-gdi_llvmpipe_present(struct pipe_screen *screen,
- struct pipe_surface *surface,
- HDC hDC)
-{
- struct llvmpipe_texture *texture;
- struct gdi_llvmpipe_displaytarget *gdt;
-
- texture = llvmpipe_texture(surface->texture);
- gdt = gdi_llvmpipe_displaytarget(texture->dt);
+ struct gdi_sw_displaytarget *gdt = gdi_sw_displaytarget(dt);
StretchDIBits(hDC,
0, 0, gdt->width, gdt->height,
@@ -235,38 +204,44 @@ gdi_llvmpipe_present(struct pipe_screen *screen,
gdt->data, &gdt->bmi, 0, SRCCOPY);
}
+static void
+gdi_sw_displaytarget_display(struct sw_winsys *winsys,
+ struct sw_displaytarget *dt,
+ void *context_private)
+{
+ /* nasty:
+ */
+ HDC hDC = (HDC)context_private;
-static const struct stw_winsys stw_winsys = {
- &gdi_llvmpipe_screen_create,
- &gdi_llvmpipe_present,
- NULL, /* get_adapter_luid */
- NULL, /* shared_surface_open */
- NULL, /* shared_surface_close */
- NULL /* compose */
-};
+ gdi_sw_display(winsys, dt, hDC);
+}
-BOOL WINAPI
-DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
+static void
+gdi_sw_destroy(struct sw_winsys *winsys)
{
- switch (fdwReason) {
- case DLL_PROCESS_ATTACH:
- stw_init(&stw_winsys);
- stw_init_thread();
- break;
-
- case DLL_THREAD_ATTACH:
- stw_init_thread();
- break;
-
- case DLL_THREAD_DETACH:
- stw_cleanup_thread();
- break;
-
- case DLL_PROCESS_DETACH:
- stw_cleanup_thread();
- stw_cleanup();
- break;
- }
- return TRUE;
+ FREE(winsys);
+}
+
+struct sw_winsys *
+gdi_create_sw_winsys(void)
+{
+ static struct sw_winsys *winsys;
+
+ winsys = CALLOC_STRUCT(sw_winsys);
+ if(!winsys)
+ return NULL;
+
+ winsys->destroy = gdi_sw_destroy;
+ winsys->is_displaytarget_format_supported = gdi_sw_is_displaytarget_format_supported;
+ winsys->displaytarget_create = gdi_sw_displaytarget_create;
+ winsys->displaytarget_from_handle = gdi_sw_displaytarget_from_handle;
+ winsys->displaytarget_get_handle = gdi_sw_displaytarget_get_handle;
+ winsys->displaytarget_map = gdi_sw_displaytarget_map;
+ winsys->displaytarget_unmap = gdi_sw_displaytarget_unmap;
+ winsys->displaytarget_display = gdi_sw_displaytarget_display;
+ winsys->displaytarget_destroy = gdi_sw_displaytarget_destroy;
+
+ return winsys;
}
+
diff --git a/src/gallium/winsys/sw/gdi/gdi_sw_winsys.h b/src/gallium/winsys/sw/gdi/gdi_sw_winsys.h
new file mode 100644
index 0000000000..4bbcb47848
--- /dev/null
+++ b/src/gallium/winsys/sw/gdi/gdi_sw_winsys.h
@@ -0,0 +1,16 @@
+#ifndef GDI_SW_WINSYS_H
+#define GDI_SW_WINSYS_H
+
+#include <windows.h>
+
+#include "pipe/p_compiler.h"
+#include "state_tracker/sw_winsys.h"
+
+void gdi_sw_display( struct sw_winsys *winsys,
+ struct sw_displaytarget *dt,
+ HDC hDC );
+
+struct sw_winsys *
+gdi_create_sw_winsys(void);
+
+#endif
diff --git a/src/gallium/winsys/sw/null/Makefile b/src/gallium/winsys/sw/null/Makefile
new file mode 100644
index 0000000000..b1882b582e
--- /dev/null
+++ b/src/gallium/winsys/sw/null/Makefile
@@ -0,0 +1,16 @@
+TOP = ../../../../..
+include $(TOP)/configs/current
+
+LIBNAME = ws_null
+
+LIBRARY_INCLUDES = \
+ -I$(TOP)/src/gallium/include \
+ -I$(TOP)/src/gallium/drivers \
+ -I$(TOP)/src/gallium/auxiliary
+
+C_SOURCES = \
+ null_sw_winsys.c
+
+include ../../../Makefile.template
+
+
diff --git a/src/gallium/winsys/sw/null/SConscript b/src/gallium/winsys/sw/null/SConscript
new file mode 100644
index 0000000000..21837dc60c
--- /dev/null
+++ b/src/gallium/winsys/sw/null/SConscript
@@ -0,0 +1,21 @@
+#######################################################################
+# SConscript for xlib winsys
+
+
+Import('*')
+
+env = env.Clone()
+
+env.Append(CPPPATH = [
+ '#/src/gallium/include',
+ '#/src/gallium/auxiliary',
+ '#/src/gallium/drivers',
+])
+
+ws_null = env.ConvenienceLibrary(
+ target = 'ws_null',
+ source = [
+ 'null_sw_winsys.c',
+ ]
+)
+Export('ws_null')
diff --git a/src/gallium/winsys/sw/null/null_sw_winsys.c b/src/gallium/winsys/sw/null/null_sw_winsys.c
new file mode 100644
index 0000000000..5027e57b30
--- /dev/null
+++ b/src/gallium/winsys/sw/null/null_sw_winsys.c
@@ -0,0 +1,148 @@
+/**************************************************************************
+ *
+ * Copyright 2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ **************************************************************************/
+
+/**
+ * @file
+ * Null software rasterizer winsys.
+ *
+ * There is no present support. Framebuffer data needs to be obtained via
+ * transfers.
+ *
+ * @author Jose Fonseca
+ */
+
+
+#include "pipe/p_format.h"
+#include "util/u_memory.h"
+#include "state_tracker/sw_winsys.h"
+#include "null_sw_winsys.h"
+
+
+static boolean
+null_sw_is_displaytarget_format_supported(struct sw_winsys *ws,
+ unsigned tex_usage,
+ enum pipe_format format )
+{
+ return FALSE;
+}
+
+
+static void *
+null_sw_displaytarget_map(struct sw_winsys *ws,
+ struct sw_displaytarget *dt,
+ unsigned flags )
+{
+ assert(0);
+ return NULL;
+}
+
+
+static void
+null_sw_displaytarget_unmap(struct sw_winsys *ws,
+ struct sw_displaytarget *dt )
+{
+ assert(0);
+}
+
+
+static void
+null_sw_displaytarget_destroy(struct sw_winsys *winsys,
+ struct sw_displaytarget *dt)
+{
+ assert(0);
+}
+
+
+static struct sw_displaytarget *
+null_sw_displaytarget_create(struct sw_winsys *winsys,
+ unsigned tex_usage,
+ enum pipe_format format,
+ unsigned width, unsigned height,
+ unsigned alignment,
+ unsigned *stride)
+{
+ return NULL;
+}
+
+
+static struct sw_displaytarget *
+null_sw_displaytarget_from_handle(struct sw_winsys *winsys,
+ const struct pipe_texture *templet,
+ struct winsys_handle *whandle,
+ unsigned *stride)
+{
+ return NULL;
+}
+
+
+static boolean
+null_sw_displaytarget_get_handle(struct sw_winsys *winsys,
+ struct sw_displaytarget *dt,
+ struct winsys_handle *whandle)
+{
+ assert(0);
+ return FALSE;
+}
+
+
+static void
+null_sw_displaytarget_display(struct sw_winsys *winsys,
+ struct sw_displaytarget *dt,
+ void *context_private)
+{
+ assert(0);
+}
+
+
+static void
+null_sw_destroy(struct sw_winsys *winsys)
+{
+ FREE(winsys);
+}
+
+
+struct sw_winsys *
+null_sw_create(void)
+{
+ static struct sw_winsys *winsys;
+
+ winsys = CALLOC_STRUCT(sw_winsys);
+ if (!winsys)
+ return NULL;
+
+ winsys->destroy = null_sw_destroy;
+ winsys->is_displaytarget_format_supported = null_sw_is_displaytarget_format_supported;
+ winsys->displaytarget_create = null_sw_displaytarget_create;
+ winsys->displaytarget_from_handle = null_sw_displaytarget_from_handle;
+ winsys->displaytarget_get_handle = null_sw_displaytarget_get_handle;
+ winsys->displaytarget_map = null_sw_displaytarget_map;
+ winsys->displaytarget_unmap = null_sw_displaytarget_unmap;
+ winsys->displaytarget_display = null_sw_displaytarget_display;
+ winsys->displaytarget_destroy = null_sw_displaytarget_destroy;
+
+ return winsys;
+}
diff --git a/src/gallium/winsys/sw/null/null_sw_winsys.h b/src/gallium/winsys/sw/null/null_sw_winsys.h
new file mode 100644
index 0000000000..1986186feb
--- /dev/null
+++ b/src/gallium/winsys/sw/null/null_sw_winsys.h
@@ -0,0 +1,40 @@
+/**************************************************************************
+ *
+ * Copyright 2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ **************************************************************************/
+
+
+#ifndef NULL_SW_WINSYS_H_
+#define NULL_SW_WINSYS_H_
+
+
+struct sw_winsys;
+
+
+struct sw_winsys *
+null_sw_create(void);
+
+
+#endif /* NULL_SW_WINSYS_H_ */
diff --git a/src/gallium/winsys/sw/wrapper/Makefile b/src/gallium/winsys/sw/wrapper/Makefile
new file mode 100644
index 0000000000..4771fbcf70
--- /dev/null
+++ b/src/gallium/winsys/sw/wrapper/Makefile
@@ -0,0 +1,12 @@
+TOP = ../../../../..
+include $(TOP)/configs/current
+
+LIBNAME = wsw
+
+C_SOURCES = wrapper_sw_winsys.c
+
+LIBRARY_INCLUDES =
+
+LIBRARY_DEFINES =
+
+include ../../../Makefile.template
diff --git a/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c b/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c
new file mode 100644
index 0000000000..459b1c1e2a
--- /dev/null
+++ b/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c
@@ -0,0 +1,282 @@
+/**********************************************************
+ * Copyright 2010 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+
+#include "wrapper_sw_winsys.h"
+
+#include "pipe/p_format.h"
+#include "pipe/p_state.h"
+
+#include "state_tracker/sw_winsys.h"
+
+#include "util/u_memory.h"
+#include "util/u_inlines.h"
+
+/*
+ * This code wraps a pipe_screen and exposes a sw_winsys interface for use
+ * with software resterizers. This code is used by the DRM based winsys to
+ * allow access to the drm driver.
+ *
+ * We must borrow the whole stack because only the pipe screen knows how
+ * to decode the content of a buffer. Or how to create a buffer that
+ * can still be used by drivers using real hardware (as the case is
+ * with software st/xorg but hw st/dri).
+ *
+ * We also need a pipe context for the transfers.
+ */
+
+struct wrapper_sw_winsys
+{
+ struct sw_winsys base;
+ struct pipe_screen *screen;
+ struct pipe_context *pipe;
+};
+
+struct wrapper_sw_displaytarget
+{
+ struct wrapper_sw_winsys *winsys;
+ struct pipe_texture *tex;
+ struct pipe_transfer *transfer;
+
+ unsigned width;
+ unsigned height;
+ unsigned map_count;
+ unsigned stride; /**< because we give stride at create */
+ void *ptr;
+};
+
+static INLINE struct wrapper_sw_winsys *
+wrapper_sw_winsys(struct sw_winsys *ws)
+{
+ return (struct wrapper_sw_winsys *)ws;
+}
+
+static INLINE struct wrapper_sw_displaytarget *
+wrapper_sw_displaytarget(struct sw_displaytarget *dt)
+{
+ return (struct wrapper_sw_displaytarget *)dt;
+}
+
+
+/*
+ * Functions
+ */
+
+
+static boolean
+wsw_dt_get_stride(struct wrapper_sw_displaytarget *wdt, unsigned *stride)
+{
+ struct pipe_context *pipe = wdt->winsys->pipe;
+ struct pipe_texture *tex = wdt->tex;
+ struct pipe_transfer *tr;
+
+ tr = pipe->get_tex_transfer(pipe, tex, 0, 0, 0,
+ PIPE_TRANSFER_READ_WRITE,
+ 0, 0, wdt->width, wdt->height);
+ if (!tr)
+ return FALSE;
+
+ *stride = tr->stride;
+ wdt->stride = tr->stride;
+
+ pipe->tex_transfer_destroy(pipe, tr);
+
+ return TRUE;
+}
+
+static struct sw_displaytarget *
+wsw_dt_wrap_texture(struct wrapper_sw_winsys *wsw,
+ struct pipe_texture *tex, unsigned *stride)
+{
+ struct wrapper_sw_displaytarget *wdt = CALLOC_STRUCT(wrapper_sw_displaytarget);
+ if (!wdt)
+ goto err_unref;
+
+ wdt->tex = tex;
+ wdt->winsys = wsw;
+
+ if (!wsw_dt_get_stride(wdt, stride))
+ goto err_free;
+
+ return (struct sw_displaytarget *)wdt;
+
+err_free:
+ FREE(wdt);
+err_unref:
+ pipe_texture_reference(&tex, NULL);
+ return NULL;
+}
+
+static struct sw_displaytarget *
+wsw_dt_create(struct sw_winsys *ws,
+ unsigned tex_usage,
+ enum pipe_format format,
+ unsigned width, unsigned height,
+ unsigned alignment,
+ unsigned *stride)
+{
+ struct wrapper_sw_winsys *wsw = wrapper_sw_winsys(ws);
+ struct pipe_texture templ;
+ struct pipe_texture *tex;
+
+ /*
+ * XXX Why don't we just get the template.
+ */
+ memset(&templ, 0, sizeof(templ));
+ templ.width0 = width;
+ templ.height0 = height;
+ templ.format = format;
+ templ.tex_usage = tex_usage;
+
+ /* XXX alignment: we can't do anything about this */
+
+ tex = wsw->screen->texture_create(wsw->screen, &templ);
+ if (!tex)
+ return NULL;
+
+ return wsw_dt_wrap_texture(wsw, tex, stride);
+}
+
+static struct sw_displaytarget *
+wsw_dt_from_handle(struct sw_winsys *ws,
+ const struct pipe_texture *templ,
+ struct winsys_handle *whandle,
+ unsigned *stride)
+{
+ struct wrapper_sw_winsys *wsw = wrapper_sw_winsys(ws);
+ struct pipe_texture *tex;
+
+ tex = wsw->screen->texture_from_handle(wsw->screen, templ, whandle);
+ if (!tex)
+ return NULL;
+
+ return wsw_dt_wrap_texture(wsw, tex, stride);
+}
+
+static void *
+wsw_dt_map(struct sw_winsys *ws,
+ struct sw_displaytarget *dt,
+ unsigned flags)
+{
+ struct wrapper_sw_displaytarget *wdt = wrapper_sw_displaytarget(dt);
+ struct pipe_context *pipe = wdt->winsys->pipe;
+ struct pipe_texture *tex = wdt->tex;
+ struct pipe_transfer *tr;
+ void *ptr;
+
+ if (!wdt->map_count) {
+
+ assert(!wdt->transfer);
+
+ tr = pipe->get_tex_transfer(pipe, tex, 0, 0, 0,
+ PIPE_TRANSFER_READ_WRITE,
+ 0, 0, wdt->width, wdt->height);
+ if (!tr)
+ return NULL;
+
+ ptr = pipe->transfer_map(pipe, tr);
+ if (!ptr)
+ goto err;
+
+ wdt->transfer = tr;
+ wdt->ptr = ptr;
+
+ /* XXX Handle this case */
+ assert(tr->stride == wdt->stride);
+ }
+
+ wdt->map_count++;
+
+ return wdt->ptr;
+
+err:
+ pipe->tex_transfer_destroy(pipe, tr);
+ return NULL;
+}
+
+static void
+wsw_dt_unmap(struct sw_winsys *ws,
+ struct sw_displaytarget *dt)
+{
+ struct wrapper_sw_displaytarget *wdt = wrapper_sw_displaytarget(dt);
+ struct pipe_context *pipe = wdt->winsys->pipe;
+
+ assert(wdt->transfer);
+
+ wdt->map_count--;
+
+ if (wdt->map_count)
+ return;
+
+ pipe->transfer_unmap(pipe, wdt->transfer);
+ pipe->tex_transfer_destroy(pipe, wdt->transfer);
+ wdt->transfer = NULL;
+}
+
+static void
+wsw_dt_destroy(struct sw_winsys *ws,
+ struct sw_displaytarget *dt)
+{
+ struct wrapper_sw_displaytarget *wdt = wrapper_sw_displaytarget(dt);
+
+ pipe_texture_reference(&wdt->tex, NULL);
+
+ FREE(wdt);
+}
+
+static void
+wsw_destroy(struct sw_winsys *ws)
+{
+ struct wrapper_sw_winsys *wsw = wrapper_sw_winsys(ws);
+
+ wsw->pipe->destroy(wsw->pipe);
+ wsw->screen->destroy(wsw->screen);
+
+ FREE(wsw);
+}
+
+struct sw_winsys *
+wrapper_sw_winsys_warp_pipe_screen(struct pipe_screen *screen)
+{
+ struct wrapper_sw_winsys *wsw = CALLOC_STRUCT(wrapper_sw_winsys);
+
+ wsw->base.displaytarget_create = wsw_dt_create;
+ wsw->base.displaytarget_from_handle = wsw_dt_from_handle;
+ wsw->base.displaytarget_map = wsw_dt_map;
+ wsw->base.displaytarget_unmap = wsw_dt_unmap;
+ wsw->base.displaytarget_destroy = wsw_dt_destroy;
+ wsw->base.destroy = wsw_destroy;
+
+ wsw->screen = screen;
+ wsw->pipe = screen->context_create(screen, NULL);
+ if (!wsw->pipe)
+ goto err;
+
+ return &wsw->base;
+
+err:
+ FREE(wsw);
+ return NULL;
+}
diff --git a/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.h b/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.h
new file mode 100644
index 0000000000..b5c25a3c50
--- /dev/null
+++ b/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.h
@@ -0,0 +1,35 @@
+/**********************************************************
+ * Copyright 2010 VMware, Inc. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ **********************************************************/
+
+
+#ifndef WRAPPER_SW_WINSYS
+#define WRAPPER_SW_WINSYS
+
+struct sw_winsys;
+struct pipe_screen;
+
+struct sw_winsys *wrapper_sw_winsys_warp_pipe_screen(struct pipe_screen *screen);
+
+#endif
diff --git a/src/gallium/winsys/sw/xlib/Makefile b/src/gallium/winsys/sw/xlib/Makefile
new file mode 100644
index 0000000000..c669389928
--- /dev/null
+++ b/src/gallium/winsys/sw/xlib/Makefile
@@ -0,0 +1,17 @@
+TOP = ../../../../..
+include $(TOP)/configs/current
+
+LIBNAME = ws_xlib
+
+LIBRARY_INCLUDES = \
+ -I$(TOP)/src/gallium/include \
+ -I$(TOP)/src/gallium/drivers \
+ -I$(TOP)/src/gallium/auxiliary \
+ $(X11_CFLAGS)
+
+C_SOURCES = \
+ xlib_sw_winsys.c
+
+include ../../../Makefile.template
+
+
diff --git a/src/gallium/winsys/sw/xlib/SConscript b/src/gallium/winsys/sw/xlib/SConscript
new file mode 100644
index 0000000000..2af6153b4c
--- /dev/null
+++ b/src/gallium/winsys/sw/xlib/SConscript
@@ -0,0 +1,23 @@
+#######################################################################
+# SConscript for xlib winsys
+
+
+Import('*')
+
+if env['platform'] == 'linux':
+
+ env = env.Clone()
+
+ env.Append(CPPPATH = [
+ '#/src/gallium/include',
+ '#/src/gallium/auxiliary',
+ '#/src/gallium/drivers',
+ ])
+
+ ws_xlib = env.ConvenienceLibrary(
+ target = 'ws_xlib',
+ source = [
+ 'xlib_sw_winsys.c',
+ ]
+ )
+ Export('ws_xlib')
diff --git a/src/gallium/winsys/xlib/xlib_llvmpipe.c b/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c
index 6cebd4c201..ad843b7def 100644
--- a/src/gallium/winsys/xlib/xlib_llvmpipe.c
+++ b/src/gallium/winsys/sw/xlib/xlib_sw_winsys.c
@@ -32,25 +32,21 @@
* Brian Paul
*/
-
-#if defined(GALLIUM_LLVMPIPE)
-
-#include "xm_api.h"
-
-#undef ASSERT
-#undef Elements
-
-#include "util/u_simple_screen.h"
#include "pipe/p_format.h"
#include "pipe/p_context.h"
#include "util/u_inlines.h"
#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
-#include "llvmpipe/lp_winsys.h"
-#include "llvmpipe/lp_texture.h"
-#include "xlib.h"
+#include "state_tracker/xlib_sw_winsys.h"
+
+#include <X11/Xlib.h>
+#include <X11/Xlibint.h>
+#include <X11/Xutil.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#include <X11/extensions/XShm.h>
/**
* Subclass of pipe_buffer for Xlib winsys.
@@ -66,28 +62,38 @@ struct xm_displaytarget
void *data;
void *mapped;
+ Display *display;
+ Visual *visual;
XImage *tempImage;
-#ifdef USE_XSHM
- int shm;
+ GC gc;
+
+ /* This is the last drawable that this display target was presented
+ * against. May need to recreate gc, tempImage when this changes??
+ */
+ Drawable drawable;
+
XShmSegmentInfo shminfo;
-#endif
+ int shm;
};
/**
- * Subclass of llvmpipe_winsys for Xlib winsys
+ * Subclass of sw_winsys for Xlib winsys
*/
-struct xmesa_llvmpipe_winsys
+struct xlib_sw_winsys
{
- struct llvmpipe_winsys base;
-/* struct xmesa_visual *xm_visual; */
+ struct sw_winsys base;
+
+
+
+ Display *display;
};
/** Cast wrapper */
static INLINE struct xm_displaytarget *
-xm_displaytarget( struct llvmpipe_displaytarget *dt )
+xm_displaytarget( struct sw_displaytarget *dt )
{
return (struct xm_displaytarget *)dt;
}
@@ -97,8 +103,6 @@ xm_displaytarget( struct llvmpipe_displaytarget *dt )
* X Shared Memory Image extension code
*/
-#ifdef USE_XSHM
-
static volatile int mesaXErrorFlag = 0;
/**
@@ -138,8 +142,8 @@ static char *alloc_shm(struct xm_displaytarget *buf, unsigned size)
* Allocate a shared memory XImage back buffer for the given XMesaBuffer.
*/
static void
-alloc_shm_ximage(struct xm_displaytarget *xm_buffer,
- struct xmesa_buffer *xmb,
+alloc_shm_ximage(struct xm_displaytarget *xm_dt,
+ struct xlib_drawable *xmb,
unsigned width, unsigned height)
{
/*
@@ -150,15 +154,15 @@ alloc_shm_ximage(struct xm_displaytarget *xm_buffer,
*/
int (*old_handler)(Display *, XErrorEvent *);
- xm_buffer->tempImage = XShmCreateImage(xmb->xm_visual->display,
- xmb->xm_visual->visinfo->visual,
- xmb->xm_visual->visinfo->depth,
- ZPixmap,
- NULL,
- &xm_buffer->shminfo,
- width, height);
- if (xm_buffer->tempImage == NULL) {
- xm_buffer->shm = 0;
+ xm_dt->tempImage = XShmCreateImage(xm_dt->display,
+ xmb->visual,
+ xmb->depth,
+ ZPixmap,
+ NULL,
+ &xm_dt->shminfo,
+ width, height);
+ if (xm_dt->tempImage == NULL) {
+ xm_dt->shm = 0;
return;
}
@@ -166,27 +170,45 @@ alloc_shm_ximage(struct xm_displaytarget *xm_buffer,
mesaXErrorFlag = 0;
old_handler = XSetErrorHandler(mesaHandleXError);
/* This may trigger the X protocol error we're ready to catch: */
- XShmAttach(xmb->xm_visual->display, &xm_buffer->shminfo);
- XSync(xmb->xm_visual->display, False);
+ XShmAttach(xm_dt->display, &xm_dt->shminfo);
+ XSync(xm_dt->display, False);
if (mesaXErrorFlag) {
/* we are on a remote display, this error is normal, don't print it */
- XFlush(xmb->xm_visual->display);
+ XFlush(xm_dt->display);
mesaXErrorFlag = 0;
- XDestroyImage(xm_buffer->tempImage);
- xm_buffer->tempImage = NULL;
- xm_buffer->shm = 0;
+ XDestroyImage(xm_dt->tempImage);
+ xm_dt->tempImage = NULL;
+ xm_dt->shm = 0;
(void) XSetErrorHandler(old_handler);
return;
}
- xm_buffer->shm = 1;
+ xm_dt->shm = 1;
}
-#endif /* USE_XSHM */
+
+static void
+alloc_ximage(struct xm_displaytarget *xm_dt,
+ struct xlib_drawable *xmb,
+ unsigned width, unsigned height)
+{
+ if (xm_dt->shm) {
+ alloc_shm_ximage(xm_dt, xmb, width, height);
+ return;
+ }
+
+ xm_dt->tempImage = XCreateImage(xm_dt->display,
+ xmb->visual,
+ xmb->depth,
+ ZPixmap, 0,
+ NULL, width, height,
+ 8, 0);
+}
static boolean
-xm_is_displaytarget_format_supported( struct llvmpipe_winsys *ws,
+xm_is_displaytarget_format_supported( struct sw_winsys *ws,
+ unsigned tex_usage,
enum pipe_format format )
{
/* TODO: check visuals or other sensible thing here */
@@ -195,8 +217,8 @@ xm_is_displaytarget_format_supported( struct llvmpipe_winsys *ws,
static void *
-xm_displaytarget_map(struct llvmpipe_winsys *ws,
- struct llvmpipe_displaytarget *dt,
+xm_displaytarget_map(struct sw_winsys *ws,
+ struct sw_displaytarget *dt,
unsigned flags)
{
struct xm_displaytarget *xm_dt = xm_displaytarget(dt);
@@ -205,21 +227,20 @@ xm_displaytarget_map(struct llvmpipe_winsys *ws,
}
static void
-xm_displaytarget_unmap(struct llvmpipe_winsys *ws,
- struct llvmpipe_displaytarget *dt)
+xm_displaytarget_unmap(struct sw_winsys *ws,
+ struct sw_displaytarget *dt)
{
struct xm_displaytarget *xm_dt = xm_displaytarget(dt);
xm_dt->mapped = NULL;
}
static void
-xm_displaytarget_destroy(struct llvmpipe_winsys *ws,
- struct llvmpipe_displaytarget *dt)
+xm_displaytarget_destroy(struct sw_winsys *ws,
+ struct sw_displaytarget *dt)
{
struct xm_displaytarget *xm_dt = xm_displaytarget(dt);
if (xm_dt->data) {
-#ifdef USE_XSHM
if (xm_dt->shminfo.shmid >= 0) {
shmdt(xm_dt->shminfo.shmaddr);
shmctl(xm_dt->shminfo.shmid, IPC_RMID, 0);
@@ -227,11 +248,17 @@ xm_displaytarget_destroy(struct llvmpipe_winsys *ws,
xm_dt->shminfo.shmid = -1;
xm_dt->shminfo.shmaddr = (char *) -1;
}
- else
-#endif
+ else {
FREE(xm_dt->data);
+ }
}
+ if (xm_dt->tempImage)
+ XDestroyImage(xm_dt->tempImage);
+
+ if (xm_dt->gc)
+ XFreeGC(xm_dt->display, xm_dt->gc);
+
FREE(xm_dt);
}
@@ -241,13 +268,14 @@ xm_displaytarget_destroy(struct llvmpipe_winsys *ws,
* by the XMesaBuffer.
*/
static void
-xm_llvmpipe_display(struct xmesa_buffer *xm_buffer,
- struct llvmpipe_displaytarget *dt)
+xlib_sw_display(struct xlib_drawable *xlib_drawable,
+ struct sw_displaytarget *dt)
{
- XImage *ximage;
- struct xm_displaytarget *xm_dt = xm_displaytarget(dt);
static boolean no_swap = 0;
static boolean firsttime = 1;
+ struct xm_displaytarget *xm_dt = xm_displaytarget(dt);
+ Display *display = xm_dt->display;
+ XImage *ximage;
if (firsttime) {
no_swap = getenv("SP_NO_RAST") != NULL;
@@ -257,28 +285,45 @@ xm_llvmpipe_display(struct xmesa_buffer *xm_buffer,
if (no_swap)
return;
-#ifdef USE_XSHM
- if (xm_dt->shm)
- {
- if (xm_dt->tempImage == NULL)
- {
- assert(util_format_get_blockwidth(xm_dt->format) == 1);
- assert(util_format_get_blockheight(xm_dt->format) == 1);
- alloc_shm_ximage(xm_dt, xm_buffer,
- xm_dt->stride / util_format_get_blocksize(xm_dt->format),
- xm_dt->height);
+ if (xm_dt->drawable != xlib_drawable->drawable) {
+ if (xm_dt->gc) {
+ XFreeGC( display, xm_dt->gc );
+ xm_dt->gc = NULL;
+ }
+
+ if (xm_dt->tempImage) {
+ XDestroyImage( xm_dt->tempImage );
+ xm_dt->tempImage = NULL;
}
+ xm_dt->drawable = xlib_drawable->drawable;
+ }
+
+ if (xm_dt->tempImage == NULL) {
+ assert(util_format_get_blockwidth(xm_dt->format) == 1);
+ assert(util_format_get_blockheight(xm_dt->format) == 1);
+ alloc_ximage(xm_dt, xlib_drawable,
+ xm_dt->stride / util_format_get_blocksize(xm_dt->format),
+ xm_dt->height);
+ if (!xm_dt->tempImage)
+ return;
+ }
+
+ if (xm_dt->gc == NULL) {
+ xm_dt->gc = XCreateGC( display, xlib_drawable->drawable, 0, NULL );
+ XSetFunction( display, xm_dt->gc, GXcopy );
+ }
+
+ if (xm_dt->shm)
+ {
ximage = xm_dt->tempImage;
ximage->data = xm_dt->data;
/* _debug_printf("XSHM\n"); */
- XShmPutImage(xm_buffer->xm_visual->display, xm_buffer->drawable, xm_buffer->gc,
+ XShmPutImage(xm_dt->display, xlib_drawable->drawable, xm_dt->gc,
ximage, 0, 0, 0, 0, xm_dt->width, xm_dt->height, False);
}
- else
-#endif
- {
+ else {
/* display image in Window */
ximage = xm_dt->tempImage;
ximage->data = xm_dt->data;
@@ -293,9 +338,11 @@ xm_llvmpipe_display(struct xmesa_buffer *xm_buffer,
ximage->bytes_per_line = xm_dt->stride;
/* _debug_printf("XPUT\n"); */
- XPutImage(xm_buffer->xm_visual->display, xm_buffer->drawable, xm_buffer->gc,
+ XPutImage(xm_dt->display, xlib_drawable->drawable, xm_dt->gc,
ximage, 0, 0, 0, 0, xm_dt->width, xm_dt->height);
}
+
+ XFlush(xm_dt->display);
}
/**
@@ -303,30 +350,31 @@ xm_llvmpipe_display(struct xmesa_buffer *xm_buffer,
* by the XMesaBuffer.
*/
static void
-xm_displaytarget_display(struct llvmpipe_winsys *ws,
- struct llvmpipe_displaytarget *dt,
+xm_displaytarget_display(struct sw_winsys *ws,
+ struct sw_displaytarget *dt,
void *context_private)
{
- XMesaContext xmctx = (XMesaContext) context_private;
- struct xmesa_buffer *xm_buffer = xmctx->xm_buffer;
- xm_llvmpipe_display(xm_buffer, dt);
+ struct xlib_drawable *xlib_drawable = (struct xlib_drawable *)context_private;
+ xlib_sw_display(xlib_drawable, dt);
}
-static struct llvmpipe_displaytarget *
-xm_displaytarget_create(struct llvmpipe_winsys *winsys,
+static struct sw_displaytarget *
+xm_displaytarget_create(struct sw_winsys *winsys,
+ unsigned tex_usage,
enum pipe_format format,
unsigned width, unsigned height,
unsigned alignment,
unsigned *stride)
{
- struct xm_displaytarget *xm_dt = CALLOC_STRUCT(xm_displaytarget);
+ struct xm_displaytarget *xm_dt;
unsigned nblocksy, size;
xm_dt = CALLOC_STRUCT(xm_displaytarget);
if(!xm_dt)
goto no_xm_dt;
+ xm_dt->display = ((struct xlib_sw_winsys *)winsys)->display;
xm_dt->format = format;
xm_dt->width = width;
xm_dt->height = height;
@@ -335,7 +383,6 @@ xm_displaytarget_create(struct llvmpipe_winsys *winsys,
xm_dt->stride = align(util_format_get_stride(format, width), alignment);
size = xm_dt->stride * nblocksy;
-#ifdef USE_XSHM
if (!debug_get_bool_option("XLIB_NO_SHM", FALSE))
{
xm_dt->shminfo.shmid = -1;
@@ -346,7 +393,6 @@ xm_displaytarget_create(struct llvmpipe_winsys *winsys,
if(!xm_dt->data)
goto no_data;
}
-#endif
if(!xm_dt->data) {
xm_dt->data = align_malloc(size, alignment);
@@ -355,7 +401,7 @@ xm_displaytarget_create(struct llvmpipe_winsys *winsys,
}
*stride = xm_dt->stride;
- return (struct llvmpipe_displaytarget *)xm_dt;
+ return (struct sw_displaytarget *)xm_dt;
no_data:
FREE(xm_dt);
@@ -364,27 +410,51 @@ no_xm_dt:
}
+static struct sw_displaytarget *
+xm_displaytarget_from_handle(struct sw_winsys *winsys,
+ const struct pipe_texture *templet,
+ struct winsys_handle *whandle,
+ unsigned *stride)
+{
+ assert(0);
+ return NULL;
+}
+
+
+static boolean
+xm_displaytarget_get_handle(struct sw_winsys *winsys,
+ struct sw_displaytarget *dt,
+ struct winsys_handle *whandle)
+{
+ assert(0);
+ return FALSE;
+}
+
+
static void
-xm_destroy( struct llvmpipe_winsys *ws )
+xm_destroy( struct sw_winsys *ws )
{
FREE(ws);
}
-static struct llvmpipe_winsys *
-xlib_create_llvmpipe_winsys( void )
+struct sw_winsys *
+xlib_create_sw_winsys( Display *display )
{
- struct xmesa_llvmpipe_winsys *ws;
+ struct xlib_sw_winsys *ws;
- ws = CALLOC_STRUCT(xmesa_llvmpipe_winsys);
+ ws = CALLOC_STRUCT(xlib_sw_winsys);
if (!ws)
return NULL;
+ ws->display = display;
ws->base.destroy = xm_destroy;
ws->base.is_displaytarget_format_supported = xm_is_displaytarget_format_supported;
ws->base.displaytarget_create = xm_displaytarget_create;
+ ws->base.displaytarget_from_handle = xm_displaytarget_from_handle;
+ ws->base.displaytarget_get_handle = xm_displaytarget_get_handle;
ws->base.displaytarget_map = xm_displaytarget_map;
ws->base.displaytarget_unmap = xm_displaytarget_unmap;
ws->base.displaytarget_destroy = xm_displaytarget_destroy;
@@ -394,49 +464,3 @@ xlib_create_llvmpipe_winsys( void )
return &ws->base;
}
-
-static struct pipe_screen *
-xlib_create_llvmpipe_screen( void )
-{
- struct llvmpipe_winsys *winsys;
- struct pipe_screen *screen;
-
- winsys = xlib_create_llvmpipe_winsys();
- if (winsys == NULL)
- return NULL;
-
- screen = llvmpipe_create_screen(winsys);
- if (screen == NULL)
- goto fail;
-
- return screen;
-
-fail:
- if (winsys)
- winsys->destroy( winsys );
-
- return NULL;
-}
-
-
-static void
-xlib_llvmpipe_display_surface(struct xmesa_buffer *xm_buffer,
- struct pipe_surface *surf)
-{
- struct llvmpipe_texture *texture = llvmpipe_texture(surf->texture);
-
- assert(texture->dt);
- if (texture->dt)
- xm_llvmpipe_display(xm_buffer, texture->dt);
-}
-
-
-struct xm_driver xlib_llvmpipe_driver =
-{
- .create_pipe_screen = xlib_create_llvmpipe_screen,
- .display_surface = xlib_llvmpipe_display_surface
-};
-
-
-
-#endif /* GALLIUM_LLVMPIPE */
diff --git a/src/gallium/winsys/xlib/xlib.c b/src/gallium/winsys/xlib/xlib.c
deleted file mode 100644
index 67617a470d..0000000000
--- a/src/gallium/winsys/xlib/xlib.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2007 Tungsten Graphics, Inc., Bismarck, ND., USA
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- *
- **************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell
- */
-
-#include "xlib.h"
-#include "xm_winsys.h"
-
-#include <stdlib.h>
-#include <assert.h>
-
-/* Todo, replace all this with callback-structs provided by the
- * individual implementations.
- */
-
-enum mode {
- MODE_CELL,
- MODE_LLVMPIPE,
- MODE_SOFTPIPE
-};
-
-/* advertise OpenGL support */
-PUBLIC const int st_api_OpenGL = 1;
-
-static enum mode get_mode()
-{
-#ifdef GALLIUM_CELL
- if (!getenv("GALLIUM_NOCELL"))
- return MODE_CELL;
-#endif
-
-#if defined(GALLIUM_LLVMPIPE)
- return MODE_LLVMPIPE;
-#else
- return MODE_SOFTPIPE;
-#endif
-}
-
-static void _init( void ) __attribute__((constructor));
-
-static void _init( void )
-{
- enum mode xlib_mode = get_mode();
-
- switch (xlib_mode) {
- case MODE_CELL:
-#if defined(GALLIUM_CELL)
- xmesa_set_driver( &xlib_cell_driver );
-#endif
- break;
- case MODE_LLVMPIPE:
-#if defined(GALLIUM_LLVMPIPE)
- xmesa_set_driver( &xlib_llvmpipe_driver );
-#endif
- break;
- case MODE_SOFTPIPE:
-#if defined(GALLIUM_SOFTPIPE)
- xmesa_set_driver( &xlib_softpipe_driver );
-#endif
- break;
- default:
- assert(0);
- break;
- }
-}
-
-
-/***********************************************************************
- *
- * Butt-ugly hack to convince the linker not to throw away public GL
- * symbols (they are all referenced from getprocaddress, I guess).
- */
-extern void (*linker_foo(const unsigned char *procName))();
-extern void (*glXGetProcAddress(const unsigned char *procName))();
-
-extern void (*linker_foo(const unsigned char *procName))()
-{
- return glXGetProcAddress(procName);
-}
-
-
-/**
- * When GLX_INDIRECT_RENDERING is defined, some symbols are missing in
- * libglapi.a. We need to define them here.
- */
-#ifdef GLX_INDIRECT_RENDERING
-
-#define GL_GLEXT_PROTOTYPES
-#include "GL/gl.h"
-#include "glapi/glapi.h"
-#include "glapi/glapitable.h"
-#include "glapi/glapidispatch.h"
-
-#if defined(USE_MGL_NAMESPACE)
-#define NAME(func) mgl##func
-#else
-#define NAME(func) gl##func
-#endif
-
-#define DISPATCH(FUNC, ARGS, MESSAGE) \
- CALL_ ## FUNC(GET_DISPATCH(), ARGS);
-
-#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \
- return CALL_ ## FUNC(GET_DISPATCH(), ARGS);
-
-/* skip normal ones */
-#define _GLAPI_SKIP_NORMAL_ENTRY_POINTS
-#include "glapi/glapitemp.h"
-
-#endif /* GLX_INDIRECT_RENDERING */
diff --git a/src/gallium/winsys/xlib/xlib.h b/src/gallium/winsys/xlib/xlib.h
deleted file mode 100644
index 8e091d0c08..0000000000
--- a/src/gallium/winsys/xlib/xlib.h
+++ /dev/null
@@ -1,13 +0,0 @@
-
-#ifndef XLIB_H
-#define XLIB_H
-
-#include "pipe/p_compiler.h"
-#include "xm_winsys.h"
-
-extern struct xm_driver xlib_softpipe_driver;
-extern struct xm_driver xlib_llvmpipe_driver;
-extern struct xm_driver xlib_cell_driver;
-
-
-#endif
diff --git a/src/gallium/winsys/xlib/xlib_brw_context.c b/src/gallium/winsys/xlib/xlib_brw_context.c
deleted file mode 100644
index 22bf41a46f..0000000000
--- a/src/gallium/winsys/xlib/xlib_brw_context.c
+++ /dev/null
@@ -1,209 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2007 Tungsten Graphics, Inc., Bismarck, ND., USA
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- *
- **************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell
- * Brian Paul
- */
-
-
-/* #include "glxheader.h" */
-/* #include "xmesaP.h" */
-
-#include "util/u_simple_screen.h"
-#include "util/u_inlines.h"
-#include "util/u_math.h"
-#include "util/u_memory.h"
-#include "i965simple/brw_winsys.h"
-#include "xlib_brw_aub.h"
-#include "xlib_brw.h"
-
-
-
-
-#define XBCWS_BATCHBUFFER_SIZE 1024
-
-
-/* The backend to the brw driver (ie struct brw_winsys) is actually a
- * per-context entity.
- */
-struct xlib_brw_context_winsys {
- struct brw_winsys brw_context_winsys; /**< batch buffer funcs */
- struct aub_context *aub;
-
- struct pipe_winsys *pipe_winsys;
-
- unsigned batch_data[XBCWS_BATCHBUFFER_SIZE];
- unsigned batch_nr;
- unsigned batch_size;
- unsigned batch_alloc;
-};
-
-
-/* Turn a brw_winsys into an xlib_brw_context_winsys:
- */
-static inline struct xlib_brw_context_winsys *
-xlib_brw_context_winsys( struct brw_winsys *sws )
-{
- return (struct xlib_brw_context_winsys *)sws;
-}
-
-
-/* Simple batchbuffer interface:
- */
-
-static unsigned *xbcws_batch_start( struct brw_winsys *sws,
- unsigned dwords,
- unsigned relocs )
-{
- struct xlib_brw_context_winsys *xbcws = xlib_brw_context_winsys(sws);
-
- if (xbcws->batch_size < xbcws->batch_nr + dwords)
- return NULL;
-
- xbcws->batch_alloc = xbcws->batch_nr + dwords;
- return (void *)1; /* not a valid pointer! */
-}
-
-static void xbcws_batch_dword( struct brw_winsys *sws,
- unsigned dword )
-{
- struct xlib_brw_context_winsys *xbcws = xlib_brw_context_winsys(sws);
-
- assert(xbcws->batch_nr < xbcws->batch_alloc);
- xbcws->batch_data[xbcws->batch_nr++] = dword;
-}
-
-static void xbcws_batch_reloc( struct brw_winsys *sws,
- struct pipe_buffer *buf,
- unsigned access_flags,
- unsigned delta )
-{
- struct xlib_brw_context_winsys *xbcws = xlib_brw_context_winsys(sws);
-
- assert(xbcws->batch_nr < xbcws->batch_alloc);
- xbcws->batch_data[xbcws->batch_nr++] =
- ( xlib_brw_get_buffer_offset( NULL, buf, access_flags ) +
- delta );
-}
-
-static void xbcws_batch_end( struct brw_winsys *sws )
-{
- struct xlib_brw_context_winsys *xbcws = xlib_brw_context_winsys(sws);
-
- assert(xbcws->batch_nr <= xbcws->batch_alloc);
- xbcws->batch_alloc = 0;
-}
-
-static void xbcws_batch_flush( struct brw_winsys *sws,
- struct pipe_fence_handle **fence )
-{
- struct xlib_brw_context_winsys *xbcws = xlib_brw_context_winsys(sws);
- assert(xbcws->batch_nr <= xbcws->batch_size);
-
- if (xbcws->batch_nr) {
- xlib_brw_commands_aub( xbcws->pipe_winsys,
- xbcws->batch_data,
- xbcws->batch_nr );
- }
-
- xbcws->batch_nr = 0;
-}
-
-
-
-/* Really a per-device function, just pass through:
- */
-static unsigned xbcws_get_buffer_offset( struct brw_winsys *sws,
- struct pipe_buffer *buf,
- unsigned access_flags )
-{
- struct xlib_brw_context_winsys *xbcws = xlib_brw_context_winsys(sws);
-
- return xlib_brw_get_buffer_offset( xbcws->pipe_winsys,
- buf,
- access_flags );
-}
-
-
-/* Really a per-device function, just pass through:
- */
-static void xbcws_buffer_subdata_typed( struct brw_winsys *sws,
- struct pipe_buffer *buf,
- unsigned long offset,
- unsigned long size,
- const void *data,
- unsigned data_type )
-{
- struct xlib_brw_context_winsys *xbcws = xlib_brw_context_winsys(sws);
-
- xlib_brw_buffer_subdata_typed( xbcws->pipe_winsys,
- buf,
- offset,
- size,
- data,
- data_type );
-}
-
-
-/**
- * Create i965 hardware rendering context, but plugged into a
- * dump-to-aubfile backend.
- */
-struct pipe_context *
-xlib_create_brw_context( struct pipe_screen *screen,
- void *unused )
-{
- struct xlib_brw_context_winsys *xbcws = CALLOC_STRUCT( xlib_brw_context_winsys );
-
- /* Fill in this struct with callbacks that i965simple will need to
- * communicate with the window system, buffer manager, etc.
- */
- xbcws->brw_context_winsys.batch_start = xbcws_batch_start;
- xbcws->brw_context_winsys.batch_dword = xbcws_batch_dword;
- xbcws->brw_context_winsys.batch_reloc = xbcws_batch_reloc;
- xbcws->brw_context_winsys.batch_end = xbcws_batch_end;
- xbcws->brw_context_winsys.batch_flush = xbcws_batch_flush;
- xbcws->brw_context_winsys.buffer_subdata_typed = xbcws_buffer_subdata_typed;
- xbcws->brw_context_winsys.get_buffer_offset = xbcws_get_buffer_offset;
-
- xbcws->pipe_winsys = screen->winsys; /* redundant */
-
- xbcws->batch_size = XBCWS_BATCHBUFFER_SIZE;
-
- /* Create the i965simple context:
- */
-#ifdef GALLIUM_CELL
- return NULL;
-#else
- return brw_create( screen,
- &xbcws->brw_context_winsys,
- 0 );
-#endif
-}
diff --git a/src/gallium/winsys/xlib/xlib_cell.c b/src/gallium/winsys/xlib/xlib_cell.c
deleted file mode 100644
index 1dc9e8fa11..0000000000
--- a/src/gallium/winsys/xlib/xlib_cell.c
+++ /dev/null
@@ -1,401 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2007 Tungsten Graphics, Inc., Bismarck, ND., USA
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- *
- **************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell
- * Brian Paul
- */
-
-#include "xlib.h"
-
-#ifdef GALLIUM_CELL
-
-#include "xm_api.h"
-
-#undef ASSERT
-#undef Elements
-
-#include "util/u_simple_screen.h"
-#include "pipe/p_format.h"
-#include "pipe/p_context.h"
-#include "util/u_inlines.h"
-#include "util/u_format.h"
-#include "util/u_math.h"
-#include "util/u_memory.h"
-
-#include "cell/ppu/cell_context.h"
-#include "cell/ppu/cell_screen.h"
-#include "cell/ppu/cell_winsys.h"
-#include "cell/ppu/cell_texture.h"
-
-
-/**
- * Subclass of pipe_buffer for Xlib winsys.
- * Low-level OS/window system memory buffer
- */
-struct xm_buffer
-{
- struct pipe_buffer base;
- boolean userBuffer; /** Is this a user-space buffer? */
- void *data;
- void *mapped;
-
- XImage *tempImage;
- int shm;
-};
-
-
-/**
- * Subclass of pipe_winsys for Xlib winsys
- */
-struct xmesa_pipe_winsys
-{
- struct pipe_winsys base;
-};
-
-
-
-/** Cast wrapper */
-static INLINE struct xm_buffer *
-xm_buffer( struct pipe_buffer *buf )
-{
- return (struct xm_buffer *)buf;
-}
-
-
-/* Most callbacks map direcly onto dri_bufmgr operations:
- */
-static void *
-xm_buffer_map(struct pipe_winsys *pws, struct pipe_buffer *buf,
- unsigned flags)
-{
- struct xm_buffer *xm_buf = xm_buffer(buf);
- xm_buf->mapped = xm_buf->data;
- return xm_buf->mapped;
-}
-
-static void
-xm_buffer_unmap(struct pipe_winsys *pws, struct pipe_buffer *buf)
-{
- struct xm_buffer *xm_buf = xm_buffer(buf);
- xm_buf->mapped = NULL;
-}
-
-static void
-xm_buffer_destroy(/*struct pipe_winsys *pws,*/
- struct pipe_buffer *buf)
-{
- struct xm_buffer *oldBuf = xm_buffer(buf);
-
- if (oldBuf) {
- if (oldBuf->data) {
- if (!oldBuf->userBuffer) {
- align_free(oldBuf->data);
- }
-
- oldBuf->data = NULL;
- }
- free(oldBuf);
- }
-}
-
-
-/**
- * For Cell. Basically, rearrange the pixels/quads from this layout:
- * +--+--+--+--+
- * |p0|p1|p2|p3|....
- * +--+--+--+--+
- *
- * to this layout:
- * +--+--+
- * |p0|p1|....
- * +--+--+
- * |p2|p3|
- * +--+--+
- */
-static void
-twiddle_tile(const uint *tileIn, uint *tileOut)
-{
- int y, x;
-
- for (y = 0; y < TILE_SIZE; y+=2) {
- for (x = 0; x < TILE_SIZE; x+=2) {
- int k = 4 * (y/2 * TILE_SIZE/2 + x/2);
- tileOut[y * TILE_SIZE + (x + 0)] = tileIn[k];
- tileOut[y * TILE_SIZE + (x + 1)] = tileIn[k+1];
- tileOut[(y + 1) * TILE_SIZE + (x + 0)] = tileIn[k+2];
- tileOut[(y + 1) * TILE_SIZE + (x + 1)] = tileIn[k+3];
- }
- }
-}
-
-
-
-/**
- * Display a surface that's in a tiled configuration. That is, all the
- * pixels for a TILE_SIZExTILE_SIZE block are contiguous in memory.
- */
-static void
-xlib_cell_display_surface(struct xmesa_buffer *b, struct pipe_surface *surf)
-{
- XImage *ximage;
- struct xm_buffer *xm_buf = xm_buffer(
- cell_texture(surf->texture)->buffer);
- const uint tilesPerRow = (surf->width + TILE_SIZE - 1) / TILE_SIZE;
- uint x, y;
-
- ximage = b->tempImage;
-
- /* check that the XImage has been previously initialized */
- assert(ximage->format);
- assert(ximage->bitmap_unit);
-
- /* update XImage's fields */
- ximage->width = TILE_SIZE;
- ximage->height = TILE_SIZE;
- ximage->bytes_per_line = TILE_SIZE * 4;
-
- for (y = 0; y < surf->height; y += TILE_SIZE) {
- for (x = 0; x < surf->width; x += TILE_SIZE) {
- uint tmpTile[TILE_SIZE * TILE_SIZE];
- int tx = x / TILE_SIZE;
- int ty = y / TILE_SIZE;
- int offset = ty * tilesPerRow + tx;
- int w = TILE_SIZE;
- int h = TILE_SIZE;
-
- if (y + h > surf->height)
- h = surf->height - y;
- if (x + w > surf->width)
- w = surf->width - x;
-
- /* offset in pixels */
- offset *= TILE_SIZE * TILE_SIZE;
-
- /* twiddle from ximage buffer to temp tile */
- twiddle_tile((uint *) xm_buf->data + offset, tmpTile);
- /* display temp tile data */
- ximage->data = (char *) tmpTile;
- XPutImage(b->xm_visual->display, b->drawable, b->gc,
- ximage, 0, 0, x, y, w, h);
- }
- }
-}
-
-
-
-
-
-static void
-xm_flush_frontbuffer(struct pipe_winsys *pws,
- struct pipe_surface *surf,
- void *context_private)
-{
- /*
- * The front color buffer is actually just another XImage buffer.
- * This function copies that XImage to the actual X Window.
- */
- XMesaContext xmctx = (XMesaContext) context_private;
- if (xmctx)
- xlib_cell_display_surface(xmctx->xm_buffer, surf);
-}
-
-
-
-static const char *
-xm_get_name(struct pipe_winsys *pws)
-{
- return "Xlib/Cell";
-}
-
-
-static struct pipe_buffer *
-xm_buffer_create(struct pipe_winsys *pws,
- unsigned alignment,
- unsigned usage,
- unsigned size)
-{
- struct xm_buffer *buffer = CALLOC_STRUCT(xm_buffer);
-
- pipe_reference_init(&buffer->base.reference, 1);
- buffer->base.alignment = alignment;
- buffer->base.usage = usage;
- buffer->base.size = size;
-
-
- if (buffer->data == NULL) {
- buffer->shm = 0;
-
- /* align to 16-byte multiple for Cell */
- buffer->data = align_malloc(size, max(alignment, 16));
- }
-
- return &buffer->base;
-}
-
-
-/**
- * Create buffer which wraps user-space data.
- */
-static struct pipe_buffer *
-xm_user_buffer_create(struct pipe_winsys *pws, void *ptr, unsigned bytes)
-{
- struct xm_buffer *buffer = CALLOC_STRUCT(xm_buffer);
- pipe_reference_init(&buffer->base.reference, 1);
- buffer->base.size = bytes;
- buffer->userBuffer = TRUE;
- buffer->data = ptr;
- buffer->shm = 0;
-
- return &buffer->base;
-}
-
-
-
-static struct pipe_buffer *
-xm_surface_buffer_create(struct pipe_winsys *winsys,
- unsigned width, unsigned height,
- enum pipe_format format,
- unsigned usage,
- unsigned tex_usage,
- unsigned *stride)
-{
- const unsigned alignment = 64;
- unsigned nblocksy;
-
- nblocksy = util_format_get_nblocksy(format, height);
- *stride = align(util_format_get_stride(format, width), alignment);
-
- return winsys->buffer_create(winsys, alignment,
- usage,
- /* XXX a bit of a hack */
- *stride * align(nblocksy, TILE_SIZE));
-}
-
-
-/*
- * Fence functions - basically nothing to do, as we don't create any actual
- * fence objects.
- */
-
-static void
-xm_fence_reference(struct pipe_winsys *sws, struct pipe_fence_handle **ptr,
- struct pipe_fence_handle *fence)
-{
-}
-
-
-static int
-xm_fence_signalled(struct pipe_winsys *sws, struct pipe_fence_handle *fence,
- unsigned flag)
-{
- return 0;
-}
-
-
-static int
-xm_fence_finish(struct pipe_winsys *sws, struct pipe_fence_handle *fence,
- unsigned flag)
-{
- return 0;
-}
-
-
-
-static struct pipe_winsys *
-xlib_create_cell_winsys( void )
-{
- static struct xmesa_pipe_winsys *ws = NULL;
-
- if (!ws) {
- ws = CALLOC_STRUCT(xmesa_pipe_winsys);
-
- /* Fill in this struct with callbacks that pipe will need to
- * communicate with the window system, buffer manager, etc.
- */
- ws->base.buffer_create = xm_buffer_create;
- ws->base.user_buffer_create = xm_user_buffer_create;
- ws->base.buffer_map = xm_buffer_map;
- ws->base.buffer_unmap = xm_buffer_unmap;
- ws->base.buffer_destroy = xm_buffer_destroy;
-
- ws->base.surface_buffer_create = xm_surface_buffer_create;
-
- ws->base.fence_reference = xm_fence_reference;
- ws->base.fence_signalled = xm_fence_signalled;
- ws->base.fence_finish = xm_fence_finish;
-
- ws->base.flush_frontbuffer = xm_flush_frontbuffer;
- ws->base.get_name = xm_get_name;
- }
-
- return &ws->base;
-}
-
-
-static struct pipe_screen *
-xlib_create_cell_screen( void )
-{
- struct pipe_winsys *winsys;
- struct pipe_screen *screen;
-
- winsys = xlib_create_cell_winsys();
- if (winsys == NULL)
- return NULL;
-
- screen = cell_create_screen(winsys);
- if (screen == NULL)
- goto fail;
-
- return screen;
-
-fail:
- if (winsys)
- winsys->destroy( winsys );
-
- return NULL;
-}
-
-
-
-struct xm_driver xlib_cell_driver =
-{
- .create_pipe_screen = xlib_create_cell_screen,
- .display_surface = xlib_cell_display_surface,
-};
-
-#else
-
-struct xm_driver xlib_cell_driver =
-{
- .create_pipe_screen = NULL,
- .display_surface = NULL,
-};
-
-#endif
diff --git a/src/gallium/winsys/xlib/xlib_softpipe.c b/src/gallium/winsys/xlib/xlib_softpipe.c
deleted file mode 100644
index 716338aef4..0000000000
--- a/src/gallium/winsys/xlib/xlib_softpipe.c
+++ /dev/null
@@ -1,508 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2007 Tungsten Graphics, Inc., Bismarck, ND., USA
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- *
- **************************************************************************/
-
-/*
- * Authors:
- * Keith Whitwell
- * Brian Paul
- */
-
-
-#include "xm_api.h"
-
-#undef ASSERT
-#undef Elements
-
-#include "util/u_simple_screen.h"
-#include "pipe/p_format.h"
-#include "pipe/p_context.h"
-#include "util/u_inlines.h"
-#include "util/u_format.h"
-#include "util/u_math.h"
-#include "util/u_memory.h"
-#include "softpipe/sp_winsys.h"
-#include "softpipe/sp_texture.h"
-
-#include "xlib.h"
-
-/**
- * Subclass of pipe_buffer for Xlib winsys.
- * Low-level OS/window system memory buffer
- */
-struct xm_buffer
-{
- struct pipe_buffer base;
- boolean userBuffer; /** Is this a user-space buffer? */
- void *data;
- void *mapped;
-
- XImage *tempImage;
-#ifdef USE_XSHM
- boolean shm; /** Is this a shared memory buffer? */
- XShmSegmentInfo shminfo;
-#endif
-};
-
-
-/**
- * Subclass of pipe_winsys for Xlib winsys
- */
-struct xmesa_pipe_winsys
-{
- struct pipe_winsys base;
-/* struct xmesa_visual *xm_visual; */
-};
-
-
-
-/** Cast wrapper */
-static INLINE struct xm_buffer *
-xm_buffer( struct pipe_buffer *buf )
-{
- return (struct xm_buffer *)buf;
-}
-
-
-/**
- * X Shared Memory Image extension code
- */
-
-#ifdef USE_XSHM
-
-static volatile int mesaXErrorFlag = 0;
-
-/**
- * Catches potential Xlib errors.
- */
-static int
-mesaHandleXError(Display *dpy, XErrorEvent *event)
-{
- (void) dpy;
- (void) event;
- mesaXErrorFlag = 1;
- return 0;
-}
-
-
-static char *alloc_shm(struct xm_buffer *buf, unsigned size)
-{
- XShmSegmentInfo *const shminfo = & buf->shminfo;
-
- shminfo->shmid = shmget(IPC_PRIVATE, size, IPC_CREAT|0777);
- if (shminfo->shmid < 0) {
- return NULL;
- }
-
- shminfo->shmaddr = (char *) shmat(shminfo->shmid, 0, 0);
- if (shminfo->shmaddr == (char *) -1) {
- shmctl(shminfo->shmid, IPC_RMID, 0);
- return NULL;
- }
-
- shminfo->readOnly = False;
- return shminfo->shmaddr;
-}
-
-
-/**
- * Allocate a shared memory XImage back buffer for the given XMesaBuffer.
- */
-static void
-alloc_shm_ximage(struct xm_buffer *b, struct xmesa_buffer *xmb,
- unsigned width, unsigned height)
-{
- /*
- * We have to do a _lot_ of error checking here to be sure we can
- * really use the XSHM extension. It seems different servers trigger
- * errors at different points if the extension won't work. Therefore
- * we have to be very careful...
- */
- int (*old_handler)(Display *, XErrorEvent *);
-
- b->tempImage = XShmCreateImage(xmb->xm_visual->display,
- xmb->xm_visual->visinfo->visual,
- xmb->xm_visual->visinfo->depth,
- ZPixmap,
- NULL,
- &b->shminfo,
- width, height);
- if (b->tempImage == NULL) {
- b->shm = FALSE;
- return;
- }
-
-
- mesaXErrorFlag = 0;
- old_handler = XSetErrorHandler(mesaHandleXError);
- /* This may trigger the X protocol error we're ready to catch: */
- XShmAttach(xmb->xm_visual->display, &b->shminfo);
- XSync(xmb->xm_visual->display, False);
-
- if (mesaXErrorFlag) {
- /* we are on a remote display, this error is normal, don't print it */
- XFlush(xmb->xm_visual->display);
- mesaXErrorFlag = 0;
- XDestroyImage(b->tempImage);
- b->tempImage = NULL;
- b->shm = FALSE;
- (void) XSetErrorHandler(old_handler);
- return;
- }
-
- b->shm = TRUE;
-}
-
-#endif /* USE_XSHM */
-
-
-
-/* Most callbacks map direcly onto dri_bufmgr operations:
- */
-static void *
-xm_buffer_map(struct pipe_winsys *pws, struct pipe_buffer *buf,
- unsigned flags)
-{
- struct xm_buffer *xm_buf = xm_buffer(buf);
- xm_buf->mapped = xm_buf->data;
- return xm_buf->mapped;
-}
-
-static void
-xm_buffer_unmap(struct pipe_winsys *pws, struct pipe_buffer *buf)
-{
- struct xm_buffer *xm_buf = xm_buffer(buf);
- xm_buf->mapped = NULL;
-}
-
-static void
-xm_buffer_destroy(struct pipe_buffer *buf)
-{
- struct xm_buffer *oldBuf = xm_buffer(buf);
-
- /*
- * Note oldBuf->data may point to one of three things:
- * 1. XShm shared memory image data
- * 2. User-provided (wrapped) memory, see xm_user_buffer_create()
- * 3. Regular, malloc'd memory
- * We need to be careful with freeing that data now.
- */
-
- if (oldBuf->data) {
-#ifdef USE_XSHM
- if (oldBuf->shminfo.shmid >= 0) {
- shmdt(oldBuf->shminfo.shmaddr);
- shmctl(oldBuf->shminfo.shmid, IPC_RMID, 0);
-
- oldBuf->shminfo.shmid = -1;
- oldBuf->shminfo.shmaddr = (char *) -1;
- }
-
- if (oldBuf->shm) {
- oldBuf->data = NULL;
- }
-
- if (oldBuf->tempImage) {
- XDestroyImage(oldBuf->tempImage);
- oldBuf->tempImage = NULL;
- }
-#endif
-
- if (oldBuf->data && !oldBuf->userBuffer) {
- /* this was regular malloc'd memory */
- align_free(oldBuf->data);
- }
-
- oldBuf->data = NULL;
- }
-
- free(oldBuf);
-}
-
-
-/**
- * Display/copy the image in the surface into the X window specified
- * by the XMesaBuffer.
- */
-static void
-xlib_softpipe_display_surface(struct xmesa_buffer *b,
- struct pipe_surface *surf)
-{
- XImage *ximage;
- struct softpipe_texture *spt = softpipe_texture(surf->texture);
- struct xm_buffer *xm_buf = xm_buffer(spt->buffer);
- static boolean no_swap = 0;
- static boolean firsttime = 1;
-
- if (firsttime) {
- no_swap = getenv("SP_NO_RAST") != NULL;
- firsttime = 0;
- }
-
- if (no_swap)
- return;
-
-#ifdef USE_XSHM
- if (xm_buf->shm)
- {
- if (xm_buf->tempImage == NULL)
- {
- assert(util_format_get_blockwidth(surf->texture->format) == 1);
- assert(util_format_get_blockheight(surf->texture->format) == 1);
- alloc_shm_ximage(xm_buf, b, spt->stride[surf->level] /
- util_format_get_blocksize(surf->texture->format), surf->height);
- }
-
- ximage = xm_buf->tempImage;
- ximage->data = xm_buf->data;
-
- /* _debug_printf("XSHM\n"); */
- XShmPutImage(b->xm_visual->display, b->drawable, b->gc,
- ximage, 0, 0, 0, 0, surf->width, surf->height, False);
- }
- else
-#endif
- {
- /* display image in Window */
- ximage = b->tempImage;
- ximage->data = xm_buf->data;
-
- /* check that the XImage has been previously initialized */
- assert(ximage->format);
- assert(ximage->bitmap_unit);
-
- /* update XImage's fields */
- ximage->width = surf->width;
- ximage->height = surf->height;
- ximage->bytes_per_line = spt->stride[surf->level];
-
- /* _debug_printf("XPUT\n"); */
- XPutImage(b->xm_visual->display, b->drawable, b->gc,
- ximage, 0, 0, 0, 0, surf->width, surf->height);
- }
-}
-
-
-static void
-xm_flush_frontbuffer(struct pipe_winsys *pws,
- struct pipe_surface *surf,
- void *context_private)
-{
- /*
- * The front color buffer is actually just another XImage buffer.
- * This function copies that XImage to the actual X Window.
- */
- XMesaContext xmctx = (XMesaContext) context_private;
- xlib_softpipe_display_surface(xmctx->xm_buffer, surf);
- xmesa_check_and_update_buffer_size(xmctx, xmctx->xm_buffer);
-}
-
-
-
-static const char *
-xm_get_name(struct pipe_winsys *pws)
-{
- return "Xlib";
-}
-
-
-static struct pipe_buffer *
-xm_buffer_create(struct pipe_winsys *pws,
- unsigned alignment,
- unsigned usage,
- unsigned size)
-{
- struct xm_buffer *buffer = CALLOC_STRUCT(xm_buffer);
-
- pipe_reference_init(&buffer->base.reference, 1);
- buffer->base.alignment = alignment;
- buffer->base.usage = usage;
- buffer->base.size = size;
-
- /* align to 16-byte multiple for Cell */
- buffer->data = align_malloc(size, max(alignment, 16));
-
- return &buffer->base;
-}
-
-
-/**
- * Create buffer which wraps user-space data.
- */
-static struct pipe_buffer *
-xm_user_buffer_create(struct pipe_winsys *pws, void *ptr, unsigned bytes)
-{
- struct xm_buffer *buffer = CALLOC_STRUCT(xm_buffer);
- pipe_reference_init(&buffer->base.reference, 1);
- buffer->base.size = bytes;
- buffer->userBuffer = TRUE;
- buffer->data = ptr;
-
- return &buffer->base;
-}
-
-
-static struct pipe_buffer *
-xm_surface_buffer_create(struct pipe_winsys *winsys,
- unsigned width, unsigned height,
- enum pipe_format format,
- unsigned usage,
- unsigned tex_usage,
- unsigned *stride)
-{
- const unsigned alignment = 64;
- unsigned nblocksy, size;
-
- nblocksy = util_format_get_nblocksy(format, height);
- *stride = align(util_format_get_stride(format, width), alignment);
- size = *stride * nblocksy;
-
-#ifdef USE_XSHM
- if (!debug_get_bool_option("XLIB_NO_SHM", FALSE))
- {
- struct xm_buffer *buffer = CALLOC_STRUCT(xm_buffer);
-
- pipe_reference_init(&buffer->base.reference, 1);
- buffer->base.alignment = alignment;
- buffer->base.usage = usage;
- buffer->base.size = size;
- buffer->userBuffer = FALSE;
- buffer->shminfo.shmid = -1;
- buffer->shminfo.shmaddr = (char *) -1;
- buffer->shm = TRUE;
-
- buffer->data = alloc_shm(buffer, size);
- if (!buffer->data)
- goto out;
-
- return &buffer->base;
-
- out:
- if (buffer)
- FREE(buffer);
- }
-#endif
-
-
- return winsys->buffer_create(winsys, alignment,
- usage,
- size);
-}
-
-
-/*
- * Fence functions - basically nothing to do, as we don't create any actual
- * fence objects.
- */
-
-static void
-xm_fence_reference(struct pipe_winsys *sws, struct pipe_fence_handle **ptr,
- struct pipe_fence_handle *fence)
-{
-}
-
-
-static int
-xm_fence_signalled(struct pipe_winsys *sws, struct pipe_fence_handle *fence,
- unsigned flag)
-{
- return 0;
-}
-
-
-static int
-xm_fence_finish(struct pipe_winsys *sws, struct pipe_fence_handle *fence,
- unsigned flag)
-{
- return 0;
-}
-
-
-
-static struct pipe_winsys *
-xlib_create_softpipe_winsys( void )
-{
- static struct xmesa_pipe_winsys *ws = NULL;
-
- if (!ws) {
- ws = CALLOC_STRUCT(xmesa_pipe_winsys);
-
- /* Fill in this struct with callbacks that pipe will need to
- * communicate with the window system, buffer manager, etc.
- */
- ws->base.buffer_create = xm_buffer_create;
- ws->base.user_buffer_create = xm_user_buffer_create;
- ws->base.buffer_map = xm_buffer_map;
- ws->base.buffer_unmap = xm_buffer_unmap;
- ws->base.buffer_destroy = xm_buffer_destroy;
-
- ws->base.surface_buffer_create = xm_surface_buffer_create;
-
- ws->base.fence_reference = xm_fence_reference;
- ws->base.fence_signalled = xm_fence_signalled;
- ws->base.fence_finish = xm_fence_finish;
-
- ws->base.flush_frontbuffer = xm_flush_frontbuffer;
- ws->base.get_name = xm_get_name;
- }
-
- return &ws->base;
-}
-
-
-static struct pipe_screen *
-xlib_create_softpipe_screen( void )
-{
- struct pipe_winsys *winsys;
- struct pipe_screen *screen;
-
- winsys = xlib_create_softpipe_winsys();
- if (winsys == NULL)
- return NULL;
-
- screen = softpipe_create_screen(winsys);
- if (screen == NULL)
- goto fail;
-
- return screen;
-
-fail:
- if (winsys)
- winsys->destroy( winsys );
-
- return NULL;
-}
-
-
-struct xm_driver xlib_softpipe_driver =
-{
- .create_pipe_screen = xlib_create_softpipe_screen,
- .display_surface = xlib_softpipe_display_surface
-};
-
-
-
diff --git a/src/gallium/winsys/xlib/xmesa.h b/src/gallium/winsys/xlib/xmesa.h
deleted file mode 100644
index 98139af833..0000000000
--- a/src/gallium/winsys/xlib/xmesa.h
+++ /dev/null
@@ -1,424 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.1
- *
- * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-/*
- * Mesa/X11 interface. This header file serves as the documentation for
- * the Mesa/X11 interface functions.
- *
- * Note: this interface isn't intended for user programs. It's primarily
- * just for implementing the pseudo-GLX interface.
- */
-
-
-/* Sample Usage:
-
-In addition to the usual X calls to select a visual, create a colormap
-and create a window, you must do the following to use the X/Mesa interface:
-
-1. Call XMesaCreateVisual() to make an XMesaVisual from an XVisualInfo.
-
-2. Call XMesaCreateContext() to create an X/Mesa rendering context, given
- the XMesaVisual.
-
-3. Call XMesaCreateWindowBuffer() to create an XMesaBuffer from an X window
- and XMesaVisual.
-
-4. Call XMesaMakeCurrent() to bind the XMesaBuffer to an XMesaContext and
- to make the context the current one.
-
-5. Make gl* calls to render your graphics.
-
-6. Use XMesaSwapBuffers() when double buffering to swap front/back buffers.
-
-7. Before the X window is destroyed, call XMesaDestroyBuffer().
-
-8. Before exiting, call XMesaDestroyVisual and XMesaDestroyContext.
-
-*/
-
-
-
-
-#ifndef XMESA_H
-#define XMESA_H
-
-#ifdef __VMS
-#include <GL/vms_x_fix.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef XFree86Server
-#include "xmesa_xf86.h"
-#else
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include "xmesa_x.h"
-#endif
-#include "GL/gl.h"
-
-#ifdef AMIWIN
-#include <pragmas/xlib_pragmas.h>
-extern struct Library *XLibBase;
-#endif
-
-
-#define XMESA_MAJOR_VERSION 6
-#define XMESA_MINOR_VERSION 3
-
-
-
-/*
- * Values passed to XMesaGetString:
- */
-#define XMESA_VERSION 1
-#define XMESA_EXTENSIONS 2
-
-
-/*
- * Values passed to XMesaSetFXmode:
- */
-#define XMESA_FX_WINDOW 1
-#define XMESA_FX_FULLSCREEN 2
-
-
-
-typedef struct xmesa_context *XMesaContext;
-
-typedef struct xmesa_visual *XMesaVisual;
-
-typedef struct xmesa_buffer *XMesaBuffer;
-
-
-
-/*
- * Create a new X/Mesa visual.
- * Input: display - X11 display
- * visinfo - an XVisualInfo pointer
- * rgb_flag - GL_TRUE = RGB mode,
- * GL_FALSE = color index mode
- * alpha_flag - alpha buffer requested?
- * db_flag - GL_TRUE = double-buffered,
- * GL_FALSE = single buffered
- * stereo_flag - stereo visual?
- * ximage_flag - GL_TRUE = use an XImage for back buffer,
- * GL_FALSE = use an off-screen pixmap for back buffer
- * depth_size - requested bits/depth values, or zero
- * stencil_size - requested bits/stencil values, or zero
- * accum_red_size - requested bits/red accum values, or zero
- * accum_green_size - requested bits/green accum values, or zero
- * accum_blue_size - requested bits/blue accum values, or zero
- * accum_alpha_size - requested bits/alpha accum values, or zero
- * num_samples - number of samples/pixel if multisampling, or zero
- * level - visual level, usually 0
- * visualCaveat - ala the GLX extension, usually GLX_NONE_EXT
- * Return; a new XMesaVisual or 0 if error.
- */
-extern XMesaVisual XMesaCreateVisual( XMesaDisplay *display,
- XMesaVisualInfo visinfo,
- GLboolean rgb_flag,
- GLboolean alpha_flag,
- GLboolean db_flag,
- GLboolean stereo_flag,
- GLboolean ximage_flag,
- GLint depth_size,
- GLint stencil_size,
- GLint accum_red_size,
- GLint accum_green_size,
- GLint accum_blue_size,
- GLint accum_alpha_size,
- GLint num_samples,
- GLint level,
- GLint visualCaveat );
-
-/*
- * Destroy an XMesaVisual, but not the associated XVisualInfo.
- */
-extern void XMesaDestroyVisual( XMesaVisual v );
-
-
-
-/*
- * Create a new XMesaContext for rendering into an X11 window.
- *
- * Input: visual - an XMesaVisual
- * share_list - another XMesaContext with which to share display
- * lists or NULL if no sharing is wanted.
- * Return: an XMesaContext or NULL if error.
- */
-extern XMesaContext XMesaCreateContext( XMesaVisual v,
- XMesaContext share_list );
-
-
-/*
- * Destroy a rendering context as returned by XMesaCreateContext()
- */
-extern void XMesaDestroyContext( XMesaContext c );
-
-
-#ifdef XFree86Server
-/*
- * These are the extra routines required for integration with XFree86.
- * None of these routines should be user visible. -KEM
- */
-extern GLboolean XMesaForceCurrent( XMesaContext c );
-
-extern GLboolean XMesaLoseCurrent( XMesaContext c );
-
-extern GLboolean XMesaCopyContext( XMesaContext src,
- XMesaContext dst,
- GLuint mask );
-#endif /* XFree86Server */
-
-
-/*
- * Create an XMesaBuffer from an X window.
- */
-extern XMesaBuffer XMesaCreateWindowBuffer( XMesaVisual v, XMesaWindow w );
-
-
-/*
- * Create an XMesaBuffer from an X pixmap.
- */
-extern XMesaBuffer XMesaCreatePixmapBuffer( XMesaVisual v,
- XMesaPixmap p,
- XMesaColormap cmap );
-
-
-/*
- * Destroy an XMesaBuffer, but not the corresponding window or pixmap.
- */
-extern void XMesaDestroyBuffer( XMesaBuffer b );
-
-
-/*
- * Return the XMesaBuffer handle which corresponds to an X drawable, if any.
- *
- * New in Mesa 2.3.
- */
-extern XMesaBuffer XMesaFindBuffer( XMesaDisplay *dpy,
- XMesaDrawable d );
-
-
-
-/*
- * Bind a buffer to a context and make the context the current one.
- */
-extern GLboolean XMesaMakeCurrent( XMesaContext c,
- XMesaBuffer b );
-
-
-/*
- * Bind two buffers (read and draw) to a context and make the
- * context the current one.
- * New in Mesa 3.3
- */
-extern GLboolean XMesaMakeCurrent2( XMesaContext c,
- XMesaBuffer drawBuffer,
- XMesaBuffer readBuffer );
-
-
-/*
- * Unbind the current context from its buffer.
- */
-extern GLboolean XMesaUnbindContext( XMesaContext c );
-
-
-/*
- * Return a handle to the current context.
- */
-extern XMesaContext XMesaGetCurrentContext( void );
-
-
-/*
- * Return handle to the current (draw) buffer.
- */
-extern XMesaBuffer XMesaGetCurrentBuffer( void );
-
-
-/*
- * Return handle to the current read buffer.
- * New in Mesa 3.3
- */
-extern XMesaBuffer XMesaGetCurrentReadBuffer( void );
-
-
-/*
- * Swap the front and back buffers for the given buffer. No action is
- * taken if the buffer is not double buffered.
- */
-extern void XMesaSwapBuffers( XMesaBuffer b );
-
-
-/*
- * Copy a sub-region of the back buffer to the front buffer.
- *
- * New in Mesa 2.6
- */
-extern void XMesaCopySubBuffer( XMesaBuffer b,
- int x,
- int y,
- int width,
- int height );
-
-
-/*
- * Return a pointer to the the Pixmap or XImage being used as the back
- * color buffer of an XMesaBuffer. This function is a way to get "under
- * the hood" of X/Mesa so one can manipulate the back buffer directly.
- * Input: b - the XMesaBuffer
- * Output: pixmap - pointer to back buffer's Pixmap, or 0
- * ximage - pointer to back buffer's XImage, or NULL
- * Return: GL_TRUE = context is double buffered
- * GL_FALSE = context is single buffered
- */
-extern GLboolean XMesaGetBackBuffer( XMesaBuffer b,
- XMesaPixmap *pixmap,
- XMesaImage **ximage );
-
-
-
-/*
- * Return the depth buffer associated with an XMesaBuffer.
- * Input: b - the XMesa buffer handle
- * Output: width, height - size of buffer in pixels
- * bytesPerValue - bytes per depth value (2 or 4)
- * buffer - pointer to depth buffer values
- * Return: GL_TRUE or GL_FALSE to indicate success or failure.
- *
- * New in Mesa 2.4.
- */
-extern GLboolean XMesaGetDepthBuffer( XMesaBuffer b,
- GLint *width,
- GLint *height,
- GLint *bytesPerValue,
- void **buffer );
-
-
-
-/*
- * Flush/sync a context
- */
-extern void XMesaFlush( XMesaContext c );
-
-
-
-/*
- * Get an X/Mesa-specific string.
- * Input: name - either XMESA_VERSION or XMESA_EXTENSIONS
- */
-extern const char *XMesaGetString( XMesaContext c, int name );
-
-
-
-/*
- * Scan for XMesaBuffers whose window/pixmap has been destroyed, then free
- * any memory used by that buffer.
- *
- * New in Mesa 2.3.
- */
-extern void XMesaGarbageCollect( void );
-
-
-
-/*
- * Return a dithered pixel value.
- * Input: c - XMesaContext
- * x, y - window coordinate
- * red, green, blue, alpha - color components in [0,1]
- * Return: pixel value
- *
- * New in Mesa 2.3.
- */
-extern unsigned long XMesaDitherColor( XMesaContext xmesa,
- GLint x,
- GLint y,
- GLfloat red,
- GLfloat green,
- GLfloat blue,
- GLfloat alpha );
-
-
-
-/*
- * 3Dfx Glide driver only!
- * Set 3Dfx/Glide full-screen or window rendering mode.
- * Input: mode - either XMESA_FX_WINDOW (window rendering mode) or
- * XMESA_FX_FULLSCREEN (full-screen rendering mode)
- * Return: GL_TRUE if success
- * GL_FALSE if invalid mode or if not using 3Dfx driver
- *
- * New in Mesa 2.6.
- */
-extern GLboolean XMesaSetFXmode( GLint mode );
-
-
-
-/*
- * Reallocate the back/depth/stencil/accum/etc/ buffers associated with
- * buffer <b> if its size has changed.
- *
- * New in Mesa 4.0.2
- */
-extern void XMesaResizeBuffers( XMesaBuffer b );
-
-
-
-/*
- * Create a pbuffer.
- * New in Mesa 4.1
- */
-extern XMesaBuffer XMesaCreatePBuffer(XMesaVisual v, XMesaColormap cmap,
- unsigned int width, unsigned int height);
-
-
-
-/*
- * Texture from Pixmap
- * New in Mesa 7.1
- */
-extern void
-XMesaBindTexImage(XMesaDisplay *dpy, XMesaBuffer drawable, int buffer,
- const int *attrib_list);
-
-extern void
-XMesaReleaseTexImage(XMesaDisplay *dpy, XMesaBuffer drawable, int buffer);
-
-
-extern XMesaBuffer
-XMesaCreatePixmapTextureBuffer(XMesaVisual v, XMesaPixmap p,
- XMesaColormap cmap,
- int format, int target, int mipmap);
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
diff --git a/src/gallium/winsys/xlib/xmesa_x.h b/src/gallium/winsys/xlib/xmesa_x.h
deleted file mode 100644
index 865bab4313..0000000000
--- a/src/gallium/winsys/xlib/xmesa_x.h
+++ /dev/null
@@ -1,86 +0,0 @@
-
-/**************************************************************************
-
-Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * Authors:
- * Kevin E. Martin <kevin@precisioninsight.com>
- *
- * When we're building the XMesa driver for stand-alone Mesa we
- * include this file when building the xm_*.c files.
- * We need to define some types and macros differently when building
- * in the Xserver vs. stand-alone Mesa.
- */
-
-#ifndef _XMESA_X_H_
-#define _XMESA_X_H_
-
-typedef Display XMesaDisplay;
-typedef Pixmap XMesaPixmap;
-typedef Colormap XMesaColormap;
-typedef Drawable XMesaDrawable;
-typedef Window XMesaWindow;
-typedef GC XMesaGC;
-typedef XVisualInfo *XMesaVisualInfo;
-typedef XImage XMesaImage;
-typedef XPoint XMesaPoint;
-typedef XColor XMesaColor;
-
-#define XMesaDestroyImage XDestroyImage
-
-#define XMesaPutPixel XPutPixel
-#define XMesaGetPixel XGetPixel
-
-#define XMesaSetForeground XSetForeground
-#define XMesaSetBackground XSetBackground
-#define XMesaSetPlaneMask XSetPlaneMask
-#define XMesaSetFunction XSetFunction
-#define XMesaSetFillStyle XSetFillStyle
-#define XMesaSetTile XSetTile
-
-#define XMesaDrawPoint XDrawPoint
-#define XMesaDrawPoints XDrawPoints
-#define XMesaDrawLine XDrawLine
-#define XMesaFillRectangle XFillRectangle
-#define XMesaGetImage XGetImage
-#define XMesaPutImage XPutImage
-#define XMesaCopyArea XCopyArea
-
-#define XMesaCreatePixmap XCreatePixmap
-#define XMesaFreePixmap XFreePixmap
-#define XMesaFreeGC XFreeGC
-
-#define GET_COLORMAP_SIZE(__v) __v->visinfo->colormap_size
-#define GET_REDMASK(__v) __v->mesa_visual.redMask
-#define GET_GREENMASK(__v) __v->mesa_visual.greenMask
-#define GET_BLUEMASK(__v) __v->mesa_visual.blueMask
-#define GET_VISUAL_DEPTH(__v) __v->visinfo->depth
-#define GET_BLACK_PIXEL(__v) BlackPixel(__v->display, __v->mesa_visual.screen)
-#define CHECK_BYTE_ORDER(__v) host_byte_order()==ImageByteOrder(__v->display)
-#define CHECK_FOR_HPCR(__v) XInternAtom(__v->display, "_HP_RGB_SMOOTH_MAP_LIST", True)
-
-#endif
diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
index 1b94a56fd1..786faff81c 100644
--- a/src/glx/drisw_glx.c
+++ b/src/glx/drisw_glx.c
@@ -53,13 +53,8 @@ struct __GLXDRIdrawablePrivateRec
XVisualInfo *visinfo;
XImage *ximage;
- int bpp;
};
-/**
- * swrast loader functions
- */
-
static Bool
XCreateDrawable(__GLXDRIdrawablePrivate * pdp,
Display * dpy, XID drawable, int visualid)
@@ -79,20 +74,21 @@ XCreateDrawable(__GLXDRIdrawablePrivate * pdp,
XChangeGC(dpy, pdp->swapgc, GCFunction, &gcvalues);
XChangeGC(dpy, pdp->swapgc, GCGraphicsExposures, &gcvalues);
- /* create XImage */
+ /* visual */
visTemp.screen = DefaultScreen(dpy);
visTemp.visualid = visualid;
visMask = (VisualScreenMask | VisualIDMask);
pdp->visinfo = XGetVisualInfo(dpy, visMask, &visTemp, &num_visuals);
- pdp->ximage = XCreateImage(dpy, pdp->visinfo->visual, pdp->visinfo->depth, ZPixmap, 0, /* format, offset */
- NULL, /* data */
- 0, 0, /* size */
- 32, /* bitmap_pad */
- 0); /* bytes_per_line */
-
- /* get the true number of bits per pixel */
- pdp->bpp = pdp->ximage->bits_per_pixel;
+ /* create XImage */
+ pdp->ximage = XCreateImage(dpy,
+ pdp->visinfo->visual,
+ pdp->visinfo->depth,
+ ZPixmap, 0, /* format, offset */
+ NULL, /* data */
+ 0, 0, /* width, height */
+ 32, /* bitmap_pad */
+ 0); /* bytes_per_line */
return True;
}
@@ -107,9 +103,14 @@ XDestroyDrawable(__GLXDRIdrawablePrivate * pdp, Display * dpy, XID drawable)
XFreeGC(dpy, pdp->swapgc);
}
+/**
+ * swrast loader functions
+ */
+
static void
swrastGetDrawableInfo(__DRIdrawable * draw,
- int *x, int *y, int *w, int *h, void *loaderPrivate)
+ int *x, int *y, int *w, int *h,
+ void *loaderPrivate)
{
__GLXDRIdrawablePrivate *pdp = loaderPrivate;
__GLXDRIdrawable *pdraw = &(pdp->base);
@@ -118,26 +119,42 @@ swrastGetDrawableInfo(__DRIdrawable * draw,
Window root;
Status stat;
- unsigned int bw, depth;
+ unsigned uw, uh, bw, depth;
drawable = pdraw->xDrawable;
stat = XGetGeometry(dpy, drawable, &root,
- x, y, (unsigned int *) w, (unsigned int *) h,
- &bw, &depth);
+ x, y, &uw, &uh, &bw, &depth);
+ *w = uw;
+ *h = uh;
}
+/**
+ * Align renderbuffer pitch.
+ *
+ * This should be chosen by the driver and the loader (libGL, xserver/glx)
+ * should use the driver provided pitch.
+ *
+ * It seems that the xorg loader (that is the xserver loading swrast_dri for
+ * indirect rendering, not client-side libGL) requires that the pitch is
+ * exactly the image width padded to 32 bits. XXX
+ *
+ * The above restriction can probably be overcome by using ScratchPixmap and
+ * CopyArea in the xserver, similar to ShmPutImage, and setting the width of
+ * the scratch pixmap to 'pitch / cpp'.
+ */
static inline int
-bytes_per_line(int w, int bpp, unsigned mul)
+bytes_per_line(unsigned pitch_bits, unsigned mul)
{
unsigned mask = mul - 1;
- return ((w * bpp + mask) & ~mask) / 8;
+ return ((pitch_bits + mask) & ~mask) / 8;
}
static void
swrastPutImage(__DRIdrawable * draw, int op,
- int x, int y, int w, int h, char *data, void *loaderPrivate)
+ int x, int y, int w, int h,
+ char *data, void *loaderPrivate)
{
__GLXDRIdrawablePrivate *pdp = loaderPrivate;
__GLXDRIdrawable *pdraw = &(pdp->base);
@@ -163,7 +180,7 @@ swrastPutImage(__DRIdrawable * draw, int op,
ximage->data = data;
ximage->width = w;
ximage->height = h;
- ximage->bytes_per_line = bytes_per_line(w, pdp->bpp, 32);
+ ximage->bytes_per_line = bytes_per_line(w * ximage->bits_per_pixel, 32);
XPutImage(dpy, drawable, gc, ximage, 0, 0, x, y, w, h);
@@ -171,24 +188,25 @@ swrastPutImage(__DRIdrawable * draw, int op,
}
static void
-swrastGetImage(__DRIdrawable * draw,
- int x, int y, int w, int h, char *data, void *loaderPrivate)
+swrastGetImage(__DRIdrawable * read,
+ int x, int y, int w, int h,
+ char *data, void *loaderPrivate)
{
- __GLXDRIdrawablePrivate *pdp = loaderPrivate;
- __GLXDRIdrawable *pdraw = &(pdp->base);
- Display *dpy = pdraw->psc->dpy;
- Drawable drawable;
+ __GLXDRIdrawablePrivate *prp = loaderPrivate;
+ __GLXDRIdrawable *pread = &(prp->base);
+ Display *dpy = pread->psc->dpy;
+ Drawable readable;
XImage *ximage;
- drawable = pdraw->xDrawable;
+ readable = pread->xDrawable;
- ximage = pdp->ximage;
+ ximage = prp->ximage;
ximage->data = data;
ximage->width = w;
ximage->height = h;
- ximage->bytes_per_line = bytes_per_line(w, pdp->bpp, 32);
+ ximage->bytes_per_line = bytes_per_line(w * ximage->bits_per_pixel, 32);
- XGetSubImage(dpy, drawable, x, y, w, h, ~0L, ZPixmap, ximage, 0, 0);
+ XGetSubImage(dpy, readable, x, y, w, h, ~0L, ZPixmap, ximage, 0, 0);
ximage->data = NULL;
}
@@ -334,10 +352,17 @@ driCreateDrawable(__GLXscreenConfigs * psc,
return pdraw;
}
-static void
-driSwapBuffers(__GLXDRIdrawable * pdraw)
+static int64_t
+driSwapBuffers(__GLXDRIdrawable * pdraw,
+ int64_t target_msc, int64_t divisor, int64_t remainder)
{
+ (void) target_msc;
+ (void) divisor;
+ (void) remainder;
+
(*pdraw->psc->core->swapBuffers) (pdraw->driDrawable);
+
+ return 0;
}
static void
@@ -350,6 +375,20 @@ driDestroyScreen(__GLXscreenConfigs * psc)
dlclose(psc->driver);
}
+static void *
+driOpenSwrast(void)
+{
+ void *driver = NULL;
+
+ if (driver == NULL)
+ driver = driOpenDriver("swrast");
+
+ if (driver == NULL)
+ driver = driOpenDriver("swrastg");
+
+ return driver;
+}
+
static __GLXDRIscreen *
driCreateScreen(__GLXscreenConfigs * psc, int screen,
__GLXdisplayPrivate * priv)
@@ -357,14 +396,13 @@ driCreateScreen(__GLXscreenConfigs * psc, int screen,
__GLXDRIscreen *psp;
const __DRIconfig **driver_configs;
const __DRIextension **extensions;
- const char *driverName = "swrast";
int i;
psp = Xcalloc(1, sizeof *psp);
if (psp == NULL)
return NULL;
- psc->driver = driOpenDriver(driverName);
+ psc->driver = driOpenSwrast();
if (psc->driver == NULL)
goto handle_error;
diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index 51a75e352b..7cdd42caf0 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -2552,6 +2552,9 @@ __glXSwapBuffersMscOML(Display * dpy, GLXDrawable drawable,
if (divisor > 0 && remainder >= divisor)
return -1;
+ if (target_msc == 0 && divisor == 0 && remainder == 0)
+ remainder = 1;
+
#ifdef __DRI_SWAP_BUFFER_COUNTER
if (psc->counters != NULL)
return (*psc->sbc->swapBuffersMSC)(pdraw->driDrawable, target_msc,
diff --git a/src/glx/single2.c b/src/glx/single2.c
index 9ecf589fff..a1461956b9 100644
--- a/src/glx/single2.c
+++ b/src/glx/single2.c
@@ -44,6 +44,9 @@
#include <X11/Xlib-xcb.h>
#endif /* USE_XCB */
+#if !defined(__GNUC__)
+# define __builtin_expect(x, y) x
+#endif
/* Used for GL_ARB_transpose_matrix */
static void
diff --git a/src/mesa/SConscript b/src/mesa/SConscript
index 0a25dccde5..424232a1d2 100644
--- a/src/mesa/SConscript
+++ b/src/mesa/SConscript
@@ -103,6 +103,7 @@ if env['platform'] != 'winddk':
'main/texrender.c',
'main/texstate.c',
'main/texstore.c',
+ 'main/transformfeedback.c',
'main/varray.c',
'main/version.c',
'main/viewport.c',
@@ -166,6 +167,7 @@ if env['platform'] != 'winddk':
'state_tracker/st_cb_condrender.c',
'state_tracker/st_cb_flush.c',
'state_tracker/st_cb_drawpixels.c',
+ 'state_tracker/st_cb_eglimage.c',
'state_tracker/st_cb_fbo.c',
'state_tracker/st_cb_feedback.c',
'state_tracker/st_cb_program.c',
@@ -182,6 +184,7 @@ if env['platform'] != 'winddk':
'state_tracker/st_format.c',
'state_tracker/st_framebuffer.c',
'state_tracker/st_gen_mipmap.c',
+ 'state_tracker/st_manager.c',
'state_tracker/st_mesa_to_tgsi.c',
'state_tracker/st_program.c',
'state_tracker/st_texture.c',
@@ -249,6 +252,8 @@ if env['platform'] != 'winddk':
glapi_sources = [
'glapi/glapi.c',
'glapi/glapi_dispatch.c',
+ 'glapi/glapi_entrypoint.c',
+ 'glapi/glapi_execmem.c',
'glapi/glapi_getproc.c',
'glapi/glapi_nop.c',
'glapi/glthread.c',
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index b97b760f18..84a2a5fcb3 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -429,13 +429,15 @@ _mesa_meta_begin(GLcontext *ctx, GLbitfield state)
if (state & META_SHADER) {
if (ctx->Extensions.ARB_vertex_program) {
save->VertexProgramEnabled = ctx->VertexProgram.Enabled;
- save->VertexProgram = ctx->VertexProgram.Current;
+ _mesa_reference_vertprog(ctx, &save->VertexProgram,
+ ctx->VertexProgram.Current);
_mesa_set_enable(ctx, GL_VERTEX_PROGRAM_ARB, GL_FALSE);
}
if (ctx->Extensions.ARB_fragment_program) {
save->FragmentProgramEnabled = ctx->FragmentProgram.Enabled;
- save->FragmentProgram = ctx->FragmentProgram.Current;
+ _mesa_reference_fragprog(ctx, &save->FragmentProgram,
+ ctx->FragmentProgram.Current);
_mesa_set_enable(ctx, GL_FRAGMENT_PROGRAM_ARB, GL_FALSE);
}
@@ -663,6 +665,7 @@ _mesa_meta_end(GLcontext *ctx)
save->VertexProgramEnabled);
_mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current,
save->VertexProgram);
+ _mesa_reference_vertprog(ctx, &save->VertexProgram, NULL);
}
if (ctx->Extensions.ARB_fragment_program) {
@@ -670,6 +673,7 @@ _mesa_meta_end(GLcontext *ctx)
save->FragmentProgramEnabled);
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current,
save->FragmentProgram);
+ _mesa_reference_fragprog(ctx, &save->FragmentProgram, NULL);
}
if (ctx->Extensions.ARB_shader_objects) {
@@ -720,6 +724,7 @@ _mesa_meta_end(GLcontext *ctx)
for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) {
_mesa_reference_texobj(&ctx->Texture.Unit[0].CurrentTex[tgt],
save->CurrentTexture[tgt]);
+ _mesa_reference_texobj(&save->CurrentTexture[tgt], NULL);
}
/* Re-enable textures, texgen */
@@ -2062,8 +2067,10 @@ _mesa_meta_Bitmap(GLcontext *ctx,
}
bitmap1 = _mesa_map_pbo_source(ctx, &unpackSave, bitmap1);
- if (!bitmap1)
+ if (!bitmap1) {
+ _mesa_meta_end(ctx);
return;
+ }
bitmap8 = (GLubyte *) calloc(1, width * height);
if (bitmap8) {
diff --git a/src/mesa/drivers/dri/Makefile.template b/src/mesa/drivers/dri/Makefile.template
index a0c25d26cd..f19cc039b2 100644
--- a/src/mesa/drivers/dri/Makefile.template
+++ b/src/mesa/drivers/dri/Makefile.template
@@ -51,9 +51,12 @@ lib: symlinks subdirs depend
@$(MAKE) $(LIBNAME) $(TOP)/$(LIB_DIR)/$(LIBNAME)
$(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(EXTRA_MODULES) Makefile \
- $(TOP)/src/mesa/drivers/dri/Makefile.template
- $(MKLIB) -o $@ -noprefix -linker '$(CC)' -ldflags '$(LDFLAGS)' \
+ $(TOP)/src/mesa/drivers/dri/Makefile.template $(TOP)/src/mesa/drivers/dri/common/dri_test.o
+ $(MKLIB) -o $@.tmp -noprefix -linker '$(CC)' -ldflags '$(LDFLAGS)' \
$(OBJECTS) $(MESA_MODULES) $(EXTRA_MODULES) $(DRI_LIB_DEPS)
+ $(CC) -o $@.test $(TOP)/src/mesa/drivers/dri/common/dri_test.o $@.tmp $(DRI_LIB_DEPS)
+ @rm -f $@.test
+ mv -f $@.tmp $@
$(TOP)/$(LIB_DIR)/$(LIBNAME): $(LIBNAME)
diff --git a/src/mesa/drivers/dri/common/dri_test.c b/src/mesa/drivers/dri/common/dri_test.c
new file mode 100644
index 0000000000..793f0c37d7
--- /dev/null
+++ b/src/mesa/drivers/dri/common/dri_test.c
@@ -0,0 +1,89 @@
+#include "main/glheader.h"
+#include "main/compiler.h"
+#include "glapi/glapi.h"
+
+/* This is just supposed to make sure we get a reference to
+ the driver entry symbol that the compiler doesn't optimize away */
+
+extern char __driDriverExtensions[];
+
+/* provide glapi symbols */
+
+#if defined(GLX_USE_TLS)
+
+PUBLIC __thread struct _glapi_table * _glapi_tls_Dispatch
+ __attribute__((tls_model("initial-exec")));
+
+PUBLIC __thread void * _glapi_tls_Context
+ __attribute__((tls_model("initial-exec")));
+
+PUBLIC const struct _glapi_table *_glapi_Dispatch;
+PUBLIC const void *_glapi_Context;
+
+#else
+
+PUBLIC struct _glapi_table *_glapi_Dispatch;
+PUBLIC void *_glapi_Context;
+
+#endif
+
+PUBLIC void
+_glapi_check_multithread(void)
+{}
+
+PUBLIC void
+_glapi_set_context(void *context)
+{}
+
+PUBLIC void *
+_glapi_get_context(void)
+{
+ return 0;
+}
+
+PUBLIC void
+_glapi_set_dispatch(struct _glapi_table *dispatch)
+{}
+
+PUBLIC struct _glapi_table *
+_glapi_get_dispatch(void)
+{
+ return 0;
+}
+
+PUBLIC int
+_glapi_add_dispatch( const char * const * function_names,
+ const char * parameter_signature )
+{
+ return 0;
+}
+
+PUBLIC GLint
+_glapi_get_proc_offset(const char *funcName)
+{
+ return 0;
+}
+
+PUBLIC _glapi_proc
+_glapi_get_proc_address(const char *funcName)
+{
+ return 0;
+}
+
+PUBLIC GLuint
+_glapi_get_dispatch_table_size(void)
+{
+ return 0;
+}
+
+PUBLIC unsigned long
+_glthread_GetID(void)
+{
+ return 0;
+}
+
+int main(int argc, char** argv)
+{
+ void* p = __driDriverExtensions;
+ return (int)(unsigned long)p;
+}
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index 75c98825b7..f1bbd38612 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -47,28 +47,6 @@ const __DRIextension driReadDrawableExtension = {
__DRI_READ_DRAWABLE, __DRI_READ_DRAWABLE_VERSION
};
-/**
- * Print message to \c stderr if the \c LIBGL_DEBUG environment variable
- * is set.
- *
- * Is called from the drivers.
- *
- * \param f \c printf like format string.
- */
-void
-__driUtilMessage(const char *f, ...)
-{
- va_list args;
-
- if (getenv("LIBGL_DEBUG")) {
- fprintf(stderr, "libGL: ");
- va_start(args, f);
- vfprintf(stderr, f, args);
- va_end(args);
- fprintf(stderr, "\n");
- }
-}
-
GLint
driIntersectArea( drm_clip_rect_t rect1, drm_clip_rect_t rect2 )
{
@@ -151,11 +129,6 @@ static int driUnbindContext(__DRIcontext *pcp)
*/
pcp->driDrawablePriv = pcp->driReadablePriv = NULL;
-#if 0
- /* Unbind the drawable */
- pdp->driContextPriv = &psp->dummyContextPriv;
-#endif
-
return GL_TRUE;
}
@@ -455,7 +428,6 @@ driCreateNewDrawable(__DRIscreen *psp, const __DRIconfig *config,
pdp->vblFlags = 0;
pdp->driScreenPriv = psp;
- pdp->driContextPriv = &psp->dummyContextPriv;
if (!(*psp->DriverAPI.CreateBuffer)(psp, pdp, &config->modes,
renderType == GLX_PIXMAP_BIT)) {
@@ -589,17 +561,6 @@ driCreateNewContext(__DRIscreen *psp, const __DRIconfig *config,
pcp->dri2.draw_stamp = 0;
pcp->dri2.read_stamp = 0;
- /* When the first context is created for a screen, initialize a "dummy"
- * context.
- */
-
- if (!psp->dri2.enabled && !psp->dummyContextPriv.driScreenPriv) {
- psp->dummyContextPriv.hHWContext = psp->pSAREA->dummy_context;
- psp->dummyContextPriv.driScreenPriv = psp;
- psp->dummyContextPriv.driDrawablePriv = NULL;
- psp->dummyContextPriv.driverPrivate = NULL;
- /* No other fields should be used! */
- }
pcp->hHWContext = hwContext;
@@ -756,13 +717,6 @@ driCreateNewScreen(int scrn,
psp->myNum = scrn;
psp->dri2.enabled = GL_FALSE;
- /*
- ** Do not init dummy context here; actual initialization will be
- ** done when the first DRI context is created. Init screen priv ptr
- ** to NULL to let CreateContext routine that it needs to be inited.
- */
- psp->dummyContextPriv.driScreenPriv = NULL;
-
psp->DriverAPI = driDriverAPI;
*driver_modes = driDriverAPI.InitScreen(psp);
diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h
index 99c0f1e442..038a81604f 100644
--- a/src/mesa/drivers/dri/common/dri_util.h
+++ b/src/mesa/drivers/dri/common/dri_util.h
@@ -399,11 +399,6 @@ struct __DRIcontextRec {
void *driverPrivate;
/**
- * Pointer back to the \c __DRIcontext that contains this structure.
- */
- __DRIcontext *pctx;
-
- /**
* Pointer to drawable currently bound to this context for drawing.
*/
__DRIdrawable *driDrawablePriv;
@@ -511,29 +506,12 @@ struct __DRIscreenRec {
/*@}*/
/**
- * Dummy context to which drawables are bound when not bound to any
- * other context.
- *
- * A dummy hHWContext is created for this context, and is used by the GL
- * core when a hardware lock is required but the drawable is not currently
- * bound (e.g., potentially during a SwapBuffers request). The dummy
- * context is created when the first "real" context is created on this
- * screen.
- */
- __DRIcontext dummyContextPriv;
-
- /**
* Device-dependent private information (not stored in the SAREA).
*
* This pointer is never touched by the DRI layer.
*/
void *private;
- /**
- * Pointer back to the \c __DRIscreen that contains this structure.
- */
- __DRIscreen *psc;
-
/* Extensions provided by the loader. */
const __DRIgetDrawableInfoExtension *getDrawableInfo;
const __DRIsystemTimeExtension *systemTime;
@@ -552,10 +530,6 @@ struct __DRIscreenRec {
};
extern void
-__driUtilMessage(const char *f, ...);
-
-
-extern void
__driUtilUpdateDrawableInfo(__DRIdrawable *pdp);
extern float
diff --git a/src/mesa/drivers/dri/common/drisw_util.c b/src/mesa/drivers/dri/common/drisw_util.c
new file mode 100644
index 0000000000..8d08b93bfb
--- /dev/null
+++ b/src/mesa/drivers/dri/common/drisw_util.c
@@ -0,0 +1,272 @@
+/*
+ * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ * Copyright 2010 George Sapountzis <gsapountzis@gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file drisw_util.c
+ *
+ * DRISW utility functions, i.e. dri_util.c stripped from drm-specific bits.
+ */
+
+#include "drisw_util.h"
+#include "utils.h"
+
+
+/**
+ * Screen functions
+ */
+
+static void
+setupLoaderExtensions(__DRIscreen *psp,
+ const __DRIextension **extensions)
+{
+ int i;
+
+ for (i = 0; extensions[i]; i++) {
+ if (strcmp(extensions[i]->name, __DRI_SWRAST_LOADER) == 0)
+ psp->swrast_loader = (__DRIswrastLoaderExtension *) extensions[i];
+ }
+}
+
+static __DRIscreen *
+driCreateNewScreen(int scrn, const __DRIextension **extensions,
+ const __DRIconfig ***driver_configs, void *data)
+{
+ static const __DRIextension *emptyExtensionList[] = { NULL };
+ __DRIscreen *psp;
+
+ (void) data;
+
+ psp = CALLOC_STRUCT(__DRIscreenRec);
+ if (!psp)
+ return NULL;
+
+ setupLoaderExtensions(psp, extensions);
+
+ psp->extensions = emptyExtensionList;
+ psp->fd = -1;
+ psp->myNum = scrn;
+
+ *driver_configs = driDriverAPI.InitScreen(psp);
+
+ if (*driver_configs == NULL) {
+ FREE(psp);
+ return NULL;
+ }
+
+ return psp;
+}
+
+static void driDestroyScreen(__DRIscreen *psp)
+{
+ if (psp) {
+ driDriverAPI.DestroyScreen(psp);
+
+ FREE(psp);
+ }
+}
+
+static const __DRIextension **driGetExtensions(__DRIscreen *psp)
+{
+ return psp->extensions;
+}
+
+
+/**
+ * Context functions
+ */
+
+static __DRIcontext *
+driCreateNewContext(__DRIscreen *psp, const __DRIconfig *config,
+ __DRIcontext *shared, void *data)
+{
+ __DRIcontext *pcp;
+ void * const shareCtx = (shared != NULL) ? shared->driverPrivate : NULL;
+
+ pcp = CALLOC_STRUCT(__DRIcontextRec);
+ if (!pcp)
+ return NULL;
+
+ pcp->loaderPrivate = data;
+
+ pcp->driScreenPriv = psp;
+ pcp->driDrawablePriv = NULL;
+ pcp->driReadablePriv = NULL;
+
+ if (!driDriverAPI.CreateContext(&config->modes, pcp, shareCtx)) {
+ FREE(pcp);
+ return NULL;
+ }
+
+ return pcp;
+}
+
+static void
+driDestroyContext(__DRIcontext *pcp)
+{
+ if (pcp) {
+ driDriverAPI.DestroyContext(pcp);
+ FREE(pcp);
+ }
+}
+
+static int
+driCopyContext(__DRIcontext *dst, __DRIcontext *src, unsigned long mask)
+{
+ return GL_FALSE;
+}
+
+static void dri_get_drawable(__DRIdrawable *pdp);
+static void dri_put_drawable(__DRIdrawable *pdp);
+
+static int driBindContext(__DRIcontext *pcp,
+ __DRIdrawable *pdp,
+ __DRIdrawable *prp)
+{
+ /* Bind the drawable to the context */
+ if (pcp) {
+ pcp->driDrawablePriv = pdp;
+ pcp->driReadablePriv = prp;
+ if (pdp) {
+ pdp->driContextPriv = pcp;
+ dri_get_drawable(pdp);
+ }
+ if ( prp && pdp != prp ) {
+ dri_get_drawable(prp);
+ }
+ }
+
+ return driDriverAPI.MakeCurrent(pcp, pdp, prp);
+}
+
+static int driUnbindContext(__DRIcontext *pcp)
+{
+ __DRIdrawable *pdp;
+ __DRIdrawable *prp;
+
+ if (pcp == NULL)
+ return GL_FALSE;
+
+ pdp = pcp->driDrawablePriv;
+ prp = pcp->driReadablePriv;
+
+ /* already unbound */
+ if (!pdp && !prp)
+ return GL_TRUE;
+
+ driDriverAPI.UnbindContext(pcp);
+
+ dri_put_drawable(pdp);
+
+ if (prp != pdp) {
+ dri_put_drawable(prp);
+ }
+
+ pcp->driDrawablePriv = NULL;
+ pcp->driReadablePriv = NULL;
+
+ return GL_TRUE;
+}
+
+
+/**
+ * Drawable functions
+ */
+
+static void dri_get_drawable(__DRIdrawable *pdp)
+{
+ pdp->refcount++;
+}
+
+static void dri_put_drawable(__DRIdrawable *pdp)
+{
+ if (pdp) {
+ pdp->refcount--;
+ if (pdp->refcount)
+ return;
+
+ driDriverAPI.DestroyBuffer(pdp);
+
+ FREE(pdp);
+ }
+}
+
+static __DRIdrawable *
+driCreateNewDrawable(__DRIscreen *psp,
+ const __DRIconfig *config, void *data)
+{
+ __DRIdrawable *pdp;
+
+ pdp = CALLOC_STRUCT(__DRIdrawableRec);
+ if (!pdp)
+ return NULL;
+
+ pdp->loaderPrivate = data;
+
+ pdp->driScreenPriv = psp;
+ pdp->driContextPriv = NULL;
+
+ dri_get_drawable(pdp);
+
+ if (!driDriverAPI.CreateBuffer(psp, pdp, &config->modes, GL_FALSE)) {
+ FREE(pdp);
+ return NULL;
+ }
+
+ pdp->lastStamp = 1; /* const */
+
+ return pdp;
+}
+
+static void
+driDestroyDrawable(__DRIdrawable *pdp)
+{
+ dri_put_drawable(pdp);
+}
+
+static void driSwapBuffers(__DRIdrawable *pdp)
+{
+ driDriverAPI.SwapBuffers(pdp);
+}
+
+const __DRIcoreExtension driCoreExtension = {
+ { __DRI_CORE, __DRI_CORE_VERSION },
+ NULL, /* driCreateNewScreen */
+ driDestroyScreen,
+ driGetExtensions,
+ driGetConfigAttrib,
+ driIndexConfigAttrib,
+ NULL, /* driCreateNewDrawable */
+ driDestroyDrawable,
+ driSwapBuffers,
+ driCreateNewContext,
+ driCopyContext,
+ driDestroyContext,
+ driBindContext,
+ driUnbindContext
+};
+
+const __DRIswrastExtension driSWRastExtension = {
+ { __DRI_SWRAST, __DRI_SWRAST_VERSION },
+ driCreateNewScreen,
+ driCreateNewDrawable
+};
diff --git a/src/mesa/drivers/dri/common/drisw_util.h b/src/mesa/drivers/dri/common/drisw_util.h
new file mode 100644
index 0000000000..08d5a116e9
--- /dev/null
+++ b/src/mesa/drivers/dri/common/drisw_util.h
@@ -0,0 +1,132 @@
+/*
+ * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ * Copyright 2010 George Sapountzis <gsapountzis@gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * @file
+ * Binding of the DRI interface (dri_interface.h) for DRISW.
+ *
+ * The DRISW structs are 'base classes' of the corresponding DRI1 / DRI2 (DRM)
+ * structs. The bindings for SW and DRM can be unified by making the DRM structs
+ * 'sub-classes' of the SW structs, either proper or with field re-ordering.
+ *
+ * The code can also be unified but that requires cluttering the common code
+ * with ifdef's and guarding with (__DRIscreen::fd >= 0) for DRM.
+ */
+
+#ifndef _DRISW_UTIL_H
+#define _DRISW_UTIL_H
+
+#include <GL/gl.h>
+#include <GL/internal/glcore.h>
+#include <GL/internal/dri_interface.h>
+typedef struct _drmLock drmLock;
+
+
+/**
+ * Extensions
+ */
+extern const __DRIcoreExtension driCoreExtension;
+extern const __DRIswrastExtension driSWRastExtension;
+
+
+/**
+ * Driver callback functions
+ */
+struct __DriverAPIRec {
+ const __DRIconfig **(*InitScreen) (__DRIscreen * priv);
+
+ void (*DestroyScreen)(__DRIscreen *driScrnPriv);
+
+ GLboolean (*CreateContext)(const __GLcontextModes *glVis,
+ __DRIcontext *driContextPriv,
+ void *sharedContextPrivate);
+
+ void (*DestroyContext)(__DRIcontext *driContextPriv);
+
+ GLboolean (*CreateBuffer)(__DRIscreen *driScrnPriv,
+ __DRIdrawable *driDrawPriv,
+ const __GLcontextModes *glVis,
+ GLboolean pixmapBuffer);
+
+ void (*DestroyBuffer)(__DRIdrawable *driDrawPriv);
+
+ void (*SwapBuffers)(__DRIdrawable *driDrawPriv);
+
+ GLboolean (*MakeCurrent)(__DRIcontext *driContextPriv,
+ __DRIdrawable *driDrawPriv,
+ __DRIdrawable *driReadPriv);
+
+ GLboolean (*UnbindContext)(__DRIcontext *driContextPriv);
+};
+
+extern const struct __DriverAPIRec driDriverAPI;
+
+
+/**
+ * Data types
+ */
+struct __DRIscreenRec {
+ int myNum;
+
+ int fd;
+
+ void *private;
+
+ const __DRIextension **extensions;
+
+ const __DRIswrastLoaderExtension *swrast_loader;
+};
+
+struct __DRIcontextRec {
+
+ void *driverPrivate;
+
+ void *loaderPrivate;
+
+ __DRIdrawable *driDrawablePriv;
+
+ __DRIdrawable *driReadablePriv;
+
+ __DRIscreen *driScreenPriv;
+};
+
+struct __DRIdrawableRec {
+
+ void *driverPrivate;
+
+ void *loaderPrivate;
+
+ __DRIcontext *driContextPriv;
+
+ __DRIscreen *driScreenPriv;
+
+ int refcount;
+
+ /* gallium */
+ unsigned int lastStamp;
+
+ int w;
+ int h;
+};
+
+#endif /* _DRISW_UTIL_H */
diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c
index b85b364c57..0dd879abc9 100644
--- a/src/mesa/drivers/dri/common/utils.c
+++ b/src/mesa/drivers/dri/common/utils.c
@@ -37,6 +37,29 @@
#include "utils.h"
+/**
+ * Print message to \c stderr if the \c LIBGL_DEBUG environment variable
+ * is set.
+ *
+ * Is called from the drivers.
+ *
+ * \param f \c printf like format string.
+ */
+void
+__driUtilMessage(const char *f, ...)
+{
+ va_list args;
+
+ if (getenv("LIBGL_DEBUG")) {
+ fprintf(stderr, "libGL: ");
+ va_start(args, f);
+ vfprintf(stderr, f, args);
+ va_end(args);
+ fprintf(stderr, "\n");
+ }
+}
+
+
unsigned
driParseDebugString( const char * debug,
const struct dri_debug_control * control )
@@ -230,9 +253,6 @@ void driInitSingleExtension( GLcontext * ctx,
/**
* Utility function used by drivers to test the verions of other components.
*
- * If one of the version requirements is not met, a message is logged using
- * \c __driUtilMessage.
- *
* \param driver_name Name of the driver. Used in error messages.
* \param driActual Actual DRI version supplied __driCreateNewScreen.
* \param driExpected Minimum DRI version required by the driver.
@@ -244,7 +264,7 @@ void driInitSingleExtension( GLcontext * ctx,
* \returns \c GL_TRUE if all version requirements are met. Otherwise,
* \c GL_FALSE is returned.
*
- * \sa __driCreateNewScreen, driCheckDriDdxDrmVersions2, __driUtilMessage
+ * \sa __driCreateNewScreen, driCheckDriDdxDrmVersions2
*
* \todo
* Now that the old \c driCheckDriDdxDrmVersions function is gone, this
diff --git a/src/mesa/drivers/dri/common/utils.h b/src/mesa/drivers/dri/common/utils.h
index 02ca3feb73..de6070c398 100644
--- a/src/mesa/drivers/dri/common/utils.h
+++ b/src/mesa/drivers/dri/common/utils.h
@@ -69,6 +69,9 @@ struct __DRIutilversionRec2 {
int patch; /**< Patch-level. */
};
+extern void
+__driUtilMessage(const char *f, ...);
+
extern unsigned driParseDebugString( const char * debug,
const struct dri_debug_control * control );
diff --git a/src/mesa/drivers/dri/common/xmlconfig.c b/src/mesa/drivers/dri/common/xmlconfig.c
index 477259ea7e..de4500a39b 100644
--- a/src/mesa/drivers/dri/common/xmlconfig.c
+++ b/src/mesa/drivers/dri/common/xmlconfig.c
@@ -36,7 +36,7 @@
#include <unistd.h>
#include <errno.h>
#include "main/imports.h"
-#include "dri_util.h"
+#include "utils.h"
#include "xmlconfig.h"
#undef GET_PROGRAM_NAME
diff --git a/src/mesa/drivers/dri/i810/Makefile b/src/mesa/drivers/dri/i810/Makefile
index 3874faee51..54a837d5ea 100644
--- a/src/mesa/drivers/dri/i810/Makefile
+++ b/src/mesa/drivers/dri/i810/Makefile
@@ -5,9 +5,6 @@ include $(TOP)/configs/current
LIBNAME = i810_dri.so
-# Not yet
-# MINIGLX_SOURCES = server/i810_dri.c
-
DRIVER_SOURCES = \
i810context.c \
i810ioctl.c \
diff --git a/src/mesa/drivers/dri/i810/server/i810_dri.c b/src/mesa/drivers/dri/i810/server/i810_dri.c
deleted file mode 100644
index f52797c5ed..0000000000
--- a/src/mesa/drivers/dri/i810/server/i810_dri.c
+++ /dev/null
@@ -1,975 +0,0 @@
-/**
- * \file server/i810_dri.c
- * \brief File to perform the device-specific initialization tasks typically
- * done in the X server.
- *
- * Here they are converted to run in the client (or perhaps a standalone
- * process), and to work with the frame buffer device rather than the X
- * server infrastructure.
- *
- * Copyright (C) 2004 Dave Airlie (airlied@linux.ie)
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-
-#include "driver.h"
-#include "drm.h"
-
-#include "i810.h"
-#include "i810_dri.h"
-#include "i810_reg.h"
-
-
-static int i810_pitches[] = {
- 512,
- 1024,
- 2048,
- 4096,
- 0
-};
-
-static int i810_pitch_flags[] = {
- 0x0,
- 0x1,
- 0x2,
- 0x3,
- 0
-};
-
-static unsigned int i810_drm_version = 0;
-
-static int
-I810AllocLow(I810MemRange * result, I810MemRange * pool, int size)
-{
- if (size > pool->Size)
- return 0;
-
- pool->Size -= size;
- result->Size = size;
- result->Start = pool->Start;
- result->End = pool->Start += size;
-
- return 1;
-}
-
-static int
-I810AllocHigh(I810MemRange * result, I810MemRange * pool, int size)
-{
- if (size > pool->Size)
- return 0;
-
- pool->Size -= size;
- result->Size = size;
- result->End = pool->End;
- result->Start = pool->End -= size;
-
- return 1;
-}
-
-
-/**
- * \brief Wait for free FIFO entries.
- *
- * \param ctx display handle.
- * \param entries number of free entries to wait.
- *
- * It polls the free entries from the chip until it reaches the requested value
- * or a timeout (3000 tries) occurs. Aborts the program if the FIFO times out.
- */
-static void I810WaitForFifo( const DRIDriverContext *ctx,
- int entries )
-{
-}
-
-/**
- * \brief Reset graphics card to known state.
- *
- * \param ctx display handle.
- *
- * Resets the values of several I810 registers.
- */
-static void I810EngineReset( const DRIDriverContext *ctx )
-{
- unsigned char *I810MMIO = ctx->MMIOAddress;
-}
-
-/**
- * \brief Restore the drawing engine.
- *
- * \param ctx display handle
- *
- * Resets the graphics card and sets initial values for several registers of
- * the card's drawing engine.
- *
- * Turns on the i810 command processor engine (i.e., the ringbuffer).
- */
-static int I810EngineRestore( const DRIDriverContext *ctx )
-{
- I810Ptr info = ctx->driverPrivate;
- unsigned char *I810MMIO = ctx->MMIOAddress;
-
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- return 1;
-}
-
-
-/**
- * \brief Shutdown the drawing engine.
- *
- * \param ctx display handle
- *
- * Turns off the command processor engine & restores the graphics card
- * to a state that fbdev understands.
- */
-static int I810EngineShutdown( const DRIDriverContext *ctx )
-{
- drmI810Init info;
- int ret;
-
- memset(&info, 0, sizeof(drmI810Init));
- info.func = I810_CLEANUP_DMA;
-
- ret = drmCommandWrite(ctx->drmFD, DRM_I810_INIT, &info, sizeof(drmI810Init));
- if (ret>0)
- {
- fprintf(stderr,"[dri] I810 DMA Cleanup failed\n");
- return -errno;
- }
- return 0;
-}
-
-/**
- * \brief Compute base 2 logarithm.
- *
- * \param val value.
- *
- * \return base 2 logarithm of \p val.
- */
-static int I810MinBits(int val)
-{
- int bits;
-
- if (!val) return 1;
- for (bits = 0; val; val >>= 1, ++bits);
- return bits;
-}
-
-static int I810DRIAgpPreInit( const DRIDriverContext *ctx, I810Ptr info)
-{
-
- if (drmAgpAcquire(ctx->drmFD) < 0) {
- fprintf(stderr, "[gart] AGP not available\n");
- return 0;
- }
-
-
- if (drmAgpEnable(ctx->drmFD, 0) < 0) {
- fprintf(stderr, "[gart] AGP not enabled\n");
- drmAgpRelease(ctx->drmFD);
- return 0;
- }
-}
-
-/**
- * \brief Initialize the AGP state
- *
- * \param ctx display handle.
- * \param info driver private data.
- *
- * \return one on success, or zero on failure.
- *
- * Acquires and enables the AGP device. Reserves memory in the AGP space for
- * the ring buffer, vertex buffers and textures. Initialize the I810
- * registers to point to that memory and add client mappings.
- */
-static int I810DRIAgpInit( const DRIDriverContext *ctx, I810Ptr info)
-{
- unsigned char *I810MMIO = ctx->MMIOAddress;
- int ret;
- int s, l;
- unsigned long dcacheHandle;
- unsigned long agpHandle;
- int pitch_idx = 0;
- int back_size = 0;
- int sysmem_size = 0;
- int width = ctx->shared.virtualWidth * ctx->cpp;
-
-
- info->backHandle = DRM_AGP_NO_HANDLE;
- info->zHandle = DRM_AGP_NO_HANDLE;
- info->sysmemHandle = DRM_AGP_NO_HANDLE;
- info->dcacheHandle = DRM_AGP_NO_HANDLE;
-
- memset(&info->DcacheMem, 0, sizeof(I810MemRange));
- memset(&info->BackBuffer, 0, sizeof(I810MemRange));
- memset(&info->DepthBuffer, 0, sizeof(I810MemRange));
-
- drmAgpAlloc(ctx->drmFD, 4096 * 1024, 1, NULL, &dcacheHandle);
- info->dcacheHandle = dcacheHandle;
-
- fprintf(stderr, "[agp] dcacheHandle : 0x%x\n", dcacheHandle);
-
-#define Elements(x) sizeof(x)/sizeof(*x)
- for (pitch_idx = 0; pitch_idx < Elements(i810_pitches); pitch_idx++)
- if (width <= i810_pitches[pitch_idx])
- break;
-
- if (pitch_idx == Elements(i810_pitches)) {
- fprintf(stderr,"[dri] Couldn't find depth/back buffer pitch\n");
- exit(-1);
- }
- else
- {
- int lines = (ctx->shared.virtualWidth + 15) / 16 * 16;
- back_size = i810_pitches[pitch_idx] * lines;
- back_size = ((back_size + 4096 - 1) / 4096) * 4096;
- }
-
- sysmem_size = ctx->shared.fbSize;
- fprintf(stderr,"sysmem_size is %lu back_size is %lu\n", sysmem_size, back_size);
- if (dcacheHandle != DRM_AGP_NO_HANDLE) {
- if (back_size > 4 * 1024 * 1024) {
- fprintf(stderr,"[dri] Backsize is larger then 4 meg\n");
- sysmem_size = sysmem_size - 2 * back_size;
- drmAgpFree(ctx->drmFD, dcacheHandle);
- info->dcacheHandle = dcacheHandle = DRM_AGP_NO_HANDLE;
- } else {
- sysmem_size = sysmem_size - back_size;
- }
- } else {
- sysmem_size = sysmem_size - 2 * back_size;
- }
-
- info->SysMem.Start=0;
- info->SysMem.Size = sysmem_size;
- info->SysMem.End = sysmem_size;
-
- if (dcacheHandle != DRM_AGP_NO_HANDLE) {
- if (drmAgpBind(ctx->drmFD, dcacheHandle, info->DepthOffset) == 0) {
- memset(&info->DcacheMem, 0, sizeof(I810MemRange));
- fprintf(stderr,"[agp] GART: Found 4096K Z buffer memory\n");
- info->DcacheMem.Start = info->DepthOffset;
- info->DcacheMem.Size = 1024 * 4096;
- info->DcacheMem.End = info->DcacheMem.Start + info->DcacheMem.Size;
- } else {
- fprintf(stderr, "[agp] GART: dcache bind failed\n");
- drmAgpFree(ctx->drmFD, dcacheHandle);
- info->dcacheHandle = dcacheHandle = DRM_AGP_NO_HANDLE;
- }
- } else {
- fprintf(stderr, "[agp] GART: no dcache memory found\n");
- }
-
- drmAgpAlloc(ctx->drmFD, back_size, 0, NULL, &agpHandle);
- info->backHandle = agpHandle;
-
- if (agpHandle != DRM_AGP_NO_HANDLE) {
- if (drmAgpBind(ctx->drmFD, agpHandle, info->BackOffset) == 0) {
- fprintf(stderr, "[agp] Bound backbuffer memory\n");
-
- info->BackBuffer.Start = info->BackOffset;
- info->BackBuffer.Size = back_size;
- info->BackBuffer.End = (info->BackBuffer.Start +
- info->BackBuffer.Size);
- } else {
- fprintf(stderr,"[agp] Unable to bind backbuffer. Disabling DRI.\n");
- return 0;
- }
- } else {
- fprintf(stderr, "[dri] Unable to allocate backbuffer memory. Disabling DRI.\n");
- return 0;
- }
-
- if (dcacheHandle == DRM_AGP_NO_HANDLE) {
- drmAgpAlloc(ctx->drmFD, back_size, 0, NULL, &agpHandle);
-
- info->zHandle = agpHandle;
-
- if (agpHandle != DRM_AGP_NO_HANDLE) {
- if (drmAgpBind(ctx->drmFD, agpHandle, info->DepthOffset) == 0) {
- fprintf(stderr,"[agp] Bound depthbuffer memory\n");
- info->DepthBuffer.Start = info->DepthOffset;
- info->DepthBuffer.Size = back_size;
- info->DepthBuffer.End = (info->DepthBuffer.Start +
- info->DepthBuffer.Size);
- } else {
- fprintf(stderr,"[agp] Unable to bind depthbuffer. Disabling DRI.\n");
- return 0;
- }
- } else {
- fprintf(stderr,"[agp] Unable to allocate depthbuffer memory. Disabling DRI.\n");
- return 0;
- }
- }
-
- /* Now allocate and bind the agp space. This memory will include the
- * regular framebuffer as well as texture memory.
- */
- drmAgpAlloc(ctx->drmFD, sysmem_size, 0, NULL, &agpHandle);
- info->sysmemHandle = agpHandle;
-
- if (agpHandle != DRM_AGP_NO_HANDLE) {
- if (drmAgpBind(ctx->drmFD, agpHandle, 0) == 0) {
- fprintf(stderr, "[agp] Bound System Texture Memory\n");
- } else {
- fprintf(stderr, "[agp] Unable to bind system texture memory. Disabling DRI.\n");
- return 0;
- }
- } else {
- fprintf(stderr, "[agp] Unable to allocate system texture memory. Disabling DRI.\n");
- return 0;
- }
-
- info->auxPitch = i810_pitches[pitch_idx];
- info->auxPitchBits = i810_pitch_flags[pitch_idx];
-
- return 1;
-}
-
-
-/**
- * \brief Initialize the kernel data structures and enable the CP engine.
- *
- * \param ctx display handle.
- * \param info driver private data.
- *
- * \return non-zero on success, or zero on failure.
- *
- * This function is a wrapper around the DRM_I810_CP_INIT command, passing
- * all the parameters in a drmI810Init structure.
- */
-static int I810DRIKernelInit( const DRIDriverContext *ctx,
- I810Ptr info)
-{
- int cpp = ctx->bpp / 8;
- drmI810Init drmInfo;
- int ret;
- I810RingBuffer *ring = &(info->LpRing);
-
- /* This is the struct passed to the kernel module for its initialization */
- memset(&drmInfo, 0, sizeof(drmI810Init));
-
- /* make sure we have at least 1.4 */
- drmInfo.func = I810_INIT_DMA_1_4;
-
- drmInfo.ring_start = ring->mem.Start;
- drmInfo.ring_end = ring->mem.End;
- drmInfo.ring_size = ring->mem.Size;
-
- drmInfo.mmio_offset = (unsigned int)info->regs;
- drmInfo.buffers_offset = (unsigned int)info->buffer_map;
- drmInfo.sarea_priv_offset = sizeof(drm_sarea_t);
-
- drmInfo.front_offset = 0;
- drmInfo.back_offset = info->BackBuffer.Start;
- drmInfo.depth_offset = info->DepthBuffer.Start;
-
- drmInfo.w = ctx->shared.virtualWidth;
- drmInfo.h = ctx->shared.virtualHeight;
- drmInfo.pitch = info->auxPitch;
- drmInfo.pitch_bits = info->auxPitchBits;
-
-
- ret = drmCommandWrite(ctx->drmFD, DRM_I810_INIT, &drmInfo,
- sizeof(drmI810Init));
-
- return ret >= 0;
-}
-
-
-/**
- * \brief Add a map for the vertex buffers that will be accessed by any
- * DRI-based clients.
- *
- * \param ctx display handle.
- * \param info driver private data.
- *
- * \return one on success, or zero on failure.
- *
- * Calls drmAddBufs() with the previously allocated vertex buffers.
- */
-static int I810DRIBufInit( const DRIDriverContext *ctx, I810Ptr info )
-{
- /* Initialize vertex buffers */
- info->bufNumBufs = drmAddBufs(ctx->drmFD,
- I810_DMA_BUF_NR,
- I810_DMA_BUF_SZ,
- DRM_AGP_BUFFER,
- info->BufferMem.Start);
-
- if (info->bufNumBufs <= 0) {
- fprintf(stderr,
- "[drm] Could not create vertex/indirect buffers list\n");
- return 0;
- }
- fprintf(stderr,
- "[drm] Added %d %d byte vertex/indirect buffers\n",
- info->bufNumBufs, I810_DMA_BUF_SZ);
-
- return 1;
-}
-
-/**
- * \brief Install an IRQ handler.
- *
- * \param ctx display handle.
- * \param info driver private data.
- *
- * Attempts to install an IRQ handler via drmCtlInstHandler(), falling back to
- * IRQ-free operation on failure.
- */
-static void I810DRIIrqInit(const DRIDriverContext *ctx,
- I810Ptr info)
-{
- if (!info->irq) {
- info->irq = drmGetInterruptFromBusID(ctx->drmFD,
- ctx->pciBus,
- ctx->pciDevice,
- ctx->pciFunc);
-
- if ((drmCtlInstHandler(ctx->drmFD, info->irq)) != 0) {
- fprintf(stderr,
- "[drm] failure adding irq handler, "
- "there is a device already using that irq\n"
- "[drm] falling back to irq-free operation\n");
- info->irq = 0;
- }
- }
-
- if (info->irq)
- fprintf(stderr,
- "[drm] dma control initialized, using IRQ %d\n",
- info->irq);
-}
-
-static int I810CheckDRMVersion( const DRIDriverContext *ctx,
- I810Ptr info )
-{
- drmVersionPtr version;
-
- version = drmGetVersion(ctx->drmFD);
- if (version) {
- int req_minor, req_patch;
-
- req_minor = 4;
- req_patch = 0;
-
- i810_drm_version = (version->version_major<<16) | version->version_minor;
- if (version->version_major != 1 ||
- version->version_minor < req_minor ||
- (version->version_minor == req_minor &&
- version->version_patchlevel < req_patch)) {
- /* Incompatible drm version */
- fprintf(stderr,
- "[dri] I810DRIScreenInit failed because of a version "
- "mismatch.\n"
- "[dri] i810.o kernel module version is %d.%d.%d "
- "but version 1.%d.%d or newer is needed.\n"
- "[dri] Disabling DRI.\n",
- version->version_major,
- version->version_minor,
- version->version_patchlevel,
- req_minor,
- req_patch);
- drmFreeVersion(version);
- return 0;
- }
-
- info->drmMinor = version->version_minor;
- drmFreeVersion(version);
- }
-
- return 1;
-}
-
-static int I810MemoryInit( const DRIDriverContext *ctx, I810Ptr info )
-{
- int width_bytes = ctx->shared.virtualWidth * ctx->cpp;
- int cpp = ctx->cpp;
- int bufferSize = (ctx->shared.virtualHeight * width_bytes);
- int depthSize = (((ctx->shared.virtualHeight+15) & ~15) * width_bytes);
- int l;
-
- if (drmAddMap(ctx->drmFD, (drm_handle_t) info->BackBuffer.Start,
- info->BackBuffer.Size, DRM_AGP, 0,
- &info->backbuffer) < 0) {
- fprintf(stderr, "[drm] drmAddMap(backbuffer) failed. Disabling DRI\n");
- return 0;
- }
-
- if (drmAddMap(ctx->drmFD, (drm_handle_t) info->DepthBuffer.Start,
- info->DepthBuffer.Size, DRM_AGP, 0,
- &info->depthbuffer) < 0) {
- fprintf(stderr, "[drm] drmAddMap(depthbuffer) failed. Disabling DRI.\n");
- return 0;
- }
-
- if (!I810AllocLow(&(info->FrontBuffer), &(info->SysMem), (((ctx->shared.virtualHeight * width_bytes) + 4095) & ~4095)))
- {
- fprintf(stderr,"Framebuffer allocation failed\n");
- return 0;
- }
- else
- fprintf(stderr,"Frame buffer at 0x%.8x (%luk, %lu bytes)\n",
- info->FrontBuffer.Start,
- info->FrontBuffer.Size / 1024, info->FrontBuffer.Size);
-
- memset(&(info->LpRing), 0, sizeof(I810RingBuffer));
- if (I810AllocLow(&(info->LpRing.mem), &(info->SysMem), 16 * 4096)) {
- fprintf(stderr,
- "Ring buffer at 0x%.8x (%luk, %lu bytes)\n",
- info->LpRing.mem.Start,
- info->LpRing.mem.Size / 1024, info->LpRing.mem.Size);
-
- info->LpRing.tail_mask = info->LpRing.mem.Size - 1;
- info->LpRing.virtual_start = info->LpRing.mem.Start;
- info->LpRing.head = 0;
- info->LpRing.tail = 0;
- info->LpRing.space = 0;
- } else {
- fprintf(stderr, "Ring buffer allocation failed\n");
- return (0);
- }
-
- /* Allocate buffer memory */
- I810AllocHigh(&(info->BufferMem), &(info->SysMem),
- I810_DMA_BUF_NR * I810_DMA_BUF_SZ);
-
-
- fprintf(stderr, "[dri] Buffer map : %lx\n",
- info->BufferMem.Start);
-
- if (info->BufferMem.Start == 0 ||
- info->BufferMem.End - info->BufferMem.Start >
- I810_DMA_BUF_NR * I810_DMA_BUF_SZ) {
- fprintf(stderr,"[dri] Not enough memory for dma buffers. Disabling DRI.\n");
- return 0;
- }
-
- if (drmAddMap(ctx->drmFD, (drm_handle_t) info->BufferMem.Start,
- info->BufferMem.Size, DRM_AGP, 0, &info->buffer_map) < 0) {
- fprintf(stderr, "[drm] drmAddMap(buffer_map) failed. Disabling DRI.\n");
- return 0;
- }
-
- if (drmAddMap(ctx->drmFD, (drm_handle_t) info->LpRing.mem.Start,
- info->LpRing.mem.Size, DRM_AGP, 0, &info->ring_map) < 0) {
- fprintf(stderr, "[drm] drmAddMap(ring_map) failed. Disabling DRI. \n");
- return 0;
- }
-
- /* Front, back and depth buffers - everything else texture??
- */
- info->textureSize = info->SysMem.Size;
-
- if (info->textureSize < 0)
- return 0;
-
-
- l = I810MinBits((info->textureSize-1) / I810_NR_TEX_REGIONS);
- if (l < I810_LOG_MIN_TEX_REGION_SIZE) l = I810_LOG_MIN_TEX_REGION_SIZE;
-
- /* Round the texture size up to the nearest whole number of
- * texture regions. Again, be greedy about this, don't
- * round down.
- */
- info->logTextureGranularity = l;
- info->textureSize = (info->textureSize >> l) << l;
-
- /* Set a minimum usable local texture heap size. This will fit
- * two 256x256x32bpp textures.
- */
- if (info->textureSize < 512 * 1024) {
- info->textureOffset = 0;
- info->textureSize = 0;
- }
-
- I810AllocLow(&(info->TexMem), &(info->SysMem), info->textureSize);
-
- if (drmAddMap(ctx->drmFD, (drm_handle_t) info->TexMem.Start,
- info->TexMem.Size, DRM_AGP, 0, &info->textures) < 0) {
- fprintf(stderr,
- "[drm] drmAddMap(textures) failed. Disabling DRI.\n");
- return 0;
- }
-
- /* Reserve space for textures */
- fprintf(stderr,
- "Will use back buffer at offset 0x%x\n",
- info->BackOffset);
- fprintf(stderr,
- "Will use depth buffer at offset 0x%x\n",
- info->DepthOffset);
- fprintf(stderr,
- "Will use %d kb for textures at offset 0x%x\n",
- info->TexMem.Size/1024, info->TexMem.Start);
-
- return 1;
-}
-
-
-
-/**
- * Called at the start of each server generation.
- *
- * \param ctx display handle.
- * \param info driver private data.
- *
- * \return non-zero on success, or zero on failure.
- *
- * Performs static frame buffer allocation. Opens the DRM device and add maps
- * to the SAREA, framebuffer and MMIO regions. Fills in \p info with more
- * information. Creates a \e server context to grab the lock for the
- * initialization ioctls and calls the other initilization functions in this
- * file. Starts the CP engine via the DRM_I810_CP_START command.
- *
- * Setups a I810DRIRec structure to be passed to i810_dri.so for its
- * initialization.
- */
-static int I810ScreenInit( DRIDriverContext *ctx, I810Ptr info )
-{
- I810DRIPtr pI810DRI;
- int err;
-
- usleep(100);
- /*assert(!ctx->IsClient);*/
-
- /* from XFree86 driver */
- info->DepthOffset = 0x3000000;
- info->BackOffset = 0x3800000;
- {
- int width_bytes = (ctx->shared.virtualWidth * ctx->cpp);
- int maxy = ctx->shared.fbSize / width_bytes;
-
-
- if (maxy <= ctx->shared.virtualHeight * 3) {
- fprintf(stderr,
- "Static buffer allocation failed -- "
- "need at least %d kB video memory (have %d kB)\n",
- (ctx->shared.virtualWidth * ctx->shared.virtualHeight *
- ctx->cpp * 3 + 1023) / 1024,
- ctx->shared.fbSize / 1024);
- return 0;
- }
- }
-
-
- info->regsSize = ctx->MMIOSize;
- ctx->shared.SAREASize = 0x2000;
-
- /* Note that drmOpen will try to load the kernel module, if needed. */
- ctx->drmFD = drmOpen("i810", NULL );
- if (ctx->drmFD < 0) {
- fprintf(stderr, "[drm] drmOpen failed\n");
- return 0;
- }
-
- if ((err = drmSetBusid(ctx->drmFD, ctx->pciBusID)) < 0) {
- fprintf(stderr, "[drm] drmSetBusid failed (%d, %s), %s\n",
- ctx->drmFD, ctx->pciBusID, strerror(-err));
- return 0;
- }
-
- if (drmAddMap( ctx->drmFD,
- 0,
- ctx->shared.SAREASize,
- DRM_SHM,
- DRM_CONTAINS_LOCK,
- &ctx->shared.hSAREA) < 0)
- {
- fprintf(stderr, "[drm] drmAddMap failed\n");
- return 0;
- }
- fprintf(stderr, "[drm] added %d byte SAREA at 0x%08lx\n",
- ctx->shared.SAREASize, ctx->shared.hSAREA);
-
- if (drmMap( ctx->drmFD,
- ctx->shared.hSAREA,
- ctx->shared.SAREASize,
- (drmAddressPtr)(&ctx->pSAREA)) < 0)
- {
- fprintf(stderr, "[drm] drmMap failed\n");
- return 0;
- }
- memset(ctx->pSAREA, 0, ctx->shared.SAREASize);
- fprintf(stderr, "[drm] mapped SAREA 0x%08lx to %p, size %d\n",
- ctx->shared.hSAREA, ctx->pSAREA, ctx->shared.SAREASize);
-
- if (drmAddMap(ctx->drmFD,
- ctx->MMIOStart,
- ctx->MMIOSize,
- DRM_REGISTERS,
- DRM_READ_ONLY,
- &info->regs) < 0) {
- fprintf(stderr, "[drm] drmAddMap mmio failed\n");
- return 0;
- }
- fprintf(stderr,
- "[drm] register handle = 0x%08x\n", info->regs);
-
- I810DRIAgpPreInit(ctx, info);
- /* Need to AddMap the framebuffer and mmio regions here:
- */
- if (drmAddMap( ctx->drmFD,
- (drm_handle_t)ctx->FBStart,
- ctx->FBSize,
- DRM_FRAME_BUFFER,
-#ifndef _EMBEDDED
- 0,
-#else
- DRM_READ_ONLY,
-#endif
- &ctx->shared.hFrameBuffer) < 0)
- {
- fprintf(stderr, "[drm] drmAddMap framebuffer failed\n");
- return 0;
- }
-
- fprintf(stderr, "[drm] framebuffer handle = 0x%08lx\n",
- ctx->shared.hFrameBuffer);
-
- /* Check the i810 DRM version */
- if (!I810CheckDRMVersion(ctx, info)) {
- return 0;
- }
-
- /* Initialize AGP */
- if (!I810DRIAgpInit(ctx, info)) {
- return 0;
- }
-
-
- /* Memory manager setup */
- if (!I810MemoryInit(ctx, info)) {
- return 0;
- }
-
- /* Initialize the SAREA private data structure */
- {
- I810SAREAPtr pSAREAPriv;
- pSAREAPriv = (I810SAREAPtr)(((char*)ctx->pSAREA) +
- sizeof(drm_sarea_t));
- memset(pSAREAPriv, 0, sizeof(*pSAREAPriv));
- // pSAREAPriv->pf_enabled=1;
- }
-
-
- /* Create a 'server' context so we can grab the lock for
- * initialization ioctls.
- */
- if ((err = drmCreateContext(ctx->drmFD, &ctx->serverContext)) != 0) {
- fprintf(stderr, "%s: drmCreateContext failed %d\n", __FUNCTION__, err);
- return 0;
- }
-
- DRM_LOCK(ctx->drmFD, ctx->pSAREA, ctx->serverContext, 0);
-
- /* Initialize the vertex buffers list */
- if (!I810DRIBufInit(ctx, info)) {
- fprintf(stderr, "I810DRIBufInit failed\n");
- DRM_UNLOCK(ctx->drmFD, ctx->pSAREA, ctx->serverContext);
- return 0;
- }
-
- /* Initialize the kernel data structures */
- if (!I810DRIKernelInit(ctx, info)) {
- fprintf(stderr, "I810DRIKernelInit failed\n");
- DRM_UNLOCK(ctx->drmFD, ctx->pSAREA, ctx->serverContext);
- return 0;
- }
-
- /* Initialize IRQ */
- I810DRIIrqInit(ctx, info);
-
- /* Quick hack to clear the front & back buffers. Could also use
- * the clear ioctl to do this, but would need to setup hw state
- * first.
- */
-#if 0
- memset((char *)ctx->FBAddress,
- 0,
- info->auxPitch * ctx->cpp * ctx->shared.virtualHeight );
-
- memset((char *)info->backbuffer,
- 0,
- info->auxPitch * ctx->cpp * ctx->shared.virtualHeight );
-#endif
-
- /* This is the struct passed to i810_dri.so for its initialization */
- ctx->driverClientMsg = malloc(sizeof(I810DRIRec));
- ctx->driverClientMsgSize = sizeof(I810DRIRec);
- pI810DRI = (I810DRIPtr)ctx->driverClientMsg;
-
- pI810DRI->regs = info->regs;
- pI810DRI->regsSize = info->regsSize;
- // regsMap is unused
-
- pI810DRI->backbufferSize = info->BackBuffer.Size;
- pI810DRI->backbuffer = info->backbuffer;
-
- pI810DRI->depthbufferSize = info->DepthBuffer.Size;
- pI810DRI->depthbuffer = info->depthbuffer;
-
- pI810DRI->textures = info->textures;
- pI810DRI->textureSize = info->textureSize;
-
- pI810DRI->agp_buffers = info->buffer_map;
- pI810DRI->agp_buf_size = info->BufferMem.Size;
-
- pI810DRI->deviceID = info->Chipset;
- pI810DRI->width = ctx->shared.virtualWidth;
- pI810DRI->height = ctx->shared.virtualHeight;
- pI810DRI->mem = ctx->shared.fbSize;
- pI810DRI->cpp = ctx->bpp / 8;
- pI810DRI->bitsPerPixel = ctx->bpp;
- pI810DRI->fbOffset = info->FrontBuffer.Start;
- pI810DRI->fbStride = info->auxPitch;
-
- pI810DRI->backOffset = info->BackBuffer.Start;
- pI810DRI->depthOffset = info->DepthBuffer.Start;
-
- pI810DRI->auxPitch = info->auxPitch;
- pI810DRI->auxPitchBits = info->auxPitchBits;
-
- pI810DRI->logTextureGranularity = info->logTextureGranularity;
- pI810DRI->textureOffset = info->TexMem.Start;
-
- pI810DRI->ringOffset = info->LpRing.mem.Start;
- pI810DRI->ringSize = info->LpRing.mem.Size;
-
- // drmBufs looks unused
- pI810DRI->irq = info->irq;
- pI810DRI->sarea_priv_offset = sizeof(drm_sarea_t);
-
- /* Don't release the lock now - let the VT switch handler do it. */
- return 1;
-}
-
-
-/**
- * \brief Validate the fbdev mode.
- *
- * \param ctx display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Saves some registers and returns 1.
- *
- * \sa i810ValidateMode().
- */
-static int i810ValidateMode( const DRIDriverContext *ctx )
-{
- unsigned char *I810MMIO = ctx->MMIOAddress;
- I810Ptr info = ctx->driverPrivate;
-
- return 1;
-}
-
-
-/**
- * \brief Examine mode returned by fbdev.
- *
- * \param ctx display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Restores registers that fbdev has clobbered and returns 1.
- *
- * \sa i810ValidateMode().
- */
-static int i810PostValidateMode( const DRIDriverContext *ctx )
-{
- unsigned char *I810MMIO = ctx->MMIOAddress;
- I810Ptr info = ctx->driverPrivate;
-
- return 1;
-}
-
-
-/**
- * \brief Initialize the framebuffer device mode
- *
- * \param ctx display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Fills in \p info with some default values and some information from \p ctx
- * and then calls I810ScreenInit() for the screen initialization.
- *
- * Before exiting clears the framebuffer memory accessing it directly.
- */
-static int i810InitFBDev( DRIDriverContext *ctx )
-{
- I810Ptr info = calloc(1, sizeof(*info));
-
- {
- int dummy = ctx->shared.virtualWidth;
-
- switch (ctx->bpp / 8) {
- case 1: dummy = (ctx->shared.virtualWidth + 127) & ~127; break;
- case 2: dummy = (ctx->shared.virtualWidth + 31) & ~31; break;
- case 3:
- case 4: dummy = (ctx->shared.virtualWidth + 15) & ~15; break;
- }
-
- ctx->shared.virtualWidth = dummy;
- }
-
- ctx->driverPrivate = (void *)info;
-
- info->Chipset = ctx->chipset;
-
- if (!I810ScreenInit( ctx, info ))
- return 0;
-
-
- return 1;
-}
-
-
-/**
- * \brief The screen is being closed, so clean up any state and free any
- * resources used by the DRI.
- *
- * \param ctx display handle.
- *
- * Unmaps the SAREA, closes the DRM device file descriptor and frees the driver
- * private data.
- */
-static void i810HaltFBDev( DRIDriverContext *ctx )
-{
- drmUnmap( ctx->pSAREA, ctx->shared.SAREASize );
- drmClose(ctx->drmFD);
-
- if (ctx->driverPrivate) {
- free(ctx->driverPrivate);
- ctx->driverPrivate = 0;
- }
-}
-
-
-extern void i810NotifyFocus( int );
-
-/**
- * \brief Exported driver interface for Mini GLX.
- *
- * \sa DRIDriverRec.
- */
-const struct DRIDriverRec __driDriver = {
- i810ValidateMode,
- i810PostValidateMode,
- i810InitFBDev,
- i810HaltFBDev,
- I810EngineShutdown,
- I810EngineRestore,
-#ifndef _EMBEDDED
- 0,
-#else
- i810NotifyFocus,
-#endif
-};
diff --git a/src/mesa/drivers/dri/i915/Makefile b/src/mesa/drivers/dri/i915/Makefile
index dc15ae425c..5b49d0c77c 100644
--- a/src/mesa/drivers/dri/i915/Makefile
+++ b/src/mesa/drivers/dri/i915/Makefile
@@ -4,8 +4,6 @@ include $(TOP)/configs/current
LIBNAME = i915_dri.so
-MINIGLX_SOURCES = server/intel_dri.c
-
DRIVER_SOURCES = \
i830_context.c \
i830_state.c \
diff --git a/src/mesa/drivers/dri/i915/i830_texstate.c b/src/mesa/drivers/dri/i915/i830_texstate.c
index e8f7e378ec..a28073919c 100644
--- a/src/mesa/drivers/dri/i915/i830_texstate.c
+++ b/src/mesa/drivers/dri/i915/i830_texstate.c
@@ -146,15 +146,15 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
dri_bo_reference(intelObj->mt->region->buffer);
i830->state.tex_buffer[unit] = intelObj->mt->region->buffer;
+ pitch = intelObj->mt->region->pitch * intelObj->mt->cpp;
+
/* XXX: This calculation is probably broken for tiled images with
* a non-page-aligned offset.
*/
- i830->state.tex_offset[unit] = (dst_x + dst_y * intelObj->mt->pitch) *
- intelObj->mt->cpp;
+ i830->state.tex_offset[unit] = dst_x * intelObj->mt->cpp + dst_y * pitch;
format = translate_texture_format(firstImage->TexFormat,
firstImage->InternalFormat);
- pitch = intelObj->mt->pitch * intelObj->mt->cpp;
state[I830_TEXREG_TM0LI] = (_3DSTATE_LOAD_STATE_IMMEDIATE_2 |
(LOAD_TEXTURE_MAP0 << unit) | 4);
diff --git a/src/mesa/drivers/dri/i915/i915_state.c b/src/mesa/drivers/dri/i915/i915_state.c
index 7275617a6f..91b228d52b 100644
--- a/src/mesa/drivers/dri/i915/i915_state.c
+++ b/src/mesa/drivers/dri/i915/i915_state.c
@@ -374,7 +374,7 @@ intelCalcViewport(GLcontext * ctx)
else {
/* window buffer, y=0=top */
yScale = -1.0;
- yBias = (intel->driDrawable) ? intel->driDrawable->h : 0.0F;
+ yBias = ctx->DrawBuffer->Height;
}
m[MAT_SX] = v[MAT_SX];
diff --git a/src/mesa/drivers/dri/i915/i915_tex_layout.c b/src/mesa/drivers/dri/i915/i915_tex_layout.c
index fe3908f580..702655283b 100644
--- a/src/mesa/drivers/dri/i915/i915_tex_layout.c
+++ b/src/mesa/drivers/dri/i915/i915_tex_layout.c
@@ -123,13 +123,12 @@ i915_miptree_layout_cube(struct intel_context *intel,
assert(lvlWidth == lvlHeight); /* cubemap images are square */
/* double pitch for cube layouts */
- mt->pitch = intel_miptree_pitch_align (intel, mt, tiling, dim * 2);
+ mt->total_width = dim * 2;
mt->total_height = dim * 4;
for (level = mt->first_level; level <= mt->last_level; level++) {
intel_miptree_set_level_info(mt, level, 6,
0, 0,
- /*OLD: mt->pitch, mt->total_height,*/
lvlWidth, lvlHeight,
1);
lvlWidth /= 2;
@@ -167,7 +166,7 @@ i915_miptree_layout_3d(struct intel_context *intel,
GLint level;
/* Calculate the size of a single slice. */
- mt->pitch = intel_miptree_pitch_align (intel, mt, tiling, mt->width0);
+ mt->total_width = mt->width0;
/* XXX: hardware expects/requires 9 levels at minimum. */
for (level = mt->first_level; level <= MAX2(8, mt->last_level); level++) {
@@ -210,7 +209,7 @@ i915_miptree_layout_2d(struct intel_context *intel,
GLuint img_height;
GLint level;
- mt->pitch = intel_miptree_pitch_align (intel, mt, tiling, mt->width0);
+ mt->total_width = mt->width0;
mt->total_height = 0;
for (level = mt->first_level; level <= mt->last_level; level++) {
@@ -251,9 +250,8 @@ i915_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree * mt,
break;
}
- DBG("%s: %dx%dx%d - sz 0x%x\n", __FUNCTION__,
- mt->pitch,
- mt->total_height, mt->cpp, mt->pitch * mt->total_height * mt->cpp);
+ DBG("%s: %dx%dx%d\n", __FUNCTION__,
+ mt->total_width, mt->total_height, mt->cpp);
return GL_TRUE;
}
@@ -336,9 +334,9 @@ i945_miptree_layout_cube(struct intel_context *intel,
* or the final row of 4x4, 2x2 and 1x1 faces below this.
*/
if (dim > 32)
- mt->pitch = intel_miptree_pitch_align (intel, mt, tiling, dim * 2);
+ mt->total_width = dim * 2;
else
- mt->pitch = intel_miptree_pitch_align (intel, mt, tiling, 14 * 8);
+ mt->total_width = 14 * 8;
if (dim >= 4)
mt->total_height = dim * 4 + 4;
@@ -423,11 +421,11 @@ i945_miptree_layout_3d(struct intel_context *intel,
GLuint pack_y_pitch;
GLuint level;
- mt->pitch = intel_miptree_pitch_align (intel, mt, tiling, mt->width0);
+ mt->total_width = mt->width0;
mt->total_height = 0;
pack_y_pitch = MAX2(mt->height0, 2);
- pack_x_pitch = mt->pitch;
+ pack_x_pitch = mt->total_width;
pack_x_nr = 1;
for (level = mt->first_level; level <= mt->last_level; level++) {
@@ -454,7 +452,7 @@ i945_miptree_layout_3d(struct intel_context *intel,
if (pack_x_pitch > 4) {
pack_x_pitch >>= 1;
pack_x_nr <<= 1;
- assert(pack_x_pitch * pack_x_nr <= mt->pitch);
+ assert(pack_x_pitch * pack_x_nr <= mt->total_width);
}
if (pack_y_pitch > 2) {
@@ -491,9 +489,8 @@ i945_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree * mt,
break;
}
- DBG("%s: %dx%dx%d - sz 0x%x\n", __FUNCTION__,
- mt->pitch,
- mt->total_height, mt->cpp, mt->pitch * mt->total_height * mt->cpp);
+ DBG("%s: %dx%dx%d\n", __FUNCTION__,
+ mt->total_width, mt->total_height, mt->cpp);
return GL_TRUE;
}
diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c
index a1ab8f8b6d..ff9ab88c5a 100644
--- a/src/mesa/drivers/dri/i915/i915_texstate.c
+++ b/src/mesa/drivers/dri/i915/i915_texstate.c
@@ -165,7 +165,7 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
format = translate_texture_format(firstImage->TexFormat,
firstImage->InternalFormat,
tObj->DepthMode);
- pitch = intelObj->mt->pitch * intelObj->mt->cpp;
+ pitch = intelObj->mt->region->pitch * intelObj->mt->cpp;
state[I915_TEXREG_MS3] =
(((firstImage->Height - 1) << MS3_HEIGHT_SHIFT) |
diff --git a/src/mesa/drivers/dri/i915/intel_tris.c b/src/mesa/drivers/dri/i915/intel_tris.c
index 81c4adeaf3..9449a158dc 100644
--- a/src/mesa/drivers/dri/i915/intel_tris.c
+++ b/src/mesa/drivers/dri/i915/intel_tris.c
@@ -488,9 +488,9 @@ intel_wpos_triangle(struct intel_context *intel,
__memcpy(v1_wpos, v1, size);
__memcpy(v2_wpos, v2, size);
- v0_wpos[1] = -v0_wpos[1] + intel->driDrawable->h;
- v1_wpos[1] = -v1_wpos[1] + intel->driDrawable->h;
- v2_wpos[1] = -v2_wpos[1] + intel->driDrawable->h;
+ v0_wpos[1] = -v0_wpos[1] + intel->ctx.DrawBuffer->Height;
+ v1_wpos[1] = -v1_wpos[1] + intel->ctx.DrawBuffer->Height;
+ v2_wpos[1] = -v2_wpos[1] + intel->ctx.DrawBuffer->Height;
intel_draw_triangle(intel, v0, v1, v2);
@@ -509,8 +509,8 @@ intel_wpos_line(struct intel_context *intel,
__memcpy(v0_wpos, v0, size);
__memcpy(v1_wpos, v1, size);
- v0_wpos[1] = -v0_wpos[1] + intel->driDrawable->h;
- v1_wpos[1] = -v1_wpos[1] + intel->driDrawable->h;
+ v0_wpos[1] = -v0_wpos[1] + intel->ctx.DrawBuffer->Height;
+ v1_wpos[1] = -v1_wpos[1] + intel->ctx.DrawBuffer->Height;
intel_draw_line(intel, v0, v1);
}
@@ -524,7 +524,7 @@ intel_wpos_point(struct intel_context *intel, intelVertexPtr v0)
GLfloat *v0_wpos = (GLfloat *)((char *)v0 + offset);
__memcpy(v0_wpos, v0, size);
- v0_wpos[1] = -v0_wpos[1] + intel->driDrawable->h;
+ v0_wpos[1] = -v0_wpos[1] + intel->ctx.DrawBuffer->Height;
intel_draw_point(intel, v0);
}
diff --git a/src/mesa/drivers/dri/i915/server/intel_dri.c b/src/mesa/drivers/dri/i915/server/intel_dri.c
deleted file mode 120000
index effdd26448..0000000000
--- a/src/mesa/drivers/dri/i915/server/intel_dri.c
+++ /dev/null
@@ -1 +0,0 @@
-../../intel/server/intel_dri.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/i965/Makefile b/src/mesa/drivers/dri/i965/Makefile
index f98a1a27db..842d4b7aa1 100644
--- a/src/mesa/drivers/dri/i965/Makefile
+++ b/src/mesa/drivers/dri/i965/Makefile
@@ -54,6 +54,7 @@ DRIVER_SOURCES = \
brw_gs_emit.c \
brw_gs_state.c \
brw_misc_state.c \
+ brw_optimize.c \
brw_program.c \
brw_queryobj.c \
brw_sf.c \
@@ -99,7 +100,6 @@ DRIVER_SOURCES = \
C_SOURCES = \
$(COMMON_SOURCES) \
- $(MINIGLX_SOURCES) \
$(DRIVER_SOURCES)
ASM_SOURCES =
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index a512896f31..241193c357 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -156,6 +156,7 @@ GLboolean brwCreateContext( const __GLcontextModes *mesaVis,
brw->has_surface_tile_offset = GL_TRUE;
brw->has_compr4 = GL_TRUE;
brw->has_aa_line_parameters = GL_TRUE;
+ brw->has_pln = GL_TRUE;
} else {
brw->CMD_VF_STATISTICS = CMD_VF_STATISTICS_965;
brw->CMD_PIPELINE_SELECT = CMD_PIPELINE_SELECT_965;
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index d6fc37e4d8..2855c93ea6 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -446,6 +446,7 @@ struct brw_context
GLboolean has_compr4;
GLboolean has_negative_rhw_bug;
GLboolean has_aa_line_parameters;
+ GLboolean has_pln;
;
struct {
struct brw_state_flags dirty;
diff --git a/src/mesa/drivers/dri/i965/brw_defines.h b/src/mesa/drivers/dri/i965/brw_defines.h
index bb1b5f5ef0..6fe574b22e 100644
--- a/src/mesa/drivers/dri/i965/brw_defines.h
+++ b/src/mesa/drivers/dri/i965/brw_defines.h
@@ -550,6 +550,7 @@
#define BRW_OPCODE_DP2 87
#define BRW_OPCODE_DPA2 88
#define BRW_OPCODE_LINE 89
+#define BRW_OPCODE_PLN 90
#define BRW_OPCODE_NOP 126
#define BRW_PREDICATE_NONE 0
@@ -830,8 +831,8 @@
#define CMD_URB 0x7805 /* GEN6+ */
# define GEN6_URB_VS_SIZE_SHIFT 16
# define GEN6_URB_VS_ENTRIES_SHIFT 0
-# define GEN6_URB_GS_SIZE_SHIFT 8
-# define GEN6_URB_GS_ENTRIES_SHIFT 0
+# define GEN6_URB_GS_ENTRIES_SHIFT 8
+# define GEN6_URB_GS_SIZE_SHIFT 0
#define CMD_VIEWPORT_STATE_POINTERS 0x780d /* GEN6+ */
# define GEN6_CC_VIEWPORT_MODIFY (1 << 12)
diff --git a/src/mesa/drivers/dri/i965/brw_disasm.c b/src/mesa/drivers/dri/i965/brw_disasm.c
index a8f6b993ac..db3fc50a63 100644
--- a/src/mesa/drivers/dri/i965/brw_disasm.c
+++ b/src/mesa/drivers/dri/i965/brw_disasm.c
@@ -50,12 +50,14 @@ struct {
[BRW_OPCODE_MAC] = { .name = "mac", .nsrc = 2, .ndst = 1 },
[BRW_OPCODE_MACH] = { .name = "mach", .nsrc = 2, .ndst = 1 },
[BRW_OPCODE_LINE] = { .name = "line", .nsrc = 2, .ndst = 1 },
+ [BRW_OPCODE_PLN] = { .name = "pln", .nsrc = 2, .ndst = 1 },
[BRW_OPCODE_SAD2] = { .name = "sad2", .nsrc = 2, .ndst = 1 },
[BRW_OPCODE_SADA2] = { .name = "sada2", .nsrc = 2, .ndst = 1 },
[BRW_OPCODE_DP4] = { .name = "dp4", .nsrc = 2, .ndst = 1 },
[BRW_OPCODE_DPH] = { .name = "dph", .nsrc = 2, .ndst = 1 },
[BRW_OPCODE_DP3] = { .name = "dp3", .nsrc = 2, .ndst = 1 },
[BRW_OPCODE_DP2] = { .name = "dp2", .nsrc = 2, .ndst = 1 },
+ [BRW_OPCODE_MATH] = { .name = "math", .nsrc = 2, .ndst = 1 },
[BRW_OPCODE_AVG] = { .name = "avg", .nsrc = 2, .ndst = 1 },
[BRW_OPCODE_ADD] = { .name = "add", .nsrc = 2, .ndst = 1 },
@@ -73,10 +75,10 @@ struct {
[BRW_OPCODE_NOP] = { .name = "nop", .nsrc = 0, .ndst = 0 },
[BRW_OPCODE_JMPI] = { .name = "jmpi", .nsrc = 1, .ndst = 0 },
[BRW_OPCODE_IF] = { .name = "if", .nsrc = 2, .ndst = 0 },
- [BRW_OPCODE_IFF] = { .name = "iff", .nsrc = 1, .ndst = 01 },
- [BRW_OPCODE_WHILE] = { .name = "while", .nsrc = 1, .ndst = 0 },
+ [BRW_OPCODE_IFF] = { .name = "iff", .nsrc = 2, .ndst = 1 },
+ [BRW_OPCODE_WHILE] = { .name = "while", .nsrc = 2, .ndst = 0 },
[BRW_OPCODE_ELSE] = { .name = "else", .nsrc = 2, .ndst = 0 },
- [BRW_OPCODE_BREAK] = { .name = "break", .nsrc = 1, .ndst = 0 },
+ [BRW_OPCODE_BREAK] = { .name = "break", .nsrc = 2, .ndst = 0 },
[BRW_OPCODE_CONTINUE] = { .name = "cont", .nsrc = 1, .ndst = 0 },
[BRW_OPCODE_HALT] = { .name = "halt", .nsrc = 1, .ndst = 0 },
[BRW_OPCODE_MSAVE] = { .name = "msave", .nsrc = 1, .ndst = 1 },
@@ -796,7 +798,11 @@ int brw_disasm (FILE *file, struct brw_instruction *inst)
err |= control (file, "saturate", saturate, inst->header.saturate, NULL);
err |= control (file, "debug control", debug_ctrl, inst->header.debug_control, NULL);
- if (inst->header.opcode != BRW_OPCODE_SEND)
+ if (inst->header.opcode == BRW_OPCODE_MATH) {
+ string (file, " ");
+ err |= control (file, "function", math_function,
+ inst->header.destreg__conditionalmod, NULL);
+ } else if (inst->header.opcode != BRW_OPCODE_SEND)
err |= control (file, "conditional modifier", conditional_modifier,
inst->header.destreg__conditionalmod, NULL);
diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h
index 39eb88d7c2..4f55158e8f 100644
--- a/src/mesa/drivers/dri/i965/brw_eu.h
+++ b/src/mesa/drivers/dri/i965/brw_eu.h
@@ -795,6 +795,7 @@ ALU2(DPH)
ALU2(DP3)
ALU2(DP2)
ALU2(LINE)
+ALU2(PLN)
#undef ALU1
#undef ALU2
@@ -965,4 +966,9 @@ void brw_math_invert( struct brw_compile *p,
void brw_set_src1( struct brw_instruction *insn,
struct brw_reg reg );
+
+
+/* brw_optimize.c */
+void brw_optimize(struct brw_compile *p);
+
#endif
diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c
index 82f2fdab2f..c33c3def30 100644
--- a/src/mesa/drivers/dri/i965/brw_eu_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c
@@ -573,7 +573,7 @@ ALU2(DPH)
ALU2(DP3)
ALU2(DP2)
ALU2(LINE)
-
+ALU2(PLN)
@@ -1416,7 +1416,10 @@ void brw_urb_WRITE(struct brw_compile *p,
* and the first message register index comes from src0.
*/
if (intel->gen >= 6) {
+ brw_push_insn_state(p);
+ brw_set_mask_control( p, BRW_MASK_DISABLE );
brw_MOV(p, brw_message_reg(msg_reg_nr), src0);
+ brw_pop_insn_state(p);
src0 = brw_message_reg(msg_reg_nr);
}
diff --git a/src/mesa/drivers/dri/i965/brw_optimize.c b/src/mesa/drivers/dri/i965/brw_optimize.c
new file mode 100644
index 0000000000..57df9ea115
--- /dev/null
+++ b/src/mesa/drivers/dri/i965/brw_optimize.c
@@ -0,0 +1,115 @@
+/*
+ * Copyright © 2010 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * Eric Anholt <eric@anholt.net>
+ *
+ */
+
+#include "main/macros.h"
+#include "shader/program.h"
+#include "shader/prog_parameter.h"
+#include "shader/prog_print.h"
+#include "brw_context.h"
+#include "brw_defines.h"
+#include "brw_eu.h"
+
+static GLboolean
+is_single_channel_dp4(struct brw_instruction *insn)
+{
+ if (insn->header.opcode != BRW_OPCODE_DP4 ||
+ insn->header.execution_size != BRW_EXECUTE_8 ||
+ insn->header.access_mode != BRW_ALIGN_16 ||
+ insn->bits1.da1.dest_reg_file != BRW_GENERAL_REGISTER_FILE)
+ return GL_FALSE;
+
+ if (!is_power_of_two(insn->bits1.da16.dest_writemask))
+ return GL_FALSE;
+
+ return GL_TRUE;
+}
+
+/**
+ * Sets the dependency control fields on DP4 instructions.
+ *
+ * The hardware only tracks dependencies on a register basis, so when
+ * you do:
+ *
+ * DP4 dst.x src1 src2
+ * DP4 dst.y src1 src3
+ * DP4 dst.z src1 src4
+ * DP4 dst.w src1 src5
+ *
+ * It will wait to do the DP4 dst.y until the dst.x is resolved, etc.
+ * We can examine our instruction stream and set the dependency
+ * control fields to tell the hardware when to do it.
+ *
+ * We may want to extend this to other instructions that are used to
+ * fill in a channel at a time of the destination register.
+ */
+static void
+brw_set_dp4_dependency_control(struct brw_compile *p)
+{
+ int i;
+
+ for (i = 1; i < p->nr_insn; i++) {
+ struct brw_instruction *insn = &p->store[i];
+ struct brw_instruction *prev = &p->store[i - 1];
+
+ if (!is_single_channel_dp4(prev))
+ continue;
+
+ if (!is_single_channel_dp4(insn)) {
+ i++;
+ continue;
+ }
+
+ /* Only avoid hw dep control if the write masks are different
+ * channels of one reg.
+ */
+ if (insn->bits1.da16.dest_writemask == prev->bits1.da16.dest_writemask)
+ continue;
+ if (insn->bits1.da16.dest_reg_nr != prev->bits1.da16.dest_reg_nr)
+ continue;
+
+ /* Check if the second instruction depends on the previous one
+ * for a src.
+ */
+ if (insn->bits1.da1.src0_reg_file == BRW_GENERAL_REGISTER_FILE &&
+ (insn->bits2.da1.src0_address_mode != BRW_ADDRESS_DIRECT ||
+ insn->bits2.da1.src0_reg_nr == insn->bits1.da16.dest_reg_nr))
+ continue;
+ if (insn->bits1.da1.src1_reg_file == BRW_GENERAL_REGISTER_FILE &&
+ (insn->bits3.da1.src1_address_mode != BRW_ADDRESS_DIRECT ||
+ insn->bits3.da1.src1_reg_nr == insn->bits1.da16.dest_reg_nr))
+ continue;
+
+ prev->header.dependency_control |= BRW_DEPENDENCY_NOTCLEARED;
+ insn->header.dependency_control |= BRW_DEPENDENCY_NOTCHECKED;
+ }
+}
+
+void
+brw_optimize(struct brw_compile *p)
+{
+ brw_set_dp4_dependency_control(p);
+}
diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c b/src/mesa/drivers/dri/i965/brw_tex_layout.c
index 09edfd81fd..b1f56a8e64 100644
--- a/src/mesa/drivers/dri/i965/brw_tex_layout.c
+++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c
@@ -58,12 +58,12 @@ GLboolean brw_miptree_layout(struct intel_context *intel,
GLuint qpitch = 0;
GLuint y_pitch = 0;
- mt->pitch = mt->width0;
+ mt->total_width = mt->width0;
intel_get_texture_alignment_unit(mt->internal_format, &align_w, &align_h);
y_pitch = ALIGN(height, align_h);
if (mt->compressed) {
- mt->pitch = ALIGN(mt->width0, align_w);
+ mt->total_width = ALIGN(mt->width0, align_w);
}
if (mt->first_level != mt->last_level) {
@@ -77,13 +77,11 @@ GLboolean brw_miptree_layout(struct intel_context *intel,
+ minify(minify(mt->width0));
}
- if (mip1_width > mt->pitch) {
- mt->pitch = mip1_width;
+ if (mip1_width > mt->total_width) {
+ mt->total_width = mip1_width;
}
}
- mt->pitch = intel_miptree_pitch_align(intel, mt, tiling, mt->pitch);
-
if (mt->compressed) {
qpitch = (y_pitch + ALIGN(minify(y_pitch), align_h) + 11 * align_h) / 4;
mt->total_height = (y_pitch + ALIGN(minify(y_pitch), align_h) + 11 * align_h) / 4 * 6;
@@ -137,10 +135,10 @@ GLboolean brw_miptree_layout(struct intel_context *intel,
intel_get_texture_alignment_unit(mt->internal_format, &align_w, &align_h);
if (mt->compressed) {
- mt->pitch = ALIGN(width, align_w);
+ mt->total_width = ALIGN(width, align_w);
pack_y_pitch = (height + 3) / 4;
} else {
- mt->pitch = intel_miptree_pitch_align (intel, mt, tiling, mt->width0);
+ mt->total_width = mt->width0;
pack_y_pitch = ALIGN(mt->height0, align_h);
}
@@ -184,7 +182,7 @@ GLboolean brw_miptree_layout(struct intel_context *intel,
if (pack_x_pitch > 4) {
pack_x_pitch >>= 1;
pack_x_nr <<= 1;
- assert(pack_x_pitch * pack_x_nr <= mt->pitch);
+ assert(pack_x_pitch * pack_x_nr <= mt->total_width);
}
if (pack_y_pitch > 2) {
@@ -211,11 +209,8 @@ GLboolean brw_miptree_layout(struct intel_context *intel,
i945_miptree_layout_2d(intel, mt, tiling);
break;
}
- DBG("%s: %dx%dx%d - sz 0x%x\n", __FUNCTION__,
- mt->pitch,
- mt->total_height,
- mt->cpp,
- mt->pitch * mt->total_height * mt->cpp );
+ DBG("%s: %dx%dx%d\n", __FUNCTION__,
+ mt->total_width, mt->total_height, mt->cpp);
return GL_TRUE;
}
diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c
index a48804a660..227261409c 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c
@@ -1361,31 +1361,6 @@ static void emit_vertex_write( struct brw_vs_compile *c)
}
}
-
-/**
- * Called after code generation to resolve subroutine calls and the
- * END instruction.
- * \param end_inst points to brw code for END instruction
- * \param last_inst points to last instruction emitted before vertex write
- */
-static void
-post_vs_emit( struct brw_vs_compile *c,
- struct brw_instruction *end_inst,
- struct brw_instruction *last_inst )
-{
- GLint offset;
-
- brw_resolve_cals(&c->func);
-
- /* patch up the END code to jump past subroutines, etc */
- offset = last_inst - end_inst;
- if (offset > 1) {
- brw_set_src1(end_inst, brw_imm_d(offset * 16));
- } else {
- end_inst->header.opcode = BRW_OPCODE_NOP;
- }
-}
-
static GLboolean
accumulator_contains(struct brw_vs_compile *c, struct brw_reg val)
{
@@ -1466,8 +1441,6 @@ void brw_vs_emit(struct brw_vs_compile *c )
struct intel_context *intel = &brw->intel;
const GLuint nr_insns = c->vp->program.Base.NumInstructions;
GLuint insn, if_depth = 0, loop_depth = 0;
- GLuint end_offset = 0;
- struct brw_instruction *end_inst, *last_inst;
struct brw_instruction *if_inst[MAX_IF_DEPTH], *loop_inst[MAX_LOOP_DEPTH] = { 0 };
const struct brw_indirect stack_index = brw_indirect(0, 0);
GLuint index;
@@ -1751,12 +1724,8 @@ void brw_vs_emit(struct brw_vs_compile *c )
brw_MOV(p, brw_ip_reg(), deref_1d(stack_index, 0));
brw_set_access_mode(p, BRW_ALIGN_16);
break;
- case OPCODE_END:
- end_offset = p->nr_insn;
- /* this instruction will get patched later to jump past subroutine
- * code, etc.
- */
- brw_ADD(p, brw_ip_reg(), brw_ip_reg(), brw_imm_d(1*16));
+ case OPCODE_END:
+ emit_vertex_write(c);
break;
case OPCODE_PRINT:
/* no-op */
@@ -1817,13 +1786,9 @@ void brw_vs_emit(struct brw_vs_compile *c )
release_tmps(c);
}
- end_inst = &p->store[end_offset];
- last_inst = &p->store[p->nr_insn];
-
- /* The END instruction will be patched to jump to this code */
- emit_vertex_write(c);
+ brw_resolve_cals(p);
- post_vs_emit(c, end_inst, last_inst);
+ brw_optimize(p);
if (INTEL_DEBUG & DEBUG_VS) {
int i;
diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h
index 47b764d24d..5aade1c4e6 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.h
+++ b/src/mesa/drivers/dri/i965/brw_wm.h
@@ -286,7 +286,7 @@ void brw_wm_pass0( struct brw_wm_compile *c );
void brw_wm_pass1( struct brw_wm_compile *c );
void brw_wm_pass2( struct brw_wm_compile *c );
void brw_wm_emit( struct brw_wm_compile *c );
-
+GLboolean brw_wm_arg_can_be_immediate(enum prog_opcode, int arg);
void brw_wm_print_value( struct brw_wm_compile *c,
struct brw_wm_value *value );
diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c
index c7d87b9d94..f79de5dbff 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c
@@ -34,6 +34,23 @@
#include "brw_context.h"
#include "brw_wm.h"
+static GLboolean can_do_pln(struct intel_context *intel,
+ const struct brw_reg *deltas)
+{
+ struct brw_context *brw = brw_context(&intel->ctx);
+
+ if (!brw->has_pln)
+ return GL_FALSE;
+
+ if (deltas[1].nr != deltas[0].nr + 1)
+ return GL_FALSE;
+
+ if (intel->gen < 6 && ((deltas[0].nr & 1) != 0))
+ return GL_FALSE;
+
+ return GL_TRUE;
+}
+
/* Not quite sure how correct this is - need to understand horiz
* vs. vertical strides a little better.
*/
@@ -44,8 +61,52 @@ static INLINE struct brw_reg sechalf( struct brw_reg reg )
return reg;
}
+/* Return the SrcReg index of the channels that can be immediate float operands
+ * instead of usage of PROGRAM_CONSTANT values through push/pull.
+ */
+GLboolean
+brw_wm_arg_can_be_immediate(enum prog_opcode opcode, int arg)
+{
+ int opcode_array[] = {
+ [OPCODE_ADD] = 2,
+ [OPCODE_CMP] = 3,
+ [OPCODE_DP3] = 2,
+ [OPCODE_DP4] = 2,
+ [OPCODE_DPH] = 2,
+ [OPCODE_MAX] = 2,
+ [OPCODE_MIN] = 2,
+ [OPCODE_MOV] = 1,
+ [OPCODE_MUL] = 2,
+ [OPCODE_SEQ] = 2,
+ [OPCODE_SGE] = 2,
+ [OPCODE_SGT] = 2,
+ [OPCODE_SLE] = 2,
+ [OPCODE_SLT] = 2,
+ [OPCODE_SNE] = 2,
+ [OPCODE_XPD] = 2,
+ };
+
+ /* These opcodes get broken down in a way that allow two
+ * args to be immediates.
+ */
+ if (opcode == OPCODE_MAD || opcode == OPCODE_LRP) {
+ if (arg == 1 || arg == 2)
+ return GL_TRUE;
+ }
+
+ if (opcode > ARRAY_SIZE(opcode_array))
+ return GL_FALSE;
-/* Payload R0:
+ return arg == opcode_array[opcode] - 1;
+}
+
+/**
+ * Computes the screen-space x,y position of the pixels.
+ *
+ * This will be used by emit_delta_xy() or emit_wpos_xy() for
+ * interpolation of attributes..
+ *
+ * Payload R0:
*
* R0.0 -- pixel mask, one bit for each of 4 pixels in 4 tiles,
* corresponding to each of the 16 execution channels.
@@ -60,7 +121,6 @@ static INLINE struct brw_reg sechalf( struct brw_reg reg )
* R1.7 -- ?
* R1.8 -- ?
*/
-
void emit_pixel_xy(struct brw_wm_compile *c,
const struct brw_reg *dst,
GLuint mask)
@@ -100,7 +160,14 @@ void emit_pixel_xy(struct brw_wm_compile *c,
brw_pop_insn_state(p);
}
-
+/**
+ * Computes the screen-space x,y distance of the pixels from the start
+ * vertex.
+ *
+ * This will be used in linterp or pinterp with the start vertex value
+ * and the Cx, Cy, and C0 coefficients passed in from the setup engine
+ * to produce interpolated attribute values.
+ */
void emit_delta_xy(struct brw_compile *p,
const struct brw_reg *dst,
GLuint mask,
@@ -108,25 +175,27 @@ void emit_delta_xy(struct brw_compile *p,
{
struct brw_reg r1 = brw_vec1_grf(1, 0);
- /* Calc delta X,Y by subtracting origin in r1 from the pixel
- * centers.
- */
- if (mask & WRITEMASK_X) {
- brw_ADD(p,
- dst[0],
- retype(arg0[0], BRW_REGISTER_TYPE_UW),
- negate(r1));
- }
+ if (mask == 0)
+ return;
- if (mask & WRITEMASK_Y) {
- brw_ADD(p,
- dst[1],
- retype(arg0[1], BRW_REGISTER_TYPE_UW),
- negate(suboffset(r1,1)));
+ assert(mask == WRITEMASK_XY);
- }
+ /* Calc delta X,Y by subtracting origin in r1 from the pixel
+ * centers produced by emit_pixel_xy().
+ */
+ brw_ADD(p,
+ dst[0],
+ retype(arg0[0], BRW_REGISTER_TYPE_UW),
+ negate(r1));
+ brw_ADD(p,
+ dst[1],
+ retype(arg0[1], BRW_REGISTER_TYPE_UW),
+ negate(suboffset(r1,1)));
}
+/**
+ * Computes the pixel offset from the window origin for gl_FragCoord().
+ */
void emit_wpos_xy(struct brw_wm_compile *c,
const struct brw_reg *dst,
GLuint mask,
@@ -134,9 +203,6 @@ void emit_wpos_xy(struct brw_wm_compile *c,
{
struct brw_compile *p = &c->func;
- /* Calculate the pixel offset from window bottom left into destination
- * X and Y channels.
- */
if (mask & WRITEMASK_X) {
if (c->fp->program.PixelCenterInteger) {
/* X' = X */
@@ -186,6 +252,7 @@ void emit_pixel_w(struct brw_wm_compile *c,
const struct brw_reg *deltas)
{
struct brw_compile *p = &c->func;
+ struct intel_context *intel = &p->brw->intel;
/* Don't need this if all you are doing is interpolating color, for
* instance.
@@ -196,8 +263,12 @@ void emit_pixel_w(struct brw_wm_compile *c,
/* Calc 1/w - just linterp wpos[3] optimized by putting the
* result straight into a message reg.
*/
- brw_LINE(p, brw_null_reg(), interp3, deltas[0]);
- brw_MAC(p, brw_message_reg(2), suboffset(interp3, 1), deltas[1]);
+ if (can_do_pln(intel, deltas)) {
+ brw_PLN(p, brw_message_reg(2), interp3, deltas[0]);
+ } else {
+ brw_LINE(p, brw_null_reg(), interp3, deltas[0]);
+ brw_MAC(p, brw_message_reg(2), suboffset(interp3, 1), deltas[1]);
+ }
/* Calc w */
if (c->dispatch_width == 16) {
@@ -224,6 +295,7 @@ void emit_linterp(struct brw_compile *p,
const struct brw_reg *arg0,
const struct brw_reg *deltas)
{
+ struct intel_context *intel = &p->brw->intel;
struct brw_reg interp[4];
GLuint nr = arg0[0].nr;
GLuint i;
@@ -235,8 +307,12 @@ void emit_linterp(struct brw_compile *p,
for (i = 0; i < 4; i++) {
if (mask & (1<<i)) {
- brw_LINE(p, brw_null_reg(), interp[i], deltas[0]);
- brw_MAC(p, dst[i], suboffset(interp[i],1), deltas[1]);
+ if (can_do_pln(intel, deltas)) {
+ brw_PLN(p, dst[i], interp[i], deltas[0]);
+ } else {
+ brw_LINE(p, brw_null_reg(), interp[i], deltas[0]);
+ brw_MAC(p, dst[i], suboffset(interp[i],1), deltas[1]);
+ }
}
}
}
@@ -249,6 +325,7 @@ void emit_pinterp(struct brw_compile *p,
const struct brw_reg *deltas,
const struct brw_reg *w)
{
+ struct intel_context *intel = &p->brw->intel;
struct brw_reg interp[4];
GLuint nr = arg0[0].nr;
GLuint i;
@@ -260,8 +337,12 @@ void emit_pinterp(struct brw_compile *p,
for (i = 0; i < 4; i++) {
if (mask & (1<<i)) {
- brw_LINE(p, brw_null_reg(), interp[i], deltas[0]);
- brw_MAC(p, dst[i], suboffset(interp[i],1), deltas[1]);
+ if (can_do_pln(intel, deltas)) {
+ brw_PLN(p, dst[i], interp[i], deltas[0]);
+ } else {
+ brw_LINE(p, brw_null_reg(), interp[i], deltas[0]);
+ brw_MAC(p, dst[i], suboffset(interp[i],1), deltas[1]);
+ }
}
}
for (i = 0; i < 4; i++) {
@@ -577,14 +658,10 @@ void emit_cmp(struct brw_compile *p,
for (i = 0; i < 4; i++) {
if (mask & (1<<i)) {
- brw_set_saturate(p, (mask & SATURATE) ? 1 : 0);
- brw_MOV(p, dst[i], arg2[i]);
- brw_set_saturate(p, 0);
-
brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_L, arg0[i], brw_imm_f(0));
brw_set_saturate(p, (mask & SATURATE) ? 1 : 0);
- brw_MOV(p, dst[i], arg1[i]);
+ brw_SEL(p, dst[i], arg1[i], arg2[i]);
brw_set_saturate(p, 0);
brw_set_predicate_control_flag_value(p, 0xff);
}
@@ -601,14 +678,10 @@ void emit_max(struct brw_compile *p,
for (i = 0; i < 4; i++) {
if (mask & (1<<i)) {
- brw_set_saturate(p, (mask & SATURATE) ? 1 : 0);
- brw_MOV(p, dst[i], arg0[i]);
- brw_set_saturate(p, 0);
-
- brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_L, arg0[i], arg1[i]);
+ brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_GE, arg0[i], arg1[i]);
brw_set_saturate(p, (mask & SATURATE) ? 1 : 0);
- brw_MOV(p, dst[i], arg1[i]);
+ brw_SEL(p, dst[i], arg0[i], arg1[i]);
brw_set_saturate(p, 0);
brw_set_predicate_control_flag_value(p, 0xff);
}
@@ -625,14 +698,10 @@ void emit_min(struct brw_compile *p,
for (i = 0; i < 4; i++) {
if (mask & (1<<i)) {
- brw_set_saturate(p, (mask & SATURATE) ? 1 : 0);
- brw_MOV(p, dst[i], arg1[i]);
- brw_set_saturate(p, 0);
-
brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_L, arg0[i], arg1[i]);
brw_set_saturate(p, (mask & SATURATE) ? 1 : 0);
- brw_MOV(p, dst[i], arg0[i]);
+ brw_SEL(p, dst[i], arg0[i], arg1[i]);
brw_set_saturate(p, 0);
brw_set_predicate_control_flag_value(p, 0xff);
}
@@ -1086,11 +1155,19 @@ static void emit_kil( struct brw_wm_compile *c,
{
struct brw_compile *p = &c->func;
struct brw_reg r0uw = retype(brw_vec1_grf(0, 0), BRW_REGISTER_TYPE_UW);
- GLuint i;
-
- /* XXX - usually won't need 4 compares!
- */
+ GLuint i, j;
+
for (i = 0; i < 4; i++) {
+ /* Check if we've already done the comparison for this reg
+ * -- common when someone does KIL TEMP.wwww.
+ */
+ for (j = 0; j < i; j++) {
+ if (memcmp(&arg0[j], &arg0[i], sizeof(arg0[0])) == 0)
+ break;
+ }
+ if (j != i)
+ continue;
+
brw_push_insn_state(p);
brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_GE, arg0[i], brw_imm_f(0));
brw_set_predicate_control_flag_value(p, 0xff);
diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c
index 315b030484..3b7e421b16 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c
@@ -23,6 +23,9 @@ GLboolean brw_wm_is_glsl(const struct gl_fragment_program *fp)
{
int i;
+ if (INTEL_DEBUG & DEBUG_GLSL_FORCE)
+ return GL_TRUE;
+
for (i = 0; i < fp->Base.NumInstructions; i++) {
const struct prog_instruction *inst = &fp->Base.Instructions[i];
switch (inst->Opcode) {
@@ -289,6 +292,7 @@ reclaim_temps(struct brw_wm_compile *c)
*/
static void prealloc_reg(struct brw_wm_compile *c)
{
+ struct intel_context *intel = &c->func.brw->intel;
int i, j;
struct brw_reg reg;
int urb_read_length = 0;
@@ -413,6 +417,43 @@ static void prealloc_reg(struct brw_wm_compile *c)
}
}
+ for (i = 0; i < c->nr_fp_insns; i++) {
+ const struct prog_instruction *inst = &c->prog_instructions[i];
+
+ switch (inst->Opcode) {
+ case WM_DELTAXY:
+ /* Allocate WM_DELTAXY destination on G45/GM45 to an
+ * even-numbered GRF if possible so that we can use the PLN
+ * instruction.
+ */
+ if (inst->DstReg.WriteMask == WRITEMASK_XY &&
+ !c->wm_regs[inst->DstReg.File][inst->DstReg.Index][0].inited &&
+ !c->wm_regs[inst->DstReg.File][inst->DstReg.Index][1].inited &&
+ (IS_G4X(intel->intelScreen->deviceID) || intel->gen == 5)) {
+ int grf;
+
+ for (grf = c->first_free_grf & ~1;
+ grf < BRW_WM_MAX_GRF;
+ grf += 2)
+ {
+ if (!c->used_grf[grf] && !c->used_grf[grf + 1]) {
+ c->used_grf[grf] = GL_TRUE;
+ c->used_grf[grf + 1] = GL_TRUE;
+ c->first_free_grf = grf + 2; /* a guess */
+
+ set_reg(c, inst->DstReg.File, inst->DstReg.Index, 0,
+ brw_vec8_grf(grf, 0));
+ set_reg(c, inst->DstReg.File, inst->DstReg.Index, 1,
+ brw_vec8_grf(grf + 1, 0));
+ break;
+ }
+ }
+ }
+ default:
+ break;
+ }
+ }
+
/* An instruction may reference up to three constants.
* They'll be found in these registers.
* XXX alloc these on demand!
@@ -529,12 +570,35 @@ static struct brw_reg get_src_reg(struct brw_wm_compile *c,
const GLuint nr = 1;
const GLuint component = GET_SWZ(src->Swizzle, channel);
- /* Extended swizzle terms */
- if (component == SWIZZLE_ZERO) {
- return brw_imm_f(0.0F);
- }
- else if (component == SWIZZLE_ONE) {
- return brw_imm_f(1.0F);
+ /* Only one immediate value can be used per native opcode, and it
+ * has be in the src1 slot, so not all Mesa instructions will get
+ * to take advantage of immediate constants.
+ */
+ if (brw_wm_arg_can_be_immediate(inst->Opcode, srcRegIndex)) {
+ const struct gl_program_parameter_list *params;
+
+ params = c->fp->program.Base.Parameters;
+
+ /* Extended swizzle terms */
+ if (component == SWIZZLE_ZERO) {
+ return brw_imm_f(0.0F);
+ } else if (component == SWIZZLE_ONE) {
+ if (src->Negate)
+ return brw_imm_f(-1.0F);
+ else
+ return brw_imm_f(1.0F);
+ }
+
+ if (src->File == PROGRAM_CONSTANT) {
+ float f = params->ParameterValues[src->Index][component];
+
+ if (src->Abs)
+ f = fabs(f);
+ if (src->Negate)
+ f = -f;
+
+ return brw_imm_f(f);
+ }
}
if (c->fp->use_const_buffer &&
@@ -2029,8 +2093,9 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c)
}
break;
default:
- printf("unsupported IR in fragment shader %d\n",
- inst->Opcode);
+ printf("unsupported opcode %d (%s) in fragment shader\n",
+ inst->Opcode, inst->Opcode < MAX_OPCODE ?
+ _mesa_opcode_string(inst->Opcode) : "unknown");
}
/* Release temporaries containing any unaliased source regs. */
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index ce0bf0b97d..6b9e566886 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -261,7 +261,7 @@ brw_update_texture_surface( GLcontext *ctx, GLuint unit )
key.format = firstImage->TexFormat;
key.internal_format = firstImage->InternalFormat;
- key.pitch = intelObj->mt->pitch;
+ key.pitch = intelObj->mt->region->pitch;
key.depth = firstImage->Depth;
key.bo = intelObj->mt->region->buffer;
key.offset = 0;
diff --git a/src/mesa/drivers/dri/i965/gen6_clip_state.c b/src/mesa/drivers/dri/i965/gen6_clip_state.c
index 06f8145e32..acc4b7f101 100644
--- a/src/mesa/drivers/dri/i965/gen6_clip_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_clip_state.c
@@ -55,7 +55,7 @@ upload_clip_state(struct brw_context *brw)
OUT_BATCH(GEN6_CLIP_STATISTICS_ENABLE);
OUT_BATCH(GEN6_CLIP_ENABLE |
GEN6_CLIP_API_OGL |
- GEN6_CLIP_MODE_REJECT_ALL | /* XXX: debug: get VS working */
+ GEN6_CLIP_MODE_NORMAL |
GEN6_CLIP_XY_TEST |
depth_clamp |
provoking);
diff --git a/src/mesa/drivers/dri/i965/gen6_gs_state.c b/src/mesa/drivers/dri/i965/gen6_gs_state.c
index 161e7b85c2..cefc93ba48 100644
--- a/src/mesa/drivers/dri/i965/gen6_gs_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_gs_state.c
@@ -50,7 +50,8 @@ upload_gs_state(struct brw_context *brw)
BEGIN_BATCH(7);
OUT_BATCH(CMD_3D_GS_STATE << 16 | (7 - 2));
OUT_RELOC(brw->gs.prog_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 0);
- OUT_BATCH((0 << GEN6_GS_SAMPLER_COUNT_SHIFT) |
+ OUT_BATCH(GEN6_GS_SPF_MODE |
+ (0 << GEN6_GS_SAMPLER_COUNT_SHIFT) |
(0 << GEN6_GS_BINDING_TABLE_ENTRY_COUNT_SHIFT));
OUT_BATCH(0); /* scratch space base offset */
OUT_BATCH((1 << GEN6_GS_DISPATCH_START_GRF_SHIFT) |
diff --git a/src/mesa/drivers/dri/i965/gen6_vs_state.c b/src/mesa/drivers/dri/i965/gen6_vs_state.c
index fe597dfb94..5916a13994 100644
--- a/src/mesa/drivers/dri/i965/gen6_vs_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_vs_state.c
@@ -100,7 +100,8 @@ upload_vs_state(struct brw_context *brw)
(brw->vs.prog_data->urb_read_length << GEN6_VS_URB_READ_LENGTH_SHIFT) |
(0 << GEN6_VS_URB_ENTRY_READ_OFFSET_SHIFT));
OUT_BATCH((0 << GEN6_VS_MAX_THREADS_SHIFT) |
- GEN6_VS_STATISTICS_ENABLE);
+ GEN6_VS_STATISTICS_ENABLE |
+ GEN6_VS_ENABLE);
ADVANCE_BATCH();
intel_batchbuffer_emit_mi_flush(intel->batch);
diff --git a/src/mesa/drivers/dri/i965/server/intel_dri.c b/src/mesa/drivers/dri/i965/server/intel_dri.c
deleted file mode 120000
index effdd26448..0000000000
--- a/src/mesa/drivers/dri/i965/server/intel_dri.c
+++ /dev/null
@@ -1 +0,0 @@
-../../intel/server/intel_dri.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c
index 4ad42a7c28..167140d274 100644
--- a/src/mesa/drivers/dri/intel/intel_blit.c
+++ b/src/mesa/drivers/dri/intel/intel_blit.c
@@ -119,22 +119,8 @@ intelEmitCopyBlit(struct intel_context *intel,
break;
} while (pass < 2);
- if (pass >= 2) {
- drm_intel_gem_bo_map_gtt(dst_buffer);
- drm_intel_gem_bo_map_gtt(src_buffer);
- _mesa_copy_rect((GLubyte *)dst_buffer->virtual + dst_offset,
- cpp,
- dst_pitch,
- dst_x, dst_y,
- w, h,
- (GLubyte *)src_buffer->virtual + src_offset,
- src_pitch,
- src_x, src_y);
- drm_intel_gem_bo_unmap_gtt(src_buffer);
- drm_intel_gem_bo_unmap_gtt(dst_buffer);
-
- return GL_TRUE;
- }
+ if (pass >= 2)
+ return GL_FALSE;
intel_batchbuffer_require_space(intel->batch, 8 * 4);
DBG("%s src:buf(%p)/%d+%d %d,%d dst:buf(%p)/%d+%d %d,%d sz:%dx%d\n",
@@ -480,6 +466,7 @@ intel_emit_linear_blit(struct intel_context *intel,
unsigned int size)
{
GLuint pitch, height;
+ GLboolean ok;
/* Blits are in a different ringbuffer so we don't use them. */
assert(intel->gen < 6);
@@ -487,25 +474,27 @@ intel_emit_linear_blit(struct intel_context *intel,
/* The pitch is a signed value. */
pitch = MIN2(size, (1 << 15) - 1);
height = size / pitch;
- intelEmitCopyBlit(intel, 1,
- pitch, src_bo, src_offset, I915_TILING_NONE,
- pitch, dst_bo, dst_offset, I915_TILING_NONE,
- 0, 0, /* src x/y */
- 0, 0, /* dst x/y */
- pitch, height, /* w, h */
- GL_COPY);
+ ok = intelEmitCopyBlit(intel, 1,
+ pitch, src_bo, src_offset, I915_TILING_NONE,
+ pitch, dst_bo, dst_offset, I915_TILING_NONE,
+ 0, 0, /* src x/y */
+ 0, 0, /* dst x/y */
+ pitch, height, /* w, h */
+ GL_COPY);
+ assert(ok);
src_offset += pitch * height;
dst_offset += pitch * height;
size -= pitch * height;
assert (size < (1 << 15));
if (size != 0) {
- intelEmitCopyBlit(intel, 1,
- size, src_bo, src_offset, I915_TILING_NONE,
- size, dst_bo, dst_offset, I915_TILING_NONE,
- 0, 0, /* src x/y */
- 0, 0, /* dst x/y */
- size, 1, /* w, h */
- GL_COPY);
+ ok = intelEmitCopyBlit(intel, 1,
+ size, src_bo, src_offset, I915_TILING_NONE,
+ size, dst_bo, dst_offset, I915_TILING_NONE,
+ 0, 0, /* src x/y */
+ 0, 0, /* dst x/y */
+ size, 1, /* w, h */
+ GL_COPY);
+ assert(ok);
}
}
diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index 0a7dcb80c6..9077a61132 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -63,7 +63,7 @@ int INTEL_DEBUG = (0);
#endif
-#define DRIVER_DATE "20100328 2010Q1"
+#define DRIVER_DATE "20100330 DEVELOPMENT"
#define DRIVER_DATE_GEM "GEM " DRIVER_DATE
@@ -389,7 +389,7 @@ intel_prepare_render(struct intel_context *intel)
__DRIcontext *driContext = intel->driContext;
__DRIdrawable *drawable;
- drawable = intel->driDrawable;
+ drawable = driContext->driDrawablePriv;
if (drawable->dri2.stamp != driContext->dri2.draw_stamp) {
if (drawable->lastStamp != drawable->dri2.stamp)
intel_update_renderbuffers(driContext, drawable);
@@ -397,7 +397,7 @@ intel_prepare_render(struct intel_context *intel)
driContext->dri2.draw_stamp = drawable->dri2.stamp;
}
- drawable = intel->driReadDrawable;
+ drawable = driContext->driReadablePriv;
if (drawable->dri2.stamp != driContext->dri2.read_stamp) {
if (drawable->lastStamp != drawable->dri2.stamp)
intel_update_renderbuffers(driContext, drawable);
@@ -444,6 +444,7 @@ static const struct dri_debug_control debug_control[] = {
{ "sing", DEBUG_SINGLE_THREAD },
{ "thre", DEBUG_SINGLE_THREAD },
{ "wm", DEBUG_WM },
+ { "glsl_force", DEBUG_GLSL_FORCE },
{ "urb", DEBUG_URB },
{ "vs", DEBUG_VS },
{ NULL, 0 }
@@ -471,6 +472,7 @@ void
intel_flush(GLcontext *ctx, GLboolean needs_mi_flush)
{
struct intel_context *intel = intel_context(ctx);
+ __DRIcontext *driContext = intel->driContext;
if (intel->Fallback)
_swrast_flush(ctx);
@@ -487,9 +489,10 @@ intel_flush(GLcontext *ctx, GLboolean needs_mi_flush)
if (screen->dri2.loader &&
(screen->dri2.loader->base.version >= 2)
&& (screen->dri2.loader->flushFrontBuffer != NULL) &&
- intel->driDrawable && intel->driDrawable->loaderPrivate) {
- (*screen->dri2.loader->flushFrontBuffer)(intel->driDrawable,
- intel->driDrawable->loaderPrivate);
+ driContext->driDrawablePriv &&
+ driContext->driDrawablePriv->loaderPrivate) {
+ (*screen->dri2.loader->flushFrontBuffer)(driContext->driDrawablePriv,
+ driContext->driDrawablePriv->loaderPrivate);
/* Only clear the dirty bit if front-buffer rendering is no longer
* enabled. This is done so that the dirty bit can only be set in
@@ -606,7 +609,6 @@ intelInitContext(struct intel_context *intel,
driContextPriv->driverPrivate = intel;
intel->intelScreen = intelScreen;
- intel->driScreen = sPriv;
intel->driContext = driContextPriv;
intel->driFd = sPriv->fd;
@@ -635,8 +637,7 @@ intelInitContext(struct intel_context *intel,
}
driParseConfigFiles(&intel->optionCache, &intelScreen->optionCache,
- intel->driScreen->myNum,
- (intel->gen >= 4) ? "i965" : "i915");
+ sPriv->myNum, (intel->gen >= 4) ? "i965" : "i915");
if (intelScreen->deviceID == PCI_CHIP_I865_G)
intel->maxBatchSize = 4096;
else
@@ -844,14 +845,6 @@ intelDestroyContext(__DRIcontext * driContextPriv)
GLboolean
intelUnbindContext(__DRIcontext * driContextPriv)
{
- struct intel_context *intel =
- (struct intel_context *) driContextPriv->driverPrivate;
-
- /* Deassociate the context with the drawables.
- */
- intel->driDrawable = NULL;
- intel->driReadDrawable = NULL;
-
return GL_TRUE;
}
@@ -880,8 +873,6 @@ intelMakeCurrent(__DRIcontext * driContextPriv,
struct gl_framebuffer *fb = driDrawPriv->driverPrivate;
struct gl_framebuffer *readFb = driReadPriv->driverPrivate;
- intel->driReadDrawable = driReadPriv;
- intel->driDrawable = driDrawPriv;
driContextPriv->dri2.draw_stamp = driDrawPriv->dri2.stamp - 1;
driContextPriv->dri2.read_stamp = driReadPriv->dri2.stamp - 1;
intel_prepare_render(intel);
diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h
index 22736a9327..c4bb2bed8e 100644
--- a/src/mesa/drivers/dri/intel/intel_context.h
+++ b/src/mesa/drivers/dri/intel/intel_context.h
@@ -243,9 +243,6 @@ struct intel_context
int driFd;
__DRIcontext *driContext;
- __DRIdrawable *driDrawable;
- __DRIdrawable *driReadDrawable;
- __DRIscreen *driScreen;
struct intel_screen *intelScreen;
/**
@@ -342,6 +339,7 @@ extern int INTEL_DEBUG;
#define DEBUG_WM 0x800000
#define DEBUG_URB 0x1000000
#define DEBUG_VS 0x2000000
+#define DEBUG_GLSL_FORCE 0x4000000
#define DBG(...) do { \
if (INTEL_DEBUG & FILE_DEBUG_FLAG) \
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c
index ba3bb8fdba..8278d12bb9 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -568,7 +568,7 @@ intel_render_texture(GLcontext * ctx,
att->Zoffset,
&dst_x, &dst_y);
- intel_image->mt->region->draw_offset = (dst_y * intel_image->mt->pitch +
+ intel_image->mt->region->draw_offset = (dst_y * intel_image->mt->region->pitch +
dst_x) * intel_image->mt->cpp;
intel_image->mt->region->draw_x = dst_x;
intel_image->mt->region->draw_y = dst_y;
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
index 5b6b4b2624..ef1966ea7e 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
@@ -83,7 +83,6 @@ intel_miptree_create_internal(struct intel_context *intel,
mt->cpp = compress_byte ? compress_byte : cpp;
mt->compressed = compress_byte ? 1 : 0;
mt->refcount = 1;
- mt->pitch = 0;
#ifdef I915
if (intel->is_945)
@@ -136,7 +135,7 @@ intel_miptree_create(struct intel_context *intel,
/*
* pitch == 0 || height == 0 indicates the null texture
*/
- if (!mt || !mt->pitch || !mt->total_height) {
+ if (!mt || !mt->total_height) {
free(mt);
return NULL;
}
@@ -144,10 +143,9 @@ intel_miptree_create(struct intel_context *intel,
mt->region = intel_region_alloc(intel,
tiling,
mt->cpp,
- mt->pitch,
+ mt->total_width,
mt->total_height,
expect_accelerated_upload);
- mt->pitch = mt->region->pitch;
if (!mt->region) {
free(mt);
@@ -178,71 +176,11 @@ intel_miptree_create_for_region(struct intel_context *intel,
if (!mt)
return mt;
- /* The mipmap tree pitch is aligned to 64 bytes to make sure render
- * to texture works, but we don't need that for texturing from a
- * pixmap. Just override it here. */
- mt->pitch = region->pitch;
-
intel_region_reference(&mt->region, region);
return mt;
}
-
-/**
- * intel_miptree_pitch_align:
- *
- * @intel: intel context pointer
- *
- * @mt: the miptree to compute pitch alignment for
- *
- * @pitch: the natural pitch value
- *
- * Given @pitch, compute a larger value which accounts for
- * any necessary alignment required by the device
- */
-int intel_miptree_pitch_align (struct intel_context *intel,
- struct intel_mipmap_tree *mt,
- uint32_t tiling,
- int pitch)
-{
-#ifdef I915
- GLcontext *ctx = &intel->ctx;
-#endif
-
- if (!mt->compressed) {
- int pitch_align;
-
- /* XXX: Align pitch to multiple of 64 bytes for now to allow
- * render-to-texture to work in all cases. This should probably be
- * replaced at some point by some scheme to only do this when really
- * necessary.
- */
- pitch_align = 64;
-
- if (tiling == I915_TILING_X)
- pitch_align = 512;
- else if (tiling == I915_TILING_Y)
- pitch_align = 128;
-
- pitch = ALIGN(pitch * mt->cpp, pitch_align);
-
-#ifdef I915
- /* Do a little adjustment to linear allocations so that we avoid
- * hitting the same channel of memory for 2 different pages when
- * reading a 2x2 subspan or doing bilinear filtering.
- */
- if (tiling == I915_TILING_NONE && !(pitch & 511) &&
- (pitch + pitch_align) < (1 << ctx->Const.MaxTextureLevels))
- pitch += pitch_align;
-#endif
-
- pitch /= mt->cpp;
- }
- return pitch;
-}
-
-
void
intel_miptree_reference(struct intel_mipmap_tree **dst,
struct intel_mipmap_tree *src)
@@ -342,13 +280,12 @@ intel_miptree_set_level_info(struct intel_mipmap_tree *mt,
mt->level[level].width = w;
mt->level[level].height = h;
mt->level[level].depth = d;
- mt->level[level].level_offset = (x + y * mt->pitch) * mt->cpp;
mt->level[level].level_x = x;
mt->level[level].level_y = y;
mt->level[level].nr_images = nr_images;
- DBG("%s level %d size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__,
- level, w, h, d, x, y, mt->level[level].level_offset);
+ DBG("%s level %d size: %d,%d,%d offset %d,%d\n", __FUNCTION__,
+ level, w, h, d, x, y);
assert(nr_images);
assert(!mt->level[level].x_offset);
@@ -415,7 +352,7 @@ intel_miptree_image_map(struct intel_context * intel,
DBG("%s \n", __FUNCTION__);
if (row_stride)
- *row_stride = mt->pitch * mt->cpp;
+ *row_stride = mt->region->pitch * mt->cpp;
if (mt->target == GL_TEXTURE_3D) {
int i;
@@ -424,7 +361,7 @@ intel_miptree_image_map(struct intel_context * intel,
intel_miptree_get_image_offset(mt, level, face, i,
&x, &y);
- image_offsets[i] = x + y * mt->pitch;
+ image_offsets[i] = x + y * mt->region->pitch;
}
return intel_region_map(intel, mt->region);
@@ -435,7 +372,7 @@ intel_miptree_image_map(struct intel_context * intel,
image_offsets[0] = 0;
return intel_region_map(intel, mt->region) +
- (x + y * mt->pitch) * mt->cpp;
+ (x + y * mt->region->pitch) * mt->cpp;
}
}
@@ -527,13 +464,13 @@ intel_miptree_image_copy(struct intel_context *intel,
src_ptr = intel_region_map(intel, src->region);
dst_ptr = intel_region_map(intel, dst->region);
- _mesa_copy_rect(dst_ptr + dst->cpp * (dst_x + dst_y * dst->pitch),
+ _mesa_copy_rect(dst_ptr,
dst->cpp,
- dst->pitch,
- 0, 0, width, height,
- src_ptr + src->cpp * (src_x + src_y * src->pitch),
- src->pitch,
- 0, 0);
+ dst->region->pitch,
+ dst_x, dst_y, width, height,
+ src_ptr,
+ src->region->pitch,
+ src_x, src_y);
intel_region_unmap(intel, src->region);
intel_region_unmap(intel, dst->region);
}
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
index b19c548def..21db2f4d3b 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
@@ -62,14 +62,6 @@
*/
struct intel_mipmap_level
{
- /**
- * Byte offset to the base of this level.
- *
- * This is used for mipmap levels of 1D/2D/3D textures. However, CUBE
- * layouts spread images around the whole tree, so the level offset is
- * always zero in that case.
- */
- GLuint level_offset;
/** Offset to this miptree level, used in computing x_offset. */
GLuint level_x;
/** Offset to this miptree level, used in computing y_offset. */
@@ -81,8 +73,8 @@ struct intel_mipmap_level
/** Number of images at this level: 1 for 1D/2D, 6 for CUBE, depth for 3D */
GLuint nr_images;
- /**
- * Byte offset from level_offset to the image for each cube face or depth
+ /** @{
+ * offsets from level_[xy] to the image for each cube face or depth
* level.
*
* Pretty much have to accept that hardware formats
@@ -91,6 +83,7 @@ struct intel_mipmap_level
* so have to store them as a lookup table.
*/
GLuint *x_offset, *y_offset;
+ /** @} */
};
struct intel_mipmap_tree
@@ -109,8 +102,7 @@ struct intel_mipmap_tree
/* Derived from the above:
*/
- GLuint pitch;
- GLuint depth_pitch; /* per-image on i945? */
+ GLuint total_width;
GLuint total_height;
/* Includes image offset tables:
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
index 6e4bb64365..5e3f40836d 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -312,18 +312,13 @@ intelCreateBuffer(__DRIscreen * driScrnPriv,
}
if (mesaVis->depthBits == 24) {
- if (mesaVis->stencilBits == 8) {
- /* combined depth/stencil buffer */
- struct intel_renderbuffer *depthStencilRb
- = intel_create_renderbuffer(MESA_FORMAT_S8_Z24);
- /* note: bind RB to two attachment points */
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthStencilRb->Base);
- _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &depthStencilRb->Base);
- } else {
- struct intel_renderbuffer *depthRb
- = intel_create_renderbuffer(MESA_FORMAT_X8_Z24);
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
- }
+ assert(mesaVis->stencilBits == 8);
+ /* combined depth/stencil buffer */
+ struct intel_renderbuffer *depthStencilRb
+ = intel_create_renderbuffer(MESA_FORMAT_S8_Z24);
+ /* note: bind RB to two attachment points */
+ _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthStencilRb->Base);
+ _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &depthStencilRb->Base);
}
else if (mesaVis->depthBits == 16) {
/* just 16-bit depth buffer, no hw stencil */
diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c
index 377f3a8627..c1e15d1b0f 100644
--- a/src/mesa/drivers/dri/intel/intel_span.c
+++ b/src/mesa/drivers/dri/intel/intel_span.c
@@ -134,7 +134,7 @@ intel_set_span_functions(struct intel_context *intel,
(*(uint32_t *)(irb->region->buffer->virtual + NO_TILE(_x, _y)) = d)
#define READ_DEPTH(d, _x, _y) \
d = *(uint32_t *)(irb->region->buffer->virtual + NO_TILE(_x, _y))
-#define TAG(x) intel_##x##_z24_x8
+#define TAG(x) intel_##x##_z24_s8
#include "depthtmp.h"
void
@@ -361,7 +361,7 @@ intel_set_span_functions(struct intel_context *intel,
break;
case MESA_FORMAT_X8_Z24:
case MESA_FORMAT_S8_Z24:
- intel_InitDepthPointers_z24_x8(rb);
+ intel_InitDepthPointers_z24_s8(rb);
break;
default:
_mesa_problem(NULL,
diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c
index 13b8bcfa86..62e1e78f59 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_copy.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c
@@ -130,18 +130,8 @@ do_copy_texsubimage(struct intel_context *intel,
}
if (ctx->ReadBuffer->Name == 0) {
- /* reading from a window, adjust x, y */
- const __DRIdrawable *dPriv = intel->driReadDrawable;
- y = dPriv->y + (dPriv->h - (y + height));
- x += dPriv->x;
-
- /* Invert the data coming from the source rectangle due to GL
- * and hardware disagreeing on where y=0 is.
- *
- * It appears that our offsets and pitches get mangled
- * appropriately by the hardware, and we don't need to adjust them
- * on our own.
- */
+ /* Flip vertical orientation for system framebuffers */
+ y = ctx->ReadBuffer->Height - (y + height);
src_pitch = -src->pitch;
} else {
/* reading from a FBO, y is already oriented the way we like */
@@ -155,7 +145,7 @@ do_copy_texsubimage(struct intel_context *intel,
src->buffer,
0,
src->tiling,
- intelImage->mt->pitch,
+ intelImage->mt->region->pitch,
dst_bo,
0,
intelImage->mt->region->tiling,
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c
index bac36eeb56..9db96acdc0 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -236,7 +236,7 @@ try_pbo_upload(struct intel_context *intel,
intelImage->face, 0,
&dst_x, &dst_y);
- dst_stride = intelImage->mt->pitch;
+ dst_stride = intelImage->mt->region->pitch;
if (drm_intel_bo_references(intel->batch->buf, dst_buffer))
intelFlush(&intel->ctx);
@@ -290,7 +290,7 @@ try_pbo_zcopy(struct intel_context *intel,
intelImage->face, 0,
&dst_x, &dst_y);
- dst_stride = intelImage->mt->pitch;
+ dst_stride = intelImage->mt->region->pitch;
if (src_stride != dst_stride || dst_x != 0 || dst_y != 0 ||
src_offset != 0) {
diff --git a/src/mesa/drivers/dri/intel/intel_tex_layout.c b/src/mesa/drivers/dri/intel/intel_tex_layout.c
index 7d69ea4484..d132e19e83 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_layout.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_layout.c
@@ -74,14 +74,14 @@ void i945_miptree_layout_2d( struct intel_context *intel,
GLuint width = mt->width0;
GLuint height = mt->height0;
- mt->pitch = mt->width0;
+ mt->total_width = mt->width0;
intel_get_texture_alignment_unit(mt->internal_format, &align_w, &align_h);
if (mt->compressed) {
- mt->pitch = ALIGN(mt->width0, align_w);
+ mt->total_width = ALIGN(mt->width0, align_w);
}
- /* May need to adjust pitch to accomodate the placement of
+ /* May need to adjust width to accomodate the placement of
* the 2nd mipmap. This occurs when the alignment
* constraints of mipmap placement push the right edge of the
* 2nd mipmap out past the width of its parent.
@@ -97,15 +97,11 @@ void i945_miptree_layout_2d( struct intel_context *intel,
+ minify(minify(mt->width0));
}
- if (mip1_width > mt->pitch) {
- mt->pitch = mip1_width;
+ if (mip1_width > mt->total_width) {
+ mt->total_width = mip1_width;
}
}
- /* Pitch must be a whole number of dwords, even though we
- * express it in texels.
- */
- mt->pitch = intel_miptree_pitch_align (intel, mt, tiling, mt->pitch);
mt->total_height = 0;
for ( level = mt->first_level ; level <= mt->last_level ; level++ ) {
diff --git a/src/mesa/drivers/dri/intel/server/intel_dri.c b/src/mesa/drivers/dri/intel/server/intel_dri.c
deleted file mode 100644
index e49c4214ad..0000000000
--- a/src/mesa/drivers/dri/intel/server/intel_dri.c
+++ /dev/null
@@ -1,1306 +0,0 @@
-/**
- * \file server/intel_dri.c
- * \brief File to perform the device-specific initialization tasks typically
- * done in the X server.
- *
- * Here they are converted to run in the client (or perhaps a standalone
- * process), and to work with the frame buffer device rather than the X
- * server infrastructure.
- *
- * Copyright (C) 2006 Dave Airlie (airlied@linux.ie)
-
- Permission is hereby granted, free of charge, to any person obtaining a
- copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sub license, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice (including the
- next paragraph) shall be included in all copies or substantial portions
- of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND/OR THEIR SUPPLIERS BE LIABLE FOR
- ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-
-#include "driver.h"
-#include "drm.h"
-
-#include "intel.h"
-#include "i830_dri.h"
-
-#include "memops.h"
-#include "pciaccess.h"
-
-static size_t drm_page_size;
-static int nextTile = 0;
-#define xf86DrvMsg(...) do {} while(0)
-
-static const int pitches[] = {
- 128 * 8,
- 128 * 16,
- 128 * 32,
- 128 * 64,
- 0
-};
-
-static Bool I830DRIDoMappings(DRIDriverContext *ctx, I830Rec *pI830, drmI830Sarea *sarea);
-
-static unsigned long
-GetBestTileAlignment(unsigned long size)
-{
- unsigned long i;
-
- for (i = KB(512); i < size; i <<= 1)
- ;
-
- if (i > MB(64))
- i = MB(64);
-
- return i;
-}
-
-static void SetFenceRegs(const DRIDriverContext *ctx, I830Rec *pI830)
-{
- int i;
- unsigned char *MMIO = ctx->MMIOAddress;
-
- for (i = 0; i < 8; i++) {
- OUTREG(FENCE + i * 4, pI830->Fence[i]);
- // if (I810_DEBUG & DEBUG_VERBOSE_VGA)
- fprintf(stderr,"Fence Register : %x\n", pI830->Fence[i]);
- }
-}
-
-/* Tiled memory is good... really, really good...
- *
- * Need to make it less likely that we miss out on this - probably
- * need to move the frontbuffer away from the 'guarenteed' alignment
- * of the first memory segment, or perhaps allocate a discontigous
- * framebuffer to get more alignment 'sweet spots'.
- */
-static void
-SetFence(const DRIDriverContext *ctx, I830Rec *pI830,
- int nr, unsigned int start, unsigned int pitch,
- unsigned int size)
-{
- unsigned int val;
- unsigned int fence_mask = 0;
- unsigned int fence_pitch;
-
- if (nr < 0 || nr > 7) {
- fprintf(stderr,
- "SetFence: fence %d out of range\n",nr);
- return;
- }
-
- pI830->Fence[nr] = 0;
-
- if (IS_I9XX(pI830))
- fence_mask = ~I915G_FENCE_START_MASK;
- else
- fence_mask = ~I830_FENCE_START_MASK;
-
- if (start & fence_mask) {
- fprintf(stderr,
- "SetFence: %d: start (0x%08x) is not %s aligned\n",
- nr, start, (IS_I9XX(pI830)) ? "1MB" : "512k");
- return;
- }
-
- if (start % size) {
- fprintf(stderr,
- "SetFence: %d: start (0x%08x) is not size (%dk) aligned\n",
- nr, start, size / 1024);
- return;
- }
-
- if (pitch & 127) {
- fprintf(stderr,
- "SetFence: %d: pitch (%d) not a multiple of 128 bytes\n",
- nr, pitch);
- return;
- }
-
- val = (start | FENCE_X_MAJOR | FENCE_VALID);
-
- if (IS_I9XX(pI830)) {
- switch (size) {
- case MB(1):
- val |= I915G_FENCE_SIZE_1M;
- break;
- case MB(2):
- val |= I915G_FENCE_SIZE_2M;
- break;
- case MB(4):
- val |= I915G_FENCE_SIZE_4M;
- break;
- case MB(8):
- val |= I915G_FENCE_SIZE_8M;
- break;
- case MB(16):
- val |= I915G_FENCE_SIZE_16M;
- break;
- case MB(32):
- val |= I915G_FENCE_SIZE_32M;
- break;
- case MB(64):
- val |= I915G_FENCE_SIZE_64M;
- break;
- default:
- fprintf(stderr,
- "SetFence: %d: illegal size (%d kByte)\n", nr, size / 1024);
- return;
- }
- } else {
- switch (size) {
- case KB(512):
- val |= FENCE_SIZE_512K;
- break;
- case MB(1):
- val |= FENCE_SIZE_1M;
- break;
- case MB(2):
- val |= FENCE_SIZE_2M;
- break;
- case MB(4):
- val |= FENCE_SIZE_4M;
- break;
- case MB(8):
- val |= FENCE_SIZE_8M;
- break;
- case MB(16):
- val |= FENCE_SIZE_16M;
- break;
- case MB(32):
- val |= FENCE_SIZE_32M;
- break;
- case MB(64):
- val |= FENCE_SIZE_64M;
- break;
- default:
- fprintf(stderr,
- "SetFence: %d: illegal size (%d kByte)\n", nr, size / 1024);
- return;
- }
- }
-
- if (IS_I9XX(pI830))
- fence_pitch = pitch / 512;
- else
- fence_pitch = pitch / 128;
-
- switch (fence_pitch) {
- case 1:
- val |= FENCE_PITCH_1;
- break;
- case 2:
- val |= FENCE_PITCH_2;
- break;
- case 4:
- val |= FENCE_PITCH_4;
- break;
- case 8:
- val |= FENCE_PITCH_8;
- break;
- case 16:
- val |= FENCE_PITCH_16;
- break;
- case 32:
- val |= FENCE_PITCH_32;
- break;
- case 64:
- val |= FENCE_PITCH_64;
- break;
- default:
- fprintf(stderr,
- "SetFence: %d: illegal pitch (%d)\n", nr, pitch);
- return;
- }
-
- pI830->Fence[nr] = val;
-}
-
-static Bool
-MakeTiles(const DRIDriverContext *ctx, I830Rec *pI830, I830MemRange *pMem)
-{
- int pitch, ntiles, i;
-
- pitch = pMem->Pitch * ctx->cpp;
- /*
- * Simply try to break the region up into at most four pieces of size
- * equal to the alignment.
- */
- ntiles = ROUND_TO(pMem->Size, pMem->Alignment) / pMem->Alignment;
- if (ntiles >= 4) {
- return FALSE;
- }
-
- for (i = 0; i < ntiles; i++, nextTile++) {
- SetFence(ctx, pI830, nextTile, pMem->Start + i * pMem->Alignment,
- pitch, pMem->Alignment);
- }
- return TRUE;
-}
-
-static void I830SetupMemoryTiling(const DRIDriverContext *ctx, I830Rec *pI830)
-{
- int i;
-
- /* Clear out */
- for (i = 0; i < 8; i++)
- pI830->Fence[i] = 0;
-
- nextTile = 0;
-
- if (pI830->BackBuffer.Alignment >= KB(512)) {
- if (MakeTiles(ctx, pI830, &(pI830->BackBuffer))) {
- fprintf(stderr,
- "Activating tiled memory for the back buffer.\n");
- } else {
- fprintf(stderr,
- "MakeTiles failed for the back buffer.\n");
- pI830->allowPageFlip = FALSE;
- }
- }
-
- if (pI830->DepthBuffer.Alignment >= KB(512)) {
- if (MakeTiles(ctx, pI830, &(pI830->DepthBuffer))) {
- fprintf(stderr,
- "Activating tiled memory for the depth buffer.\n");
- } else {
- fprintf(stderr,
- "MakeTiles failed for the depth buffer.\n");
- }
- }
-
- return;
-}
-
-static int I830DetectMemory(const DRIDriverContext *ctx, I830Rec *pI830)
-{
- struct pci_device host_bridge, ig_dev;
- uint32_t gmch_ctrl;
- int memsize = 0;
- int range;
- uint32_t aper_size;
- uint32_t membase2 = 0;
-
- memset(&host_bridge, 0, sizeof(host_bridge));
- memset(&ig_dev, 0, sizeof(ig_dev));
-
- ig_dev.dev = 2;
-
- pci_device_cfg_read_u32(&host_bridge, &gmch_ctrl, I830_GMCH_CTRL);
-
- if (IS_I830(pI830) || IS_845G(pI830)) {
- if ((gmch_ctrl & I830_GMCH_MEM_MASK) == I830_GMCH_MEM_128M) {
- aper_size = 0x80000000;
- } else {
- aper_size = 0x40000000;
- }
- } else {
- if (IS_I9XX(pI830)) {
- int ret;
- ret = pci_device_cfg_read_u32(&ig_dev, &membase2, 0x18);
- if (membase2 & 0x08000000)
- aper_size = 0x8000000;
- else
- aper_size = 0x10000000;
-
- fprintf(stderr,"aper size is %08X %08x %d\n", aper_size, membase2, ret);
- } else
- aper_size = 0x8000000;
- }
-
- pI830->aper_size = aper_size;
-
-
- /* We need to reduce the stolen size, by the GTT and the popup.
- * The GTT varying according the the FbMapSize and the popup is 4KB */
- range = (ctx->shared.fbSize / (1024*1024)) + 4;
-
- if (IS_I85X(pI830) || IS_I865G(pI830) || IS_I9XX(pI830)) {
- switch (gmch_ctrl & I830_GMCH_GMS_MASK) {
- case I855_GMCH_GMS_STOLEN_1M:
- memsize = MB(1) - KB(range);
- break;
- case I855_GMCH_GMS_STOLEN_4M:
- memsize = MB(4) - KB(range);
- break;
- case I855_GMCH_GMS_STOLEN_8M:
- memsize = MB(8) - KB(range);
- break;
- case I855_GMCH_GMS_STOLEN_16M:
- memsize = MB(16) - KB(range);
- break;
- case I855_GMCH_GMS_STOLEN_32M:
- memsize = MB(32) - KB(range);
- break;
- case I915G_GMCH_GMS_STOLEN_48M:
- if (IS_I9XX(pI830))
- memsize = MB(48) - KB(range);
- break;
- case I915G_GMCH_GMS_STOLEN_64M:
- if (IS_I9XX(pI830))
- memsize = MB(64) - KB(range);
- break;
- }
- } else {
- switch (gmch_ctrl & I830_GMCH_GMS_MASK) {
- case I830_GMCH_GMS_STOLEN_512:
- memsize = KB(512) - KB(range);
- break;
- case I830_GMCH_GMS_STOLEN_1024:
- memsize = MB(1) - KB(range);
- break;
- case I830_GMCH_GMS_STOLEN_8192:
- memsize = MB(8) - KB(range);
- break;
- case I830_GMCH_GMS_LOCAL:
- memsize = 0;
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Local memory found, but won't be used.\n");
- break;
- }
- }
- if (memsize > 0) {
- fprintf(stderr,
- "detected %d kB stolen memory.\n", memsize / 1024);
- } else {
- fprintf(stderr,
- "no video memory detected.\n");
- }
- return memsize;
-}
-
-static int AgpInit(const DRIDriverContext *ctx, I830Rec *info)
-{
- unsigned long mode = 0x4;
-
- if (drmAgpAcquire(ctx->drmFD) < 0) {
- fprintf(stderr, "[gart] AGP not available\n");
- return 0;
- }
-
- if (drmAgpEnable(ctx->drmFD, mode) < 0) {
- fprintf(stderr, "[gart] AGP not enabled\n");
- drmAgpRelease(ctx->drmFD);
- return 0;
- }
- else
- fprintf(stderr, "[gart] AGP enabled at %dx\n", ctx->agpmode);
-
- return 1;
-}
-
-/*
- * Allocate memory from the given pool. Grow the pool if needed and if
- * possible.
- */
-static unsigned long
-AllocFromPool(const DRIDriverContext *ctx, I830Rec *pI830,
- I830MemRange *result, I830MemPool *pool,
- long size, unsigned long alignment, int flags)
-{
- long needed, start, end;
-
- if (!result || !pool || !size)
- return 0;
-
- /* Calculate how much space is needed. */
- if (alignment <= GTT_PAGE_SIZE)
- needed = size;
- else {
- start = ROUND_TO(pool->Free.Start, alignment);
- end = ROUND_TO(start + size, alignment);
- needed = end - pool->Free.Start;
- }
- if (needed > pool->Free.Size) {
- return 0;
- }
-
- result->Start = ROUND_TO(pool->Free.Start, alignment);
- pool->Free.Start += needed;
- result->End = pool->Free.Start;
-
- pool->Free.Size = pool->Free.End - pool->Free.Start;
- result->Size = result->End - result->Start;
- result->Pool = pool;
- result->Alignment = alignment;
- return needed;
-}
-
-static unsigned long AllocFromAGP(const DRIDriverContext *ctx, I830Rec *pI830, long size, unsigned long alignment, I830MemRange *result)
-{
- unsigned long start, end;
- unsigned long newApStart, newApEnd;
- int ret;
- if (!result || !size)
- return 0;
-
- if (!alignment)
- alignment = 4;
-
- start = ROUND_TO(pI830->MemoryAperture.Start, alignment);
- end = ROUND_TO(start + size, alignment);
- newApStart = end;
- newApEnd = pI830->MemoryAperture.End;
-
- ret=drmAgpAlloc(ctx->drmFD, size, 0, &(result->Physical), (drm_handle_t *)&(result->Key));
-
- if (ret)
- {
- fprintf(stderr,"drmAgpAlloc failed %d\n", ret);
- return 0;
- }
- pI830->allocatedMemory += size;
- pI830->MemoryAperture.Start = newApStart;
- pI830->MemoryAperture.End = newApEnd;
- pI830->MemoryAperture.Size = newApEnd - newApStart;
- // pI830->FreeMemory -= size;
- result->Start = start;
- result->End = start + size;
- result->Size = size;
- result->Offset = start;
- result->Alignment = alignment;
- result->Pool = NULL;
-
- return size;
-}
-
-unsigned long
-I830AllocVidMem(const DRIDriverContext *ctx, I830Rec *pI830,
- I830MemRange *result, I830MemPool *pool, long size,
- unsigned long alignment, int flags)
-{
- unsigned long ret;
-
- if (!result)
- return 0;
-
- /* Make sure these are initialised. */
- result->Size = 0;
- result->Key = -1;
-
- if (!size) {
- return 0;
- }
-
- if (pool->Free.Size < size) {
- ret = AllocFromAGP(ctx, pI830, size, alignment, result);
- }
- else {
- ret = AllocFromPool(ctx, pI830, result, pool, size, alignment, flags);
- if (ret == 0)
- ret = AllocFromAGP(ctx, pI830, size, alignment, result);
- }
- return ret;
-}
-
-static Bool BindAgpRange(const DRIDriverContext *ctx, I830MemRange *mem)
-{
- if (!mem)
- return FALSE;
-
- if (mem->Key == -1)
- return TRUE;
-
- return !drmAgpBind(ctx->drmFD, mem->Key, mem->Offset);
-}
-
-/* simple memory allocation routines needed */
-/* put ring buffer in low memory */
-/* need to allocate front, back, depth buffers aligned correctly,
- allocate ring buffer,
-*/
-
-/* */
-static Bool
-I830AllocateMemory(const DRIDriverContext *ctx, I830Rec *pI830)
-{
- unsigned long size, ret;
- unsigned long lines, lineSize, align;
-
- /* allocate ring buffer */
- memset(pI830->LpRing, 0, sizeof(I830RingBuffer));
- pI830->LpRing->mem.Key = -1;
-
- size = PRIMARY_RINGBUFFER_SIZE;
-
- ret = I830AllocVidMem(ctx, pI830, &pI830->LpRing->mem, &pI830->StolenPool, size, 0x1000, 0);
-
- if (ret != size)
- {
- fprintf(stderr,"unable to allocate ring buffer %ld\n", ret);
- return FALSE;
- }
-
- pI830->LpRing->tail_mask = pI830->LpRing->mem.Size - 1;
-
-
- /* allocate front buffer */
- memset(&(pI830->FrontBuffer), 0, sizeof(pI830->FrontBuffer));
- pI830->FrontBuffer.Key = -1;
- pI830->FrontBuffer.Pitch = ctx->shared.virtualWidth;
-
- align = KB(512);
-
- lineSize = ctx->shared.virtualWidth * ctx->cpp;
- lines = (ctx->shared.virtualHeight + 15) / 16 * 16;
- size = lineSize * lines;
- size = ROUND_TO_PAGE(size);
-
- align = GetBestTileAlignment(size);
-
- ret = I830AllocVidMem(ctx, pI830, &pI830->FrontBuffer, &pI830->StolenPool, size, align, 0);
- if (ret < size)
- {
- fprintf(stderr,"unable to allocate front buffer %ld\n", ret);
- return FALSE;
- }
-
- memset(&(pI830->BackBuffer), 0, sizeof(pI830->BackBuffer));
- pI830->BackBuffer.Key = -1;
- pI830->BackBuffer.Pitch = ctx->shared.virtualWidth;
-
- ret = I830AllocVidMem(ctx, pI830, &pI830->BackBuffer, &pI830->StolenPool, size, align, 0);
- if (ret < size)
- {
- fprintf(stderr,"unable to allocate back buffer %ld\n", ret);
- return FALSE;
- }
-
- memset(&(pI830->DepthBuffer), 0, sizeof(pI830->DepthBuffer));
- pI830->DepthBuffer.Key = -1;
- pI830->DepthBuffer.Pitch = ctx->shared.virtualWidth;
-
- ret = I830AllocVidMem(ctx, pI830, &pI830->DepthBuffer, &pI830->StolenPool, size, align, 0);
- if (ret < size)
- {
- fprintf(stderr,"unable to allocate depth buffer %ld\n", ret);
- return FALSE;
- }
-
- memset(&(pI830->ContextMem), 0, sizeof(pI830->ContextMem));
- pI830->ContextMem.Key = -1;
- size = KB(32);
-
- ret = I830AllocVidMem(ctx, pI830, &pI830->ContextMem, &pI830->StolenPool, size, align, 0);
- if (ret < size)
- {
- fprintf(stderr,"unable to allocate context buffer %ld\n", ret);
- return FALSE;
- }
-
-#if 0
- memset(&(pI830->TexMem), 0, sizeof(pI830->TexMem));
- pI830->TexMem.Key = -1;
-
- size = 32768 * 1024;
- ret = AllocFromAGP(ctx, pI830, size, align, &pI830->TexMem);
- if (ret < size)
- {
- fprintf(stderr,"unable to allocate texture memory %ld\n", ret);
- return FALSE;
- }
-#endif
-
- return TRUE;
-}
-
-static Bool
-I830BindMemory(const DRIDriverContext *ctx, I830Rec *pI830)
-{
- if (!BindAgpRange(ctx, &pI830->LpRing->mem))
- return FALSE;
- if (!BindAgpRange(ctx, &pI830->FrontBuffer))
- return FALSE;
- if (!BindAgpRange(ctx, &pI830->BackBuffer))
- return FALSE;
- if (!BindAgpRange(ctx, &pI830->DepthBuffer))
- return FALSE;
- if (!BindAgpRange(ctx, &pI830->ContextMem))
- return FALSE;
-#if 0
- if (!BindAgpRange(ctx, &pI830->TexMem))
- return FALSE;
-#endif
- return TRUE;
-}
-
-static void SetupDRIMM(const DRIDriverContext *ctx, I830Rec *pI830)
-{
- unsigned long aperEnd = ROUND_DOWN_TO(pI830->aper_size, GTT_PAGE_SIZE) / GTT_PAGE_SIZE;
- unsigned long aperStart = ROUND_TO(pI830->aper_size - KB(32768), GTT_PAGE_SIZE) / GTT_PAGE_SIZE;
-
- fprintf(stderr, "aper size is %08X\n", ctx->shared.fbSize);
- if (drmMMInit(ctx->drmFD, aperStart, aperEnd - aperStart, DRM_BO_MEM_TT)) {
- fprintf(stderr,
- "DRM MM Initialization Failed\n");
- } else {
- fprintf(stderr,
- "DRM MM Initialized at offset 0x%lx length %d page\n", aperStart, aperEnd-aperStart);
- }
-
-}
-
-static Bool
-I830CleanupDma(const DRIDriverContext *ctx)
-{
- drmI830Init info;
-
- memset(&info, 0, sizeof(drmI830Init));
- info.func = I830_CLEANUP_DMA;
-
- if (drmCommandWrite(ctx->drmFD, DRM_I830_INIT,
- &info, sizeof(drmI830Init))) {
- fprintf(stderr, "I830 Dma Cleanup Failed\n");
- return FALSE;
- }
-
- return TRUE;
-}
-
-static Bool
-I830InitDma(const DRIDriverContext *ctx, I830Rec *pI830)
-{
- I830RingBuffer *ring = pI830->LpRing;
- drmI830Init info;
-
- memset(&info, 0, sizeof(drmI830Init));
- info.func = I830_INIT_DMA;
-
- info.ring_start = ring->mem.Start + pI830->LinearAddr;
- info.ring_end = ring->mem.End + pI830->LinearAddr;
- info.ring_size = ring->mem.Size;
-
- info.mmio_offset = (unsigned int)ctx->MMIOStart;
-
- info.sarea_priv_offset = sizeof(drm_sarea_t);
-
- info.front_offset = pI830->FrontBuffer.Start;
- info.back_offset = pI830->BackBuffer.Start;
- info.depth_offset = pI830->DepthBuffer.Start;
- info.w = ctx->shared.virtualWidth;
- info.h = ctx->shared.virtualHeight;
- info.pitch = ctx->shared.virtualWidth;
- info.back_pitch = pI830->BackBuffer.Pitch;
- info.depth_pitch = pI830->DepthBuffer.Pitch;
- info.cpp = ctx->cpp;
-
- if (drmCommandWrite(ctx->drmFD, DRM_I830_INIT,
- &info, sizeof(drmI830Init))) {
- fprintf(stderr,
- "I830 Dma Initialization Failed\n");
- return FALSE;
- }
-
- return TRUE;
-}
-
-static int I830CheckDRMVersion( const DRIDriverContext *ctx,
- I830Rec *pI830 )
-{
- drmVersionPtr version;
-
- version = drmGetVersion(ctx->drmFD);
-
- if (version) {
- int req_minor, req_patch;
-
- req_minor = 4;
- req_patch = 0;
-
- if (version->version_major != 1 ||
- version->version_minor < req_minor ||
- (version->version_minor == req_minor &&
- version->version_patchlevel < req_patch)) {
- /* Incompatible drm version */
- fprintf(stderr,
- "[dri] I830DRIScreenInit failed because of a version "
- "mismatch.\n"
- "[dri] i915.o kernel module version is %d.%d.%d "
- "but version 1.%d.%d or newer is needed.\n"
- "[dri] Disabling DRI.\n",
- version->version_major,
- version->version_minor,
- version->version_patchlevel,
- req_minor,
- req_patch);
- drmFreeVersion(version);
- return 0;
- }
-
- pI830->drmMinor = version->version_minor;
- drmFreeVersion(version);
- }
- return 1;
-}
-
-static void
-I830SetRingRegs(const DRIDriverContext *ctx, I830Rec *pI830)
-{
- unsigned int itemp;
- unsigned char *MMIO = ctx->MMIOAddress;
-
- OUTREG(LP_RING + RING_LEN, 0);
- OUTREG(LP_RING + RING_TAIL, 0);
- OUTREG(LP_RING + RING_HEAD, 0);
-
- if ((long)(pI830->LpRing->mem.Start & I830_RING_START_MASK) !=
- pI830->LpRing->mem.Start) {
- fprintf(stderr,
- "I830SetRingRegs: Ring buffer start (%lx) violates its "
- "mask (%x)\n", pI830->LpRing->mem.Start, I830_RING_START_MASK);
- }
- /* Don't care about the old value. Reserved bits must be zero anyway. */
- itemp = pI830->LpRing->mem.Start & I830_RING_START_MASK;
- OUTREG(LP_RING + RING_START, itemp);
-
- if (((pI830->LpRing->mem.Size - 4096) & I830_RING_NR_PAGES) !=
- pI830->LpRing->mem.Size - 4096) {
- fprintf(stderr,
- "I830SetRingRegs: Ring buffer size - 4096 (%lx) violates its "
- "mask (%x)\n", pI830->LpRing->mem.Size - 4096,
- I830_RING_NR_PAGES);
- }
- /* Don't care about the old value. Reserved bits must be zero anyway. */
- itemp = (pI830->LpRing->mem.Size - 4096) & I830_RING_NR_PAGES;
- itemp |= (RING_NO_REPORT | RING_VALID);
- OUTREG(LP_RING + RING_LEN, itemp);
-
- pI830->LpRing->head = INREG(LP_RING + RING_HEAD) & I830_HEAD_MASK;
- pI830->LpRing->tail = INREG(LP_RING + RING_TAIL);
- pI830->LpRing->space = pI830->LpRing->head - (pI830->LpRing->tail + 8);
- if (pI830->LpRing->space < 0)
- pI830->LpRing->space += pI830->LpRing->mem.Size;
-
- SetFenceRegs(ctx, pI830);
-
- /* RESET THE DISPLAY PIPE TO POINT TO THE FRONTBUFFER - hacky
- hacky hacky */
- OUTREG(DSPABASE, pI830->FrontBuffer.Start + pI830->LinearAddr);
-
-}
-
-static Bool
-I830SetParam(const DRIDriverContext *ctx, int param, int value)
-{
- drmI830SetParam sp;
-
- memset(&sp, 0, sizeof(sp));
- sp.param = param;
- sp.value = value;
-
- if (drmCommandWrite(ctx->drmFD, DRM_I830_SETPARAM, &sp, sizeof(sp))) {
- fprintf(stderr, "I830 SetParam Failed\n");
- return FALSE;
- }
-
- return TRUE;
-}
-
-static Bool
-I830DRIMapScreenRegions(DRIDriverContext *ctx, I830Rec *pI830, drmI830Sarea *sarea)
-{
- fprintf(stderr,
- "[drm] Mapping front buffer\n");
-
- if (drmAddMap(ctx->drmFD,
- (drm_handle_t)(sarea->front_offset + pI830->LinearAddr),
- sarea->front_size,
- DRM_FRAME_BUFFER, /*DRM_AGP,*/
- 0,
- &sarea->front_handle) < 0) {
- fprintf(stderr,
- "[drm] drmAddMap(front_handle) failed. Disabling DRI\n");
- return FALSE;
- }
- ctx->shared.hFrameBuffer = sarea->front_handle;
- ctx->shared.fbSize = sarea->front_size;
- fprintf(stderr, "[drm] Front Buffer = 0x%08x\n",
- sarea->front_handle);
-
- if (drmAddMap(ctx->drmFD,
- (drm_handle_t)(sarea->back_offset),
- sarea->back_size, DRM_AGP, 0,
- &sarea->back_handle) < 0) {
- fprintf(stderr,
- "[drm] drmAddMap(back_handle) failed. Disabling DRI\n");
- return FALSE;
- }
- fprintf(stderr, "[drm] Back Buffer = 0x%08x\n",
- sarea->back_handle);
-
- if (drmAddMap(ctx->drmFD,
- (drm_handle_t)sarea->depth_offset,
- sarea->depth_size, DRM_AGP, 0,
- &sarea->depth_handle) < 0) {
- fprintf(stderr,
- "[drm] drmAddMap(depth_handle) failed. Disabling DRI\n");
- return FALSE;
- }
- fprintf(stderr, "[drm] Depth Buffer = 0x%08x\n",
- sarea->depth_handle);
-
-#if 0
- if (drmAddMap(ctx->drmFD,
- (drm_handle_t)sarea->tex_offset,
- sarea->tex_size, DRM_AGP, 0,
- &sarea->tex_handle) < 0) {
- fprintf(stderr,
- "[drm] drmAddMap(tex_handle) failed. Disabling DRI\n");
- return FALSE;
- }
- fprintf(stderr, "[drm] textures = 0x%08x\n",
- sarea->tex_handle);
-#endif
- return TRUE;
-}
-
-
-static void
-I830DRIUnmapScreenRegions(const DRIDriverContext *ctx, I830Rec *pI830, drmI830Sarea *sarea)
-{
-#if 1
- if (sarea->front_handle) {
- drmRmMap(ctx->drmFD, sarea->front_handle);
- sarea->front_handle = 0;
- }
-#endif
- if (sarea->back_handle) {
- drmRmMap(ctx->drmFD, sarea->back_handle);
- sarea->back_handle = 0;
- }
- if (sarea->depth_handle) {
- drmRmMap(ctx->drmFD, sarea->depth_handle);
- sarea->depth_handle = 0;
- }
- if (sarea->tex_handle) {
- drmRmMap(ctx->drmFD, sarea->tex_handle);
- sarea->tex_handle = 0;
- }
-}
-
-static Bool
-I830DRIDoMappings(DRIDriverContext *ctx, I830Rec *pI830, drmI830Sarea *sarea)
-{
- if (drmAddMap(ctx->drmFD,
- (drm_handle_t)pI830->LpRing->mem.Start,
- pI830->LpRing->mem.Size, DRM_AGP, 0,
- &pI830->ring_map) < 0) {
- fprintf(stderr,
- "[drm] drmAddMap(ring_map) failed. Disabling DRI\n");
- return FALSE;
- }
- fprintf(stderr, "[drm] ring buffer = 0x%08x\n",
- pI830->ring_map);
-
- if (I830InitDma(ctx, pI830) == FALSE) {
- return FALSE;
- }
-
- /* init to zero to be safe */
-
- I830DRIMapScreenRegions(ctx, pI830, sarea);
- SetupDRIMM(ctx, pI830);
-
- if (ctx->pciDevice != PCI_CHIP_845_G &&
- ctx->pciDevice != PCI_CHIP_I830_M) {
- I830SetParam(ctx, I830_SETPARAM_USE_MI_BATCHBUFFER_START, 1 );
- }
-
- /* Okay now initialize the dma engine */
- {
- pI830->irq = drmGetInterruptFromBusID(ctx->drmFD,
- ctx->pciBus,
- ctx->pciDevice,
- ctx->pciFunc);
-
- if (drmCtlInstHandler(ctx->drmFD, pI830->irq)) {
- fprintf(stderr,
- "[drm] failure adding irq handler\n");
- pI830->irq = 0;
- return FALSE;
- }
- else
- fprintf(stderr,
- "[drm] dma control initialized, using IRQ %d\n",
- pI830->irq);
- }
-
- fprintf(stderr, "[dri] visual configs initialized\n");
-
- return TRUE;
-}
-
-static Bool
-I830ClearScreen(DRIDriverContext *ctx, I830Rec *pI830, drmI830Sarea *sarea)
-{
- /* need to drmMap front and back buffers and zero them */
- drmAddress map_addr;
- int ret;
-
- ret = drmMap(ctx->drmFD,
- sarea->front_handle,
- sarea->front_size,
- &map_addr);
-
- if (ret)
- {
- fprintf(stderr, "Unable to map front buffer\n");
- return FALSE;
- }
-
- drimemsetio((char *)map_addr,
- 0,
- sarea->front_size);
- drmUnmap(map_addr, sarea->front_size);
-
-
- ret = drmMap(ctx->drmFD,
- sarea->back_handle,
- sarea->back_size,
- &map_addr);
-
- if (ret)
- {
- fprintf(stderr, "Unable to map back buffer\n");
- return FALSE;
- }
-
- drimemsetio((char *)map_addr,
- 0,
- sarea->back_size);
- drmUnmap(map_addr, sarea->back_size);
-
- return TRUE;
-}
-
-static Bool
-I830ScreenInit(DRIDriverContext *ctx, I830Rec *pI830)
-
-{
- I830DRIPtr pI830DRI;
- drmI830Sarea *pSAREAPriv;
- int err;
-
- drm_page_size = getpagesize();
-
- pI830->registerSize = ctx->MMIOSize;
- /* This is a hack for now. We have to have more than a 4k page here
- * because of the size of the state. However, the state should be
- * in a per-context mapping. This will be added in the Mesa 3.5 port
- * of the I830 driver.
- */
- ctx->shared.SAREASize = SAREA_MAX;
-
- /* Note that drmOpen will try to load the kernel module, if needed. */
- ctx->drmFD = drmOpen("i915", NULL );
- if (ctx->drmFD < 0) {
- fprintf(stderr, "[drm] drmOpen failed\n");
- return 0;
- }
-
- if ((err = drmSetBusid(ctx->drmFD, ctx->pciBusID)) < 0) {
- fprintf(stderr, "[drm] drmSetBusid failed (%d, %s), %s\n",
- ctx->drmFD, ctx->pciBusID, strerror(-err));
- return 0;
- }
-
- if (drmAddMap( ctx->drmFD,
- 0,
- ctx->shared.SAREASize,
- DRM_SHM,
- DRM_CONTAINS_LOCK,
- &ctx->shared.hSAREA) < 0)
- {
- fprintf(stderr, "[drm] drmAddMap failed\n");
- return 0;
- }
-
- fprintf(stderr, "[drm] added %d byte SAREA at 0x%08x\n",
- ctx->shared.SAREASize, ctx->shared.hSAREA);
-
- if (drmMap( ctx->drmFD,
- ctx->shared.hSAREA,
- ctx->shared.SAREASize,
- (drmAddressPtr)(&ctx->pSAREA)) < 0)
- {
- fprintf(stderr, "[drm] drmMap failed\n");
- return 0;
-
- }
-
- memset(ctx->pSAREA, 0, ctx->shared.SAREASize);
- fprintf(stderr, "[drm] mapped SAREA 0x%08x to %p, size %d\n",
- ctx->shared.hSAREA, ctx->pSAREA, ctx->shared.SAREASize);
-
-
- if (drmAddMap(ctx->drmFD,
- ctx->MMIOStart,
- ctx->MMIOSize,
- DRM_REGISTERS,
- DRM_READ_ONLY,
- &pI830->registerHandle) < 0) {
- fprintf(stderr, "[drm] drmAddMap mmio failed\n");
- return 0;
- }
- fprintf(stderr,
- "[drm] register handle = 0x%08x\n", pI830->registerHandle);
-
-
- if (!I830CheckDRMVersion(ctx, pI830)) {
- return FALSE;
- }
-
- /* Create a 'server' context so we can grab the lock for
- * initialization ioctls.
- */
- if ((err = drmCreateContext(ctx->drmFD, &ctx->serverContext)) != 0) {
- fprintf(stderr, "%s: drmCreateContext failed %d\n", __FUNCTION__, err);
- return 0;
- }
-
- DRM_LOCK(ctx->drmFD, ctx->pSAREA, ctx->serverContext, 0);
-
- /* Initialize the SAREA private data structure */
- pSAREAPriv = (drmI830Sarea *)(((char*)ctx->pSAREA) +
- sizeof(drm_sarea_t));
- memset(pSAREAPriv, 0, sizeof(*pSAREAPriv));
-
- pI830->StolenMemory.Size = I830DetectMemory(ctx, pI830);
- pI830->StolenMemory.Start = 0;
- pI830->StolenMemory.End = pI830->StolenMemory.Size;
-
- pI830->MemoryAperture.Start = pI830->StolenMemory.End;
- pI830->MemoryAperture.End = KB(40000);
- pI830->MemoryAperture.Size = pI830->MemoryAperture.End - pI830->MemoryAperture.Start;
-
- pI830->StolenPool.Fixed = pI830->StolenMemory;
- pI830->StolenPool.Total = pI830->StolenMemory;
- pI830->StolenPool.Free = pI830->StolenPool.Total;
- pI830->FreeMemory = pI830->StolenPool.Total.Size;
-
- if (!AgpInit(ctx, pI830))
- return FALSE;
-
- if (I830AllocateMemory(ctx, pI830) == FALSE)
- {
- return FALSE;
- }
-
- if (I830BindMemory(ctx, pI830) == FALSE)
- {
- return FALSE;
- }
-
- pSAREAPriv->rotated_offset = -1;
- pSAREAPriv->rotated_size = 0;
- pSAREAPriv->rotated_pitch = ctx->shared.virtualWidth;
-
- pSAREAPriv->front_offset = pI830->FrontBuffer.Start;
- pSAREAPriv->front_size = pI830->FrontBuffer.Size;
- pSAREAPriv->width = ctx->shared.virtualWidth;
- pSAREAPriv->height = ctx->shared.virtualHeight;
- pSAREAPriv->pitch = ctx->shared.virtualWidth;
- pSAREAPriv->virtualX = ctx->shared.virtualWidth;
- pSAREAPriv->virtualY = ctx->shared.virtualHeight;
- pSAREAPriv->back_offset = pI830->BackBuffer.Start;
- pSAREAPriv->back_size = pI830->BackBuffer.Size;
- pSAREAPriv->depth_offset = pI830->DepthBuffer.Start;
- pSAREAPriv->depth_size = pI830->DepthBuffer.Size;
-#if 0
- pSAREAPriv->tex_offset = pI830->TexMem.Start;
- pSAREAPriv->tex_size = pI830->TexMem.Size;
-#endif
- pSAREAPriv->log_tex_granularity = pI830->TexGranularity;
-
- ctx->driverClientMsg = malloc(sizeof(I830DRIRec));
- ctx->driverClientMsgSize = sizeof(I830DRIRec);
- pI830DRI = (I830DRIPtr)ctx->driverClientMsg;
- pI830DRI->deviceID = pI830->Chipset;
- pI830DRI->regsSize = I830_REG_SIZE;
- pI830DRI->width = ctx->shared.virtualWidth;
- pI830DRI->height = ctx->shared.virtualHeight;
- pI830DRI->mem = ctx->shared.fbSize;
- pI830DRI->cpp = ctx->cpp;
-
- pI830DRI->bitsPerPixel = ctx->bpp;
- pI830DRI->sarea_priv_offset = sizeof(drm_sarea_t);
-
- err = I830DRIDoMappings(ctx, pI830, pSAREAPriv);
- if (err == FALSE)
- return FALSE;
-
- I830SetupMemoryTiling(ctx, pI830);
-
- /* Quick hack to clear the front & back buffers. Could also use
- * the clear ioctl to do this, but would need to setup hw state
- * first.
- */
- I830ClearScreen(ctx, pI830, pSAREAPriv);
-
- I830SetRingRegs(ctx, pI830);
-
- return TRUE;
-}
-
-
-/**
- * \brief Validate the fbdev mode.
- *
- * \param ctx display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Saves some registers and returns 1.
- *
- * \sa radeonValidateMode().
- */
-static int i830ValidateMode( const DRIDriverContext *ctx )
-{
- return 1;
-}
-
-/**
- * \brief Examine mode returned by fbdev.
- *
- * \param ctx display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Restores registers that fbdev has clobbered and returns 1.
- *
- * \sa i810ValidateMode().
- */
-static int i830PostValidateMode( const DRIDriverContext *ctx )
-{
- I830Rec *pI830 = ctx->driverPrivate;
-
- I830SetRingRegs(ctx, pI830);
- return 1;
-}
-
-
-/**
- * \brief Initialize the framebuffer device mode
- *
- * \param ctx display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Fills in \p info with some default values and some information from \p ctx
- * and then calls I810ScreenInit() for the screen initialization.
- *
- * Before exiting clears the framebuffer memory accessing it directly.
- */
-static int i830InitFBDev( DRIDriverContext *ctx )
-{
- I830Rec *pI830 = calloc(1, sizeof(I830Rec));
- int i;
-
- {
- int dummy = ctx->shared.virtualWidth;
-
- switch (ctx->bpp / 8) {
- case 1: dummy = (ctx->shared.virtualWidth + 127) & ~127; break;
- case 2: dummy = (ctx->shared.virtualWidth + 31) & ~31; break;
- case 3:
- case 4: dummy = (ctx->shared.virtualWidth + 15) & ~15; break;
- }
-
- ctx->shared.virtualWidth = dummy;
- ctx->shared.Width = ctx->shared.virtualWidth;
- }
-
-
- for (i = 0; pitches[i] != 0; i++) {
- if (pitches[i] >= ctx->shared.virtualWidth) {
- ctx->shared.virtualWidth = pitches[i];
- break;
- }
- }
-
- ctx->driverPrivate = (void *)pI830;
-
- pI830->LpRing = calloc(1, sizeof(I830RingBuffer));
- pI830->Chipset = ctx->chipset;
- pI830->LinearAddr = ctx->FBStart;
-
- if (!I830ScreenInit( ctx, pI830 ))
- return 0;
-
-
- return 1;
-}
-
-
-/**
- * \brief The screen is being closed, so clean up any state and free any
- * resources used by the DRI.
- *
- * \param ctx display handle.
- *
- * Unmaps the SAREA, closes the DRM device file descriptor and frees the driver
- * private data.
- */
-static void i830HaltFBDev( DRIDriverContext *ctx )
-{
- drmI830Sarea *pSAREAPriv;
- I830Rec *pI830 = ctx->driverPrivate;
-
- if (pI830->irq) {
- drmCtlUninstHandler(ctx->drmFD);
- pI830->irq = 0; }
-
- I830CleanupDma(ctx);
-
- pSAREAPriv = (drmI830Sarea *)(((char*)ctx->pSAREA) +
- sizeof(drm_sarea_t));
-
- I830DRIUnmapScreenRegions(ctx, pI830, pSAREAPriv);
- drmUnmap( ctx->pSAREA, ctx->shared.SAREASize );
- drmClose(ctx->drmFD);
-
- if (ctx->driverPrivate) {
- free(ctx->driverPrivate);
- ctx->driverPrivate = 0;
- }
-}
-
-
-extern void i810NotifyFocus( int );
-
-/**
- * \brief Exported driver interface for Mini GLX.
- *
- * \sa DRIDriverRec.
- */
-const struct DRIDriverRec __driDriver = {
- i830ValidateMode,
- i830PostValidateMode,
- i830InitFBDev,
- i830HaltFBDev,
- NULL,//I830EngineShutdown,
- NULL, //I830EngineRestore,
-#ifndef _EMBEDDED
- 0,
-#else
- i810NotifyFocus,
-#endif
-};
diff --git a/src/mesa/drivers/dri/mach64/Makefile b/src/mesa/drivers/dri/mach64/Makefile
index a8f463e9fd..c20fdece29 100644
--- a/src/mesa/drivers/dri/mach64/Makefile
+++ b/src/mesa/drivers/dri/mach64/Makefile
@@ -5,9 +5,6 @@ include $(TOP)/configs/current
LIBNAME = mach64_dri.so
-# Not yet
-# MINIGLX_SOURCES = server/mach64_dri.c
-
DRIVER_SOURCES = \
mach64_context.c \
mach64_ioctl.c \
diff --git a/src/mesa/drivers/dri/mach64/mach64_context.c b/src/mesa/drivers/dri/mach64/mach64_context.c
index 77e7e53ce0..73b1e08d4b 100644
--- a/src/mesa/drivers/dri/mach64/mach64_context.c
+++ b/src/mesa/drivers/dri/mach64/mach64_context.c
@@ -31,6 +31,7 @@
#include "main/glheader.h"
#include "main/context.h"
+#include "main/extensions.h"
#include "main/simple_list.h"
#include "main/imports.h"
diff --git a/src/mesa/drivers/dri/mga/Makefile b/src/mesa/drivers/dri/mga/Makefile
index 0cc329fb22..92533bccc2 100644
--- a/src/mesa/drivers/dri/mga/Makefile
+++ b/src/mesa/drivers/dri/mga/Makefile
@@ -5,8 +5,6 @@ include $(TOP)/configs/current
LIBNAME = mga_dri.so
-MINIGLX_SOURCES = server/mga_dri.c
-
DRIVER_SOURCES = \
mgadd.c \
mgaioctl.c \
diff --git a/src/mesa/drivers/dri/mga/server/mga_dri.c b/src/mesa/drivers/dri/mga/server/mga_dri.c
deleted file mode 100644
index bc575e62ee..0000000000
--- a/src/mesa/drivers/dri/mga/server/mga_dri.c
+++ /dev/null
@@ -1,1088 +0,0 @@
-
-/*
- * Copyright 2000 VA Linux Systems Inc., Fremont, California.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES
- * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- * Gareth Hughes <gareth@valinux.com>
- */
-
-#include <errno.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <inttypes.h>
-
-#include "driver.h"
-#include "drm.h"
-#include "memops.h"
-
-#include "mga_reg.h"
-#include "mga.h"
-#include "mga_macros.h"
-#include "mga_dri.h"
-
-
-/* Quiescence, locking
- */
-#define MGA_TIMEOUT 2048
-
-static void MGAWaitForIdleDMA( struct DRIDriverContextRec *ctx, MGAPtr pMga )
-{
- drm_lock_t lock;
- int ret;
- int i = 0;
-
- memset( &lock, 0, sizeof(lock) );
-
- for (;;) {
- do {
- /* first ask for quiescent and flush */
- lock.flags = DRM_LOCK_QUIESCENT | DRM_LOCK_FLUSH;
- do {
- ret = drmCommandWrite( ctx->drmFD, DRM_MGA_FLUSH,
- &lock, sizeof( lock ) );
- } while ( ret == -EBUSY && i++ < DRM_MGA_IDLE_RETRY );
-
- /* if it's still busy just try quiescent */
- if ( ret == -EBUSY ) {
- lock.flags = DRM_LOCK_QUIESCENT;
- do {
- ret = drmCommandWrite( ctx->drmFD, DRM_MGA_FLUSH,
- &lock, sizeof( lock ) );
- } while ( ret == -EBUSY && i++ < DRM_MGA_IDLE_RETRY );
- }
- } while ( ( ret == -EBUSY ) && ( i++ < MGA_TIMEOUT ) );
-
- if ( ret == 0 )
- return;
-
- fprintf( stderr,
- "[dri] Idle timed out, resetting engine...\n" );
-
- drmCommandNone( ctx->drmFD, DRM_MGA_RESET );
- }
-}
-
-static unsigned int mylog2( unsigned int n )
-{
- unsigned int log2 = 1;
- while ( n > 1 ) n >>= 1, log2++;
- return log2;
-}
-
-static int MGADRIAgpInit(struct DRIDriverContextRec *ctx, MGAPtr pMga)
-{
- unsigned long mode;
- unsigned int vendor, device;
- int ret, count, i;
-
- if(pMga->agpSize < 12)pMga->agpSize = 12;
- if(pMga->agpSize > 64)pMga->agpSize = 64; /* cap */
-
- /* FIXME: Make these configurable...
- */
- pMga->agp.size = pMga->agpSize * 1024 * 1024;
-
- pMga->warp.offset = 0;
- pMga->warp.size = MGA_WARP_UCODE_SIZE;
-
- pMga->primary.offset = (pMga->warp.offset +
- pMga->warp.size);
- pMga->primary.size = 1024 * 1024;
-
- pMga->buffers.offset = (pMga->primary.offset +
- pMga->primary.size);
- pMga->buffers.size = MGA_NUM_BUFFERS * MGA_BUFFER_SIZE;
-
-
- pMga->agpTextures.offset = (pMga->buffers.offset +
- pMga->buffers.size);
-
- pMga->agpTextures.size = pMga->agp.size -
- pMga->agpTextures.offset;
-
- if ( drmAgpAcquire( ctx->drmFD ) < 0 ) {
- fprintf( stderr, "[agp] AGP not available\n" );
- return 0;
- }
-
- mode = drmAgpGetMode( ctx->drmFD ); /* Default mode */
- vendor = drmAgpVendorId( ctx->drmFD );
- device = drmAgpDeviceId( ctx->drmFD );
-
- mode &= ~MGA_AGP_MODE_MASK;
- switch ( pMga->agpMode ) {
- case 4:
- mode |= MGA_AGP_4X_MODE;
- case 2:
- mode |= MGA_AGP_2X_MODE;
- case 1:
- default:
- mode |= MGA_AGP_1X_MODE;
- }
-
-#if 0
- fprintf( stderr,
- "[agp] Mode 0x%08lx [AGP 0x%04x/0x%04x; Card 0x%04x/0x%04x]\n",
- mode, vendor, device,
- ctx->pciVendor,
- ctx->pciChipType );
-#endif
-
- if ( drmAgpEnable( ctx->drmFD, mode ) < 0 ) {
- fprintf( stderr, "[agp] AGP not enabled\n" );
- drmAgpRelease( ctx->drmFD );
- return 0;
- }
-
- if ( pMga->Chipset == PCI_CHIP_MGAG200 ) {
- switch ( pMga->agpMode ) {
- case 2:
- fprintf( stderr,
- "[drm] Enabling AGP 2x PLL encoding\n" );
- OUTREG( MGAREG_AGP_PLL, MGA_AGP2XPLL_ENABLE );
- break;
-
- case 1:
- default:
- fprintf( stderr,
- "[drm] Disabling AGP 2x PLL encoding\n" );
- OUTREG( MGAREG_AGP_PLL, MGA_AGP2XPLL_DISABLE );
- pMga->agpMode = 1;
- break;
- }
- }
-
- ret = drmAgpAlloc( ctx->drmFD, pMga->agp.size,
- 0, NULL, &pMga->agp.handle );
- if ( ret < 0 ) {
- fprintf( stderr, "[agp] Out of memory (%d)\n", ret );
- drmAgpRelease( ctx->drmFD );
- return 0;
- }
- fprintf( stderr,
- "[agp] %d kB allocated with handle 0x%08x\n",
- pMga->agp.size/1024, (unsigned int)pMga->agp.handle );
-
- if ( drmAgpBind( ctx->drmFD, pMga->agp.handle, 0 ) < 0 ) {
- fprintf( stderr, "[agp] Could not bind memory\n" );
- drmAgpFree( ctx->drmFD, pMga->agp.handle );
- drmAgpRelease( ctx->drmFD );
- return 0;
- }
-
- /* WARP microcode space
- */
- if ( drmAddMap( ctx->drmFD,
- pMga->warp.offset,
- pMga->warp.size,
- DRM_AGP, DRM_READ_ONLY,
- &pMga->warp.handle ) < 0 ) {
- fprintf( stderr,
- "[agp] Could not add WARP microcode mapping\n" );
- return 0;
- }
- fprintf( stderr,
- "[agp] WARP microcode handle = 0x%08x\n",
- pMga->warp.handle );
-
- if ( drmMap( ctx->drmFD,
- pMga->warp.handle,
- pMga->warp.size,
- &pMga->warp.map ) < 0 ) {
- fprintf( stderr,
- "[agp] Could not map WARP microcode\n" );
- return 0;
- }
- fprintf( stderr,
- "[agp] WARP microcode mapped at 0x%08lx\n",
- (unsigned long)pMga->warp.map );
-
- /* Primary DMA space
- */
- if ( drmAddMap( ctx->drmFD,
- pMga->primary.offset,
- pMga->primary.size,
- DRM_AGP, DRM_READ_ONLY,
- &pMga->primary.handle ) < 0 ) {
- fprintf( stderr,
- "[agp] Could not add primary DMA mapping\n" );
- return 0;
- }
- fprintf( stderr,
- "[agp] Primary DMA handle = 0x%08x\n",
- pMga->primary.handle );
-
- if ( drmMap( ctx->drmFD,
- pMga->primary.handle,
- pMga->primary.size,
- &pMga->primary.map ) < 0 ) {
- fprintf( stderr,
- "[agp] Could not map primary DMA\n" );
- return 0;
- }
- fprintf( stderr,
- "[agp] Primary DMA mapped at 0x%08lx\n",
- (unsigned long)pMga->primary.map );
-
- /* DMA buffers
- */
- if ( drmAddMap( ctx->drmFD,
- pMga->buffers.offset,
- pMga->buffers.size,
- DRM_AGP, 0,
- &pMga->buffers.handle ) < 0 ) {
- fprintf( stderr,
- "[agp] Could not add DMA buffers mapping\n" );
- return 0;
- }
- fprintf( stderr,
- "[agp] DMA buffers handle = 0x%08x\n",
- pMga->buffers.handle );
-
- if ( drmMap( ctx->drmFD,
- pMga->buffers.handle,
- pMga->buffers.size,
- &pMga->buffers.map ) < 0 ) {
- fprintf( stderr,
- "[agp] Could not map DMA buffers\n" );
- return 0;
- }
- fprintf( stderr,
- "[agp] DMA buffers mapped at 0x%08lx\n",
- (unsigned long)pMga->buffers.map );
-
- count = drmAddBufs( ctx->drmFD,
- MGA_NUM_BUFFERS, MGA_BUFFER_SIZE,
- DRM_AGP_BUFFER, pMga->buffers.offset );
- if ( count <= 0 ) {
- fprintf( stderr,
- "[drm] failure adding %d %d byte DMA buffers\n",
- MGA_NUM_BUFFERS, MGA_BUFFER_SIZE );
- return 0;
- }
- fprintf( stderr,
- "[drm] Added %d %d byte DMA buffers\n",
- count, MGA_BUFFER_SIZE );
-
- i = mylog2(pMga->agpTextures.size / MGA_NR_TEX_REGIONS);
- if(i < MGA_LOG_MIN_TEX_REGION_SIZE)
- i = MGA_LOG_MIN_TEX_REGION_SIZE;
- pMga->agpTextures.size = (pMga->agpTextures.size >> i) << i;
-
- if ( drmAddMap( ctx->drmFD,
- pMga->agpTextures.offset,
- pMga->agpTextures.size,
- DRM_AGP, 0,
- &pMga->agpTextures.handle ) < 0 ) {
- fprintf( stderr,
- "[agp] Could not add agpTexture mapping\n" );
- return 0;
- }
-/* should i map it ? */
- fprintf( stderr,
- "[agp] agpTexture handle = 0x%08x\n",
- pMga->agpTextures.handle );
- fprintf( stderr,
- "[agp] agpTexture size: %d kb\n", pMga->agpTextures.size/1024 );
-
- return 1;
-}
-
-static int MGADRIMapInit( struct DRIDriverContextRec *ctx, MGAPtr pMga )
-{
- pMga->registers.size = MGAIOMAPSIZE;
-
- if ( drmAddMap( ctx->drmFD,
- (drm_handle_t)pMga->IOAddress,
- pMga->registers.size,
- DRM_REGISTERS, DRM_READ_ONLY,
- &pMga->registers.handle ) < 0 ) {
- fprintf( stderr,
- "[drm] Could not add MMIO registers mapping\n" );
- return 0;
- }
- fprintf( stderr,
- "[drm] Registers handle = 0x%08lx\n",
- pMga->registers.handle );
-
- pMga->status.size = SAREA_MAX;
-
- if ( drmAddMap( ctx->drmFD, 0, pMga->status.size,
- DRM_SHM, DRM_READ_ONLY | DRM_LOCKED | DRM_KERNEL,
- &pMga->status.handle ) < 0 ) {
- fprintf( stderr,
- "[drm] Could not add status page mapping\n" );
- return 0;
- }
- fprintf( stderr,
- "[drm] Status handle = 0x%08x\n",
- pMga->status.handle );
-
- if ( drmMap( ctx->drmFD,
- pMga->status.handle,
- pMga->status.size,
- &pMga->status.map ) < 0 ) {
- fprintf( stderr,
- "[agp] Could not map status page\n" );
- return 0;
- }
- fprintf( stderr,
- "[agp] Status page mapped at 0x%08lx\n",
- (unsigned long)pMga->status.map );
-
- return 1;
-}
-
-static int MGADRIKernelInit( struct DRIDriverContextRec *ctx, MGAPtr pMga )
-{
- drm_mga_init_t init;
- int ret;
-
- memset( &init, 0, sizeof(init) );
-
- init.func = MGA_INIT_DMA;
- init.sarea_priv_offset = sizeof(drm_sarea_t);
-
- switch ( pMga->Chipset ) {
- case PCI_CHIP_MGAG550:
- case PCI_CHIP_MGAG400:
- init.chipset = MGA_CARD_TYPE_G400;
- break;
- case PCI_CHIP_MGAG200:
- case PCI_CHIP_MGAG200_PCI:
- init.chipset = MGA_CARD_TYPE_G200;
- break;
- default:
- return 0;
- }
-
- init.sgram = 0; /* FIXME !pMga->HasSDRAM; */
-
-
- switch (ctx->bpp)
- {
- case 16:
- init.maccess = MGA_MACCESS_PW16;
- break;
- case 32:
- init.maccess = MGA_MACCESS_PW32;
- break;
- default:
- fprintf( stderr, "[mga] invalid bpp (%d)\n", ctx->bpp );
- return 0;
- }
-
-
- init.fb_cpp = ctx->bpp / 8;
- init.front_offset = pMga->frontOffset;
- init.front_pitch = pMga->frontPitch / init.fb_cpp;
- init.back_offset = pMga->backOffset;
- init.back_pitch = pMga->backPitch / init.fb_cpp;
-
- init.depth_cpp = ctx->bpp / 8;
- init.depth_offset = pMga->depthOffset;
- init.depth_pitch = pMga->depthPitch / init.depth_cpp;
-
- init.texture_offset[0] = pMga->textureOffset;
- init.texture_size[0] = pMga->textureSize;
-
- init.fb_offset = ctx->shared.hFrameBuffer;
- init.mmio_offset = pMga->registers.handle;
- init.status_offset = pMga->status.handle;
-
- init.warp_offset = pMga->warp.handle;
- init.primary_offset = pMga->primary.handle;
- init.buffers_offset = pMga->buffers.handle;
-
- init.texture_offset[1] = pMga->agpTextures.handle;
- init.texture_size[1] = pMga->agpTextures.size;
-
- ret = drmCommandWrite( ctx->drmFD, DRM_MGA_INIT, &init, sizeof(init));
- if ( ret < 0 ) {
- fprintf( stderr,
- "[drm] Failed to initialize DMA! (%d)\n", ret );
- return 0;
- }
-
- return 1;
-}
-
-static void MGADRIIrqInit(struct DRIDriverContextRec *ctx, MGAPtr pMga)
-{
- if (!pMga->irq)
- {
- pMga->irq = drmGetInterruptFromBusID(ctx->drmFD,
- ctx->pciBus,
- ctx->pciDevice,
- ctx->pciFunc);
-
- fprintf(stderr, "[drm] got IRQ %d\n", pMga->irq);
-
- if((drmCtlInstHandler(ctx->drmFD, pMga->irq)) != 0)
- {
- fprintf(stderr,
- "[drm] failure adding irq handler, "
- "there is a device already using that irq\n"
- "[drm] falling back to irq-free operation\n");
- pMga->irq = 0;
- }
- else
- {
- pMga->reg_ien = INREG( MGAREG_IEN );
- }
- }
-
- if (pMga->irq)
- fprintf(stderr,
- "[drm] dma control initialized, using IRQ %d\n",
- pMga->irq);
-}
-
-static int MGADRIBuffersInit( struct DRIDriverContextRec *ctx, MGAPtr pMga )
-{
- pMga->drmBuffers = drmMapBufs( ctx->drmFD );
- if ( !pMga->drmBuffers )
- {
- fprintf( stderr,
- "[drm] Failed to map DMA buffers list\n" );
- return 0;
- }
-
- fprintf( stderr,
- "[drm] Mapped %d DMA buffers\n",
- pMga->drmBuffers->count );
-
- return 1;
-}
-
-static int MGAMemoryInit( struct DRIDriverContextRec *ctx, MGAPtr pMga )
-{
- int width_bytes = ctx->shared.virtualWidth * ctx->cpp;
- int bufferSize = ((ctx->shared.virtualHeight * width_bytes
- + MGA_BUFFER_ALIGN)
- & ~MGA_BUFFER_ALIGN);
- int depthSize = ((((ctx->shared.virtualHeight+15) & ~15) * width_bytes
- + MGA_BUFFER_ALIGN)
- & ~MGA_BUFFER_ALIGN);
- int l;
-
- pMga->frontOffset = 0;
- pMga->frontPitch = ctx->shared.virtualWidth * ctx->cpp;
-
- fprintf(stderr,
- "Using %d MB AGP aperture\n", pMga->agpSize);
- fprintf(stderr,
- "Using %d MB for vertex/indirect buffers\n", pMga->buffers.size>>20);
- fprintf(stderr,
- "Using %d MB for AGP textures\n", pMga->agpTextures.size>>20);
-
- /* Front, back and depth buffers - everything else texture??
- */
- pMga->textureSize = ctx->shared.fbSize - 2 * bufferSize - depthSize;
-
- if (pMga->textureSize < 0)
- return 0;
-
- l = mylog2( pMga->textureSize / MGA_NR_TEX_REGIONS );
- if ( l < MGA_LOG_MIN_TEX_REGION_SIZE )
- l = MGA_LOG_MIN_TEX_REGION_SIZE;
-
- /* Round the texture size up to the nearest whole number of
- * texture regions. Again, be greedy about this, don't
- * round down.
- */
- pMga->logTextureGranularity = l;
- pMga->textureSize = (pMga->textureSize >> l) << l;
-
- /* Set a minimum usable local texture heap size. This will fit
- * two 256x256x32bpp textures.
- */
- if (pMga->textureSize < 512 * 1024) {
- pMga->textureOffset = 0;
- pMga->textureSize = 0;
- }
-
- /* Reserve space for textures */
- pMga->textureOffset = ((ctx->shared.fbSize - pMga->textureSize +
- MGA_BUFFER_ALIGN) &
- ~MGA_BUFFER_ALIGN);
-
- /* Reserve space for the shared depth
- * buffer.
- */
- pMga->depthOffset = ((pMga->textureOffset - depthSize +
- MGA_BUFFER_ALIGN) &
- ~MGA_BUFFER_ALIGN);
- pMga->depthPitch = ctx->shared.virtualWidth * ctx->cpp;
-
- pMga->backOffset = ((pMga->depthOffset - bufferSize +
- MGA_BUFFER_ALIGN) &
- ~MGA_BUFFER_ALIGN);
- pMga->backPitch = ctx->shared.virtualWidth * ctx->cpp;
-
-
- fprintf(stderr,
- "Will use back buffer at offset 0x%x\n",
- pMga->backOffset);
- fprintf(stderr,
- "Will use depth buffer at offset 0x%x\n",
- pMga->depthOffset);
- fprintf(stderr,
- "Will use %d kb for textures at offset 0x%x\n",
- pMga->textureSize/1024, pMga->textureOffset);
-
- return 1;
-}
-
-static int MGACheckDRMVersion( struct DRIDriverContextRec *ctx, MGAPtr pMga )
-{
- drmVersionPtr version;
-
- /* Check the MGA DRM version */
- version = drmGetVersion(ctx->drmFD);
- if ( version ) {
- if ( version->version_major != 3 ||
- version->version_minor < 0 ) {
- /* incompatible drm version */
- fprintf( stderr,
- "[dri] MGADRIScreenInit failed because of a version mismatch.\n"
- "[dri] mga.o kernel module version is %d.%d.%d but version 3.0.x is needed.\n"
- "[dri] Disabling DRI.\n",
- version->version_major,
- version->version_minor,
- version->version_patchlevel );
- drmFreeVersion( version );
- return 0;
- }
- drmFreeVersion( version );
- }
-
- return 1;
-}
-
-static void print_client_msg( MGADRIPtr pMGADRI )
-{
- fprintf( stderr, "chipset: %d\n", pMGADRI->chipset );
-
- fprintf( stderr, "width: %d\n", pMGADRI->width );
- fprintf( stderr, "height: %d\n", pMGADRI->height );
- fprintf( stderr, "mem: %d\n", pMGADRI->mem );
- fprintf( stderr, "cpp: %d\n", pMGADRI->cpp );
-
- fprintf( stderr, "agpMode: %d\n", pMGADRI->agpMode );
-
- fprintf( stderr, "frontOffset: %d\n", pMGADRI->frontOffset );
- fprintf( stderr, "frontPitch: %d\n", pMGADRI->frontPitch );
-
- fprintf( stderr, "backOffset: %d\n", pMGADRI->backOffset );
- fprintf( stderr, "backPitch: %d\n", pMGADRI->backPitch );
-
- fprintf( stderr, "depthOffset: %d\n", pMGADRI->depthOffset );
- fprintf( stderr, "depthPitch: %d\n", pMGADRI->depthPitch );
-
- fprintf( stderr, "textureOffset: %d\n", pMGADRI->textureOffset );
- fprintf( stderr, "textureSize: %d\n", pMGADRI->textureSize );
-
- fprintf( stderr, "logTextureGranularity: %d\n", pMGADRI->logTextureGranularity );
- fprintf( stderr, "logAgpTextureGranularity: %d\n", pMGADRI->logAgpTextureGranularity );
-
- fprintf( stderr, "agpTextureHandle: %u\n", (unsigned int)pMGADRI->agpTextureOffset );
- fprintf( stderr, "agpTextureSize: %u\n", (unsigned int)pMGADRI->agpTextureSize );
-
-#if 0
- pMGADRI->registers.handle = pMga->registers.handle;
- pMGADRI->registers.size = pMga->registers.size;
- pMGADRI->status.handle = pMga->status.handle;
- pMGADRI->status.size = pMga->status.size;
- pMGADRI->primary.handle = pMga->primary.handle;
- pMGADRI->primary.size = pMga->primary.size;
- pMGADRI->buffers.handle = pMga->buffers.handle;
- pMGADRI->buffers.size = pMga->buffers.size;
- pMGADRI->sarea_priv_offset = sizeof(drm_sarea_t);
-#endif
-}
-
-static int MGAScreenInit( struct DRIDriverContextRec *ctx, MGAPtr pMga )
-{
- int i;
- int err;
- MGADRIPtr pMGADRI;
-
- usleep(100);
- /*assert(!ctx->IsClient);*/
-
- {
- int width_bytes = (ctx->shared.virtualWidth * ctx->cpp);
- int maxy = ctx->shared.fbSize / width_bytes;
-
-
- if (maxy <= ctx->shared.virtualHeight * 3) {
- fprintf(stderr,
- "Static buffer allocation failed -- "
- "need at least %d kB video memory (have %d kB)\n",
- (ctx->shared.virtualWidth * ctx->shared.virtualHeight *
- ctx->cpp * 3 + 1023) / 1024,
- ctx->shared.fbSize / 1024);
- return 0;
- }
- }
-
- switch(pMga->Chipset) {
- case PCI_CHIP_MGAG550:
- case PCI_CHIP_MGAG400:
- case PCI_CHIP_MGAG200:
-#if 0
- case PCI_CHIP_MGAG200_PCI:
-#endif
- break;
- default:
- fprintf(stderr, "[drm] Direct rendering only supported with G200/G400/G550 AGP\n");
- return 0;
- }
-
- fprintf( stderr,
- "[drm] bpp: %d depth: %d\n",
- ctx->bpp, ctx->bpp /* FIXME: depth */ );
-
- if ( (ctx->bpp / 8) != 2 &&
- (ctx->bpp / 8) != 4 ) {
- fprintf( stderr,
- "[dri] Direct rendering only supported in 16 and 32 bpp modes\n" );
- return 0;
- }
-
- ctx->shared.SAREASize = SAREA_MAX;
-
-
- /* Note that drmOpen will try to load the kernel module, if needed. */
- ctx->drmFD = drmOpen("mga", NULL );
- if (ctx->drmFD < 0) {
- fprintf(stderr, "[drm] drmOpen failed\n");
- return 0;
- }
-
- if ((err = drmSetBusid(ctx->drmFD, ctx->pciBusID)) < 0) {
- fprintf(stderr, "[drm] drmSetBusid failed (%d, %s), %s\n",
- ctx->drmFD, ctx->pciBusID, strerror(-err));
- return 0;
- }
-
-
- if (drmAddMap( ctx->drmFD,
- 0,
- ctx->shared.SAREASize,
- DRM_SHM,
- DRM_CONTAINS_LOCK,
- &ctx->shared.hSAREA) < 0)
- {
- fprintf(stderr, "[drm] drmAddMap failed\n");
- return 0;
- }
- fprintf(stderr, "[drm] added %d byte SAREA at 0x%08lx\n",
- ctx->shared.SAREASize, ctx->shared.hSAREA);
-
- if (drmMap( ctx->drmFD,
- ctx->shared.hSAREA,
- ctx->shared.SAREASize,
- (drmAddressPtr)(&ctx->pSAREA)) < 0)
- {
- fprintf(stderr, "[drm] drmMap failed\n");
- return 0;
- }
- memset(ctx->pSAREA, 0, ctx->shared.SAREASize);
- fprintf(stderr, "[drm] mapped SAREA 0x%08lx to %p, size %d\n",
- ctx->shared.hSAREA, ctx->pSAREA, ctx->shared.SAREASize);
-
- /* Need to AddMap the framebuffer and mmio regions here:
- */
- if (drmAddMap( ctx->drmFD,
- (drm_handle_t)ctx->FBStart,
- ctx->FBSize,
- DRM_FRAME_BUFFER,
- 0,
- &ctx->shared.hFrameBuffer) < 0)
- {
- fprintf(stderr, "[drm] drmAddMap framebuffer failed\n");
- return 0;
- }
- fprintf(stderr, "[drm] framebuffer handle = 0x%08lx\n",
- ctx->shared.hFrameBuffer);
-
-
-#if 0 /* will be done in MGADRIMapInit */
- if (drmAddMap(ctx->drmFD,
- ctx->FixedInfo.mmio_start,
- ctx->FixedInfo.mmio_len,
- DRM_REGISTERS,
- DRM_READ_ONLY,
- &pMga->registers.handle) < 0) {
- fprintf(stderr, "[drm] drmAddMap mmio failed\n");
- return 0;
- }
- fprintf(stderr,
- "[drm] register handle = 0x%08lx\n", pMga->registers.handle);
-#endif
-
-
- /* Check the mga DRM version */
- if (!MGACheckDRMVersion(ctx, pMga)) {
- return 0;
- }
-
- if ( !MGADRIAgpInit( ctx, pMga ) ) {
- return 0;
- }
-
- if ( !MGADRIMapInit( ctx, pMga ) ) {
- return 0;
- }
-
- /* Memory manager setup */
- if (!MGAMemoryInit(ctx, pMga)) {
- return 0;
- }
-
-
- /* Create a 'server' context so we can grab the lock for
- * initialization ioctls.
- */
- if ((err = drmCreateContext(ctx->drmFD, &ctx->serverContext)) != 0) {
- fprintf(stderr, "%s: drmCreateContext failed %d\n", __FUNCTION__, err);
- return 0;
- }
-
- DRM_LOCK(ctx->drmFD, ctx->pSAREA, ctx->serverContext, 0);
-
- /* Initialize the kernel data structures */
- if (!MGADRIKernelInit(ctx, pMga)) {
- fprintf(stderr, "MGADRIKernelInit failed\n");
- DRM_UNLOCK(ctx->drmFD, ctx->pSAREA, ctx->serverContext);
- return 0;
- }
-
- /* Initialize the vertex buffers list */
- if (!MGADRIBuffersInit(ctx, pMga)) {
- fprintf(stderr, "MGADRIBuffersInit failed\n");
- DRM_UNLOCK(ctx->drmFD, ctx->pSAREA, ctx->serverContext);
- return 0;
- }
-
- /* Initialize IRQ */
- MGADRIIrqInit(ctx, pMga);
-
-
- /* Initialize the SAREA private data structure */
- {
- drm_mga_sarea_t *pSAREAPriv;
- pSAREAPriv = (drm_mga_sarea_t *)(((char*)ctx->pSAREA) +
- sizeof(drm_sarea_t));
- memset(pSAREAPriv, 0, sizeof(*pSAREAPriv));
- }
-
- /* Quick hack to clear the front & back buffers. Could also use
- * the clear ioctl to do this, but would need to setup hw state
- * first.
- */
- drimemsetio((char *)ctx->FBAddress + pMga->frontOffset,
- 0,
- pMga->frontPitch * ctx->shared.virtualHeight );
-
- drimemsetio((char *)ctx->FBAddress + pMga->backOffset,
- 0,
- pMga->backPitch * ctx->shared.virtualHeight );
-
- /* Can release the lock now */
-/* DRM_UNLOCK(ctx->drmFD, ctx->pSAREA, ctx->serverContext);*/
-
- /* This is the struct passed to radeon_dri.so for its initialization */
- ctx->driverClientMsg = malloc(sizeof(MGADRIRec));
- ctx->driverClientMsgSize = sizeof(MGADRIRec);
-
- pMGADRI = (MGADRIPtr)ctx->driverClientMsg;
-
-
- switch(pMga->Chipset) {
- case PCI_CHIP_MGAG550:
- case PCI_CHIP_MGAG400:
- pMGADRI->chipset = MGA_CARD_TYPE_G400;
- break;
- case PCI_CHIP_MGAG200:
- case PCI_CHIP_MGAG200_PCI:
- pMGADRI->chipset = MGA_CARD_TYPE_G200;
- break;
- default:
- return 0;
- }
- pMGADRI->width = ctx->shared.virtualWidth;
- pMGADRI->height = ctx->shared.virtualHeight;
- pMGADRI->mem = ctx->shared.fbSize;
- pMGADRI->cpp = ctx->bpp / 8;
-
- pMGADRI->agpMode = pMga->agpMode;
-
- pMGADRI->frontOffset = pMga->frontOffset;
- pMGADRI->frontPitch = pMga->frontPitch;
- pMGADRI->backOffset = pMga->backOffset;
- pMGADRI->backPitch = pMga->backPitch;
- pMGADRI->depthOffset = pMga->depthOffset;
- pMGADRI->depthPitch = pMga->depthPitch;
- pMGADRI->textureOffset = pMga->textureOffset;
- pMGADRI->textureSize = pMga->textureSize;
- pMGADRI->logTextureGranularity = pMga->logTextureGranularity;
-
- i = mylog2( pMga->agpTextures.size / MGA_NR_TEX_REGIONS );
- if ( i < MGA_LOG_MIN_TEX_REGION_SIZE )
- i = MGA_LOG_MIN_TEX_REGION_SIZE;
-
- pMGADRI->logAgpTextureGranularity = i;
- pMGADRI->agpTextureOffset = (unsigned int)pMga->agpTextures.handle;
- pMGADRI->agpTextureSize = (unsigned int)pMga->agpTextures.size;
-
- pMGADRI->registers.handle = pMga->registers.handle;
- pMGADRI->registers.size = pMga->registers.size;
- pMGADRI->status.handle = pMga->status.handle;
- pMGADRI->status.size = pMga->status.size;
- pMGADRI->primary.handle = pMga->primary.handle;
- pMGADRI->primary.size = pMga->primary.size;
- pMGADRI->buffers.handle = pMga->buffers.handle;
- pMGADRI->buffers.size = pMga->buffers.size;
- pMGADRI->sarea_priv_offset = sizeof(drm_sarea_t);
-
- print_client_msg( pMGADRI );
-
- return 1;
-}
-
-
-/**
- * \brief Validate the fbdev mode.
- *
- * \param ctx display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Saves some registers and returns 1.
- *
- * \sa mgaValidateMode().
- */
-static int mgaValidateMode( const DRIDriverContext *ctx )
-{
- return 1;
-}
-
-
-/**
- * \brief Examine mode returned by fbdev.
- *
- * \param ctx display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Restores registers that fbdev has clobbered and returns 1.
- *
- * \sa mgaValidateMode().
- */
-static int mgaPostValidateMode( const DRIDriverContext *ctx )
-{
- return 1;
-}
-
-
-/**
- * \brief Initialize the framebuffer device mode
- *
- * \param ctx display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Fills in \p info with some default values and some information from \p ctx
- * and then calls MGAScreenInit() for the screen initialization.
- *
- * Before exiting clears the framebuffer memomry accessing it directly.
- */
-static int mgaInitFBDev( struct DRIDriverContextRec *ctx )
-{
- MGAPtr pMga = calloc(1, sizeof(*pMga));
-
- {
- int dummy = ctx->shared.virtualWidth;
-
- switch (ctx->bpp / 8) {
- case 1: dummy = (ctx->shared.virtualWidth + 127) & ~127; break;
- case 2: dummy = (ctx->shared.virtualWidth + 31) & ~31; break;
- case 3:
- case 4: dummy = (ctx->shared.virtualWidth + 15) & ~15; break;
- }
-
- ctx->shared.virtualWidth = dummy;
- }
-
- ctx->driverPrivate = (void *)pMga;
-
- pMga->agpMode = MGA_DEFAULT_AGP_MODE;
- pMga->agpSize = MGA_DEFAULT_AGP_SIZE;
-
- pMga->Chipset = ctx->chipset;
-
- pMga->IOAddress = ctx->MMIOStart;
- pMga->IOBase = ctx->MMIOAddress;
-
- pMga->frontPitch = ctx->shared.virtualWidth * ctx->cpp;
-
- if (!MGAScreenInit( ctx, pMga ))
- return 0;
-
- return 1;
-}
-
-
-/**
- * \brief The screen is being closed, so clean up any state and free any
- * resources used by the DRI.
- *
- * \param ctx display handle.
- *
- * Unmaps the SAREA, closes the DRM device file descriptor and frees the driver
- * private data.
- */
-static void mgaHaltFBDev( struct DRIDriverContextRec *ctx )
-{
- drmUnmap( ctx->pSAREA, ctx->shared.SAREASize );
- drmClose(ctx->drmFD);
-
- if (ctx->driverPrivate) {
- free(ctx->driverPrivate);
- ctx->driverPrivate = NULL;
- }
-}
-
-
-static int mgaEngineShutdown( const DRIDriverContext *ctx )
-{
- fprintf(stderr, "%s() is not yet implemented!\n", __FUNCTION__);
-
- return 1;
-}
-
-static int mgaEngineRestore( const DRIDriverContext *ctx )
-{
- fprintf(stderr, "%s() is not yet implemented!\n", __FUNCTION__);
-
- return 1;
-}
-
-/**
- * \brief Exported driver interface for Mini GLX.
- *
- * \sa DRIDriverRec.
- */
-struct DRIDriverRec __driDriver = {
- mgaValidateMode,
- mgaPostValidateMode,
- mgaInitFBDev,
- mgaHaltFBDev,
- mgaEngineShutdown,
- mgaEngineRestore,
- 0
-};
-
-
-
-
-#if 0
-void MGADRICloseScreen( ScreenPtr pScreen )
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- MGAPtr pMga = MGAPTR(pScrn);
- MGADRIServerPrivatePtr pMga = pMga->DRIServerInfo;
- drmMGAInit init;
-
- if ( pMga->drmBuffers ) {
- drmUnmapBufs( pMga->drmBuffers );
- pMga->drmBuffers = NULL;
- }
-
- if (pMga->irq) {
- drmCtlUninstHandler(ctx->drmFD);
- pMga->irq = 0;
- }
-
- /* Cleanup DMA */
- memset( &init, 0, sizeof(drmMGAInit) );
- init.func = MGA_CLEANUP_DMA;
- drmCommandWrite( ctx->drmFD, DRM_MGA_INIT, &init, sizeof(drmMGAInit) );
-
- if ( pMga->status.map ) {
- drmUnmap( pMga->status.map, pMga->status.size );
- pMga->status.map = NULL;
- }
- if ( pMga->buffers.map ) {
- drmUnmap( pMga->buffers.map, pMga->buffers.size );
- pMga->buffers.map = NULL;
- }
- if ( pMga->primary.map ) {
- drmUnmap( pMga->primary.map, pMga->primary.size );
- pMga->primary.map = NULL;
- }
- if ( pMga->warp.map ) {
- drmUnmap( pMga->warp.map, pMga->warp.size );
- pMga->warp.map = NULL;
- }
-
- if ( pMga->agpTextures.map ) {
- drmUnmap( pMga->agpTextures.map, pMga->agpTextures.size );
- pMga->agpTextures.map = NULL;
- }
-
- if ( pMga->agp.handle ) {
- drmAgpUnbind( ctx->drmFD, pMga->agp.handle );
- drmAgpFree( ctx->drmFD, pMga->agp.handle );
- pMga->agp.handle = 0;
- drmAgpRelease( ctx->drmFD );
- }
-
- DRICloseScreen( pScreen );
-
- if ( pMga->pDRIInfo ) {
- if ( pMga->pDRIpMga->devPrivate ) {
- xfree( pMga->pDRIpMga->devPrivate );
- pMga->pDRIpMga->devPrivate = 0;
- }
- DRIDestroyInfoRec( pMga->pDRIInfo );
- pMga->pDRIInfo = 0;
- }
- if ( pMga->DRIServerInfo ) {
- xfree( pMga->DRIServerInfo );
- pMga->DRIServerInfo = 0;
- }
- if ( pMga->pVisualConfigs ) {
- xfree( pMga->pVisualConfigs );
- }
- if ( pMga->pVisualConfigsPriv ) {
- xfree( pMga->pVisualConfigsPriv );
- }
-}
-#endif
diff --git a/src/mesa/drivers/dri/nouveau/Makefile b/src/mesa/drivers/dri/nouveau/Makefile
index 49e8933561..7be19b26fd 100644
--- a/src/mesa/drivers/dri/nouveau/Makefile
+++ b/src/mesa/drivers/dri/nouveau/Makefile
@@ -8,8 +8,6 @@ DRI_LIB_DEPS += $(shell pkg-config libdrm_nouveau --libs)
LIBNAME = nouveau_vieux_dri.so
-MINIGLX_SOURCES =
-
DRIVER_SOURCES = \
nouveau_screen.c \
nouveau_context.c \
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index 52185a2fb9..42bec659d7 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -43,19 +43,23 @@
#define need_GL_EXT_framebuffer_object
#define need_GL_EXT_fog_coord
+#define need_GL_EXT_secondary_color
#include "main/remap_helper.h"
static const struct dri_extension nouveau_extensions[] = {
{ "GL_ARB_multitexture", NULL },
+ { "GL_ARB_texture_env_add", NULL },
{ "GL_ARB_texture_env_combine", NULL },
{ "GL_ARB_texture_env_dot3", NULL },
- { "GL_ARB_texture_env_add", NULL },
- { "GL_EXT_texture_lod_bias", NULL },
- { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions },
{ "GL_ARB_texture_mirrored_repeat", NULL },
- { "GL_EXT_stencil_wrap", NULL },
{ "GL_EXT_fog_coord", GL_EXT_fog_coord_functions },
+ { "GL_EXT_framebuffer_blit", NULL },
+ { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions },
+ { "GL_EXT_secondary_color", GL_EXT_secondary_color_functions },
+ { "GL_EXT_stencil_wrap", NULL },
+ { "GL_EXT_texture_lod_bias", NULL },
+ { "GL_NV_blend_square", NULL },
{ "GL_SGIS_generate_mipmap", NULL },
{ NULL, NULL }
};
@@ -66,8 +70,8 @@ nouveau_channel_flush_notify(struct nouveau_channel *chan)
struct nouveau_context *nctx = chan->user_private;
GLcontext *ctx = &nctx->base;
- if (nctx->fallback < SWRAST && ctx->DrawBuffer)
- nouveau_state_emit(&nctx->base);
+ if (nctx->fallback < SWRAST)
+ nouveau_bo_state_emit(ctx);
}
GLboolean
@@ -334,6 +338,8 @@ nouveau_validate_framebuffer(GLcontext *ctx)
update_framebuffer(dri_ctx, dri_read,
&dri_ctx->dri2.read_stamp);
- if (nouveau_next_dirty_state(ctx) >= 0)
+ if (nouveau_next_dirty_state(ctx) >= 0) {
+ nouveau_state_emit(ctx);
FIRE_RING(context_chan(ctx));
+ }
}
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.h b/src/mesa/drivers/dri/nouveau/nouveau_context.h
index 682f8a414e..fe64fec930 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.h
@@ -85,6 +85,8 @@ struct nouveau_context {
BITSET_SET(to_nouveau_context(ctx)->dirty, NOUVEAU_STATE_##s)
#define context_dirty_i(ctx, s, i) \
BITSET_SET(to_nouveau_context(ctx)->dirty, NOUVEAU_STATE_##s##0 + i)
+#define context_emit(ctx, s) \
+ context_drv(ctx)->emit[NOUVEAU_STATE_##s](ctx, NOUVEAU_STATE_##s)
GLboolean
nouveau_context_create(const __GLcontextModes *visual, __DRIcontext *dri_ctx,
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.c b/src/mesa/drivers/dri/nouveau/nouveau_driver.c
index 1d12f43741..4ec864c181 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_driver.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_driver.c
@@ -135,4 +135,8 @@ nouveau_driver_functions_init(struct dd_function_table *functions)
functions->Flush = nouveau_flush;
functions->Finish = nouveau_finish;
functions->Clear = nouveau_clear;
+ functions->DrawPixels = _mesa_meta_DrawPixels;
+ functions->CopyPixels = _mesa_meta_CopyPixels;
+ functions->Bitmap = _mesa_meta_Bitmap;
+ functions->BlitFramebuffer = _mesa_meta_BlitFramebuffer;
}
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
index 2ec3dc9242..8be7edb150 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_fbo.c
@@ -236,7 +236,7 @@ nouveau_render_texture(GLcontext *ctx, struct gl_framebuffer *fb,
/* Allocate a renderbuffer object for the texture if we
* haven't already done so. */
if (!rb) {
- rb = nouveau_renderbuffer_new(ctx, 0);
+ rb = nouveau_renderbuffer_new(ctx, ~0);
assert(rb);
rb->AllocStorage = NULL;
@@ -259,11 +259,7 @@ static void
nouveau_finish_render_texture(GLcontext *ctx,
struct gl_renderbuffer_attachment *att)
{
- struct nouveau_renderbuffer *nrb
- = to_nouveau_renderbuffer(att->Renderbuffer);
-
texture_dirty(att->Texture);
- nouveau_surface_ref(NULL, &nrb->surface);
}
void
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_gldefs.h b/src/mesa/drivers/dri/nouveau/nouveau_gldefs.h
index 00007a9a35..fbeed3baea 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_gldefs.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_gldefs.h
@@ -260,4 +260,23 @@ nvgl_filter_mode(unsigned filter)
}
}
+static inline unsigned
+nvgl_texgen_mode(unsigned mode)
+{
+ switch (mode) {
+ case GL_EYE_LINEAR:
+ return 0x2400;
+ case GL_OBJECT_LINEAR:
+ return 0x2401;
+ case GL_SPHERE_MAP:
+ return 0x2402;
+ case GL_NORMAL_MAP:
+ return 0x8511;
+ case GL_REFLECTION_MAP:
+ return 0x8512;
+ default:
+ assert(0);
+ }
+}
+
#endif
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_render.h b/src/mesa/drivers/dri/nouveau/nouveau_render.h
index bff0ccfd76..923b79b2cf 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_render.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_render.h
@@ -32,8 +32,8 @@
struct nouveau_array_state;
typedef void (*dispatch_t)(GLcontext *, unsigned int, int, unsigned int);
-typedef unsigned (*extract_u_t)(struct nouveau_array_state *a, int i, int j);
-typedef float (*extract_f_t)(struct nouveau_array_state *a, int i, int j);
+typedef unsigned (*extract_u_t)(struct nouveau_array_state *, int, int);
+typedef float (*extract_f_t)(struct nouveau_array_state *, int, int);
struct nouveau_attr_info {
int vbo_index;
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_render_t.c b/src/mesa/drivers/dri/nouveau/nouveau_render_t.c
index c0505781cf..7ccd7e6416 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_render_t.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_render_t.c
@@ -254,7 +254,7 @@ get_scratch_vbo(GLcontext *ctx, unsigned size, struct nouveau_bo **bo,
*/
static inline unsigned
get_max_vertices(GLcontext *ctx, const struct _mesa_index_buffer *ib,
- unsigned n)
+ int n)
{
struct nouveau_render_state *render = to_render_state(ctx);
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_span.c b/src/mesa/drivers/dri/nouveau/nouveau_span.c
index f1a56dd03a..1bfdecc6a2 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_span.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_span.c
@@ -32,7 +32,6 @@
#include "swrast/swrast.h"
#define LOCAL_VARS \
- struct gl_framebuffer *fb = ctx->DrawBuffer; \
struct nouveau_surface *s = &to_nouveau_renderbuffer(rb)->surface; \
GLuint p; \
(void)p;
@@ -45,12 +44,12 @@
#define HW_CLIPLOOP() { \
int minx = 0; \
int miny = 0; \
- int maxx = fb->Width; \
- int maxy = fb->Height;
+ int maxx = rb->Width; \
+ int maxy = rb->Height;
#define HW_ENDCLIPLOOP() }
-#define Y_FLIP(y) (fb->Name ? (y) : rb->Height - 1 - (y))
+#define Y_FLIP(y) (rb->Name ? (y) : rb->Height - 1 - (y))
/* RGB565 span functions */
#define SPANTMP_PIXEL_FMT GL_RGB
@@ -144,17 +143,28 @@ texture_unit_map_unmap(GLcontext *ctx, struct gl_texture_unit *u, GLboolean map)
}
static void
-span_map_unmap(GLcontext *ctx, GLboolean map)
+framebuffer_map_unmap(struct gl_framebuffer *fb, GLboolean map)
{
int i;
- for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++)
- renderbuffer_map_unmap(ctx->DrawBuffer->_ColorDrawBuffers[i], map);
+ for (i = 0; i < fb->_NumColorDrawBuffers; i++)
+ renderbuffer_map_unmap(fb->_ColorDrawBuffers[i], map);
+
+ renderbuffer_map_unmap(fb->_ColorReadBuffer, map);
+
+ if (fb->_DepthBuffer)
+ renderbuffer_map_unmap(fb->_DepthBuffer->Wrapped, map);
+}
+
+static void
+span_map_unmap(GLcontext *ctx, GLboolean map)
+{
+ int i;
- renderbuffer_map_unmap(ctx->DrawBuffer->_ColorReadBuffer, map);
+ framebuffer_map_unmap(ctx->DrawBuffer, map);
- if (ctx->DrawBuffer->_DepthBuffer)
- renderbuffer_map_unmap(ctx->DrawBuffer->_DepthBuffer->Wrapped, map);
+ if (ctx->ReadBuffer != ctx->DrawBuffer)
+ framebuffer_map_unmap(ctx->ReadBuffer, map);
for (i = 0; i < ctx->Const.MaxTextureUnits; i++)
texture_unit_map_unmap(ctx, &ctx->Texture.Unit[i], map);
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.c b/src/mesa/drivers/dri/nouveau/nouveau_state.c
index e1871db0eb..a57df2d9dc 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_state.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_state.c
@@ -150,6 +150,7 @@ nouveau_enable(GLcontext *ctx, GLenum cap, GLboolean state)
break;
case GL_COLOR_SUM_EXT:
context_dirty(ctx, FRAG);
+ context_dirty(ctx, LIGHT_MODEL);
break;
case GL_CULL_FACE:
context_dirty(ctx, CULL_FACE);
@@ -188,6 +189,7 @@ nouveau_enable(GLcontext *ctx, GLenum cap, GLboolean state)
case GL_LIGHTING:
context_dirty(ctx, FRAG);
context_dirty(ctx, MODELVIEW);
+ context_dirty(ctx, LIGHT_MODEL);
context_dirty(ctx, LIGHT_ENABLE);
for (i = 0; i < MAX_LIGHTS; i++) {
@@ -230,9 +232,17 @@ nouveau_enable(GLcontext *ctx, GLenum cap, GLboolean state)
case GL_TEXTURE_1D:
case GL_TEXTURE_2D:
case GL_TEXTURE_3D:
+ case GL_TEXTURE_RECTANGLE:
context_dirty_i(ctx, TEX_ENV, ctx->Texture.CurrentUnit);
context_dirty_i(ctx, TEX_OBJ, ctx->Texture.CurrentUnit);
break;
+ case GL_TEXTURE_GEN_S:
+ case GL_TEXTURE_GEN_T:
+ case GL_TEXTURE_GEN_R:
+ case GL_TEXTURE_GEN_Q:
+ context_dirty_i(ctx, TEX_GEN, ctx->Texture.CurrentUnit);
+ context_dirty(ctx, MODELVIEW);
+ break;
}
}
@@ -367,7 +377,15 @@ static void
nouveau_tex_gen(GLcontext *ctx, GLenum coord, GLenum pname,
const GLfloat *params)
{
- context_dirty_i(ctx, TEX_GEN, ctx->Texture.CurrentUnit);
+ switch (pname) {
+ case GL_TEXTURE_GEN_MODE:
+ context_dirty_i(ctx, TEX_GEN, ctx->Texture.CurrentUnit);
+ context_dirty(ctx, MODELVIEW);
+ break;
+ default:
+ context_dirty_i(ctx, TEX_GEN, ctx->Texture.CurrentUnit);
+ break;
+ }
}
static void
@@ -453,12 +471,19 @@ nouveau_state_emit(GLcontext *ctx)
static void
nouveau_update_state(GLcontext *ctx, GLbitfield new_state)
{
+ int i;
+
if (new_state & (_NEW_PROJECTION | _NEW_MODELVIEW))
context_dirty(ctx, PROJECTION);
if (new_state & _NEW_MODELVIEW)
context_dirty(ctx, MODELVIEW);
+ if (new_state & _NEW_TEXTURE_MATRIX) {
+ for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++)
+ context_dirty_i(ctx, TEX_MAT, i);
+ }
+
if (new_state & _NEW_CURRENT_ATTRIB &&
new_state & _NEW_LIGHT) {
context_dirty(ctx, MATERIAL_FRONT_AMBIENT);
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.h b/src/mesa/drivers/dri/nouveau/nouveau_state.h
index d01d962c9f..38ac9753c8 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_state.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_state.h
@@ -89,6 +89,10 @@ enum {
NOUVEAU_STATE_TEX_GEN1,
NOUVEAU_STATE_TEX_GEN2,
NOUVEAU_STATE_TEX_GEN3,
+ NOUVEAU_STATE_TEX_MAT0,
+ NOUVEAU_STATE_TEX_MAT1,
+ NOUVEAU_STATE_TEX_MAT2,
+ NOUVEAU_STATE_TEX_MAT3,
NOUVEAU_STATE_TEX_OBJ0,
NOUVEAU_STATE_TEX_OBJ1,
NOUVEAU_STATE_TEX_OBJ2,
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
index bf365bfca3..dbf9a5cc61 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
@@ -177,15 +177,15 @@ nouveau_choose_tex_format(GLcontext *ctx, GLint internalFormat,
}
static GLboolean
-teximage_fits(struct gl_texture_object *t, int level,
- struct gl_texture_image *ti)
+teximage_fits(struct gl_texture_object *t, int level)
{
struct nouveau_surface *s = &to_nouveau_texture(t)->surfaces[level];
+ struct gl_texture_image *ti = t->Image[0][level];
- return t->Target == GL_TEXTURE_RECTANGLE ||
- (s->bo && s->width == ti->Width &&
- s->height == ti->Height &&
- s->format == ti->TexFormat);
+ return ti && (t->Target == GL_TEXTURE_RECTANGLE ||
+ (s->bo && s->width == ti->Width &&
+ s->height == ti->Height &&
+ s->format == ti->TexFormat));
}
static GLboolean
@@ -195,7 +195,7 @@ validate_teximage(GLcontext *ctx, struct gl_texture_object *t,
{
struct gl_texture_image *ti = t->Image[0][level];
- if (ti && teximage_fits(t, level, ti)) {
+ if (teximage_fits(t, level)) {
struct nouveau_surface *ss = to_nouveau_texture(t)->surfaces;
struct nouveau_surface *s = &to_nouveau_teximage(ti)->surface;
@@ -283,7 +283,8 @@ nouveau_texture_validate(GLcontext *ctx, struct gl_texture_object *t)
struct nouveau_texture *nt = to_nouveau_texture(t);
int i, last = get_last_level(t);
- if (!nt->surfaces[last].bo)
+ if (!teximage_fits(t, t->BaseLevel) ||
+ !teximage_fits(t, last))
return GL_FALSE;
if (nt->dirty) {
@@ -296,6 +297,8 @@ nouveau_texture_validate(GLcontext *ctx, struct gl_texture_object *t)
validate_teximage(ctx, t, i, 0, 0, 0,
s->width, s->height, 1);
}
+
+ FIRE_RING(context_chan(ctx));
}
return GL_TRUE;
@@ -304,9 +307,12 @@ nouveau_texture_validate(GLcontext *ctx, struct gl_texture_object *t)
void
nouveau_texture_reallocate(GLcontext *ctx, struct gl_texture_object *t)
{
- texture_dirty(t);
- relayout_texture(ctx, t);
- nouveau_texture_validate(ctx, t);
+ if (!teximage_fits(t, t->BaseLevel) ||
+ !teximage_fits(t, get_last_level(t))) {
+ texture_dirty(t);
+ relayout_texture(ctx, t);
+ nouveau_texture_validate(ctx, t);
+ }
}
static unsigned
@@ -364,7 +370,7 @@ nouveau_teximage(GLcontext *ctx, GLint dims, GLenum target, GLint level,
}
if (level == t->BaseLevel) {
- if (!teximage_fits(t, level, ti))
+ if (!teximage_fits(t, level))
relayout_texture(ctx, t);
nouveau_texture_validate(ctx, t);
}
@@ -416,6 +422,40 @@ nouveau_teximage_3d(GLcontext *ctx, GLenum target, GLint level,
}
static void
+nouveau_texsubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ GLint width, GLint height, GLint depth,
+ GLenum format, GLenum type, const void *pixels,
+ const struct gl_pixelstore_attrib *packing,
+ struct gl_texture_object *t,
+ struct gl_texture_image *ti)
+{
+ struct nouveau_surface *s = &to_nouveau_teximage(ti)->surface;
+ int ret;
+
+ pixels = _mesa_validate_pbo_teximage(ctx, dims, width, height, depth,
+ format, type, pixels, packing,
+ "glTexSubImage");
+ if (pixels) {
+ nouveau_teximage_map(ctx, ti);
+
+ ret = _mesa_texstore(ctx, 3, ti->_BaseFormat, ti->TexFormat,
+ ti->Data, xoffset, yoffset, zoffset,
+ s->pitch, ti->ImageOffsets,
+ width, height, depth, format, type,
+ pixels, packing);
+ assert(ret);
+
+ nouveau_teximage_unmap(ctx, ti);
+ _mesa_unmap_teximage_pbo(ctx, packing);
+ }
+
+ if (!to_nouveau_texture(t)->dirty)
+ validate_teximage(ctx, t, level, xoffset, yoffset, zoffset,
+ width, height, depth);
+}
+
+static void
nouveau_texsubimage_3d(GLcontext *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLint width, GLint height, GLint depth,
@@ -424,15 +464,9 @@ nouveau_texsubimage_3d(GLcontext *ctx, GLenum target, GLint level,
struct gl_texture_object *t,
struct gl_texture_image *ti)
{
- nouveau_teximage_map(ctx, ti);
- _mesa_store_texsubimage3d(ctx, target, level, xoffset, yoffset, zoffset,
- width, height, depth, format, type, pixels,
- packing, t, ti);
- nouveau_teximage_unmap(ctx, ti);
-
- if (!to_nouveau_texture(t)->dirty)
- validate_teximage(ctx, t, level, xoffset, yoffset, zoffset,
- width, height, depth);
+ nouveau_texsubimage(ctx, 3, target, level, xoffset, yoffset, zoffset,
+ width, height, depth, format, type, pixels,
+ packing, t, ti);
}
static void
@@ -444,15 +478,9 @@ nouveau_texsubimage_2d(GLcontext *ctx, GLenum target, GLint level,
struct gl_texture_object *t,
struct gl_texture_image *ti)
{
- nouveau_teximage_map(ctx, ti);
- _mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset,
- width, height, format, type, pixels,
- packing, t, ti);
- nouveau_teximage_unmap(ctx, ti);
-
- if (!to_nouveau_texture(t)->dirty)
- validate_teximage(ctx, t, level, xoffset, yoffset, 0,
- width, height, 1);
+ nouveau_texsubimage(ctx, 2, target, level, xoffset, yoffset, 0,
+ width, height, 1, format, type, pixels,
+ packing, t, ti);
}
static void
@@ -463,15 +491,9 @@ nouveau_texsubimage_1d(GLcontext *ctx, GLenum target, GLint level,
struct gl_texture_object *t,
struct gl_texture_image *ti)
{
- nouveau_teximage_map(ctx, ti);
- _mesa_store_texsubimage1d(ctx, target, level, xoffset,
- width, format, type, pixels,
- packing, t, ti);
- nouveau_teximage_unmap(ctx, ti);
-
- if (!to_nouveau_texture(t)->dirty)
- validate_teximage(ctx, t, level, xoffset, 0, 0,
- width, 1, 1);
+ nouveau_texsubimage(ctx, 1, target, level, xoffset, 0, 0,
+ width, 1, 1, format, type, pixels,
+ packing, t, ti);
}
static void
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.h b/src/mesa/drivers/dri/nouveau/nouveau_texture.h
index b91facbdeb..251f537bba 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.h
@@ -41,7 +41,7 @@ struct nouveau_texture {
#define to_nouveau_texture(x) ((struct nouveau_texture *)(x))
#define texture_dirty(t) \
- to_nouveau_texture(t)->dirty = GL_TRUE;
+ to_nouveau_texture(t)->dirty = GL_TRUE
void
nouveau_set_texbuffer(__DRIcontext *dri_ctx,
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_util.h b/src/mesa/drivers/dri/nouveau/nouveau_util.h
index d6007aba2b..584cb80ef6 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_util.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_util.h
@@ -191,4 +191,22 @@ is_texture_source(int s)
return s == GL_TEXTURE || (s >= GL_TEXTURE0 && s <= GL_TEXTURE31);
}
+static inline struct gl_texgen *
+get_texgen_coord(struct gl_texture_unit *u, int i)
+{
+ return ((struct gl_texgen *[])
+ { &u->GenS, &u->GenT, &u->GenR, &u->GenQ }) [i];
+}
+
+static inline float *
+get_texgen_coeff(struct gl_texgen *c)
+{
+ if (c->Mode == GL_OBJECT_LINEAR)
+ return c->ObjectPlane;
+ else if (c->Mode == GL_EYE_LINEAR)
+ return c->EyePlane;
+ else
+ return NULL;
+}
+
#endif
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
index 69a9b96f0c..e5858f8268 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
@@ -85,6 +85,18 @@ vbo_deinit_array(struct nouveau_array_state *a)
a->fields = 0;
}
+static int
+get_array_stride(GLcontext *ctx, const struct gl_client_array *a)
+{
+ struct nouveau_render_state *render = to_render_state(ctx);
+
+ if (render->mode == VBO && !_mesa_is_bufferobj(a->BufferObj))
+ /* Pack client buffers. */
+ return align(_mesa_sizeof_type(a->Type) * a->Size, 4);
+ else
+ return a->StrideB;
+}
+
static void
vbo_init_arrays(GLcontext *ctx, const struct _mesa_index_buffer *ib,
const struct gl_client_array **arrays)
@@ -101,18 +113,10 @@ vbo_init_arrays(GLcontext *ctx, const struct _mesa_index_buffer *ib,
if (attr >= 0) {
const struct gl_client_array *array = arrays[attr];
- int stride;
-
- if (render->mode == VBO &&
- !_mesa_is_bufferobj(array->BufferObj))
- /* Pack client buffers. */
- stride = align(_mesa_sizeof_type(array->Type)
- * array->Size, 4);
- else
- stride = array->StrideB;
vbo_init_array(&render->attrs[attr], attr,
- stride, array->Size, array->Type,
+ get_array_stride(ctx, array),
+ array->Size, array->Type,
array->BufferObj, array->Ptr,
render->mode == IMM);
}
@@ -224,9 +228,11 @@ vbo_choose_attrs(GLcontext *ctx, const struct gl_client_array **arrays)
if (ctx->Fog.Enabled && ctx->Fog.FogCoordinateSource == GL_FOG_COORD)
vbo_emit_attr(ctx, arrays, VERT_ATTRIB_FOG);
- if (ctx->Light.Enabled) {
+ if (ctx->Light.Enabled ||
+ (ctx->Texture._GenFlags & TEXGEN_NEED_NORMALS))
vbo_emit_attr(ctx, arrays, VERT_ATTRIB_NORMAL);
+ if (ctx->Light.Enabled) {
vbo_emit_attr(ctx, arrays, MAT(FRONT_AMBIENT));
vbo_emit_attr(ctx, arrays, MAT(FRONT_DIFFUSE));
vbo_emit_attr(ctx, arrays, MAT(FRONT_SPECULAR));
@@ -243,18 +249,21 @@ vbo_choose_attrs(GLcontext *ctx, const struct gl_client_array **arrays)
vbo_emit_attr(ctx, arrays, VERT_ATTRIB_POS);
}
-static unsigned
-get_max_client_stride(GLcontext *ctx)
+static int
+get_max_client_stride(GLcontext *ctx, const struct gl_client_array **arrays)
{
struct nouveau_render_state *render = to_render_state(ctx);
int i, s = 0;
for (i = 0; i < render->attr_count; i++) {
int attr = render->map[i];
- struct nouveau_array_state *a = &render->attrs[attr];
- if (attr >= 0 && !a->bo)
- s = MAX2(a->stride, s);
+ if (attr >= 0) {
+ const struct gl_client_array *a = arrays[attr];
+
+ if (!_mesa_is_bufferobj(a->BufferObj))
+ s = MAX2(s, get_array_stride(ctx, a));
+ }
}
return s;
@@ -275,20 +284,20 @@ vbo_maybe_split(GLcontext *ctx, const struct gl_client_array **arrays,
{
struct nouveau_context *nctx = to_nouveau_context(ctx);
struct nouveau_render_state *render = to_render_state(ctx);
- unsigned pushbuf_avail = PUSHBUF_DWORDS - 2 * nctx->bo.count,
+ unsigned pushbuf_avail = PUSHBUF_DWORDS - 2 * (nctx->bo.count +
+ render->attr_count),
vert_avail = get_max_vertices(ctx, NULL, pushbuf_avail),
idx_avail = get_max_vertices(ctx, ib, pushbuf_avail);
int stride;
/* Try to keep client buffers smaller than the scratch BOs. */
- if (!ib && render->mode == VBO &&
- (stride = get_max_client_stride(ctx)))
+ if (render->mode == VBO &&
+ (stride = get_max_client_stride(ctx, arrays)))
vert_avail = MIN2(vert_avail,
RENDER_SCRATCH_SIZE / stride);
-
- if ((ib && ib->count > idx_avail) ||
- (!ib && max_index - min_index > vert_avail)) {
+ if (max_index - min_index > vert_avail ||
+ (ib && ib->count > idx_avail)) {
struct split_limits limits = {
.max_verts = vert_avail,
.max_indices = idx_avail,
@@ -322,6 +331,7 @@ vbo_bind_vertices(GLcontext *ctx, const struct gl_client_array **arrays,
* array->StrideB;
if (a->bo) {
+ /* Array in a buffer obj. */
a->offset = (intptr_t)array->Ptr + delta;
} else {
int j, n = max_index - min_index + 1;
@@ -329,6 +339,8 @@ vbo_bind_vertices(GLcontext *ctx, const struct gl_client_array **arrays,
char *dp = get_scratch_vbo(ctx, n * a->stride,
&a->bo, &a->offset);
+ /* Array in client memory, move it to
+ * a scratch buffer obj. */
for (j = 0; j < n; j++)
memcpy(dp + j * a->stride,
sp + j * array->StrideB,
@@ -372,8 +384,6 @@ vbo_draw_vbo(GLcontext *ctx, const struct gl_client_array **arrays,
dispatch(ctx, start, delta, count);
BATCH_END();
}
-
- FIRE_RING(chan);
}
/* Immediate rendering path. */
@@ -417,8 +427,6 @@ vbo_draw_imm(GLcontext *ctx, const struct gl_client_array **arrays,
BATCH_END();
}
-
- FIRE_RING(chan);
}
/* draw_prims entry point when we're doing hw-tnl. */
diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.c b/src/mesa/drivers/dri/nouveau/nv04_context.c
index a442425e44..6834f7cd3d 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_context.c
@@ -75,18 +75,16 @@ nv04_channel_flush_notify(struct nouveau_channel *chan)
struct nouveau_context *nctx = chan->user_private;
GLcontext *ctx = &nctx->base;
- if (nctx->fallback < SWRAST && ctx->DrawBuffer) {
- GLcontext *ctx = &nctx->base;
-
+ if (nctx->fallback < SWRAST) {
/* Flushing seems to clobber the engine context. */
- context_dirty_i(ctx, TEX_OBJ, 0);
- context_dirty_i(ctx, TEX_OBJ, 1);
- context_dirty_i(ctx, TEX_ENV, 0);
- context_dirty_i(ctx, TEX_ENV, 1);
- context_dirty(ctx, CONTROL);
- context_dirty(ctx, BLEND);
-
- nouveau_state_emit(ctx);
+ context_emit(ctx, TEX_OBJ0);
+ context_emit(ctx, TEX_OBJ1);
+ context_emit(ctx, TEX_ENV0);
+ context_emit(ctx, TEX_ENV1);
+ context_emit(ctx, CONTROL);
+ context_emit(ctx, BLEND);
+
+ nouveau_bo_state_emit(ctx);
}
}
@@ -200,9 +198,9 @@ nv04_context_create(struct nouveau_screen *screen, const GLvisual *visual,
if (ret)
goto fail;
+ init_dummy_texture(ctx);
nv04_hwctx_init(ctx);
nv04_render_init(ctx);
- init_dummy_texture(ctx);
return ctx;
@@ -278,6 +276,10 @@ const struct nouveau_driver nv04_driver = {
nouveau_emit_nothing,
nouveau_emit_nothing,
nouveau_emit_nothing,
+ nouveau_emit_nothing,
+ nouveau_emit_nothing,
+ nouveau_emit_nothing,
+ nouveau_emit_nothing,
nv04_emit_tex_obj,
nv04_emit_tex_obj,
nouveau_emit_nothing,
diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_fb.c b/src/mesa/drivers/dri/nouveau/nv04_state_fb.c
index aad1e491d2..5e5e0c5874 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state_fb.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state_fb.c
@@ -63,7 +63,7 @@ nv04_emit_framebuffer(GLcontext *ctx, int emit)
return;
/* Render target */
- if (fb->_NumColorDrawBuffers) {
+ if (fb->_ColorDrawBuffers[0]) {
s = &to_nouveau_renderbuffer(
fb->_ColorDrawBuffers[0])->surface;
diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_raster.c b/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
index 4314fc33cf..c191571a5f 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state_raster.c
@@ -275,6 +275,10 @@ nv04_emit_blend(GLcontext *ctx, int emit)
else
blend |= NV04_MULTITEX_TRIANGLE_BLEND_SHADE_MODE_FLAT;
+ /* Secondary color */
+ if (NEED_SECONDARY_COLOR(ctx))
+ blend |= NV04_MULTITEX_TRIANGLE_BLEND_SPECULAR_ENABLE;
+
/* Fog. */
if (ctx->Fog.Enabled)
blend |= NV04_MULTITEX_TRIANGLE_BLEND_FOG_ENABLE;
@@ -309,6 +313,10 @@ nv04_emit_blend(GLcontext *ctx, int emit)
else
blend |= get_texenv_mode(GL_MODULATE);
+ /* Secondary color */
+ if (NEED_SECONDARY_COLOR(ctx))
+ blend |= NV04_TEXTURED_TRIANGLE_BLEND_SPECULAR_ENABLE;
+
/* Fog. */
if (ctx->Fog.Enabled)
blend |= NV04_TEXTURED_TRIANGLE_BLEND_FOG_ENABLE;
diff --git a/src/mesa/drivers/dri/nouveau/nv10_context.c b/src/mesa/drivers/dri/nouveau/nv10_context.c
index 860d0aeb8f..b6d10361de 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_context.c
@@ -212,7 +212,7 @@ nv10_hwctx_init(GLcontext *ctx)
OUT_RING(chan, 0);
BEGIN_RING(chan, celsius, NV10TCL_CULL_FACE_ENABLE, 1);
OUT_RING(chan, 0);
- BEGIN_RING(chan, celsius, NV10TCL_TX_GEN_S(0), 8);
+ BEGIN_RING(chan, celsius, NV10TCL_TX_GEN_MODE_S(0), 8);
for (i = 0; i < 8; i++)
OUT_RING(chan, 0);
@@ -412,6 +412,10 @@ const struct nouveau_driver nv10_driver = {
nv10_emit_tex_gen,
nouveau_emit_nothing,
nouveau_emit_nothing,
+ nv10_emit_tex_mat,
+ nv10_emit_tex_mat,
+ nouveau_emit_nothing,
+ nouveau_emit_nothing,
nv10_emit_tex_obj,
nv10_emit_tex_obj,
nouveau_emit_nothing,
diff --git a/src/mesa/drivers/dri/nouveau/nv10_driver.h b/src/mesa/drivers/dri/nouveau/nv10_driver.h
index d662712533..cefd6c6fba 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_driver.h
+++ b/src/mesa/drivers/dri/nouveau/nv10_driver.h
@@ -134,6 +134,9 @@ void
nv10_emit_tex_gen(GLcontext *ctx, int emit);
void
+nv10_emit_tex_mat(GLcontext *ctx, int emit);
+
+void
nv10_emit_tex_obj(GLcontext *ctx, int emit);
/* nv10_state_tnl.c */
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_fb.c b/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
index 05c36b4f8f..a2fcb6b695 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
@@ -71,6 +71,7 @@ setup_lma_buffer(GLcontext *ctx)
nouveau_bo_markl(bctx, celsius, NV17TCL_LMA_DEPTH_BUFFER_OFFSET,
nfb->lma_bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR);
+ WAIT_RING(chan, 9);
BEGIN_RING(chan, celsius, NV17TCL_LMA_DEPTH_WINDOW_X, 4);
OUT_RINGf(chan, - 1792);
OUT_RINGf(chan, - 2304 + fb->Height);
@@ -111,7 +112,7 @@ nv10_emit_framebuffer(GLcontext *ctx, int emit)
}
/* Render target */
- if (fb->_NumColorDrawBuffers) {
+ if (fb->_ColorDrawBuffers[0]) {
s = &to_nouveau_renderbuffer(
fb->_ColorDrawBuffers[0])->surface;
@@ -171,15 +172,13 @@ nv10_emit_viewport(GLcontext *ctx, int emit)
struct nouveau_grobj *celsius = context_eng3d(ctx);
struct gl_framebuffer *fb = ctx->DrawBuffer;
float a[4] = {};
- int i;
get_viewport_translate(ctx, a);
a[0] -= 2048;
a[1] -= 2048;
BEGIN_RING(chan, celsius, NV10TCL_VIEWPORT_TRANSLATE_X, 4);
- for (i = 0; i < 4; i++)
- OUT_RINGf(chan, a[i]);
+ OUT_RINGp(chan, a, 4);
BEGIN_RING(chan, celsius, NV10TCL_VIEWPORT_CLIP_HORIZ(0), 1);
OUT_RING(chan, (fb->Width - 1) << 16 | 0x08000800);
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
index 02a5ca797a..6dedb18c72 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
@@ -32,9 +32,64 @@
#include "nouveau_util.h"
#include "nv10_driver.h"
+#define TX_GEN_MODE(i, j) (NV10TCL_TX_GEN_MODE_S(i) + 4 * (j))
+#define TX_GEN_COEFF(i, j) (NV10TCL_TX_GEN_COEFF_S_A(i) + 16 * (j))
+#define TX_MATRIX(i) (NV10TCL_TX0_MATRIX(0) + 64 * (i))
+
void
nv10_emit_tex_gen(GLcontext *ctx, int emit)
{
+ const int i = emit - NOUVEAU_STATE_TEX_GEN0;
+ struct nouveau_context *nctx = to_nouveau_context(ctx);
+ struct nouveau_channel *chan = context_chan(ctx);
+ struct nouveau_grobj *celsius = context_eng3d(ctx);
+ struct gl_texture_unit *unit = &ctx->Texture.Unit[i];
+ int j;
+
+ for (j = 0; j < 4; j++) {
+ if (nctx->fallback == HWTNL && (unit->TexGenEnabled & 1 << j)) {
+ struct gl_texgen *coord = get_texgen_coord(unit, j);
+ float *k = get_texgen_coeff(coord);
+
+ if (k) {
+ BEGIN_RING(chan, celsius,
+ TX_GEN_COEFF(i, j), 4);
+ OUT_RINGp(chan, k, 4);
+ }
+
+ BEGIN_RING(chan, celsius, TX_GEN_MODE(i, j), 1);
+ OUT_RING(chan, nvgl_texgen_mode(coord->Mode));
+
+ } else {
+ BEGIN_RING(chan, celsius, TX_GEN_MODE(i, j), 1);
+ OUT_RING(chan, 0);
+ }
+ }
+
+ context_dirty_i(ctx, TEX_MAT, i);
+}
+
+void
+nv10_emit_tex_mat(GLcontext *ctx, int emit)
+{
+ const int i = emit - NOUVEAU_STATE_TEX_MAT0;
+ struct nouveau_context *nctx = to_nouveau_context(ctx);
+ struct nouveau_channel *chan = context_chan(ctx);
+ struct nouveau_grobj *celsius = context_eng3d(ctx);
+
+ if (nctx->fallback == HWTNL &&
+ ((ctx->Texture._TexMatEnabled & 1 << i) ||
+ ctx->Texture.Unit[i]._GenFlags)) {
+ BEGIN_RING(chan, celsius, NV10TCL_TX_MATRIX_ENABLE(i), 1);
+ OUT_RING(chan, 1);
+
+ BEGIN_RING(chan, celsius, TX_MATRIX(i), 16);
+ OUT_RINGm(chan, ctx->TextureMatrixStack[i].Top->m);
+
+ } else {
+ BEGIN_RING(chan, celsius, NV10TCL_TX_MATRIX_ENABLE(i), 1);
+ OUT_RING(chan, 0);
+ }
}
static uint32_t
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_tnl.c b/src/mesa/drivers/dri/nouveau/nv10_state_tnl.c
index 6db14d83b8..0e592a1629 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_tnl.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_tnl.c
@@ -140,9 +140,7 @@ nv10_emit_fog(GLcontext *ctx, int emit)
OUT_RING(chan, pack_rgba_f(MESA_FORMAT_RGBA8888_REV, f->Color));
BEGIN_RING(chan, celsius, NV10TCL_FOG_EQUATION_CONSTANT, 3);
- OUT_RINGf(chan, k[0]);
- OUT_RINGf(chan, k[1]);
- OUT_RINGf(chan, k[2]);
+ OUT_RINGp(chan, k, 3);
context_dirty(ctx, FRAG);
}
@@ -201,8 +199,10 @@ nv10_emit_light_model(GLcontext *ctx, int emit)
BEGIN_RING(chan, celsius, NV10TCL_LIGHT_MODEL, 1);
OUT_RING(chan, ((m->LocalViewer ?
NV10TCL_LIGHT_MODEL_LOCAL_VIEWER : 0) |
- (m->ColorControl == GL_SEPARATE_SPECULAR_COLOR ?
- NV10TCL_LIGHT_MODEL_SEPARATE_SPECULAR : 0)));
+ (NEED_SECONDARY_COLOR(ctx) ?
+ NV10TCL_LIGHT_MODEL_SEPARATE_SPECULAR : 0) |
+ (!ctx->Light.Enabled && ctx->Fog.ColorSumEnabled ?
+ NV10TCL_LIGHT_MODEL_VERTEX_SPECULAR : 0)));
}
static float
@@ -282,9 +282,7 @@ nv10_emit_light_source(GLcontext *ctx, int emit)
if (l->_Flags & LIGHT_POSITIONAL) {
BEGIN_RING(chan, celsius, NV10TCL_LIGHT_POSITION_X(i), 3);
- OUT_RINGf(chan, l->_Position[0]);
- OUT_RINGf(chan, l->_Position[1]);
- OUT_RINGf(chan, l->_Position[2]);
+ OUT_RINGp(chan, l->_Position, 3);
BEGIN_RING(chan, celsius,
NV10TCL_LIGHT_ATTENUATION_CONSTANT(i), 3);
@@ -294,14 +292,10 @@ nv10_emit_light_source(GLcontext *ctx, int emit)
} else {
BEGIN_RING(chan, celsius, NV10TCL_LIGHT_DIRECTION_X(i), 3);
- OUT_RINGf(chan, l->_VP_inf_norm[0]);
- OUT_RINGf(chan, l->_VP_inf_norm[1]);
- OUT_RINGf(chan, l->_VP_inf_norm[2]);
+ OUT_RINGp(chan, l->_VP_inf_norm, 3);
BEGIN_RING(chan, celsius, NV10TCL_LIGHT_HALF_VECTOR_X(i), 3);
- OUT_RINGf(chan, l->_h_inf_norm[0]);
- OUT_RINGf(chan, l->_h_inf_norm[1]);
- OUT_RINGf(chan, l->_h_inf_norm[2]);
+ OUT_RINGp(chan, l->_h_inf_norm, 3);
}
if (l->_Flags & LIGHT_SPOT) {
@@ -310,13 +304,7 @@ nv10_emit_light_source(GLcontext *ctx, int emit)
nv10_get_spot_coeff(l, k);
BEGIN_RING(chan, celsius, NV10TCL_LIGHT_SPOT_CUTOFF_A(i), 7);
- OUT_RINGf(chan, k[0]);
- OUT_RINGf(chan, k[1]);
- OUT_RINGf(chan, k[2]);
- OUT_RINGf(chan, k[3]);
- OUT_RINGf(chan, k[4]);
- OUT_RINGf(chan, k[5]);
- OUT_RINGf(chan, k[6]);
+ OUT_RINGp(chan, k, 7);
}
}
@@ -348,15 +336,11 @@ nv10_emit_material_ambient(GLcontext *ctx, int emit)
}
BEGIN_RING(chan, celsius, NV10TCL_LIGHT_MODEL_AMBIENT_R, 3);
- OUT_RINGf(chan, c_scene[0]);
- OUT_RINGf(chan, c_scene[1]);
- OUT_RINGf(chan, c_scene[2]);
+ OUT_RINGp(chan, c_scene, 3);
if (ctx->Light.ColorMaterialEnabled) {
BEGIN_RING(chan, celsius, NV10TCL_MATERIAL_FACTOR_R, 3);
- OUT_RINGf(chan, c_factor[0]);
- OUT_RINGf(chan, c_factor[1]);
- OUT_RINGf(chan, c_factor[2]);
+ OUT_RINGp(chan, c_factor, 3);
}
foreach(l, &ctx->Light.EnabledList) {
@@ -366,9 +350,7 @@ nv10_emit_material_ambient(GLcontext *ctx, int emit)
l->_MatAmbient[0]);
BEGIN_RING(chan, celsius, NV10TCL_LIGHT_AMBIENT_R(i), 3);
- OUT_RINGf(chan, c_light[0]);
- OUT_RINGf(chan, c_light[1]);
- OUT_RINGf(chan, c_light[2]);
+ OUT_RINGp(chan, c_light, 3);
}
}
@@ -390,9 +372,7 @@ nv10_emit_material_diffuse(GLcontext *ctx, int emit)
l->_MatDiffuse[0]);
BEGIN_RING(chan, celsius, NV10TCL_LIGHT_DIFFUSE_R(i), 3);
- OUT_RINGf(chan, c_light[0]);
- OUT_RINGf(chan, c_light[1]);
- OUT_RINGf(chan, c_light[2]);
+ OUT_RINGp(chan, c_light, 3);
}
}
@@ -410,9 +390,7 @@ nv10_emit_material_specular(GLcontext *ctx, int emit)
l->_MatSpecular[0]);
BEGIN_RING(chan, celsius, NV10TCL_LIGHT_SPECULAR_R(i), 3);
- OUT_RINGf(chan, c_light[0]);
- OUT_RINGf(chan, c_light[1]);
- OUT_RINGf(chan, c_light[2]);
+ OUT_RINGp(chan, c_light, 3);
}
}
@@ -453,12 +431,7 @@ nv10_emit_material_shininess(GLcontext *ctx, int emit)
k);
BEGIN_RING(chan, celsius, NV10TCL_MATERIAL_SHININESS(0), 6);
- OUT_RINGf(chan, k[0]);
- OUT_RINGf(chan, k[1]);
- OUT_RINGf(chan, k[2]);
- OUT_RINGf(chan, k[3]);
- OUT_RINGf(chan, k[4]);
- OUT_RINGf(chan, k[5]);
+ OUT_RINGp(chan, k, 6);
}
void
@@ -472,12 +445,14 @@ nv10_emit_modelview(GLcontext *ctx, int emit)
if (nctx->fallback != HWTNL)
return;
- if (ctx->Light._NeedEyeCoords || ctx->Fog.Enabled) {
+ if (ctx->Light._NeedEyeCoords || ctx->Fog.Enabled ||
+ (ctx->Texture._GenFlags & TEXGEN_NEED_EYE_COORD)) {
BEGIN_RING(chan, celsius, NV10TCL_MODELVIEW0_MATRIX(0), 16);
OUT_RINGm(chan, m->m);
}
- if (ctx->Light.Enabled) {
+ if (ctx->Light.Enabled ||
+ (ctx->Texture._GenFlags & TEXGEN_NEED_EYE_COORD)) {
int i, j;
BEGIN_RING(chan, celsius,
diff --git a/src/mesa/drivers/dri/nouveau/nv20_context.c b/src/mesa/drivers/dri/nouveau/nv20_context.c
index db39ef7075..789dcaa6b4 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_context.c
@@ -297,9 +297,9 @@ nv20_hwctx_init(GLcontext *ctx)
BEGIN_RING(chan, kelvin, NV20TCL_POLYGON_STIPPLE_ENABLE, 1);
OUT_RING (chan, 0);
- BEGIN_RING(chan, kelvin, NV20TCL_TX_GEN_S(0),
- 4 * NV20TCL_TX_GEN_S__SIZE);
- for (i=0; i < 4 * NV20TCL_TX_GEN_S__SIZE; i++)
+ BEGIN_RING(chan, kelvin, NV20TCL_TX_GEN_MODE_S(0),
+ 4 * NV20TCL_TX_GEN_MODE_S__SIZE);
+ for (i=0; i < 4 * NV20TCL_TX_GEN_MODE_S__SIZE; i++)
OUT_RING(chan, 0);
BEGIN_RING(chan, kelvin, NV20TCL_FOG_EQUATION_CONSTANT, 3);
@@ -497,10 +497,14 @@ const struct nouveau_driver nv20_driver = {
nv20_emit_tex_env,
nv20_emit_tex_env,
nv20_emit_tex_env,
- nv10_emit_tex_gen,
- nv10_emit_tex_gen,
- nv10_emit_tex_gen,
- nv10_emit_tex_gen,
+ nv20_emit_tex_gen,
+ nv20_emit_tex_gen,
+ nv20_emit_tex_gen,
+ nv20_emit_tex_gen,
+ nv20_emit_tex_mat,
+ nv20_emit_tex_mat,
+ nv20_emit_tex_mat,
+ nv20_emit_tex_mat,
nv20_emit_tex_obj,
nv20_emit_tex_obj,
nv20_emit_tex_obj,
diff --git a/src/mesa/drivers/dri/nouveau/nv20_driver.h b/src/mesa/drivers/dri/nouveau/nv20_driver.h
index 18574e9be6..8adecef2c4 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_driver.h
+++ b/src/mesa/drivers/dri/nouveau/nv20_driver.h
@@ -68,6 +68,12 @@ nv20_emit_frag(GLcontext *ctx, int emit);
/* nv20_state_tex.c */
void
+nv20_emit_tex_gen(GLcontext *ctx, int emit);
+
+void
+nv20_emit_tex_mat(GLcontext *ctx, int emit);
+
+void
nv20_emit_tex_obj(GLcontext *ctx, int emit);
void
diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_fb.c b/src/mesa/drivers/dri/nouveau/nv20_state_fb.c
index 869acd6e31..21da4f7af1 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_state_fb.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_state_fb.c
@@ -67,7 +67,7 @@ nv20_emit_framebuffer(GLcontext *ctx, int emit)
return;
/* Render target */
- if (fb->_NumColorDrawBuffers) {
+ if (fb->_ColorDrawBuffers[0]) {
s = &to_nouveau_renderbuffer(
fb->_ColorDrawBuffers[0])->surface;
@@ -106,13 +106,11 @@ nv20_emit_viewport(GLcontext *ctx, int emit)
struct nouveau_grobj *kelvin = context_eng3d(ctx);
struct gl_framebuffer *fb = ctx->DrawBuffer;
float a[4] = {};
- int i;
get_viewport_translate(ctx, a);
BEGIN_RING(chan, kelvin, NV20TCL_VIEWPORT_TRANSLATE_X, 4);
- for (i = 0; i < 4; i++)
- OUT_RINGf(chan, a[i]);
+ OUT_RINGp(chan, a, 4);
BEGIN_RING(chan, kelvin, NV20TCL_VIEWPORT_CLIP_HORIZ(0), 1);
OUT_RING(chan, (fb->Width - 1) << 16);
diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_tex.c b/src/mesa/drivers/dri/nouveau/nv20_state_tex.c
index 92870105f9..e46118e4fc 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_state_tex.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_state_tex.c
@@ -32,6 +32,62 @@
#include "nouveau_util.h"
#include "nv20_driver.h"
+#define TX_GEN_MODE(i, j) (NV20TCL_TX_GEN_MODE_S(i) + 4 * (j))
+#define TX_GEN_COEFF(i, j) (NV20TCL_TX_GEN_COEFF_S_A(i) + 16 * (j))
+#define TX_MATRIX(i) (NV20TCL_TX0_MATRIX(0) + 64 * (i))
+
+void
+nv20_emit_tex_gen(GLcontext *ctx, int emit)
+{
+ const int i = emit - NOUVEAU_STATE_TEX_GEN0;
+ struct nouveau_context *nctx = to_nouveau_context(ctx);
+ struct nouveau_channel *chan = context_chan(ctx);
+ struct nouveau_grobj *kelvin = context_eng3d(ctx);
+ struct gl_texture_unit *unit = &ctx->Texture.Unit[i];
+ int j;
+
+ for (j = 0; j < 4; j++) {
+ if (nctx->fallback == HWTNL && (unit->TexGenEnabled & 1 << j)) {
+ struct gl_texgen *coord = get_texgen_coord(unit, j);
+ float *k = get_texgen_coeff(coord);
+
+ if (k) {
+ BEGIN_RING(chan, kelvin, TX_GEN_COEFF(i, j), 4);
+ OUT_RINGp(chan, k, 4);
+ }
+
+ BEGIN_RING(chan, kelvin, TX_GEN_MODE(i, j), 1);
+ OUT_RING(chan, nvgl_texgen_mode(coord->Mode));
+
+ } else {
+ BEGIN_RING(chan, kelvin, TX_GEN_MODE(i, j), 1);
+ OUT_RING(chan, 0);
+ }
+ }
+}
+
+void
+nv20_emit_tex_mat(GLcontext *ctx, int emit)
+{
+ const int i = emit - NOUVEAU_STATE_TEX_MAT0;
+ struct nouveau_context *nctx = to_nouveau_context(ctx);
+ struct nouveau_channel *chan = context_chan(ctx);
+ struct nouveau_grobj *kelvin = context_eng3d(ctx);
+
+ if (nctx->fallback == HWTNL &&
+ (ctx->Texture._TexMatEnabled & 1 << i)) {
+ BEGIN_RING(chan, kelvin, NV20TCL_TX_MATRIX_ENABLE(i), 1);
+ OUT_RING(chan, 1);
+
+ BEGIN_RING(chan, kelvin, TX_MATRIX(i), 16);
+ OUT_RINGm(chan, ctx->TextureMatrixStack[i].Top->m);
+
+ } else {
+ BEGIN_RING(chan, kelvin, NV20TCL_TX_MATRIX_ENABLE(i), 1);
+ OUT_RING(chan, 0);
+ }
+}
+
static uint32_t
get_tex_format_pot(struct gl_texture_image *ti)
{
diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c b/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c
index 0d566064f6..62efe80fe4 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c
@@ -139,9 +139,7 @@ nv20_emit_fog(GLcontext *ctx, int emit)
OUT_RING(chan, pack_rgba_f(MESA_FORMAT_RGBA8888_REV, f->Color));
BEGIN_RING(chan, kelvin, NV20TCL_FOG_EQUATION_CONSTANT, 3);
- OUT_RINGf(chan, k[0]);
- OUT_RINGf(chan, k[1]);
- OUT_RINGf(chan, k[2]);
+ OUT_RINGp(chan, k, 3);
}
void
@@ -158,7 +156,7 @@ nv20_emit_light_model(GLcontext *ctx, int emit)
OUT_RING(chan, ((m->LocalViewer ?
NV20TCL_LIGHT_MODEL_VIEWER_LOCAL :
NV20TCL_LIGHT_MODEL_VIEWER_NONLOCAL) |
- (m->ColorControl == GL_SEPARATE_SPECULAR_COLOR ?
+ (NEED_SECONDARY_COLOR(ctx) ?
NV20TCL_LIGHT_MODEL_SEPARATE_SPECULAR :
0)));
@@ -176,9 +174,7 @@ nv20_emit_light_source(GLcontext *ctx, int emit)
if (l->_Flags & LIGHT_POSITIONAL) {
BEGIN_RING(chan, kelvin, NV20TCL_LIGHT_POSITION_X(i), 3);
- OUT_RINGf(chan, l->_Position[0]);
- OUT_RINGf(chan, l->_Position[1]);
- OUT_RINGf(chan, l->_Position[2]);
+ OUT_RINGp(chan, l->_Position, 3);
BEGIN_RING(chan, kelvin, NV20TCL_LIGHT_ATTENUATION_CONSTANT(i), 3);
OUT_RINGf(chan, l->ConstantAttenuation);
@@ -187,14 +183,10 @@ nv20_emit_light_source(GLcontext *ctx, int emit)
} else {
BEGIN_RING(chan, kelvin, NV20TCL_LIGHT_DIRECTION_X(i), 3);
- OUT_RINGf(chan, l->_VP_inf_norm[0]);
- OUT_RINGf(chan, l->_VP_inf_norm[1]);
- OUT_RINGf(chan, l->_VP_inf_norm[2]);
+ OUT_RINGp(chan, l->_VP_inf_norm, 3);
BEGIN_RING(chan, kelvin, NV20TCL_LIGHT_HALF_VECTOR_X(i), 3);
- OUT_RINGf(chan, l->_h_inf_norm[0]);
- OUT_RINGf(chan, l->_h_inf_norm[1]);
- OUT_RINGf(chan, l->_h_inf_norm[2]);
+ OUT_RINGp(chan, l->_h_inf_norm, 3);
}
if (l->_Flags & LIGHT_SPOT) {
@@ -203,13 +195,7 @@ nv20_emit_light_source(GLcontext *ctx, int emit)
nv10_get_spot_coeff(l, k);
BEGIN_RING(chan, kelvin, NV20TCL_LIGHT_SPOT_CUTOFF_A(i), 7);
- OUT_RINGf(chan, k[0]);
- OUT_RINGf(chan, k[1]);
- OUT_RINGf(chan, k[2]);
- OUT_RINGf(chan, k[3]);
- OUT_RINGf(chan, k[4]);
- OUT_RINGf(chan, k[5]);
- OUT_RINGf(chan, k[6]);
+ OUT_RINGp(chan, k, 7);
}
}
@@ -246,15 +232,11 @@ nv20_emit_material_ambient(GLcontext *ctx, int emit)
}
BEGIN_RING(chan, kelvin, m_scene[side], 3);
- OUT_RINGf(chan, c_scene[0]);
- OUT_RINGf(chan, c_scene[1]);
- OUT_RINGf(chan, c_scene[2]);
+ OUT_RINGp(chan, c_scene, 3);
if (ctx->Light.ColorMaterialEnabled) {
BEGIN_RING(chan, kelvin, m_factor[side], 3);
- OUT_RINGf(chan, c_factor[0]);
- OUT_RINGf(chan, c_factor[1]);
- OUT_RINGf(chan, c_factor[2]);
+ OUT_RINGp(chan, c_factor, 3);
}
foreach(l, &ctx->Light.EnabledList) {
@@ -266,9 +248,7 @@ nv20_emit_material_ambient(GLcontext *ctx, int emit)
l->_MatAmbient[side]);
BEGIN_RING(chan, kelvin, m_light[side], 3);
- OUT_RINGf(chan, c_light[0]);
- OUT_RINGf(chan, c_light[1]);
- OUT_RINGf(chan, c_light[2]);
+ OUT_RINGp(chan, c_light, 3);
}
}
@@ -295,9 +275,7 @@ nv20_emit_material_diffuse(GLcontext *ctx, int emit)
l->_MatDiffuse[side]);
BEGIN_RING(chan, kelvin, m_light[side], 3);
- OUT_RINGf(chan, c_light[0]);
- OUT_RINGf(chan, c_light[1]);
- OUT_RINGf(chan, c_light[2]);
+ OUT_RINGp(chan, c_light, 3);
}
}
@@ -318,9 +296,7 @@ nv20_emit_material_specular(GLcontext *ctx, int emit)
l->_MatSpecular[side]);
BEGIN_RING(chan, kelvin, m_light[side], 3);
- OUT_RINGf(chan, c_light[0]);
- OUT_RINGf(chan, c_light[1]);
- OUT_RINGf(chan, c_light[2]);
+ OUT_RINGp(chan, c_light, 3);
}
}
@@ -340,12 +316,7 @@ nv20_emit_material_shininess(GLcontext *ctx, int emit)
k);
BEGIN_RING(chan, kelvin, mthd[side], 6);
- OUT_RINGf(chan, k[0]);
- OUT_RINGf(chan, k[1]);
- OUT_RINGf(chan, k[2]);
- OUT_RINGf(chan, k[3]);
- OUT_RINGf(chan, k[4]);
- OUT_RINGf(chan, k[5]);
+ OUT_RINGp(chan, k, 6);
}
void
@@ -359,12 +330,14 @@ nv20_emit_modelview(GLcontext *ctx, int emit)
if (nctx->fallback != HWTNL)
return;
- if (ctx->Light._NeedEyeCoords || ctx->Fog.Enabled) {
+ if (ctx->Light._NeedEyeCoords || ctx->Fog.Enabled ||
+ (ctx->Texture._GenFlags & TEXGEN_NEED_EYE_COORD)) {
BEGIN_RING(chan, kelvin, NV20TCL_MODELVIEW0_MATRIX(0), 16);
OUT_RINGm(chan, m->m);
}
- if (ctx->Light.Enabled) {
+ if (ctx->Light.Enabled ||
+ (ctx->Texture._GenFlags & TEXGEN_NEED_EYE_COORD)) {
int i, j;
BEGIN_RING(chan, kelvin,
diff --git a/src/mesa/drivers/dri/r128/Makefile b/src/mesa/drivers/dri/r128/Makefile
index 52c5a38a70..8144c9b43f 100644
--- a/src/mesa/drivers/dri/r128/Makefile
+++ b/src/mesa/drivers/dri/r128/Makefile
@@ -5,8 +5,6 @@ include $(TOP)/configs/current
LIBNAME = r128_dri.so
-MINIGLX_SOURCES = server/r128_dri.c
-
DRIVER_SOURCES = \
r128_context.c \
r128_lock.c \
diff --git a/src/mesa/drivers/dri/r128/server/r128_dri.c b/src/mesa/drivers/dri/r128/server/r128_dri.c
deleted file mode 100644
index 6e3db948af..0000000000
--- a/src/mesa/drivers/dri/r128/server/r128_dri.c
+++ /dev/null
@@ -1,1112 +0,0 @@
-/*
- * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
- * Precision Insight, Inc., Cedar Park, Texas, and
- * VA Linux Systems Inc., Fremont, California.
- *
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation on the rights to use, copy, modify, merge,
- * publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so,
- * subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, PRECISION INSIGHT, VA LINUX
- * SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*
- * Authors:
- * Kevin E. Martin <martin@valinux.com>
- * Rickard E. Faith <faith@valinux.com>
- * Daryll Strauss <daryll@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-// Fix this to use kernel pci_ids.h when all of these IDs make it into the kernel
-#include "pci_ids.h"
-
-#include "driver.h"
-#include "drm.h"
-#include "memops.h"
-
-#include "r128.h"
-#include "r128_dri.h"
-#include "r128_macros.h"
-#include "r128_reg.h"
-#include "r128_version.h"
-#include "r128_drm.h"
-
-static size_t r128_drm_page_size;
-
-/* Compute log base 2 of val. */
-static int R128MinBits(int val)
-{
- int bits;
-
- if (!val) return 1;
- for (bits = 0; val; val >>= 1, ++bits);
- return bits;
-}
-
-/* Initialize the AGP state. Request memory for use in AGP space, and
- initialize the Rage 128 registers to point to that memory. */
-static GLboolean R128DRIAgpInit(const DRIDriverContext *ctx)
-{
- unsigned char *R128MMIO = ctx->MMIOAddress;
- R128InfoPtr info = ctx->driverPrivate;
- unsigned long mode;
- unsigned int vendor, device;
- int ret;
- unsigned long cntl, chunk;
- int s, l;
- int flags;
- unsigned long agpBase;
-
- if (drmAgpAcquire(ctx->drmFD) < 0) {
- fprintf(stderr, "[agp] AGP not available\n");
- return GL_FALSE;
- }
-
- /* Modify the mode if the default mode is
- not appropriate for this particular
- combination of graphics card and AGP
- chipset. */
-
- mode = drmAgpGetMode(ctx->drmFD); /* Default mode */
- vendor = drmAgpVendorId(ctx->drmFD);
- device = drmAgpDeviceId(ctx->drmFD);
-
- mode &= ~R128_AGP_MODE_MASK;
- switch (info->agpMode) {
- case 4: mode |= R128_AGP_4X_MODE;
- case 2: mode |= R128_AGP_2X_MODE;
- case 1: default: mode |= R128_AGP_1X_MODE;
- }
-
- fprintf(stderr,
- "[agp] Mode 0x%08lx [AGP 0x%04x/0x%04x; Card 0x%04x/0x%04x]\n",
- mode, vendor, device,
- 0x1002,
- info->Chipset);
-
- if (drmAgpEnable(ctx->drmFD, mode) < 0) {
- fprintf(stderr, "[agp] AGP not enabled\n");
- drmAgpRelease(ctx->drmFD);
- return GL_FALSE;
- }
-
- info->agpOffset = 0;
-
- if ((ret = drmAgpAlloc(ctx->drmFD, info->agpSize*1024*1024, 0, NULL,
- &info->agpMemHandle)) < 0) {
- fprintf(stderr, "[agp] Out of memory (%d)\n", ret);
- drmAgpRelease(ctx->drmFD);
- return GL_FALSE;
- }
- fprintf(stderr,
- "[agp] %d kB allocated with handle 0x%08x\n",
- info->agpSize*1024, info->agpMemHandle);
-
- if (drmAgpBind(ctx->drmFD, info->agpMemHandle, info->agpOffset) < 0) {
- fprintf(stderr, "[agp] Could not bind\n");
- drmAgpFree(ctx->drmFD, info->agpMemHandle);
- drmAgpRelease(ctx->drmFD);
- return GL_FALSE;
- }
-
- /* Initialize the CCE ring buffer data */
- info->ringStart = info->agpOffset;
- info->ringMapSize = info->ringSize*1024*1024 + r128_drm_page_size;
- info->ringSizeLog2QW = R128MinBits(info->ringSize*1024*1024/8) - 1;
-
- info->ringReadOffset = info->ringStart + info->ringMapSize;
- info->ringReadMapSize = r128_drm_page_size;
-
- /* Reserve space for vertex/indirect buffers */
- info->bufStart = info->ringReadOffset + info->ringReadMapSize;
- info->bufMapSize = info->bufSize*1024*1024;
-
- /* Reserve the rest for AGP textures */
- info->agpTexStart = info->bufStart + info->bufMapSize;
- s = (info->agpSize*1024*1024 - info->agpTexStart);
- l = R128MinBits((s-1) / R128_NR_TEX_REGIONS);
- if (l < R128_LOG_TEX_GRANULARITY) l = R128_LOG_TEX_GRANULARITY;
- info->agpTexMapSize = (s >> l) << l;
- info->log2AGPTexGran = l;
-
- if (info->CCESecure) flags = DRM_READ_ONLY;
- else flags = 0;
-
- if (drmAddMap(ctx->drmFD, info->ringStart, info->ringMapSize,
- DRM_AGP, flags, &info->ringHandle) < 0) {
- fprintf(stderr,
- "[agp] Could not add ring mapping\n");
- return GL_FALSE;
- }
- fprintf(stderr,
- "[agp] ring handle = 0x%08x\n", info->ringHandle);
-
- if (drmMap(ctx->drmFD, info->ringHandle, info->ringMapSize,
- (drmAddressPtr)&info->ring) < 0) {
- fprintf(stderr, "[agp] Could not map ring\n");
- return GL_FALSE;
- }
- fprintf(stderr,
- "[agp] Ring mapped at 0x%08lx\n",
- (unsigned long)info->ring);
-
- if (drmAddMap(ctx->drmFD, info->ringReadOffset, info->ringReadMapSize,
- DRM_AGP, flags, &info->ringReadPtrHandle) < 0) {
- fprintf(stderr,
- "[agp] Could not add ring read ptr mapping\n");
- return GL_FALSE;
- }
- fprintf(stderr,
- "[agp] ring read ptr handle = 0x%08x\n",
- info->ringReadPtrHandle);
-
- if (drmMap(ctx->drmFD, info->ringReadPtrHandle, info->ringReadMapSize,
- (drmAddressPtr)&info->ringReadPtr) < 0) {
- fprintf(stderr,
- "[agp] Could not map ring read ptr\n");
- return GL_FALSE;
- }
- fprintf(stderr,
- "[agp] Ring read ptr mapped at 0x%08lx\n",
- (unsigned long)info->ringReadPtr);
-
- if (drmAddMap(ctx->drmFD, info->bufStart, info->bufMapSize,
- DRM_AGP, 0, &info->bufHandle) < 0) {
- fprintf(stderr,
- "[agp] Could not add vertex/indirect buffers mapping\n");
- return GL_FALSE;
- }
- fprintf(stderr,
- "[agp] vertex/indirect buffers handle = 0x%08lx\n",
- info->bufHandle);
-
- if (drmMap(ctx->drmFD, info->bufHandle, info->bufMapSize,
- (drmAddressPtr)&info->buf) < 0) {
- fprintf(stderr,
- "[agp] Could not map vertex/indirect buffers\n");
- return GL_FALSE;
- }
- fprintf(stderr,
- "[agp] Vertex/indirect buffers mapped at 0x%08lx\n",
- (unsigned long)info->buf);
-
- if (drmAddMap(ctx->drmFD, info->agpTexStart, info->agpTexMapSize,
- DRM_AGP, 0, &info->agpTexHandle) < 0) {
- fprintf(stderr,
- "[agp] Could not add AGP texture map mapping\n");
- return GL_FALSE;
- }
- fprintf(stderr,
- "[agp] AGP texture map handle = 0x%08lx\n",
- info->agpTexHandle);
-
- if (drmMap(ctx->drmFD, info->agpTexHandle, info->agpTexMapSize,
- (drmAddressPtr)&info->agpTex) < 0) {
- fprintf(stderr,
- "[agp] Could not map AGP texture map\n");
- return GL_FALSE;
- }
- fprintf(stderr,
- "[agp] AGP Texture map mapped at 0x%08lx\n",
- (unsigned long)info->agpTex);
-
- /* Initialize Rage 128's AGP registers */
- cntl = INREG(R128_AGP_CNTL);
- cntl &= ~R128_AGP_APER_SIZE_MASK;
- switch (info->agpSize) {
- case 256: cntl |= R128_AGP_APER_SIZE_256MB; break;
- case 128: cntl |= R128_AGP_APER_SIZE_128MB; break;
- case 64: cntl |= R128_AGP_APER_SIZE_64MB; break;
- case 32: cntl |= R128_AGP_APER_SIZE_32MB; break;
- case 16: cntl |= R128_AGP_APER_SIZE_16MB; break;
- case 8: cntl |= R128_AGP_APER_SIZE_8MB; break;
- case 4: cntl |= R128_AGP_APER_SIZE_4MB; break;
- default:
- fprintf(stderr,
- "[agp] Illegal aperture size %d kB\n",
- info->agpSize*1024);
- return GL_FALSE;
- }
- agpBase = drmAgpBase(ctx->drmFD);
- OUTREG(R128_AGP_BASE, agpBase);
- OUTREG(R128_AGP_CNTL, cntl);
-
- /* Disable Rage 128's PCIGART registers */
- chunk = INREG(R128_BM_CHUNK_0_VAL);
- chunk &= ~(R128_BM_PTR_FORCE_TO_PCI |
- R128_BM_PM4_RD_FORCE_TO_PCI |
- R128_BM_GLOBAL_FORCE_TO_PCI);
- OUTREG(R128_BM_CHUNK_0_VAL, chunk);
-
- OUTREG(R128_PCI_GART_PAGE, 1); /* Ensure AGP GART is used (for now) */
-
- return GL_TRUE;
-}
-
-static GLboolean R128DRIPciInit(const DRIDriverContext *ctx)
-{
- R128InfoPtr info = ctx->driverPrivate;
- unsigned char *R128MMIO = ctx->MMIOAddress;
- uint32_t chunk;
- int ret;
- int flags;
-
- info->agpOffset = 0;
-
- ret = drmScatterGatherAlloc(ctx->drmFD, info->agpSize*1024*1024,
- &info->pciMemHandle);
- if (ret < 0) {
- fprintf(stderr, "[pci] Out of memory (%d)\n", ret);
- return GL_FALSE;
- }
- fprintf(stderr,
- "[pci] %d kB allocated with handle 0x%08x\n",
- info->agpSize*1024, info->pciMemHandle);
-
- /* Initialize the CCE ring buffer data */
- info->ringStart = info->agpOffset;
- info->ringMapSize = info->ringSize*1024*1024 + r128_drm_page_size;
- info->ringSizeLog2QW = R128MinBits(info->ringSize*1024*1024/8) - 1;
-
- info->ringReadOffset = info->ringStart + info->ringMapSize;
- info->ringReadMapSize = r128_drm_page_size;
-
- /* Reserve space for vertex/indirect buffers */
- info->bufStart = info->ringReadOffset + info->ringReadMapSize;
- info->bufMapSize = info->bufSize*1024*1024;
-
- flags = DRM_READ_ONLY | DRM_LOCKED | DRM_KERNEL;
-
- if (drmAddMap(ctx->drmFD, info->ringStart, info->ringMapSize,
- DRM_SCATTER_GATHER, flags, &info->ringHandle) < 0) {
- fprintf(stderr,
- "[pci] Could not add ring mapping\n");
- return GL_FALSE;
- }
- fprintf(stderr,
- "[pci] ring handle = 0x%08lx\n", info->ringHandle);
-
- if (drmMap(ctx->drmFD, info->ringHandle, info->ringMapSize,
- (drmAddressPtr)&info->ring) < 0) {
- fprintf(stderr, "[pci] Could not map ring\n");
- return GL_FALSE;
- }
- fprintf(stderr,
- "[pci] Ring mapped at 0x%08lx\n",
- (unsigned long)info->ring);
- fprintf(stderr,
- "[pci] Ring contents 0x%08lx\n",
- *(unsigned long *)info->ring);
-
- if (drmAddMap(ctx->drmFD, info->ringReadOffset, info->ringReadMapSize,
- DRM_SCATTER_GATHER, flags, &info->ringReadPtrHandle) < 0) {
- fprintf(stderr,
- "[pci] Could not add ring read ptr mapping\n");
- return GL_FALSE;
- }
- fprintf(stderr,
- "[pci] ring read ptr handle = 0x%08lx\n",
- info->ringReadPtrHandle);
-
- if (drmMap(ctx->drmFD, info->ringReadPtrHandle, info->ringReadMapSize,
- (drmAddressPtr)&info->ringReadPtr) < 0) {
- fprintf(stderr,
- "[pci] Could not map ring read ptr\n");
- return GL_FALSE;
- }
- fprintf(stderr,
- "[pci] Ring read ptr mapped at 0x%08lx\n",
- (unsigned long)info->ringReadPtr);
- fprintf(stderr,
- "[pci] Ring read ptr contents 0x%08lx\n",
- *(unsigned long *)info->ringReadPtr);
-
- if (drmAddMap(ctx->drmFD, info->bufStart, info->bufMapSize,
- DRM_SCATTER_GATHER, 0, &info->bufHandle) < 0) {
- fprintf(stderr,
- "[pci] Could not add vertex/indirect buffers mapping\n");
- return GL_FALSE;
- }
- fprintf(stderr,
- "[pci] vertex/indirect buffers handle = 0x%08lx\n",
- info->bufHandle);
-
- if (drmMap(ctx->drmFD, info->bufHandle, info->bufMapSize,
- (drmAddressPtr)&info->buf) < 0) {
- fprintf(stderr,
- "[pci] Could not map vertex/indirect buffers\n");
- return GL_FALSE;
- }
- fprintf(stderr,
- "[pci] Vertex/indirect buffers mapped at 0x%08lx\n",
- (unsigned long)info->buf);
- fprintf(stderr,
- "[pci] Vertex/indirect buffers contents 0x%08lx\n",
- *(unsigned long *)info->buf);
-
- if (!info->IsPCI) {
- /* This is really an AGP card, force PCI GART mode */
- chunk = INREG(R128_BM_CHUNK_0_VAL);
- chunk |= (R128_BM_PTR_FORCE_TO_PCI |
- R128_BM_PM4_RD_FORCE_TO_PCI |
- R128_BM_GLOBAL_FORCE_TO_PCI);
- OUTREG(R128_BM_CHUNK_0_VAL, chunk);
- OUTREG(R128_PCI_GART_PAGE, 0); /* Ensure PCI GART is used */
- }
-
- return GL_TRUE;
-}
-
-/* Add a map for the MMIO registers that will be accessed by any
- DRI-based clients. */
-static GLboolean R128DRIMapInit(const DRIDriverContext *ctx)
-{
- R128InfoPtr info = ctx->driverPrivate;
- int flags;
-
- if (info->CCESecure) flags = DRM_READ_ONLY;
- else flags = 0;
-
- /* Map registers */
- if (drmAddMap(ctx->drmFD, ctx->MMIOStart, ctx->MMIOSize,
- DRM_REGISTERS, flags, &info->registerHandle) < 0) {
- return GL_FALSE;
- }
- fprintf(stderr,
- "[drm] register handle = 0x%08x\n", info->registerHandle);
-
- return GL_TRUE;
-}
-
-/* Initialize the kernel data structures. */
-static int R128DRIKernelInit(const DRIDriverContext *ctx)
-{
- R128InfoPtr info = ctx->driverPrivate;
- drm_r128_init_t drmInfo;
-
- memset( &drmInfo, 0, sizeof(&drmInfo) );
-
- drmInfo.func = R128_INIT_CCE;
- drmInfo.sarea_priv_offset = sizeof(drm_sarea_t);
- drmInfo.is_pci = info->IsPCI;
- drmInfo.cce_mode = info->CCEMode;
- drmInfo.cce_secure = info->CCESecure;
- drmInfo.ring_size = info->ringSize*1024*1024;
- drmInfo.usec_timeout = info->CCEusecTimeout;
-
- drmInfo.fb_bpp = ctx->bpp;
- drmInfo.depth_bpp = ctx->bpp;
-
- drmInfo.front_offset = info->frontOffset;
- drmInfo.front_pitch = info->frontPitch;
-
- drmInfo.back_offset = info->backOffset;
- drmInfo.back_pitch = info->backPitch;
-
- drmInfo.depth_offset = info->depthOffset;
- drmInfo.depth_pitch = info->depthPitch;
- drmInfo.span_offset = info->spanOffset;
-
- drmInfo.fb_offset = info->LinearAddr;
- drmInfo.mmio_offset = info->registerHandle;
- drmInfo.ring_offset = info->ringHandle;
- drmInfo.ring_rptr_offset = info->ringReadPtrHandle;
- drmInfo.buffers_offset = info->bufHandle;
- drmInfo.agp_textures_offset = info->agpTexHandle;
-
- if (drmCommandWrite(ctx->drmFD, DRM_R128_INIT,
- &drmInfo, sizeof(drmInfo)) < 0)
- return GL_FALSE;
-
- return GL_TRUE;
-}
-
-/* Add a map for the vertex buffers that will be accessed by any
- DRI-based clients. */
-static GLboolean R128DRIBufInit(const DRIDriverContext *ctx)
-{
- R128InfoPtr info = ctx->driverPrivate;
- /* Initialize vertex buffers */
- if (info->IsPCI) {
- info->bufNumBufs = drmAddBufs(ctx->drmFD,
- info->bufMapSize / R128_BUFFER_SIZE,
- R128_BUFFER_SIZE,
- DRM_SG_BUFFER,
- info->bufStart);
- } else {
- info->bufNumBufs = drmAddBufs(ctx->drmFD,
- info->bufMapSize / R128_BUFFER_SIZE,
- R128_BUFFER_SIZE,
- DRM_AGP_BUFFER,
- info->bufStart);
- }
- if (info->bufNumBufs <= 0) {
- fprintf(stderr,
- "[drm] Could not create vertex/indirect buffers list\n");
- return GL_FALSE;
- }
- fprintf(stderr,
- "[drm] Added %d %d byte vertex/indirect buffers\n",
- info->bufNumBufs, R128_BUFFER_SIZE);
-
- if (!(info->buffers = drmMapBufs(ctx->drmFD))) {
- fprintf(stderr,
- "[drm] Failed to map vertex/indirect buffers list\n");
- return GL_FALSE;
- }
- fprintf(stderr,
- "[drm] Mapped %d vertex/indirect buffers\n",
- info->buffers->count);
-
- return GL_TRUE;
-}
-
-static void R128DRIIrqInit(const DRIDriverContext *ctx)
-{
- R128InfoPtr info = ctx->driverPrivate;
- unsigned char *R128MMIO = ctx->MMIOAddress;
-
- if (!info->irq) {
- info->irq = drmGetInterruptFromBusID(
- ctx->drmFD,
- ctx->pciBus,
- ctx->pciDevice,
- ctx->pciFunc);
-
- if((drmCtlInstHandler(ctx->drmFD, info->irq)) != 0) {
- fprintf(stderr,
- "[drm] failure adding irq handler, "
- "there is a device already using that irq\n"
- "[drm] falling back to irq-free operation\n");
- info->irq = 0;
- } else {
- info->gen_int_cntl = INREG( R128_GEN_INT_CNTL );
- }
- }
-
- if (info->irq)
- fprintf(stderr,
- "[drm] dma control initialized, using IRQ %d\n",
- info->irq);
-}
-
-static int R128CCEStop(const DRIDriverContext *ctx)
-{
- R128InfoPtr info = ctx->driverPrivate;
- drm_r128_cce_stop_t stop;
- int ret, i;
-
- stop.flush = 1;
- stop.idle = 1;
-
- ret = drmCommandWrite( ctx->drmFD, DRM_R128_CCE_STOP,
- &stop, sizeof(stop) );
-
- if ( ret == 0 ) {
- return 0;
- } else if ( errno != EBUSY ) {
- return -errno;
- }
-
- stop.flush = 0;
-
- i = 0;
- do {
- ret = drmCommandWrite( ctx->drmFD, DRM_R128_CCE_STOP,
- &stop, sizeof(stop) );
- } while ( ret && errno == EBUSY && i++ < R128_IDLE_RETRY );
-
- if ( ret == 0 ) {
- return 0;
- } else if ( errno != EBUSY ) {
- return -errno;
- }
-
- stop.idle = 0;
-
- if ( drmCommandWrite( ctx->drmFD, DRM_R128_CCE_STOP,
- &stop, sizeof(stop) )) {
- return -errno;
- } else {
- return 0;
- }
-}
-
-/* Initialize the CCE state, and start the CCE (if used by the X server) */
-static void R128DRICCEInit(const DRIDriverContext *ctx)
-{
- R128InfoPtr info = ctx->driverPrivate;
-
- /* Turn on bus mastering */
- info->BusCntl &= ~R128_BUS_MASTER_DIS;
-
- /* CCEMode is initialized in r128_driver.c */
- switch (info->CCEMode) {
- case R128_PM4_NONPM4: info->CCEFifoSize = 0; break;
- case R128_PM4_192PIO: info->CCEFifoSize = 192; break;
- case R128_PM4_192BM: info->CCEFifoSize = 192; break;
- case R128_PM4_128PIO_64INDBM: info->CCEFifoSize = 128; break;
- case R128_PM4_128BM_64INDBM: info->CCEFifoSize = 128; break;
- case R128_PM4_64PIO_128INDBM: info->CCEFifoSize = 64; break;
- case R128_PM4_64BM_128INDBM: info->CCEFifoSize = 64; break;
- case R128_PM4_64PIO_64VCBM_64INDBM: info->CCEFifoSize = 64; break;
- case R128_PM4_64BM_64VCBM_64INDBM: info->CCEFifoSize = 64; break;
- case R128_PM4_64PIO_64VCPIO_64INDPIO: info->CCEFifoSize = 64; break;
- }
-
- /* Make sure the CCE is on for the X server */
- R128CCE_START(ctx, info);
-}
-
-
-static int R128MemoryInit(const DRIDriverContext *ctx)
-{
- R128InfoPtr info = ctx->driverPrivate;
- int width_bytes = ctx->shared.virtualWidth * ctx->cpp;
- int cpp = ctx->cpp;
- int bufferSize = ((ctx->shared.virtualHeight * width_bytes
- + R128_BUFFER_ALIGN)
- & ~R128_BUFFER_ALIGN);
- int depthSize = ((((ctx->shared.virtualHeight+15) & ~15) * width_bytes
- + R128_BUFFER_ALIGN)
- & ~R128_BUFFER_ALIGN);
- int l;
-
- info->frontOffset = 0;
- info->frontPitch = ctx->shared.virtualWidth;
-
- fprintf(stderr,
- "Using %d MB AGP aperture\n", info->agpSize);
- fprintf(stderr,
- "Using %d MB for the ring buffer\n", info->ringSize);
- fprintf(stderr,
- "Using %d MB for vertex/indirect buffers\n", info->bufSize);
- fprintf(stderr,
- "Using %d MB for AGP textures\n", info->agpTexSize);
-
- /* Front, back and depth buffers - everything else texture??
- */
- info->textureSize = ctx->shared.fbSize - 2 * bufferSize - depthSize;
-
- if (info->textureSize < 0)
- return 0;
-
- l = R128MinBits((info->textureSize-1) / R128_NR_TEX_REGIONS);
- if (l < R128_LOG_TEX_GRANULARITY) l = R128_LOG_TEX_GRANULARITY;
-
- /* Round the texture size up to the nearest whole number of
- * texture regions. Again, be greedy about this, don't
- * round down.
- */
- info->log2TexGran = l;
- info->textureSize = (info->textureSize >> l) << l;
-
- /* Set a minimum usable local texture heap size. This will fit
- * two 256x256x32bpp textures.
- */
- if (info->textureSize < 512 * 1024) {
- info->textureOffset = 0;
- info->textureSize = 0;
- }
-
- /* Reserve space for textures */
- info->textureOffset = ((ctx->shared.fbSize - info->textureSize +
- R128_BUFFER_ALIGN) &
- ~R128_BUFFER_ALIGN);
-
- /* Reserve space for the shared depth
- * buffer.
- */
- info->depthOffset = ((info->textureOffset - depthSize +
- R128_BUFFER_ALIGN) &
- ~R128_BUFFER_ALIGN);
- info->depthPitch = ctx->shared.virtualWidth;
-
- info->backOffset = ((info->depthOffset - bufferSize +
- R128_BUFFER_ALIGN) &
- ~R128_BUFFER_ALIGN);
- info->backPitch = ctx->shared.virtualWidth;
-
-
- fprintf(stderr,
- "Will use back buffer at offset 0x%x\n",
- info->backOffset);
- fprintf(stderr,
- "Will use depth buffer at offset 0x%x\n",
- info->depthOffset);
- fprintf(stderr,
- "Will use %d kb for textures at offset 0x%x\n",
- info->textureSize/1024, info->textureOffset);
-
- return 1;
-}
-
-
-/* Initialize the screen-specific data structures for the DRI and the
- Rage 128. This is the main entry point to the device-specific
- initialization code. It calls device-independent DRI functions to
- create the DRI data structures and initialize the DRI state. */
-static GLboolean R128DRIScreenInit(DRIDriverContext *ctx)
-{
- R128InfoPtr info = ctx->driverPrivate;
- R128DRIPtr pR128DRI;
- int err, major, minor, patch;
- drmVersionPtr version;
- drm_r128_sarea_t *pSAREAPriv;
-
- switch (ctx->bpp) {
- case 8:
- /* These modes are not supported (yet). */
- case 15:
- case 24:
- fprintf(stderr,
- "[dri] R128DRIScreenInit failed (depth %d not supported). "
- "[dri] Disabling DRI.\n", ctx->bpp);
- return GL_FALSE;
-
- /* Only 16 and 32 color depths are supports currently. */
- case 16:
- case 32:
- break;
- }
- r128_drm_page_size = getpagesize();
-
- info->registerSize = ctx->MMIOSize;
- ctx->shared.SAREASize = SAREA_MAX;
-
- /* Note that drmOpen will try to load the kernel module, if needed. */
- ctx->drmFD = drmOpen("r128", NULL );
- if (ctx->drmFD < 0) {
- fprintf(stderr, "[drm] drmOpen failed\n");
- return 0;
- }
-
- /* Check the r128 DRM version */
- version = drmGetVersion(ctx->drmFD);
- if (version) {
- if (version->version_major != 2 ||
- version->version_minor < 2) {
- /* incompatible drm version */
- fprintf(stderr,
- "[dri] R128DRIScreenInit failed because of a version mismatch.\n"
- "[dri] r128.o kernel module version is %d.%d.%d but version 2.2 or greater is needed.\n"
- "[dri] Disabling the DRI.\n",
- version->version_major,
- version->version_minor,
- version->version_patchlevel);
- drmFreeVersion(version);
- return GL_FALSE;
- }
- info->drmMinor = version->version_minor;
- drmFreeVersion(version);
- }
-
- if ((err = drmSetBusid(ctx->drmFD, ctx->pciBusID)) < 0) {
- fprintf(stderr, "[drm] drmSetBusid failed (%d, %s), %s\n",
- ctx->drmFD, ctx->pciBusID, strerror(-err));
- return 0;
- }
-
- if (drmAddMap( ctx->drmFD,
- 0,
- ctx->shared.SAREASize,
- DRM_SHM,
- DRM_CONTAINS_LOCK,
- &ctx->shared.hSAREA) < 0)
- {
- fprintf(stderr, "[drm] drmAddMap failed\n");
- return 0;
- }
- fprintf(stderr, "[drm] added %d byte SAREA at 0x%08lx\n",
- ctx->shared.SAREASize, ctx->shared.hSAREA);
-
- if (drmMap( ctx->drmFD,
- ctx->shared.hSAREA,
- ctx->shared.SAREASize,
- (drmAddressPtr)(&ctx->pSAREA)) < 0)
- {
- fprintf(stderr, "[drm] drmMap failed\n");
- return 0;
- }
- memset(ctx->pSAREA, 0, ctx->shared.SAREASize);
- fprintf(stderr, "[drm] mapped SAREA 0x%08lx to %p, size %d\n",
- ctx->shared.hSAREA, ctx->pSAREA, ctx->shared.SAREASize);
-
- /* Need to AddMap the framebuffer and mmio regions here:
- */
- if (drmAddMap( ctx->drmFD,
- (drm_handle_t)ctx->FBStart,
- ctx->FBSize,
- DRM_FRAME_BUFFER,
- 0,
- &ctx->shared.hFrameBuffer) < 0)
- {
- fprintf(stderr, "[drm] drmAddMap framebuffer failed\n");
- return 0;
- }
-
- fprintf(stderr, "[drm] framebuffer handle = 0x%08lx\n",
- ctx->shared.hFrameBuffer);
-
- if (!R128MemoryInit(ctx))
- return GL_FALSE;
-
- /* Initialize AGP */
- if (!info->IsPCI && !R128DRIAgpInit(ctx)) {
- info->IsPCI = GL_TRUE;
- fprintf(stderr,
- "[agp] AGP failed to initialize -- falling back to PCI mode.\n");
- fprintf(stderr,
- "[agp] Make sure you have the agpgart kernel module loaded.\n");
- }
-
- /* Initialize PCIGART */
- if (info->IsPCI && !R128DRIPciInit(ctx)) {
- return GL_FALSE;
- }
-
- /* DRIScreenInit doesn't add all the
- common mappings. Add additional
- mappings here. */
- if (!R128DRIMapInit(ctx)) {
- return GL_FALSE;
- }
-
- /* Create a 'server' context so we can grab the lock for
- * initialization ioctls.
- */
- if ((err = drmCreateContext(ctx->drmFD, &ctx->serverContext)) != 0) {
- fprintf(stderr, "%s: drmCreateContext failed %d\n", __FUNCTION__, err);
- return 0;
- }
-
- DRM_LOCK(ctx->drmFD, ctx->pSAREA, ctx->serverContext, 0);
-
- /* Initialize the kernel data structures */
- if (!R128DRIKernelInit(ctx)) {
- return GL_FALSE;
- }
-
- /* Initialize the vertex buffers list */
- if (!R128DRIBufInit(ctx)) {
- return GL_FALSE;
- }
-
- /* Initialize IRQ */
- R128DRIIrqInit(ctx);
-
- /* Initialize and start the CCE if required */
- R128DRICCEInit(ctx);
-
- /* Quick hack to clear the front & back buffers. Could also use
- * the clear ioctl to do this, but would need to setup hw state
- * first.
- */
- drimemsetio((char *)ctx->FBAddress + info->frontOffset,
- 0,
- info->frontPitch * ctx->cpp * ctx->shared.virtualHeight );
-
- drimemsetio((char *)ctx->FBAddress + info->backOffset,
- 0,
- info->backPitch * ctx->cpp * ctx->shared.virtualHeight );
-
- pSAREAPriv = (drm_r128_sarea_t *)(((char*)ctx->pSAREA) +
- sizeof(drm_sarea_t));
- memset(pSAREAPriv, 0, sizeof(*pSAREAPriv));
-
- /* This is the struct passed to radeon_dri.so for its initialization */
- ctx->driverClientMsg = malloc(sizeof(R128DRIRec));
- ctx->driverClientMsgSize = sizeof(R128DRIRec);
-
- pR128DRI = (R128DRIPtr)ctx->driverClientMsg;
- pR128DRI->deviceID = info->Chipset;
- pR128DRI->width = ctx->shared.virtualWidth;
- pR128DRI->height = ctx->shared.virtualHeight;
- pR128DRI->depth = ctx->bpp;
- pR128DRI->bpp = ctx->bpp;
-
- pR128DRI->IsPCI = info->IsPCI;
- pR128DRI->AGPMode = info->agpMode;
-
- pR128DRI->frontOffset = info->frontOffset;
- pR128DRI->frontPitch = info->frontPitch;
- pR128DRI->backOffset = info->backOffset;
- pR128DRI->backPitch = info->backPitch;
- pR128DRI->depthOffset = info->depthOffset;
- pR128DRI->depthPitch = info->depthPitch;
- pR128DRI->spanOffset = info->spanOffset;
- pR128DRI->textureOffset = info->textureOffset;
- pR128DRI->textureSize = info->textureSize;
- pR128DRI->log2TexGran = info->log2TexGran;
-
- pR128DRI->registerHandle = info->registerHandle;
- pR128DRI->registerSize = info->registerSize;
-
- pR128DRI->agpTexHandle = info->agpTexHandle;
- pR128DRI->agpTexMapSize = info->agpTexMapSize;
- pR128DRI->log2AGPTexGran = info->log2AGPTexGran;
- pR128DRI->agpTexOffset = info->agpTexStart;
- pR128DRI->sarea_priv_offset = sizeof(drm_sarea_t);
-
- return GL_TRUE;
-}
-
-/* The screen is being closed, so clean up any state and free any
- resources used by the DRI. */
-void R128DRICloseScreen(const DRIDriverContext *ctx)
-{
- R128InfoPtr info = ctx->driverPrivate;
- drm_r128_init_t drmInfo;
-
- /* Stop the CCE if it is still in use */
- R128CCE_STOP(ctx, info);
-
- if (info->irq) {
- drmCtlUninstHandler(ctx->drmFD);
- info->irq = 0;
- }
-
- /* De-allocate vertex buffers */
- if (info->buffers) {
- drmUnmapBufs(info->buffers);
- info->buffers = NULL;
- }
-
- /* De-allocate all kernel resources */
- memset(&drmInfo, 0, sizeof(drmInfo));
- drmInfo.func = R128_CLEANUP_CCE;
- drmCommandWrite(ctx->drmFD, DRM_R128_INIT,
- &drmInfo, sizeof(drmInfo));
-
- /* De-allocate all AGP resources */
- if (info->agpTex) {
- drmUnmap(info->agpTex, info->agpTexMapSize);
- info->agpTex = NULL;
- }
- if (info->buf) {
- drmUnmap(info->buf, info->bufMapSize);
- info->buf = NULL;
- }
- if (info->ringReadPtr) {
- drmUnmap(info->ringReadPtr, info->ringReadMapSize);
- info->ringReadPtr = NULL;
- }
- if (info->ring) {
- drmUnmap(info->ring, info->ringMapSize);
- info->ring = NULL;
- }
- if (info->agpMemHandle != DRM_AGP_NO_HANDLE) {
- drmAgpUnbind(ctx->drmFD, info->agpMemHandle);
- drmAgpFree(ctx->drmFD, info->agpMemHandle);
- info->agpMemHandle = 0;
- drmAgpRelease(ctx->drmFD);
- }
- if (info->pciMemHandle) {
- drmScatterGatherFree(ctx->drmFD, info->pciMemHandle);
- info->pciMemHandle = 0;
- }
-}
-
-static GLboolean R128PreInitDRI(const DRIDriverContext *ctx)
-{
- R128InfoPtr info = ctx->driverPrivate;
-
- /*info->CCEMode = R128_DEFAULT_CCE_PIO_MODE;*/
- info->CCEMode = R128_DEFAULT_CCE_BM_MODE;
- info->CCESecure = GL_TRUE;
-
- info->agpMode = R128_DEFAULT_AGP_MODE;
- info->agpSize = R128_DEFAULT_AGP_SIZE;
- info->ringSize = R128_DEFAULT_RING_SIZE;
- info->bufSize = R128_DEFAULT_BUFFER_SIZE;
- info->agpTexSize = R128_DEFAULT_AGP_TEX_SIZE;
-
- info->CCEusecTimeout = R128_DEFAULT_CCE_TIMEOUT;
-
- return GL_TRUE;
-}
-
-/**
- * \brief Initialize the framebuffer device mode
- *
- * \param ctx display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Fills in \p info with some default values and some information from \p ctx
- * and then calls R128ScreenInit() for the screen initialization.
- *
- * Before exiting clears the framebuffer memory accessing it directly.
- */
-static int R128InitFBDev( DRIDriverContext *ctx )
-{
- R128InfoPtr info = calloc(1, sizeof(*info));
-
- {
- int dummy = ctx->shared.virtualWidth;
-
- switch (ctx->bpp / 8) {
- case 1: dummy = (ctx->shared.virtualWidth + 127) & ~127; break;
- case 2: dummy = (ctx->shared.virtualWidth + 31) & ~31; break;
- case 3:
- case 4: dummy = (ctx->shared.virtualWidth + 15) & ~15; break;
- }
-
- ctx->shared.virtualWidth = dummy;
- }
-
- ctx->driverPrivate = (void *)info;
-
- info->Chipset = ctx->chipset;
-
- switch (info->Chipset) {
- case PCI_DEVICE_ID_ATI_RAGE128_LE:
- case PCI_DEVICE_ID_ATI_RAGE128_RE:
- case PCI_DEVICE_ID_ATI_RAGE128_RK:
- case PCI_DEVICE_ID_ATI_RAGE128_PD:
- case PCI_DEVICE_ID_ATI_RAGE128_PP:
- case PCI_DEVICE_ID_ATI_RAGE128_PR:
- /* This is a PCI card */
- info->IsPCI = GL_TRUE;
- break;
- default:
- /* This is an AGP card */
- info->IsPCI = GL_FALSE;
- break;
- }
-
- info->frontPitch = ctx->shared.virtualWidth;
- info->LinearAddr = ctx->FBStart & 0xfc000000;
-
- if (!R128PreInitDRI(ctx))
- return 0;
-
- if (!R128DRIScreenInit(ctx))
- return 0;
-
- return 1;
-}
-
-
-/**
- * \brief The screen is being closed, so clean up any state and free any
- * resources used by the DRI.
- *
- * \param ctx display handle.
- *
- * Unmaps the SAREA, closes the DRM device file descriptor and frees the driver
- * private data.
- */
-static void R128HaltFBDev( DRIDriverContext *ctx )
-{
- drmUnmap( ctx->pSAREA, ctx->shared.SAREASize );
- drmClose(ctx->drmFD);
-
- if (ctx->driverPrivate) {
- free(ctx->driverPrivate);
- ctx->driverPrivate = 0;
- }
-}
-
-
-/**
- * \brief Validate the fbdev mode.
- *
- * \param ctx display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Saves some registers and returns 1.
- *
- * \sa R128PostValidateMode().
- */
-static int R128ValidateMode( const DRIDriverContext *ctx )
-{
- return 1;
-}
-
-
-/**
- * \brief Examine mode returned by fbdev.
- *
- * \param ctx display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Restores registers that fbdev has clobbered and returns 1.
- *
- * \sa R128ValidateMode().
- */
-static int R128PostValidateMode( const DRIDriverContext *ctx )
-{
- return 1;
-}
-
-
-/**
- * \brief Shutdown the drawing engine.
- *
- * \param ctx display handle
- *
- * Turns off the command processor engine & restores the graphics card
- * to a state that fbdev understands.
- */
-static int R128EngineShutdown( const DRIDriverContext *ctx )
-{
- return 1;
-}
-
-/**
- * \brief Restore the drawing engine.
- *
- * \param ctx display handle
- *
- * Resets the graphics card and sets initial values for several registers of
- * the card's drawing engine.
- *
- * Turns on the R128 command processor engine (i.e., the ringbuffer).
- */
-static int R128EngineRestore( const DRIDriverContext *ctx )
-{
- return 1;
-}
-
-
-/**
- * \brief Exported driver interface for Mini GLX.
- *
- * \sa DRIDriverRec.
- */
-const struct DRIDriverRec __driDriver = {
- R128ValidateMode,
- R128PostValidateMode,
- R128InitFBDev,
- R128HaltFBDev,
- R128EngineShutdown,
- R128EngineRestore,
- 0,
-};
diff --git a/src/mesa/drivers/dri/r200/Makefile b/src/mesa/drivers/dri/r200/Makefile
index 14eb96c1ba..c9c1346c3a 100644
--- a/src/mesa/drivers/dri/r200/Makefile
+++ b/src/mesa/drivers/dri/r200/Makefile
@@ -7,8 +7,6 @@ CFLAGS += $(RADEON_CFLAGS)
LIBNAME = r200_dri.so
-MINIGLX_SOURCES = server/radeon_dri.c
-
ifeq ($(RADEON_LDFLAGS),)
CS_SOURCES = radeon_cs_space_drm.c radeon_bo.c radeon_cs.c
endif
@@ -23,17 +21,19 @@ RADEON_COMMON_SOURCES = \
radeon_fbo.c \
radeon_lock.c \
radeon_mipmap_tree.c \
+ radeon_pixel_read.c \
radeon_queryobj.c \
radeon_span.c \
radeon_texture.c \
- radeon_tex_copy.c
+ radeon_tex_copy.c \
+ radeon_tex_getimage.c \
+ radeon_tile.c
DRIVER_SOURCES = r200_context.c \
r200_ioctl.c \
r200_state.c \
r200_state_init.c \
r200_cmdbuf.c \
- r200_pixel.c \
r200_tex.c \
r200_texstate.c \
r200_tcl.c \
diff --git a/src/mesa/drivers/dri/r200/r200_blit.c b/src/mesa/drivers/dri/r200/r200_blit.c
index 3075760093..e187fc0f61 100644
--- a/src/mesa/drivers/dri/r200/r200_blit.c
+++ b/src/mesa/drivers/dri/r200/r200_blit.c
@@ -48,6 +48,11 @@ unsigned r200_check_blit(gl_format mesa_format)
case MESA_FORMAT_ARGB4444:
case MESA_FORMAT_ARGB1555:
case MESA_FORMAT_A8:
+ case MESA_FORMAT_L8:
+ case MESA_FORMAT_I8:
+ /* swizzled */
+ case MESA_FORMAT_RGBA8888:
+ case MESA_FORMAT_RGBA8888_REV:
break;
default:
return 0;
@@ -86,7 +91,8 @@ static inline void emit_vtx_state(struct r200_context *r200)
}
static void inline emit_tx_setup(struct r200_context *r200,
- gl_format mesa_format,
+ gl_format src_mesa_format,
+ gl_format dst_mesa_format,
struct radeon_bo *bo,
intptr_t offset,
unsigned width,
@@ -101,10 +107,16 @@ static void inline emit_tx_setup(struct r200_context *r200,
assert(offset % 32 == 0);
/* XXX others? BE/LE? */
- switch (mesa_format) {
+ switch (src_mesa_format) {
case MESA_FORMAT_ARGB8888:
txformat |= R200_TXFORMAT_ARGB8888 | R200_TXFORMAT_ALPHA_IN_MAP;
break;
+ case MESA_FORMAT_RGBA8888:
+ txformat |= R200_TXFORMAT_RGBA8888 | R200_TXFORMAT_ALPHA_IN_MAP;
+ break;
+ case MESA_FORMAT_RGBA8888_REV:
+ txformat |= R200_TXFORMAT_ABGR8888 | R200_TXFORMAT_ALPHA_IN_MAP;
+ break;
case MESA_FORMAT_XRGB8888:
txformat |= R200_TXFORMAT_ARGB8888;
break;
@@ -118,26 +130,143 @@ static void inline emit_tx_setup(struct r200_context *r200,
txformat |= R200_TXFORMAT_ARGB1555 | R200_TXFORMAT_ALPHA_IN_MAP;
break;
case MESA_FORMAT_A8:
+ case MESA_FORMAT_I8:
txformat |= R200_TXFORMAT_I8 | R200_TXFORMAT_ALPHA_IN_MAP;
break;
+ case MESA_FORMAT_L8:
+ txformat |= R200_TXFORMAT_I8;
+ break;
+ case MESA_FORMAT_AL88:
+ txformat |= R200_TXFORMAT_AI88 | R200_TXFORMAT_ALPHA_IN_MAP;
+ break;
+ default:
+ break;
+ }
+
+ switch (dst_mesa_format) {
+ case MESA_FORMAT_ARGB8888:
+ case MESA_FORMAT_XRGB8888:
+ case MESA_FORMAT_RGB565:
+ case MESA_FORMAT_ARGB4444:
+ case MESA_FORMAT_ARGB1555:
+ case MESA_FORMAT_A8:
+ case MESA_FORMAT_L8:
+ case MESA_FORMAT_I8:
default:
+ /* no swizzle required */
+ BEGIN_BATCH(10);
+ OUT_BATCH_REGVAL(RADEON_PP_CNTL, (RADEON_TEX_0_ENABLE |
+ RADEON_TEX_BLEND_0_ENABLE));
+ OUT_BATCH_REGVAL(R200_PP_TXCBLEND_0, (R200_TXC_ARG_A_ZERO |
+ R200_TXC_ARG_B_ZERO |
+ R200_TXC_ARG_C_R0_COLOR |
+ R200_TXC_OP_MADD));
+ OUT_BATCH_REGVAL(R200_PP_TXCBLEND2_0, (R200_TXC_CLAMP_0_1 |
+ R200_TXC_OUTPUT_REG_R0));
+ OUT_BATCH_REGVAL(R200_PP_TXABLEND_0, (R200_TXA_ARG_A_ZERO |
+ R200_TXA_ARG_B_ZERO |
+ R200_TXA_ARG_C_R0_ALPHA |
+ R200_TXA_OP_MADD));
+ OUT_BATCH_REGVAL(R200_PP_TXABLEND2_0, (R200_TXA_CLAMP_0_1 |
+ R200_TXA_OUTPUT_REG_R0));
+ END_BATCH();
+ break;
+ case MESA_FORMAT_RGBA8888:
+ BEGIN_BATCH(10);
+ OUT_BATCH_REGVAL(RADEON_PP_CNTL, (RADEON_TEX_0_ENABLE |
+ RADEON_TEX_BLEND_0_ENABLE));
+ OUT_BATCH_REGVAL(R200_PP_TXCBLEND_0, (R200_TXC_ARG_A_ZERO |
+ R200_TXC_ARG_B_ZERO |
+ R200_TXC_ARG_C_R0_COLOR |
+ R200_TXC_OP_MADD));
+ OUT_BATCH_REGVAL(R200_PP_TXCBLEND2_0, (R200_TXC_CLAMP_0_1 |
+ R200_TXC_OUTPUT_ROTATE_GBA |
+ R200_TXC_OUTPUT_REG_R0));
+ OUT_BATCH_REGVAL(R200_PP_TXABLEND_0, (R200_TXA_ARG_A_ZERO |
+ R200_TXA_ARG_B_ZERO |
+ R200_TXA_ARG_C_R0_ALPHA |
+ R200_TXA_OP_MADD));
+ OUT_BATCH_REGVAL(R200_PP_TXABLEND2_0, (R200_TXA_CLAMP_0_1 |
+ (R200_TXA_REPL_RED << R200_TXA_REPL_ARG_C_SHIFT) |
+ R200_TXA_OUTPUT_REG_R0));
+ END_BATCH();
+ break;
+ case MESA_FORMAT_RGBA8888_REV:
+ BEGIN_BATCH(34);
+ OUT_BATCH_REGVAL(RADEON_PP_CNTL, (RADEON_TEX_0_ENABLE |
+ RADEON_TEX_BLEND_0_ENABLE |
+ RADEON_TEX_BLEND_1_ENABLE |
+ RADEON_TEX_BLEND_2_ENABLE |
+ RADEON_TEX_BLEND_3_ENABLE));
+ /* r1.r = r0.b */
+ OUT_BATCH_REGVAL(R200_PP_TXCBLEND_0, (R200_TXC_ARG_A_ZERO |
+ R200_TXC_ARG_B_ZERO |
+ R200_TXC_ARG_C_R0_COLOR |
+ R200_TXC_OP_MADD));
+ OUT_BATCH_REGVAL(R200_PP_TXCBLEND2_0, (R200_TXC_CLAMP_0_1 |
+ R200_TXC_OUTPUT_MASK_R |
+ (R200_TXC_REPL_BLUE << R200_TXC_REPL_ARG_C_SHIFT) |
+ R200_TXC_OUTPUT_REG_R1));
+ /* r1.a = r0.a */
+ OUT_BATCH_REGVAL(R200_PP_TXABLEND_0, (R200_TXA_ARG_A_ZERO |
+ R200_TXA_ARG_B_ZERO |
+ R200_TXA_ARG_C_R0_ALPHA |
+ R200_TXA_OP_MADD));
+ OUT_BATCH_REGVAL(R200_PP_TXABLEND2_0, (R200_TXA_CLAMP_0_1 |
+ R200_TXA_OUTPUT_REG_R1));
+ /* r1.g = r0.g */
+ OUT_BATCH_REGVAL(R200_PP_TXCBLEND_1, (R200_TXC_ARG_A_ZERO |
+ R200_TXC_ARG_B_ZERO |
+ R200_TXC_ARG_C_R0_COLOR |
+ R200_TXC_OP_MADD));
+ OUT_BATCH_REGVAL(R200_PP_TXCBLEND2_1, (R200_TXC_CLAMP_0_1 |
+ R200_TXC_OUTPUT_MASK_G |
+ (R200_TXC_REPL_GREEN << R200_TXC_REPL_ARG_C_SHIFT) |
+ R200_TXC_OUTPUT_REG_R1));
+ /* r1.a = r0.a */
+ OUT_BATCH_REGVAL(R200_PP_TXABLEND_1, (R200_TXA_ARG_A_ZERO |
+ R200_TXA_ARG_B_ZERO |
+ R200_TXA_ARG_C_R0_ALPHA |
+ R200_TXA_OP_MADD));
+ OUT_BATCH_REGVAL(R200_PP_TXABLEND2_1, (R200_TXA_CLAMP_0_1 |
+ R200_TXA_OUTPUT_REG_R1));
+ /* r1.b = r0.r */
+ OUT_BATCH_REGVAL(R200_PP_TXCBLEND_2, (R200_TXC_ARG_A_ZERO |
+ R200_TXC_ARG_B_ZERO |
+ R200_TXC_ARG_C_R0_COLOR |
+ R200_TXC_OP_MADD));
+ OUT_BATCH_REGVAL(R200_PP_TXCBLEND2_2, (R200_TXC_CLAMP_0_1 |
+ R200_TXC_OUTPUT_MASK_B |
+ (R200_TXC_REPL_RED << R200_TXC_REPL_ARG_C_SHIFT) |
+ R200_TXC_OUTPUT_REG_R1));
+ /* r1.a = r0.a */
+ OUT_BATCH_REGVAL(R200_PP_TXABLEND_2, (R200_TXA_ARG_A_ZERO |
+ R200_TXA_ARG_B_ZERO |
+ R200_TXA_ARG_C_R0_ALPHA |
+ R200_TXA_OP_MADD));
+ OUT_BATCH_REGVAL(R200_PP_TXABLEND2_2, (R200_TXA_CLAMP_0_1 |
+ R200_TXA_OUTPUT_REG_R1));
+ /* r0.rgb = r1.rgb */
+ OUT_BATCH_REGVAL(R200_PP_TXCBLEND_3, (R200_TXC_ARG_A_ZERO |
+ R200_TXC_ARG_B_ZERO |
+ R200_TXC_ARG_C_R1_COLOR |
+ R200_TXC_OP_MADD));
+ OUT_BATCH_REGVAL(R200_PP_TXCBLEND2_3, (R200_TXC_CLAMP_0_1 |
+ R200_TXC_OUTPUT_REG_R0));
+ /* r0.a = r1.a */
+ OUT_BATCH_REGVAL(R200_PP_TXABLEND_3, (R200_TXA_ARG_A_ZERO |
+ R200_TXA_ARG_B_ZERO |
+ R200_TXA_ARG_C_R1_ALPHA |
+ R200_TXA_OP_MADD));
+ OUT_BATCH_REGVAL(R200_PP_TXABLEND2_3, (R200_TXA_CLAMP_0_1 |
+ R200_TXA_OUTPUT_REG_R0));
+ END_BATCH();
break;
}
- BEGIN_BATCH(28);
- OUT_BATCH_REGVAL(RADEON_PP_CNTL, RADEON_TEX_0_ENABLE | RADEON_TEX_BLEND_0_ENABLE);
+ BEGIN_BATCH(18);
OUT_BATCH_REGVAL(R200_PP_CNTL_X, 0);
OUT_BATCH_REGVAL(R200_PP_TXMULTI_CTL_0, 0);
- OUT_BATCH_REGVAL(R200_PP_TXCBLEND_0, (R200_TXC_ARG_A_ZERO |
- R200_TXC_ARG_B_ZERO |
- R200_TXC_ARG_C_R0_COLOR |
- R200_TXC_OP_MADD));
- OUT_BATCH_REGVAL(R200_PP_TXCBLEND2_0, R200_TXC_CLAMP_0_1 | R200_TXC_OUTPUT_REG_R0);
- OUT_BATCH_REGVAL(R200_PP_TXABLEND_0, (R200_TXA_ARG_A_ZERO |
- R200_TXA_ARG_B_ZERO |
- R200_TXA_ARG_C_R0_ALPHA |
- R200_TXA_OP_MADD));
- OUT_BATCH_REGVAL(R200_PP_TXABLEND2_0, R200_TXA_CLAMP_0_1 | R200_TXA_OUTPUT_REG_R0);
OUT_BATCH_REGVAL(R200_PP_TXFILTER_0, (R200_CLAMP_S_CLAMP_LAST |
R200_CLAMP_T_CLAMP_LAST |
R200_MAG_FILTER_NEAREST |
@@ -146,7 +275,7 @@ static void inline emit_tx_setup(struct r200_context *r200,
OUT_BATCH_REGVAL(R200_PP_TXFORMAT_X_0, 0);
OUT_BATCH_REGVAL(R200_PP_TXSIZE_0, ((width - 1) |
((height - 1) << RADEON_TEX_VSIZE_SHIFT)));
- OUT_BATCH_REGVAL(R200_PP_TXPITCH_0, pitch * _mesa_get_format_bytes(mesa_format) - 32);
+ OUT_BATCH_REGVAL(R200_PP_TXPITCH_0, pitch * _mesa_get_format_bytes(src_mesa_format) - 32);
OUT_BATCH_REGSEQ(R200_PP_TXOFFSET_0, 1);
OUT_BATCH_RELOC(0, bo, 0, RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0);
@@ -170,6 +299,8 @@ static inline void emit_cb_setup(struct r200_context *r200,
switch (mesa_format) {
case MESA_FORMAT_ARGB8888:
case MESA_FORMAT_XRGB8888:
+ case MESA_FORMAT_RGBA8888:
+ case MESA_FORMAT_RGBA8888_REV:
dst_format = RADEON_COLOR_FORMAT_ARGB8888;
break;
case MESA_FORMAT_RGB565:
@@ -182,6 +313,8 @@ static inline void emit_cb_setup(struct r200_context *r200,
dst_format = RADEON_COLOR_FORMAT_ARGB1555;
break;
case MESA_FORMAT_A8:
+ case MESA_FORMAT_L8:
+ case MESA_FORMAT_I8:
dst_format = RADEON_COLOR_FORMAT_RGB8;
break;
default:
@@ -384,15 +517,15 @@ unsigned r200_blit(GLcontext *ctx,
/* Flush is needed to make sure that source buffer has correct data */
radeonFlush(r200->radeon.glCtx);
- rcommonEnsureCmdBufSpace(&r200->radeon, 78, __FUNCTION__);
+ rcommonEnsureCmdBufSpace(&r200->radeon, 102, __FUNCTION__);
if (!validate_buffers(r200, src_bo, dst_bo))
return GL_FALSE;
/* 14 */
emit_vtx_state(r200);
- /* 28 */
- emit_tx_setup(r200, src_mesaformat, src_bo, src_offset, src_width, src_height, src_pitch);
+ /* 52 */
+ emit_tx_setup(r200, src_mesaformat, dst_mesaformat, src_bo, src_offset, src_width, src_height, src_pitch);
/* 22 */
emit_cb_setup(r200, dst_bo, dst_offset, dst_mesaformat, dst_pitch, dst_width, dst_height);
/* 14 */
diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c
index dad2580e08..36a29350cc 100644
--- a/src/mesa/drivers/dri/r200/r200_context.c
+++ b/src/mesa/drivers/dri/r200/r200_context.c
@@ -51,7 +51,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r200_context.h"
#include "r200_ioctl.h"
#include "r200_state.h"
-#include "r200_pixel.h"
#include "r200_tex.h"
#include "r200_swtcl.h"
#include "r200_tcl.h"
@@ -266,6 +265,7 @@ static void r200_init_vtbl(radeonContextPtr radeon)
radeon->vtbl.emit_query_finish = r200_emit_query_finish;
radeon->vtbl.check_blit = r200_check_blit;
radeon->vtbl.blit = r200_blit;
+ radeon->vtbl.is_format_renderable = radeonIsFormatRenderable;
}
@@ -324,7 +324,7 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual,
_mesa_init_driver_functions(&functions);
r200InitDriverFuncs(&functions);
r200InitIoctlFuncs(&functions);
- r200InitStateFuncs(&functions);
+ r200InitStateFuncs(&rmesa->radeon, &functions);
r200InitTextureFuncs(&rmesa->radeon, &functions);
r200InitShaderFuncs(&functions);
radeonInitQueryObjFunctions(&functions);
@@ -473,7 +473,6 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual,
/* XXX these should really go right after _mesa_init_driver_functions() */
radeon_fbo_init(&rmesa->radeon);
radeonInitSpanFuncs( ctx );
- r200InitPixelFuncs( ctx );
r200InitTnlFuncs( ctx );
r200InitState( rmesa );
r200InitSwtcl( ctx );
diff --git a/src/mesa/drivers/dri/r200/r200_pixel.c b/src/mesa/drivers/dri/r200/r200_pixel.c
deleted file mode 100644
index bfb7e2a2ed..0000000000
--- a/src/mesa/drivers/dri/r200/r200_pixel.c
+++ /dev/null
@@ -1,494 +0,0 @@
-/*
-Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
-
-The Weather Channel (TM) funded Tungsten Graphics to develop the
-initial release of the Radeon 8500 driver under the XFree86 license.
-This notice must be preserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#include "main/glheader.h"
-#include "main/enums.h"
-#include "main/mtypes.h"
-#include "main/macros.h"
-#include "swrast/swrast.h"
-
-#include "r200_context.h"
-#include "r200_ioctl.h"
-#include "r200_pixel.h"
-#include "r200_swtcl.h"
-
-#include "drirenderbuffer.h"
-
-
-static GLboolean
-check_color( const GLcontext *ctx, GLenum type, GLenum format,
- const struct gl_pixelstore_attrib *packing,
- const void *pixels, GLint sz, GLint pitch )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLuint cpp = rmesa->radeon.radeonScreen->cpp;
-
- if (R200_DEBUG & RADEON_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if ( (pitch & 63) ||
- ctx->_ImageTransferState ||
- packing->SwapBytes ||
- packing->LsbFirst) {
- if (R200_DEBUG & RADEON_PIXEL)
- fprintf(stderr, "%s: failed 1\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- if ( type == GL_UNSIGNED_INT_8_8_8_8_REV &&
- cpp == 4 &&
- format == GL_BGRA ) {
- if (R200_DEBUG & RADEON_PIXEL)
- fprintf(stderr, "%s: passed 2\n", __FUNCTION__);
- return GL_TRUE;
- }
-
- if (R200_DEBUG & RADEON_PIXEL)
- fprintf(stderr, "%s: failed\n", __FUNCTION__);
-
- return GL_FALSE;
-}
-
-static GLboolean
-check_color_per_fragment_ops( const GLcontext *ctx )
-{
- int result;
- result = (!( ctx->Color.AlphaEnabled ||
- ctx->Depth.Test ||
- ctx->Fog.Enabled ||
- ctx->Scissor.Enabled ||
- ctx->Stencil._Enabled ||
- !ctx->Color.ColorMask[0][0] ||
- !ctx->Color.ColorMask[0][1] ||
- !ctx->Color.ColorMask[0][2] ||
- !ctx->Color.ColorMask[0][3] ||
- ctx->Color.ColorLogicOpEnabled ||
- ctx->Texture._EnabledUnits
- ) &&
- ctx->Current.RasterPosValid);
-
- return result;
-}
-
-
-#if 0
-static GLboolean
-clip_pixelrect( const GLcontext *ctx,
- const GLframebuffer *buffer,
- GLint *x, GLint *y,
- GLsizei *width, GLsizei *height,
- GLint *size )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- /* left clipping */
- if (*x < buffer->_Xmin) {
- *width -= (buffer->_Xmin - *x);
- *x = buffer->_Xmin;
- }
-
- /* right clipping */
- if (*x + *width > buffer->_Xmax)
- *width -= (*x + *width - buffer->_Xmax - 1);
-
- if (*width <= 0)
- return GL_FALSE;
-
- /* bottom clipping */
- if (*y < buffer->_Ymin) {
- *height -= (buffer->_Ymin - *y);
- *y = buffer->_Ymin;
- }
-
- /* top clipping */
- if (*y + *height > buffer->_Ymax)
- *height -= (*y + *height - buffer->_Ymax - 1);
-
- if (*height <= 0)
- return GL_FALSE;
-
- *size = ((*y + *height - 1) * rmesa->radeon.radeonScreen->frontPitch +
- (*x + *width - 1) * rmesa->radeon.radeonScreen->cpp);
-
- return GL_TRUE;
-}
-#endif
-
-static GLboolean
-r200TryReadPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *pack,
- GLvoid *pixels )
-{
- return GL_FALSE;
-#if 0
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLint pitch = pack->RowLength ? pack->RowLength : width;
- GLint blit_format;
- GLuint cpp = rmesa->radeon.radeonScreen->cpp;
- GLint size = width * height * cpp;
-
- if (R200_DEBUG & RADEON_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- /* Only accelerate reading to GART buffers.
- */
- if ( !r200IsGartMemory(rmesa, pixels,
- pitch * height * rmesa->radeon.radeonScreen->cpp ) ) {
- if (R200_DEBUG & RADEON_PIXEL)
- fprintf(stderr, "%s: dest not GART\n", __FUNCTION__);
- }
-
- /* Need GL_PACK_INVERT_MESA to cope with upsidedown results from
- * blitter:
- */
- if (!pack->Invert) {
- if (R200_DEBUG & RADEON_PIXEL)
- fprintf(stderr, "%s: MESA_PACK_INVERT not set\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- if (!check_color(ctx, type, format, pack, pixels, size, pitch))
- return GL_FALSE;
-
- switch ( rmesa->radeon.radeonScreen->cpp ) {
- case 4:
- blit_format = R200_CP_COLOR_FORMAT_ARGB8888;
- break;
- default:
- return GL_FALSE;
- }
-
-
- /* Although the blits go on the command buffer, need to do this and
- * fire with lock held to guarentee cliprects and drawOffset are
- * correct.
- *
- * This is an unusual situation however, as the code which flushes
- * a full command buffer expects to be called unlocked. As a
- * workaround, immediately flush the buffer on aquiring the lock.
- */
- LOCK_HARDWARE( &rmesa->radeon );
-
- if (rmesa->store.cmd_used)
- rcommonFlushCmdBufLocked( &rmesa->radeon, __FUNCTION__ );
-
- if (!clip_pixelrect(ctx, ctx->ReadBuffer, &x, &y, &width, &height,
- &size)) {
- UNLOCK_HARDWARE( &rmesa->radeon );
- if (R200_DEBUG & RADEON_PIXEL)
- fprintf(stderr, "%s totally clipped -- nothing to do\n",
- __FUNCTION__);
- return GL_TRUE;
- }
-
- {
- __DRIdrawable *dPriv = rmesa->radeon.dri.drawable;
- driRenderbuffer *drb = (driRenderbuffer *) ctx->ReadBuffer->_ColorReadBuffer;
- int nbox = dPriv->numClipRects;
- int src_offset = drb->offset
- + rmesa->radeon.radeonScreen->fbLocation;
- int src_pitch = drb->pitch * drb->cpp;
- int dst_offset = r200GartOffsetFromVirtual( rmesa, pixels );
- int dst_pitch = pitch * rmesa->radeon.radeonScreen->cpp;
- drm_clip_rect_t *box = dPriv->pClipRects;
- int i;
-
- r200EmitWait( rmesa, RADEON_WAIT_3D );
-
- y = dPriv->h - y - height;
- x += dPriv->x;
- y += dPriv->y;
-
-
- if (R200_DEBUG & RADEON_PIXEL)
- fprintf(stderr, "readpixel blit src_pitch %d dst_pitch %d\n",
- src_pitch, dst_pitch);
-
- for (i = 0 ; i < nbox ; i++)
- {
- GLint bx = box[i].x1;
- GLint by = box[i].y1;
- GLint bw = box[i].x2 - bx;
- GLint bh = box[i].y2 - by;
-
- if (bx < x) bw -= x - bx, bx = x;
- if (by < y) bh -= y - by, by = y;
- if (bx + bw > x + width) bw = x + width - bx;
- if (by + bh > y + height) bh = y + height - by;
- if (bw <= 0) continue;
- if (bh <= 0) continue;
-
- r200EmitBlit( rmesa,
- blit_format,
- src_pitch, src_offset,
- dst_pitch, dst_offset,
- bx, by,
- bx - x, by - y,
- bw, bh );
- }
-
- rcommonFlushCmdBufLocked( &rmesa->radeon, __FUNCTION__ );
- }
- UNLOCK_HARDWARE( &rmesa->radeon );
-
- radeonFinish( ctx ); /* required by GL */
-#endif
- return GL_TRUE;
-}
-
-static void
-r200ReadPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *pack,
- GLvoid *pixels )
-{
- if (R200_DEBUG & RADEON_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (!r200TryReadPixels( ctx, x, y, width, height, format, type, pack,
- pixels))
- _swrast_ReadPixels( ctx, x, y, width, height, format, type, pack,
- pixels);
-}
-
-
-
-
-static void do_draw_pix( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLint pitch,
- const void *pixels,
- GLuint planemask)
-{
- if (R200_DEBUG & RADEON_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
-#if 0
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- __DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon);
- drm_clip_rect_t *box = dPriv->pClipRects;
- struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorDrawBuffers[0];
- driRenderbuffer *drb = (driRenderbuffer *) rb;
- int nbox = dPriv->numClipRects;
- int i;
- int blit_format;
- int size;
- int src_offset = r200GartOffsetFromVirtual( rmesa, pixels );
- int src_pitch = pitch * rmesa->radeon.radeonScreen->cpp;
-
- switch ( rmesa->radeon.radeonScreen->cpp ) {
- case 2:
- blit_format = R200_CP_COLOR_FORMAT_RGB565;
- break;
- case 4:
- blit_format = R200_CP_COLOR_FORMAT_ARGB8888;
- break;
- default:
- return;
- }
-
-
- LOCK_HARDWARE( &rmesa->radeon );
-
- if (rmesa->store.cmd_used)
- rcommonFlushCmdBufLocked( &rmesa->radeon, __FUNCTION__ );
-
- y -= height; /* cope with pixel zoom */
-
- if (!clip_pixelrect(ctx, ctx->DrawBuffer,
- &x, &y, &width, &height,
- &size)) {
- UNLOCK_HARDWARE( &rmesa->radeon );
- return;
- }
-
- y = dPriv->h - y - height; /* convert from gl to hardware coords */
- x += dPriv->x;
- y += dPriv->y;
-
-
- r200EmitWait( rmesa, RADEON_WAIT_3D );
-
- for (i = 0 ; i < nbox ; i++ )
- {
- GLint bx = box[i].x1;
- GLint by = box[i].y1;
- GLint bw = box[i].x2 - bx;
- GLint bh = box[i].y2 - by;
-
- if (bx < x) bw -= x - bx, bx = x;
- if (by < y) bh -= y - by, by = y;
- if (bx + bw > x + width) bw = x + width - bx;
- if (by + bh > y + height) bh = y + height - by;
- if (bw <= 0) continue;
- if (bh <= 0) continue;
-
- r200EmitBlit( rmesa,
- blit_format,
- src_pitch, src_offset,
- drb->pitch * drb->cpp,
- drb->offset + rmesa->radeon.radeonScreen->fbLocation,
- bx - x, by - y,
- bx, by,
- bw, bh );
- }
-
- rcommonFlushCmdBufLocked( &rmesa->radeon, __FUNCTION__ );
- radeonWaitForIdleLocked( &rmesa->radeon ); /* required by GL */
- UNLOCK_HARDWARE( &rmesa->radeon );
-#endif
-}
-
-
-
-
-static GLboolean
-r200TryDrawPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid *pixels )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
- GLint pitch = unpack->RowLength ? unpack->RowLength : width;
- GLuint planemask;
- GLuint cpp = rmesa->radeon.radeonScreen->cpp;
- GLint size = height * pitch * cpp;
-
- if (R200_DEBUG & RADEON_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- /* check that we're drawing to exactly one color buffer */
- if (ctx->DrawBuffer->_NumColorDrawBuffers != 1)
- return GL_FALSE;
-
- switch (format) {
- case GL_RGB:
- case GL_RGBA:
- case GL_BGRA:
- planemask = radeonPackColor(cpp,
- ctx->Color.ColorMask[0][RCOMP],
- ctx->Color.ColorMask[0][GCOMP],
- ctx->Color.ColorMask[0][BCOMP],
- ctx->Color.ColorMask[0][ACOMP]);
-
- if (cpp == 2)
- planemask |= planemask << 16;
-
- if (planemask != ~0)
- return GL_FALSE; /* fix me -- should be possible */
-
- /* Can't do conversions on GART reads/draws.
- */
- if ( !r200IsGartMemory( rmesa, pixels, size ) ) {
- if (R200_DEBUG & RADEON_PIXEL)
- fprintf(stderr, "%s: not GART memory\n", __FUNCTION__);
- return GL_FALSE;
- }
-
- if (!check_color(ctx, type, format, unpack, pixels, size, pitch)) {
- return GL_FALSE;
- }
- if (!check_color_per_fragment_ops(ctx)) {
- return GL_FALSE;
- }
-
- if (ctx->Pixel.ZoomX != 1.0F ||
- ctx->Pixel.ZoomY != -1.0F)
- return GL_FALSE;
- break;
-
- default:
- return GL_FALSE;
- }
-
- if (0)// r200IsGartMemory(rmesa, pixels, size) )
- {
- do_draw_pix( ctx, x, y, width, height, pitch, pixels, planemask );
- return GL_TRUE;
- }
- else if (0)
- {
- /* Pixels is in regular memory -- get dma buffers and perform
- * upload through them.
- */
- }
- else
- return GL_FALSE;
-}
-
-static void
-r200DrawPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- const GLvoid *pixels )
-{
- if (R200_DEBUG & RADEON_PIXEL)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- if (!r200TryDrawPixels( ctx, x, y, width, height, format, type,
- unpack, pixels ))
- _swrast_DrawPixels( ctx, x, y, width, height, format, type,
- unpack, pixels );
-}
-
-
-static void
-r200Bitmap( GLcontext *ctx, GLint px, GLint py,
- GLsizei width, GLsizei height,
- const struct gl_pixelstore_attrib *unpack,
- const GLubyte *bitmap )
-{
- r200ContextPtr rmesa = R200_CONTEXT(ctx);
-
- if (rmesa->radeon.Fallback)
- _swrast_Bitmap( ctx, px, py, width, height, unpack, bitmap );
- else
- r200PointsBitmap( ctx, px, py, width, height, unpack, bitmap );
-}
-
-
-
-void r200InitPixelFuncs( GLcontext *ctx )
-{
- if (!getenv("R200_NO_BLITS")) {
- ctx->Driver.ReadPixels = r200ReadPixels;
- ctx->Driver.DrawPixels = r200DrawPixels;
- if (getenv("R200_HW_BITMAP"))
- ctx->Driver.Bitmap = r200Bitmap;
- }
-}
diff --git a/src/mesa/drivers/dri/r200/r200_pixel.h b/src/mesa/drivers/dri/r200/r200_pixel.h
deleted file mode 100644
index e62aa05d74..0000000000
--- a/src/mesa/drivers/dri/r200/r200_pixel.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
-Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
-
-The Weather Channel (TM) funded Tungsten Graphics to develop the
-initial release of the Radeon 8500 driver under the XFree86 license.
-This notice must be preserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-/*
- * Authors:
- * Keith Whitwell <keith@tungstengraphics.com>
- */
-
-#ifndef __R200_PIXEL_H__
-#define __R200_PIXEL_H__
-
-extern void r200InitPixelFuncs( GLcontext *ctx );
-
-#endif
diff --git a/src/mesa/drivers/dri/r200/r200_reg.h b/src/mesa/drivers/dri/r200/r200_reg.h
index b3a4940a7a..e331be223b 100644
--- a/src/mesa/drivers/dri/r200/r200_reg.h
+++ b/src/mesa/drivers/dri/r200/r200_reg.h
@@ -1265,6 +1265,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define R200_TXC_OUTPUT_MASK_G (5 << 20)
#define R200_TXC_OUTPUT_MASK_B (6 << 20)
#define R200_TXC_OUTPUT_MASK_NONE (7 << 20)
+#define R200_TXC_OUTPUT_ROTATE_RGB (0 << 24)
+#define R200_TXC_OUTPUT_ROTATE_ARG (1 << 24)
+#define R200_TXC_OUTPUT_ROTATE_GBA (2 << 24)
+#define R200_TXC_OUTPUT_ROTATE_RGA (3 << 24)
#define R200_TXC_REPL_NORMAL 0
#define R200_TXC_REPL_RED 1
#define R200_TXC_REPL_GREEN 2
diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c
index 050e5aa877..29d7bed8b6 100644
--- a/src/mesa/drivers/dri/r200/r200_state.c
+++ b/src/mesa/drivers/dri/r200/r200_state.c
@@ -46,6 +46,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "tnl/tnl.h"
#include "tnl/t_pipeline.h"
#include "swrast_setup/swrast_setup.h"
+#include "drivers/common/meta.h"
#include "radeon_common.h"
#include "radeon_mipmap_tree.h"
@@ -2487,7 +2488,7 @@ static void r200PolygonStipple( GLcontext *ctx, const GLubyte *mask )
}
/* Initialize the driver's state functions.
*/
-void r200InitStateFuncs( struct dd_function_table *functions )
+void r200InitStateFuncs( radeonContextPtr radeon, struct dd_function_table *functions )
{
functions->UpdateState = r200InvalidateState;
functions->LightingSpaceChange = r200LightingSpaceChange;
@@ -2495,6 +2496,11 @@ void r200InitStateFuncs( struct dd_function_table *functions )
functions->DrawBuffer = radeonDrawBuffer;
functions->ReadBuffer = radeonReadBuffer;
+ functions->CopyPixels = _mesa_meta_CopyPixels;
+ functions->DrawPixels = _mesa_meta_DrawPixels;
+ if (radeon->radeonScreen->kernel_mm)
+ functions->ReadPixels = radeonReadPixels;
+
functions->AlphaFunc = r200AlphaFunc;
functions->BlendColor = r200BlendColor;
functions->BlendEquationSeparate = r200BlendEquationSeparate;
diff --git a/src/mesa/drivers/dri/r200/r200_state.h b/src/mesa/drivers/dri/r200/r200_state.h
index 7b9b0c106a..327ba837e2 100644
--- a/src/mesa/drivers/dri/r200/r200_state.h
+++ b/src/mesa/drivers/dri/r200/r200_state.h
@@ -38,7 +38,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r200_context.h"
extern void r200InitState( r200ContextPtr rmesa );
-extern void r200InitStateFuncs( struct dd_function_table *functions );
+extern void r200InitStateFuncs( radeonContextPtr radeon, struct dd_function_table *functions );
extern void r200InitTnlFuncs( GLcontext *ctx );
extern void r200UpdateMaterial( GLcontext *ctx );
diff --git a/src/mesa/drivers/dri/r200/radeon_pixel_read.c b/src/mesa/drivers/dri/r200/radeon_pixel_read.c
new file mode 120000
index 0000000000..3b03803126
--- /dev/null
+++ b/src/mesa/drivers/dri/r200/radeon_pixel_read.c
@@ -0,0 +1 @@
+../radeon/radeon_pixel_read.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r200/radeon_tex_getimage.c b/src/mesa/drivers/dri/r200/radeon_tex_getimage.c
new file mode 120000
index 0000000000..d9836d7326
--- /dev/null
+++ b/src/mesa/drivers/dri/r200/radeon_tex_getimage.c
@@ -0,0 +1 @@
+../radeon/radeon_tex_getimage.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r200/radeon_tile.c b/src/mesa/drivers/dri/r200/radeon_tile.c
new file mode 120000
index 0000000000..d4bfe27da6
--- /dev/null
+++ b/src/mesa/drivers/dri/r200/radeon_tile.c
@@ -0,0 +1 @@
+../radeon/radeon_tile.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r200/radeon_tile.h b/src/mesa/drivers/dri/r200/radeon_tile.h
new file mode 120000
index 0000000000..31074c581e
--- /dev/null
+++ b/src/mesa/drivers/dri/r200/radeon_tile.h
@@ -0,0 +1 @@
+../radeon/radeon_tile.h \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r200/server/radeon_dri.c b/src/mesa/drivers/dri/r200/server/radeon_dri.c
deleted file mode 120000
index d05847d650..0000000000
--- a/src/mesa/drivers/dri/r200/server/radeon_dri.c
+++ /dev/null
@@ -1 +0,0 @@
-../../radeon/server/radeon_dri.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r300/Makefile b/src/mesa/drivers/dri/r300/Makefile
index 04459c2ddf..2245998c95 100644
--- a/src/mesa/drivers/dri/r300/Makefile
+++ b/src/mesa/drivers/dri/r300/Makefile
@@ -7,8 +7,6 @@ CFLAGS += $(RADEON_CFLAGS)
LIBNAME = r300_dri.so
-MINIGLX_SOURCES = server/radeon_dri.c
-
ifeq ($(RADEON_LDFLAGS),)
CS_SOURCES = radeon_cs_space_drm.c radeon_bo.c radeon_cs.c
endif
@@ -33,10 +31,13 @@ RADEON_COMMON_SOURCES = \
radeon_fbo.c \
radeon_lock.c \
radeon_mipmap_tree.c \
- radeon_span.c \
+ radeon_pixel_read.c \
radeon_queryobj.c \
+ radeon_span.c \
radeon_texture.c \
- radeon_tex_copy.c
+ radeon_tex_copy.c \
+ radeon_tex_getimage.c \
+ radeon_tile.c
DRIVER_SOURCES = \
radeon_screen.c \
diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c
index b0fb8e970b..b78d7d5715 100644
--- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c
+++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c
@@ -433,19 +433,20 @@ void r500FragmentProgramDump(struct rX00_fragment_program_code *c)
(inst >> 30));
fprintf(stderr,"\t3 RGB_INST: 0x%08x:", code->inst[n].inst3);
inst = code->inst[n].inst3;
- fprintf(stderr,"rgb_A_src:%d %s/%s/%s %d rgb_B_src:%d %s/%s/%s %d\n",
+ fprintf(stderr,"rgb_A_src:%d %s/%s/%s %d rgb_B_src:%d %s/%s/%s %d targ: %d\n",
(inst) & 0x3, toswiz((inst >> 2) & 0x7), toswiz((inst >> 5) & 0x7), toswiz((inst >> 8) & 0x7),
(inst >> 11) & 0x3,
(inst >> 13) & 0x3, toswiz((inst >> 15) & 0x7), toswiz((inst >> 18) & 0x7), toswiz((inst >> 21) & 0x7),
- (inst >> 24) & 0x3);
+ (inst >> 24) & 0x3, (inst >> 29) & 0x3);
fprintf(stderr,"\t4 ALPHA_INST:0x%08x:", code->inst[n].inst4);
inst = code->inst[n].inst4;
- fprintf(stderr,"%s dest:%d%s alp_A_src:%d %s %d alp_B_src:%d %s %d w:%d\n", to_alpha_op(inst & 0xf),
+ fprintf(stderr,"%s dest:%d%s alp_A_src:%d %s %d alp_B_src:%d %s %d targ %d w:%d\n", to_alpha_op(inst & 0xf),
(inst >> 4) & 0x7f, inst & (1<<11) ? "(rel)":"",
(inst >> 12) & 0x3, toswiz((inst >> 14) & 0x7), (inst >> 17) & 0x3,
(inst >> 19) & 0x3, toswiz((inst >> 21) & 0x7), (inst >> 24) & 0x3,
+ (inst >> 29) & 0x3,
(inst >> 31) & 0x1);
fprintf(stderr,"\t5 RGBA_INST: 0x%08x:", code->inst[n].inst5);
diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c
index 4e84eefd65..b6dfe28def 100644
--- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c
+++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c
@@ -190,6 +190,17 @@ static unsigned int use_source(struct r500_fragment_program_code* code, struct r
return 0;
}
+/**
+ * NOP the specified instruction if it is not a texture lookup.
+ */
+static void alu_nop(struct r300_fragment_program_compiler *c, int ip)
+{
+ PROG_CODE;
+
+ if ((code->inst[ip].inst0 & 0x3) != R500_INST_TYPE_TEX) {
+ code->inst[ip].inst0 |= R500_INST_NOP;
+ }
+}
/**
* Emit a paired ALU instruction.
@@ -205,6 +216,14 @@ static void emit_paired(struct r300_fragment_program_compiler *c, struct rc_pair
int ip = ++code->inst_end;
+ /* Quirk: MDH/MDV (DDX/DDY) need a NOP on previous non-TEX instructions. */
+ if (inst->RGB.Opcode == RC_OPCODE_DDX || inst->Alpha.Opcode == RC_OPCODE_DDX ||
+ inst->RGB.Opcode == RC_OPCODE_DDY || inst->Alpha.Opcode == RC_OPCODE_DDY) {
+ if (ip > 0) {
+ alu_nop(c, ip - 1);
+ }
+ }
+
code->inst[ip].inst5 = translate_rgb_op(c, inst->RGB.Opcode);
code->inst[ip].inst4 = translate_alpha_op(c, inst->Alpha.Opcode);
@@ -252,8 +271,8 @@ static void emit_paired(struct r300_fragment_program_compiler *c, struct rc_pair
code->inst[ip].inst4 |= translate_arg_alpha(inst, 1) << R500_ALPHA_SEL_B_SHIFT;
code->inst[ip].inst5 |= translate_arg_alpha(inst, 2) << R500_ALU_RGBA_ALPHA_SEL_C_SHIFT;
- code->inst[ip].inst3 |= R500_ALU_RGB_TARGET(inst->RGB.Target);
- code->inst[ip].inst4 |= R500_ALPHA_TARGET(inst->Alpha.Target);
+ code->inst[ip].inst3 |= R500_ALU_RGB_TARGET(inst->RGB.Target);
+ code->inst[ip].inst4 |= R500_ALPHA_TARGET(inst->Alpha.Target);
if (inst->WriteALUResult) {
code->inst[ip].inst3 |= R500_ALU_RGB_WMASK;
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.c b/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.c
index c1c0181fac..9d289fce34 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.c
@@ -75,14 +75,14 @@ struct rc_opcode_info rc_opcodes[MAX_RC_OPCODE] = {
{
.Opcode = RC_OPCODE_DDX,
.Name = "DDX",
- .NumSrcRegs = 1,
+ .NumSrcRegs = 2,
.HasDstReg = 1,
.IsComponentwise = 1
},
{
.Opcode = RC_OPCODE_DDY,
.Name = "DDY",
- .NumSrcRegs = 1,
+ .NumSrcRegs = 2,
.HasDstReg = 1,
.IsComponentwise = 1
},
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c b/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c
index fff5b0c217..3a26e7daaf 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c
@@ -159,11 +159,6 @@ static void set_pair_instruction(struct r300_fragment_program_compiler *c,
int nargs = opcode->NumSrcRegs;
int i;
- /* Special case for DDX/DDY (MDH/MDV). */
- if (inst->Opcode == RC_OPCODE_DDX || inst->Opcode == RC_OPCODE_DDY) {
- nargs++;
- }
-
for(i = 0; i < opcode->NumSrcRegs; ++i) {
int source;
if (needrgb && !istranscendent) {
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c
index b5c08aea49..f5b7d57eab 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c
@@ -506,6 +506,46 @@ static void transform_r300_vertex_ABS(struct radeon_compiler* c,
inst->U.I.SrcReg[1].Negate ^= RC_MASK_XYZW;
}
+static void transform_r300_vertex_CMP(struct radeon_compiler* c,
+ struct rc_instruction* inst)
+{
+ /* There is no decent CMP available, so let's rig one up.
+ * CMP is defined as dst = src0 < 0.0 ? src1 : src2
+ * The following sequence consumes two temps and three extra slots,
+ * but should be equivalent:
+ *
+ * SLT tmp0, src0, 0.0
+ * SGE tmp1, src0, 0.0
+ * MUL tmp0, tmp0, src1
+ * MAD dst, src2, tmp1, tmp0
+ *
+ * Yes, I know, I'm a mad scientist. ~ C. */
+ int tempreg0 = rc_find_free_temporary(c);
+ int tempreg1 = rc_find_free_temporary(c);
+
+ /* SLT tmp0, src0, 0.0 */
+ emit2(c, inst->Prev, RC_OPCODE_SLT, 0,
+ dstreg(RC_FILE_TEMPORARY, tempreg0),
+ inst->U.I.SrcReg[0], builtin_zero);
+
+ /* SGE tmp1, src0, 0.0 */
+ emit2(c, inst->Prev, RC_OPCODE_SGE, 0,
+ dstreg(RC_FILE_TEMPORARY, tempreg1),
+ inst->U.I.SrcReg[0], builtin_zero);
+
+ /* MUL tmp0, tmp0, src1 */
+ emit2(c, inst->Prev, RC_OPCODE_MUL, 0,
+ dstreg(RC_FILE_TEMPORARY, tempreg0),
+ srcreg(RC_FILE_TEMPORARY, tempreg0), inst->U.I.SrcReg[1]);
+
+ /* MAD dst, src2, tmp1, tmp0 */
+ emit3(c, inst->Prev, RC_OPCODE_MAD, inst->U.I.SaturateMode,
+ inst->U.I.DstReg,
+ inst->U.I.SrcReg[2], srcreg(RC_FILE_TEMPORARY, tempreg1), srcreg(RC_FILE_TEMPORARY, tempreg0));
+
+ rc_remove_instruction(inst);
+}
+
/**
* For use with radeonLocalTransform, this transforms non-native ALU
* instructions of the r300 up to r500 vertex engine.
@@ -517,6 +557,7 @@ int r300_transform_vertex_alu(
{
switch(inst->U.I.Opcode) {
case RC_OPCODE_ABS: transform_r300_vertex_ABS(c, inst); return 1;
+ case RC_OPCODE_CMP: transform_r300_vertex_CMP(c, inst); return 1;
case RC_OPCODE_DP3: transform_DP3(c, inst); return 1;
case RC_OPCODE_DPH: transform_DPH(c, inst); return 1;
case RC_OPCODE_FLR: transform_FLR(c, inst); return 1;
diff --git a/src/mesa/drivers/dri/r300/r300_blit.c b/src/mesa/drivers/dri/r300/r300_blit.c
index d870c7f852..fa60628a5e 100644
--- a/src/mesa/drivers/dri/r300/r300_blit.c
+++ b/src/mesa/drivers/dri/r300/r300_blit.c
@@ -582,12 +582,6 @@ unsigned r300_blit(GLcontext *ctx,
if (dst_pitch % 2 > 0)
++dst_pitch;
- /* Rendering to small buffer doesn't work.
- * Looks like a hw limitation.
- */
- if (dst_pitch < 32)
- return 0;
-
/* Need to clamp the region size to make sure
* we don't read outside of the source buffer
* or write outside of the destination buffer.
diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c
index 788dc2f16e..c40802aec6 100644
--- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c
+++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c
@@ -360,36 +360,37 @@ void r300_emit_cb_setup(struct r300_context *r300,
assert(offset % 32 == 0);
switch (format) {
- case MESA_FORMAT_RGB565:
- assert(_mesa_little_endian());
- cbpitch |= R300_COLOR_FORMAT_RGB565;
+ case MESA_FORMAT_SL8:
+ case MESA_FORMAT_A8:
+ case MESA_FORMAT_L8:
+ case MESA_FORMAT_I8:
+ cbpitch |= R300_COLOR_FORMAT_I8;
break;
+ case MESA_FORMAT_RGB565:
case MESA_FORMAT_RGB565_REV:
- assert(!_mesa_little_endian());
cbpitch |= R300_COLOR_FORMAT_RGB565;
break;
case MESA_FORMAT_ARGB4444:
- assert(_mesa_little_endian());
- cbpitch |= R300_COLOR_FORMAT_ARGB4444;
- break;
case MESA_FORMAT_ARGB4444_REV:
- assert(!_mesa_little_endian());
cbpitch |= R300_COLOR_FORMAT_ARGB4444;
break;
+ case MESA_FORMAT_RGBA5551:
case MESA_FORMAT_ARGB1555:
- assert(_mesa_little_endian());
- cbpitch |= R300_COLOR_FORMAT_ARGB1555;
- break;
case MESA_FORMAT_ARGB1555_REV:
- assert(!_mesa_little_endian());
cbpitch |= R300_COLOR_FORMAT_ARGB1555;
break;
+ case MESA_FORMAT_RGBA8888:
+ case MESA_FORMAT_RGBA8888_REV:
+ case MESA_FORMAT_XRGB8888:
+ case MESA_FORMAT_ARGB8888:
+ case MESA_FORMAT_XRGB8888_REV:
+ case MESA_FORMAT_ARGB8888_REV:
+ case MESA_FORMAT_SRGBA8:
+ case MESA_FORMAT_SARGB8:
+ cbpitch |= R300_COLOR_FORMAT_ARGB8888;
+ break;
default:
- if (cpp == 4) {
- cbpitch |= R300_COLOR_FORMAT_ARGB8888;
- } else {
- _mesa_problem(r300->radeon.glCtx, "unexpected format in emit_cb_offset()");;
- }
+ _mesa_problem(r300->radeon.glCtx, "unexpected format in emit_cb_offset()");
break;
}
diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c
index ff35cd5275..cfeb5407e9 100644
--- a/src/mesa/drivers/dri/r300/r300_context.c
+++ b/src/mesa/drivers/dri/r300/r300_context.c
@@ -321,6 +321,12 @@ static void r300_init_vtbl(radeonContextPtr radeon)
radeon->vtbl.check_blit = r300_check_blit;
radeon->vtbl.blit = r300_blit;
+
+ if (radeon->radeonScreen->chip_family >= CHIP_FAMILY_RV515) {
+ radeon->vtbl.is_format_renderable = r500IsFormatRenderable;
+ } else {
+ radeon->vtbl.is_format_renderable = r300IsFormatRenderable;
+ }
}
static void r300InitConstValues(GLcontext *ctx, radeonScreenPtr screen)
@@ -494,7 +500,7 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
_mesa_init_driver_functions(&functions);
r300InitIoctlFuncs(&functions);
- r300InitStateFuncs(&functions);
+ r300InitStateFuncs(&r300->radeon, &functions);
r300InitTextureFuncs(&r300->radeon, &functions);
r300InitShaderFuncs(&functions);
radeonInitQueryObjFunctions(&functions);
diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c
index 5979dedac4..e660b1fb3b 100644
--- a/src/mesa/drivers/dri/r300/r300_state.c
+++ b/src/mesa/drivers/dri/r300/r300_state.c
@@ -46,6 +46,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "main/simple_list.h"
#include "main/api_arrayelt.h"
+#include "drivers/common/meta.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "shader/prog_parameter.h"
@@ -589,7 +590,7 @@ static void r300SetDepthState(GLcontext * ctx)
R500_STENCIL_REFMASK_FRONT_BACK);
r300->hw.zs.cmd[R300_ZS_CNTL_1] &= ~(R300_ZS_MASK << R300_Z_FUNC_SHIFT);
- if (ctx->Depth.Test) {
+ if (ctx->Depth.Test && ctx->DrawBuffer->_DepthBuffer) {
r300->hw.zs.cmd[R300_ZS_CNTL_0] |= R300_Z_ENABLE;
if (ctx->Depth.Mask)
r300->hw.zs.cmd[R300_ZS_CNTL_0] |= R300_Z_WRITE_ENABLE;
@@ -2237,6 +2238,68 @@ void r300UpdateShaderStates(r300ContextPtr rmesa)
}
}
+#define EASY_US_OUT_FMT(comps, c0, c1, c2, c3) \
+ (R500_OUT_FMT_##comps | R500_C0_SEL_##c0 | R500_C1_SEL_##c1 | \
+ R500_C2_SEL_##c2 | R500_C3_SEL_##c3)
+static void r300SetupUsOutputFormat(GLcontext *ctx)
+{
+ r300ContextPtr rmesa = R300_CONTEXT(ctx);
+ uint32_t hw_format;
+ struct radeon_renderbuffer *rrb = radeon_get_colorbuffer(&rmesa->radeon);
+
+ if (!rrb) {
+ return;
+ }
+
+ switch (rrb->base.Format)
+ {
+ case MESA_FORMAT_RGBA5551:
+ case MESA_FORMAT_RGBA8888:
+ hw_format = EASY_US_OUT_FMT(C4_8, A, B, G, R);
+ break;
+ case MESA_FORMAT_RGB565_REV:
+ case MESA_FORMAT_RGBA8888_REV:
+ hw_format = EASY_US_OUT_FMT(C4_8, R, G, B, A);
+ break;
+ case MESA_FORMAT_RGB565:
+ case MESA_FORMAT_ARGB4444:
+ case MESA_FORMAT_ARGB1555:
+ case MESA_FORMAT_XRGB8888:
+ case MESA_FORMAT_ARGB8888:
+ hw_format = EASY_US_OUT_FMT(C4_8, B, G, R, A);
+ break;
+ case MESA_FORMAT_ARGB4444_REV:
+ case MESA_FORMAT_ARGB1555_REV:
+ case MESA_FORMAT_XRGB8888_REV:
+ case MESA_FORMAT_ARGB8888_REV:
+ hw_format = EASY_US_OUT_FMT(C4_8, A, R, G, B);
+ break;
+ case MESA_FORMAT_SRGBA8:
+ hw_format = EASY_US_OUT_FMT(C4_10_GAMMA, A, B, G, R);
+ break;
+ case MESA_FORMAT_SARGB8:
+ hw_format = EASY_US_OUT_FMT(C4_10_GAMMA, B, G, R, A);
+ break;
+ case MESA_FORMAT_SL8:
+ hw_format = EASY_US_OUT_FMT(C4_10_GAMMA, A, A, R, A);
+ break;
+ case MESA_FORMAT_A8:
+ hw_format = EASY_US_OUT_FMT(C4_8, A, A, A, A);
+ break;
+ case MESA_FORMAT_L8:
+ case MESA_FORMAT_I8:
+ hw_format = EASY_US_OUT_FMT(C4_8, A, A, R, A);
+ break;
+ default:
+ assert(!"Unsupported format");
+ break;
+ }
+
+ R300_STATECHANGE(rmesa, us_out_fmt);
+ rmesa->hw.us_out_fmt.cmd[1] = hw_format;
+}
+#undef EASY_US_OUT_FMT
+
/**
* Called by Mesa after an internal state update.
*/
@@ -2266,6 +2329,10 @@ static void r300InvalidateState(GLcontext * ctx, GLuint new_state)
r300->hw.shade2.cmd[1] &= ~R300_GA_COLOR_CONTROL_PROVOKING_VERTEX_LAST;
}
+ if (new_state & _NEW_BUFFERS) {
+ r300SetupUsOutputFormat(ctx);
+ }
+
r300->radeon.NewGLState |= new_state;
}
@@ -2287,7 +2354,7 @@ static void r300RenderMode(GLcontext * ctx, GLenum mode)
/**
* Initialize driver's state callback functions
*/
-void r300InitStateFuncs(struct dd_function_table *functions)
+void r300InitStateFuncs(radeonContextPtr radeon, struct dd_function_table *functions)
{
functions->UpdateState = r300InvalidateState;
@@ -2326,8 +2393,13 @@ void r300InitStateFuncs(struct dd_function_table *functions)
functions->ClipPlane = r300ClipPlane;
functions->Scissor = radeonScissor;
- functions->DrawBuffer = radeonDrawBuffer;
- functions->ReadBuffer = radeonReadBuffer;
+ functions->DrawBuffer = radeonDrawBuffer;
+ functions->ReadBuffer = radeonReadBuffer;
+
+ functions->CopyPixels = _mesa_meta_CopyPixels;
+ functions->DrawPixels = _mesa_meta_DrawPixels;
+ if (radeon->radeonScreen->kernel_mm)
+ functions->ReadPixels = radeonReadPixels;
}
void r300InitShaderFunctions(r300ContextPtr r300)
diff --git a/src/mesa/drivers/dri/r300/r300_state.h b/src/mesa/drivers/dri/r300/r300_state.h
index d46bf9f179..e70f84f4e4 100644
--- a/src/mesa/drivers/dri/r300/r300_state.h
+++ b/src/mesa/drivers/dri/r300/r300_state.h
@@ -55,7 +55,7 @@ void r300UpdateDrawBuffer (GLcontext * ctx);
void r300UpdateShaders (r300ContextPtr rmesa);
void r300UpdateShaderStates (r300ContextPtr rmesa);
void r300InitState (r300ContextPtr r300);
-void r300InitStateFuncs (struct dd_function_table *functions);
+void r300InitStateFuncs (radeonContextPtr radeon, struct dd_function_table *functions);
void r300VapCntl(r300ContextPtr rmesa, GLuint input_count, GLuint output_count, GLuint temp_count);
void r300SetupVAP(GLcontext *ctx, GLuint InputsRead, GLuint OutputsWritten);
diff --git a/src/mesa/drivers/dri/r300/r300_tex.c b/src/mesa/drivers/dri/r300/r300_tex.c
index 8dd8507395..baef206bc2 100644
--- a/src/mesa/drivers/dri/r300/r300_tex.c
+++ b/src/mesa/drivers/dri/r300/r300_tex.c
@@ -308,6 +308,45 @@ static struct gl_texture_object *r300NewTextureObject(GLcontext * ctx,
return &t->base;
}
+unsigned r300IsFormatRenderable(gl_format mesa_format)
+{
+ switch (mesa_format)
+ {
+ case MESA_FORMAT_RGB565:
+ case MESA_FORMAT_RGBA5551:
+ case MESA_FORMAT_RGBA8888:
+ case MESA_FORMAT_RGB565_REV:
+ case MESA_FORMAT_RGBA8888_REV:
+ case MESA_FORMAT_ARGB4444:
+ case MESA_FORMAT_ARGB1555:
+ case MESA_FORMAT_XRGB8888:
+ case MESA_FORMAT_ARGB8888:
+ case MESA_FORMAT_ARGB4444_REV:
+ case MESA_FORMAT_ARGB1555_REV:
+ case MESA_FORMAT_XRGB8888_REV:
+ case MESA_FORMAT_ARGB8888_REV:
+ case MESA_FORMAT_SRGBA8:
+ case MESA_FORMAT_SARGB8:
+ case MESA_FORMAT_SL8:
+ case MESA_FORMAT_A8:
+ case MESA_FORMAT_L8:
+ case MESA_FORMAT_I8:
+ case MESA_FORMAT_Z16:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+unsigned r500IsFormatRenderable(gl_format mesa_format)
+{
+ if (mesa_format == MESA_FORMAT_S8_Z24) {
+ return 1;
+ } else {
+ return r300IsFormatRenderable(mesa_format);
+ }
+}
+
void r300InitTextureFuncs(radeonContextPtr radeon, struct dd_function_table *functions)
{
/* Note: we only plug in the functions we implement in the driver
diff --git a/src/mesa/drivers/dri/r300/r300_tex.h b/src/mesa/drivers/dri/r300/r300_tex.h
index 9694e703b8..aca44cd766 100644
--- a/src/mesa/drivers/dri/r300/r300_tex.h
+++ b/src/mesa/drivers/dri/r300/r300_tex.h
@@ -53,4 +53,7 @@ extern void r300InitTextureFuncs(radeonContextPtr radeon, struct dd_function_tab
int32_t r300TranslateTexFormat(gl_format mesaFormat);
+unsigned r300IsFormatRenderable(gl_format mesaFormat);
+unsigned r500IsFormatRenderable(gl_format mesaFormat);
+
#endif /* __r300_TEX_H__ */
diff --git a/src/mesa/drivers/dri/r300/radeon_pixel_read.c b/src/mesa/drivers/dri/r300/radeon_pixel_read.c
new file mode 120000
index 0000000000..3b03803126
--- /dev/null
+++ b/src/mesa/drivers/dri/r300/radeon_pixel_read.c
@@ -0,0 +1 @@
+../radeon/radeon_pixel_read.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r300/radeon_tex_getimage.c b/src/mesa/drivers/dri/r300/radeon_tex_getimage.c
new file mode 120000
index 0000000000..d9836d7326
--- /dev/null
+++ b/src/mesa/drivers/dri/r300/radeon_tex_getimage.c
@@ -0,0 +1 @@
+../radeon/radeon_tex_getimage.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r300/radeon_tile.c b/src/mesa/drivers/dri/r300/radeon_tile.c
new file mode 120000
index 0000000000..d4bfe27da6
--- /dev/null
+++ b/src/mesa/drivers/dri/r300/radeon_tile.c
@@ -0,0 +1 @@
+../radeon/radeon_tile.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r300/radeon_tile.h b/src/mesa/drivers/dri/r300/radeon_tile.h
new file mode 120000
index 0000000000..31074c581e
--- /dev/null
+++ b/src/mesa/drivers/dri/r300/radeon_tile.h
@@ -0,0 +1 @@
+../radeon/radeon_tile.h \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r300/server/radeon_dri.c b/src/mesa/drivers/dri/r300/server/radeon_dri.c
deleted file mode 120000
index d05847d650..0000000000
--- a/src/mesa/drivers/dri/r300/server/radeon_dri.c
+++ /dev/null
@@ -1 +0,0 @@
-../../radeon/server/radeon_dri.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r600/Makefile b/src/mesa/drivers/dri/r600/Makefile
index 5d50941539..17915621ee 100644
--- a/src/mesa/drivers/dri/r600/Makefile
+++ b/src/mesa/drivers/dri/r600/Makefile
@@ -7,8 +7,6 @@ CFLAGS += $(RADEON_CFLAGS)
LIBNAME = r600_dri.so
-MINIGLX_SOURCES = server/radeon_dri.c
-
ifeq ($(RADEON_LDFLAGS),)
CS_SOURCES = radeon_cs_space_drm.c radeon_bo.c radeon_cs.c
endif
@@ -33,10 +31,13 @@ RADEON_COMMON_SOURCES = \
radeon_fbo.c \
radeon_lock.c \
radeon_mipmap_tree.c \
+ radeon_pixel_read.c \
+ radeon_queryobj.c \
radeon_span.c \
radeon_texture.c \
- radeon_queryobj.c \
- radeon_tex_copy.c
+ radeon_tex_copy.c \
+ radeon_tex_getimage.c \
+ radeon_tile.c
DRIVER_SOURCES = \
radeon_screen.c \
diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c
index 134e97e7c3..fddac2f9bd 100644
--- a/src/mesa/drivers/dri/r600/r600_context.c
+++ b/src/mesa/drivers/dri/r600/r600_context.c
@@ -239,6 +239,7 @@ static void r600_init_vtbl(radeonContextPtr radeon)
radeon->vtbl.emit_query_finish = r600_emit_query_finish;
radeon->vtbl.check_blit = r600_check_blit;
radeon->vtbl.blit = r600_blit;
+ radeon->vtbl.is_format_renderable = radeonIsFormatRenderable;
}
static void r600InitConstValues(GLcontext *ctx, radeonScreenPtr screen)
@@ -383,7 +384,7 @@ GLboolean r600CreateContext(const __GLcontextModes * glVisual,
*/
_mesa_init_driver_functions(&functions);
- r700InitStateFuncs(&functions);
+ r700InitStateFuncs(&r600->radeon, &functions);
r600InitTextureFuncs(&r600->radeon, &functions);
r700InitShaderFuncs(&functions);
radeonInitQueryObjFunctions(&functions);
diff --git a/src/mesa/drivers/dri/r600/r700_state.c b/src/mesa/drivers/dri/r600/r700_state.c
index 12eaebbc16..1da31e7b2b 100644
--- a/src/mesa/drivers/dri/r600/r700_state.c
+++ b/src/mesa/drivers/dri/r600/r700_state.c
@@ -39,6 +39,7 @@
#include "swrast_setup/swrast_setup.h"
#include "main/api_arrayelt.h"
#include "main/framebuffer.h"
+#include "drivers/common/meta.h"
#include "shader/prog_parameter.h"
#include "shader/prog_statevars.h"
@@ -1816,7 +1817,7 @@ void r700InitState(GLcontext * ctx) //-------------------
}
-void r700InitStateFuncs(struct dd_function_table *functions) //-----------------
+void r700InitStateFuncs(radeonContextPtr radeon, struct dd_function_table *functions)
{
functions->UpdateState = r700InvalidateState;
functions->AlphaFunc = r700AlphaFunc;
@@ -1857,8 +1858,12 @@ void r700InitStateFuncs(struct dd_function_table *functions) //-----------------
functions->Scissor = radeonScissor;
- functions->DrawBuffer = radeonDrawBuffer;
- functions->ReadBuffer = radeonReadBuffer;
+ functions->DrawBuffer = radeonDrawBuffer;
+ functions->ReadBuffer = radeonReadBuffer;
+ functions->CopyPixels = _mesa_meta_CopyPixels;
+ functions->DrawPixels = _mesa_meta_DrawPixels;
+ if (radeon->radeonScreen->kernel_mm)
+ functions->ReadPixels = radeonReadPixels;
}
diff --git a/src/mesa/drivers/dri/r600/r700_state.h b/src/mesa/drivers/dri/r600/r700_state.h
index 60c6a7f23c..56885e0b15 100644
--- a/src/mesa/drivers/dri/r600/r700_state.h
+++ b/src/mesa/drivers/dri/r600/r700_state.h
@@ -40,7 +40,7 @@ extern void r700UpdateShaderStates(GLcontext * ctx);
extern void r700UpdateViewportOffset(GLcontext * ctx);
extern void r700InitState (GLcontext * ctx);
-extern void r700InitStateFuncs (struct dd_function_table *functions);
+extern void r700InitStateFuncs (radeonContextPtr radeon, struct dd_function_table *functions);
extern void r700SetScissor(context_t *context);
diff --git a/src/mesa/drivers/dri/r600/radeon_pixel_read.c b/src/mesa/drivers/dri/r600/radeon_pixel_read.c
new file mode 120000
index 0000000000..3b03803126
--- /dev/null
+++ b/src/mesa/drivers/dri/r600/radeon_pixel_read.c
@@ -0,0 +1 @@
+../radeon/radeon_pixel_read.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r600/radeon_tex_getimage.c b/src/mesa/drivers/dri/r600/radeon_tex_getimage.c
new file mode 120000
index 0000000000..d9836d7326
--- /dev/null
+++ b/src/mesa/drivers/dri/r600/radeon_tex_getimage.c
@@ -0,0 +1 @@
+../radeon/radeon_tex_getimage.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r600/radeon_tile.c b/src/mesa/drivers/dri/r600/radeon_tile.c
new file mode 120000
index 0000000000..d4bfe27da6
--- /dev/null
+++ b/src/mesa/drivers/dri/r600/radeon_tile.c
@@ -0,0 +1 @@
+../radeon/radeon_tile.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r600/radeon_tile.h b/src/mesa/drivers/dri/r600/radeon_tile.h
new file mode 120000
index 0000000000..31074c581e
--- /dev/null
+++ b/src/mesa/drivers/dri/r600/radeon_tile.h
@@ -0,0 +1 @@
+../radeon/radeon_tile.h \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r600/server/radeon_dri.c b/src/mesa/drivers/dri/r600/server/radeon_dri.c
deleted file mode 120000
index d05847d650..0000000000
--- a/src/mesa/drivers/dri/r600/server/radeon_dri.c
+++ /dev/null
@@ -1 +0,0 @@
-../../radeon/server/radeon_dri.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/radeon/Makefile b/src/mesa/drivers/dri/radeon/Makefile
index a54ea16ec6..19df62742e 100644
--- a/src/mesa/drivers/dri/radeon/Makefile
+++ b/src/mesa/drivers/dri/radeon/Makefile
@@ -8,8 +8,6 @@ CFLAGS += $(RADEON_CFLAGS)
LIBNAME = radeon_dri.so
-MINIGLX_SOURCES = server/radeon_dri.c
-
ifeq ($(RADEON_LDFLAGS),)
CS_SOURCES = radeon_cs_space_drm.c radeon_bo.c radeon_cs.c
endif
@@ -24,10 +22,13 @@ RADEON_COMMON_SOURCES = \
radeon_fbo.c \
radeon_lock.c \
radeon_mipmap_tree.c \
+ radeon_pixel_read.c \
radeon_queryobj.c \
radeon_span.c \
radeon_texture.c \
- radeon_tex_copy.c
+ radeon_tex_copy.c \
+ radeon_tex_getimage.c \
+ radeon_tile.c
DRIVER_SOURCES = \
radeon_context.c \
diff --git a/src/mesa/drivers/dri/radeon/radeon_blit.c b/src/mesa/drivers/dri/radeon/radeon_blit.c
index e1e1f21550..143822361e 100644
--- a/src/mesa/drivers/dri/radeon/radeon_blit.c
+++ b/src/mesa/drivers/dri/radeon/radeon_blit.c
@@ -48,6 +48,8 @@ unsigned r100_check_blit(gl_format mesa_format)
case MESA_FORMAT_ARGB4444:
case MESA_FORMAT_ARGB1555:
case MESA_FORMAT_A8:
+ case MESA_FORMAT_L8:
+ case MESA_FORMAT_I8:
break;
default:
return 0;
@@ -103,6 +105,9 @@ static void inline emit_tx_setup(struct r100_context *r100,
case MESA_FORMAT_ARGB8888:
txformat |= RADEON_TXFORMAT_ARGB8888 | RADEON_TXFORMAT_ALPHA_IN_MAP;
break;
+ case MESA_FORMAT_RGBA8888:
+ txformat |= RADEON_TXFORMAT_RGBA8888 | RADEON_TXFORMAT_ALPHA_IN_MAP;
+ break;
case MESA_FORMAT_XRGB8888:
txformat |= RADEON_TXFORMAT_ARGB8888;
break;
@@ -116,8 +121,15 @@ static void inline emit_tx_setup(struct r100_context *r100,
txformat |= RADEON_TXFORMAT_ARGB1555 | RADEON_TXFORMAT_ALPHA_IN_MAP;
break;
case MESA_FORMAT_A8:
+ case MESA_FORMAT_I8:
txformat |= RADEON_TXFORMAT_I8 | RADEON_TXFORMAT_ALPHA_IN_MAP;
break;
+ case MESA_FORMAT_L8:
+ txformat |= RADEON_TXFORMAT_I8;
+ break;
+ case MESA_FORMAT_AL88:
+ txformat |= RADEON_TXFORMAT_AI88 | RADEON_TXFORMAT_ALPHA_IN_MAP;
+ break;
default:
break;
}
@@ -177,6 +189,8 @@ static inline void emit_cb_setup(struct r100_context *r100,
dst_format = RADEON_COLOR_FORMAT_ARGB1555;
break;
case MESA_FORMAT_A8:
+ case MESA_FORMAT_L8:
+ case MESA_FORMAT_I8:
dst_format = RADEON_COLOR_FORMAT_RGB8;
break;
default:
diff --git a/src/mesa/drivers/dri/radeon/radeon_common.h b/src/mesa/drivers/dri/radeon/radeon_common.h
index cd01c9984e..35b3f08fff 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common.h
+++ b/src/mesa/drivers/dri/radeon/radeon_common.h
@@ -44,6 +44,12 @@ radeon_renderbuffer_set_bo(struct radeon_renderbuffer *rb,
struct radeon_renderbuffer *
radeon_create_renderbuffer(gl_format format, __DRIdrawable *driDrawPriv);
+void
+radeonReadPixels(GLcontext * ctx,
+ GLint x, GLint y, GLsizei width, GLsizei height,
+ GLenum format, GLenum type,
+ const struct gl_pixelstore_attrib *pack, GLvoid * pixels);
+
void radeon_check_front_buffer_rendering(GLcontext *ctx);
static inline struct radeon_renderbuffer *radeon_renderbuffer(struct gl_renderbuffer *rb)
{
diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.h b/src/mesa/drivers/dri/radeon/radeon_common_context.h
index d1a24e265f..5156c5d0d0 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common_context.h
+++ b/src/mesa/drivers/dri/radeon/radeon_common_context.h
@@ -539,6 +539,7 @@ struct radeon_context {
unsigned reg_width,
unsigned reg_height,
unsigned flip_y);
+ unsigned (*is_format_renderable)(gl_format mesa_format);
} vtbl;
};
diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c
index 878a453bd5..56aba16e9e 100644
--- a/src/mesa/drivers/dri/radeon/radeon_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_context.c
@@ -200,6 +200,7 @@ static void r100_init_vtbl(radeonContextPtr radeon)
radeon->vtbl.emit_query_finish = r100_emit_query_finish;
radeon->vtbl.check_blit = r100_check_blit;
radeon->vtbl.blit = r100_blit;
+ radeon->vtbl.is_format_renderable = radeonIsFormatRenderable;
}
/* Create the device specific context.
diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c
index 46664a1755..6398605835 100644
--- a/src/mesa/drivers/dri/radeon/radeon_fbo.c
+++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c
@@ -409,82 +409,51 @@ radeon_framebuffer_renderbuffer(GLcontext * ctx,
radeon_draw_buffer(ctx, fb);
}
-
-/* TODO: According to EXT_fbo spec internal format of texture image
- * once set during glTexImage call, should be preserved when
- * attaching image to renderbuffer. When HW doesn't support
- * rendering to format of attached image, set framebuffer
- * completeness accordingly in radeon_validate_framebuffer (issue #79).
- */
static GLboolean
radeon_update_wrapper(GLcontext *ctx, struct radeon_renderbuffer *rrb,
struct gl_texture_image *texImage)
{
- int retry = 0;
- gl_format texFormat;
-
radeon_print(RADEON_TEXTURE, RADEON_TRACE,
- "%s(%p, rrb %p, texImage %p) \n",
- __func__, ctx, rrb, texImage);
-
-restart:
- if (texImage->TexFormat == _dri_texformat_argb8888) {
- rrb->base.DataType = GL_UNSIGNED_BYTE;
- DBG("Render to RGBA8 texture OK\n");
+ "%s(%p, rrb %p, texImage %p, texFormat %s) \n",
+ __func__, ctx, rrb, texImage, _mesa_get_format_name(texImage->TexFormat));
+
+ switch (texImage->TexFormat) {
+ case MESA_FORMAT_RGBA8888:
+ case MESA_FORMAT_RGBA8888_REV:
+ case MESA_FORMAT_ARGB8888:
+ case MESA_FORMAT_ARGB8888_REV:
+ case MESA_FORMAT_XRGB8888:
+ case MESA_FORMAT_XRGB8888_REV:
+ case MESA_FORMAT_RGB565:
+ case MESA_FORMAT_RGB565_REV:
+ case MESA_FORMAT_RGBA5551:
+ case MESA_FORMAT_ARGB1555:
+ case MESA_FORMAT_ARGB1555_REV:
+ case MESA_FORMAT_ARGB4444:
+ case MESA_FORMAT_ARGB4444_REV:
+ rrb->base.DataType = GL_UNSIGNED_BYTE;
+ break;
+ case MESA_FORMAT_Z16:
+ rrb->base.DataType = GL_UNSIGNED_SHORT;
+ break;
+ case MESA_FORMAT_X8_Z24:
+ rrb->base.DataType = GL_UNSIGNED_INT;
+ break;
+ case MESA_FORMAT_S8_Z24:
+ rrb->base.DataType = GL_UNSIGNED_INT_24_8_EXT;
+ break;
}
- else if (texImage->TexFormat == _dri_texformat_rgb565) {
- rrb->base.DataType = GL_UNSIGNED_BYTE;
- DBG("Render to RGB5 texture OK\n");
- }
- else if (texImage->TexFormat == _dri_texformat_argb1555) {
- rrb->base.DataType = GL_UNSIGNED_BYTE;
- DBG("Render to ARGB1555 texture OK\n");
- }
- else if (texImage->TexFormat == _dri_texformat_argb4444) {
- rrb->base.DataType = GL_UNSIGNED_BYTE;
- DBG("Render to ARGB4444 texture OK\n");
- }
- else if (texImage->TexFormat == MESA_FORMAT_Z16) {
- rrb->base.DataType = GL_UNSIGNED_SHORT;
- DBG("Render to DEPTH16 texture OK\n");
- }
- else if (texImage->TexFormat == MESA_FORMAT_S8_Z24) {
- rrb->base.DataType = GL_UNSIGNED_INT_24_8_EXT;
- DBG("Render to DEPTH_STENCIL texture OK\n");
- }
- else {
- /* try redoing the FBO */
- if (retry == 1) {
- DBG("Render to texture BAD FORMAT %d\n",
- texImage->TexFormat);
- return GL_FALSE;
- }
- /* XXX why is the tex format being set here?
- * I think this can be removed.
- */
- texImage->TexFormat = radeonChooseTextureFormat(ctx, texImage->InternalFormat, 0,
- _mesa_get_format_datatype(texImage->TexFormat),
- 1);
-
- retry++;
- goto restart;
- }
-
- texFormat = texImage->TexFormat;
-
- rrb->base.Format = texFormat;
-
- rrb->cpp = _mesa_get_format_bytes(texFormat);
+
+ rrb->cpp = _mesa_get_format_bytes(texImage->TexFormat);
rrb->pitch = texImage->Width * rrb->cpp;
+ rrb->base.Format = texImage->TexFormat;
rrb->base.InternalFormat = texImage->InternalFormat;
- rrb->base._BaseFormat = _mesa_base_fbo_format(ctx, rrb->base.InternalFormat);
-
+ rrb->base._BaseFormat = _mesa_base_fbo_format(ctx, rrb->base.InternalFormat);
rrb->base.Width = texImage->Width;
rrb->base.Height = texImage->Height;
-
rrb->base.Delete = radeon_delete_renderbuffer;
rrb->base.AllocStorage = radeon_nop_alloc_storage;
-
+
return GL_TRUE;
}
@@ -607,6 +576,35 @@ radeon_finish_render_texture(GLcontext * ctx,
static void
radeon_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb)
{
+ radeonContextPtr radeon = RADEON_CONTEXT(ctx);
+ gl_format mesa_format;
+ int i;
+
+ for (i = -2; i < (GLint) ctx->Const.MaxColorAttachments; i++) {
+ struct gl_renderbuffer_attachment *att;
+ if (i == -2) {
+ att = &fb->Attachment[BUFFER_DEPTH];
+ } else if (i == -1) {
+ att = &fb->Attachment[BUFFER_STENCIL];
+ } else {
+ att = &fb->Attachment[BUFFER_COLOR0 + i];
+ }
+
+ if (att->Type == GL_TEXTURE) {
+ mesa_format = att->Texture->Image[att->CubeMapFace][att->TextureLevel]->TexFormat;
+ } else {
+ /* All renderbuffer formats are renderable, but not sampable */
+ continue;
+ }
+
+ if (!radeon->vtbl.is_format_renderable(mesa_format)){
+ fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED;
+ radeon_print(RADEON_TEXTURE, RADEON_TRACE,
+ "%s: HW doesn't support format %s as output format of attachment %d\n",
+ __FUNCTION__, _mesa_get_format_name(mesa_format), i);
+ return;
+ }
+ }
}
void radeon_fbo_init(struct radeon_context *radeon)
diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
index e0e271b771..7f5fb99fa4 100644
--- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
+++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
@@ -36,6 +36,7 @@
#include "main/texobj.h"
#include "main/enums.h"
#include "radeon_texture.h"
+#include "radeon_tile.h"
static unsigned get_aligned_compressed_row_stride(
gl_format format,
@@ -69,16 +70,51 @@ static unsigned get_aligned_compressed_row_stride(
return stride;
}
-static unsigned get_compressed_image_size(
+unsigned get_texture_image_size(
gl_format format,
unsigned rowStride,
- unsigned height)
+ unsigned height,
+ unsigned depth,
+ unsigned tiling)
{
- unsigned blockWidth, blockHeight;
+ if (_mesa_is_format_compressed(format)) {
+ unsigned blockWidth, blockHeight;
- _mesa_get_format_block_size(format, &blockWidth, &blockHeight);
+ _mesa_get_format_block_size(format, &blockWidth, &blockHeight);
+
+ return rowStride * ((height + blockHeight - 1) / blockHeight) * depth;
+ } else if (tiling) {
+ /* Need to align height to tile height */
+ unsigned tileWidth, tileHeight;
- return rowStride * ((height + blockHeight - 1) / blockHeight);
+ get_tile_size(format, &tileWidth, &tileHeight);
+ tileHeight--;
+
+ height = (height + tileHeight) & ~tileHeight;
+ }
+
+ return rowStride * height * depth;
+}
+
+unsigned get_texture_image_row_stride(radeonContextPtr rmesa, gl_format format, unsigned width, unsigned tiling)
+{
+ if (_mesa_is_format_compressed(format)) {
+ return get_aligned_compressed_row_stride(format, width, rmesa->texture_compressed_row_align);
+ } else {
+ unsigned row_align;
+
+ if (!_mesa_is_pow_two(width)) {
+ row_align = rmesa->texture_rect_row_align - 1;
+ } else if (tiling) {
+ unsigned tileWidth, tileHeight;
+ get_tile_size(format, &tileWidth, &tileHeight);
+ row_align = tileWidth * _mesa_get_format_bytes(format) - 1;
+ } else {
+ row_align = rmesa->texture_row_align - 1;
+ }
+
+ return (_mesa_format_row_stride(format, width) + row_align) & ~row_align;
+ }
}
/**
@@ -92,34 +128,15 @@ static void compute_tex_image_offset(radeonContextPtr rmesa, radeon_mipmap_tree
GLuint face, GLuint level, GLuint* curOffset)
{
radeon_mipmap_level *lvl = &mt->levels[level];
- uint32_t row_align;
GLuint height;
height = _mesa_next_pow_two_32(lvl->height);
- /* Find image size in bytes */
- if (_mesa_is_format_compressed(mt->mesaFormat)) {
- lvl->rowstride = get_aligned_compressed_row_stride(mt->mesaFormat, lvl->width, rmesa->texture_compressed_row_align);
- lvl->size = get_compressed_image_size(mt->mesaFormat, lvl->rowstride, height);
- } else if (mt->target == GL_TEXTURE_RECTANGLE_NV) {
- row_align = rmesa->texture_rect_row_align - 1;
- lvl->rowstride = (_mesa_format_row_stride(mt->mesaFormat, lvl->width) + row_align) & ~row_align;
- lvl->size = lvl->rowstride * height;
- } else if (mt->tilebits & RADEON_TXO_MICRO_TILE) {
- /* tile pattern is 16 bytes x2. mipmaps stay 32 byte aligned,
- * though the actual offset may be different (if texture is less than
- * 32 bytes width) to the untiled case */
- lvl->rowstride = (_mesa_format_row_stride(mt->mesaFormat, lvl->width) * 2 + 31) & ~31;
- lvl->size = lvl->rowstride * ((height + 1) / 2) * lvl->depth;
- } else {
- row_align = rmesa->texture_row_align - 1;
- lvl->rowstride = (_mesa_format_row_stride(mt->mesaFormat, lvl->width) + row_align) & ~row_align;
- lvl->size = lvl->rowstride * height * lvl->depth;
- }
+ lvl->rowstride = get_texture_image_row_stride(rmesa, mt->mesaFormat, lvl->width, mt->tilebits);
+ lvl->size = get_texture_image_size(mt->mesaFormat, lvl->rowstride, lvl->height, lvl->depth, mt->tilebits);
+
assert(lvl->size > 0);
- /* All images are aligned to a 32-byte offset */
- *curOffset = (*curOffset + 0x1f) & ~0x1f;
lvl->faces[face].offset = *curOffset;
*curOffset += lvl->size;
@@ -451,12 +468,9 @@ static void migrate_image_to_miptree(radeon_mipmap_tree *mt,
radeon_mipmap_level *srclvl = &image->mt->levels[image->mtlevel];
- /* TODO: bring back these assertions once the FBOs are fixed */
-#if 0
assert(image->mtlevel == level);
assert(srclvl->size == dstlvl->size);
assert(srclvl->rowstride == dstlvl->rowstride);
-#endif
radeon_bo_map(image->mt->bo, GL_FALSE);
diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h
index c911688c1a..088f970172 100644
--- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h
+++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h
@@ -89,4 +89,13 @@ void radeon_try_alloc_miptree(radeonContextPtr rmesa, radeonTexObj *t);
GLuint radeon_miptree_image_offset(radeon_mipmap_tree *mt,
GLuint face, GLuint level);
uint32_t get_base_teximage_offset(radeonTexObj *texObj);
+
+unsigned get_texture_image_row_stride(radeonContextPtr rmesa, gl_format format, unsigned width, unsigned tiling);
+
+unsigned get_texture_image_size(
+ gl_format format,
+ unsigned rowStride,
+ unsigned height,
+ unsigned depth,
+ unsigned tiling);
#endif /* __RADEON_MIPMAP_TREE_H_ */
diff --git a/src/mesa/drivers/dri/radeon/radeon_pixel_read.c b/src/mesa/drivers/dri/radeon/radeon_pixel_read.c
new file mode 100644
index 0000000000..dadb8002c7
--- /dev/null
+++ b/src/mesa/drivers/dri/radeon/radeon_pixel_read.c
@@ -0,0 +1,199 @@
+/*
+ * Copyright (C) 2010 Maciej Cencora <m.cencora@gmail.com>
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#include "stdint.h"
+#include "main/bufferobj.h"
+#include "main/enums.h"
+#include "main/image.h"
+#include "main/state.h"
+#include "swrast/swrast.h"
+
+#include "radeon_common_context.h"
+#include "radeon_debug.h"
+#include "radeon_mipmap_tree.h"
+
+static gl_format gl_format_and_type_to_mesa_format(GLenum format, GLenum type)
+{
+ switch (format)
+ {
+ case GL_RGB:
+ switch (type) {
+ case GL_UNSIGNED_SHORT_5_6_5:
+ return MESA_FORMAT_RGB565;
+ case GL_UNSIGNED_SHORT_5_6_5_REV:
+ return MESA_FORMAT_RGB565_REV;
+ }
+ break;
+ case GL_RGBA:
+ switch (type) {
+ case GL_FLOAT:
+ return MESA_FORMAT_RGBA_FLOAT32;
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ return MESA_FORMAT_RGBA5551;
+ case GL_UNSIGNED_INT_8_8_8_8:
+ return MESA_FORMAT_RGBA8888;
+ case GL_UNSIGNED_BYTE:
+ case GL_UNSIGNED_INT_8_8_8_8_REV:
+ return MESA_FORMAT_RGBA8888_REV;
+ }
+ break;
+ case GL_BGRA:
+ switch (type) {
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ return MESA_FORMAT_ARGB4444_REV;
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+ return MESA_FORMAT_ARGB4444;
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ return MESA_FORMAT_ARGB1555_REV;
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ return MESA_FORMAT_ARGB1555;
+ case GL_UNSIGNED_INT_8_8_8_8:
+ return MESA_FORMAT_ARGB8888_REV;
+ case GL_UNSIGNED_BYTE:
+ case GL_UNSIGNED_INT_8_8_8_8_REV:
+ return MESA_FORMAT_ARGB8888;
+
+ }
+ break;
+ }
+
+ return MESA_FORMAT_NONE;
+}
+
+static GLboolean
+do_blit_readpixels(GLcontext * ctx,
+ GLint x, GLint y, GLsizei width, GLsizei height,
+ GLenum format, GLenum type,
+ const struct gl_pixelstore_attrib *pack, GLvoid * pixels)
+{
+ radeonContextPtr radeon = RADEON_CONTEXT(ctx);
+ const struct radeon_renderbuffer *rrb = radeon_renderbuffer(ctx->ReadBuffer->_ColorReadBuffer);
+ const gl_format dst_format = gl_format_and_type_to_mesa_format(format, type);
+ unsigned dst_rowstride, dst_imagesize, aligned_rowstride, flip_y;
+ struct radeon_bo *dst_buffer;
+ GLint dst_x = 0, dst_y = 0;
+
+ /* It's not worth if number of pixels to copy is really small */
+ if (width * height < 100) {
+ return GL_FALSE;
+ }
+
+ if (dst_format == MESA_FORMAT_NONE ||
+ !radeon->vtbl.check_blit(dst_format) || !radeon->vtbl.blit) {
+ return GL_FALSE;
+ }
+
+ if (ctx->_ImageTransferState || ctx->Color._LogicOpEnabled) {
+ return GL_FALSE;
+ }
+
+ if (pack->SwapBytes || pack->LsbFirst) {
+ return GL_FALSE;
+ }
+
+ if (pack->RowLength > 0) {
+ dst_rowstride = pack->RowLength;
+ } else {
+ dst_rowstride = width;
+ }
+
+ if (!_mesa_clip_copytexsubimage(ctx, &dst_x, &dst_y, &x, &y, &width, &height)) {
+ return GL_TRUE;
+ }
+ assert(x >= 0 && y >= 0);
+
+ aligned_rowstride = get_texture_image_row_stride(radeon, dst_format, dst_rowstride, 0);
+ dst_imagesize = get_texture_image_size(dst_format,
+ aligned_rowstride,
+ height, 1, 0);
+ dst_buffer = radeon_bo_open(radeon->radeonScreen->bom, 0, dst_imagesize, 1024, RADEON_GEM_DOMAIN_GTT, 0);
+
+ /* Disable source Y flipping for FBOs */
+ flip_y = (ctx->ReadBuffer->Name == 0);
+ if (pack->Invert) {
+ y = rrb->base.Height - height - y;
+ flip_y = !flip_y;
+ }
+
+ if (radeon->vtbl.blit(ctx,
+ rrb->bo,
+ rrb->draw_offset,
+ rrb->base.Format,
+ rrb->pitch / rrb->cpp,
+ rrb->base.Width,
+ rrb->base.Height,
+ x,
+ y,
+ dst_buffer,
+ 0, /* dst_offset */
+ dst_format,
+ aligned_rowstride / _mesa_get_format_bytes(dst_format),
+ width,
+ height,
+ 0, /* dst_x */
+ 0, /* dst_y */
+ width,
+ height,
+ flip_y))
+ {
+ radeon_bo_map(dst_buffer, 0);
+ dst_rowstride *= _mesa_get_format_bytes(dst_format);
+ copy_rows(pixels, dst_rowstride, dst_buffer->ptr,
+ aligned_rowstride, height, dst_rowstride);
+ radeon_bo_unmap(dst_buffer);
+ radeon_bo_unref(dst_buffer);
+ return GL_TRUE;
+ } else {
+ radeon_bo_unref(dst_buffer);
+ return GL_FALSE;
+ }
+}
+
+void
+radeonReadPixels(GLcontext * ctx,
+ GLint x, GLint y, GLsizei width, GLsizei height,
+ GLenum format, GLenum type,
+ const struct gl_pixelstore_attrib *pack, GLvoid * pixels)
+{
+ if (do_blit_readpixels(ctx, x, y, width, height, format, type, pack, pixels))
+ return;
+
+ /* Update Mesa state before calling down into _swrast_ReadPixels, as
+ * the spans code requires the computed buffer states to be up to date,
+ * but _swrast_ReadPixels only updates Mesa state after setting up
+ * the spans code.
+ */
+
+ radeon_print(RADEON_FALLBACKS, RADEON_NORMAL,
+ "Falling back to sw for ReadPixels (format %s, type %s)\n",
+ _mesa_lookup_enum_by_nr(format), _mesa_lookup_enum_by_nr(type));
+
+ if (ctx->NewState)
+ _mesa_update_state(ctx);
+
+ _swrast_ReadPixels(ctx, x, y, width, height, format, type, pack, pixels);
+}
diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c
index 583751d64d..539b067742 100644
--- a/src/mesa/drivers/dri/radeon/radeon_state.c
+++ b/src/mesa/drivers/dri/radeon/radeon_state.c
@@ -45,6 +45,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "tnl/tnl.h"
#include "tnl/t_pipeline.h"
#include "swrast_setup/swrast_setup.h"
+#include "drivers/common/meta.h"
#include "radeon_context.h"
#include "radeon_mipmap_tree.h"
@@ -2248,6 +2249,10 @@ void radeonInitStateFuncs( GLcontext *ctx , GLboolean dri2 )
ctx->Driver.DrawBuffer = radeonDrawBuffer;
ctx->Driver.ReadBuffer = radeonReadBuffer;
+ ctx->Driver.CopyPixels = _mesa_meta_CopyPixels;
+ ctx->Driver.DrawPixels = _mesa_meta_DrawPixels;
+ if (dri2)
+ ctx->Driver.ReadPixels = radeonReadPixels;
ctx->Driver.AlphaFunc = radeonAlphaFunc;
ctx->Driver.BlendEquationSeparate = radeonBlendEquationSeparate;
diff --git a/src/mesa/drivers/dri/radeon/radeon_tex_copy.c b/src/mesa/drivers/dri/radeon/radeon_tex_copy.c
index 5cfad6fc3c..29fd31ac23 100644
--- a/src/mesa/drivers/dri/radeon/radeon_tex_copy.c
+++ b/src/mesa/drivers/dri/radeon/radeon_tex_copy.c
@@ -28,6 +28,7 @@
#include "radeon_common.h"
#include "radeon_texture.h"
+#include "main/enums.h"
#include "main/image.h"
#include "main/teximage.h"
#include "main/texstate.h"
@@ -52,22 +53,34 @@ do_copy_texsubimage(GLcontext *ctx,
gl_format dst_mesaformat;
unsigned src_width;
unsigned dst_width;
+ unsigned flip_y;
if (!radeon->vtbl.blit) {
return GL_FALSE;
}
if (_mesa_get_format_bits(timg->base.TexFormat, GL_DEPTH_BITS) > 0) {
- rrb = radeon_get_depthbuffer(radeon);
+ if (ctx->ReadBuffer->_DepthBuffer && ctx->ReadBuffer->_DepthBuffer->Wrapped) {
+ rrb = radeon_renderbuffer(ctx->ReadBuffer->_DepthBuffer->Wrapped);
+ } else {
+ rrb = radeon_renderbuffer(ctx->ReadBuffer->_DepthBuffer);
+ }
+ flip_y = ctx->ReadBuffer->Attachment[BUFFER_DEPTH].Type == GL_NONE;
} else {
- rrb = radeon_get_colorbuffer(radeon);
+ rrb = radeon_renderbuffer(ctx->ReadBuffer->_ColorReadBuffer);
+ flip_y = ctx->ReadBuffer->Attachment[BUFFER_COLOR0].Type == GL_NONE;
+ }
+
+ // This is software renderbuffer, fallback to swrast
+ if (!rrb) {
+ return GL_FALSE;
}
if (!timg->mt) {
radeon_validate_texture_miptree(ctx, &tobj->base);
}
- assert(rrb && rrb->bo);
+ assert(rrb->bo);
assert(timg->mt);
assert(timg->mt->bo);
assert(timg->base.Width >= dstx + width);
@@ -124,7 +137,7 @@ do_copy_texsubimage(GLcontext *ctx,
timg->mt->bo, dst_offset, dst_mesaformat,
timg->mt->levels[level].rowstride / dst_bpp,
dst_width, timg->base.Height,
- dstx, dsty, width, height, 1);
+ dstx, dsty, width, height, flip_y);
}
void
@@ -171,6 +184,10 @@ radeonCopyTexImage2D(GLcontext *ctx, GLenum target, GLint level,
return;
fail:
+ radeon_print(RADEON_FALLBACKS, RADEON_NORMAL,
+ "Falling back to sw for glCopyTexImage2D (internalFormat %s, border %d)\n",
+ _mesa_lookup_enum_by_nr(internalFormat), border);
+
_mesa_meta_CopyTexImage2D(ctx, target, level, internalFormat, x, y,
width, height, border);
}
@@ -189,7 +206,8 @@ radeonCopyTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
radeon_tex_obj(texObj), (radeon_texture_image *)texImage,
xoffset, yoffset, x, y, width, height)) {
- //DEBUG_FALLBACKS
+ radeon_print(RADEON_FALLBACKS, RADEON_NORMAL,
+ "Falling back to sw for glCopyTexSubImage2D\n");
_mesa_meta_CopyTexSubImage2D(ctx, target, level,
xoffset, yoffset, x, y, width, height);
diff --git a/src/mesa/drivers/dri/radeon/radeon_tex_getimage.c b/src/mesa/drivers/dri/radeon/radeon_tex_getimage.c
new file mode 100644
index 0000000000..7bf6dcc2e3
--- /dev/null
+++ b/src/mesa/drivers/dri/radeon/radeon_tex_getimage.c
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2009 Maciej Cencora.
+ * Copyright (C) 2008 Nicolai Haehnle.
+ * Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
+ *
+ * The Weather Channel (TM) funded Tungsten Graphics to develop the
+ * initial release of the Radeon 8500 driver under the XFree86 license.
+ * This notice must be preserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#include "radeon_common_context.h"
+#include "radeon_texture.h"
+#include "radeon_mipmap_tree.h"
+
+#include "main/texgetimage.h"
+
+/**
+ * Need to map texture image into memory before copying image data,
+ * then unmap it.
+ */
+static void
+radeon_get_tex_image(GLcontext * ctx, GLenum target, GLint level,
+ GLenum format, GLenum type, GLvoid * pixels,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage, int compressed)
+{
+ radeon_texture_image *image = get_radeon_texture_image(texImage);
+
+ radeon_print(RADEON_TEXTURE, RADEON_NORMAL,
+ "%s(%p, tex %p, image %p) compressed %d.\n",
+ __func__, ctx, texObj, image, compressed);
+
+ if (image->mt) {
+ /* Map the texture image read-only */
+ radeon_teximage_map(image, GL_FALSE);
+ } else {
+ /* Image hasn't been uploaded to a miptree yet */
+ assert(image->base.Data);
+ }
+
+ if (compressed) {
+ /* FIXME: this can't work for small textures (mips) which
+ use different hw stride */
+ _mesa_get_compressed_teximage(ctx, target, level, pixels,
+ texObj, texImage);
+ } else {
+ _mesa_get_teximage(ctx, target, level, format, type, pixels,
+ texObj, texImage);
+ }
+
+ if (image->mt) {
+ radeon_teximage_unmap(image);
+ }
+}
+
+void
+radeonGetTexImage(GLcontext * ctx, GLenum target, GLint level,
+ GLenum format, GLenum type, GLvoid * pixels,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage)
+{
+ radeon_get_tex_image(ctx, target, level, format, type, pixels,
+ texObj, texImage, 0);
+}
+
+void
+radeonGetCompressedTexImage(GLcontext *ctx, GLenum target, GLint level,
+ GLvoid *pixels,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage)
+{
+ radeon_get_tex_image(ctx, target, level, 0, 0, pixels,
+ texObj, texImage, 1);
+}
diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c
index ff37fd3e86..2b655fbd95 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.c
@@ -39,7 +39,6 @@
#include "main/texstore.h"
#include "main/teximage.h"
#include "main/texobj.h"
-#include "main/texgetimage.h"
#include "xmlpool.h" /* for symbolic values of enum-type options */
@@ -559,6 +558,15 @@ gl_format radeonChooseTextureFormat(GLcontext * ctx,
case GL_COMPRESSED_SLUMINANCE_ALPHA:
return MESA_FORMAT_SLA8;
+ case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
+ return MESA_FORMAT_SRGB_DXT1;
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
+ return MESA_FORMAT_SRGBA_DXT1;
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
+ return MESA_FORMAT_SRGBA_DXT3;
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
+ return MESA_FORMAT_SRGBA_DXT5;
+
default:
_mesa_problem(ctx,
"unexpected internalFormat 0x%x in %s",
@@ -664,6 +672,7 @@ static void radeon_store_teximage(GLcontext* ctx, int dims,
struct gl_texture_image *texImage,
int compressed)
{
+ radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
radeonTexObj *t = radeon_tex_obj(texObj);
radeon_texture_image* image = get_radeon_texture_image(texImage);
@@ -678,8 +687,7 @@ static void radeon_store_teximage(GLcontext* ctx, int dims,
dstRowStride = image->mt->levels[image->mtlevel].rowstride;
} else if (t->bo) {
/* TFP case */
- /* TODO */
- assert(0);
+ dstRowStride = get_texture_image_row_stride(rmesa, texImage->TexFormat, width, 0);
} else {
dstRowStride = _mesa_format_row_stride(texImage->TexFormat, texImage->Width);
}
@@ -999,61 +1007,18 @@ void radeonTexSubImage3D(GLcontext * ctx, GLenum target, GLint level,
format, type, pixels, packing, texObj, texImage, 0);
}
-/**
- * Need to map texture image into memory before copying image data,
- * then unmap it.
- */
-static void
-radeon_get_tex_image(GLcontext * ctx, GLenum target, GLint level,
- GLenum format, GLenum type, GLvoid * pixels,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage, int compressed)
+unsigned radeonIsFormatRenderable(gl_format mesa_format)
{
- radeon_texture_image *image = get_radeon_texture_image(texImage);
-
- radeon_print(RADEON_TEXTURE, RADEON_NORMAL,
- "%s(%p, tex %p, image %p) compressed %d.\n",
- __func__, ctx, texObj, image, compressed);
+ if (mesa_format == _dri_texformat_argb8888 || mesa_format == _dri_texformat_rgb565 ||
+ mesa_format == _dri_texformat_argb1555 || mesa_format == _dri_texformat_argb4444)
+ return 1;
- if (image->mt) {
- /* Map the texture image read-only */
- radeon_teximage_map(image, GL_FALSE);
- } else {
- /* Image hasn't been uploaded to a miptree yet */
- assert(image->base.Data);
- }
-
- if (compressed) {
- /* FIXME: this can't work for small textures (mips) which
- use different hw stride */
- _mesa_get_compressed_teximage(ctx, target, level, pixels,
- texObj, texImage);
- } else {
- _mesa_get_teximage(ctx, target, level, format, type, pixels,
- texObj, texImage);
- }
-
- if (image->mt) {
- radeon_teximage_unmap(image);
+ switch (mesa_format)
+ {
+ case MESA_FORMAT_Z16:
+ case MESA_FORMAT_S8_Z24:
+ return 1;
+ default:
+ return 0;
}
}
-
-void
-radeonGetTexImage(GLcontext * ctx, GLenum target, GLint level,
- GLenum format, GLenum type, GLvoid * pixels,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
- radeon_get_tex_image(ctx, target, level, format, type, pixels,
- texObj, texImage, 0);
-}
-
-void
-radeonGetCompressedTexImage(GLcontext *ctx, GLenum target, GLint level,
- GLvoid *pixels,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage)
-{
- radeon_get_tex_image(ctx, target, level, 0, 0, pixels,
- texObj, texImage, 1);
-}
diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.h b/src/mesa/drivers/dri/radeon/radeon_texture.h
index f09dd65214..4ce639ea34 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.h
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.h
@@ -135,4 +135,6 @@ void radeonCopyTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
GLint x, GLint y,
GLsizei width, GLsizei height);
+unsigned radeonIsFormatRenderable(gl_format mesa_format);
+
#endif
diff --git a/src/mesa/drivers/dri/radeon/radeon_tile.c b/src/mesa/drivers/dri/radeon/radeon_tile.c
new file mode 100644
index 0000000000..403da11010
--- /dev/null
+++ b/src/mesa/drivers/dri/radeon/radeon_tile.c
@@ -0,0 +1,512 @@
+/*
+ * Copyright (C) 2010 Maciej Cencora <m.cencora@gmail.com>
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#include "radeon_tile.h"
+
+#include <stdint.h>
+#include <string.h>
+
+#include "main/macros.h"
+#include "radeon_debug.h"
+
+#define MICRO_TILE_SIZE 32
+
+static void micro_tile_8_x_4_8bit(const void * const src, unsigned src_pitch,
+ void * const dst, unsigned dst_pitch,
+ unsigned width, unsigned height)
+{
+ unsigned row; /* current source row */
+ unsigned col; /* current source column */
+ unsigned k; /* number of processed tiles */
+ const unsigned tile_width = 8, tile_height = 4;
+ const unsigned tiles_in_row = (width + (tile_width - 1)) / tile_width;
+
+ k = 0;
+ for (row = 0; row < height; row += tile_height)
+ {
+ for (col = 0; col < width; col += tile_width, ++k)
+ {
+ uint8_t *src2 = (uint8_t *)src + src_pitch * row + col;
+ uint8_t *dst2 = (uint8_t *)dst + row * dst_pitch +
+ (k % tiles_in_row) * MICRO_TILE_SIZE / sizeof(uint8_t);
+ unsigned j;
+
+ for (j = 0; j < MIN2(tile_height, height - row); ++j)
+ {
+ unsigned columns = MIN2(tile_width, width - col);
+ memcpy(dst2, src2, columns * sizeof(uint8_t));
+ dst2 += tile_width;
+ src2 += src_pitch;
+ }
+ }
+ }
+}
+
+static void micro_tile_4_x_4_16bit(const void * const src, unsigned src_pitch,
+ void * const dst, unsigned dst_pitch,
+ unsigned width, unsigned height)
+{
+ unsigned row; /* current source row */
+ unsigned col; /* current source column */
+ unsigned k; /* number of processed tiles */
+ const unsigned tile_width = 4, tile_height = 4;
+ const unsigned tiles_in_row = (width + (tile_width - 1)) / tile_width;
+
+ k = 0;
+ for (row = 0; row < height; row += tile_height)
+ {
+ for (col = 0; col < width; col += tile_width, ++k)
+ {
+ uint16_t *src2 = (uint16_t *)src + src_pitch * row + col;
+ uint16_t *dst2 = (uint16_t *)dst + row * dst_pitch +
+ (k % tiles_in_row) * MICRO_TILE_SIZE / sizeof(uint16_t);
+ unsigned j;
+
+ for (j = 0; j < MIN2(tile_height, height - row); ++j)
+ {
+ unsigned columns = MIN2(tile_width, width - col);
+ memcpy(dst2, src2, columns * sizeof(uint16_t));
+ dst2 += tile_width;
+ src2 += src_pitch;
+ }
+ }
+ }
+}
+
+static void micro_tile_8_x_2_16bit(const void * const src, unsigned src_pitch,
+ void * const dst, unsigned dst_pitch,
+ unsigned width, unsigned height)
+{
+ unsigned row; /* current source row */
+ unsigned col; /* current source column */
+ unsigned k; /* number of processed tiles */
+ const unsigned tile_width = 8, tile_height = 2;
+ const unsigned tiles_in_row = (width + (tile_width - 1)) / tile_width;
+
+ k = 0;
+ for (row = 0; row < height; row += tile_height)
+ {
+ for (col = 0; col < width; col += tile_width, ++k)
+ {
+ uint16_t *src2 = (uint16_t *)src + src_pitch * row + col;
+ uint16_t *dst2 = (uint16_t *)dst + row * dst_pitch +
+ (k % tiles_in_row) * MICRO_TILE_SIZE / sizeof(uint16_t);
+ unsigned j;
+
+ for (j = 0; j < MIN2(tile_height, height - row); ++j)
+ {
+ unsigned columns = MIN2(tile_width, width - col);
+ memcpy(dst2, src2, columns * sizeof(uint16_t));
+ dst2 += tile_width;
+ src2 += src_pitch;
+ }
+ }
+ }
+}
+
+static void micro_tile_4_x_2_32bit(const void * const src, unsigned src_pitch,
+ void * const dst, unsigned dst_pitch,
+ unsigned width, unsigned height)
+{
+ unsigned row; /* current source row */
+ unsigned col; /* current source column */
+ unsigned k; /* number of processed tiles */
+ const unsigned tile_width = 4, tile_height = 2;
+ const unsigned tiles_in_row = (width + (tile_width - 1)) / tile_width;
+
+ k = 0;
+ for (row = 0; row < height; row += tile_height)
+ {
+ for (col = 0; col < width; col += tile_width, ++k)
+ {
+ uint32_t *src2 = (uint32_t *)src + src_pitch * row + col;
+ uint32_t *dst2 = (uint32_t *)dst + row * dst_pitch +
+ (k % tiles_in_row) * MICRO_TILE_SIZE / sizeof(uint32_t);
+ unsigned j;
+
+ for (j = 0; j < MIN2(tile_height, height - row); ++j)
+ {
+ unsigned columns = MIN2(tile_width, width - col);
+ memcpy(dst2, src2, columns * sizeof(uint32_t));
+ dst2 += tile_width;
+ src2 += src_pitch;
+ }
+ }
+ }
+}
+
+static void micro_tile_2_x_2_64bit(const void * const src, unsigned src_pitch,
+ void * const dst, unsigned dst_pitch,
+ unsigned width, unsigned height)
+{
+ unsigned row; /* current source row */
+ unsigned col; /* current source column */
+ unsigned k; /* number of processed tiles */
+ const unsigned tile_width = 2, tile_height = 2;
+ const unsigned tiles_in_row = (width + (tile_width - 1)) / tile_width;
+
+ k = 0;
+ for (row = 0; row < height; row += tile_height)
+ {
+ for (col = 0; col < width; col += tile_width, ++k)
+ {
+ uint64_t *src2 = (uint64_t *)src + src_pitch * row + col;
+ uint64_t *dst2 = (uint64_t *)dst + row * dst_pitch +
+ (k % tiles_in_row) * MICRO_TILE_SIZE / sizeof(uint64_t);
+ unsigned j;
+
+ for (j = 0; j < MIN2(tile_height, height - row); ++j)
+ {
+ unsigned columns = MIN2(tile_width, width - col);
+ memcpy(dst2, src2, columns * sizeof(uint64_t));
+ dst2 += tile_width;
+ src2 += src_pitch;
+ }
+ }
+ }
+}
+
+static void micro_tile_1_x_1_128bit(const void * src, unsigned src_pitch,
+ void * dst, unsigned dst_pitch,
+ unsigned width, unsigned height)
+{
+ unsigned i, j;
+ const unsigned elem_size = 16; /* sizeof(uint128_t) */
+
+ for (j = 0; j < height; ++j)
+ {
+ for (i = 0; i < width; ++i)
+ {
+ memcpy(dst, src, width * elem_size);
+ dst += dst_pitch * elem_size;
+ src += src_pitch * elem_size;
+ }
+ }
+}
+
+void tile_image(const void * src, unsigned src_pitch,
+ void *dst, unsigned dst_pitch,
+ gl_format format, unsigned width, unsigned height)
+{
+ assert(src_pitch >= width);
+ assert(dst_pitch >= width);
+
+ radeon_print(RADEON_TEXTURE, RADEON_TRACE,
+ "Software tiling: src_pitch %d, dst_pitch %d, width %d, height %d, bpp %d\n",
+ src_pitch, dst_pitch, width, height, _mesa_get_format_bytes(format));
+
+ switch (_mesa_get_format_bytes(format))
+ {
+ case 16:
+ micro_tile_1_x_1_128bit(src, src_pitch, dst, dst_pitch, width, height);
+ break;
+ case 8:
+ micro_tile_2_x_2_64bit(src, src_pitch, dst, dst_pitch, width, height);
+ break;
+ case 4:
+ micro_tile_4_x_2_32bit(src, src_pitch, dst, dst_pitch, width, height);
+ break;
+ case 2:
+ if (_mesa_get_format_bits(format, GL_DEPTH_BITS))
+ {
+ micro_tile_4_x_4_16bit(src, src_pitch, dst, dst_pitch, width, height);
+ }
+ else
+ {
+ micro_tile_8_x_2_16bit(src, src_pitch, dst, dst_pitch, width, height);
+ }
+ break;
+ case 1:
+ micro_tile_8_x_4_8bit(src, src_pitch, dst, dst_pitch, width, height);
+ break;
+ default:
+ assert(0);
+ break;
+ }
+}
+
+static void micro_untile_8_x_4_8bit(const void * const src, unsigned src_pitch,
+ void * const dst, unsigned dst_pitch,
+ unsigned width, unsigned height)
+{
+ unsigned row; /* current destination row */
+ unsigned col; /* current destination column */
+ unsigned k; /* current tile number */
+ const unsigned tile_width = 8, tile_height = 4;
+ const unsigned tiles_in_row = (width + (tile_width - 1)) / tile_width;
+
+ assert(src_pitch % tile_width == 0);
+
+ k = 0;
+ for (row = 0; row < height; row += tile_height)
+ {
+ for (col = 0; col < width; col += tile_width, ++k)
+ {
+ uint8_t *src2 = (uint8_t *)src + row * src_pitch +
+ (k % tiles_in_row) * MICRO_TILE_SIZE / sizeof(uint8_t);
+ uint8_t *dst2 = (uint8_t *)dst + dst_pitch * row + col;
+ unsigned j;
+
+ for (j = 0; j < MIN2(tile_height, height - row); ++j)
+ {
+ unsigned columns = MIN2(tile_width, width - col);
+ memcpy(dst2, src2, columns * sizeof(uint8_t));
+ dst2 += dst_pitch;
+ src2 += tile_width;
+ }
+ }
+ }
+}
+
+static void micro_untile_8_x_2_16bit(const void * const src, unsigned src_pitch,
+ void * const dst, unsigned dst_pitch,
+ unsigned width, unsigned height)
+{
+ unsigned row; /* current destination row */
+ unsigned col; /* current destination column */
+ unsigned k; /* current tile number */
+ const unsigned tile_width = 8, tile_height = 2;
+ const unsigned tiles_in_row = (width + (tile_width - 1)) / tile_width;
+
+ assert(src_pitch % tile_width == 0);
+
+ k = 0;
+ for (row = 0; row < height; row += tile_height)
+ {
+ for (col = 0; col < width; col += tile_width, ++k)
+ {
+ uint16_t *src2 = (uint16_t *)src + row * src_pitch +
+ (k % tiles_in_row) * MICRO_TILE_SIZE / sizeof(uint16_t);
+ uint16_t *dst2 = (uint16_t *)dst + dst_pitch * row + col;
+ unsigned j;
+
+ for (j = 0; j < MIN2(tile_height, height - row); ++j)
+ {
+ unsigned columns = MIN2(tile_width, width - col);
+ memcpy(dst2, src2, columns * sizeof(uint16_t));
+ dst2 += dst_pitch;
+ src2 += tile_width;
+ }
+ }
+ }
+}
+
+static void micro_untile_4_x_4_16bit(const void * const src, unsigned src_pitch,
+ void * const dst, unsigned dst_pitch,
+ unsigned width, unsigned height)
+{
+ unsigned row; /* current destination row */
+ unsigned col; /* current destination column */
+ unsigned k; /* current tile number */
+ const unsigned tile_width = 4, tile_height = 4;
+ const unsigned tiles_in_row = (width + (tile_width - 1)) / tile_width;
+
+ assert(src_pitch % tile_width == 0);
+
+ k = 0;
+ for (row = 0; row < height; row += tile_height)
+ {
+ for (col = 0; col < width; col += tile_width, ++k)
+ {
+ uint16_t *src2 = (uint16_t *)src + row * src_pitch +
+ (k % tiles_in_row) * MICRO_TILE_SIZE / sizeof(uint16_t);
+ uint16_t *dst2 = (uint16_t *)dst + dst_pitch * row + col;
+ unsigned j;
+
+ for (j = 0; j < MIN2(tile_height, height - row); ++j)
+ {
+ unsigned columns = MIN2(tile_width, width - col);
+ memcpy(dst2, src2, columns * sizeof(uint16_t));
+ dst2 += dst_pitch;
+ src2 += tile_width;
+ }
+ }
+ }
+}
+
+static void micro_untile_4_x_2_32bit(const void * const src, unsigned src_pitch,
+ void * const dst, unsigned dst_pitch,
+ unsigned width, unsigned height)
+{
+ unsigned row; /* current destination row */
+ unsigned col; /* current destination column */
+ unsigned k; /* current tile number */
+ const unsigned tile_width = 4, tile_height = 2;
+ const unsigned tiles_in_row = (width + (tile_width - 1)) / tile_width;
+
+ assert(src_pitch % tile_width == 0);
+
+ k = 0;
+ for (row = 0; row < height; row += tile_height)
+ {
+ for (col = 0; col < width; col += tile_width, ++k)
+ {
+ uint32_t *src2 = (uint32_t *)src + row * src_pitch +
+ (k % tiles_in_row) * MICRO_TILE_SIZE / sizeof(uint32_t);
+ uint32_t *dst2 = (uint32_t *)dst + dst_pitch * row + col;
+ unsigned j;
+
+ for (j = 0; j < MIN2(tile_height, height - row); ++j)
+ {
+ unsigned columns = MIN2(tile_width, width - col);
+ memcpy(dst2, src2, columns * sizeof(uint32_t));
+ dst2 += dst_pitch;
+ src2 += tile_width;
+ }
+ }
+ }
+}
+
+static void micro_untile_2_x_2_64bit(const void * const src, unsigned src_pitch,
+ void * const dst, unsigned dst_pitch,
+ unsigned width, unsigned height)
+{
+ unsigned row; /* current destination row */
+ unsigned col; /* current destination column */
+ unsigned k; /* current tile number */
+ const unsigned tile_width = 2, tile_height = 2;
+ const unsigned tiles_in_row = (width + (tile_width - 1)) / tile_width;
+
+ assert(src_pitch % tile_width == 0);
+
+ k = 0;
+ for (row = 0; row < height; row += tile_height)
+ {
+ for (col = 0; col < width; col += tile_width, ++k)
+ {
+ uint64_t *src2 = (uint64_t *)src + row * src_pitch +
+ (k % tiles_in_row) * MICRO_TILE_SIZE / sizeof(uint64_t);
+ uint64_t *dst2 = (uint64_t *)dst + dst_pitch * row + col;
+ unsigned j;
+
+ for (j = 0; j < MIN2(tile_height, height - row); ++j)
+ {
+ unsigned columns = MIN2(tile_width, width - col);
+ memcpy(dst2, src2, columns * sizeof(uint64_t));
+ dst2 += dst_pitch;
+ src2 += tile_width;
+ }
+ }
+ }
+}
+
+static void micro_untile_1_x_1_128bit(const void * src, unsigned src_pitch,
+ void * dst, unsigned dst_pitch,
+ unsigned width, unsigned height)
+{
+ unsigned i, j;
+ const unsigned elem_size = 16; /* sizeof(uint128_t) */
+
+ for (j = 0; j < height; ++j)
+ {
+ for (i = 0; i < width; ++i)
+ {
+ memcpy(dst, src, width * elem_size);
+ dst += dst_pitch * elem_size;
+ src += src_pitch * elem_size;
+ }
+ }
+}
+
+void untile_image(const void * src, unsigned src_pitch,
+ void *dst, unsigned dst_pitch,
+ gl_format format, unsigned width, unsigned height)
+{
+ assert(src_pitch >= width);
+ assert(dst_pitch >= width);
+
+ radeon_print(RADEON_TEXTURE, RADEON_TRACE,
+ "Software untiling: src_pitch %d, dst_pitch %d, width %d, height %d, bpp %d\n",
+ src_pitch, dst_pitch, width, height, _mesa_get_format_bytes(format));
+
+ switch (_mesa_get_format_bytes(format))
+ {
+ case 16:
+ micro_untile_1_x_1_128bit(src, src_pitch, dst, dst_pitch, width, height);
+ break;
+ case 8:
+ micro_untile_2_x_2_64bit(src, src_pitch, dst, dst_pitch, width, height);
+ break;
+ case 4:
+ micro_untile_4_x_2_32bit(src, src_pitch, dst, dst_pitch, width, height);
+ break;
+ case 2:
+ if (_mesa_get_format_bits(format, GL_DEPTH_BITS))
+ {
+ micro_untile_4_x_4_16bit(src, src_pitch, dst, dst_pitch, width, height);
+ }
+ else
+ {
+ micro_untile_8_x_2_16bit(src, src_pitch, dst, dst_pitch, width, height);
+ }
+ break;
+ case 1:
+ micro_untile_8_x_4_8bit(src, src_pitch, dst, dst_pitch, width, height);
+ break;
+ default:
+ assert(0);
+ break;
+ }
+}
+
+void get_tile_size(gl_format format, unsigned *block_width, unsigned *block_height)
+{
+ switch (_mesa_get_format_bytes(format))
+ {
+ case 16:
+ *block_width = 1;
+ *block_height = 1;
+ break;
+ case 8:
+ *block_width = 2;
+ *block_height = 2;
+ break;
+ case 4:
+ *block_width = 4;
+ *block_height = 2;
+ break;
+ case 2:
+ if (_mesa_get_format_bits(format, GL_DEPTH_BITS))
+ {
+ *block_width = 4;
+ *block_height = 4;
+ }
+ else
+ {
+ *block_width = 8;
+ *block_height = 2;
+ }
+ break;
+ case 1:
+ *block_width = 8;
+ *block_height = 4;
+ break;
+ default:
+ assert(0);
+ break;
+ }
+}
diff --git a/src/mesa/drivers/dri/radeon/radeon_tile.h b/src/mesa/drivers/dri/radeon/radeon_tile.h
new file mode 100644
index 0000000000..31d9c5611c
--- /dev/null
+++ b/src/mesa/drivers/dri/radeon/radeon_tile.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2010 Maciej Cencora <m.cencora@gmail.com>
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#include <main/formats.h>
+
+void tile_image(const void * src, unsigned src_pitch,
+ void *dst, unsigned dst_pitch,
+ gl_format format, unsigned width, unsigned height);
+
+void untile_image(const void * src, unsigned src_pitch,
+ void *dst, unsigned dst_pitch,
+ gl_format format, unsigned width, unsigned height);
+
+void get_tile_size(gl_format format, unsigned *block_width, unsigned *block_height);
diff --git a/src/mesa/drivers/dri/radeon/server/radeon_dri.c b/src/mesa/drivers/dri/radeon/server/radeon_dri.c
deleted file mode 100644
index 7ead588dac..0000000000
--- a/src/mesa/drivers/dri/radeon/server/radeon_dri.c
+++ /dev/null
@@ -1,1337 +0,0 @@
-/**
- * \file server/radeon_dri.c
- * \brief File to perform the device-specific initialization tasks typically
- * done in the X server.
- *
- * Here they are converted to run in the client (or perhaps a standalone
- * process), and to work with the frame buffer device rather than the X
- * server infrastructure.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-
-#include "driver.h"
-#include "drm.h"
-#include "memops.h"
-
-#include "radeon.h"
-#include "radeon_dri.h"
-#include "radeon_macros.h"
-#include "radeon_reg.h"
-#include "drm_sarea.h"
-
-static size_t radeon_drm_page_size;
-
-static int RadeonSetParam(const DRIDriverContext *ctx, int param, int value)
-{
- drm_radeon_setparam_t sp;
-
- memset(&sp, 0, sizeof(sp));
- sp.param = param;
- sp.value = value;
-
- if (drmCommandWrite(ctx->drmFD, DRM_RADEON_SETPARAM, &sp, sizeof(sp))) {
- return -1;
- }
-
- return 0;
-}
-
-/**
- * \brief Wait for free FIFO entries.
- *
- * \param ctx display handle.
- * \param entries number of free entries to wait.
- *
- * It polls the free entries from the chip until it reaches the requested value
- * or a timeout (3000 tries) occurs. Aborts the program if the FIFO times out.
- */
-static void RADEONWaitForFifo( const DRIDriverContext *ctx,
- int entries )
-{
- unsigned char *RADEONMMIO = ctx->MMIOAddress;
- int i;
-
- for (i = 0; i < 3000; i++) {
- int fifo_slots =
- INREG(RADEON_RBBM_STATUS) & RADEON_RBBM_FIFOCNT_MASK;
- if (fifo_slots >= entries) return;
- }
-
- /* There are recoveries possible, but I haven't seen them work
- * in practice:
- */
- fprintf(stderr, "FIFO timed out: %d entries, stat=0x%08x\n",
- INREG(RADEON_RBBM_STATUS) & RADEON_RBBM_FIFOCNT_MASK,
- INREG(RADEON_RBBM_STATUS));
- exit(1);
-}
-
-/**
- * \brief Read a PLL register.
- *
- * \param ctx display handle.
- * \param addr PLL register index.
- *
- * \return value of the PLL register.
- */
-static unsigned int RADEONINPLL( const DRIDriverContext *ctx, int addr)
-{
- unsigned char *RADEONMMIO = ctx->MMIOAddress;
- unsigned int data;
-
- OUTREG8(RADEON_CLOCK_CNTL_INDEX, addr & 0x3f);
- data = INREG(RADEON_CLOCK_CNTL_DATA);
-
- return data;
-}
-
-/**
- * \brief Reset graphics card to known state.
- *
- * \param ctx display handle.
- *
- * Resets the values of several Radeon registers.
- */
-static void RADEONEngineReset( const DRIDriverContext *ctx )
-{
- unsigned char *RADEONMMIO = ctx->MMIOAddress;
- unsigned int clock_cntl_index;
- unsigned int mclk_cntl;
- unsigned int rbbm_soft_reset;
- unsigned int host_path_cntl;
- int i;
-
- OUTREGP(RADEON_RB2D_DSTCACHE_CTLSTAT,
- RADEON_RB2D_DC_FLUSH_ALL,
- ~RADEON_RB2D_DC_FLUSH_ALL);
- for (i = 0; i < 512; i++) {
- if (!(INREG(RADEON_RB2D_DSTCACHE_CTLSTAT) & RADEON_RB2D_DC_BUSY))
- break;
- }
-
- clock_cntl_index = INREG(RADEON_CLOCK_CNTL_INDEX);
-
- mclk_cntl = INPLL(ctx, RADEON_MCLK_CNTL);
- OUTPLL(RADEON_MCLK_CNTL, (mclk_cntl |
- RADEON_FORCEON_MCLKA |
- RADEON_FORCEON_MCLKB |
- RADEON_FORCEON_YCLKA |
- RADEON_FORCEON_YCLKB |
- RADEON_FORCEON_MC |
- RADEON_FORCEON_AIC));
-
- /* Soft resetting HDP thru RBBM_SOFT_RESET register can cause some
- * unexpected behaviour on some machines. Here we use
- * RADEON_HOST_PATH_CNTL to reset it.
- */
- host_path_cntl = INREG(RADEON_HOST_PATH_CNTL);
- rbbm_soft_reset = INREG(RADEON_RBBM_SOFT_RESET);
-
- OUTREG(RADEON_RBBM_SOFT_RESET, (rbbm_soft_reset |
- RADEON_SOFT_RESET_CP |
- RADEON_SOFT_RESET_HI |
- RADEON_SOFT_RESET_SE |
- RADEON_SOFT_RESET_RE |
- RADEON_SOFT_RESET_PP |
- RADEON_SOFT_RESET_E2 |
- RADEON_SOFT_RESET_RB));
- INREG(RADEON_RBBM_SOFT_RESET);
- OUTREG(RADEON_RBBM_SOFT_RESET, (rbbm_soft_reset &
- (unsigned int) ~(RADEON_SOFT_RESET_CP |
- RADEON_SOFT_RESET_HI |
- RADEON_SOFT_RESET_SE |
- RADEON_SOFT_RESET_RE |
- RADEON_SOFT_RESET_PP |
- RADEON_SOFT_RESET_E2 |
- RADEON_SOFT_RESET_RB)));
- INREG(RADEON_RBBM_SOFT_RESET);
-
- OUTREG(RADEON_HOST_PATH_CNTL, host_path_cntl | RADEON_HDP_SOFT_RESET);
- INREG(RADEON_HOST_PATH_CNTL);
- OUTREG(RADEON_HOST_PATH_CNTL, host_path_cntl);
-
- OUTREG(RADEON_RBBM_SOFT_RESET, rbbm_soft_reset);
-
- OUTREG(RADEON_CLOCK_CNTL_INDEX, clock_cntl_index);
- OUTPLL(RADEON_MCLK_CNTL, mclk_cntl);
-}
-
-/**
- * \brief Restore the drawing engine.
- *
- * \param ctx display handle
- *
- * Resets the graphics card and sets initial values for several registers of
- * the card's drawing engine.
- *
- * Turns on the radeon command processor engine (i.e., the ringbuffer).
- */
-static int RADEONEngineRestore( const DRIDriverContext *ctx )
-{
- RADEONInfoPtr info = ctx->driverPrivate;
- unsigned char *RADEONMMIO = ctx->MMIOAddress;
- int pitch64, datatype, dp_gui_master_cntl, err;
-
- fprintf(stderr, "%s\n", __FUNCTION__);
-
- OUTREG(RADEON_RB3D_CNTL, 0);
- RADEONEngineReset( ctx );
-
- switch (ctx->bpp) {
- case 16: datatype = 4; break;
- case 32: datatype = 6; break;
- default: return 0;
- }
-
- dp_gui_master_cntl =
- ((datatype << RADEON_GMC_DST_DATATYPE_SHIFT)
- | RADEON_GMC_CLR_CMP_CNTL_DIS);
-
- pitch64 = ((ctx->shared.virtualWidth * (ctx->bpp / 8) + 0x3f)) >> 6;
-
- RADEONWaitForFifo(ctx, 1);
- OUTREG(RADEON_DEFAULT_OFFSET, ((INREG(RADEON_DEFAULT_OFFSET) & 0xC0000000)
- | (pitch64 << 22)));
-
- RADEONWaitForFifo(ctx, 1);
- OUTREG(RADEON_SURFACE_CNTL, RADEON_SURF_TRANSLATION_DIS);
-
- RADEONWaitForFifo(ctx, 1);
- OUTREG(RADEON_DEFAULT_SC_BOTTOM_RIGHT, (RADEON_DEFAULT_SC_RIGHT_MAX
- | RADEON_DEFAULT_SC_BOTTOM_MAX));
-
- RADEONWaitForFifo(ctx, 1);
- OUTREG(RADEON_DP_GUI_MASTER_CNTL, (dp_gui_master_cntl
- | RADEON_GMC_BRUSH_SOLID_COLOR
- | RADEON_GMC_SRC_DATATYPE_COLOR));
-
- RADEONWaitForFifo(ctx, 7);
- OUTREG(RADEON_DST_LINE_START, 0);
- OUTREG(RADEON_DST_LINE_END, 0);
- OUTREG(RADEON_DP_BRUSH_FRGD_CLR, 0xffffffff);
- OUTREG(RADEON_DP_BRUSH_BKGD_CLR, 0);
- OUTREG(RADEON_DP_SRC_FRGD_CLR, 0xffffffff);
- OUTREG(RADEON_DP_SRC_BKGD_CLR, 0);
- OUTREG(RADEON_DP_WRITE_MASK, 0xffffffff);
- OUTREG(RADEON_AUX_SC_CNTL, 0);
-
-/* RADEONWaitForIdleMMIO(ctx); */
- usleep(100);
-
-
- OUTREG(RADEON_GEN_INT_CNTL, info->gen_int_cntl);
- if (info->colorTiling)
- info->crtc_offset_cntl |= RADEON_CRTC_TILE_EN;
- OUTREG(RADEON_CRTC_OFFSET_CNTL, info->crtc_offset_cntl);
-
- /* Initialize and start the CP if required */
- if ((err = drmCommandNone(ctx->drmFD, DRM_RADEON_CP_START)) != 0) {
- fprintf(stderr, "%s: CP start %d\n", __FUNCTION__, err);
- return 0;
- }
-
- return 1;
-}
-
-
-/**
- * \brief Shutdown the drawing engine.
- *
- * \param ctx display handle
- *
- * Turns off the command processor engine & restores the graphics card
- * to a state that fbdev understands.
- */
-static int RADEONEngineShutdown( const DRIDriverContext *ctx )
-{
- drm_radeon_cp_stop_t stop;
- int ret, i;
-
- stop.flush = 1;
- stop.idle = 1;
-
- ret = drmCommandWrite(ctx->drmFD, DRM_RADEON_CP_STOP, &stop,
- sizeof(drm_radeon_cp_stop_t));
-
- if (ret == 0) {
- return 0;
- } else if (errno != EBUSY) {
- return -errno;
- }
-
- stop.flush = 0;
-
- i = 0;
- do {
- ret = drmCommandWrite(ctx->drmFD, DRM_RADEON_CP_STOP, &stop,
- sizeof(drm_radeon_cp_stop_t));
- } while (ret && errno == EBUSY && i++ < 10);
-
- if (ret == 0) {
- return 0;
- } else if (errno != EBUSY) {
- return -errno;
- }
-
- stop.idle = 0;
-
- if (drmCommandWrite(ctx->drmFD, DRM_RADEON_CP_STOP,
- &stop, sizeof(drm_radeon_cp_stop_t))) {
- return -errno;
- } else {
- return 0;
- }
-}
-
-/**
- * \brief Compute base 2 logarithm.
- *
- * \param val value.
- *
- * \return base 2 logarithm of \p val.
- */
-static int RADEONMinBits(int val)
-{
- int bits;
-
- if (!val) return 1;
- for (bits = 0; val; val >>= 1, ++bits);
- return bits;
-}
-
-/**
- * \brief Initialize the AGP state
- *
- * \param ctx display handle.
- * \param info driver private data.
- *
- * \return one on success, or zero on failure.
- *
- * Acquires and enables the AGP device. Reserves memory in the AGP space for
- * the ring buffer, vertex buffers and textures. Initialize the Radeon
- * registers to point to that memory and add client mappings.
- */
-static int RADEONDRIAgpInit( const DRIDriverContext *ctx, RADEONInfoPtr info)
-{
- unsigned char *RADEONMMIO = ctx->MMIOAddress;
- unsigned long mode;
- int ret;
- int s, l;
-
- if (drmAgpAcquire(ctx->drmFD) < 0) {
- fprintf(stderr, "[gart] AGP not available\n");
- return 0;
- }
-
- /* Modify the mode if the default mode is not appropriate for this
- * particular combination of graphics card and AGP chipset.
- */
- mode = drmAgpGetMode(ctx->drmFD); /* Default mode */
-
- /* Disable fast write entirely - too many lockups.
- */
- mode &= ~RADEON_AGP_MODE_MASK;
- switch (ctx->agpmode) {
- case 4: mode |= RADEON_AGP_4X_MODE;
- case 2: mode |= RADEON_AGP_2X_MODE;
- case 1: default: mode |= RADEON_AGP_1X_MODE;
- }
-
- if (drmAgpEnable(ctx->drmFD, mode) < 0) {
- fprintf(stderr, "[gart] AGP not enabled\n");
- drmAgpRelease(ctx->drmFD);
- return 0;
- }
- else
- fprintf(stderr, "[gart] AGP enabled at %dx\n", ctx->agpmode);
-
- /* Workaround for some hardware bugs */
- if (info->ChipFamily < CHIP_FAMILY_R200)
- OUTREG(RADEON_AGP_CNTL, INREG(RADEON_AGP_CNTL) | 0x000e0000);
-
- info->gartOffset = 0;
-
- if ((ret = drmAgpAlloc(ctx->drmFD, info->gartSize*1024*1024, 0, NULL,
- &info->gartMemHandle)) < 0) {
- fprintf(stderr, "[gart] Out of memory (%d)\n", ret);
- drmAgpRelease(ctx->drmFD);
- return 0;
- }
- fprintf(stderr,
- "[gart] %d kB allocated with handle 0x%08x\n",
- info->gartSize*1024, (unsigned)info->gartMemHandle);
-
- if (drmAgpBind(ctx->drmFD,
- info->gartMemHandle, info->gartOffset) < 0) {
- fprintf(stderr, "[gart] Could not bind\n");
- drmAgpFree(ctx->drmFD, info->gartMemHandle);
- drmAgpRelease(ctx->drmFD);
- return 0;
- }
-
- /* Initialize the CP ring buffer data */
- info->ringStart = info->gartOffset;
- info->ringMapSize = info->ringSize*1024*1024 + radeon_drm_page_size;
-
- info->ringReadOffset = info->ringStart + info->ringMapSize;
- info->ringReadMapSize = radeon_drm_page_size;
-
- /* Reserve space for vertex/indirect buffers */
- info->bufStart = info->ringReadOffset + info->ringReadMapSize;
- info->bufMapSize = info->bufSize*1024*1024;
-
- /* Reserve the rest for AGP textures */
- info->gartTexStart = info->bufStart + info->bufMapSize;
- s = (info->gartSize*1024*1024 - info->gartTexStart);
- l = RADEONMinBits((s-1) / RADEON_NR_TEX_REGIONS);
- if (l < RADEON_LOG_TEX_GRANULARITY) l = RADEON_LOG_TEX_GRANULARITY;
- info->gartTexMapSize = (s >> l) << l;
- info->log2GARTTexGran = l;
-
- if (drmAddMap(ctx->drmFD, info->ringStart, info->ringMapSize,
- DRM_AGP, DRM_READ_ONLY, &info->ringHandle) < 0) {
- fprintf(stderr, "[gart] Could not add ring mapping\n");
- return 0;
- }
- fprintf(stderr, "[gart] ring handle = 0x%08x\n", info->ringHandle);
-
-
- if (drmAddMap(ctx->drmFD, info->ringReadOffset, info->ringReadMapSize,
- DRM_AGP, DRM_READ_ONLY, &info->ringReadPtrHandle) < 0) {
- fprintf(stderr,
- "[gart] Could not add ring read ptr mapping\n");
- return 0;
- }
-
- fprintf(stderr,
- "[gart] ring read ptr handle = 0x%08lx\n",
- info->ringReadPtrHandle);
-
- if (drmAddMap(ctx->drmFD, info->bufStart, info->bufMapSize,
- DRM_AGP, 0, &info->bufHandle) < 0) {
- fprintf(stderr,
- "[gart] Could not add vertex/indirect buffers mapping\n");
- return 0;
- }
- fprintf(stderr,
- "[gart] vertex/indirect buffers handle = 0x%08x\n",
- info->bufHandle);
-
- if (drmAddMap(ctx->drmFD, info->gartTexStart, info->gartTexMapSize,
- DRM_AGP, 0, &info->gartTexHandle) < 0) {
- fprintf(stderr,
- "[gart] Could not add AGP texture map mapping\n");
- return 0;
- }
- fprintf(stderr,
- "[gart] AGP texture map handle = 0x%08lx\n",
- info->gartTexHandle);
-
- /* Initialize Radeon's AGP registers */
- /* Ring buffer is at AGP offset 0 */
- OUTREG(RADEON_AGP_BASE, info->ringHandle);
-
- return 1;
-}
-
-/* Initialize the PCI GART state. Request memory for use in PCI space,
- * and initialize the Radeon registers to point to that memory.
- */
-static int RADEONDRIPciInit(const DRIDriverContext *ctx, RADEONInfoPtr info)
-{
- int ret;
- int flags = DRM_READ_ONLY | DRM_LOCKED | DRM_KERNEL;
- int s, l;
-
- ret = drmScatterGatherAlloc(ctx->drmFD, info->gartSize*1024*1024,
- &info->gartMemHandle);
- if (ret < 0) {
- fprintf(stderr, "[pci] Out of memory (%d)\n", ret);
- return 0;
- }
- fprintf(stderr,
- "[pci] %d kB allocated with handle 0x%08lx\n",
- info->gartSize*1024, info->gartMemHandle);
-
- info->gartOffset = 0;
-
- /* Initialize the CP ring buffer data */
- info->ringStart = info->gartOffset;
- info->ringMapSize = info->ringSize*1024*1024 + radeon_drm_page_size;
-
- info->ringReadOffset = info->ringStart + info->ringMapSize;
- info->ringReadMapSize = radeon_drm_page_size;
-
- /* Reserve space for vertex/indirect buffers */
- info->bufStart = info->ringReadOffset + info->ringReadMapSize;
- info->bufMapSize = info->bufSize*1024*1024;
-
- /* Reserve the rest for AGP textures */
- info->gartTexStart = info->bufStart + info->bufMapSize;
- s = (info->gartSize*1024*1024 - info->gartTexStart);
- l = RADEONMinBits((s-1) / RADEON_NR_TEX_REGIONS);
- if (l < RADEON_LOG_TEX_GRANULARITY) l = RADEON_LOG_TEX_GRANULARITY;
- info->gartTexMapSize = (s >> l) << l;
- info->log2GARTTexGran = l;
-
- if (drmAddMap(ctx->drmFD, info->ringStart, info->ringMapSize,
- DRM_SCATTER_GATHER, flags, &info->ringHandle) < 0) {
- fprintf(stderr,
- "[pci] Could not add ring mapping\n");
- return 0;
- }
- fprintf(stderr,
- "[pci] ring handle = 0x%08x\n", info->ringHandle);
-
- if (drmAddMap(ctx->drmFD, info->ringReadOffset, info->ringReadMapSize,
- DRM_SCATTER_GATHER, flags, &info->ringReadPtrHandle) < 0) {
- fprintf(stderr,
- "[pci] Could not add ring read ptr mapping\n");
- return 0;
- }
- fprintf(stderr,
- "[pci] ring read ptr handle = 0x%08lx\n",
- info->ringReadPtrHandle);
-
- if (drmAddMap(ctx->drmFD, info->bufStart, info->bufMapSize,
- DRM_SCATTER_GATHER, 0, &info->bufHandle) < 0) {
- fprintf(stderr,
- "[pci] Could not add vertex/indirect buffers mapping\n");
- return 0;
- }
- fprintf(stderr,
- "[pci] vertex/indirect buffers handle = 0x%08lx\n",
- info->bufHandle);
-
- if (drmAddMap(ctx->drmFD, info->gartTexStart, info->gartTexMapSize,
- DRM_SCATTER_GATHER, 0, &info->gartTexHandle) < 0) {
- fprintf(stderr,
- "[pci] Could not add GART texture map mapping\n");
- return 0;
- }
- fprintf(stderr,
- "[pci] GART texture map handle = 0x%08x\n",
- info->gartTexHandle);
-
- return 1;
-}
-
-
-/**
- * \brief Initialize the kernel data structures and enable the CP engine.
- *
- * \param ctx display handle.
- * \param info driver private data.
- *
- * \return non-zero on success, or zero on failure.
- *
- * This function is a wrapper around the DRM_RADEON_CP_INIT command, passing
- * all the parameters in a drm_radeon_init_t structure.
- */
-static int RADEONDRIKernelInit( const DRIDriverContext *ctx,
- RADEONInfoPtr info)
-{
- int cpp = ctx->bpp / 8;
- drm_radeon_init_t drmInfo;
- int ret;
-
- memset(&drmInfo, 0, sizeof(drm_radeon_init_t));
-
- if ( (info->ChipFamily == CHIP_FAMILY_R200) ||
- (info->ChipFamily == CHIP_FAMILY_RV250) ||
- (info->ChipFamily == CHIP_FAMILY_M9) ||
- (info->ChipFamily == CHIP_FAMILY_RV280) )
- drmInfo.func = RADEON_INIT_R200_CP;
- else
- drmInfo.func = RADEON_INIT_CP;
-
- /* This is the struct passed to the kernel module for its initialization */
- drmInfo.sarea_priv_offset = sizeof(drm_sarea_t);
- drmInfo.is_pci = ctx->isPCI;
- drmInfo.cp_mode = RADEON_DEFAULT_CP_BM_MODE;
- drmInfo.gart_size = info->gartSize*1024*1024;
- drmInfo.ring_size = info->ringSize*1024*1024;
- drmInfo.usec_timeout = 1000;
- drmInfo.fb_bpp = ctx->bpp;
- drmInfo.depth_bpp = ctx->bpp;
- drmInfo.front_offset = info->frontOffset;
- drmInfo.front_pitch = info->frontPitch * cpp;
- drmInfo.back_offset = info->backOffset;
- drmInfo.back_pitch = info->backPitch * cpp;
- drmInfo.depth_offset = info->depthOffset;
- drmInfo.depth_pitch = info->depthPitch * cpp;
- drmInfo.fb_offset = info->LinearAddr;
- drmInfo.mmio_offset = info->registerHandle;
- drmInfo.ring_offset = info->ringHandle;
- drmInfo.ring_rptr_offset = info->ringReadPtrHandle;
- drmInfo.buffers_offset = info->bufHandle;
- drmInfo.gart_textures_offset = info->gartTexHandle;
-
- ret = drmCommandWrite(ctx->drmFD, DRM_RADEON_CP_INIT, &drmInfo,
- sizeof(drm_radeon_init_t));
-
- return ret >= 0;
-}
-
-
-/**
- * \brief Initialize the AGP heap.
- *
- * \param ctx display handle.
- * \param info driver private data.
- *
- * This function is a wrapper around the DRM_RADEON_INIT_HEAP command, passing
- * all the parameters in a drm_radeon_mem_init_heap structure.
- */
-static void RADEONDRIAgpHeapInit(const DRIDriverContext *ctx,
- RADEONInfoPtr info)
-{
- drm_radeon_mem_init_heap_t drmHeap;
-
- /* Start up the simple memory manager for gart space */
- drmHeap.region = RADEON_MEM_REGION_GART;
- drmHeap.start = 0;
- drmHeap.size = info->gartTexMapSize;
-
- if (drmCommandWrite(ctx->drmFD, DRM_RADEON_INIT_HEAP,
- &drmHeap, sizeof(drmHeap))) {
- fprintf(stderr,
- "[drm] Failed to initialized gart heap manager\n");
- } else {
- fprintf(stderr,
- "[drm] Initialized kernel gart heap manager, %d\n",
- info->gartTexMapSize);
- }
-}
-
-/**
- * \brief Add a map for the vertex buffers that will be accessed by any
- * DRI-based clients.
- *
- * \param ctx display handle.
- * \param info driver private data.
- *
- * \return one on success, or zero on failure.
- *
- * Calls drmAddBufs() with the previously allocated vertex buffers.
- */
-static int RADEONDRIBufInit( const DRIDriverContext *ctx, RADEONInfoPtr info )
-{
- /* Initialize vertex buffers */
- info->bufNumBufs = drmAddBufs(ctx->drmFD,
- info->bufMapSize / RADEON_BUFFER_SIZE,
- RADEON_BUFFER_SIZE,
- ctx->isPCI ? DRM_SG_BUFFER : DRM_AGP_BUFFER,
- info->bufStart);
-
- if (info->bufNumBufs <= 0) {
- fprintf(stderr,
- "[drm] Could not create vertex/indirect buffers list\n");
- return 0;
- }
- fprintf(stderr,
- "[drm] Added %d %d byte vertex/indirect buffers\n",
- info->bufNumBufs, RADEON_BUFFER_SIZE);
-
- return 1;
-}
-
-/**
- * \brief Install an IRQ handler.
- *
- * \param ctx display handle.
- * \param info driver private data.
- *
- * Attempts to install an IRQ handler via drmCtlInstHandler(), falling back to
- * IRQ-free operation on failure.
- */
-static void RADEONDRIIrqInit(const DRIDriverContext *ctx,
- RADEONInfoPtr info)
-{
- if (!info->irq) {
- info->irq = drmGetInterruptFromBusID(ctx->drmFD,
- ctx->pciBus,
- ctx->pciDevice,
- ctx->pciFunc);
-
- if ((drmCtlInstHandler(ctx->drmFD, info->irq)) != 0) {
- fprintf(stderr,
- "[drm] failure adding irq handler, "
- "there is a device already using that irq\n"
- "[drm] falling back to irq-free operation\n");
- info->irq = 0;
- }
- }
-
- if (info->irq)
- fprintf(stderr,
- "[drm] dma control initialized, using IRQ %d\n",
- info->irq);
-}
-
-static int RADEONCheckDRMVersion( const DRIDriverContext *ctx,
- RADEONInfoPtr info )
-{
- drmVersionPtr version;
-
- version = drmGetVersion(ctx->drmFD);
- if (version) {
- int req_minor, req_patch;
-
- /* Need 1.8.x for proper cleanup-on-client-exit behaviour.
- */
- req_minor = 8;
- req_patch = 0;
-
- if (version->version_major != 1 ||
- version->version_minor < req_minor ||
- (version->version_minor == req_minor &&
- version->version_patchlevel < req_patch)) {
- /* Incompatible drm version */
- fprintf(stderr,
- "[dri] RADEONDRIScreenInit failed because of a version "
- "mismatch.\n"
- "[dri] radeon.o kernel module version is %d.%d.%d "
- "but version 1.%d.%d or newer is needed.\n"
- "[dri] Disabling DRI.\n",
- version->version_major,
- version->version_minor,
- version->version_patchlevel,
- req_minor,
- req_patch);
- drmFreeVersion(version);
- return 0;
- }
-
- info->drmMinor = version->version_minor;
- drmFreeVersion(version);
- }
-
- return 1;
-}
-
-static int RADEONMemoryInit( const DRIDriverContext *ctx, RADEONInfoPtr info )
-{
- int width_bytes = ctx->shared.virtualWidth * ctx->cpp;
- int cpp = ctx->cpp;
- int bufferSize = ((((ctx->shared.virtualHeight+15) & ~15) * width_bytes + RADEON_BUFFER_ALIGN) & ~RADEON_BUFFER_ALIGN);
- int depthSize = ((((ctx->shared.virtualHeight+15) & ~15) * width_bytes
- + RADEON_BUFFER_ALIGN) & ~RADEON_BUFFER_ALIGN);
- int l;
-
- info->frontOffset = 0;
- info->frontPitch = ctx->shared.virtualWidth;
-
- fprintf(stderr,
- "Using %d MB AGP aperture\n", info->gartSize);
- fprintf(stderr,
- "Using %d MB for the ring buffer\n", info->ringSize);
- fprintf(stderr,
- "Using %d MB for vertex/indirect buffers\n", info->bufSize);
- fprintf(stderr,
- "Using %d MB for AGP textures\n", info->gartTexSize);
-
- /* Front, back and depth buffers - everything else texture??
- */
- info->textureSize = ctx->shared.fbSize - 2 * bufferSize - depthSize;
-
- if (ctx->colorTiling==1)
- {
- info->textureSize = ctx->shared.fbSize - ((ctx->shared.fbSize - info->textureSize + width_bytes * 16 - 1) / (width_bytes * 16)) * (width_bytes*16);
- }
-
- if (info->textureSize < 0)
- return 0;
-
- l = RADEONMinBits((info->textureSize-1) / RADEON_NR_TEX_REGIONS);
- if (l < RADEON_LOG_TEX_GRANULARITY) l = RADEON_LOG_TEX_GRANULARITY;
-
- /* Round the texture size up to the nearest whole number of
- * texture regions. Again, be greedy about this, don't
- * round down.
- */
- info->log2TexGran = l;
- info->textureSize = (info->textureSize >> l) << l;
-
- /* Set a minimum usable local texture heap size. This will fit
- * two 256x256x32bpp textures.
- */
- if (info->textureSize < 512 * 1024) {
- info->textureOffset = 0;
- info->textureSize = 0;
- }
-
- /* Reserve space for textures */
- if (ctx->colorTiling==1)
- {
- info->textureOffset = ((ctx->shared.fbSize - info->textureSize) /
- (width_bytes * 16)) * (width_bytes*16);
- }
- else
- {
- info->textureOffset = ((ctx->shared.fbSize - info->textureSize +
- RADEON_BUFFER_ALIGN) &
- ~RADEON_BUFFER_ALIGN);
- }
- /* Reserve space for the shared depth
- * buffer.
- */
- info->depthOffset = ((info->textureOffset - depthSize +
- RADEON_BUFFER_ALIGN) &
- ~RADEON_BUFFER_ALIGN);
- info->depthPitch = ctx->shared.virtualWidth;
-
- info->backOffset = ((info->depthOffset - bufferSize +
- RADEON_BUFFER_ALIGN) &
- ~RADEON_BUFFER_ALIGN);
- info->backPitch = ctx->shared.virtualWidth;
-
-
- fprintf(stderr,
- "Will use back buffer at offset 0x%x\n",
- info->backOffset);
- fprintf(stderr,
- "Will use depth buffer at offset 0x%x\n",
- info->depthOffset);
- fprintf(stderr,
- "Will use %d kb for textures at offset 0x%x\n",
- info->textureSize/1024, info->textureOffset);
-
- info->frontPitchOffset = (((info->frontPitch * cpp / 64) << 22) |
- (info->frontOffset >> 10));
-
- info->backPitchOffset = (((info->backPitch * cpp / 64) << 22) |
- (info->backOffset >> 10));
-
- info->depthPitchOffset = (((info->depthPitch * cpp / 64) << 22) |
- (info->depthOffset >> 10));
-
- return 1;
-}
-
-static int RADEONColorTilingInit( const DRIDriverContext *ctx, RADEONInfoPtr info )
-{
- int width_bytes = ctx->shared.virtualWidth * ctx->cpp;
- int bufferSize = ((((ctx->shared.virtualHeight+15) & ~15) * width_bytes + RADEON_BUFFER_ALIGN)
- & ~RADEON_BUFFER_ALIGN);
- /* Setup color tiling */
- if (info->drmMinor<14)
- info->colorTiling=0;
-
- if (info->colorTiling)
- {
-
- int colorTilingFlag;
- drm_radeon_surface_alloc_t front,back;
-
- RadeonSetParam(ctx, RADEON_SETPARAM_SWITCH_TILING, info->colorTiling ? 1 : 0);
-
- /* Setup the surfaces */
- if (info->ChipFamily < CHIP_FAMILY_R200)
- colorTilingFlag=RADEON_SURF_TILE_COLOR_MACRO;
- else
- colorTilingFlag=R200_SURF_TILE_COLOR_MACRO;
-
- front.address = info->frontOffset;
- front.size = bufferSize;
- front.flags = (width_bytes) | colorTilingFlag;
- drmCommandWrite(ctx->drmFD, DRM_RADEON_SURF_ALLOC, &front,sizeof(front));
-
- back.address = info->backOffset;
- back.size = bufferSize;
- back.flags = (width_bytes) | colorTilingFlag;
- drmCommandWrite(ctx->drmFD, DRM_RADEON_SURF_ALLOC, &back,sizeof(back));
-
- }
- return 1;
-}
-
-
-
-/**
- * Called at the start of each server generation.
- *
- * \param ctx display handle.
- * \param info driver private data.
- *
- * \return non-zero on success, or zero on failure.
- *
- * Performs static frame buffer allocation. Opens the DRM device and add maps
- * to the SAREA, framebuffer and MMIO regions. Fills in \p info with more
- * information. Creates a \e server context to grab the lock for the
- * initialization ioctls and calls the other initilization functions in this
- * file. Starts the CP engine via the DRM_RADEON_CP_START command.
- *
- * Setups a RADEONDRIRec structure to be passed to radeon_dri.so for its
- * initialization.
- */
-static int RADEONScreenInit( DRIDriverContext *ctx, RADEONInfoPtr info )
-{
- RADEONDRIPtr pRADEONDRI;
- int err;
-
- usleep(100);
- /*assert(!ctx->IsClient);*/
-
- {
- int width_bytes = (ctx->shared.virtualWidth * ctx->cpp);
- int maxy = ctx->shared.fbSize / width_bytes;
-
-
- if (maxy <= ctx->shared.virtualHeight * 3) {
- fprintf(stderr,
- "Static buffer allocation failed -- "
- "need at least %d kB video memory (have %d kB)\n",
- (ctx->shared.virtualWidth * ctx->shared.virtualHeight *
- ctx->cpp * 3 + 1023) / 1024,
- ctx->shared.fbSize / 1024);
- return 0;
- }
- }
-
-
- if (info->ChipFamily >= CHIP_FAMILY_R300) {
- fprintf(stderr,
- "Direct rendering not yet supported on "
- "Radeon 9700 and newer cards\n");
- return 0;
- }
-
- radeon_drm_page_size = getpagesize();
-
- info->registerSize = ctx->MMIOSize;
- ctx->shared.SAREASize = SAREA_MAX;
-
- /* Note that drmOpen will try to load the kernel module, if needed. */
- ctx->drmFD = drmOpen("radeon", NULL );
- if (ctx->drmFD < 0) {
- fprintf(stderr, "[drm] drmOpen failed\n");
- return 0;
- }
-
- if ((err = drmSetBusid(ctx->drmFD, ctx->pciBusID)) < 0) {
- fprintf(stderr, "[drm] drmSetBusid failed (%d, %s), %s\n",
- ctx->drmFD, ctx->pciBusID, strerror(-err));
- return 0;
- }
-
- if (drmAddMap( ctx->drmFD,
- 0,
- ctx->shared.SAREASize,
- DRM_SHM,
- DRM_CONTAINS_LOCK,
- &ctx->shared.hSAREA) < 0)
- {
- fprintf(stderr, "[drm] drmAddMap failed\n");
- return 0;
- }
- fprintf(stderr, "[drm] added %d byte SAREA at 0x%08lx\n",
- ctx->shared.SAREASize, ctx->shared.hSAREA);
-
- if (drmMap( ctx->drmFD,
- ctx->shared.hSAREA,
- ctx->shared.SAREASize,
- (drmAddressPtr)(&ctx->pSAREA)) < 0)
- {
- fprintf(stderr, "[drm] drmMap failed\n");
- return 0;
- }
- memset(ctx->pSAREA, 0, ctx->shared.SAREASize);
- fprintf(stderr, "[drm] mapped SAREA 0x%08lx to %p, size %d\n",
- ctx->shared.hSAREA, ctx->pSAREA, ctx->shared.SAREASize);
-
- /* Need to AddMap the framebuffer and mmio regions here:
- */
- if (drmAddMap( ctx->drmFD,
- (drm_handle_t)ctx->FBStart,
- ctx->FBSize,
- DRM_FRAME_BUFFER,
-#ifndef _EMBEDDED
- 0,
-#else
- DRM_READ_ONLY,
-#endif
- &ctx->shared.hFrameBuffer) < 0)
- {
- fprintf(stderr, "[drm] drmAddMap framebuffer failed\n");
- return 0;
- }
-
- fprintf(stderr, "[drm] framebuffer handle = 0x%08lx\n",
- ctx->shared.hFrameBuffer);
-
-
-
- if (drmAddMap(ctx->drmFD,
- ctx->MMIOStart,
- ctx->MMIOSize,
- DRM_REGISTERS,
- DRM_READ_ONLY,
- &info->registerHandle) < 0) {
- fprintf(stderr, "[drm] drmAddMap mmio failed\n");
- return 0;
- }
- fprintf(stderr,
- "[drm] register handle = 0x%08lx\n", info->registerHandle);
-
- /* Check the radeon DRM version */
- if (!RADEONCheckDRMVersion(ctx, info)) {
- return 0;
- }
-
- if (ctx->isPCI) {
- /* Initialize PCI */
- if (!RADEONDRIPciInit(ctx, info))
- return 0;
- }
- else {
- /* Initialize AGP */
- if (!RADEONDRIAgpInit(ctx, info))
- return 0;
- }
-
- /* Memory manager setup */
- if (!RADEONMemoryInit(ctx, info)) {
- return 0;
- }
-
- /* Create a 'server' context so we can grab the lock for
- * initialization ioctls.
- */
- if ((err = drmCreateContext(ctx->drmFD, &ctx->serverContext)) != 0) {
- fprintf(stderr, "%s: drmCreateContext failed %d\n", __FUNCTION__, err);
- return 0;
- }
-
- DRM_LOCK(ctx->drmFD, ctx->pSAREA, ctx->serverContext, 0);
-
- /* Initialize the kernel data structures */
- if (!RADEONDRIKernelInit(ctx, info)) {
- fprintf(stderr, "RADEONDRIKernelInit failed\n");
- DRM_UNLOCK(ctx->drmFD, ctx->pSAREA, ctx->serverContext);
- return 0;
- }
-
- /* Initialize the vertex buffers list */
- if (!RADEONDRIBufInit(ctx, info)) {
- fprintf(stderr, "RADEONDRIBufInit failed\n");
- DRM_UNLOCK(ctx->drmFD, ctx->pSAREA, ctx->serverContext);
- return 0;
- }
-
- RADEONColorTilingInit(ctx, info);
-
- /* Initialize IRQ */
- RADEONDRIIrqInit(ctx, info);
-
- /* Initialize kernel gart memory manager */
- RADEONDRIAgpHeapInit(ctx, info);
-
- fprintf(stderr,"color tiling %sabled\n", info->colorTiling?"en":"dis");
- fprintf(stderr,"page flipping %sabled\n", info->page_flip_enable?"en":"dis");
- /* Initialize the SAREA private data structure */
- {
- drm_radeon_sarea_t *pSAREAPriv;
- pSAREAPriv = (drm_radeon_sarea_t *)(((char*)ctx->pSAREA) +
- sizeof(drm_sarea_t));
- memset(pSAREAPriv, 0, sizeof(*pSAREAPriv));
- pSAREAPriv->pfState = info->page_flip_enable;
- }
-
-
- /* Quick hack to clear the front & back buffers. Could also use
- * the clear ioctl to do this, but would need to setup hw state
- * first.
- */
- drimemsetio((char *)ctx->FBAddress + info->frontOffset,
- 0,
- info->frontPitch * ctx->cpp * ctx->shared.virtualHeight );
-
- drimemsetio((char *)ctx->FBAddress + info->backOffset,
- 0,
- info->backPitch * ctx->cpp * ctx->shared.virtualHeight );
-
- /* This is the struct passed to radeon_dri.so for its initialization */
- ctx->driverClientMsg = malloc(sizeof(RADEONDRIRec));
- ctx->driverClientMsgSize = sizeof(RADEONDRIRec);
- pRADEONDRI = (RADEONDRIPtr)ctx->driverClientMsg;
- pRADEONDRI->deviceID = info->Chipset;
- pRADEONDRI->width = ctx->shared.virtualWidth;
- pRADEONDRI->height = ctx->shared.virtualHeight;
- pRADEONDRI->depth = ctx->bpp; /* XXX: depth */
- pRADEONDRI->bpp = ctx->bpp;
- pRADEONDRI->IsPCI = ctx->isPCI;
- pRADEONDRI->AGPMode = ctx->agpmode;
- pRADEONDRI->frontOffset = info->frontOffset;
- pRADEONDRI->frontPitch = info->frontPitch;
- pRADEONDRI->backOffset = info->backOffset;
- pRADEONDRI->backPitch = info->backPitch;
- pRADEONDRI->depthOffset = info->depthOffset;
- pRADEONDRI->depthPitch = info->depthPitch;
- pRADEONDRI->textureOffset = info->textureOffset;
- pRADEONDRI->textureSize = info->textureSize;
- pRADEONDRI->log2TexGran = info->log2TexGran;
- pRADEONDRI->registerHandle = info->registerHandle;
- pRADEONDRI->registerSize = info->registerSize;
- pRADEONDRI->statusHandle = info->ringReadPtrHandle;
- pRADEONDRI->statusSize = info->ringReadMapSize;
- pRADEONDRI->gartTexHandle = info->gartTexHandle;
- pRADEONDRI->gartTexMapSize = info->gartTexMapSize;
- pRADEONDRI->log2GARTTexGran = info->log2GARTTexGran;
- pRADEONDRI->gartTexOffset = info->gartTexStart;
- pRADEONDRI->sarea_priv_offset = sizeof(drm_sarea_t);
-
- /* Don't release the lock now - let the VT switch handler do it. */
-
- return 1;
-}
-
-
-/**
- * \brief Get Radeon chip family from chipset number.
- *
- * \param info driver private data.
- *
- * \return non-zero on success, or zero on failure.
- *
- * Called by radeonInitFBDev() to set RADEONInfoRec::ChipFamily
- * according to the value of RADEONInfoRec::Chipset. Fails if the
- * chipset is unrecognized or not appropriate for this driver (i.e., not
- * an r100 style radeon)
- */
-static int get_chipfamily_from_chipset( RADEONInfoPtr info )
-{
- switch (info->Chipset) {
- case PCI_CHIP_RADEON_LY:
- case PCI_CHIP_RADEON_LZ:
- info->ChipFamily = CHIP_FAMILY_M6;
- break;
-
- case PCI_CHIP_RADEON_QY:
- case PCI_CHIP_RADEON_QZ:
- info->ChipFamily = CHIP_FAMILY_VE;
- break;
-
- case PCI_CHIP_R200_QL:
- case PCI_CHIP_R200_QN:
- case PCI_CHIP_R200_QO:
- case PCI_CHIP_R200_Ql:
- case PCI_CHIP_R200_BB:
- info->ChipFamily = CHIP_FAMILY_R200;
- break;
-
- case PCI_CHIP_RV200_QW: /* RV200 desktop */
- case PCI_CHIP_RV200_QX:
- info->ChipFamily = CHIP_FAMILY_RV200;
- break;
-
- case PCI_CHIP_RADEON_LW:
- case PCI_CHIP_RADEON_LX:
- info->ChipFamily = CHIP_FAMILY_M7;
- break;
-
- case PCI_CHIP_RV250_Id:
- case PCI_CHIP_RV250_Ie:
- case PCI_CHIP_RV250_If:
- case PCI_CHIP_RV250_Ig:
- info->ChipFamily = CHIP_FAMILY_RV250;
- break;
-
- case PCI_CHIP_RV250_Ld:
- case PCI_CHIP_RV250_Le:
- case PCI_CHIP_RV250_Lf:
- case PCI_CHIP_RV250_Lg:
- info->ChipFamily = CHIP_FAMILY_M9;
- break;
-
- case PCI_CHIP_RV280_Y_:
- case PCI_CHIP_RV280_Ya:
- case PCI_CHIP_RV280_Yb:
- case PCI_CHIP_RV280_Yc:
- info->ChipFamily = CHIP_FAMILY_RV280;
- break;
-
- case PCI_CHIP_R300_ND:
- case PCI_CHIP_R300_NE:
- case PCI_CHIP_R300_NF:
- case PCI_CHIP_R300_NG:
- info->ChipFamily = CHIP_FAMILY_R300;
- break;
-
- default:
- /* Original Radeon/7200 */
- info->ChipFamily = CHIP_FAMILY_RADEON;
- }
-
- return 1;
-}
-
-
-/**
- * \brief Validate the fbdev mode.
- *
- * \param ctx display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Saves some registers and returns 1.
- *
- * \sa radeonValidateMode().
- */
-static int radeonValidateMode( const DRIDriverContext *ctx )
-{
- unsigned char *RADEONMMIO = ctx->MMIOAddress;
- RADEONInfoPtr info = ctx->driverPrivate;
-
- info->gen_int_cntl = INREG(RADEON_GEN_INT_CNTL);
- info->crtc_offset_cntl = INREG(RADEON_CRTC_OFFSET_CNTL);
-
- if (info->colorTiling)
- info->crtc_offset_cntl |= RADEON_CRTC_TILE_EN;
- return 1;
-}
-
-
-/**
- * \brief Examine mode returned by fbdev.
- *
- * \param ctx display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Restores registers that fbdev has clobbered and returns 1.
- *
- * \sa radeonValidateMode().
- */
-static int radeonPostValidateMode( const DRIDriverContext *ctx )
-{
- unsigned char *RADEONMMIO = ctx->MMIOAddress;
- RADEONInfoPtr info = ctx->driverPrivate;
-
- RADEONColorTilingInit( ctx, info);
- OUTREG(RADEON_GEN_INT_CNTL, info->gen_int_cntl);
- if (info->colorTiling)
- info->crtc_offset_cntl |= RADEON_CRTC_TILE_EN;
- OUTREG(RADEON_CRTC_OFFSET_CNTL, info->crtc_offset_cntl);
-
- return 1;
-}
-
-
-/**
- * \brief Initialize the framebuffer device mode
- *
- * \param ctx display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Fills in \p info with some default values and some information from \p ctx
- * and then calls RADEONScreenInit() for the screen initialization.
- *
- * Before exiting clears the framebuffer memory accessing it directly.
- */
-static int radeonInitFBDev( DRIDriverContext *ctx )
-{
- RADEONInfoPtr info = calloc(1, sizeof(*info));
-
- {
- int dummy = ctx->shared.virtualWidth;
-
- if (ctx->colorTiling==1)
- {
- switch (ctx->bpp / 8) {
- case 1: dummy = (ctx->shared.virtualWidth + 255) & ~255; break;
- case 2: dummy = (ctx->shared.virtualWidth + 127) & ~127; break;
- case 3:
- case 4: dummy = (ctx->shared.virtualWidth + 63) & ~63; break;
- }
- } else {
- switch (ctx->bpp / 8) {
- case 1: dummy = (ctx->shared.virtualWidth + 127) & ~127; break;
- case 2: dummy = (ctx->shared.virtualWidth + 31) & ~31; break;
- case 3:
- case 4: dummy = (ctx->shared.virtualWidth + 15) & ~15; break;
- }
- }
-
- ctx->shared.virtualWidth = dummy;
- ctx->shared.Width = dummy;
- }
-
- fprintf(stderr,"shared virtual width is %d\n", ctx->shared.virtualWidth);
- ctx->driverPrivate = (void *)info;
-
- info->gartFastWrite = RADEON_DEFAULT_AGP_FAST_WRITE;
- info->gartSize = RADEON_DEFAULT_AGP_SIZE;
- info->gartTexSize = RADEON_DEFAULT_AGP_TEX_SIZE;
- info->bufSize = RADEON_DEFAULT_BUFFER_SIZE;
- info->ringSize = RADEON_DEFAULT_RING_SIZE;
- info->page_flip_enable = RADEON_DEFAULT_PAGE_FLIP;
- info->colorTiling = ctx->colorTiling;
-
- info->Chipset = ctx->chipset;
-
- if (!get_chipfamily_from_chipset( info )) {
- fprintf(stderr, "Unknown or non-radeon chipset -- cannot continue\n");
- fprintf(stderr, "==> Verify PCI BusID is correct in miniglx.conf\n");
- return 0;
- }
-
- info->frontPitch = ctx->shared.virtualWidth;
- info->LinearAddr = ctx->FBStart & 0xfc000000;
-
-
- if (!RADEONScreenInit( ctx, info ))
- return 0;
-
-
- return 1;
-}
-
-
-/**
- * \brief The screen is being closed, so clean up any state and free any
- * resources used by the DRI.
- *
- * \param ctx display handle.
- *
- * Unmaps the SAREA, closes the DRM device file descriptor and frees the driver
- * private data.
- */
-static void radeonHaltFBDev( DRIDriverContext *ctx )
-{
- drmUnmap( ctx->pSAREA, ctx->shared.SAREASize );
- drmClose(ctx->drmFD);
-
- if (ctx->driverPrivate) {
- free(ctx->driverPrivate);
- ctx->driverPrivate = 0;
- }
-}
-
-
-extern void radeonNotifyFocus( int );
-
-/**
- * \brief Exported driver interface for Mini GLX.
- *
- * \sa DRIDriverRec.
- */
-const struct DRIDriverRec __driDriver = {
- radeonValidateMode,
- radeonPostValidateMode,
- radeonInitFBDev,
- radeonHaltFBDev,
- RADEONEngineShutdown,
- RADEONEngineRestore,
-#ifndef _EMBEDDED
- 0,
-#else
- radeonNotifyFocus,
-#endif
-};
diff --git a/src/mesa/drivers/dri/savage/Makefile b/src/mesa/drivers/dri/savage/Makefile
index 2e5c40802c..53511552c6 100644
--- a/src/mesa/drivers/dri/savage/Makefile
+++ b/src/mesa/drivers/dri/savage/Makefile
@@ -5,9 +5,6 @@ include $(TOP)/configs/current
LIBNAME = savage_dri.so
-# Doesn't exist yet.
-#MINIGLX_SOURCES = server/savage_dri.c
-
DRIVER_SOURCES = \
savage_xmesa.c \
savagedd.c \
diff --git a/src/mesa/drivers/dri/sis/Makefile b/src/mesa/drivers/dri/sis/Makefile
index ad009fc239..6b4f938bab 100644
--- a/src/mesa/drivers/dri/sis/Makefile
+++ b/src/mesa/drivers/dri/sis/Makefile
@@ -5,10 +5,6 @@ include $(TOP)/configs/current
LIBNAME = sis_dri.so
-
-# Not yet
-# MINIGLX_SOURCES = server/sis_dri.c
-
DRIVER_SOURCES = \
sis6326_state.c \
sis6326_clear.c \
diff --git a/src/mesa/drivers/dri/swrast/Makefile b/src/mesa/drivers/dri/swrast/Makefile
index 771169c1ff..d2cf6dbc55 100644
--- a/src/mesa/drivers/dri/swrast/Makefile
+++ b/src/mesa/drivers/dri/swrast/Makefile
@@ -5,6 +5,8 @@ include $(TOP)/configs/current
LIBNAME = swrast_dri.so
+DRIVER_DEFINES = -D__NOT_HAVE_DRM_H
+
DRIVER_SOURCES = \
swrast.c \
swrast_span.c
@@ -17,7 +19,8 @@ ASM_SOURCES =
SWRAST_COMMON_SOURCES = \
../../common/driverfuncs.c \
- ../common/utils.c
+ ../common/utils.c \
+ ../common/drisw_util.c
include ../Makefile.template
diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c
index 03c672ecf1..8b68281fab 100644
--- a/src/mesa/drivers/dri/swrast/swrast.c
+++ b/src/mesa/drivers/dri/swrast/swrast.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 George Sapountzis <gsap7@yahoo.gr>
+ * Copyright 2008, 2010 George Sapountzis <gsapountzis@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -54,17 +54,9 @@
* Screen and config-related functions
*/
-static void
-setupLoaderExtensions(__DRIscreen *psp,
- const __DRIextension **extensions)
-{
- int i;
-
- for (i = 0; extensions[i]; i++) {
- if (strcmp(extensions[i]->name, __DRI_SWRAST_LOADER) == 0)
- psp->swrast_loader = (__DRIswrastLoaderExtension *) extensions[i];
- }
-}
+static const __DRIextension *dri_screen_extensions[] = {
+ NULL
+};
static __DRIconfig **
swrastFillInModes(__DRIscreen *psp,
@@ -143,26 +135,14 @@ swrastFillInModes(__DRIscreen *psp,
return configs;
}
-static __DRIscreen *
-driCreateNewScreen(int scrn, const __DRIextension **extensions,
- const __DRIconfig ***driver_configs, void *data)
+static const __DRIconfig **
+dri_init_screen(__DRIscreen * psp)
{
- static const __DRIextension *emptyExtensionList[] = { NULL };
- __DRIscreen *psp;
__DRIconfig **configs8, **configs16, **configs24, **configs32;
- (void) data;
-
TRACE;
- psp = calloc(1, sizeof(*psp));
- if (!psp)
- return NULL;
-
- setupLoaderExtensions(psp, extensions);
-
- psp->num = scrn;
- psp->extensions = emptyExtensionList;
+ psp->extensions = dri_screen_extensions;
configs8 = swrastFillInModes(psp, 8, 8, 0, 1);
configs16 = swrastFillInModes(psp, 16, 16, 0, 1);
@@ -171,28 +151,15 @@ driCreateNewScreen(int scrn, const __DRIextension **extensions,
configs16 = driConcatConfigs(configs8, configs16);
configs24 = driConcatConfigs(configs16, configs24);
- *driver_configs = (const __DRIconfig **)
- driConcatConfigs(configs24, configs32);
-
- driInitExtensions( NULL, NULL, GL_FALSE );
-
- return psp;
-}
-
-static void driDestroyScreen(__DRIscreen *psp)
-{
- TRACE;
+ configs32 = driConcatConfigs(configs24, configs32);
- if (psp) {
- free(psp);
- }
+ return (const __DRIconfig **)configs32;
}
-static const __DRIextension **driGetExtensions(__DRIscreen *psp)
+static void
+dri_destroy_screen(__DRIscreen * sPriv)
{
TRACE;
-
- return psp->extensions;
}
@@ -239,12 +206,20 @@ swrast_delete_renderbuffer(struct gl_renderbuffer *rb)
free(rb);
}
+/* see bytes_per_line in libGL */
+static INLINE int
+bytes_per_line(unsigned pitch_bits, unsigned mul)
+{
+ unsigned mask = mul - 1;
+
+ return ((pitch_bits + mask) & ~mask) / 8;
+}
+
static GLboolean
swrast_alloc_front_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
GLenum internalFormat, GLuint width, GLuint height)
{
struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
- unsigned mask = PITCH_ALIGN_BITS - 1;
TRACE;
@@ -252,8 +227,7 @@ swrast_alloc_front_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
rb->Width = width;
rb->Height = height;
- /* always pad to PITCH_ALIGN_BITS */
- xrb->pitch = ((width * xrb->bpp + mask) & ~mask) / 8;
+ xrb->pitch = bytes_per_line(width * xrb->bpp, 32);
return GL_TRUE;
}
@@ -336,94 +310,118 @@ swrast_new_renderbuffer(const GLvisual *visual, GLboolean front)
return xrb;
}
-static __DRIdrawable *
-driCreateNewDrawable(__DRIscreen *screen,
- const __DRIconfig *config, void *data)
+static GLboolean
+dri_create_buffer(__DRIscreen * sPriv,
+ __DRIdrawable * dPriv,
+ const __GLcontextModes * visual, GLboolean isPixmap)
{
- __DRIdrawable *buf;
+ struct dri_drawable *drawable = NULL;
+ GLframebuffer *fb;
struct swrast_renderbuffer *frontrb, *backrb;
TRACE;
- buf = calloc(1, sizeof *buf);
- if (!buf)
- return NULL;
+ drawable = CALLOC_STRUCT(dri_drawable);
+ if (drawable == NULL)
+ goto drawable_fail;
- buf->loaderPrivate = data;
+ dPriv->driverPrivate = drawable;
+ drawable->dPriv = dPriv;
- buf->driScreenPriv = screen;
+ drawable->row = malloc(MAX_WIDTH * 4);
+ if (drawable->row == NULL)
+ goto drawable_fail;
- buf->row = malloc(MAX_WIDTH * 4);
+ fb = &drawable->Base;
/* basic framebuffer setup */
- _mesa_initialize_window_framebuffer(&buf->Base, &config->modes);
+ _mesa_initialize_window_framebuffer(fb, visual);
/* add front renderbuffer */
- frontrb = swrast_new_renderbuffer(&config->modes, GL_TRUE);
- _mesa_add_renderbuffer(&buf->Base, BUFFER_FRONT_LEFT, &frontrb->Base);
+ frontrb = swrast_new_renderbuffer(visual, GL_TRUE);
+ _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontrb->Base);
/* add back renderbuffer */
- if (config->modes.doubleBufferMode) {
- backrb = swrast_new_renderbuffer(&config->modes, GL_FALSE);
- _mesa_add_renderbuffer(&buf->Base, BUFFER_BACK_LEFT, &backrb->Base);
+ if (visual->doubleBufferMode) {
+ backrb = swrast_new_renderbuffer(visual, GL_FALSE);
+ _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backrb->Base);
}
/* add software renderbuffers */
- _mesa_add_soft_renderbuffers(&buf->Base,
+ _mesa_add_soft_renderbuffers(fb,
GL_FALSE, /* color */
- config->modes.haveDepthBuffer,
- config->modes.haveStencilBuffer,
- config->modes.haveAccumBuffer,
+ visual->haveDepthBuffer,
+ visual->haveStencilBuffer,
+ visual->haveAccumBuffer,
GL_FALSE, /* alpha */
GL_FALSE /* aux bufs */);
- return buf;
+ return GL_TRUE;
+
+drawable_fail:
+
+ if (drawable)
+ free(drawable->row);
+
+ FREE(drawable);
+
+ return GL_FALSE;
}
static void
-driDestroyDrawable(__DRIdrawable *buf)
+dri_destroy_buffer(__DRIdrawable * dPriv)
{
TRACE;
- if (buf) {
- struct gl_framebuffer *fb = &buf->Base;
+ if (dPriv) {
+ struct dri_drawable *drawable = dri_drawable(dPriv);
+ GLframebuffer *fb;
+
+ free(drawable->row);
- free(buf->row);
+ fb = &drawable->Base;
fb->DeletePending = GL_TRUE;
_mesa_reference_framebuffer(&fb, NULL);
}
}
-static void driSwapBuffers(__DRIdrawable *buf)
+static void
+dri_swap_buffers(__DRIdrawable * dPriv)
{
- GET_CURRENT_CONTEXT(ctx);
+ __DRIscreen *sPriv = dPriv->driScreenPriv;
- struct swrast_renderbuffer *frontrb =
- swrast_renderbuffer(buf->Base.Attachment[BUFFER_FRONT_LEFT].Renderbuffer);
- struct swrast_renderbuffer *backrb =
- swrast_renderbuffer(buf->Base.Attachment[BUFFER_BACK_LEFT].Renderbuffer);
+ GET_CURRENT_CONTEXT(ctx);
- __DRIscreen *screen = buf->driScreenPriv;
+ struct dri_drawable *drawable = dri_drawable(dPriv);
+ GLframebuffer *fb;
+ struct swrast_renderbuffer *frontrb, *backrb;
TRACE;
+ fb = &drawable->Base;
+
+ frontrb =
+ swrast_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer);
+ backrb =
+ swrast_renderbuffer(fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer);
+
/* check for signle-buffered */
if (backrb == NULL)
return;
/* check if swapping currently bound buffer */
- if (ctx && ctx->DrawBuffer == &(buf->Base)) {
+ if (ctx && ctx->DrawBuffer == fb) {
/* flush pending rendering */
_mesa_notifySwapBuffers(ctx);
}
- screen->swrast_loader->putImage(buf, __DRI_SWRAST_IMAGE_OP_SWAP,
- 0, 0,
- frontrb->Base.Width,
- frontrb->Base.Height,
- backrb->Base.Data,
- buf->loaderPrivate);
+ sPriv->swrast_loader->putImage(dPriv, __DRI_SWRAST_IMAGE_OP_SWAP,
+ 0, 0,
+ frontrb->Base.Width,
+ frontrb->Base.Height,
+ backrb->Base.Data,
+ dPriv->loaderPrivate);
}
@@ -434,13 +432,13 @@ static void driSwapBuffers(__DRIdrawable *buf)
static void
get_window_size( GLframebuffer *fb, GLsizei *w, GLsizei *h )
{
- __DRIdrawable *buf = swrast_drawable(fb);
- __DRIscreen *screen = buf->driScreenPriv;
+ __DRIdrawable *dPriv = swrast_drawable(fb)->dPriv;
+ __DRIscreen *sPriv = dPriv->driScreenPriv;
int x, y;
- screen->swrast_loader->getDrawableInfo(buf,
- &x, &y, w, h,
- buf->loaderPrivate);
+ sPriv->swrast_loader->getDrawableInfo(dPriv,
+ &x, &y, w, h,
+ dPriv->loaderPrivate);
}
static void
@@ -502,37 +500,40 @@ swrast_init_driver_functions(struct dd_function_table *driver)
* Context-related functions.
*/
-static __DRIcontext *
-driCreateNewContext(__DRIscreen *screen, const __DRIconfig *config,
- __DRIcontext *shared, void *data)
+static GLboolean
+dri_create_context(const __GLcontextModes * visual,
+ __DRIcontext * cPriv, void *sharedContextPrivate)
{
- __DRIcontext *ctx;
- GLcontext *mesaCtx;
+ struct dri_context *ctx = NULL;
+ struct dri_context *share = (struct dri_context *)sharedContextPrivate;
+ GLcontext *mesaCtx = NULL;
+ GLcontext *sharedCtx = NULL;
struct dd_function_table functions;
TRACE;
- ctx = calloc(1, sizeof *ctx);
- if (!ctx)
- return NULL;
-
- ctx->loaderPrivate = data;
+ ctx = CALLOC_STRUCT(dri_context);
+ if (ctx == NULL)
+ goto context_fail;
- ctx->driScreenPriv = screen;
+ cPriv->driverPrivate = ctx;
+ ctx->cPriv = cPriv;
/* build table of device driver functions */
_mesa_init_driver_functions(&functions);
swrast_init_driver_functions(&functions);
- if (!_mesa_initialize_context(&ctx->Base, &config->modes,
- shared ? &shared->Base : NULL,
- &functions, (void *) ctx)) {
- free(ctx);
- return NULL;
+ if (share) {
+ sharedCtx = &share->Base;
}
mesaCtx = &ctx->Base;
+ /* basic context setup */
+ if (!_mesa_initialize_context(mesaCtx, visual, sharedCtx, &functions, (void *) cPriv)) {
+ goto context_fail;
+ }
+
/* do bounds checking to prevent segfaults and server crashes! */
mesaCtx->Const.CheckArrayBounds = GL_TRUE;
@@ -558,17 +559,28 @@ driCreateNewContext(__DRIscreen *screen, const __DRIconfig *config,
_mesa_meta_init(mesaCtx);
- return ctx;
+ driInitExtensions( mesaCtx, NULL, GL_FALSE );
+
+ return GL_TRUE;
+
+context_fail:
+
+ FREE(ctx);
+
+ return GL_FALSE;
}
static void
-driDestroyContext(__DRIcontext *ctx)
+dri_destroy_context(__DRIcontext * cPriv)
{
- GLcontext *mesaCtx;
TRACE;
- if (ctx) {
+ if (cPriv) {
+ struct dri_context *ctx = dri_context(cPriv);
+ GLcontext *mesaCtx;
+
mesaCtx = &ctx->Base;
+
_mesa_meta_free(mesaCtx);
_swsetup_DestroyContext( mesaCtx );
_swrast_DestroyContext( mesaCtx );
@@ -578,26 +590,22 @@ driDestroyContext(__DRIcontext *ctx)
}
}
-static int
-driCopyContext(__DRIcontext *dst, __DRIcontext *src, unsigned long mask)
-{
- TRACE;
-
- _mesa_copy_context(&src->Base, &dst->Base, mask);
- return GL_TRUE;
-}
-
-static int driBindContext(__DRIcontext *ctx,
- __DRIdrawable *draw,
- __DRIdrawable *read)
+static GLboolean
+dri_make_current(__DRIcontext * cPriv,
+ __DRIdrawable * driDrawPriv,
+ __DRIdrawable * driReadPriv)
{
GLcontext *mesaCtx;
GLframebuffer *mesaDraw;
GLframebuffer *mesaRead;
TRACE;
- if (ctx) {
- if (!draw || !read)
+ if (cPriv) {
+ struct dri_context *ctx = dri_context(cPriv);
+ struct dri_drawable *draw = dri_drawable(driDrawPriv);
+ struct dri_drawable *read = dri_drawable(driReadPriv);
+
+ if (!driDrawPriv || !driReadPriv)
return GL_FALSE;
mesaCtx = &ctx->Base;
@@ -614,7 +622,7 @@ static int driBindContext(__DRIcontext *ctx,
_glapi_check_multithread();
swrast_check_and_update_window_size(mesaCtx, mesaDraw);
- if (read != draw)
+ if (mesaRead != mesaDraw)
swrast_check_and_update_window_size(mesaCtx, mesaRead);
_mesa_make_current( mesaCtx,
@@ -629,35 +637,25 @@ static int driBindContext(__DRIcontext *ctx,
return GL_TRUE;
}
-static int driUnbindContext(__DRIcontext *ctx)
+static GLboolean
+dri_unbind_context(__DRIcontext * cPriv)
{
TRACE;
- (void) ctx;
+ (void) cPriv;
return GL_TRUE;
}
-static const __DRIcoreExtension driCoreExtension = {
- { __DRI_CORE, __DRI_CORE_VERSION },
- NULL, /* driCreateNewScreen */
- driDestroyScreen,
- driGetExtensions,
- driGetConfigAttrib,
- driIndexConfigAttrib,
- NULL, /* driCreateNewDrawable */
- driDestroyDrawable,
- driSwapBuffers,
- driCreateNewContext,
- driCopyContext,
- driDestroyContext,
- driBindContext,
- driUnbindContext
-};
-
-static const __DRIswrastExtension driSWRastExtension = {
- { __DRI_SWRAST, __DRI_SWRAST_VERSION },
- driCreateNewScreen,
- driCreateNewDrawable
+const struct __DriverAPIRec driDriverAPI = {
+ .InitScreen = dri_init_screen,
+ .DestroyScreen = dri_destroy_screen,
+ .CreateContext = dri_create_context,
+ .DestroyContext = dri_destroy_context,
+ .CreateBuffer = dri_create_buffer,
+ .DestroyBuffer = dri_destroy_buffer,
+ .SwapBuffers = dri_swap_buffers,
+ .MakeCurrent = dri_make_current,
+ .UnbindContext = dri_unbind_context,
};
/* This is the table of extensions that the loader will dlsym() for. */
diff --git a/src/mesa/drivers/dri/swrast/swrast_priv.h b/src/mesa/drivers/dri/swrast/swrast_priv.h
index 4722007f95..6679061a98 100644
--- a/src/mesa/drivers/dri/swrast/swrast_priv.h
+++ b/src/mesa/drivers/dri/swrast/swrast_priv.h
@@ -3,6 +3,7 @@
* Version: 7.1
*
* Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
+ * Copyright 2008, 2010 George Sapountzis <gsapountzis@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -22,11 +23,6 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-/*
- * Authors:
- * George Sapountzis <gsap7@yahoo.gr>
- */
-
#ifndef _SWRAST_PRIV_H
#define _SWRAST_PRIV_H
@@ -34,6 +30,7 @@
#include <GL/gl.h>
#include <GL/internal/dri_interface.h>
#include "main/mtypes.h"
+#include "drisw_util.h"
/**
@@ -58,33 +55,51 @@
/**
* Data types
*/
-struct __DRIscreenRec {
- int num;
-
- const __DRIextension **extensions;
+struct dri_context
+{
+ /* mesa, base class, must be first */
+ GLcontext Base;
- const __DRIswrastLoaderExtension *swrast_loader;
+ /* dri */
+ __DRIcontext *cPriv;
};
-struct __DRIcontextRec {
- GLcontext Base;
-
- void *loaderPrivate;
+static INLINE struct dri_context *
+dri_context(__DRIcontext * driContextPriv)
+{
+ return (struct dri_context *)driContextPriv->driverPrivate;
+}
- __DRIscreen *driScreenPriv;
-};
+static INLINE struct dri_context *
+swrast_context(GLcontext *ctx)
+{
+ return (struct dri_context *) ctx;
+}
-struct __DRIdrawableRec {
+struct dri_drawable
+{
+ /* mesa, base class, must be first */
GLframebuffer Base;
- void *loaderPrivate;
-
- __DRIscreen *driScreenPriv;
+ /* dri */
+ __DRIdrawable *dPriv;
/* scratch row for optimized front-buffer rendering */
char *row;
};
+static INLINE struct dri_drawable *
+dri_drawable(__DRIdrawable * driDrawPriv)
+{
+ return (struct dri_drawable *)driDrawPriv->driverPrivate;
+}
+
+static INLINE struct dri_drawable *
+swrast_drawable(GLframebuffer *fb)
+{
+ return (struct dri_drawable *) fb;
+}
+
struct swrast_renderbuffer {
struct gl_renderbuffer Base;
@@ -94,18 +109,6 @@ struct swrast_renderbuffer {
GLuint bpp;
};
-static INLINE __DRIcontext *
-swrast_context(GLcontext *ctx)
-{
- return (__DRIcontext *) ctx;
-}
-
-static INLINE __DRIdrawable *
-swrast_drawable(GLframebuffer *fb)
-{
- return (__DRIdrawable *) fb;
-}
-
static INLINE struct swrast_renderbuffer *
swrast_renderbuffer(struct gl_renderbuffer *rb)
{
@@ -121,14 +124,6 @@ swrast_renderbuffer(struct gl_renderbuffer *rb)
#define PF_R3G3B2 3 /**< 8bpp TrueColor: 3-R, 3-G, 2-B bits */
#define PF_X8R8G8B8 4 /**< 32bpp TrueColor: 8-R, 8-G, 8-B bits */
-/**
- * Renderbuffer pitch alignment (in bits).
- *
- * The xorg loader requires padding images to 32 bits. However, this should
- * become a screen/drawable parameter XXX
- */
-#define PITCH_ALIGN_BITS 32
-
/* swrast_span.c */
diff --git a/src/mesa/drivers/dri/swrast/swrast_span.c b/src/mesa/drivers/dri/swrast/swrast_span.c
index d896e154f7..c7d0bfdac7 100644
--- a/src/mesa/drivers/dri/swrast/swrast_span.c
+++ b/src/mesa/drivers/dri/swrast/swrast_span.c
@@ -3,6 +3,7 @@
* Version: 7.1
*
* Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
+ * Copyright 2008, 2010 George Sapountzis <gsapountzis@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -22,11 +23,6 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-/*
- * Authors:
- * George Sapountzis <gsap7@yahoo.gr>
- */
-
#include "swrast_priv.h"
#define YFLIP(_xrb, Y) ((_xrb)->Base.Height - (Y) - 1)
diff --git a/src/mesa/drivers/dri/swrast/swrast_spantemp.h b/src/mesa/drivers/dri/swrast/swrast_spantemp.h
index 8487361714..1e9405eebf 100644
--- a/src/mesa/drivers/dri/swrast/swrast_spantemp.h
+++ b/src/mesa/drivers/dri/swrast/swrast_spantemp.h
@@ -39,8 +39,8 @@
static INLINE void
PUT_PIXEL( GLcontext *glCtx, GLint x, GLint y, GLvoid *p )
{
- __DRIcontext *ctx = swrast_context(glCtx);
- __DRIdrawable *draw = swrast_drawable(glCtx->DrawBuffer);
+ __DRIcontext *ctx = swrast_context(glCtx)->cPriv;
+ __DRIdrawable *draw = swrast_drawable(glCtx->DrawBuffer)->dPriv;
__DRIscreen *screen = ctx->driScreenPriv;
@@ -53,8 +53,8 @@ PUT_PIXEL( GLcontext *glCtx, GLint x, GLint y, GLvoid *p )
static INLINE void
GET_PIXEL( GLcontext *glCtx, GLint x, GLint y, GLubyte *p )
{
- __DRIcontext *ctx = swrast_context(glCtx);
- __DRIdrawable *read = swrast_drawable(glCtx->ReadBuffer);
+ __DRIcontext *ctx = swrast_context(glCtx)->cPriv;
+ __DRIdrawable *read = swrast_drawable(glCtx->ReadBuffer)->dPriv;
__DRIscreen *screen = ctx->driScreenPriv;
@@ -65,8 +65,8 @@ GET_PIXEL( GLcontext *glCtx, GLint x, GLint y, GLubyte *p )
static INLINE void
PUT_ROW( GLcontext *glCtx, GLint x, GLint y, GLuint n, char *row )
{
- __DRIcontext *ctx = swrast_context(glCtx);
- __DRIdrawable *draw = swrast_drawable(glCtx->DrawBuffer);
+ __DRIcontext *ctx = swrast_context(glCtx)->cPriv;
+ __DRIdrawable *draw = swrast_drawable(glCtx->DrawBuffer)->dPriv;
__DRIscreen *screen = ctx->driScreenPriv;
@@ -78,8 +78,8 @@ PUT_ROW( GLcontext *glCtx, GLint x, GLint y, GLuint n, char *row )
static INLINE void
GET_ROW( GLcontext *glCtx, GLint x, GLint y, GLuint n, char *row )
{
- __DRIcontext *ctx = swrast_context(glCtx);
- __DRIdrawable *read = swrast_drawable(glCtx->ReadBuffer);
+ __DRIcontext *ctx = swrast_context(glCtx)->cPriv;
+ __DRIdrawable *read = swrast_drawable(glCtx->ReadBuffer)->dPriv;
__DRIscreen *screen = ctx->driScreenPriv;
diff --git a/src/mesa/drivers/dri/tdfx/Makefile b/src/mesa/drivers/dri/tdfx/Makefile
index b9f25db4fe..96bd8f8202 100644
--- a/src/mesa/drivers/dri/tdfx/Makefile
+++ b/src/mesa/drivers/dri/tdfx/Makefile
@@ -5,9 +5,6 @@ include $(TOP)/configs/current
LIBNAME = tdfx_dri.so
-# not yet
-# MINIGLX_SOURCES = server/tdfx_dri.c
-
DRIVER_SOURCES = \
tdfx_context.c \
tdfx_dd.c \
diff --git a/src/mesa/drivers/dri/tdfx/server/tdfx_dri.c b/src/mesa/drivers/dri/tdfx/server/tdfx_dri.c
deleted file mode 100644
index 63fe875f59..0000000000
--- a/src/mesa/drivers/dri/tdfx/server/tdfx_dri.c
+++ /dev/null
@@ -1,471 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version: 5.1
- *
- * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/* Authors:
- * Keith Whitwell
- * Daniel Borca
- */
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-
-#include "driver.h"
-#include "drm.h"
-#include "imports.h"
-
-#include "dri_util.h"
-
-#include "tdfx_context.h"
-#include "tdfx_dri.h"
-#include "xf86drm.h"
-
-
-#define TILE_WIDTH 128
-#define TILE_HEIGHT 32
-
-#define CMDFIFO_PAGES 64
-
-
-static int
-calcBufferStride (int xres, int tiled, int cpp)
-{
- int strideInTiles;
-
- if (tiled) {
- /* Calculate tile width stuff */
- strideInTiles = (xres+TILE_WIDTH-1)/TILE_WIDTH;
-
- return strideInTiles*cpp*TILE_WIDTH;
- } else {
- return xres*cpp;
- }
-} /* calcBufferStride */
-
-
-static int
-calcBufferHeightInTiles (int yres)
-{
- int heightInTiles; /* Height of buffer in tiles */
-
- /* Calculate tile height stuff */
- heightInTiles = yres >> 5;
-
- if (yres & (TILE_HEIGHT - 1))
- heightInTiles++;
-
- return heightInTiles;
-
-} /* calcBufferHeightInTiles */
-
-
-static int
-calcBufferSize (int xres, int yres, int tiled, int cpp)
-{
- int stride, height, bufSize;
-
- if (tiled) {
- stride = calcBufferStride(xres, tiled, cpp);
- height = TILE_HEIGHT * calcBufferHeightInTiles(yres);
- } else {
- stride = xres*cpp;
- height = yres;
- }
-
- bufSize = stride * height;
-
- return bufSize;
-} /* calcBufferSize */
-
-
-static void allocateMemory (const DRIDriverContext *ctx, TDFXDRIPtr pTDFX)
-{
- int memRemaining, fifoSize, screenSizeInTiles;
- int fbSize;
- char *str;
- int pixmapCacheLinesMin;
- int cursorOffset, cursorSize;
-
- pTDFX->stride = calcBufferStride(pTDFX->width, !0, pTDFX->cpp);
-
- /* enough to do DVD */
- pixmapCacheLinesMin = ((720*480*pTDFX->cpp) +
- pTDFX->stride - 1)/pTDFX->stride;
-
- if (pTDFX->deviceID > PCI_CHIP_VOODOO3) {
- if ((pixmapCacheLinesMin + pTDFX->height) > 4095)
- pixmapCacheLinesMin = 4095 - pTDFX->height;
- } else {
- if ((pixmapCacheLinesMin + pTDFX->height) > 2047)
- pixmapCacheLinesMin = 2047 - pTDFX->height;
- }
-
- if (pTDFX->cpp!=3) {
- screenSizeInTiles=calcBufferSize(pTDFX->width, pTDFX->height,
- !0, pTDFX->cpp);
- }
- else {
- /* cpp==3 needs to bump up to 4 */
- screenSizeInTiles=calcBufferSize(pTDFX->width, pTDFX->height,
- !0, 4);
- }
-
- /*
- * Layout is:
- * cursor, fifo, fb, tex, bb, db
- */
-
- fbSize = (pTDFX->height + pixmapCacheLinesMin) * pTDFX->stride;
-
- memRemaining=(pTDFX->mem - 1) &~ 0xFFF;
- /* Note that a page is 4096 bytes, and a */
- /* tile is 32 x 128 = 4096 bytes. So, */
- /* page and tile boundaries are the same */
- /* Place the depth offset first, forcing */
- /* it to be on an *odd* page boundary. */
- pTDFX->depthOffset = (memRemaining - screenSizeInTiles) &~ 0xFFF;
- if ((pTDFX->depthOffset & (0x1 << 12)) == 0) {
- pTDFX->depthOffset -= (0x1 << 12);
- }
- /* Now, place the back buffer, forcing it */
- /* to be on an *even* page boundary. */
- pTDFX->backOffset = (pTDFX->depthOffset - screenSizeInTiles) &~ 0xFFF;
- if (pTDFX->backOffset & (0x1 << 12)) {
- pTDFX->backOffset -= (0x1 << 12);
- }
- /* Give the cmd fifo at least */
- /* CMDFIFO_PAGES pages, but no more than */
- /* 64. NOTE: Don't go higher than 64, as */
- /* there is suspect code in Glide3 ! */
- fifoSize = ((64 <= CMDFIFO_PAGES) ? 64 : CMDFIFO_PAGES) << 12;
-
- /* We give 4096 bytes to the cursor */
- cursorSize = 0/*4096*/;
- cursorOffset = 0;
-
- pTDFX->fifoOffset = cursorOffset + cursorSize;
- pTDFX->fifoSize = fifoSize;
- /* Now, place the front buffer, forcing */
- /* it to be on a page boundary too, just */
- /* for giggles. */
- pTDFX->fbOffset = pTDFX->fifoOffset + pTDFX->fifoSize;
- pTDFX->textureOffset = pTDFX->fbOffset + fbSize;
- if (pTDFX->depthOffset <= pTDFX->textureOffset ||
- pTDFX->backOffset <= pTDFX->textureOffset) {
- /*
- * pTDFX->textureSize < 0 means that the DRI is disabled. pTDFX->backOffset
- * is used to calculate the maximum amount of memory available for
- * 2D offscreen use. With DRI disabled, set this to the top of memory.
- */
-
- pTDFX->textureSize = -1;
- pTDFX->backOffset = pTDFX->mem;
- pTDFX->depthOffset = -1;
- fprintf(stderr,
- "Not enough video memory available for textures and depth buffer\n"
- "\tand/or back buffer. Disabling DRI. To use DRI try lower\n"
- "\tresolution modes and/or a smaller virtual screen size\n");
- } else {
- pTDFX->textureSize = pTDFX->backOffset - pTDFX->textureOffset;
- }
-}
-
-
-static int createScreen (DRIDriverContext *ctx, TDFXDRIPtr pTDFX)
-{
- int err;
-
- {
- int width_bytes = (ctx->shared.virtualWidth * ctx->cpp);
- int maxy = ctx->shared.fbSize / width_bytes;
-
-
- if (maxy <= ctx->shared.virtualHeight * 3) {
- fprintf(stderr,
- "Static buffer allocation failed -- "
- "need at least %d kB video memory (have %d kB)\n",
- (ctx->shared.virtualWidth * ctx->shared.virtualHeight *
- ctx->cpp * 3 + 1023) / 1024,
- ctx->shared.fbSize / 1024);
- return 0;
- }
- }
-
- ctx->shared.SAREASize = SAREA_MAX;
- pTDFX->regsSize = ctx->MMIOSize;
-
- /* Note that drmOpen will try to load the kernel module, if needed. */
- ctx->drmFD = drmOpen("tdfx", NULL );
- if (ctx->drmFD < 0) {
- fprintf(stderr, "[drm] drmOpen failed\n");
- return 0;
- }
-
- if ((err = drmSetBusid(ctx->drmFD, ctx->pciBusID)) < 0) {
- fprintf(stderr, "[drm] drmSetBusid failed (%d, %s), %s\n",
- ctx->drmFD, ctx->pciBusID, strerror(-err));
- return 0;
- }
-
- if (drmAddMap( ctx->drmFD,
- 0,
- ctx->shared.SAREASize,
- DRM_SHM,
- DRM_CONTAINS_LOCK,
- &ctx->shared.hSAREA) < 0)
- {
- fprintf(stderr, "[drm] drmAddMap failed\n");
- return 0;
- }
- fprintf(stderr, "[drm] added %d byte SAREA at 0x%08lx\n",
- ctx->shared.SAREASize, ctx->shared.hSAREA);
-
- if (drmMap( ctx->drmFD,
- ctx->shared.hSAREA,
- ctx->shared.SAREASize,
- (drmAddressPtr)(&ctx->pSAREA)) < 0)
- {
- fprintf(stderr, "[drm] drmMap failed\n");
- return 0;
- }
- memset(ctx->pSAREA, 0, ctx->shared.SAREASize);
- fprintf(stderr, "[drm] mapped SAREA 0x%08lx to %p, size %d\n",
- ctx->shared.hSAREA, ctx->pSAREA, ctx->shared.SAREASize);
-
- /* Need to AddMap the framebuffer and mmio regions here:
- */
- if (drmAddMap( ctx->drmFD,
- (drm_handle_t)ctx->FBStart,
- ctx->FBSize,
- DRM_FRAME_BUFFER,
-#ifndef _EMBEDDED
- 0,
-#else
- DRM_READ_ONLY,
-#endif
- &ctx->shared.hFrameBuffer) < 0)
- {
- fprintf(stderr, "[drm] drmAddMap framebuffer failed\n");
- return 0;
- }
-
- fprintf(stderr, "[drm] framebuffer handle = 0x%08lx\n",
- ctx->shared.hFrameBuffer);
-
-
- if (drmAddMap(ctx->drmFD,
- ctx->MMIOStart,
- ctx->MMIOSize,
- DRM_REGISTERS,
- DRM_READ_ONLY,
- &pTDFX->regs) < 0) {
- fprintf(stderr, "[drm] drmAddMap mmio failed\n");
- return 0;
- }
- fprintf(stderr,
- "[drm] register handle = 0x%08lx\n", pTDFX->regs);
-
-
- /* Create a 'server' context so we can grab the lock for
- * initialization ioctls.
- */
- if ((err = drmCreateContext(ctx->drmFD, &ctx->serverContext)) != 0) {
- fprintf(stderr, "%s: drmCreateContext failed %d\n", __FUNCTION__, err);
- return 0;
- }
-
- DRM_LOCK(ctx->drmFD, ctx->pSAREA, ctx->serverContext, 0);
-
- /* Initialize the kernel data structures */
-
- /* Initialize kernel gart memory manager */
- allocateMemory(ctx, pTDFX);
-
- /* Initialize the SAREA private data structure */
-
-
- /* Quick hack to clear the front & back buffers. Could also use
- * the clear ioctl to do this, but would need to setup hw state
- * first.
- */
-
-
- /* This is the struct passed to tdfx_dri.so for its initialization */
- ctx->driverClientMsg = malloc(sizeof(TDFXDRIRec));
- ctx->driverClientMsgSize = sizeof(TDFXDRIRec);
- memcpy(ctx->driverClientMsg, pTDFX, ctx->driverClientMsgSize);
- pTDFX = (TDFXDRIPtr)ctx->driverClientMsg;
-
- /* Don't release the lock now - let the VT switch handler do it. */
-
- return 1;
-}
-
-
-/**
- * \brief Validate the fbdev mode.
- *
- * \param ctx display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Saves some registers and returns 1.
- *
- * \sa tdfxValidateMode().
- */
-static int tdfxValidateMode( const DRIDriverContext *ctx )
-{
- return 1;
-}
-
-
-/**
- * \brief Examine mode returned by fbdev.
- *
- * \param ctx display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Restores registers that fbdev has clobbered and returns 1.
- *
- * \sa tdfxValidateMode().
- */
-static int tdfxPostValidateMode( const DRIDriverContext *ctx )
-{
- return 1;
-}
-
-
-/**
- * \brief Initialize the framebuffer device mode
- *
- * \param ctx display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Before exiting clears the framebuffer memory accessing it directly.
- */
-static int tdfxInitFBDev( DRIDriverContext *ctx )
-{
- TDFXDRIPtr pTDFX = calloc(1, sizeof(TDFXDRIRec));
-
- {
- int dummy = ctx->shared.virtualWidth;
-
- switch (ctx->bpp / 8) {
- case 1: dummy = (ctx->shared.virtualWidth + 127) & ~127; break;
- case 2: dummy = (ctx->shared.virtualWidth + 31) & ~31; break;
- case 3:
- case 4: dummy = (ctx->shared.virtualWidth + 15) & ~15; break;
- }
-
- ctx->shared.virtualWidth = dummy;
- }
-
- ctx->driverPrivate = (void *)pTDFX;
-
- pTDFX->deviceID = ctx->chipset;
- pTDFX->width = ctx->shared.virtualWidth;
- pTDFX->height = ctx->shared.virtualHeight;
- pTDFX->cpp = ctx->cpp;
- pTDFX->mem = ctx->FBSize; /* ->shared.fbSize? mem probe? */
- pTDFX->sarea_priv_offset = sizeof(drm_sarea_t);
-
- if (!createScreen(ctx, pTDFX))
- return 0;
-
- return 1;
-}
-
-
-/**
- * \brief The screen is being closed, so clean up any state and free any
- * resources used by the DRI.
- *
- * \param ctx display handle.
- *
- * Unmaps the SAREA, closes the DRM device file descriptor and frees the driver
- * private data.
- */
-static void tdfxHaltFBDev( DRIDriverContext *ctx )
-{
- drmUnmap( ctx->pSAREA, ctx->shared.SAREASize );
- drmClose(ctx->drmFD);
-
- if (ctx->driverPrivate) {
- free(ctx->driverPrivate);
- ctx->driverPrivate = 0;
- }
-}
-
-
-/**
- * \brief Shutdown the drawing engine.
- *
- * \param ctx display handle
- *
- * Turns off the 3D engine & restores the graphics card
- * to a state that fbdev understands.
- */
-static int tdfxEngineShutdown( const DRIDriverContext *ctx )
-{
- fprintf(stderr, "%s: not implemented\n", __FUNCTION__);
- return 1;
-}
-
-
-/**
- * \brief Restore the drawing engine.
- *
- * \param ctx display handle
- *
- * Resets the graphics card and sets initial values for several registers of
- * the card's drawing engine.
- *
- * Turns on 3dfx
- */
-static int tdfxEngineRestore( const DRIDriverContext *ctx )
-{
- fprintf(stderr, "%s: not implemented\n", __FUNCTION__);
- return 1;
-}
-
-
-/**
- * \brief Exported driver interface for Mini GLX.
- *
- * \sa DRIDriverRec.
- */
-struct DRIDriverRec __driDriver = {
- tdfxValidateMode,
- tdfxPostValidateMode,
- tdfxInitFBDev,
- tdfxHaltFBDev,
- tdfxEngineShutdown,
- tdfxEngineRestore,
- 0
-};
diff --git a/src/mesa/drivers/dri/unichrome/Makefile b/src/mesa/drivers/dri/unichrome/Makefile
index 344d34fce3..14cf9f3038 100644
--- a/src/mesa/drivers/dri/unichrome/Makefile
+++ b/src/mesa/drivers/dri/unichrome/Makefile
@@ -5,8 +5,6 @@ include $(TOP)/configs/current
LIBNAME = unichrome_dri.so
-MINIGLX_SOURCES = server/via_dri.c
-
DRIVER_SOURCES = \
via_context.c \
via_fb.c \
diff --git a/src/mesa/drivers/dri/unichrome/server/via_dri.c b/src/mesa/drivers/dri/unichrome/server/via_dri.c
deleted file mode 100644
index 74034485e2..0000000000
--- a/src/mesa/drivers/dri/unichrome/server/via_dri.c
+++ /dev/null
@@ -1,1251 +0,0 @@
-/*
- * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
- * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sub license,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-
-#include "driver.h"
-#include "drm.h"
-#include "imports.h"
-
-#include "dri_util.h"
-
-#include "via_context.h"
-#include "via_dri.h"
-#include "via_driver.h"
-#include "xf86drm.h"
-
-static void VIAEnableMMIO(DRIDriverContext * ctx);
-static void VIADisableMMIO(DRIDriverContext * ctx);
-static void VIADisableExtendedFIFO(DRIDriverContext *ctx);
-static void VIAEnableExtendedFIFO(DRIDriverContext *ctx);
-static void VIAInitialize2DEngine(DRIDriverContext *ctx);
-static void VIAInitialize3DEngine(DRIDriverContext *ctx);
-
-static int VIADRIScreenInit(DRIDriverContext * ctx);
-static void VIADRICloseScreen(DRIDriverContext * ctx);
-static int VIADRIFinishScreenInit(DRIDriverContext * ctx);
-
-/* _SOLO : missing macros normally defined by X code */
-#define xf86DrvMsg(a, b, ...) fprintf(stderr, __VA_ARGS__)
-#define MMIO_IN8(base, addr) ((*(((volatile uint8_t*)base)+(addr)))+0)
-#define MMIO_OUT8(base, addr, val) ((*(((volatile uint8_t*)base)+(addr)))=((uint8_t)val))
-#define MMIO_OUT16(base, addr, val) ((*(volatile uint16_t*)(((uint8_t*)base)+(addr)))=((uint16_t)val))
-
-#define VIDEO 0
-#define AGP 1
-#define AGP_PAGE_SIZE 4096
-#define AGP_PAGES 8192
-#define AGP_SIZE (AGP_PAGE_SIZE * AGP_PAGES)
-#define AGP_CMDBUF_PAGES 512
-#define AGP_CMDBUF_SIZE (AGP_PAGE_SIZE * AGP_CMDBUF_PAGES)
-
-static char VIAKernelDriverName[] = "via";
-static char VIAClientDriverName[] = "unichrome";
-
-static int VIADRIAgpInit(const DRIDriverContext *ctx, VIAPtr pVia);
-static int VIADRIPciInit(DRIDriverContext * ctx, VIAPtr pVia);
-static int VIADRIFBInit(DRIDriverContext * ctx, VIAPtr pVia);
-static int VIADRIKernelInit(DRIDriverContext * ctx, VIAPtr pVia);
-static int VIADRIMapInit(DRIDriverContext * ctx, VIAPtr pVia);
-
-static void VIADRIIrqInit( DRIDriverContext *ctx )
-{
- VIAPtr pVia = VIAPTR(ctx);
- VIADRIPtr pVIADRI = pVia->devPrivate;
-
- pVIADRI->irqEnabled = drmGetInterruptFromBusID(pVia->drmFD,
- ctx->pciBus,
- ctx->pciDevice,
- ctx->pciFunc);
-
- if ((drmCtlInstHandler(pVia->drmFD, pVIADRI->irqEnabled))) {
- xf86DrvMsg(pScreen->myNum, X_WARNING,
- "[drm] Failure adding irq handler. "
- "Falling back to irq-free operation.\n");
- pVIADRI->irqEnabled = 0;
- }
-
- if (pVIADRI->irqEnabled)
- xf86DrvMsg(pScreen->myNum, X_INFO,
- "[drm] Irq handler installed, using IRQ %d.\n",
- pVIADRI->irqEnabled);
-}
-
-static void VIADRIIrqExit( DRIDriverContext *ctx ) {
- VIAPtr pVia = VIAPTR(ctx);
- VIADRIPtr pVIADRI = pVia->devPrivate;
-
- if (pVIADRI->irqEnabled) {
- if (drmCtlUninstHandler(pVia->drmFD)) {
- xf86DrvMsg(pScreen-myNum, X_INFO,"[drm] Irq handler uninstalled.\n");
- } else {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[drm] Could not uninstall irq handler.\n");
- }
- }
-}
-
-static void VIADRIRingBufferCleanup(DRIDriverContext *ctx)
-{
- VIAPtr pVia = VIAPTR(ctx);
- VIADRIPtr pVIADRI = pVia->devPrivate;
- drm_via_dma_init_t ringBufInit;
-
- if (pVIADRI->ringBufActive) {
- xf86DrvMsg(pScreen->myNum, X_INFO,
- "[drm] Cleaning up DMA ring-buffer.\n");
- ringBufInit.func = VIA_CLEANUP_DMA;
- if (drmCommandWrite(pVia->drmFD, DRM_VIA_DMA_INIT, &ringBufInit,
- sizeof(ringBufInit))) {
- xf86DrvMsg(pScreen->myNum, X_WARNING,
- "[drm] Failed to clean up DMA ring-buffer: %d\n", errno);
- }
- pVIADRI->ringBufActive = 0;
- }
-}
-
-static int VIADRIRingBufferInit(DRIDriverContext *ctx)
-{
- VIAPtr pVia = VIAPTR(ctx);
- VIADRIPtr pVIADRI = pVia->devPrivate;
- drm_via_dma_init_t ringBufInit;
- drmVersionPtr drmVer;
-
- pVIADRI->ringBufActive = 0;
-
- if (NULL == (drmVer = drmGetVersion(pVia->drmFD))) {
- return GL_FALSE;
- }
-
- if (((drmVer->version_major <= 1) && (drmVer->version_minor <= 3))) {
- return GL_FALSE;
- }
-
- /*
- * Info frome code-snippet on DRI-DEVEL list; Erdi Chen.
- */
-
- switch (pVia->ChipId) {
- case PCI_CHIP_VT3259:
- ringBufInit.reg_pause_addr = 0x40c;
- break;
- default:
- ringBufInit.reg_pause_addr = 0x418;
- break;
- }
-
- ringBufInit.offset = pVia->agpSize;
- ringBufInit.size = AGP_CMDBUF_SIZE;
- ringBufInit.func = VIA_INIT_DMA;
- if (drmCommandWrite(pVia->drmFD, DRM_VIA_DMA_INIT, &ringBufInit,
- sizeof(ringBufInit))) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[drm] Failed to initialize DMA ring-buffer: %d\n", errno);
- return GL_FALSE;
- }
- xf86DrvMsg(pScreen->myNum, X_INFO,
- "[drm] Initialized AGP ring-buffer, size 0x%lx at AGP offset 0x%lx.\n",
- ringBufInit.size, ringBufInit.offset);
-
- pVIADRI->ringBufActive = 1;
- return GL_TRUE;
-}
-
-static int VIADRIAgpInit(const DRIDriverContext *ctx, VIAPtr pVia)
-{
- unsigned long agp_phys;
- drmAddress agpaddr;
- VIADRIPtr pVIADRI;
- pVIADRI = pVia->devPrivate;
- pVia->agpSize = 0;
-
- if (drmAgpAcquire(pVia->drmFD) < 0) {
- xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAgpAcquire failed %d\n", errno);
- return GL_FALSE;
- }
-
- if (drmAgpEnable(pVia->drmFD, drmAgpGetMode(pVia->drmFD)&~0x0) < 0) {
- xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAgpEnable failed\n");
- return GL_FALSE;
- }
-
- xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] drmAgpEnabled succeeded\n");
-
- if (drmAgpAlloc(pVia->drmFD, AGP_SIZE, 0, &agp_phys, &pVia->agpHandle) < 0) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[drm] drmAgpAlloc failed\n");
- drmAgpRelease(pVia->drmFD);
- return GL_FALSE;
- }
-
- if (drmAgpBind(pVia->drmFD, pVia->agpHandle, 0) < 0) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[drm] drmAgpBind failed\n");
- drmAgpFree(pVia->drmFD, pVia->agpHandle);
- drmAgpRelease(pVia->drmFD);
-
- return GL_FALSE;
- }
-
- /*
- * Place the ring-buffer last in the AGP region, and restrict the
- * public map not to include the buffer for security reasons.
- */
-
- pVia->agpSize = AGP_SIZE - AGP_CMDBUF_SIZE;
- pVia->agpAddr = drmAgpBase(pVia->drmFD);
- xf86DrvMsg(pScreen->myNum, X_INFO,
- "[drm] agpAddr = 0x%08lx\n",pVia->agpAddr);
-
- pVIADRI->agp.size = pVia->agpSize;
- if (drmAddMap(pVia->drmFD, (drm_handle_t)0,
- pVIADRI->agp.size, DRM_AGP, 0,
- &pVIADRI->agp.handle) < 0) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[drm] Failed to map public agp area\n");
- pVIADRI->agp.size = 0;
- return GL_FALSE;
- }
- /* Map AGP from kernel to Xserver - Not really needed */
- drmMap(pVia->drmFD, pVIADRI->agp.handle,pVIADRI->agp.size, &agpaddr);
-
- xf86DrvMsg(pScreen->myNum, X_INFO,
- "[drm] agpAddr = 0x%08lx\n", pVia->agpAddr);
- xf86DrvMsg(pScreen->myNum, X_INFO,
- "[drm] agpSize = 0x%08lx\n", pVia->agpSize);
- xf86DrvMsg(pScreen->myNum, X_INFO,
- "[drm] agp physical addr = 0x%08lx\n", agp_phys);
-
- {
- drm_via_agp_t agp;
- agp.offset = 0;
- agp.size = AGP_SIZE-AGP_CMDBUF_SIZE;
- if (drmCommandWrite(pVia->drmFD, DRM_VIA_AGP_INIT, &agp,
- sizeof(drm_via_agp_t)) < 0) {
- drmUnmap(&agpaddr,pVia->agpSize);
- drmRmMap(pVia->drmFD,pVIADRI->agp.handle);
- drmAgpUnbind(pVia->drmFD, pVia->agpHandle);
- drmAgpFree(pVia->drmFD, pVia->agpHandle);
- drmAgpRelease(pVia->drmFD);
- return GL_FALSE;
- }
- }
-
- return GL_TRUE;
-}
-
-static int VIADRIFBInit(DRIDriverContext * ctx, VIAPtr pVia)
-{
- int FBSize = pVia->FBFreeEnd-pVia->FBFreeStart;
- int FBOffset = pVia->FBFreeStart;
- VIADRIPtr pVIADRI = pVia->devPrivate;
- pVIADRI->fbOffset = FBOffset;
- pVIADRI->fbSize = pVia->videoRambytes;
-
- {
- drm_via_fb_t fb;
- fb.offset = FBOffset;
- fb.size = FBSize;
-
- if (drmCommandWrite(pVia->drmFD, DRM_VIA_FB_INIT, &fb,
- sizeof(drm_via_fb_t)) < 0) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[drm] failed to init frame buffer area\n");
- return GL_FALSE;
- } else {
- xf86DrvMsg(pScreen->myNum, X_INFO,
- "[drm] FBFreeStart= 0x%08x FBFreeEnd= 0x%08x "
- "FBSize= 0x%08x\n",
- pVia->FBFreeStart, pVia->FBFreeEnd, FBSize);
- return GL_TRUE;
- }
- }
-}
-
-static int VIADRIPciInit(DRIDriverContext * ctx, VIAPtr pVia)
-{
- return GL_TRUE;
-}
-
-static int VIADRIScreenInit(DRIDriverContext * ctx)
-{
- VIAPtr pVia = VIAPTR(ctx);
- VIADRIPtr pVIADRI;
- int err;
-
-#if 0
- ctx->shared.SAREASize = ((sizeof(drm_sarea_t) + 0xfff) & 0x1000);
-#else
- if (sizeof(drm_sarea_t)+sizeof(drm_via_sarea_t) > SAREA_MAX) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Data does not fit in SAREA\n");
- return GL_FALSE;
- }
- ctx->shared.SAREASize = SAREA_MAX;
-#endif
-
- ctx->drmFD = drmOpen(VIAKernelDriverName, NULL);
- if (ctx->drmFD < 0) {
- fprintf(stderr, "[drm] drmOpen failed\n");
- return 0;
- }
- pVia->drmFD = ctx->drmFD;
-
- err = drmSetBusid(ctx->drmFD, ctx->pciBusID);
- if (err < 0) {
- fprintf(stderr, "[drm] drmSetBusid failed (%d, %s), %s\n",
- ctx->drmFD, ctx->pciBusID, strerror(-err));
- return 0;
- }
-
- err = drmAddMap(ctx->drmFD, 0, ctx->shared.SAREASize, DRM_SHM,
- DRM_CONTAINS_LOCK, &ctx->shared.hSAREA);
- if (err < 0) {
- fprintf(stderr, "[drm] drmAddMap failed\n");
- return 0;
- }
- fprintf(stderr, "[drm] added %d byte SAREA at 0x%08lx\n",
- ctx->shared.SAREASize, ctx->shared.hSAREA);
-
- if (drmMap(ctx->drmFD,
- ctx->shared.hSAREA,
- ctx->shared.SAREASize,
- (drmAddressPtr)(&ctx->pSAREA)) < 0)
- {
- fprintf(stderr, "[drm] drmMap failed\n");
- return 0;
- }
- memset(ctx->pSAREA, 0, ctx->shared.SAREASize);
- fprintf(stderr, "[drm] mapped SAREA 0x%08lx to %p, size %d\n",
- ctx->shared.hSAREA, ctx->pSAREA, ctx->shared.SAREASize);
-
- /* Need to AddMap the framebuffer and mmio regions here:
- */
- if (drmAddMap(ctx->drmFD,
- (drm_handle_t)ctx->FBStart,
- ctx->FBSize,
- DRM_FRAME_BUFFER,
-#ifndef _EMBEDDED
- 0,
-#else
- DRM_READ_ONLY,
-#endif
- &ctx->shared.hFrameBuffer) < 0)
- {
- fprintf(stderr, "[drm] drmAddMap framebuffer failed\n");
- return 0;
- }
-
- fprintf(stderr, "[drm] framebuffer handle = 0x%08lx\n",
- ctx->shared.hFrameBuffer);
-
- pVIADRI = (VIADRIPtr) CALLOC(sizeof(VIADRIRec));
- if (!pVIADRI) {
- drmClose(ctx->drmFD);
- return GL_FALSE;
- }
- pVia->devPrivate = pVIADRI;
- ctx->driverClientMsg = pVIADRI;
- ctx->driverClientMsgSize = sizeof(*pVIADRI);
-
- /* DRIScreenInit doesn't add all the common mappings. Add additional mappings here. */
- if (!VIADRIMapInit(ctx, pVia)) {
- VIADRICloseScreen(ctx);
- return GL_FALSE;
- }
-
- pVIADRI->regs.size = VIA_MMIO_REGSIZE;
- pVIADRI->regs.handle = pVia->registerHandle;
- xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] mmio Registers = 0x%08lx\n",
- pVIADRI->regs.handle);
-
- if (drmMap(pVia->drmFD,
- pVIADRI->regs.handle,
- pVIADRI->regs.size,
- (drmAddress *)&pVia->MapBase) != 0)
- {
- VIADRICloseScreen(ctx);
- return GL_FALSE;
- }
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] mmio mapped.\n" );
-
- VIAEnableMMIO(ctx);
-
- /* Get video memory clock. */
- VGAOUT8(0x3D4, 0x3D);
- pVia->MemClk = (VGAIN8(0x3D5) & 0xF0) >> 4;
- xf86DrvMsg(0, X_INFO, "[dri] MemClk (0x%x)\n", pVia->MemClk);
-
- /* 3D rendering has noise if not enabled. */
- VIAEnableExtendedFIFO(ctx);
-
- VIAInitialize2DEngine(ctx);
-
- /* Must disable MMIO or 3D won't work. */
- VIADisableMMIO(ctx);
-
- VIAInitialize3DEngine(ctx);
-
- pVia->IsPCI = !VIADRIAgpInit(ctx, pVia);
-
- if (pVia->IsPCI) {
- VIADRIPciInit(ctx, pVia);
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] use pci.\n" );
- }
- else
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] use agp.\n" );
-
- if (!(VIADRIFBInit(ctx, pVia))) {
- VIADRICloseScreen(ctx);
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "[dri] frame buffer initialize fail .\n" );
- return GL_FALSE;
- }
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] frame buffer initialized.\n" );
-
- return VIADRIFinishScreenInit(ctx);
-}
-
-static void
-VIADRICloseScreen(DRIDriverContext * ctx)
-{
- VIAPtr pVia = VIAPTR(ctx);
- VIADRIPtr pVIADRI=(VIADRIPtr)pVia->devPrivate;
-
- VIADRIRingBufferCleanup(ctx);
-
- if (pVia->MapBase) {
- xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Unmapping MMIO registers\n");
- drmUnmap(pVia->MapBase, pVIADRI->regs.size);
- }
-
- if (pVia->agpSize) {
- xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Freeing agp memory\n");
- drmAgpFree(pVia->drmFD, pVia->agpHandle);
- xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Releasing agp module\n");
- drmAgpRelease(pVia->drmFD);
- }
-
-#if 0
- if (pVia->DRIIrqEnable)
-#endif
- VIADRIIrqExit(ctx);
-}
-
-static int
-VIADRIFinishScreenInit(DRIDriverContext * ctx)
-{
- VIAPtr pVia = VIAPTR(ctx);
- VIADRIPtr pVIADRI;
- int err;
-
- err = drmCreateContext(ctx->drmFD, &ctx->serverContext);
- if (err != 0) {
- fprintf(stderr, "%s: drmCreateContext failed %d\n", __FUNCTION__, err);
- return GL_FALSE;
- }
-
- DRM_LOCK(ctx->drmFD, ctx->pSAREA, ctx->serverContext, 0);
-
-
- if (!VIADRIKernelInit(ctx, pVia)) {
- VIADRICloseScreen(ctx);
- return GL_FALSE;
- }
- xf86DrvMsg(pScreen->myNum, X_INFO, "[dri] kernel data initialized.\n");
-
- /* set SAREA value */
- {
- drm_via_sarea_t *saPriv;
-
- saPriv=(drm_via_sarea_t*)(((char*)ctx->pSAREA) +
- sizeof(drm_sarea_t));
- assert(saPriv);
- memset(saPriv, 0, sizeof(*saPriv));
- saPriv->ctxOwner = -1;
- }
- pVIADRI=(VIADRIPtr)pVia->devPrivate;
- pVIADRI->deviceID=pVia->Chipset;
- pVIADRI->width=ctx->shared.virtualWidth;
- pVIADRI->height=ctx->shared.virtualHeight;
- pVIADRI->mem=ctx->shared.fbSize;
- pVIADRI->bytesPerPixel= (ctx->bpp+7) / 8;
- pVIADRI->sarea_priv_offset = sizeof(drm_sarea_t);
- /* TODO */
- pVIADRI->scrnX=pVIADRI->width;
- pVIADRI->scrnY=pVIADRI->height;
-
- /* Initialize IRQ */
-#if 0
- if (pVia->DRIIrqEnable)
-#endif
- VIADRIIrqInit(ctx);
-
- pVIADRI->ringBufActive = 0;
- VIADRIRingBufferInit(ctx);
-
- return GL_TRUE;
-}
-
-/* Initialize the kernel data structures. */
-static int VIADRIKernelInit(DRIDriverContext * ctx, VIAPtr pVia)
-{
- drm_via_init_t drmInfo;
- memset(&drmInfo, 0, sizeof(drm_via_init_t));
- drmInfo.sarea_priv_offset = sizeof(drm_sarea_t);
- drmInfo.func = VIA_INIT_MAP;
- drmInfo.fb_offset = pVia->FrameBufferBase;
- drmInfo.mmio_offset = pVia->registerHandle;
- if (pVia->IsPCI)
- drmInfo.agpAddr = (uint32_t)NULL;
- else
- drmInfo.agpAddr = (uint32_t)pVia->agpAddr;
-
- if ((drmCommandWrite(pVia->drmFD, DRM_VIA_MAP_INIT,&drmInfo,
- sizeof(drm_via_init_t))) < 0)
- return GL_FALSE;
-
- return GL_TRUE;
-}
-/* Add a map for the MMIO registers */
-static int VIADRIMapInit(DRIDriverContext * ctx, VIAPtr pVia)
-{
- int flags = 0;
-
- if (drmAddMap(pVia->drmFD, pVia->MmioBase, VIA_MMIO_REGSIZE,
- DRM_REGISTERS, flags, &pVia->registerHandle) < 0) {
- return GL_FALSE;
- }
-
- xf86DrvMsg(pScreen->myNum, X_INFO,
- "[drm] register handle = 0x%08lx\n", pVia->registerHandle);
-
- return GL_TRUE;
-}
-
-static int viaValidateMode(const DRIDriverContext *ctx)
-{
- VIAPtr pVia = VIAPTR(ctx);
-
- return 1;
-}
-
-static int viaPostValidateMode(const DRIDriverContext *ctx)
-{
- VIAPtr pVia = VIAPTR(ctx);
-
- return 1;
-}
-
-static void VIAEnableMMIO(DRIDriverContext * ctx)
-{
- /*vgaHWPtr hwp = VGAHWPTR(ctx);*/
- VIAPtr pVia = VIAPTR(ctx);
- unsigned char val;
-
-#if 0
- if (xf86IsPrimaryPci(pVia->PciInfo)) {
- /* If we are primary card, we still use std vga port. If we use
- * MMIO, system will hang in vgaHWSave when our card used in
- * PLE and KLE (integrated Trident MVP4)
- */
- vgaHWSetStdFuncs(hwp);
- }
- else {
- vgaHWSetMmioFuncs(hwp, pVia->MapBase, 0x8000);
- }
-#endif
-
- val = VGAIN8(0x3c3);
- VGAOUT8(0x3c3, val | 0x01);
- val = VGAIN8(0x3cc);
- VGAOUT8(0x3c2, val | 0x01);
-
- /* Unlock Extended IO Space */
- VGAOUT8(0x3c4, 0x10);
- VGAOUT8(0x3c5, 0x01);
-
- /* Enable MMIO */
- if(!pVia->IsSecondary) {
- VGAOUT8(0x3c4, 0x1a);
- val = VGAIN8(0x3c5);
-#ifdef DEBUG
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "primary val = %x\n", val);
-#endif
- VGAOUT8(0x3c5, val | 0x68);
- }
- else {
- VGAOUT8(0x3c4, 0x1a);
- val = VGAIN8(0x3c5);
-#ifdef DEBUG
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "secondary val = %x\n", val);
-#endif
- VGAOUT8(0x3c5, val | 0x38);
- }
-
- /* Unlock CRTC registers */
- VGAOUT8(0x3d4, 0x47);
- VGAOUT8(0x3d5, 0x00);
-
- return;
-}
-
-static void VIADisableMMIO(DRIDriverContext * ctx)
-{
- VIAPtr pVia = VIAPTR(ctx);
- unsigned char val;
-
- VGAOUT8(0x3c4, 0x1a);
- val = VGAIN8(0x3c5);
- VGAOUT8(0x3c5, val & 0x97);
-
- return;
-}
-
-static void VIADisableExtendedFIFO(DRIDriverContext *ctx)
-{
- VIAPtr pVia = VIAPTR(ctx);
- uint32_t dwGE230, dwGE298;
-
- /* Cause of exit XWindow will dump back register value, others chipset no
- * need to set extended fifo value */
- if (pVia->Chipset == VIA_CLE266 && pVia->ChipRev < 15 &&
- (ctx->shared.virtualWidth > 1024 || pVia->HasSecondary)) {
- /* Turn off Extend FIFO */
- /* 0x298[29] */
- dwGE298 = VIAGETREG(0x298);
- VIASETREG(0x298, dwGE298 | 0x20000000);
- /* 0x230[21] */
- dwGE230 = VIAGETREG(0x230);
- VIASETREG(0x230, dwGE230 & ~0x00200000);
- /* 0x298[29] */
- dwGE298 = VIAGETREG(0x298);
- VIASETREG(0x298, dwGE298 & ~0x20000000);
- }
-}
-
-static void VIAEnableExtendedFIFO(DRIDriverContext *ctx)
-{
- VIAPtr pVia = VIAPTR(ctx);
- uint8_t bRegTemp;
- uint32_t dwGE230, dwGE298;
-
- switch (pVia->Chipset) {
- case VIA_CLE266:
- if (pVia->ChipRev > 14) { /* For 3123Cx */
- if (pVia->HasSecondary) { /* SAMM or DuoView case */
- if (ctx->shared.virtualWidth >= 1024)
- {
- /* 3c5.16[0:5] */
- VGAOUT8(0x3C4, 0x16);
- bRegTemp = VGAIN8(0x3C5);
- bRegTemp &= ~0x3F;
- bRegTemp |= 0x1C;
- VGAOUT8(0x3C5, bRegTemp);
- /* 3c5.17[0:6] */
- VGAOUT8(0x3C4, 0x17);
- bRegTemp = VGAIN8(0x3C5);
- bRegTemp &= ~0x7F;
- bRegTemp |= 0x3F;
- VGAOUT8(0x3C5, bRegTemp);
- pVia->EnableExtendedFIFO = GL_TRUE;
- }
- }
- else /* Single view or Simultaneoue case */
- {
- if (ctx->shared.virtualWidth > 1024)
- {
- /* 3c5.16[0:5] */
- VGAOUT8(0x3C4, 0x16);
- bRegTemp = VGAIN8(0x3C5);
- bRegTemp &= ~0x3F;
- bRegTemp |= 0x17;
- VGAOUT8(0x3C5, bRegTemp);
- /* 3c5.17[0:6] */
- VGAOUT8(0x3C4, 0x17);
- bRegTemp = VGAIN8(0x3C5);
- bRegTemp &= ~0x7F;
- bRegTemp |= 0x2F;
- VGAOUT8(0x3C5, bRegTemp);
- pVia->EnableExtendedFIFO = GL_TRUE;
- }
- }
- /* 3c5.18[0:5] */
- VGAOUT8(0x3C4, 0x18);
- bRegTemp = VGAIN8(0x3C5);
- bRegTemp &= ~0x3F;
- bRegTemp |= 0x17;
- bRegTemp |= 0x40; /* force the preq always higher than treq */
- VGAOUT8(0x3C5, bRegTemp);
- }
- else { /* for 3123Ax */
- if (ctx->shared.virtualWidth > 1024 || pVia->HasSecondary) {
- /* Turn on Extend FIFO */
- /* 0x298[29] */
- dwGE298 = VIAGETREG(0x298);
- VIASETREG(0x298, dwGE298 | 0x20000000);
- /* 0x230[21] */
- dwGE230 = VIAGETREG(0x230);
- VIASETREG(0x230, dwGE230 | 0x00200000);
- /* 0x298[29] */
- dwGE298 = VIAGETREG(0x298);
- VIASETREG(0x298, dwGE298 & ~0x20000000);
-
- /* 3c5.16[0:5] */
- VGAOUT8(0x3C4, 0x16);
- bRegTemp = VGAIN8(0x3C5);
- bRegTemp &= ~0x3F;
- bRegTemp |= 0x17;
- /* bRegTemp |= 0x10; */
- VGAOUT8(0x3C5, bRegTemp);
- /* 3c5.17[0:6] */
- VGAOUT8(0x3C4, 0x17);
- bRegTemp = VGAIN8(0x3C5);
- bRegTemp &= ~0x7F;
- bRegTemp |= 0x2F;
- /*bRegTemp |= 0x1F;*/
- VGAOUT8(0x3C5, bRegTemp);
- /* 3c5.18[0:5] */
- VGAOUT8(0x3C4, 0x18);
- bRegTemp = VGAIN8(0x3C5);
- bRegTemp &= ~0x3F;
- bRegTemp |= 0x17;
- bRegTemp |= 0x40; /* force the preq always higher than treq */
- VGAOUT8(0x3C5, bRegTemp);
- pVia->EnableExtendedFIFO = GL_TRUE;
- }
- }
- break;
- case VIA_KM400:
- if (pVia->HasSecondary) { /* SAMM or DuoView case */
- if ((ctx->shared.virtualWidth >= 1600) &&
- (pVia->MemClk <= VIA_MEM_DDR200)) {
- /* enable CRT extendded FIFO */
- VGAOUT8(0x3C4, 0x17);
- VGAOUT8(0x3C5, 0x1C);
- /* revise second display queue depth and read threshold */
- VGAOUT8(0x3C4, 0x16);
- bRegTemp = VGAIN8(0x3C5);
- bRegTemp &= ~0x3F;
- bRegTemp = (bRegTemp) | (0x09);
- VGAOUT8(0x3C5, bRegTemp);
- }
- else {
- /* enable CRT extendded FIFO */
- VGAOUT8(0x3C4, 0x17);
- VGAOUT8(0x3C5,0x3F);
- /* revise second display queue depth and read threshold */
- VGAOUT8(0x3C4, 0x16);
- bRegTemp = VGAIN8(0x3C5);
- bRegTemp &= ~0x3F;
- bRegTemp = (bRegTemp) | (0x1C);
- VGAOUT8(0x3C5, bRegTemp);
- }
- /* 3c5.18[0:5] */
- VGAOUT8(0x3C4, 0x18);
- bRegTemp = VGAIN8(0x3C5);
- bRegTemp &= ~0x3F;
- bRegTemp |= 0x17;
- bRegTemp |= 0x40; /* force the preq always higher than treq */
- VGAOUT8(0x3C5, bRegTemp);
- pVia->EnableExtendedFIFO = GL_TRUE;
- }
- else {
- if ( (ctx->shared.virtualWidth > 1024) && (ctx->shared.virtualWidth <= 1280) )
- {
- /* enable CRT extendded FIFO */
- VGAOUT8(0x3C4, 0x17);
- VGAOUT8(0x3C5, 0x3F);
- /* revise second display queue depth and read threshold */
- VGAOUT8(0x3C4, 0x16);
- bRegTemp = VGAIN8(0x3C5);
- bRegTemp &= ~0x3F;
- bRegTemp = (bRegTemp) | (0x17);
- VGAOUT8(0x3C5, bRegTemp);
- pVia->EnableExtendedFIFO = GL_TRUE;
- }
- else if ((ctx->shared.virtualWidth > 1280))
- {
- /* enable CRT extendded FIFO */
- VGAOUT8(0x3C4, 0x17);
- VGAOUT8(0x3C5, 0x3F);
- /* revise second display queue depth and read threshold */
- VGAOUT8(0x3C4, 0x16);
- bRegTemp = VGAIN8(0x3C5);
- bRegTemp &= ~0x3F;
- bRegTemp = (bRegTemp) | (0x1C);
- VGAOUT8(0x3C5, bRegTemp);
- pVia->EnableExtendedFIFO = GL_TRUE;
- }
- else
- {
- /* enable CRT extendded FIFO */
- VGAOUT8(0x3C4, 0x17);
- VGAOUT8(0x3C5, 0x3F);
- /* revise second display queue depth and read threshold */
- VGAOUT8(0x3C4, 0x16);
- bRegTemp = VGAIN8(0x3C5);
- bRegTemp &= ~0x3F;
- bRegTemp = (bRegTemp) | (0x10);
- VGAOUT8(0x3C5, bRegTemp);
- }
- /* 3c5.18[0:5] */
- VGAOUT8(0x3C4, 0x18);
- bRegTemp = VGAIN8(0x3C5);
- bRegTemp &= ~0x3F;
- bRegTemp |= 0x17;
- bRegTemp |= 0x40; /* force the preq always higher than treq */
- VGAOUT8(0x3C5, bRegTemp);
- }
- break;
- case VIA_K8M800:
- /*=* R1 Display FIFO depth (384 /8 -1 -> 0xbf) SR17[7:0] (8bits) *=*/
- VGAOUT8(0x3c4, 0x17);
- VGAOUT8(0x3c5, 0xbf);
-
- /*=* R2 Display fetch datum threshold value (328/4 -> 0x52)
- SR16[5:0], SR16[7] (7bits) *=*/
- VGAOUT8(0x3c4, 0x16);
- bRegTemp = VGAIN8(0x3c5) & ~0xBF;
- bRegTemp |= (0x52 & 0x3F);
- bRegTemp |= ((0x52 & 0x40) << 1);
- VGAOUT8(0x3c5, bRegTemp);
-
- /*=* R3 Switch to the highest agent threshold value (74 -> 0x4a)
- SR18[5:0], SR18[7] (7bits) *=*/
- VGAOUT8(0x3c4, 0x18);
- bRegTemp = VGAIN8(0x3c5) & ~0xBF;
- bRegTemp |= (0x4a & 0x3F);
- bRegTemp |= ((0x4a & 0x40) << 1);
- VGAOUT8(0x3c5, bRegTemp);
-#if 0
- /*=* R4 Fetch Number for a scan line (unit: 8 bytes)
- SR1C[7:0], SR1D[1:0] (10bits) *=*/
- wRegTemp = (pBIOSInfo->offsetWidthByQWord >> 1) + 4;
- VGAOUT8(0x3c4, 0x1c);
- VGAOUT8(0x3c5, (uint8_t)(wRegTemp & 0xFF));
- VGAOUT8(0x3c4, 0x1d);
- bRegTemp = VGAIN8(0x3c5) & ~0x03;
- VGAOUT8(0x3c5, bRegTemp | ((wRegTemp & 0x300) >> 8));
-#endif
- if (ctx->shared.virtualWidth >= 1400 && ctx->bpp == 32)
- {
- /*=* Max. length for a request SR22[4:0] (64/4 -> 0x10) *=*/
- VGAOUT8(0x3c4, 0x22);
- bRegTemp = VGAIN8(0x3c5) & ~0x1F;
- VGAOUT8(0x3c5, bRegTemp | 0x10);
- }
- else
- {
- /*=* Max. length for a request SR22[4:0]
- (128/4 -> over flow 0x0) *=*/
- VGAOUT8(0x3c4, 0x22);
- bRegTemp = VGAIN8(0x3c5) & ~0x1F;
- VGAOUT8(0x3c5, bRegTemp);
- }
- break;
- case VIA_PM800:
- /*=* R1 Display FIFO depth (96-1 -> 0x5f) SR17[7:0] (8bits) *=*/
- VGAOUT8(0x3c4, 0x17);
- VGAOUT8(0x3c5, 0x5f);
-
- /*=* R2 Display fetch datum threshold value (32 -> 0x20)
- SR16[5:0], SR16[7] (7bits) *=*/
- VGAOUT8(0x3c4, 0x16);
- bRegTemp = VGAIN8(0x3c5) & ~0xBF;
- bRegTemp |= (0x20 & 0x3F);
- bRegTemp |= ((0x20 & 0x40) << 1);
- VGAOUT8(0x3c5, bRegTemp);
-
- /*=* R3 Switch to the highest agent threshold value (16 -> 0x10)
- SR18[5:0], SR18[7] (7bits) *=*/
- VGAOUT8(0x3c4, 0x18);
- bRegTemp = VGAIN8(0x3c5) & ~0xBF;
- bRegTemp |= (0x10 & 0x3F);
- bRegTemp |= ((0x10 & 0x40) << 1);
- VGAOUT8(0x3c5, bRegTemp);
-#if 0
- /*=* R4 Fetch Number for a scan line (unit: 8 bytes)
- SR1C[7:0], SR1D[1:0] (10bits) *=*/
- wRegTemp = (pBIOSInfo->offsetWidthByQWord >> 1) + 4;
- VGAOUT8(0x3c4, 0x1c);
- VGAOUT8(0x3c5, (uint8_t)(wRegTemp & 0xFF));
- VGAOUT8(0x3c4, 0x1d);
- bRegTemp = VGAIN8(0x3c5) & ~0x03;
- VGAOUT8(0x3c5, bRegTemp | ((wRegTemp & 0x300) >> 8));
-#endif
- if (ctx->shared.virtualWidth >= 1400 && ctx->bpp == 32)
- {
- /*=* Max. length for a request SR22[4:0] (64/4 -> 0x10) *=*/
- VGAOUT8(0x3c4, 0x22);
- bRegTemp = VGAIN8(0x3c5) & ~0x1F;
- VGAOUT8(0x3c5, bRegTemp | 0x10);
- }
- else
- {
- /*=* Max. length for a request SR22[4:0] (0x1F) *=*/
- VGAOUT8(0x3c4, 0x22);
- bRegTemp = VGAIN8(0x3c5) & ~0x1F;
- VGAOUT8(0x3c5, bRegTemp | 0x1F);
- }
- break;
- default:
- break;
- }
-}
-
-static void VIAInitialize2DEngine(DRIDriverContext *ctx)
-{
- VIAPtr pVia = VIAPTR(ctx);
- uint32_t dwVQStartAddr, dwVQEndAddr;
- uint32_t dwVQLen, dwVQStartL, dwVQEndL, dwVQStartEndH;
- uint32_t dwGEMode;
-
- /* init 2D engine regs to reset 2D engine */
- VIASETREG(0x04, 0x0);
- VIASETREG(0x08, 0x0);
- VIASETREG(0x0c, 0x0);
- VIASETREG(0x10, 0x0);
- VIASETREG(0x14, 0x0);
- VIASETREG(0x18, 0x0);
- VIASETREG(0x1c, 0x0);
- VIASETREG(0x20, 0x0);
- VIASETREG(0x24, 0x0);
- VIASETREG(0x28, 0x0);
- VIASETREG(0x2c, 0x0);
- VIASETREG(0x30, 0x0);
- VIASETREG(0x34, 0x0);
- VIASETREG(0x38, 0x0);
- VIASETREG(0x3c, 0x0);
- VIASETREG(0x40, 0x0);
-
- VIADisableMMIO(ctx);
-
- /* Init AGP and VQ regs */
- VIASETREG(0x43c, 0x00100000);
- VIASETREG(0x440, 0x00000000);
- VIASETREG(0x440, 0x00333004);
- VIASETREG(0x440, 0x60000000);
- VIASETREG(0x440, 0x61000000);
- VIASETREG(0x440, 0x62000000);
- VIASETREG(0x440, 0x63000000);
- VIASETREG(0x440, 0x64000000);
- VIASETREG(0x440, 0x7D000000);
-
- VIASETREG(0x43c, 0xfe020000);
- VIASETREG(0x440, 0x00000000);
-
- if (pVia->VQStart != 0) {
- /* Enable VQ */
- dwVQStartAddr = pVia->VQStart;
- dwVQEndAddr = pVia->VQEnd;
- dwVQStartL = 0x50000000 | (dwVQStartAddr & 0xFFFFFF);
- dwVQEndL = 0x51000000 | (dwVQEndAddr & 0xFFFFFF);
- dwVQStartEndH = 0x52000000 | ((dwVQStartAddr & 0xFF000000) >> 24) |
- ((dwVQEndAddr & 0xFF000000) >> 16);
- dwVQLen = 0x53000000 | (VIA_VQ_SIZE >> 3);
-
- VIASETREG(0x43c, 0x00fe0000);
- VIASETREG(0x440, 0x080003fe);
- VIASETREG(0x440, 0x0a00027c);
- VIASETREG(0x440, 0x0b000260);
- VIASETREG(0x440, 0x0c000274);
- VIASETREG(0x440, 0x0d000264);
- VIASETREG(0x440, 0x0e000000);
- VIASETREG(0x440, 0x0f000020);
- VIASETREG(0x440, 0x1000027e);
- VIASETREG(0x440, 0x110002fe);
- VIASETREG(0x440, 0x200f0060);
-
- VIASETREG(0x440, 0x00000006);
- VIASETREG(0x440, 0x40008c0f);
- VIASETREG(0x440, 0x44000000);
- VIASETREG(0x440, 0x45080c04);
- VIASETREG(0x440, 0x46800408);
-
- VIASETREG(0x440, dwVQStartEndH);
- VIASETREG(0x440, dwVQStartL);
- VIASETREG(0x440, dwVQEndL);
- VIASETREG(0x440, dwVQLen);
- }
- else {
- /* Diable VQ */
- VIASETREG(0x43c, 0x00fe0000);
- VIASETREG(0x440, 0x00000004);
- VIASETREG(0x440, 0x40008c0f);
- VIASETREG(0x440, 0x44000000);
- VIASETREG(0x440, 0x45080c04);
- VIASETREG(0x440, 0x46800408);
- }
-
- dwGEMode = 0;
-
- switch (ctx->bpp) {
- case 16:
- dwGEMode |= VIA_GEM_16bpp;
- break;
- case 32:
- dwGEMode |= VIA_GEM_32bpp;
- break;
- default:
- dwGEMode |= VIA_GEM_8bpp;
- break;
- }
-
-#if 0
- switch (ctx->shared.virtualWidth) {
- case 800:
- dwGEMode |= VIA_GEM_800;
- break;
- case 1024:
- dwGEMode |= VIA_GEM_1024;
- break;
- case 1280:
- dwGEMode |= VIA_GEM_1280;
- break;
- case 1600:
- dwGEMode |= VIA_GEM_1600;
- break;
- case 2048:
- dwGEMode |= VIA_GEM_2048;
- break;
- default:
- dwGEMode |= VIA_GEM_640;
- break;
- }
-#endif
-
- VIAEnableMMIO(ctx);
-
- /* Set BPP and Pitch */
- VIASETREG(VIA_REG_GEMODE, dwGEMode);
-
- /* Set Src and Dst base address and pitch, pitch is qword */
- VIASETREG(VIA_REG_SRCBASE, 0x0);
- VIASETREG(VIA_REG_DSTBASE, 0x0);
- VIASETREG(VIA_REG_PITCH, VIA_PITCH_ENABLE |
- ((ctx->shared.virtualWidth * ctx->bpp >> 3) >> 3) |
- (((ctx->shared.virtualWidth * ctx->bpp >> 3) >> 3) << 16));
-}
-
-static int b3DRegsInitialized = 0;
-
-static void VIAInitialize3DEngine(DRIDriverContext *ctx)
-{
- VIAPtr pVia = VIAPTR(ctx);
- int i;
-
- if (!b3DRegsInitialized)
- {
-
- VIASETREG(0x43C, 0x00010000);
-
- for (i = 0; i <= 0x7D; i++)
- {
- VIASETREG(0x440, (uint32_t) i << 24);
- }
-
- VIASETREG(0x43C, 0x00020000);
-
- for (i = 0; i <= 0x94; i++)
- {
- VIASETREG(0x440, (uint32_t) i << 24);
- }
-
- VIASETREG(0x440, 0x82400000);
-
- VIASETREG(0x43C, 0x01020000);
-
-
- for (i = 0; i <= 0x94; i++)
- {
- VIASETREG(0x440, (uint32_t) i << 24);
- }
-
- VIASETREG(0x440, 0x82400000);
- VIASETREG(0x43C, 0xfe020000);
-
- for (i = 0; i <= 0x03; i++)
- {
- VIASETREG(0x440, (uint32_t) i << 24);
- }
-
- VIASETREG(0x43C, 0x00030000);
-
- for (i = 0; i <= 0xff; i++)
- {
- VIASETREG(0x440, 0);
- }
- VIASETREG(0x43C, 0x00100000);
- VIASETREG(0x440, 0x00333004);
- VIASETREG(0x440, 0x10000002);
- VIASETREG(0x440, 0x60000000);
- VIASETREG(0x440, 0x61000000);
- VIASETREG(0x440, 0x62000000);
- VIASETREG(0x440, 0x63000000);
- VIASETREG(0x440, 0x64000000);
-
- VIASETREG(0x43C, 0x00fe0000);
-
- if (pVia->ChipRev >= 3 )
- VIASETREG(0x440,0x40008c0f);
- else
- VIASETREG(0x440,0x4000800f);
-
- VIASETREG(0x440,0x44000000);
- VIASETREG(0x440,0x45080C04);
- VIASETREG(0x440,0x46800408);
- VIASETREG(0x440,0x50000000);
- VIASETREG(0x440,0x51000000);
- VIASETREG(0x440,0x52000000);
- VIASETREG(0x440,0x53000000);
-
- b3DRegsInitialized = 1;
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "3D Engine has been initialized.\n");
- }
-
- VIASETREG(0x43C,0x00fe0000);
- VIASETREG(0x440,0x08000001);
- VIASETREG(0x440,0x0A000183);
- VIASETREG(0x440,0x0B00019F);
- VIASETREG(0x440,0x0C00018B);
- VIASETREG(0x440,0x0D00019B);
- VIASETREG(0x440,0x0E000000);
- VIASETREG(0x440,0x0F000000);
- VIASETREG(0x440,0x10000000);
- VIASETREG(0x440,0x11000000);
- VIASETREG(0x440,0x20000000);
-}
-
-static int
-WaitIdleCLE266(VIAPtr pVia)
-{
- int loop = 0;
-
- /*mem_barrier();*/
-
- while (!(VIAGETREG(VIA_REG_STATUS) & VIA_VR_QUEUE_BUSY) && (loop++ < MAXLOOP))
- ;
-
- while ((VIAGETREG(VIA_REG_STATUS) &
- (VIA_CMD_RGTR_BUSY | VIA_2D_ENG_BUSY | VIA_3D_ENG_BUSY)) &&
- (loop++ < MAXLOOP))
- ;
-
- return loop >= MAXLOOP;
-}
-
-static int viaInitFBDev(DRIDriverContext *ctx)
-{
- VIAPtr pVia = CALLOC(sizeof(*pVia));
-
- ctx->driverPrivate = (void *)pVia;
-
- switch (ctx->chipset) {
- case PCI_CHIP_CLE3122:
- case PCI_CHIP_CLE3022:
- pVia->Chipset = VIA_CLE266;
- break;
- case PCI_CHIP_VT7205:
- case PCI_CHIP_VT3205:
- pVia->Chipset = VIA_KM400;
- break;
- case PCI_CHIP_VT3204:
- case PCI_CHIP_VT3344:
- pVia->Chipset = VIA_K8M800;
- break;
- case PCI_CHIP_VT3259:
- pVia->Chipset = VIA_PM800;
- break;
- default:
- xf86DrvMsg(0, X_ERROR, "VIA: Unknown device ID (0x%x)\n", ctx->chipset);
- }
-
- /* _SOLO TODO XXX need to read ChipRev too */
- pVia->ChipRev = 0;
-
- pVia->videoRambytes = ctx->shared.fbSize;
- pVia->MmioBase = ctx->MMIOStart;
- pVia->FrameBufferBase = ctx->FBStart & 0xfc000000;
-
- pVia->FBFreeStart = ctx->shared.virtualWidth * ctx->cpp *
- ctx->shared.virtualHeight;
-
-#if 1
- /* Alloc a second framebuffer for the second head */
- pVia->FBFreeStart += ctx->shared.virtualWidth * ctx->cpp *
- ctx->shared.virtualHeight;
-#endif
-
- pVia->VQStart = pVia->FBFreeStart;
- pVia->VQEnd = pVia->FBFreeStart + VIA_VQ_SIZE - 1;
-
- pVia->FBFreeStart += VIA_VQ_SIZE;
-
- pVia->FBFreeEnd = pVia->videoRambytes;
-
- if (!VIADRIScreenInit(ctx))
- return 0;
-
- return 1;
-}
-
-static void viaHaltFBDev(DRIDriverContext *ctx)
-{
- drmUnmap( ctx->pSAREA, ctx->shared.SAREASize );
- drmClose(ctx->drmFD);
-
- if (ctx->driverPrivate) {
- free(ctx->driverPrivate);
- ctx->driverPrivate = 0;
- }
-}
-
-static int viaEngineShutdown(const DRIDriverContext *ctx)
-{
- return 1;
-}
-
-static int viaEngineRestore(const DRIDriverContext *ctx)
-{
- return 1;
-}
-
-const struct DRIDriverRec __driDriver =
-{
- viaValidateMode,
- viaPostValidateMode,
- viaInitFBDev,
- viaHaltFBDev,
- viaEngineShutdown,
- viaEngineRestore,
- 0,
-};
-
diff --git a/src/mesa/drivers/glslcompiler/glslcompiler.c b/src/mesa/drivers/glslcompiler/glslcompiler.c
index 66035a4a43..d58f32b293 100644
--- a/src/mesa/drivers/glslcompiler/glslcompiler.c
+++ b/src/mesa/drivers/glslcompiler/glslcompiler.c
@@ -68,6 +68,7 @@ static const char *Prog = "glslcompiler";
struct options {
GLboolean LineNumbers;
+ GLboolean Link;
gl_prog_print_mode Mode;
const char *VertFile;
const char *FragFile;
@@ -207,23 +208,29 @@ ReadShader(GLuint shader, const char *filename)
}
-#if 0
static void
-CheckLink(GLuint prog)
+CheckLink(GLuint v_shader, GLuint f_shader)
{
+ GLuint prog;
GLint stat;
+
+ prog = _mesa_CreateProgram();
+
+ _mesa_AttachShader(prog, v_shader);
+ _mesa_AttachShader(prog, f_shader);
+
+ _mesa_LinkProgramARB(prog);
_mesa_GetProgramiv(prog, GL_LINK_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
_mesa_GetProgramInfoLog(prog, 1000, &len, log);
- fprintf(stderr, "%s: Linker error:\n%s\n", Prog, log);
+ fprintf(stderr, "Linker error:\n%s\n", log);
}
else {
- fprintf(stderr, "%s: Link success!\n", Prog);
+ fprintf(stderr, "Link success!\n");
}
}
-#endif
static void
@@ -262,6 +269,7 @@ Usage(void)
printf(" --fs FILE fragment shader input filename\n");
printf(" --arb emit ARB-style instructions\n");
printf(" --nv emit NV-style instructions\n");
+ printf(" --link run linker\n");
printf(" --debug force #pragma debug(on)\n");
printf(" --nodebug force #pragma debug(off)\n");
printf(" --opt force #pragma optimize(on)\n");
@@ -309,6 +317,9 @@ ParseOptions(int argc, char *argv[])
else if (strcmp(argv[i], "--nv") == 0) {
Options.Mode = PROG_PRINT_NV;
}
+ else if (strcmp(argv[i], "--link") == 0) {
+ Options.Link = GL_TRUE;
+ }
else if (strcmp(argv[i], "--debug") == 0) {
Options.Pragmas.IgnoreDebug = GL_TRUE;
Options.Pragmas.Debug = GL_TRUE;
@@ -358,7 +369,7 @@ ParseOptions(int argc, char *argv[])
int
main(int argc, char *argv[])
{
- GLuint shader = 0;
+ GLuint v_shader = 0, f_shader = 0;
ParseOptions(argc, argv);
@@ -368,24 +379,38 @@ main(int argc, char *argv[])
}
if (Options.VertFile) {
- shader = CompileShader(Options.VertFile, GL_VERTEX_SHADER);
+ v_shader = CompileShader(Options.VertFile, GL_VERTEX_SHADER);
}
- else if (Options.FragFile) {
- shader = CompileShader(Options.FragFile, GL_FRAGMENT_SHADER);
+
+ if (Options.FragFile) {
+ f_shader = CompileShader(Options.FragFile, GL_FRAGMENT_SHADER);
}
- if (shader) {
+ if (v_shader || f_shader) {
if (Options.OutputFile) {
fclose(stdout);
/*stdout =*/ freopen(Options.OutputFile, "w", stdout);
}
- if (stdout) {
- PrintShaderInstructions(shader, stdout);
+ if (stdout && v_shader) {
+ PrintShaderInstructions(v_shader, stdout);
+ }
+ if (stdout && f_shader) {
+ PrintShaderInstructions(f_shader, stdout);
}
if (Options.OutputFile) {
fclose(stdout);
}
}
+ if (Options.Link) {
+ if (!v_shader || !f_shader) {
+ fprintf(stderr,
+ "--link option requires both a vertex and fragment shader.\n");
+ exit(1);
+ }
+
+ CheckLink(v_shader, f_shader);
+ }
+
return 0;
}
diff --git a/src/mesa/es/Makefile b/src/mesa/es/Makefile
index fbe67445c9..8b484853af 100644
--- a/src/mesa/es/Makefile
+++ b/src/mesa/es/Makefile
@@ -19,9 +19,8 @@ es1: $(ES1_LIBS)
es2: $(ES2_LIBS)
@rm -f subdirs-stamp-tmp
-# force the inclusion of es's mfeatures.h
-ES1_CPPFLAGS := -include main/mfeatures_es1.h -D__GL_EXPORTS
-ES2_CPPFLAGS := -include main/mfeatures_es2.h -D__GL_EXPORTS
+ES1_CPPFLAGS := -DFEATURE_ES1=1 -D__GL_EXPORTS
+ES2_CPPFLAGS := -DFEATURE_ES2=1 -D__GL_EXPORTS
ES1_OBJ_DIR := objs-es1
ES2_OBJ_DIR := objs-es2
diff --git a/src/mesa/es/main/mfeatures_es1.h b/src/mesa/es/main/mfeatures_es1.h
deleted file mode 100644
index 1793550268..0000000000
--- a/src/mesa/es/main/mfeatures_es1.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-/**
- * \file mfeatures.h
- *
- * The #defines in this file enable/disable Mesa features needed
- * for OpenGL ES 1.1.
- */
-
-
-#ifndef MFEATURES_ES1_H
-#define MFEATURES_ES1_H
-
-/* this file replaces main/mfeatures.h */
-#ifdef FEATURES_H
-#error "main/mfeatures.h was wrongly included"
-#endif
-#define FEATURES_H
-
-#define ASSERT_NO_FEATURE() ASSERT(0)
-
-/*
- * Enable/disable features (blocks of code) by setting FEATURE_xyz to 0 or 1.
- */
-#ifndef _HAVE_FULL_GL
-#define _HAVE_FULL_GL 1
-#endif
-
-#ifdef IN_DRI_DRIVER
-#define FEATURE_remap_table 1
-#else
-#define FEATURE_remap_table 0
-#endif
-
-#define FEATURE_accum 0
-#define FEATURE_arrayelt 0
-#define FEATURE_attrib 0
-#define FEATURE_beginend 0
-#define FEATURE_colortable 0
-#define FEATURE_convolve 0
-#define FEATURE_dispatch 1
-#define FEATURE_dlist 0
-#define FEATURE_draw_read_buffer 0
-#define FEATURE_drawpix 0
-#define FEATURE_eval 0
-#define FEATURE_feedback 0
-#define FEATURE_fixedpt 1
-#define FEATURE_histogram 0
-#define FEATURE_pixel 0
-#define FEATURE_point_size_array 1
-#define FEATURE_queryobj 0
-#define FEATURE_rastpos 0
-#define FEATURE_texgen 1
-#define FEATURE_texture_fxt1 0
-#define FEATURE_texture_s3tc 0
-#define FEATURE_userclip 1
-#define FEATURE_vertex_array_byte 1
-#define FEATURE_es2_glsl 0
-
-#define FEATURE_ARB_fragment_program _HAVE_FULL_GL
-#define FEATURE_ARB_vertex_buffer_object _HAVE_FULL_GL
-#define FEATURE_ARB_vertex_program _HAVE_FULL_GL
-
-#define FEATURE_ARB_vertex_shader _HAVE_FULL_GL
-#define FEATURE_ARB_fragment_shader _HAVE_FULL_GL
-#define FEATURE_ARB_shader_objects (FEATURE_ARB_vertex_shader || FEATURE_ARB_fragment_shader)
-#define FEATURE_ARB_shading_language_100 FEATURE_ARB_shader_objects
-#define FEATURE_ARB_shading_language_120 FEATURE_ARB_shader_objects
-
-#define FEATURE_EXT_framebuffer_blit 0
-#define FEATURE_EXT_framebuffer_object _HAVE_FULL_GL
-#define FEATURE_EXT_pixel_buffer_object _HAVE_FULL_GL
-#define FEATURE_EXT_texture_sRGB 0
-#define FEATURE_ATI_fragment_shader 0
-#define FEATURE_MESA_program_debug _HAVE_FULL_GL
-#define FEATURE_NV_fence 0
-#define FEATURE_NV_fragment_program 0
-#define FEATURE_NV_vertex_program 0
-
-#define FEATURE_OES_framebuffer_object 1
-#define FEATURE_OES_draw_texture 1
-#define FEATURE_OES_mapbuffer 1
-
-#define FEATURE_OES_EGL_image 1
-
-#define FEATURE_extra_context_init 1
-
-/*@}*/
-
-
-
-
-#endif /* MFEATURES_ES1_H */
diff --git a/src/mesa/es/main/mfeatures_es2.h b/src/mesa/es/main/mfeatures_es2.h
deleted file mode 100644
index a463bed11c..0000000000
--- a/src/mesa/es/main/mfeatures_es2.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-/**
- * \file mfeatures.h
- *
- * The #defines in this file enable/disable Mesa features needed
- * for OpenGL ES 2.0.
- */
-
-
-#ifndef MFEATURES_ES2_H
-#define MFEATURES_ES2_H
-
-/* this file replaces main/mfeatures.h */
-#ifdef FEATURES_H
-#error "main/mfeatures.h was wrongly included"
-#endif
-#define FEATURES_H
-
-#define ASSERT_NO_FEATURE() ASSERT(0)
-
-/*
- * Enable/disable features (blocks of code) by setting FEATURE_xyz to 0 or 1.
- */
-#ifndef _HAVE_FULL_GL
-#define _HAVE_FULL_GL 1
-#endif
-
-#ifdef IN_DRI_DRIVER
-#define FEATURE_remap_table 1
-#else
-#define FEATURE_remap_table 0
-#endif
-
-#define FEATURE_accum 0
-#define FEATURE_arrayelt 0
-#define FEATURE_attrib 0
-#define FEATURE_beginend 0
-#define FEATURE_colortable 0
-#define FEATURE_convolve 0
-#define FEATURE_dispatch 1
-#define FEATURE_dlist 0
-#define FEATURE_draw_read_buffer 0
-#define FEATURE_drawpix 0
-#define FEATURE_eval 0
-#define FEATURE_feedback 0
-#define FEATURE_fixedpt 1
-#define FEATURE_histogram 0
-#define FEATURE_pixel 0
-#define FEATURE_point_size_array 1
-#define FEATURE_queryobj 0
-#define FEATURE_rastpos 0
-#define FEATURE_texgen 1
-#define FEATURE_texture_fxt1 0
-#define FEATURE_texture_s3tc 0
-#define FEATURE_userclip 1
-#define FEATURE_vertex_array_byte 1
-#define FEATURE_es2_glsl 1
-
-#define FEATURE_ARB_fragment_program _HAVE_FULL_GL
-#define FEATURE_ARB_vertex_buffer_object _HAVE_FULL_GL
-#define FEATURE_ARB_vertex_program _HAVE_FULL_GL
-
-#define FEATURE_ARB_vertex_shader _HAVE_FULL_GL
-#define FEATURE_ARB_fragment_shader _HAVE_FULL_GL
-#define FEATURE_ARB_shader_objects (FEATURE_ARB_vertex_shader || FEATURE_ARB_fragment_shader)
-#define FEATURE_ARB_shading_language_100 FEATURE_ARB_shader_objects
-#define FEATURE_ARB_shading_language_120 FEATURE_ARB_shader_objects
-
-#define FEATURE_EXT_framebuffer_blit 0
-#define FEATURE_EXT_framebuffer_object _HAVE_FULL_GL
-#define FEATURE_EXT_pixel_buffer_object _HAVE_FULL_GL
-#define FEATURE_EXT_texture_sRGB 0
-#define FEATURE_ATI_fragment_shader 0
-#define FEATURE_MESA_program_debug _HAVE_FULL_GL
-#define FEATURE_NV_fence 0
-#define FEATURE_NV_fragment_program 0
-#define FEATURE_NV_vertex_program 0
-
-#define FEATURE_OES_framebuffer_object 1
-#define FEATURE_OES_draw_texture 0
-#define FEATURE_OES_mapbuffer 1
-
-#define FEATURE_OES_EGL_image 1
-
-#define FEATURE_extra_context_init 1
-
-/*@}*/
-
-
-
-
-#endif /* MFEATURES_ES2_H */
diff --git a/src/mesa/es/main/stubs.c b/src/mesa/es/main/stubs.c
index e7b8bc780f..b829543cc0 100644
--- a/src/mesa/es/main/stubs.c
+++ b/src/mesa/es/main/stubs.c
@@ -37,13 +37,6 @@
_mesa_error(ctx, GL_INVALID_OPERATION, __FUNCTION__); \
} while (0)
-#if FEATURE_accum
-/* This is a sanity check that to be sure we're using the correct mfeatures.h
- * header. We don't want to accidentally use the one from mainline Mesa.
- */
-#error "The wrong mfeatures.h file is being included!"
-#endif
-
/* silence compiler warnings */
extern void GLAPIENTRY _vbo_Materialf(GLenum face, GLenum pname, GLfloat param);
diff --git a/src/mesa/es/state_tracker/st_cb_drawtex.c b/src/mesa/es/state_tracker/st_cb_drawtex.c
index 0a5cba9d92..f75f4861a2 100644
--- a/src/mesa/es/state_tracker/st_cb_drawtex.c
+++ b/src/mesa/es/state_tracker/st_cb_drawtex.c
@@ -120,8 +120,11 @@ st_DrawTex(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z,
GLboolean emitColor;
uint semantic_names[2 + MAX_TEXTURE_UNITS];
uint semantic_indexes[2 + MAX_TEXTURE_UNITS];
+ struct pipe_vertex_element velements[2 + MAX_TEXTURE_UNITS];
GLbitfield inputs = VERT_BIT_POS;
+ st_validate_state(st);
+
/* determine if we need vertex color */
if (ctx->FragmentProgram._Current->Base.InputsRead & FRAG_BIT_COL0)
emitColor = GL_TRUE;
@@ -232,6 +235,7 @@ st_DrawTex(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z,
cso_save_viewport(cso);
cso_save_vertex_shader(cso);
+ cso_save_vertex_elements(cso);
{
void *vs = lookup_shader(pipe, numAttribs,
@@ -239,6 +243,14 @@ st_DrawTex(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z,
cso_set_vertex_shader_handle(cso, vs);
}
+ for (i = 0; i < numAttribs; i++) {
+ velements[i].src_offset = i * 4 * sizeof(float);
+ velements[i].instance_divisor = 0;
+ velements[i].vertex_buffer_index = 0;
+ velements[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+ }
+ cso_set_vertex_elements(cso, numAttribs, velements);
+
/* viewport state: viewport matching window dims */
{
const struct gl_framebuffer *fb = st->ctx->DrawBuffer;
@@ -270,6 +282,7 @@ st_DrawTex(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z,
/* restore state */
cso_restore_viewport(cso);
cso_restore_vertex_shader(cso);
+ cso_restore_vertex_elements(cso);
}
diff --git a/src/mesa/glapi/gen/EXT_transform_feedback.xml b/src/mesa/glapi/gen/EXT_transform_feedback.xml
new file mode 100644
index 0000000000..abbed9b25b
--- /dev/null
+++ b/src/mesa/glapi/gen/EXT_transform_feedback.xml
@@ -0,0 +1,123 @@
+<?xml version="1.0"?>
+<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
+
+<!-- Note: no GLX protocol info yet. -->
+
+
+<OpenGLAPI>
+
+<category name="GL_EXT_transform_feedback" number="352">
+
+ <enum name="TRANSFORM_FEEDBACK_BUFFER_EXT" value="0x8C8E"/>
+ <enum name="TRANSFORM_FEEDBACK_BUFFER_START_EXT" value="0x8C84"/>
+ <enum name="TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT" value="0x8C85"/>
+ <enum name="TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT" value="0x8C8F"/>
+ <enum name="INTERLEAVED_ATTRIBS_EXT" value="0x8C8C"/>
+ <enum name="SEPARATE_ATTRIBS_EXT" value="0x8C8D"/>
+ <enum name="PRIMITIVES_GENERATED_EXT" value="0x8C87"/>
+ <enum name="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT" value="0x8C88"/>
+ <enum name="RASTERIZER_DISCARD_EXT" value="0x8C89"/>
+ <enum name="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT" value="0x8C8A"/>
+ <enum name="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT" value="0x8C8B"/>
+ <enum name="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT" value="0x8C80"/>
+ <enum name="TRANSFORM_FEEDBACK_VARYINGS_EXT" value="0x8C83"/>
+ <enum name="TRANSFORM_FEEDBACK_BUFFER_MODE_EXT" value="0x8C7F"/>
+ <enum name="TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT" value="0x8C76"/>
+
+ <function name="BindBufferRangeEXT" offset="assign">
+ <param name="target" type="GLenum"/>
+ <param name="index" type="GLuint"/>
+ <param name="buffer" type="GLuint"/>
+ <param name="offset" type="GLintptr"/>
+ <param name="size" type="GLsizeiptr"/>
+ </function>
+
+ <function name="BindBufferOffsetEXT" offset="assign">
+ <param name="target" type="GLenum"/>
+ <param name="index" type="GLuint"/>
+ <param name="buffer" type="GLuint"/>
+ <param name="offset" type="GLintptr"/>
+ </function>
+
+ <function name="BindBufferBaseEXT" offset="assign">
+ <param name="target" type="GLenum"/>
+ <param name="index" type="GLuint"/>
+ <param name="buffer" type="GLuint"/>
+ </function>
+
+ <function name="BeginTransformFeedbackEXT" offset="assign">
+ <param name="mode" type="GLenum"/>
+ </function>
+
+ <function name="EndTransformFeedbackEXT" offset="assign">
+ </function>
+
+ <function name="TransformFeedbackVaryingsEXT" offset="assign">
+ <param name="program" type="GLuint"/>
+ <param name="count" type="GLsizei"/>
+ <param name="varyings" type="const char **"/>
+ <param name="bufferMode" type="GLenum"/>
+ </function>
+
+ <function name="GetTransformFeedbackVaryingEXT" offset="assign">
+ <param name="program" type="GLuint"/>
+ <param name="index" type="GLuint"/>
+ <param name="bufSize" type="GLsizei"/>
+ <param name="length" type="GLsizei *"/>
+ <param name="size" type="GLsizei *"/>
+ <param name="type" type="GLenum *"/>
+ <param name="name" type="GLchar *"/>
+ </function>
+
+ <!-- Note: the glGetIntegerIndexedvEXT() and glGetBooleanIndexedvEXT
+ functions are defined in the EXT_draw_buffers2.xml file -->
+
+</category>
+
+
+<!-- Note: these 3.0 entrypoints might get moved to a new file -->
+
+<category name="3.0">
+
+ <function name="BindBufferRange" alias="BindBufferRangeEXT">
+ <param name="target" type="GLenum"/>
+ <param name="index" type="GLuint"/>
+ <param name="buffer" type="GLuint"/>
+ <param name="offset" type="GLintptr"/>
+ <param name="size" type="GLsizeiptr"/>
+ </function>
+
+ <function name="BindBufferBase" alias="BindBufferBaseEXT">
+ <param name="target" type="GLenum"/>
+ <param name="index" type="GLuint"/>
+ <param name="buffer" type="GLuint"/>
+ </function>
+
+ <function name="BeginTransformFeedback" alias="BeginTransformFeedbackEXT">
+ <param name="mode" type="GLenum"/>
+ </function>
+
+ <function name="EndTransformFeedback" alias="EndTransformFeedbackEXT">
+ </function>
+
+ <function name="TransformFeedbackVaryings" alias="TransformFeedbackVaryingsEXT">
+ <param name="program" type="GLuint"/>
+ <param name="count" type="GLsizei"/>
+ <param name="varyings" type="const char **"/>
+ <param name="bufferMode" type="GLenum"/>
+ </function>
+
+ <function name="GetTransformFeedbackVarying" alias="GetTransformFeedbackVaryingEXT">
+ <param name="program" type="GLuint"/>
+ <param name="index" type="GLuint"/>
+ <param name="bufSize" type="GLsizei"/>
+ <param name="length" type="GLsizei *"/>
+ <param name="size" type="GLsizei *"/>
+ <param name="type" type="GLenum *"/>
+ <param name="name" type="GLchar *"/>
+ </function>
+
+</category>
+
+
+</OpenGLAPI>
diff --git a/src/mesa/glapi/gen/Makefile b/src/mesa/glapi/gen/Makefile
index 8aa74ce434..4ac95a29cb 100644
--- a/src/mesa/glapi/gen/Makefile
+++ b/src/mesa/glapi/gen/Makefile
@@ -86,6 +86,7 @@ API_XML = \
EXT_packed_depth_stencil.xml \
EXT_provoking_vertex.xml \
EXT_texture_array.xml \
+ EXT_transform_feedback.xml \
NV_conditional_render.xml \
OES_EGL_image.xml
@@ -103,7 +104,7 @@ xorg: check-xorg-source $(XORG_OUTPUTS)
check-xorg-source:
@if ! test -d $(XORG_GLX_DIR); then \
- echo "ERROR: Must specify path to xserver checkout; set XORG_BASE."; \
+ echo "ERROR: Must specify path to xserver/GL/GLX checkout; set XORG_GLX_DIR."; \
exit 1; \
fi
diff --git a/src/mesa/glapi/gen/gl_API.xml b/src/mesa/glapi/gen/gl_API.xml
index 4a4d0d5382..10fdc0e1bb 100644
--- a/src/mesa/glapi/gen/gl_API.xml
+++ b/src/mesa/glapi/gen/gl_API.xml
@@ -7967,6 +7967,8 @@
<xi:include href="NV_conditional_render.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
+<xi:include href="EXT_transform_feedback.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
+
<!-- Non-ARB extensions sorted by extension number. -->
diff --git a/src/mesa/glapi/glapi.c b/src/mesa/glapi/glapi.c
index 13de594aaf..ce85cf6a87 100644
--- a/src/mesa/glapi/glapi.c
+++ b/src/mesa/glapi/glapi.c
@@ -59,7 +59,7 @@
#endif
#include "glapi/glapi.h"
-#include "glapi/glapitable.h"
+#include "glapi/glapi_priv.h"
extern _glapi_proc __glapi_noop_table[];
@@ -291,45 +291,3 @@ _glapi_get_dispatch(void)
return _glapi_Dispatch;
#endif
}
-
-
-
-
-/*
- * The dispatch table size (number of entries) is the size of the
- * _glapi_table struct plus the number of dynamic entries we can add.
- * The extra slots can be filled in by DRI drivers that register new extension
- * functions.
- */
-#define DISPATCH_TABLE_SIZE (sizeof(struct _glapi_table) / sizeof(void *) + MAX_EXTENSION_FUNCS)
-
-
-/**
- * Return size of dispatch table struct as number of functions (or
- * slots).
- */
-PUBLIC GLuint
-_glapi_get_dispatch_table_size(void)
-{
- return DISPATCH_TABLE_SIZE;
-}
-
-
-/**
- * Make sure there are no NULL pointers in the given dispatch table.
- * Intended for debugging purposes.
- */
-void
-_glapi_check_table_not_null(const struct _glapi_table *table)
-{
-#if 0 /* enable this for extra DEBUG */
- const GLuint entries = _glapi_get_dispatch_table_size();
- const void **tab = (const void **) table;
- GLuint i;
- for (i = 1; i < entries; i++) {
- assert(tab[i]);
- }
-#else
- (void) table;
-#endif
-}
diff --git a/src/mesa/glapi/glapi.h b/src/mesa/glapi/glapi.h
index 1ca2e4beff..7dcf2e8910 100644
--- a/src/mesa/glapi/glapi.h
+++ b/src/mesa/glapi/glapi.h
@@ -165,29 +165,8 @@ extern _glapi_proc
_glapi_get_proc_address(const char *funcName);
-/**
- * GL API local functions and defines
- */
-
-extern void
-init_glapi_relocs_once(void);
-
-extern void
-_glapi_check_table_not_null(const struct _glapi_table *table);
-
-
-extern void
-_glapi_check_table(const struct _glapi_table *table);
-
-
extern const char *
_glapi_get_proc_name(unsigned int offset);
-/*
- * Number of extension functions which we can dynamically add at runtime.
- */
-#define MAX_EXTENSION_FUNCS 300
-
-
#endif
diff --git a/src/mesa/glapi/glapi_entrypoint.c b/src/mesa/glapi/glapi_entrypoint.c
new file mode 100644
index 0000000000..239780e753
--- /dev/null
+++ b/src/mesa/glapi/glapi_entrypoint.c
@@ -0,0 +1,352 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.1
+ *
+ * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file glapi_entrypoint.c
+ *
+ * Arch-specific code for manipulating GL API entrypoints (dispatch stubs).
+ */
+
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#include "glapi/mesa.h"
+#else
+#include "main/glheader.h"
+#include "main/compiler.h"
+#endif
+
+#include "glapi/glapi.h"
+#include "glapi/glapi_priv.h"
+
+
+#ifdef USE_X86_ASM
+
+#if defined( GLX_USE_TLS )
+extern GLubyte gl_dispatch_functions_start[];
+extern GLubyte gl_dispatch_functions_end[];
+#else
+extern const GLubyte gl_dispatch_functions_start[];
+#endif
+
+#endif /* USE_X86_ASM */
+
+
+#if defined(DISPATCH_FUNCTION_SIZE)
+
+_glapi_proc
+get_entrypoint_address(unsigned int functionOffset)
+{
+ return (_glapi_proc) (gl_dispatch_functions_start
+ + (DISPATCH_FUNCTION_SIZE * functionOffset));
+}
+
+#endif
+
+
+#if defined(USE_X86_ASM)
+
+/**
+ * Perform platform-specific GL API entry-point fixups.
+ */
+static void
+init_glapi_relocs( void )
+{
+#if defined(GLX_USE_TLS) && !defined(GLX_X86_READONLY_TEXT)
+ extern unsigned long _x86_get_dispatch(void);
+ char run_time_patch[] = {
+ 0x65, 0xa1, 0, 0, 0, 0 /* movl %gs:0,%eax */
+ };
+ GLuint *offset = (GLuint *) &run_time_patch[2]; /* 32-bits for x86/32 */
+ const GLubyte * const get_disp = (const GLubyte *) run_time_patch;
+ GLubyte * curr_func = (GLubyte *) gl_dispatch_functions_start;
+
+ *offset = _x86_get_dispatch();
+ while ( curr_func != (GLubyte *) gl_dispatch_functions_end ) {
+ (void) memcpy( curr_func, get_disp, sizeof(run_time_patch));
+ curr_func += DISPATCH_FUNCTION_SIZE;
+ }
+#endif
+}
+
+
+/**
+ * Generate a dispatch function (entrypoint) which jumps through
+ * the given slot number (offset) in the current dispatch table.
+ * We need assembly language in order to accomplish this.
+ */
+_glapi_proc
+generate_entrypoint(unsigned int functionOffset)
+{
+ /* 32 is chosen as something of a magic offset. For x86, the dispatch
+ * at offset 32 is the first one where the offset in the
+ * "jmp OFFSET*4(%eax)" can't be encoded in a single byte.
+ */
+ const GLubyte * const template_func = gl_dispatch_functions_start
+ + (DISPATCH_FUNCTION_SIZE * 32);
+ GLubyte * const code = (GLubyte *) _glapi_exec_malloc(DISPATCH_FUNCTION_SIZE);
+
+
+ if ( code != NULL ) {
+ (void) memcpy(code, template_func, DISPATCH_FUNCTION_SIZE);
+ fill_in_entrypoint_offset( (_glapi_proc) code, functionOffset );
+ }
+
+ return (_glapi_proc) code;
+}
+
+
+/**
+ * This function inserts a new dispatch offset into the assembly language
+ * stub that was generated with the preceeding function.
+ */
+void
+fill_in_entrypoint_offset(_glapi_proc entrypoint, unsigned int offset)
+{
+ GLubyte * const code = (GLubyte *) entrypoint;
+
+#if defined(GLX_USE_TLS)
+ *((unsigned int *)(code + 8)) = 4 * offset;
+#elif defined(THREADS)
+ *((unsigned int *)(code + 11)) = 4 * offset;
+ *((unsigned int *)(code + 22)) = 4 * offset;
+#else
+ *((unsigned int *)(code + 7)) = 4 * offset;
+#endif
+}
+
+
+#elif defined(USE_SPARC_ASM)
+
+extern void __glapi_sparc_icache_flush(unsigned int *);
+
+static void
+init_glapi_relocs( void )
+{
+#if defined(PTHREADS) || defined(GLX_USE_TLS)
+ static const unsigned int template[] = {
+#ifdef GLX_USE_TLS
+ 0x05000000, /* sethi %hi(_glapi_tls_Dispatch), %g2 */
+ 0x8730e00a, /* srl %g3, 10, %g3 */
+ 0x8410a000, /* or %g2, %lo(_glapi_tls_Dispatch), %g2 */
+#ifdef __arch64__
+ 0xc259c002, /* ldx [%g7 + %g2], %g1 */
+ 0xc2584003, /* ldx [%g1 + %g3], %g1 */
+#else
+ 0xc201c002, /* ld [%g7 + %g2], %g1 */
+ 0xc2004003, /* ld [%g1 + %g3], %g1 */
+#endif
+ 0x81c04000, /* jmp %g1 */
+ 0x01000000, /* nop */
+#else
+#ifdef __arch64__
+ 0x03000000, /* 64-bit 0x00 --> sethi %hh(_glapi_Dispatch), %g1 */
+ 0x05000000, /* 64-bit 0x04 --> sethi %lm(_glapi_Dispatch), %g2 */
+ 0x82106000, /* 64-bit 0x08 --> or %g1, %hm(_glapi_Dispatch), %g1 */
+ 0x8730e00a, /* 64-bit 0x0c --> srl %g3, 10, %g3 */
+ 0x83287020, /* 64-bit 0x10 --> sllx %g1, 32, %g1 */
+ 0x82004002, /* 64-bit 0x14 --> add %g1, %g2, %g1 */
+ 0xc2586000, /* 64-bit 0x18 --> ldx [%g1 + %lo(_glapi_Dispatch)], %g1 */
+#else
+ 0x03000000, /* 32-bit 0x00 --> sethi %hi(_glapi_Dispatch), %g1 */
+ 0x8730e00a, /* 32-bit 0x04 --> srl %g3, 10, %g3 */
+ 0xc2006000, /* 32-bit 0x08 --> ld [%g1 + %lo(_glapi_Dispatch)], %g1 */
+#endif
+ 0x80a06000, /* --> cmp %g1, 0 */
+ 0x02800005, /* --> be +4*5 */
+ 0x01000000, /* --> nop */
+#ifdef __arch64__
+ 0xc2584003, /* 64-bit --> ldx [%g1 + %g3], %g1 */
+#else
+ 0xc2004003, /* 32-bit --> ld [%g1 + %g3], %g1 */
+#endif
+ 0x81c04000, /* --> jmp %g1 */
+ 0x01000000, /* --> nop */
+#ifdef __arch64__
+ 0x9de3bf80, /* 64-bit --> save %sp, -128, %sp */
+#else
+ 0x9de3bfc0, /* 32-bit --> save %sp, -64, %sp */
+#endif
+ 0xa0100003, /* --> mov %g3, %l0 */
+ 0x40000000, /* --> call _glapi_get_dispatch */
+ 0x01000000, /* --> nop */
+ 0x82100008, /* --> mov %o0, %g1 */
+ 0x86100010, /* --> mov %l0, %g3 */
+ 0x10bffff7, /* --> ba -4*9 */
+ 0x81e80000, /* --> restore */
+#endif
+ };
+#ifdef GLX_USE_TLS
+ extern unsigned int __glapi_sparc_tls_stub;
+ extern unsigned long __glapi_sparc_get_dispatch(void);
+ unsigned int *code = &__glapi_sparc_tls_stub;
+ unsigned long dispatch = __glapi_sparc_get_dispatch();
+#else
+ extern unsigned int __glapi_sparc_pthread_stub;
+ unsigned int *code = &__glapi_sparc_pthread_stub;
+ unsigned long dispatch = (unsigned long) &_glapi_Dispatch;
+ unsigned long call_dest = (unsigned long ) &_glapi_get_dispatch;
+ int idx;
+#endif
+
+#ifdef GLX_USE_TLS
+ code[0] = template[0] | (dispatch >> 10);
+ code[1] = template[1];
+ __glapi_sparc_icache_flush(&code[0]);
+ code[2] = template[2] | (dispatch & 0x3ff);
+ code[3] = template[3];
+ __glapi_sparc_icache_flush(&code[2]);
+ code[4] = template[4];
+ code[5] = template[5];
+ __glapi_sparc_icache_flush(&code[4]);
+ code[6] = template[6];
+ __glapi_sparc_icache_flush(&code[6]);
+#else
+#if defined(__arch64__)
+ code[0] = template[0] | (dispatch >> (32 + 10));
+ code[1] = template[1] | ((dispatch & 0xffffffff) >> 10);
+ __glapi_sparc_icache_flush(&code[0]);
+ code[2] = template[2] | ((dispatch >> 32) & 0x3ff);
+ code[3] = template[3];
+ __glapi_sparc_icache_flush(&code[2]);
+ code[4] = template[4];
+ code[5] = template[5];
+ __glapi_sparc_icache_flush(&code[4]);
+ code[6] = template[6] | (dispatch & 0x3ff);
+ idx = 7;
+#else
+ code[0] = template[0] | (dispatch >> 10);
+ code[1] = template[1];
+ __glapi_sparc_icache_flush(&code[0]);
+ code[2] = template[2] | (dispatch & 0x3ff);
+ idx = 3;
+#endif
+ code[idx + 0] = template[idx + 0];
+ __glapi_sparc_icache_flush(&code[idx - 1]);
+ code[idx + 1] = template[idx + 1];
+ code[idx + 2] = template[idx + 2];
+ __glapi_sparc_icache_flush(&code[idx + 1]);
+ code[idx + 3] = template[idx + 3];
+ code[idx + 4] = template[idx + 4];
+ __glapi_sparc_icache_flush(&code[idx + 3]);
+ code[idx + 5] = template[idx + 5];
+ code[idx + 6] = template[idx + 6];
+ __glapi_sparc_icache_flush(&code[idx + 5]);
+ code[idx + 7] = template[idx + 7];
+ code[idx + 8] = template[idx + 8] |
+ (((call_dest - ((unsigned long) &code[idx + 8]))
+ >> 2) & 0x3fffffff);
+ __glapi_sparc_icache_flush(&code[idx + 7]);
+ code[idx + 9] = template[idx + 9];
+ code[idx + 10] = template[idx + 10];
+ __glapi_sparc_icache_flush(&code[idx + 9]);
+ code[idx + 11] = template[idx + 11];
+ code[idx + 12] = template[idx + 12];
+ __glapi_sparc_icache_flush(&code[idx + 11]);
+ code[idx + 13] = template[idx + 13];
+ __glapi_sparc_icache_flush(&code[idx + 13]);
+#endif
+#endif
+}
+
+
+_glapi_proc
+generate_entrypoint(GLuint functionOffset)
+{
+#if defined(PTHREADS) || defined(GLX_USE_TLS)
+ static const unsigned int template[] = {
+ 0x07000000, /* sethi %hi(0), %g3 */
+ 0x8210000f, /* mov %o7, %g1 */
+ 0x40000000, /* call */
+ 0x9e100001, /* mov %g1, %o7 */
+ };
+#ifdef GLX_USE_TLS
+ extern unsigned int __glapi_sparc_tls_stub;
+ unsigned long call_dest = (unsigned long ) &__glapi_sparc_tls_stub;
+#else
+ extern unsigned int __glapi_sparc_pthread_stub;
+ unsigned long call_dest = (unsigned long ) &__glapi_sparc_pthread_stub;
+#endif
+ unsigned int *code = (unsigned int *) _glapi_exec_malloc(sizeof(template));
+ if (code) {
+ code[0] = template[0] | (functionOffset & 0x3fffff);
+ code[1] = template[1];
+ __glapi_sparc_icache_flush(&code[0]);
+ code[2] = template[2] |
+ (((call_dest - ((unsigned long) &code[2]))
+ >> 2) & 0x3fffffff);
+ code[3] = template[3];
+ __glapi_sparc_icache_flush(&code[2]);
+ }
+ return (_glapi_proc) code;
+#endif
+}
+
+
+void
+fill_in_entrypoint_offset(_glapi_proc entrypoint, GLuint offset)
+{
+ unsigned int *code = (unsigned int *) entrypoint;
+
+ code[0] &= ~0x3fffff;
+ code[0] |= (offset * sizeof(void *)) & 0x3fffff;
+ __glapi_sparc_icache_flush(&code[0]);
+}
+
+
+#else /* USE_*_ASM */
+
+static void
+init_glapi_relocs( void )
+{
+}
+
+
+_glapi_proc
+generate_entrypoint(GLuint functionOffset)
+{
+ (void) functionOffset;
+ return NULL;
+}
+
+
+void
+fill_in_entrypoint_offset(_glapi_proc entrypoint, GLuint offset)
+{
+ /* an unimplemented architecture */
+ (void) entrypoint;
+ (void) offset;
+}
+
+#endif /* USE_*_ASM */
+
+
+void
+init_glapi_relocs_once( void )
+{
+#if defined(PTHREADS) || defined(GLX_USE_TLS)
+ static pthread_once_t once_control = PTHREAD_ONCE_INIT;
+ pthread_once( & once_control, init_glapi_relocs );
+#endif
+}
diff --git a/src/mesa/glapi/glapi_execmem.c b/src/mesa/glapi/glapi_execmem.c
new file mode 100644
index 0000000000..57f00be8dc
--- /dev/null
+++ b/src/mesa/glapi/glapi_execmem.c
@@ -0,0 +1,128 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.5
+ *
+ * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * \file glapi_execmem.c
+ *
+ * Function for allocating executable memory for dispatch stubs.
+ *
+ * Copied from main/execmem.c and simplified for dispatch stubs.
+ */
+
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#include "glapi/mesa.h"
+#else
+#include "main/compiler.h"
+#endif
+
+#include "glapi/glthread.h"
+#include "glapi/glapi_priv.h"
+
+
+#if defined(__linux__) || defined(__OpenBSD__) || defined(_NetBSD__) || defined(__sun)
+
+#include <unistd.h>
+#include <sys/mman.h>
+
+#ifdef MESA_SELINUX
+#include <selinux/selinux.h>
+#endif
+
+
+#ifndef MAP_ANONYMOUS
+#define MAP_ANONYMOUS MAP_ANON
+#endif
+
+
+#define EXEC_MAP_SIZE (4*1024)
+
+_glthread_DECLARE_STATIC_MUTEX(exec_mutex);
+
+static unsigned int head = 0;
+
+static unsigned char *exec_mem = NULL;
+
+
+/*
+ * Dispatch stubs are of fixed size and never freed. Thus, we do not need to
+ * overlay a heap, we just mmap a page and manage through an index.
+ */
+
+static int
+init_map(void)
+{
+#ifdef MESA_SELINUX
+ if (is_selinux_enabled()) {
+ if (!security_get_boolean_active("allow_execmem") ||
+ !security_get_boolean_pending("allow_execmem"))
+ return 0;
+ }
+#endif
+
+ if (!exec_mem)
+ exec_mem = mmap(NULL, EXEC_MAP_SIZE, PROT_EXEC | PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+
+ return (exec_mem != MAP_FAILED);
+}
+
+
+void *
+_glapi_exec_malloc(unsigned int size)
+{
+ void *addr = NULL;
+
+ _glthread_LOCK_MUTEX(exec_mutex);
+
+ if (!init_map())
+ goto bail;
+
+ /* free space check, assumes no integer overflow */
+ if (head + size > EXEC_MAP_SIZE)
+ goto bail;
+
+ /* allocation, assumes proper addr and size alignement */
+ addr = exec_mem + head;
+ head += size;
+
+bail:
+ _glthread_UNLOCK_MUTEX(exec_mutex);
+
+ return addr;
+}
+
+
+#else
+
+void *
+_glapi_exec_malloc(unsigned int size)
+{
+ return malloc(size);
+}
+
+
+#endif
diff --git a/src/mesa/glapi/glapi_getproc.c b/src/mesa/glapi/glapi_getproc.c
index a6dbf173e8..c73e8dd3b0 100644
--- a/src/mesa/glapi/glapi_getproc.c
+++ b/src/mesa/glapi/glapi_getproc.c
@@ -39,25 +39,19 @@
#endif
#include "glapi/glapi.h"
-#include "glapi/glapioffsets.h"
+#include "glapi/glapi_priv.h"
#include "glapi/glapitable.h"
+#include "glapi/glapioffsets.h"
-#if defined(USE_X64_64_ASM) && defined(GLX_USE_TLS)
-# define DISPATCH_FUNCTION_SIZE 16
-#elif defined(USE_X86_ASM)
-# if defined(THREADS) && !defined(GLX_USE_TLS)
-# define DISPATCH_FUNCTION_SIZE 32
-# else
-# define DISPATCH_FUNCTION_SIZE 16
-# endif
-#endif
+/**********************************************************************
+ * Static function management.
+ */
+
-#if !defined(DISPATCH_FUNCTION_SIZE) && !defined(XFree86Server) && !defined(XGLServer)
+#if !defined(DISPATCH_FUNCTION_SIZE) && !defined(XFree86Server)
# define NEED_FUNCTION_POINTER
#endif
-
-/* The code in this file is auto-generated with Python */
#include "glapi/glprocs.h"
@@ -66,13 +60,13 @@
* and return the corresponding glprocs_table_t entry.
*/
static const glprocs_table_t *
-find_entry( const char * n )
+get_static_proc( const char * n )
{
GLuint i;
for (i = 0; static_functions[i].Name_offset >= 0; i++) {
const char *testName = gl_string_table + static_functions[i].Name_offset;
#ifdef MANGLE
- /* skip the "m" prefix on the name */
+ /* skip the prefix on the name */
if (strcmp(testName, n + 1) == 0)
#else
if (strcmp(testName, n) == 0)
@@ -92,27 +86,16 @@ find_entry( const char * n )
static GLint
get_static_proc_offset(const char *funcName)
{
- const glprocs_table_t * const f = find_entry( funcName );
- if (f) {
- return f->Offset;
+ const glprocs_table_t * const f = get_static_proc( funcName );
+ if (f == NULL) {
+ return -1;
}
- return -1;
-}
-
-#ifdef USE_X86_ASM
-
-#if defined( GLX_USE_TLS )
-extern GLubyte gl_dispatch_functions_start[];
-extern GLubyte gl_dispatch_functions_end[];
-#else
-extern const GLubyte gl_dispatch_functions_start[];
-#endif
-
-#endif /* USE_X86_ASM */
+ return f->Offset;
+}
-#if !defined(XFree86Server) && !defined(XGLServer)
+#if !defined(XFree86Server)
/**
* Return dispatch function address for the named static (built-in) function.
@@ -121,27 +104,32 @@ extern const GLubyte gl_dispatch_functions_start[];
static _glapi_proc
get_static_proc_address(const char *funcName)
{
- const glprocs_table_t * const f = find_entry( funcName );
- if (f) {
+ const glprocs_table_t * const f = get_static_proc( funcName );
+ if (f == NULL) {
+ return NULL;
+ }
+
#if defined(DISPATCH_FUNCTION_SIZE) && defined(GLX_INDIRECT_RENDERING)
- return (f->Address == NULL)
- ? (_glapi_proc) (gl_dispatch_functions_start
- + (DISPATCH_FUNCTION_SIZE * f->Offset))
- : f->Address;
+ return (f->Address == NULL)
+ ? get_entrypoint_address(f->Offset)
+ : f->Address;
#elif defined(DISPATCH_FUNCTION_SIZE)
- return (_glapi_proc) (gl_dispatch_functions_start
- + (DISPATCH_FUNCTION_SIZE * f->Offset));
+ return get_entrypoint_address(f->Offset);
#else
- return f->Address;
+ return f->Address;
#endif
- }
- else {
- return NULL;
- }
}
-#endif /* !defined(XFree86Server) && !defined(XGLServer) */
+#else
+
+static _glapi_proc
+get_static_proc_address(const char *funcName)
+{
+ (void) funcName;
+ return NULL;
+}
+#endif /* !defined(XFree86Server) */
/**
@@ -162,172 +150,6 @@ get_static_proc_name( GLuint offset )
-#if defined(PTHREADS) || defined(GLX_USE_TLS)
-
-/**
- * Perform platform-specific GL API entry-point fixups.
- */
-static void
-init_glapi_relocs( void )
-{
-#if defined(USE_X86_ASM) && defined(GLX_USE_TLS) && !defined(GLX_X86_READONLY_TEXT)
- extern unsigned long _x86_get_dispatch(void);
- char run_time_patch[] = {
- 0x65, 0xa1, 0, 0, 0, 0 /* movl %gs:0,%eax */
- };
- GLuint *offset = (GLuint *) &run_time_patch[2]; /* 32-bits for x86/32 */
- const GLubyte * const get_disp = (const GLubyte *) run_time_patch;
- GLubyte * curr_func = (GLubyte *) gl_dispatch_functions_start;
-
- *offset = _x86_get_dispatch();
- while ( curr_func != (GLubyte *) gl_dispatch_functions_end ) {
- (void) memcpy( curr_func, get_disp, sizeof(run_time_patch));
- curr_func += DISPATCH_FUNCTION_SIZE;
- }
-#endif
-#ifdef USE_SPARC_ASM
- extern void __glapi_sparc_icache_flush(unsigned int *);
- static const unsigned int template[] = {
-#ifdef GLX_USE_TLS
- 0x05000000, /* sethi %hi(_glapi_tls_Dispatch), %g2 */
- 0x8730e00a, /* srl %g3, 10, %g3 */
- 0x8410a000, /* or %g2, %lo(_glapi_tls_Dispatch), %g2 */
-#ifdef __arch64__
- 0xc259c002, /* ldx [%g7 + %g2], %g1 */
- 0xc2584003, /* ldx [%g1 + %g3], %g1 */
-#else
- 0xc201c002, /* ld [%g7 + %g2], %g1 */
- 0xc2004003, /* ld [%g1 + %g3], %g1 */
-#endif
- 0x81c04000, /* jmp %g1 */
- 0x01000000, /* nop */
-#else
-#ifdef __arch64__
- 0x03000000, /* 64-bit 0x00 --> sethi %hh(_glapi_Dispatch), %g1 */
- 0x05000000, /* 64-bit 0x04 --> sethi %lm(_glapi_Dispatch), %g2 */
- 0x82106000, /* 64-bit 0x08 --> or %g1, %hm(_glapi_Dispatch), %g1 */
- 0x8730e00a, /* 64-bit 0x0c --> srl %g3, 10, %g3 */
- 0x83287020, /* 64-bit 0x10 --> sllx %g1, 32, %g1 */
- 0x82004002, /* 64-bit 0x14 --> add %g1, %g2, %g1 */
- 0xc2586000, /* 64-bit 0x18 --> ldx [%g1 + %lo(_glapi_Dispatch)], %g1 */
-#else
- 0x03000000, /* 32-bit 0x00 --> sethi %hi(_glapi_Dispatch), %g1 */
- 0x8730e00a, /* 32-bit 0x04 --> srl %g3, 10, %g3 */
- 0xc2006000, /* 32-bit 0x08 --> ld [%g1 + %lo(_glapi_Dispatch)], %g1 */
-#endif
- 0x80a06000, /* --> cmp %g1, 0 */
- 0x02800005, /* --> be +4*5 */
- 0x01000000, /* --> nop */
-#ifdef __arch64__
- 0xc2584003, /* 64-bit --> ldx [%g1 + %g3], %g1 */
-#else
- 0xc2004003, /* 32-bit --> ld [%g1 + %g3], %g1 */
-#endif
- 0x81c04000, /* --> jmp %g1 */
- 0x01000000, /* --> nop */
-#ifdef __arch64__
- 0x9de3bf80, /* 64-bit --> save %sp, -128, %sp */
-#else
- 0x9de3bfc0, /* 32-bit --> save %sp, -64, %sp */
-#endif
- 0xa0100003, /* --> mov %g3, %l0 */
- 0x40000000, /* --> call _glapi_get_dispatch */
- 0x01000000, /* --> nop */
- 0x82100008, /* --> mov %o0, %g1 */
- 0x86100010, /* --> mov %l0, %g3 */
- 0x10bffff7, /* --> ba -4*9 */
- 0x81e80000, /* --> restore */
-#endif
- };
-#ifdef GLX_USE_TLS
- extern unsigned int __glapi_sparc_tls_stub;
- extern unsigned long __glapi_sparc_get_dispatch(void);
- unsigned int *code = &__glapi_sparc_tls_stub;
- unsigned long dispatch = __glapi_sparc_get_dispatch();
-#else
- extern unsigned int __glapi_sparc_pthread_stub;
- unsigned int *code = &__glapi_sparc_pthread_stub;
- unsigned long dispatch = (unsigned long) &_glapi_Dispatch;
- unsigned long call_dest = (unsigned long ) &_glapi_get_dispatch;
- int idx;
-#endif
-
-#if defined(GLX_USE_TLS)
- code[0] = template[0] | (dispatch >> 10);
- code[1] = template[1];
- __glapi_sparc_icache_flush(&code[0]);
- code[2] = template[2] | (dispatch & 0x3ff);
- code[3] = template[3];
- __glapi_sparc_icache_flush(&code[2]);
- code[4] = template[4];
- code[5] = template[5];
- __glapi_sparc_icache_flush(&code[4]);
- code[6] = template[6];
- __glapi_sparc_icache_flush(&code[6]);
-#else
-#if defined(__arch64__)
- code[0] = template[0] | (dispatch >> (32 + 10));
- code[1] = template[1] | ((dispatch & 0xffffffff) >> 10);
- __glapi_sparc_icache_flush(&code[0]);
- code[2] = template[2] | ((dispatch >> 32) & 0x3ff);
- code[3] = template[3];
- __glapi_sparc_icache_flush(&code[2]);
- code[4] = template[4];
- code[5] = template[5];
- __glapi_sparc_icache_flush(&code[4]);
- code[6] = template[6] | (dispatch & 0x3ff);
- idx = 7;
-#else
- code[0] = template[0] | (dispatch >> 10);
- code[1] = template[1];
- __glapi_sparc_icache_flush(&code[0]);
- code[2] = template[2] | (dispatch & 0x3ff);
- idx = 3;
-#endif
- code[idx + 0] = template[idx + 0];
- __glapi_sparc_icache_flush(&code[idx - 1]);
- code[idx + 1] = template[idx + 1];
- code[idx + 2] = template[idx + 2];
- __glapi_sparc_icache_flush(&code[idx + 1]);
- code[idx + 3] = template[idx + 3];
- code[idx + 4] = template[idx + 4];
- __glapi_sparc_icache_flush(&code[idx + 3]);
- code[idx + 5] = template[idx + 5];
- code[idx + 6] = template[idx + 6];
- __glapi_sparc_icache_flush(&code[idx + 5]);
- code[idx + 7] = template[idx + 7];
- code[idx + 8] = template[idx + 8] |
- (((call_dest - ((unsigned long) &code[idx + 8]))
- >> 2) & 0x3fffffff);
- __glapi_sparc_icache_flush(&code[idx + 7]);
- code[idx + 9] = template[idx + 9];
- code[idx + 10] = template[idx + 10];
- __glapi_sparc_icache_flush(&code[idx + 9]);
- code[idx + 11] = template[idx + 11];
- code[idx + 12] = template[idx + 12];
- __glapi_sparc_icache_flush(&code[idx + 11]);
- code[idx + 13] = template[idx + 13];
- __glapi_sparc_icache_flush(&code[idx + 13]);
-#endif
-#endif
-}
-
-void
-init_glapi_relocs_once( void )
-{
- static pthread_once_t once_control = PTHREAD_ONCE_INIT;
- pthread_once( & once_control, init_glapi_relocs );
-}
-
-#else
-
-void
-init_glapi_relocs_once( void ) { }
-
-#endif /* defined(PTHREADS) || defined(GLX_USE_TLS) */
-
-
-
/**********************************************************************
* Extension function management.
*/
@@ -381,107 +203,54 @@ struct _glapi_function {
static struct _glapi_function ExtEntryTable[MAX_EXTENSION_FUNCS];
static GLuint NumExtEntryPoints = 0;
-#ifdef USE_SPARC_ASM
-extern void __glapi_sparc_icache_flush(unsigned int *);
-#endif
-
-static void
-fill_in_entrypoint_offset(_glapi_proc entrypoint, GLuint offset);
-/**
- * Generate a dispatch function (entrypoint) which jumps through
- * the given slot number (offset) in the current dispatch table.
- * We need assembly language in order to accomplish this.
- */
-static _glapi_proc
-generate_entrypoint(GLuint functionOffset)
+static struct _glapi_function *
+get_extension_proc(const char *funcName)
{
-#if defined(USE_X86_ASM)
- /* 32 is chosen as something of a magic offset. For x86, the dispatch
- * at offset 32 is the first one where the offset in the
- * "jmp OFFSET*4(%eax)" can't be encoded in a single byte.
- */
- const GLubyte * const template_func = gl_dispatch_functions_start
- + (DISPATCH_FUNCTION_SIZE * 32);
- GLubyte * const code = (GLubyte *) malloc(DISPATCH_FUNCTION_SIZE);
-
-
- if ( code != NULL ) {
- (void) memcpy(code, template_func, DISPATCH_FUNCTION_SIZE);
- fill_in_entrypoint_offset( (_glapi_proc) code, functionOffset );
+ GLuint i;
+ for (i = 0; i < NumExtEntryPoints; i++) {
+ if (strcmp(ExtEntryTable[i].name, funcName) == 0) {
+ return & ExtEntryTable[i];
+ }
}
+ return NULL;
+}
- return (_glapi_proc) code;
-#elif defined(USE_SPARC_ASM)
-
-#if defined(PTHREADS) || defined(GLX_USE_TLS)
- static const unsigned int template[] = {
- 0x07000000, /* sethi %hi(0), %g3 */
- 0x8210000f, /* mov %o7, %g1 */
- 0x40000000, /* call */
- 0x9e100001, /* mov %g1, %o7 */
- };
-#ifdef GLX_USE_TLS
- extern unsigned int __glapi_sparc_tls_stub;
- unsigned long call_dest = (unsigned long ) &__glapi_sparc_tls_stub;
-#else
- extern unsigned int __glapi_sparc_pthread_stub;
- unsigned long call_dest = (unsigned long ) &__glapi_sparc_pthread_stub;
-#endif
- unsigned int *code = (unsigned int *) malloc(sizeof(template));
- if (code) {
- code[0] = template[0] | (functionOffset & 0x3fffff);
- code[1] = template[1];
- __glapi_sparc_icache_flush(&code[0]);
- code[2] = template[2] |
- (((call_dest - ((unsigned long) &code[2]))
- >> 2) & 0x3fffffff);
- code[3] = template[3];
- __glapi_sparc_icache_flush(&code[2]);
+
+static GLint
+get_extension_proc_offset(const char *funcName)
+{
+ const struct _glapi_function * const f = get_extension_proc( funcName );
+ if (f == NULL) {
+ return -1;
}
- return (_glapi_proc) code;
-#endif
-#else
- (void) functionOffset;
- return NULL;
-#endif /* USE_*_ASM */
+ return f->dispatch_offset;
}
-/**
- * This function inserts a new dispatch offset into the assembly language
- * stub that was generated with the preceeding function.
- */
-static void
-fill_in_entrypoint_offset(_glapi_proc entrypoint, GLuint offset)
+static _glapi_proc
+get_extension_proc_address(const char *funcName)
{
-#if defined(USE_X86_ASM)
- GLubyte * const code = (GLubyte *) entrypoint;
-
-#if DISPATCH_FUNCTION_SIZE == 32
- *((unsigned int *)(code + 11)) = 4 * offset;
- *((unsigned int *)(code + 22)) = 4 * offset;
-#elif DISPATCH_FUNCTION_SIZE == 16 && defined( GLX_USE_TLS )
- *((unsigned int *)(code + 8)) = 4 * offset;
-#elif DISPATCH_FUNCTION_SIZE == 16
- *((unsigned int *)(code + 7)) = 4 * offset;
-#else
-# error Invalid DISPATCH_FUNCTION_SIZE!
-#endif
+ const struct _glapi_function * const f = get_extension_proc( funcName );
+ if (f == NULL) {
+ return NULL;
+ }
-#elif defined(USE_SPARC_ASM)
- unsigned int *code = (unsigned int *) entrypoint;
- code[0] &= ~0x3fffff;
- code[0] |= (offset * sizeof(void *)) & 0x3fffff;
- __glapi_sparc_icache_flush(&code[0]);
-#else
+ return f->dispatch_stub;
+}
- /* an unimplemented architecture */
- (void) entrypoint;
- (void) offset;
-#endif /* USE_*_ASM */
+static const char *
+get_extension_proc_name(GLuint offset)
+{
+ GLuint i;
+ for (i = 0; i < NumExtEntryPoints; i++) {
+ if (ExtEntryTable[i].dispatch_offset == offset) {
+ return ExtEntryTable[i].name;
+ }
+ }
+ return NULL;
}
@@ -518,20 +287,55 @@ static struct _glapi_function *
add_function_name( const char * funcName )
{
struct _glapi_function * entry = NULL;
-
- if (NumExtEntryPoints < MAX_EXTENSION_FUNCS) {
- _glapi_proc entrypoint = generate_entrypoint(~0);
- if (entrypoint != NULL) {
- entry = & ExtEntryTable[NumExtEntryPoints];
-
- ExtEntryTable[NumExtEntryPoints].name = str_dup(funcName);
- ExtEntryTable[NumExtEntryPoints].parameter_signature = NULL;
- ExtEntryTable[NumExtEntryPoints].dispatch_offset = ~0;
- ExtEntryTable[NumExtEntryPoints].dispatch_stub = entrypoint;
- NumExtEntryPoints++;
- }
+ _glapi_proc entrypoint = NULL;
+ char * name_dup = NULL;
+
+ if (NumExtEntryPoints >= MAX_EXTENSION_FUNCS)
+ return NULL;
+
+ if (funcName == NULL)
+ return NULL;
+
+ name_dup = str_dup(funcName);
+ if (name_dup == NULL)
+ return NULL;
+
+ entrypoint = generate_entrypoint(~0);
+
+ if (entrypoint == NULL) {
+ free(name_dup);
+ return NULL;
}
+ entry = & ExtEntryTable[NumExtEntryPoints];
+ NumExtEntryPoints++;
+
+ entry->name = name_dup;
+ entry->parameter_signature = NULL;
+ entry->dispatch_offset = ~0;
+ entry->dispatch_stub = entrypoint;
+
+ return entry;
+}
+
+
+static struct _glapi_function *
+set_entry_info( struct _glapi_function * entry, const char * signature, unsigned offset )
+{
+ char * sig_dup = NULL;
+
+ if (signature == NULL)
+ return NULL;
+
+ sig_dup = str_dup(signature);
+ if (sig_dup == NULL)
+ return NULL;
+
+ fill_in_entrypoint_offset(entry->dispatch_stub, offset);
+
+ entry->parameter_signature = sig_dup;
+ entry->dispatch_offset = offset;
+
return entry;
}
@@ -593,88 +397,103 @@ _glapi_add_dispatch( const char * const * function_names,
struct _glapi_function * entry[8];
GLboolean is_static[8];
unsigned i;
- unsigned j;
int offset = ~0;
- int new_offset;
+ init_glapi_relocs_once();
(void) memset( is_static, 0, sizeof( is_static ) );
(void) memset( entry, 0, sizeof( entry ) );
+ /* Find the _single_ dispatch offset for all function names that already
+ * exist (and have a dispatch offset).
+ */
+
for ( i = 0 ; function_names[i] != NULL ; i++ ) {
- /* Do some trivial validation on the name of the function.
- */
+ const char * funcName = function_names[i];
+ int static_offset;
+ int extension_offset;
- if (!function_names[i] || function_names[i][0] != 'g' || function_names[i][1] != 'l')
+ if (funcName[0] != 'g' || funcName[1] != 'l')
return -1;
-
- /* Determine if the named function already exists. If the function does
- * exist, it must have the same parameter signature as the function
- * being added.
- */
-
- new_offset = get_static_proc_offset(function_names[i]);
- if (new_offset >= 0) {
+
+ /* search built-in functions */
+ static_offset = get_static_proc_offset(funcName);
+
+ if (static_offset >= 0) {
+
+ is_static[i] = GL_TRUE;
+
/* FIXME: Make sure the parameter signatures match! How do we get
* FIXME: the parameter signature for static functions?
*/
- if ( (offset != ~0) && (new_offset != offset) ) {
+ if ( (offset != ~0) && (static_offset != offset) ) {
return -1;
}
- is_static[i] = GL_TRUE;
- offset = new_offset;
+ offset = static_offset;
+
+ continue;
}
-
-
- for ( j = 0 ; j < NumExtEntryPoints ; j++ ) {
- if (strcmp(ExtEntryTable[j].name, function_names[i]) == 0) {
- /* The offset may be ~0 if the function name was added by
- * glXGetProcAddress but never filled in by the driver.
- */
-
- if (ExtEntryTable[j].dispatch_offset != ~0) {
- if (strcmp(real_sig, ExtEntryTable[j].parameter_signature)
- != 0) {
- return -1;
- }
-
- if ( (offset != ~0) && (ExtEntryTable[j].dispatch_offset != offset) ) {
- return -1;
- }
-
- offset = ExtEntryTable[j].dispatch_offset;
- }
-
- entry[i] = & ExtEntryTable[j];
- break;
+
+ /* search added extension functions */
+ entry[i] = get_extension_proc(funcName);
+
+ if (entry[i] != NULL) {
+ extension_offset = entry[i]->dispatch_offset;
+
+ /* The offset may be ~0 if the function name was added by
+ * glXGetProcAddress but never filled in by the driver.
+ */
+
+ if (extension_offset == ~0) {
+ continue;
+ }
+
+ if (strcmp(real_sig, entry[i]->parameter_signature) != 0) {
+ return -1;
}
+
+ if ( (offset != ~0) && (extension_offset != offset) ) {
+ return -1;
+ }
+
+ offset = extension_offset;
}
}
+ /* If all function names are either new (or with no dispatch offset),
+ * allocate a new dispatch offset.
+ */
+
if (offset == ~0) {
offset = next_dynamic_offset;
next_dynamic_offset++;
}
+ /* Fill in the dispatch offset for the new function names (and those with
+ * no dispatch offset).
+ */
+
for ( i = 0 ; function_names[i] != NULL ; i++ ) {
- if (! is_static[i] ) {
+ if (is_static[i]) {
+ continue;
+ }
+
+ /* generate entrypoints for new function names */
+ if (entry[i] == NULL) {
+ entry[i] = add_function_name( function_names[i] );
if (entry[i] == NULL) {
- entry[i] = add_function_name( function_names[i] );
- if (entry[i] == NULL) {
- /* FIXME: Possible memory leak here.
- */
- return -1;
- }
+ /* FIXME: Possible memory leak here. */
+ return -1;
}
+ }
- entry[i]->parameter_signature = str_dup(real_sig);
- fill_in_entrypoint_offset(entry[i]->dispatch_stub, offset);
- entry[i]->dispatch_offset = offset;
+ if (entry[i]->dispatch_offset == ~0) {
+ set_entry_info( entry[i], real_sig, offset );
}
}
-
+
return offset;
}
@@ -685,13 +504,13 @@ _glapi_add_dispatch( const char * const * function_names,
PUBLIC GLint
_glapi_get_proc_offset(const char *funcName)
{
+ GLint offset;
+
/* search extension functions first */
- GLuint i;
- for (i = 0; i < NumExtEntryPoints; i++) {
- if (strcmp(ExtEntryTable[i].name, funcName) == 0) {
- return ExtEntryTable[i].dispatch_offset;
- }
- }
+ offset = get_extension_proc_offset(funcName);
+ if (offset >= 0)
+ return offset;
+
/* search static functions */
return get_static_proc_offset(funcName);
}
@@ -706,11 +525,14 @@ _glapi_get_proc_offset(const char *funcName)
PUBLIC _glapi_proc
_glapi_get_proc_address(const char *funcName)
{
+ _glapi_proc func;
struct _glapi_function * entry;
- GLuint i;
+
+ init_glapi_relocs_once();
#ifdef MANGLE
- if (funcName[0] != 'm' || funcName[1] != 'g' || funcName[2] != 'l')
+ /* skip the prefix on the name */
+ if (funcName[1] != 'g' || funcName[2] != 'l')
return NULL;
#else
if (funcName[0] != 'g' || funcName[1] != 'l')
@@ -718,23 +540,21 @@ _glapi_get_proc_address(const char *funcName)
#endif
/* search extension functions first */
- for (i = 0; i < NumExtEntryPoints; i++) {
- if (strcmp(ExtEntryTable[i].name, funcName) == 0) {
- return ExtEntryTable[i].dispatch_stub;
- }
- }
+ func = get_extension_proc_address(funcName);
+ if (func)
+ return func;
-#if !defined( XFree86Server ) && !defined( XGLServer )
/* search static functions */
- {
- const _glapi_proc func = get_static_proc_address(funcName);
- if (func)
- return func;
- }
-#endif /* !defined( XFree86Server ) */
+ func = get_static_proc_address(funcName);
+ if (func)
+ return func;
+ /* generate entrypoint, dispatch offset must be filled in by the driver */
entry = add_function_name(funcName);
- return (entry == NULL) ? NULL : entry->dispatch_stub;
+ if (entry == NULL)
+ return NULL;
+
+ return entry->dispatch_stub;
}
@@ -746,7 +566,6 @@ _glapi_get_proc_address(const char *funcName)
const char *
_glapi_get_proc_name(GLuint offset)
{
- GLuint i;
const char * n;
/* search built-in functions */
@@ -756,16 +575,56 @@ _glapi_get_proc_name(GLuint offset)
}
/* search added extension functions */
- for (i = 0; i < NumExtEntryPoints; i++) {
- if (ExtEntryTable[i].dispatch_offset == offset) {
- return ExtEntryTable[i].name;
- }
- }
- return NULL;
+ return get_extension_proc_name(offset);
}
+/**********************************************************************
+ * GL API table functions.
+ */
+
+
+/*
+ * The dispatch table size (number of entries) is the size of the
+ * _glapi_table struct plus the number of dynamic entries we can add.
+ * The extra slots can be filled in by DRI drivers that register new extension
+ * functions.
+ */
+#define DISPATCH_TABLE_SIZE (sizeof(struct _glapi_table) / sizeof(void *) + MAX_EXTENSION_FUNCS)
+
+
+/**
+ * Return size of dispatch table struct as number of functions (or
+ * slots).
+ */
+PUBLIC GLuint
+_glapi_get_dispatch_table_size(void)
+{
+ return DISPATCH_TABLE_SIZE;
+}
+
+
+/**
+ * Make sure there are no NULL pointers in the given dispatch table.
+ * Intended for debugging purposes.
+ */
+void
+_glapi_check_table_not_null(const struct _glapi_table *table)
+{
+#ifdef EXTRA_DEBUG /* set to DEBUG for extra DEBUG */
+ const GLuint entries = _glapi_get_dispatch_table_size();
+ const void **tab = (const void **) table;
+ GLuint i;
+ for (i = 1; i < entries; i++) {
+ assert(tab[i]);
+ }
+#else
+ (void) table;
+#endif
+}
+
+
/**
* Do some spot checks to be sure that the dispatch table
* slots are assigned correctly. For debugging only.
@@ -773,7 +632,7 @@ _glapi_get_proc_name(GLuint offset)
void
_glapi_check_table(const struct _glapi_table *table)
{
-#if 0 /* enable this for extra DEBUG */
+#ifdef EXTRA_DEBUG /* set to DEBUG for extra DEBUG */
{
GLuint BeginOffset = _glapi_get_proc_offset("glBegin");
char *BeginFunc = (char*) &table->Begin;
diff --git a/src/mesa/glapi/glapi_priv.h b/src/mesa/glapi/glapi_priv.h
new file mode 100644
index 0000000000..da6fee63fe
--- /dev/null
+++ b/src/mesa/glapi/glapi_priv.h
@@ -0,0 +1,99 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.1
+ *
+ * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef _GLAPI_PRIV_H
+#define _GLAPI_PRIV_H
+
+#include "glthread.h"
+#include "glapi.h"
+
+
+
+/* getproc */
+
+extern void
+_glapi_check_table_not_null(const struct _glapi_table *table);
+
+
+extern void
+_glapi_check_table(const struct _glapi_table *table);
+
+
+/* execmem */
+
+extern void *
+_glapi_exec_malloc(unsigned int size);
+
+
+/* entrypoint */
+
+extern void
+init_glapi_relocs_once(void);
+
+
+extern _glapi_proc
+generate_entrypoint(unsigned int functionOffset);
+
+
+extern void
+fill_in_entrypoint_offset(_glapi_proc entrypoint, unsigned int offset);
+
+
+extern _glapi_proc
+get_entrypoint_address(unsigned int functionOffset);
+
+
+/**
+ * Size (in bytes) of dispatch function (entrypoint).
+ */
+#if defined(USE_X86_ASM)
+# if defined(GLX_USE_TLS)
+# define DISPATCH_FUNCTION_SIZE 16
+# elif defined(THREADS)
+# define DISPATCH_FUNCTION_SIZE 32
+# else
+# define DISPATCH_FUNCTION_SIZE 16
+# endif
+#endif
+
+#if defined(USE_X64_64_ASM)
+# if defined(GLX_USE_TLS)
+# define DISPATCH_FUNCTION_SIZE 16
+# endif
+#endif
+
+
+/**
+ * Number of extension functions which we can dynamically add at runtime.
+ *
+ * Number of extension functions is also subject to the size of backing exec
+ * mem we allocate. For the common case of dispatch stubs with size 16 bytes,
+ * the two limits will be hit simultaneously. For larger dispatch function
+ * sizes, MAX_EXTENSION_FUNCS is effectively reduced.
+ */
+#define MAX_EXTENSION_FUNCS 256
+
+
+#endif
diff --git a/src/mesa/glapi/glapidispatch.h b/src/mesa/glapi/glapidispatch.h
index 7e0f21390f..07bcbd905d 100644
--- a/src/mesa/glapi/glapidispatch.h
+++ b/src/mesa/glapi/glapidispatch.h
@@ -2446,6 +2446,27 @@
#define CALL_EndConditionalRenderNV(disp, parameters) (*((disp)->EndConditionalRenderNV)) parameters
#define GET_EndConditionalRenderNV(disp) ((disp)->EndConditionalRenderNV)
#define SET_EndConditionalRenderNV(disp, fn) ((disp)->EndConditionalRenderNV = fn)
+#define CALL_BeginTransformFeedbackEXT(disp, parameters) (*((disp)->BeginTransformFeedbackEXT)) parameters
+#define GET_BeginTransformFeedbackEXT(disp) ((disp)->BeginTransformFeedbackEXT)
+#define SET_BeginTransformFeedbackEXT(disp, fn) ((disp)->BeginTransformFeedbackEXT = fn)
+#define CALL_BindBufferBaseEXT(disp, parameters) (*((disp)->BindBufferBaseEXT)) parameters
+#define GET_BindBufferBaseEXT(disp) ((disp)->BindBufferBaseEXT)
+#define SET_BindBufferBaseEXT(disp, fn) ((disp)->BindBufferBaseEXT = fn)
+#define CALL_BindBufferOffsetEXT(disp, parameters) (*((disp)->BindBufferOffsetEXT)) parameters
+#define GET_BindBufferOffsetEXT(disp) ((disp)->BindBufferOffsetEXT)
+#define SET_BindBufferOffsetEXT(disp, fn) ((disp)->BindBufferOffsetEXT = fn)
+#define CALL_BindBufferRangeEXT(disp, parameters) (*((disp)->BindBufferRangeEXT)) parameters
+#define GET_BindBufferRangeEXT(disp) ((disp)->BindBufferRangeEXT)
+#define SET_BindBufferRangeEXT(disp, fn) ((disp)->BindBufferRangeEXT = fn)
+#define CALL_EndTransformFeedbackEXT(disp, parameters) (*((disp)->EndTransformFeedbackEXT)) parameters
+#define GET_EndTransformFeedbackEXT(disp) ((disp)->EndTransformFeedbackEXT)
+#define SET_EndTransformFeedbackEXT(disp, fn) ((disp)->EndTransformFeedbackEXT = fn)
+#define CALL_GetTransformFeedbackVaryingEXT(disp, parameters) (*((disp)->GetTransformFeedbackVaryingEXT)) parameters
+#define GET_GetTransformFeedbackVaryingEXT(disp) ((disp)->GetTransformFeedbackVaryingEXT)
+#define SET_GetTransformFeedbackVaryingEXT(disp, fn) ((disp)->GetTransformFeedbackVaryingEXT = fn)
+#define CALL_TransformFeedbackVaryingsEXT(disp, parameters) (*((disp)->TransformFeedbackVaryingsEXT)) parameters
+#define GET_TransformFeedbackVaryingsEXT(disp) ((disp)->TransformFeedbackVaryingsEXT)
+#define SET_TransformFeedbackVaryingsEXT(disp, fn) ((disp)->TransformFeedbackVaryingsEXT = fn)
#define CALL_ProvokingVertexEXT(disp, parameters) (*((disp)->ProvokingVertexEXT)) parameters
#define GET_ProvokingVertexEXT(disp) ((disp)->ProvokingVertexEXT)
#define SET_ProvokingVertexEXT(disp, fn) ((disp)->ProvokingVertexEXT = fn)
@@ -2488,7 +2509,7 @@
#else
-#define driDispatchRemapTable_size 400
+#define driDispatchRemapTable_size 407
extern int driDispatchRemapTable[ driDispatchRemapTable_size ];
#define AttachShader_remap_index 0
@@ -2878,19 +2899,26 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ];
#define IsEnabledIndexedEXT_remap_index 384
#define BeginConditionalRenderNV_remap_index 385
#define EndConditionalRenderNV_remap_index 386
-#define ProvokingVertexEXT_remap_index 387
-#define GetTexParameterPointervAPPLE_remap_index 388
-#define TextureRangeAPPLE_remap_index 389
-#define GetObjectParameterivAPPLE_remap_index 390
-#define ObjectPurgeableAPPLE_remap_index 391
-#define ObjectUnpurgeableAPPLE_remap_index 392
-#define StencilFuncSeparateATI_remap_index 393
-#define ProgramEnvParameters4fvEXT_remap_index 394
-#define ProgramLocalParameters4fvEXT_remap_index 395
-#define GetQueryObjecti64vEXT_remap_index 396
-#define GetQueryObjectui64vEXT_remap_index 397
-#define EGLImageTargetRenderbufferStorageOES_remap_index 398
-#define EGLImageTargetTexture2DOES_remap_index 399
+#define BeginTransformFeedbackEXT_remap_index 387
+#define BindBufferBaseEXT_remap_index 388
+#define BindBufferOffsetEXT_remap_index 389
+#define BindBufferRangeEXT_remap_index 390
+#define EndTransformFeedbackEXT_remap_index 391
+#define GetTransformFeedbackVaryingEXT_remap_index 392
+#define TransformFeedbackVaryingsEXT_remap_index 393
+#define ProvokingVertexEXT_remap_index 394
+#define GetTexParameterPointervAPPLE_remap_index 395
+#define TextureRangeAPPLE_remap_index 396
+#define GetObjectParameterivAPPLE_remap_index 397
+#define ObjectPurgeableAPPLE_remap_index 398
+#define ObjectUnpurgeableAPPLE_remap_index 399
+#define StencilFuncSeparateATI_remap_index 400
+#define ProgramEnvParameters4fvEXT_remap_index 401
+#define ProgramLocalParameters4fvEXT_remap_index 402
+#define GetQueryObjecti64vEXT_remap_index 403
+#define GetQueryObjectui64vEXT_remap_index 404
+#define EGLImageTargetRenderbufferStorageOES_remap_index 405
+#define EGLImageTargetTexture2DOES_remap_index 406
#define CALL_AttachShader(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLuint)), driDispatchRemapTable[AttachShader_remap_index], parameters)
#define GET_AttachShader(disp) GET_by_offset(disp, driDispatchRemapTable[AttachShader_remap_index])
@@ -4053,6 +4081,27 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ];
#define CALL_EndConditionalRenderNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(void)), driDispatchRemapTable[EndConditionalRenderNV_remap_index], parameters)
#define GET_EndConditionalRenderNV(disp) GET_by_offset(disp, driDispatchRemapTable[EndConditionalRenderNV_remap_index])
#define SET_EndConditionalRenderNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[EndConditionalRenderNV_remap_index], fn)
+#define CALL_BeginTransformFeedbackEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[BeginTransformFeedbackEXT_remap_index], parameters)
+#define GET_BeginTransformFeedbackEXT(disp) GET_by_offset(disp, driDispatchRemapTable[BeginTransformFeedbackEXT_remap_index])
+#define SET_BeginTransformFeedbackEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BeginTransformFeedbackEXT_remap_index], fn)
+#define CALL_BindBufferBaseEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint)), driDispatchRemapTable[BindBufferBaseEXT_remap_index], parameters)
+#define GET_BindBufferBaseEXT(disp) GET_by_offset(disp, driDispatchRemapTable[BindBufferBaseEXT_remap_index])
+#define SET_BindBufferBaseEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BindBufferBaseEXT_remap_index], fn)
+#define CALL_BindBufferOffsetEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, GLintptr)), driDispatchRemapTable[BindBufferOffsetEXT_remap_index], parameters)
+#define GET_BindBufferOffsetEXT(disp) GET_by_offset(disp, driDispatchRemapTable[BindBufferOffsetEXT_remap_index])
+#define SET_BindBufferOffsetEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BindBufferOffsetEXT_remap_index], fn)
+#define CALL_BindBufferRangeEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, GLintptr, GLsizeiptr)), driDispatchRemapTable[BindBufferRangeEXT_remap_index], parameters)
+#define GET_BindBufferRangeEXT(disp) GET_by_offset(disp, driDispatchRemapTable[BindBufferRangeEXT_remap_index])
+#define SET_BindBufferRangeEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BindBufferRangeEXT_remap_index], fn)
+#define CALL_EndTransformFeedbackEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(void)), driDispatchRemapTable[EndTransformFeedbackEXT_remap_index], parameters)
+#define GET_EndTransformFeedbackEXT(disp) GET_by_offset(disp, driDispatchRemapTable[EndTransformFeedbackEXT_remap_index])
+#define SET_EndTransformFeedbackEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[EndTransformFeedbackEXT_remap_index], fn)
+#define CALL_GetTransformFeedbackVaryingEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLuint, GLsizei, GLsizei *, GLsizei *, GLenum *, GLchar *)), driDispatchRemapTable[GetTransformFeedbackVaryingEXT_remap_index], parameters)
+#define GET_GetTransformFeedbackVaryingEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetTransformFeedbackVaryingEXT_remap_index])
+#define SET_GetTransformFeedbackVaryingEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetTransformFeedbackVaryingEXT_remap_index], fn)
+#define CALL_TransformFeedbackVaryingsEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const char **, GLenum)), driDispatchRemapTable[TransformFeedbackVaryingsEXT_remap_index], parameters)
+#define GET_TransformFeedbackVaryingsEXT(disp) GET_by_offset(disp, driDispatchRemapTable[TransformFeedbackVaryingsEXT_remap_index])
+#define SET_TransformFeedbackVaryingsEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[TransformFeedbackVaryingsEXT_remap_index], fn)
#define CALL_ProvokingVertexEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[ProvokingVertexEXT_remap_index], parameters)
#define GET_ProvokingVertexEXT(disp) GET_by_offset(disp, driDispatchRemapTable[ProvokingVertexEXT_remap_index])
#define SET_ProvokingVertexEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProvokingVertexEXT_remap_index], fn)
diff --git a/src/mesa/glapi/glapioffsets.h b/src/mesa/glapi/glapioffsets.h
index 6d7bc2a0fa..abd29fbc48 100644
--- a/src/mesa/glapi/glapioffsets.h
+++ b/src/mesa/glapi/glapioffsets.h
@@ -829,20 +829,27 @@
#define _gloffset_IsEnabledIndexedEXT 792
#define _gloffset_BeginConditionalRenderNV 793
#define _gloffset_EndConditionalRenderNV 794
-#define _gloffset_ProvokingVertexEXT 795
-#define _gloffset_GetTexParameterPointervAPPLE 796
-#define _gloffset_TextureRangeAPPLE 797
-#define _gloffset_GetObjectParameterivAPPLE 798
-#define _gloffset_ObjectPurgeableAPPLE 799
-#define _gloffset_ObjectUnpurgeableAPPLE 800
-#define _gloffset_StencilFuncSeparateATI 801
-#define _gloffset_ProgramEnvParameters4fvEXT 802
-#define _gloffset_ProgramLocalParameters4fvEXT 803
-#define _gloffset_GetQueryObjecti64vEXT 804
-#define _gloffset_GetQueryObjectui64vEXT 805
-#define _gloffset_EGLImageTargetRenderbufferStorageOES 806
-#define _gloffset_EGLImageTargetTexture2DOES 807
-#define _gloffset_FIRST_DYNAMIC 808
+#define _gloffset_BeginTransformFeedbackEXT 795
+#define _gloffset_BindBufferBaseEXT 796
+#define _gloffset_BindBufferOffsetEXT 797
+#define _gloffset_BindBufferRangeEXT 798
+#define _gloffset_EndTransformFeedbackEXT 799
+#define _gloffset_GetTransformFeedbackVaryingEXT 800
+#define _gloffset_TransformFeedbackVaryingsEXT 801
+#define _gloffset_ProvokingVertexEXT 802
+#define _gloffset_GetTexParameterPointervAPPLE 803
+#define _gloffset_TextureRangeAPPLE 804
+#define _gloffset_GetObjectParameterivAPPLE 805
+#define _gloffset_ObjectPurgeableAPPLE 806
+#define _gloffset_ObjectUnpurgeableAPPLE 807
+#define _gloffset_StencilFuncSeparateATI 808
+#define _gloffset_ProgramEnvParameters4fvEXT 809
+#define _gloffset_ProgramLocalParameters4fvEXT 810
+#define _gloffset_GetQueryObjecti64vEXT 811
+#define _gloffset_GetQueryObjectui64vEXT 812
+#define _gloffset_EGLImageTargetRenderbufferStorageOES 813
+#define _gloffset_EGLImageTargetTexture2DOES 814
+#define _gloffset_FIRST_DYNAMIC 815
#else
@@ -1233,6 +1240,13 @@
#define _gloffset_IsEnabledIndexedEXT driDispatchRemapTable[IsEnabledIndexedEXT_remap_index]
#define _gloffset_BeginConditionalRenderNV driDispatchRemapTable[BeginConditionalRenderNV_remap_index]
#define _gloffset_EndConditionalRenderNV driDispatchRemapTable[EndConditionalRenderNV_remap_index]
+#define _gloffset_BeginTransformFeedbackEXT driDispatchRemapTable[BeginTransformFeedbackEXT_remap_index]
+#define _gloffset_BindBufferBaseEXT driDispatchRemapTable[BindBufferBaseEXT_remap_index]
+#define _gloffset_BindBufferOffsetEXT driDispatchRemapTable[BindBufferOffsetEXT_remap_index]
+#define _gloffset_BindBufferRangeEXT driDispatchRemapTable[BindBufferRangeEXT_remap_index]
+#define _gloffset_EndTransformFeedbackEXT driDispatchRemapTable[EndTransformFeedbackEXT_remap_index]
+#define _gloffset_GetTransformFeedbackVaryingEXT driDispatchRemapTable[GetTransformFeedbackVaryingEXT_remap_index]
+#define _gloffset_TransformFeedbackVaryingsEXT driDispatchRemapTable[TransformFeedbackVaryingsEXT_remap_index]
#define _gloffset_ProvokingVertexEXT driDispatchRemapTable[ProvokingVertexEXT_remap_index]
#define _gloffset_GetTexParameterPointervAPPLE driDispatchRemapTable[GetTexParameterPointervAPPLE_remap_index]
#define _gloffset_TextureRangeAPPLE driDispatchRemapTable[TextureRangeAPPLE_remap_index]
diff --git a/src/mesa/glapi/glapitable.h b/src/mesa/glapi/glapitable.h
index 149ff3f3c4..317c64de00 100644
--- a/src/mesa/glapi/glapitable.h
+++ b/src/mesa/glapi/glapitable.h
@@ -835,19 +835,26 @@ struct _glapi_table
GLboolean (GLAPIENTRYP IsEnabledIndexedEXT)(GLenum target, GLuint index); /* 792 */
void (GLAPIENTRYP BeginConditionalRenderNV)(GLuint query, GLenum mode); /* 793 */
void (GLAPIENTRYP EndConditionalRenderNV)(void); /* 794 */
- void (GLAPIENTRYP ProvokingVertexEXT)(GLenum mode); /* 795 */
- void (GLAPIENTRYP GetTexParameterPointervAPPLE)(GLenum target, GLenum pname, GLvoid ** params); /* 796 */
- void (GLAPIENTRYP TextureRangeAPPLE)(GLenum target, GLsizei length, GLvoid * pointer); /* 797 */
- void (GLAPIENTRYP GetObjectParameterivAPPLE)(GLenum objectType, GLuint name, GLenum pname, GLint * value); /* 798 */
- GLenum (GLAPIENTRYP ObjectPurgeableAPPLE)(GLenum objectType, GLuint name, GLenum option); /* 799 */
- GLenum (GLAPIENTRYP ObjectUnpurgeableAPPLE)(GLenum objectType, GLuint name, GLenum option); /* 800 */
- void (GLAPIENTRYP StencilFuncSeparateATI)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); /* 801 */
- void (GLAPIENTRYP ProgramEnvParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 802 */
- void (GLAPIENTRYP ProgramLocalParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 803 */
- void (GLAPIENTRYP GetQueryObjecti64vEXT)(GLuint id, GLenum pname, GLint64EXT * params); /* 804 */
- void (GLAPIENTRYP GetQueryObjectui64vEXT)(GLuint id, GLenum pname, GLuint64EXT * params); /* 805 */
- void (GLAPIENTRYP EGLImageTargetRenderbufferStorageOES)(GLenum target, GLvoid * writeOffset); /* 806 */
- void (GLAPIENTRYP EGLImageTargetTexture2DOES)(GLenum target, GLvoid * writeOffset); /* 807 */
+ void (GLAPIENTRYP BeginTransformFeedbackEXT)(GLenum mode); /* 795 */
+ void (GLAPIENTRYP BindBufferBaseEXT)(GLenum target, GLuint index, GLuint buffer); /* 796 */
+ void (GLAPIENTRYP BindBufferOffsetEXT)(GLenum target, GLuint index, GLuint buffer, GLintptr offset); /* 797 */
+ void (GLAPIENTRYP BindBufferRangeEXT)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); /* 798 */
+ void (GLAPIENTRYP EndTransformFeedbackEXT)(void); /* 799 */
+ void (GLAPIENTRYP GetTransformFeedbackVaryingEXT)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLsizei * size, GLenum * type, GLchar * name); /* 800 */
+ void (GLAPIENTRYP TransformFeedbackVaryingsEXT)(GLuint program, GLsizei count, const char ** varyings, GLenum bufferMode); /* 801 */
+ void (GLAPIENTRYP ProvokingVertexEXT)(GLenum mode); /* 802 */
+ void (GLAPIENTRYP GetTexParameterPointervAPPLE)(GLenum target, GLenum pname, GLvoid ** params); /* 803 */
+ void (GLAPIENTRYP TextureRangeAPPLE)(GLenum target, GLsizei length, GLvoid * pointer); /* 804 */
+ void (GLAPIENTRYP GetObjectParameterivAPPLE)(GLenum objectType, GLuint name, GLenum pname, GLint * value); /* 805 */
+ GLenum (GLAPIENTRYP ObjectPurgeableAPPLE)(GLenum objectType, GLuint name, GLenum option); /* 806 */
+ GLenum (GLAPIENTRYP ObjectUnpurgeableAPPLE)(GLenum objectType, GLuint name, GLenum option); /* 807 */
+ void (GLAPIENTRYP StencilFuncSeparateATI)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); /* 808 */
+ void (GLAPIENTRYP ProgramEnvParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 809 */
+ void (GLAPIENTRYP ProgramLocalParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 810 */
+ void (GLAPIENTRYP GetQueryObjecti64vEXT)(GLuint id, GLenum pname, GLint64EXT * params); /* 811 */
+ void (GLAPIENTRYP GetQueryObjectui64vEXT)(GLuint id, GLenum pname, GLuint64EXT * params); /* 812 */
+ void (GLAPIENTRYP EGLImageTargetRenderbufferStorageOES)(GLenum target, GLvoid * writeOffset); /* 813 */
+ void (GLAPIENTRYP EGLImageTargetTexture2DOES)(GLenum target, GLvoid * writeOffset); /* 814 */
};
#endif /* !defined( _GLAPI_TABLE_H_ ) */
diff --git a/src/mesa/glapi/glapitemp.h b/src/mesa/glapi/glapitemp.h
index ea6b61159d..bd805ca923 100644
--- a/src/mesa/glapi/glapitemp.h
+++ b/src/mesa/glapi/glapitemp.h
@@ -5553,6 +5553,71 @@ KEYWORD1 void KEYWORD2 NAME(EndConditionalRenderNV)(void)
DISPATCH(EndConditionalRenderNV, (), (F, "glEndConditionalRenderNV();\n"));
}
+KEYWORD1 void KEYWORD2 NAME(BeginTransformFeedbackEXT)(GLenum mode)
+{
+ DISPATCH(BeginTransformFeedbackEXT, (mode), (F, "glBeginTransformFeedbackEXT(0x%x);\n", mode));
+}
+
+KEYWORD1 void KEYWORD2 NAME(BeginTransformFeedback)(GLenum mode)
+{
+ DISPATCH(BeginTransformFeedbackEXT, (mode), (F, "glBeginTransformFeedback(0x%x);\n", mode));
+}
+
+KEYWORD1 void KEYWORD2 NAME(BindBufferBaseEXT)(GLenum target, GLuint index, GLuint buffer)
+{
+ DISPATCH(BindBufferBaseEXT, (target, index, buffer), (F, "glBindBufferBaseEXT(0x%x, %d, %d);\n", target, index, buffer));
+}
+
+KEYWORD1 void KEYWORD2 NAME(BindBufferBase)(GLenum target, GLuint index, GLuint buffer)
+{
+ DISPATCH(BindBufferBaseEXT, (target, index, buffer), (F, "glBindBufferBase(0x%x, %d, %d);\n", target, index, buffer));
+}
+
+KEYWORD1 void KEYWORD2 NAME(BindBufferOffsetEXT)(GLenum target, GLuint index, GLuint buffer, GLintptr offset)
+{
+ DISPATCH(BindBufferOffsetEXT, (target, index, buffer, offset), (F, "glBindBufferOffsetEXT(0x%x, %d, %d, %d);\n", target, index, buffer, offset));
+}
+
+KEYWORD1 void KEYWORD2 NAME(BindBufferRangeEXT)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
+{
+ DISPATCH(BindBufferRangeEXT, (target, index, buffer, offset, size), (F, "glBindBufferRangeEXT(0x%x, %d, %d, %d, %d);\n", target, index, buffer, offset, size));
+}
+
+KEYWORD1 void KEYWORD2 NAME(BindBufferRange)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
+{
+ DISPATCH(BindBufferRangeEXT, (target, index, buffer, offset, size), (F, "glBindBufferRange(0x%x, %d, %d, %d, %d);\n", target, index, buffer, offset, size));
+}
+
+KEYWORD1 void KEYWORD2 NAME(EndTransformFeedbackEXT)(void)
+{
+ DISPATCH(EndTransformFeedbackEXT, (), (F, "glEndTransformFeedbackEXT();\n"));
+}
+
+KEYWORD1 void KEYWORD2 NAME(EndTransformFeedback)(void)
+{
+ DISPATCH(EndTransformFeedbackEXT, (), (F, "glEndTransformFeedback();\n"));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetTransformFeedbackVaryingEXT)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLsizei * size, GLenum * type, GLchar * name)
+{
+ DISPATCH(GetTransformFeedbackVaryingEXT, (program, index, bufSize, length, size, type, name), (F, "glGetTransformFeedbackVaryingEXT(%d, %d, %d, %p, %p, %p, %p);\n", program, index, bufSize, (const void *) length, (const void *) size, (const void *) type, (const void *) name));
+}
+
+KEYWORD1 void KEYWORD2 NAME(GetTransformFeedbackVarying)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLsizei * size, GLenum * type, GLchar * name)
+{
+ DISPATCH(GetTransformFeedbackVaryingEXT, (program, index, bufSize, length, size, type, name), (F, "glGetTransformFeedbackVarying(%d, %d, %d, %p, %p, %p, %p);\n", program, index, bufSize, (const void *) length, (const void *) size, (const void *) type, (const void *) name));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TransformFeedbackVaryingsEXT)(GLuint program, GLsizei count, const char ** varyings, GLenum bufferMode)
+{
+ DISPATCH(TransformFeedbackVaryingsEXT, (program, count, varyings, bufferMode), (F, "glTransformFeedbackVaryingsEXT(%d, %d, %p, 0x%x);\n", program, count, (const void *) varyings, bufferMode));
+}
+
+KEYWORD1 void KEYWORD2 NAME(TransformFeedbackVaryings)(GLuint program, GLsizei count, const char ** varyings, GLenum bufferMode)
+{
+ DISPATCH(TransformFeedbackVaryingsEXT, (program, count, varyings, bufferMode), (F, "glTransformFeedbackVaryings(%d, %d, %p, 0x%x);\n", program, count, (const void *) varyings, bufferMode));
+}
+
KEYWORD1 void KEYWORD2 NAME(ProvokingVertexEXT)(GLenum mode)
{
DISPATCH(ProvokingVertexEXT, (mode), (F, "glProvokingVertexEXT(0x%x);\n", mode));
@@ -5563,16 +5628,16 @@ KEYWORD1 void KEYWORD2 NAME(ProvokingVertex)(GLenum mode)
DISPATCH(ProvokingVertexEXT, (mode), (F, "glProvokingVertex(0x%x);\n", mode));
}
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_796)(GLenum target, GLenum pname, GLvoid ** params);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_803)(GLenum target, GLenum pname, GLvoid ** params);
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_796)(GLenum target, GLenum pname, GLvoid ** params)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_803)(GLenum target, GLenum pname, GLvoid ** params)
{
DISPATCH(GetTexParameterPointervAPPLE, (target, pname, params), (F, "glGetTexParameterPointervAPPLE(0x%x, 0x%x, %p);\n", target, pname, (const void *) params));
}
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_797)(GLenum target, GLsizei length, GLvoid * pointer);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_804)(GLenum target, GLsizei length, GLvoid * pointer);
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_797)(GLenum target, GLsizei length, GLvoid * pointer)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_804)(GLenum target, GLsizei length, GLvoid * pointer)
{
DISPATCH(TextureRangeAPPLE, (target, length, pointer), (F, "glTextureRangeAPPLE(0x%x, %d, %p);\n", target, length, (const void *) pointer));
}
@@ -5592,37 +5657,37 @@ KEYWORD1 GLenum KEYWORD2 NAME(ObjectUnpurgeableAPPLE)(GLenum objectType, GLuint
RETURN_DISPATCH(ObjectUnpurgeableAPPLE, (objectType, name, option), (F, "glObjectUnpurgeableAPPLE(0x%x, %d, 0x%x);\n", objectType, name, option));
}
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_801)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_808)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_801)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_808)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask)
{
DISPATCH(StencilFuncSeparateATI, (frontfunc, backfunc, ref, mask), (F, "glStencilFuncSeparateATI(0x%x, 0x%x, %d, %d);\n", frontfunc, backfunc, ref, mask));
}
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_802)(GLenum target, GLuint index, GLsizei count, const GLfloat * params);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_809)(GLenum target, GLuint index, GLsizei count, const GLfloat * params);
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_802)(GLenum target, GLuint index, GLsizei count, const GLfloat * params)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_809)(GLenum target, GLuint index, GLsizei count, const GLfloat * params)
{
DISPATCH(ProgramEnvParameters4fvEXT, (target, index, count, params), (F, "glProgramEnvParameters4fvEXT(0x%x, %d, %d, %p);\n", target, index, count, (const void *) params));
}
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_803)(GLenum target, GLuint index, GLsizei count, const GLfloat * params);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_810)(GLenum target, GLuint index, GLsizei count, const GLfloat * params);
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_803)(GLenum target, GLuint index, GLsizei count, const GLfloat * params)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_810)(GLenum target, GLuint index, GLsizei count, const GLfloat * params)
{
DISPATCH(ProgramLocalParameters4fvEXT, (target, index, count, params), (F, "glProgramLocalParameters4fvEXT(0x%x, %d, %d, %p);\n", target, index, count, (const void *) params));
}
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_804)(GLuint id, GLenum pname, GLint64EXT * params);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_811)(GLuint id, GLenum pname, GLint64EXT * params);
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_804)(GLuint id, GLenum pname, GLint64EXT * params)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_811)(GLuint id, GLenum pname, GLint64EXT * params)
{
DISPATCH(GetQueryObjecti64vEXT, (id, pname, params), (F, "glGetQueryObjecti64vEXT(%d, 0x%x, %p);\n", id, pname, (const void *) params));
}
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_805)(GLuint id, GLenum pname, GLuint64EXT * params);
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_812)(GLuint id, GLenum pname, GLuint64EXT * params);
-KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_805)(GLuint id, GLenum pname, GLuint64EXT * params)
+KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_812)(GLuint id, GLenum pname, GLuint64EXT * params)
{
DISPATCH(GetQueryObjectui64vEXT, (id, pname, params), (F, "glGetQueryObjectui64vEXT(%d, 0x%x, %p);\n", id, pname, (const void *) params));
}
@@ -6585,17 +6650,24 @@ _glapi_proc DISPATCH_TABLE_NAME[] = {
TABLE_ENTRY(IsEnabledIndexedEXT),
TABLE_ENTRY(BeginConditionalRenderNV),
TABLE_ENTRY(EndConditionalRenderNV),
+ TABLE_ENTRY(BeginTransformFeedbackEXT),
+ TABLE_ENTRY(BindBufferBaseEXT),
+ TABLE_ENTRY(BindBufferOffsetEXT),
+ TABLE_ENTRY(BindBufferRangeEXT),
+ TABLE_ENTRY(EndTransformFeedbackEXT),
+ TABLE_ENTRY(GetTransformFeedbackVaryingEXT),
+ TABLE_ENTRY(TransformFeedbackVaryingsEXT),
TABLE_ENTRY(ProvokingVertexEXT),
- TABLE_ENTRY(_dispatch_stub_796),
- TABLE_ENTRY(_dispatch_stub_797),
+ TABLE_ENTRY(_dispatch_stub_803),
+ TABLE_ENTRY(_dispatch_stub_804),
TABLE_ENTRY(GetObjectParameterivAPPLE),
TABLE_ENTRY(ObjectPurgeableAPPLE),
TABLE_ENTRY(ObjectUnpurgeableAPPLE),
- TABLE_ENTRY(_dispatch_stub_801),
- TABLE_ENTRY(_dispatch_stub_802),
- TABLE_ENTRY(_dispatch_stub_803),
- TABLE_ENTRY(_dispatch_stub_804),
- TABLE_ENTRY(_dispatch_stub_805),
+ TABLE_ENTRY(_dispatch_stub_808),
+ TABLE_ENTRY(_dispatch_stub_809),
+ TABLE_ENTRY(_dispatch_stub_810),
+ TABLE_ENTRY(_dispatch_stub_811),
+ TABLE_ENTRY(_dispatch_stub_812),
TABLE_ENTRY(EGLImageTargetRenderbufferStorageOES),
TABLE_ENTRY(EGLImageTargetTexture2DOES),
/* A whole bunch of no-op functions. These might be called
@@ -6990,6 +7062,12 @@ _glapi_proc UNUSED_TABLE_NAME[] = {
TABLE_ENTRY(RenderbufferStorage),
TABLE_ENTRY(BlitFramebuffer),
TABLE_ENTRY(FramebufferTextureLayer),
+ TABLE_ENTRY(BeginTransformFeedback),
+ TABLE_ENTRY(BindBufferBase),
+ TABLE_ENTRY(BindBufferRange),
+ TABLE_ENTRY(EndTransformFeedback),
+ TABLE_ENTRY(GetTransformFeedbackVarying),
+ TABLE_ENTRY(TransformFeedbackVaryings),
TABLE_ENTRY(ProvokingVertex),
#endif /* _GLAPI_SKIP_NORMAL_ENTRY_POINTS */
#ifndef _GLAPI_SKIP_PROTO_ENTRY_POINTS
diff --git a/src/mesa/glapi/glprocs.h b/src/mesa/glapi/glprocs.h
index 44861863e6..bdeafb4df5 100644
--- a/src/mesa/glapi/glprocs.h
+++ b/src/mesa/glapi/glprocs.h
@@ -847,6 +847,13 @@ static const char gl_string_table[] =
"glIsEnabledIndexedEXT\0"
"glBeginConditionalRenderNV\0"
"glEndConditionalRenderNV\0"
+ "glBeginTransformFeedbackEXT\0"
+ "glBindBufferBaseEXT\0"
+ "glBindBufferOffsetEXT\0"
+ "glBindBufferRangeEXT\0"
+ "glEndTransformFeedbackEXT\0"
+ "glGetTransformFeedbackVaryingEXT\0"
+ "glTransformFeedbackVaryingsEXT\0"
"glProvokingVertexEXT\0"
"glGetTexParameterPointervAPPLE\0"
"glTextureRangeAPPLE\0"
@@ -1161,6 +1168,12 @@ static const char gl_string_table[] =
"glRenderbufferStorage\0"
"glBlitFramebuffer\0"
"glFramebufferTextureLayer\0"
+ "glBeginTransformFeedback\0"
+ "glBindBufferBase\0"
+ "glBindBufferRange\0"
+ "glEndTransformFeedback\0"
+ "glGetTransformFeedbackVarying\0"
+ "glTransformFeedbackVaryings\0"
"glProvokingVertex\0"
;
@@ -1209,13 +1222,13 @@ static const char gl_string_table[] =
#define gl_dispatch_stub_783 mgl_dispatch_stub_783
#define gl_dispatch_stub_784 mgl_dispatch_stub_784
#define gl_dispatch_stub_785 mgl_dispatch_stub_785
-#define gl_dispatch_stub_796 mgl_dispatch_stub_796
-#define gl_dispatch_stub_797 mgl_dispatch_stub_797
-#define gl_dispatch_stub_801 mgl_dispatch_stub_801
-#define gl_dispatch_stub_802 mgl_dispatch_stub_802
#define gl_dispatch_stub_803 mgl_dispatch_stub_803
#define gl_dispatch_stub_804 mgl_dispatch_stub_804
-#define gl_dispatch_stub_805 mgl_dispatch_stub_805
+#define gl_dispatch_stub_808 mgl_dispatch_stub_808
+#define gl_dispatch_stub_809 mgl_dispatch_stub_809
+#define gl_dispatch_stub_810 mgl_dispatch_stub_810
+#define gl_dispatch_stub_811 mgl_dispatch_stub_811
+#define gl_dispatch_stub_812 mgl_dispatch_stub_812
#endif /* USE_MGL_NAMESPACE */
@@ -1263,13 +1276,13 @@ void GLAPIENTRY gl_dispatch_stub_765(GLenum modeRGB, GLenum modeA);
void GLAPIENTRY gl_dispatch_stub_783(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
void GLAPIENTRY gl_dispatch_stub_784(GLenum target, GLenum pname, GLint param);
void GLAPIENTRY gl_dispatch_stub_785(GLenum target, GLintptr offset, GLsizeiptr size);
-void GLAPIENTRY gl_dispatch_stub_796(GLenum target, GLenum pname, GLvoid ** params);
-void GLAPIENTRY gl_dispatch_stub_797(GLenum target, GLsizei length, GLvoid * pointer);
-void GLAPIENTRY gl_dispatch_stub_801(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
-void GLAPIENTRY gl_dispatch_stub_802(GLenum target, GLuint index, GLsizei count, const GLfloat * params);
-void GLAPIENTRY gl_dispatch_stub_803(GLenum target, GLuint index, GLsizei count, const GLfloat * params);
-void GLAPIENTRY gl_dispatch_stub_804(GLuint id, GLenum pname, GLint64EXT * params);
-void GLAPIENTRY gl_dispatch_stub_805(GLuint id, GLenum pname, GLuint64EXT * params);
+void GLAPIENTRY gl_dispatch_stub_803(GLenum target, GLenum pname, GLvoid ** params);
+void GLAPIENTRY gl_dispatch_stub_804(GLenum target, GLsizei length, GLvoid * pointer);
+void GLAPIENTRY gl_dispatch_stub_808(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
+void GLAPIENTRY gl_dispatch_stub_809(GLenum target, GLuint index, GLsizei count, const GLfloat * params);
+void GLAPIENTRY gl_dispatch_stub_810(GLenum target, GLuint index, GLsizei count, const GLfloat * params);
+void GLAPIENTRY gl_dispatch_stub_811(GLuint id, GLenum pname, GLint64EXT * params);
+void GLAPIENTRY gl_dispatch_stub_812(GLuint id, GLenum pname, GLuint64EXT * params);
#endif /* defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING) */
static const glprocs_table_t static_functions[] = {
@@ -2068,321 +2081,334 @@ static const glprocs_table_t static_functions[] = {
NAME_FUNC_OFFSET(13976, glIsEnabledIndexedEXT, glIsEnabledIndexedEXT, NULL, _gloffset_IsEnabledIndexedEXT),
NAME_FUNC_OFFSET(13998, glBeginConditionalRenderNV, glBeginConditionalRenderNV, NULL, _gloffset_BeginConditionalRenderNV),
NAME_FUNC_OFFSET(14025, glEndConditionalRenderNV, glEndConditionalRenderNV, NULL, _gloffset_EndConditionalRenderNV),
- NAME_FUNC_OFFSET(14050, glProvokingVertexEXT, glProvokingVertexEXT, NULL, _gloffset_ProvokingVertexEXT),
- NAME_FUNC_OFFSET(14071, gl_dispatch_stub_796, gl_dispatch_stub_796, NULL, _gloffset_GetTexParameterPointervAPPLE),
- NAME_FUNC_OFFSET(14102, gl_dispatch_stub_797, gl_dispatch_stub_797, NULL, _gloffset_TextureRangeAPPLE),
- NAME_FUNC_OFFSET(14122, glGetObjectParameterivAPPLE, glGetObjectParameterivAPPLE, NULL, _gloffset_GetObjectParameterivAPPLE),
- NAME_FUNC_OFFSET(14150, glObjectPurgeableAPPLE, glObjectPurgeableAPPLE, NULL, _gloffset_ObjectPurgeableAPPLE),
- NAME_FUNC_OFFSET(14173, glObjectUnpurgeableAPPLE, glObjectUnpurgeableAPPLE, NULL, _gloffset_ObjectUnpurgeableAPPLE),
- NAME_FUNC_OFFSET(14198, gl_dispatch_stub_801, gl_dispatch_stub_801, NULL, _gloffset_StencilFuncSeparateATI),
- NAME_FUNC_OFFSET(14223, gl_dispatch_stub_802, gl_dispatch_stub_802, NULL, _gloffset_ProgramEnvParameters4fvEXT),
- NAME_FUNC_OFFSET(14252, gl_dispatch_stub_803, gl_dispatch_stub_803, NULL, _gloffset_ProgramLocalParameters4fvEXT),
- NAME_FUNC_OFFSET(14283, gl_dispatch_stub_804, gl_dispatch_stub_804, NULL, _gloffset_GetQueryObjecti64vEXT),
- NAME_FUNC_OFFSET(14307, gl_dispatch_stub_805, gl_dispatch_stub_805, NULL, _gloffset_GetQueryObjectui64vEXT),
- NAME_FUNC_OFFSET(14332, glEGLImageTargetRenderbufferStorageOES, glEGLImageTargetRenderbufferStorageOES, NULL, _gloffset_EGLImageTargetRenderbufferStorageOES),
- NAME_FUNC_OFFSET(14371, glEGLImageTargetTexture2DOES, glEGLImageTargetTexture2DOES, NULL, _gloffset_EGLImageTargetTexture2DOES),
- NAME_FUNC_OFFSET(14400, glArrayElement, glArrayElement, NULL, _gloffset_ArrayElement),
- NAME_FUNC_OFFSET(14418, glBindTexture, glBindTexture, NULL, _gloffset_BindTexture),
- NAME_FUNC_OFFSET(14435, glDrawArrays, glDrawArrays, NULL, _gloffset_DrawArrays),
- NAME_FUNC_OFFSET(14451, glAreTexturesResident, glAreTexturesResidentEXT, glAreTexturesResidentEXT, _gloffset_AreTexturesResident),
- NAME_FUNC_OFFSET(14476, glCopyTexImage1D, glCopyTexImage1D, NULL, _gloffset_CopyTexImage1D),
- NAME_FUNC_OFFSET(14496, glCopyTexImage2D, glCopyTexImage2D, NULL, _gloffset_CopyTexImage2D),
- NAME_FUNC_OFFSET(14516, glCopyTexSubImage1D, glCopyTexSubImage1D, NULL, _gloffset_CopyTexSubImage1D),
- NAME_FUNC_OFFSET(14539, glCopyTexSubImage2D, glCopyTexSubImage2D, NULL, _gloffset_CopyTexSubImage2D),
- NAME_FUNC_OFFSET(14562, glDeleteTextures, glDeleteTexturesEXT, glDeleteTexturesEXT, _gloffset_DeleteTextures),
- NAME_FUNC_OFFSET(14582, glGenTextures, glGenTexturesEXT, glGenTexturesEXT, _gloffset_GenTextures),
- NAME_FUNC_OFFSET(14599, glGetPointerv, glGetPointerv, NULL, _gloffset_GetPointerv),
- NAME_FUNC_OFFSET(14616, glIsTexture, glIsTextureEXT, glIsTextureEXT, _gloffset_IsTexture),
- NAME_FUNC_OFFSET(14631, glPrioritizeTextures, glPrioritizeTextures, NULL, _gloffset_PrioritizeTextures),
- NAME_FUNC_OFFSET(14655, glTexSubImage1D, glTexSubImage1D, NULL, _gloffset_TexSubImage1D),
- NAME_FUNC_OFFSET(14674, glTexSubImage2D, glTexSubImage2D, NULL, _gloffset_TexSubImage2D),
- NAME_FUNC_OFFSET(14693, glBlendColor, glBlendColor, NULL, _gloffset_BlendColor),
- NAME_FUNC_OFFSET(14709, glBlendEquation, glBlendEquation, NULL, _gloffset_BlendEquation),
- NAME_FUNC_OFFSET(14728, glDrawRangeElements, glDrawRangeElements, NULL, _gloffset_DrawRangeElements),
- NAME_FUNC_OFFSET(14751, glColorTable, glColorTable, NULL, _gloffset_ColorTable),
- NAME_FUNC_OFFSET(14767, glColorTable, glColorTable, NULL, _gloffset_ColorTable),
- NAME_FUNC_OFFSET(14783, glColorTableParameterfv, glColorTableParameterfv, NULL, _gloffset_ColorTableParameterfv),
- NAME_FUNC_OFFSET(14810, glColorTableParameteriv, glColorTableParameteriv, NULL, _gloffset_ColorTableParameteriv),
- NAME_FUNC_OFFSET(14837, glCopyColorTable, glCopyColorTable, NULL, _gloffset_CopyColorTable),
- NAME_FUNC_OFFSET(14857, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable),
- NAME_FUNC_OFFSET(14876, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable),
- NAME_FUNC_OFFSET(14895, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv),
- NAME_FUNC_OFFSET(14925, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv),
- NAME_FUNC_OFFSET(14955, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv),
- NAME_FUNC_OFFSET(14985, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv),
- NAME_FUNC_OFFSET(15015, glColorSubTable, glColorSubTable, NULL, _gloffset_ColorSubTable),
- NAME_FUNC_OFFSET(15034, glCopyColorSubTable, glCopyColorSubTable, NULL, _gloffset_CopyColorSubTable),
- NAME_FUNC_OFFSET(15057, glConvolutionFilter1D, glConvolutionFilter1D, NULL, _gloffset_ConvolutionFilter1D),
- NAME_FUNC_OFFSET(15082, glConvolutionFilter2D, glConvolutionFilter2D, NULL, _gloffset_ConvolutionFilter2D),
- NAME_FUNC_OFFSET(15107, glConvolutionParameterf, glConvolutionParameterf, NULL, _gloffset_ConvolutionParameterf),
- NAME_FUNC_OFFSET(15134, glConvolutionParameterfv, glConvolutionParameterfv, NULL, _gloffset_ConvolutionParameterfv),
- NAME_FUNC_OFFSET(15162, glConvolutionParameteri, glConvolutionParameteri, NULL, _gloffset_ConvolutionParameteri),
- NAME_FUNC_OFFSET(15189, glConvolutionParameteriv, glConvolutionParameteriv, NULL, _gloffset_ConvolutionParameteriv),
- NAME_FUNC_OFFSET(15217, glCopyConvolutionFilter1D, glCopyConvolutionFilter1D, NULL, _gloffset_CopyConvolutionFilter1D),
- NAME_FUNC_OFFSET(15246, glCopyConvolutionFilter2D, glCopyConvolutionFilter2D, NULL, _gloffset_CopyConvolutionFilter2D),
- NAME_FUNC_OFFSET(15275, glGetConvolutionFilter, gl_dispatch_stub_356, gl_dispatch_stub_356, _gloffset_GetConvolutionFilter),
- NAME_FUNC_OFFSET(15301, glGetConvolutionParameterfv, gl_dispatch_stub_357, gl_dispatch_stub_357, _gloffset_GetConvolutionParameterfv),
- NAME_FUNC_OFFSET(15332, glGetConvolutionParameteriv, gl_dispatch_stub_358, gl_dispatch_stub_358, _gloffset_GetConvolutionParameteriv),
- NAME_FUNC_OFFSET(15363, glGetSeparableFilter, gl_dispatch_stub_359, gl_dispatch_stub_359, _gloffset_GetSeparableFilter),
- NAME_FUNC_OFFSET(15387, glSeparableFilter2D, glSeparableFilter2D, NULL, _gloffset_SeparableFilter2D),
- NAME_FUNC_OFFSET(15410, glGetHistogram, gl_dispatch_stub_361, gl_dispatch_stub_361, _gloffset_GetHistogram),
- NAME_FUNC_OFFSET(15428, glGetHistogramParameterfv, gl_dispatch_stub_362, gl_dispatch_stub_362, _gloffset_GetHistogramParameterfv),
- NAME_FUNC_OFFSET(15457, glGetHistogramParameteriv, gl_dispatch_stub_363, gl_dispatch_stub_363, _gloffset_GetHistogramParameteriv),
- NAME_FUNC_OFFSET(15486, glGetMinmax, gl_dispatch_stub_364, gl_dispatch_stub_364, _gloffset_GetMinmax),
- NAME_FUNC_OFFSET(15501, glGetMinmaxParameterfv, gl_dispatch_stub_365, gl_dispatch_stub_365, _gloffset_GetMinmaxParameterfv),
- NAME_FUNC_OFFSET(15527, glGetMinmaxParameteriv, gl_dispatch_stub_366, gl_dispatch_stub_366, _gloffset_GetMinmaxParameteriv),
- NAME_FUNC_OFFSET(15553, glHistogram, glHistogram, NULL, _gloffset_Histogram),
- NAME_FUNC_OFFSET(15568, glMinmax, glMinmax, NULL, _gloffset_Minmax),
- NAME_FUNC_OFFSET(15580, glResetHistogram, glResetHistogram, NULL, _gloffset_ResetHistogram),
- NAME_FUNC_OFFSET(15600, glResetMinmax, glResetMinmax, NULL, _gloffset_ResetMinmax),
- NAME_FUNC_OFFSET(15617, glTexImage3D, glTexImage3D, NULL, _gloffset_TexImage3D),
- NAME_FUNC_OFFSET(15633, glTexSubImage3D, glTexSubImage3D, NULL, _gloffset_TexSubImage3D),
- NAME_FUNC_OFFSET(15652, glCopyTexSubImage3D, glCopyTexSubImage3D, NULL, _gloffset_CopyTexSubImage3D),
- NAME_FUNC_OFFSET(15675, glActiveTextureARB, glActiveTextureARB, NULL, _gloffset_ActiveTextureARB),
- NAME_FUNC_OFFSET(15691, glClientActiveTextureARB, glClientActiveTextureARB, NULL, _gloffset_ClientActiveTextureARB),
- NAME_FUNC_OFFSET(15713, glMultiTexCoord1dARB, glMultiTexCoord1dARB, NULL, _gloffset_MultiTexCoord1dARB),
- NAME_FUNC_OFFSET(15731, glMultiTexCoord1dvARB, glMultiTexCoord1dvARB, NULL, _gloffset_MultiTexCoord1dvARB),
- NAME_FUNC_OFFSET(15750, glMultiTexCoord1fARB, glMultiTexCoord1fARB, NULL, _gloffset_MultiTexCoord1fARB),
- NAME_FUNC_OFFSET(15768, glMultiTexCoord1fvARB, glMultiTexCoord1fvARB, NULL, _gloffset_MultiTexCoord1fvARB),
- NAME_FUNC_OFFSET(15787, glMultiTexCoord1iARB, glMultiTexCoord1iARB, NULL, _gloffset_MultiTexCoord1iARB),
- NAME_FUNC_OFFSET(15805, glMultiTexCoord1ivARB, glMultiTexCoord1ivARB, NULL, _gloffset_MultiTexCoord1ivARB),
- NAME_FUNC_OFFSET(15824, glMultiTexCoord1sARB, glMultiTexCoord1sARB, NULL, _gloffset_MultiTexCoord1sARB),
- NAME_FUNC_OFFSET(15842, glMultiTexCoord1svARB, glMultiTexCoord1svARB, NULL, _gloffset_MultiTexCoord1svARB),
- NAME_FUNC_OFFSET(15861, glMultiTexCoord2dARB, glMultiTexCoord2dARB, NULL, _gloffset_MultiTexCoord2dARB),
- NAME_FUNC_OFFSET(15879, glMultiTexCoord2dvARB, glMultiTexCoord2dvARB, NULL, _gloffset_MultiTexCoord2dvARB),
- NAME_FUNC_OFFSET(15898, glMultiTexCoord2fARB, glMultiTexCoord2fARB, NULL, _gloffset_MultiTexCoord2fARB),
- NAME_FUNC_OFFSET(15916, glMultiTexCoord2fvARB, glMultiTexCoord2fvARB, NULL, _gloffset_MultiTexCoord2fvARB),
- NAME_FUNC_OFFSET(15935, glMultiTexCoord2iARB, glMultiTexCoord2iARB, NULL, _gloffset_MultiTexCoord2iARB),
- NAME_FUNC_OFFSET(15953, glMultiTexCoord2ivARB, glMultiTexCoord2ivARB, NULL, _gloffset_MultiTexCoord2ivARB),
- NAME_FUNC_OFFSET(15972, glMultiTexCoord2sARB, glMultiTexCoord2sARB, NULL, _gloffset_MultiTexCoord2sARB),
- NAME_FUNC_OFFSET(15990, glMultiTexCoord2svARB, glMultiTexCoord2svARB, NULL, _gloffset_MultiTexCoord2svARB),
- NAME_FUNC_OFFSET(16009, glMultiTexCoord3dARB, glMultiTexCoord3dARB, NULL, _gloffset_MultiTexCoord3dARB),
- NAME_FUNC_OFFSET(16027, glMultiTexCoord3dvARB, glMultiTexCoord3dvARB, NULL, _gloffset_MultiTexCoord3dvARB),
- NAME_FUNC_OFFSET(16046, glMultiTexCoord3fARB, glMultiTexCoord3fARB, NULL, _gloffset_MultiTexCoord3fARB),
- NAME_FUNC_OFFSET(16064, glMultiTexCoord3fvARB, glMultiTexCoord3fvARB, NULL, _gloffset_MultiTexCoord3fvARB),
- NAME_FUNC_OFFSET(16083, glMultiTexCoord3iARB, glMultiTexCoord3iARB, NULL, _gloffset_MultiTexCoord3iARB),
- NAME_FUNC_OFFSET(16101, glMultiTexCoord3ivARB, glMultiTexCoord3ivARB, NULL, _gloffset_MultiTexCoord3ivARB),
- NAME_FUNC_OFFSET(16120, glMultiTexCoord3sARB, glMultiTexCoord3sARB, NULL, _gloffset_MultiTexCoord3sARB),
- NAME_FUNC_OFFSET(16138, glMultiTexCoord3svARB, glMultiTexCoord3svARB, NULL, _gloffset_MultiTexCoord3svARB),
- NAME_FUNC_OFFSET(16157, glMultiTexCoord4dARB, glMultiTexCoord4dARB, NULL, _gloffset_MultiTexCoord4dARB),
- NAME_FUNC_OFFSET(16175, glMultiTexCoord4dvARB, glMultiTexCoord4dvARB, NULL, _gloffset_MultiTexCoord4dvARB),
- NAME_FUNC_OFFSET(16194, glMultiTexCoord4fARB, glMultiTexCoord4fARB, NULL, _gloffset_MultiTexCoord4fARB),
- NAME_FUNC_OFFSET(16212, glMultiTexCoord4fvARB, glMultiTexCoord4fvARB, NULL, _gloffset_MultiTexCoord4fvARB),
- NAME_FUNC_OFFSET(16231, glMultiTexCoord4iARB, glMultiTexCoord4iARB, NULL, _gloffset_MultiTexCoord4iARB),
- NAME_FUNC_OFFSET(16249, glMultiTexCoord4ivARB, glMultiTexCoord4ivARB, NULL, _gloffset_MultiTexCoord4ivARB),
- NAME_FUNC_OFFSET(16268, glMultiTexCoord4sARB, glMultiTexCoord4sARB, NULL, _gloffset_MultiTexCoord4sARB),
- NAME_FUNC_OFFSET(16286, glMultiTexCoord4svARB, glMultiTexCoord4svARB, NULL, _gloffset_MultiTexCoord4svARB),
- NAME_FUNC_OFFSET(16305, glStencilOpSeparate, glStencilOpSeparate, NULL, _gloffset_StencilOpSeparate),
- NAME_FUNC_OFFSET(16328, glLoadTransposeMatrixdARB, glLoadTransposeMatrixdARB, NULL, _gloffset_LoadTransposeMatrixdARB),
- NAME_FUNC_OFFSET(16351, glLoadTransposeMatrixfARB, glLoadTransposeMatrixfARB, NULL, _gloffset_LoadTransposeMatrixfARB),
- NAME_FUNC_OFFSET(16374, glMultTransposeMatrixdARB, glMultTransposeMatrixdARB, NULL, _gloffset_MultTransposeMatrixdARB),
- NAME_FUNC_OFFSET(16397, glMultTransposeMatrixfARB, glMultTransposeMatrixfARB, NULL, _gloffset_MultTransposeMatrixfARB),
- NAME_FUNC_OFFSET(16420, glSampleCoverageARB, glSampleCoverageARB, NULL, _gloffset_SampleCoverageARB),
- NAME_FUNC_OFFSET(16437, glCompressedTexImage1DARB, glCompressedTexImage1DARB, NULL, _gloffset_CompressedTexImage1DARB),
- NAME_FUNC_OFFSET(16460, glCompressedTexImage2DARB, glCompressedTexImage2DARB, NULL, _gloffset_CompressedTexImage2DARB),
- NAME_FUNC_OFFSET(16483, glCompressedTexImage3DARB, glCompressedTexImage3DARB, NULL, _gloffset_CompressedTexImage3DARB),
- NAME_FUNC_OFFSET(16506, glCompressedTexSubImage1DARB, glCompressedTexSubImage1DARB, NULL, _gloffset_CompressedTexSubImage1DARB),
- NAME_FUNC_OFFSET(16532, glCompressedTexSubImage2DARB, glCompressedTexSubImage2DARB, NULL, _gloffset_CompressedTexSubImage2DARB),
- NAME_FUNC_OFFSET(16558, glCompressedTexSubImage3DARB, glCompressedTexSubImage3DARB, NULL, _gloffset_CompressedTexSubImage3DARB),
- NAME_FUNC_OFFSET(16584, glGetCompressedTexImageARB, glGetCompressedTexImageARB, NULL, _gloffset_GetCompressedTexImageARB),
- NAME_FUNC_OFFSET(16608, glDisableVertexAttribArrayARB, glDisableVertexAttribArrayARB, NULL, _gloffset_DisableVertexAttribArrayARB),
- NAME_FUNC_OFFSET(16635, glEnableVertexAttribArrayARB, glEnableVertexAttribArrayARB, NULL, _gloffset_EnableVertexAttribArrayARB),
- NAME_FUNC_OFFSET(16661, glGetVertexAttribdvARB, glGetVertexAttribdvARB, NULL, _gloffset_GetVertexAttribdvARB),
- NAME_FUNC_OFFSET(16681, glGetVertexAttribfvARB, glGetVertexAttribfvARB, NULL, _gloffset_GetVertexAttribfvARB),
- NAME_FUNC_OFFSET(16701, glGetVertexAttribivARB, glGetVertexAttribivARB, NULL, _gloffset_GetVertexAttribivARB),
- NAME_FUNC_OFFSET(16721, glProgramEnvParameter4dARB, glProgramEnvParameter4dARB, NULL, _gloffset_ProgramEnvParameter4dARB),
- NAME_FUNC_OFFSET(16744, glProgramEnvParameter4dvARB, glProgramEnvParameter4dvARB, NULL, _gloffset_ProgramEnvParameter4dvARB),
- NAME_FUNC_OFFSET(16768, glProgramEnvParameter4fARB, glProgramEnvParameter4fARB, NULL, _gloffset_ProgramEnvParameter4fARB),
- NAME_FUNC_OFFSET(16791, glProgramEnvParameter4fvARB, glProgramEnvParameter4fvARB, NULL, _gloffset_ProgramEnvParameter4fvARB),
- NAME_FUNC_OFFSET(16815, glVertexAttrib1dARB, glVertexAttrib1dARB, NULL, _gloffset_VertexAttrib1dARB),
- NAME_FUNC_OFFSET(16832, glVertexAttrib1dvARB, glVertexAttrib1dvARB, NULL, _gloffset_VertexAttrib1dvARB),
- NAME_FUNC_OFFSET(16850, glVertexAttrib1fARB, glVertexAttrib1fARB, NULL, _gloffset_VertexAttrib1fARB),
- NAME_FUNC_OFFSET(16867, glVertexAttrib1fvARB, glVertexAttrib1fvARB, NULL, _gloffset_VertexAttrib1fvARB),
- NAME_FUNC_OFFSET(16885, glVertexAttrib1sARB, glVertexAttrib1sARB, NULL, _gloffset_VertexAttrib1sARB),
- NAME_FUNC_OFFSET(16902, glVertexAttrib1svARB, glVertexAttrib1svARB, NULL, _gloffset_VertexAttrib1svARB),
- NAME_FUNC_OFFSET(16920, glVertexAttrib2dARB, glVertexAttrib2dARB, NULL, _gloffset_VertexAttrib2dARB),
- NAME_FUNC_OFFSET(16937, glVertexAttrib2dvARB, glVertexAttrib2dvARB, NULL, _gloffset_VertexAttrib2dvARB),
- NAME_FUNC_OFFSET(16955, glVertexAttrib2fARB, glVertexAttrib2fARB, NULL, _gloffset_VertexAttrib2fARB),
- NAME_FUNC_OFFSET(16972, glVertexAttrib2fvARB, glVertexAttrib2fvARB, NULL, _gloffset_VertexAttrib2fvARB),
- NAME_FUNC_OFFSET(16990, glVertexAttrib2sARB, glVertexAttrib2sARB, NULL, _gloffset_VertexAttrib2sARB),
- NAME_FUNC_OFFSET(17007, glVertexAttrib2svARB, glVertexAttrib2svARB, NULL, _gloffset_VertexAttrib2svARB),
- NAME_FUNC_OFFSET(17025, glVertexAttrib3dARB, glVertexAttrib3dARB, NULL, _gloffset_VertexAttrib3dARB),
- NAME_FUNC_OFFSET(17042, glVertexAttrib3dvARB, glVertexAttrib3dvARB, NULL, _gloffset_VertexAttrib3dvARB),
- NAME_FUNC_OFFSET(17060, glVertexAttrib3fARB, glVertexAttrib3fARB, NULL, _gloffset_VertexAttrib3fARB),
- NAME_FUNC_OFFSET(17077, glVertexAttrib3fvARB, glVertexAttrib3fvARB, NULL, _gloffset_VertexAttrib3fvARB),
- NAME_FUNC_OFFSET(17095, glVertexAttrib3sARB, glVertexAttrib3sARB, NULL, _gloffset_VertexAttrib3sARB),
- NAME_FUNC_OFFSET(17112, glVertexAttrib3svARB, glVertexAttrib3svARB, NULL, _gloffset_VertexAttrib3svARB),
- NAME_FUNC_OFFSET(17130, glVertexAttrib4NbvARB, glVertexAttrib4NbvARB, NULL, _gloffset_VertexAttrib4NbvARB),
- NAME_FUNC_OFFSET(17149, glVertexAttrib4NivARB, glVertexAttrib4NivARB, NULL, _gloffset_VertexAttrib4NivARB),
- NAME_FUNC_OFFSET(17168, glVertexAttrib4NsvARB, glVertexAttrib4NsvARB, NULL, _gloffset_VertexAttrib4NsvARB),
- NAME_FUNC_OFFSET(17187, glVertexAttrib4NubARB, glVertexAttrib4NubARB, NULL, _gloffset_VertexAttrib4NubARB),
- NAME_FUNC_OFFSET(17206, glVertexAttrib4NubvARB, glVertexAttrib4NubvARB, NULL, _gloffset_VertexAttrib4NubvARB),
- NAME_FUNC_OFFSET(17226, glVertexAttrib4NuivARB, glVertexAttrib4NuivARB, NULL, _gloffset_VertexAttrib4NuivARB),
- NAME_FUNC_OFFSET(17246, glVertexAttrib4NusvARB, glVertexAttrib4NusvARB, NULL, _gloffset_VertexAttrib4NusvARB),
- NAME_FUNC_OFFSET(17266, glVertexAttrib4bvARB, glVertexAttrib4bvARB, NULL, _gloffset_VertexAttrib4bvARB),
- NAME_FUNC_OFFSET(17284, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL, _gloffset_VertexAttrib4dARB),
- NAME_FUNC_OFFSET(17301, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL, _gloffset_VertexAttrib4dvARB),
- NAME_FUNC_OFFSET(17319, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL, _gloffset_VertexAttrib4fARB),
- NAME_FUNC_OFFSET(17336, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL, _gloffset_VertexAttrib4fvARB),
- NAME_FUNC_OFFSET(17354, glVertexAttrib4ivARB, glVertexAttrib4ivARB, NULL, _gloffset_VertexAttrib4ivARB),
- NAME_FUNC_OFFSET(17372, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL, _gloffset_VertexAttrib4sARB),
- NAME_FUNC_OFFSET(17389, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL, _gloffset_VertexAttrib4svARB),
- NAME_FUNC_OFFSET(17407, glVertexAttrib4ubvARB, glVertexAttrib4ubvARB, NULL, _gloffset_VertexAttrib4ubvARB),
- NAME_FUNC_OFFSET(17426, glVertexAttrib4uivARB, glVertexAttrib4uivARB, NULL, _gloffset_VertexAttrib4uivARB),
- NAME_FUNC_OFFSET(17445, glVertexAttrib4usvARB, glVertexAttrib4usvARB, NULL, _gloffset_VertexAttrib4usvARB),
- NAME_FUNC_OFFSET(17464, glVertexAttribPointerARB, glVertexAttribPointerARB, NULL, _gloffset_VertexAttribPointerARB),
- NAME_FUNC_OFFSET(17486, glBindBufferARB, glBindBufferARB, NULL, _gloffset_BindBufferARB),
- NAME_FUNC_OFFSET(17499, glBufferDataARB, glBufferDataARB, NULL, _gloffset_BufferDataARB),
- NAME_FUNC_OFFSET(17512, glBufferSubDataARB, glBufferSubDataARB, NULL, _gloffset_BufferSubDataARB),
- NAME_FUNC_OFFSET(17528, glDeleteBuffersARB, glDeleteBuffersARB, NULL, _gloffset_DeleteBuffersARB),
- NAME_FUNC_OFFSET(17544, glGenBuffersARB, glGenBuffersARB, NULL, _gloffset_GenBuffersARB),
- NAME_FUNC_OFFSET(17557, glGetBufferParameterivARB, glGetBufferParameterivARB, NULL, _gloffset_GetBufferParameterivARB),
- NAME_FUNC_OFFSET(17580, glGetBufferPointervARB, glGetBufferPointervARB, NULL, _gloffset_GetBufferPointervARB),
- NAME_FUNC_OFFSET(17600, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL, _gloffset_GetBufferSubDataARB),
- NAME_FUNC_OFFSET(17619, glIsBufferARB, glIsBufferARB, NULL, _gloffset_IsBufferARB),
- NAME_FUNC_OFFSET(17630, glMapBufferARB, glMapBufferARB, NULL, _gloffset_MapBufferARB),
- NAME_FUNC_OFFSET(17642, glUnmapBufferARB, glUnmapBufferARB, NULL, _gloffset_UnmapBufferARB),
- NAME_FUNC_OFFSET(17656, glBeginQueryARB, glBeginQueryARB, NULL, _gloffset_BeginQueryARB),
- NAME_FUNC_OFFSET(17669, glDeleteQueriesARB, glDeleteQueriesARB, NULL, _gloffset_DeleteQueriesARB),
- NAME_FUNC_OFFSET(17685, glEndQueryARB, glEndQueryARB, NULL, _gloffset_EndQueryARB),
- NAME_FUNC_OFFSET(17696, glGenQueriesARB, glGenQueriesARB, NULL, _gloffset_GenQueriesARB),
- NAME_FUNC_OFFSET(17709, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL, _gloffset_GetQueryObjectivARB),
- NAME_FUNC_OFFSET(17728, glGetQueryObjectuivARB, glGetQueryObjectuivARB, NULL, _gloffset_GetQueryObjectuivARB),
- NAME_FUNC_OFFSET(17748, glGetQueryivARB, glGetQueryivARB, NULL, _gloffset_GetQueryivARB),
- NAME_FUNC_OFFSET(17761, glIsQueryARB, glIsQueryARB, NULL, _gloffset_IsQueryARB),
- NAME_FUNC_OFFSET(17771, glCompileShaderARB, glCompileShaderARB, NULL, _gloffset_CompileShaderARB),
- NAME_FUNC_OFFSET(17787, glGetActiveUniformARB, glGetActiveUniformARB, NULL, _gloffset_GetActiveUniformARB),
- NAME_FUNC_OFFSET(17806, glGetShaderSourceARB, glGetShaderSourceARB, NULL, _gloffset_GetShaderSourceARB),
- NAME_FUNC_OFFSET(17824, glGetUniformLocationARB, glGetUniformLocationARB, NULL, _gloffset_GetUniformLocationARB),
- NAME_FUNC_OFFSET(17845, glGetUniformfvARB, glGetUniformfvARB, NULL, _gloffset_GetUniformfvARB),
- NAME_FUNC_OFFSET(17860, glGetUniformivARB, glGetUniformivARB, NULL, _gloffset_GetUniformivARB),
- NAME_FUNC_OFFSET(17875, glLinkProgramARB, glLinkProgramARB, NULL, _gloffset_LinkProgramARB),
- NAME_FUNC_OFFSET(17889, glShaderSourceARB, glShaderSourceARB, NULL, _gloffset_ShaderSourceARB),
- NAME_FUNC_OFFSET(17904, glUniform1fARB, glUniform1fARB, NULL, _gloffset_Uniform1fARB),
- NAME_FUNC_OFFSET(17916, glUniform1fvARB, glUniform1fvARB, NULL, _gloffset_Uniform1fvARB),
- NAME_FUNC_OFFSET(17929, glUniform1iARB, glUniform1iARB, NULL, _gloffset_Uniform1iARB),
- NAME_FUNC_OFFSET(17941, glUniform1ivARB, glUniform1ivARB, NULL, _gloffset_Uniform1ivARB),
- NAME_FUNC_OFFSET(17954, glUniform2fARB, glUniform2fARB, NULL, _gloffset_Uniform2fARB),
- NAME_FUNC_OFFSET(17966, glUniform2fvARB, glUniform2fvARB, NULL, _gloffset_Uniform2fvARB),
- NAME_FUNC_OFFSET(17979, glUniform2iARB, glUniform2iARB, NULL, _gloffset_Uniform2iARB),
- NAME_FUNC_OFFSET(17991, glUniform2ivARB, glUniform2ivARB, NULL, _gloffset_Uniform2ivARB),
- NAME_FUNC_OFFSET(18004, glUniform3fARB, glUniform3fARB, NULL, _gloffset_Uniform3fARB),
- NAME_FUNC_OFFSET(18016, glUniform3fvARB, glUniform3fvARB, NULL, _gloffset_Uniform3fvARB),
- NAME_FUNC_OFFSET(18029, glUniform3iARB, glUniform3iARB, NULL, _gloffset_Uniform3iARB),
- NAME_FUNC_OFFSET(18041, glUniform3ivARB, glUniform3ivARB, NULL, _gloffset_Uniform3ivARB),
- NAME_FUNC_OFFSET(18054, glUniform4fARB, glUniform4fARB, NULL, _gloffset_Uniform4fARB),
- NAME_FUNC_OFFSET(18066, glUniform4fvARB, glUniform4fvARB, NULL, _gloffset_Uniform4fvARB),
- NAME_FUNC_OFFSET(18079, glUniform4iARB, glUniform4iARB, NULL, _gloffset_Uniform4iARB),
- NAME_FUNC_OFFSET(18091, glUniform4ivARB, glUniform4ivARB, NULL, _gloffset_Uniform4ivARB),
- NAME_FUNC_OFFSET(18104, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL, _gloffset_UniformMatrix2fvARB),
- NAME_FUNC_OFFSET(18123, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL, _gloffset_UniformMatrix3fvARB),
- NAME_FUNC_OFFSET(18142, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL, _gloffset_UniformMatrix4fvARB),
- NAME_FUNC_OFFSET(18161, glUseProgramObjectARB, glUseProgramObjectARB, NULL, _gloffset_UseProgramObjectARB),
- NAME_FUNC_OFFSET(18174, glValidateProgramARB, glValidateProgramARB, NULL, _gloffset_ValidateProgramARB),
- NAME_FUNC_OFFSET(18192, glBindAttribLocationARB, glBindAttribLocationARB, NULL, _gloffset_BindAttribLocationARB),
- NAME_FUNC_OFFSET(18213, glGetActiveAttribARB, glGetActiveAttribARB, NULL, _gloffset_GetActiveAttribARB),
- NAME_FUNC_OFFSET(18231, glGetAttribLocationARB, glGetAttribLocationARB, NULL, _gloffset_GetAttribLocationARB),
- NAME_FUNC_OFFSET(18251, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB),
- NAME_FUNC_OFFSET(18265, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB),
- NAME_FUNC_OFFSET(18282, glRenderbufferStorageMultisample, glRenderbufferStorageMultisample, NULL, _gloffset_RenderbufferStorageMultisample),
- NAME_FUNC_OFFSET(18318, gl_dispatch_stub_584, gl_dispatch_stub_584, NULL, _gloffset_SampleMaskSGIS),
- NAME_FUNC_OFFSET(18334, gl_dispatch_stub_585, gl_dispatch_stub_585, NULL, _gloffset_SamplePatternSGIS),
- NAME_FUNC_OFFSET(18353, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT),
- NAME_FUNC_OFFSET(18371, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT),
- NAME_FUNC_OFFSET(18392, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT),
- NAME_FUNC_OFFSET(18414, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT),
- NAME_FUNC_OFFSET(18433, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT),
- NAME_FUNC_OFFSET(18455, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT),
- NAME_FUNC_OFFSET(18478, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, _gloffset_SecondaryColor3bEXT),
- NAME_FUNC_OFFSET(18497, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, _gloffset_SecondaryColor3bvEXT),
- NAME_FUNC_OFFSET(18517, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, _gloffset_SecondaryColor3dEXT),
- NAME_FUNC_OFFSET(18536, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, _gloffset_SecondaryColor3dvEXT),
- NAME_FUNC_OFFSET(18556, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, _gloffset_SecondaryColor3fEXT),
- NAME_FUNC_OFFSET(18575, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, _gloffset_SecondaryColor3fvEXT),
- NAME_FUNC_OFFSET(18595, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, _gloffset_SecondaryColor3iEXT),
- NAME_FUNC_OFFSET(18614, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, _gloffset_SecondaryColor3ivEXT),
- NAME_FUNC_OFFSET(18634, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, _gloffset_SecondaryColor3sEXT),
- NAME_FUNC_OFFSET(18653, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, _gloffset_SecondaryColor3svEXT),
- NAME_FUNC_OFFSET(18673, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, _gloffset_SecondaryColor3ubEXT),
- NAME_FUNC_OFFSET(18693, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, _gloffset_SecondaryColor3ubvEXT),
- NAME_FUNC_OFFSET(18714, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, _gloffset_SecondaryColor3uiEXT),
- NAME_FUNC_OFFSET(18734, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, _gloffset_SecondaryColor3uivEXT),
- NAME_FUNC_OFFSET(18755, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, _gloffset_SecondaryColor3usEXT),
- NAME_FUNC_OFFSET(18775, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, _gloffset_SecondaryColor3usvEXT),
- NAME_FUNC_OFFSET(18796, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, _gloffset_SecondaryColorPointerEXT),
- NAME_FUNC_OFFSET(18820, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, _gloffset_MultiDrawArraysEXT),
- NAME_FUNC_OFFSET(18838, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, _gloffset_MultiDrawElementsEXT),
- NAME_FUNC_OFFSET(18858, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, _gloffset_FogCoordPointerEXT),
- NAME_FUNC_OFFSET(18876, glFogCoorddEXT, glFogCoorddEXT, NULL, _gloffset_FogCoorddEXT),
- NAME_FUNC_OFFSET(18888, glFogCoorddvEXT, glFogCoorddvEXT, NULL, _gloffset_FogCoorddvEXT),
- NAME_FUNC_OFFSET(18901, glFogCoordfEXT, glFogCoordfEXT, NULL, _gloffset_FogCoordfEXT),
- NAME_FUNC_OFFSET(18913, glFogCoordfvEXT, glFogCoordfvEXT, NULL, _gloffset_FogCoordfvEXT),
- NAME_FUNC_OFFSET(18926, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT),
- NAME_FUNC_OFFSET(18946, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT),
- NAME_FUNC_OFFSET(18970, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA),
- NAME_FUNC_OFFSET(18984, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA),
- NAME_FUNC_OFFSET(19001, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA),
- NAME_FUNC_OFFSET(19016, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA),
- NAME_FUNC_OFFSET(19034, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA),
- NAME_FUNC_OFFSET(19048, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA),
- NAME_FUNC_OFFSET(19065, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA),
- NAME_FUNC_OFFSET(19080, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA),
- NAME_FUNC_OFFSET(19098, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA),
- NAME_FUNC_OFFSET(19112, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA),
- NAME_FUNC_OFFSET(19129, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA),
- NAME_FUNC_OFFSET(19144, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA),
- NAME_FUNC_OFFSET(19162, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA),
- NAME_FUNC_OFFSET(19176, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA),
- NAME_FUNC_OFFSET(19193, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA),
- NAME_FUNC_OFFSET(19208, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA),
- NAME_FUNC_OFFSET(19226, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA),
- NAME_FUNC_OFFSET(19240, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA),
- NAME_FUNC_OFFSET(19257, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA),
- NAME_FUNC_OFFSET(19272, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA),
- NAME_FUNC_OFFSET(19290, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA),
- NAME_FUNC_OFFSET(19304, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA),
- NAME_FUNC_OFFSET(19321, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA),
- NAME_FUNC_OFFSET(19336, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA),
- NAME_FUNC_OFFSET(19354, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA),
- NAME_FUNC_OFFSET(19368, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA),
- NAME_FUNC_OFFSET(19385, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA),
- NAME_FUNC_OFFSET(19400, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA),
- NAME_FUNC_OFFSET(19418, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA),
- NAME_FUNC_OFFSET(19432, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA),
- NAME_FUNC_OFFSET(19449, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA),
- NAME_FUNC_OFFSET(19464, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA),
- NAME_FUNC_OFFSET(19482, glBindProgramNV, glBindProgramNV, NULL, _gloffset_BindProgramNV),
- NAME_FUNC_OFFSET(19499, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV),
- NAME_FUNC_OFFSET(19519, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV),
- NAME_FUNC_OFFSET(19536, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV),
- NAME_FUNC_OFFSET(19562, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV),
- NAME_FUNC_OFFSET(19591, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV),
- NAME_FUNC_OFFSET(19606, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV),
- NAME_FUNC_OFFSET(19624, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV),
- NAME_FUNC_OFFSET(19643, gl_dispatch_stub_755, gl_dispatch_stub_755, NULL, _gloffset_DeleteVertexArraysAPPLE),
- NAME_FUNC_OFFSET(19664, gl_dispatch_stub_757, gl_dispatch_stub_757, NULL, _gloffset_IsVertexArrayAPPLE),
- NAME_FUNC_OFFSET(19680, gl_dispatch_stub_765, gl_dispatch_stub_765, NULL, _gloffset_BlendEquationSeparateEXT),
- NAME_FUNC_OFFSET(19704, gl_dispatch_stub_765, gl_dispatch_stub_765, NULL, _gloffset_BlendEquationSeparateEXT),
- NAME_FUNC_OFFSET(19731, glBindFramebufferEXT, glBindFramebufferEXT, NULL, _gloffset_BindFramebufferEXT),
- NAME_FUNC_OFFSET(19749, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, _gloffset_BindRenderbufferEXT),
- NAME_FUNC_OFFSET(19768, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, _gloffset_CheckFramebufferStatusEXT),
- NAME_FUNC_OFFSET(19793, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, _gloffset_DeleteFramebuffersEXT),
- NAME_FUNC_OFFSET(19814, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, _gloffset_DeleteRenderbuffersEXT),
- NAME_FUNC_OFFSET(19836, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, _gloffset_FramebufferRenderbufferEXT),
- NAME_FUNC_OFFSET(19862, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, _gloffset_FramebufferTexture1DEXT),
- NAME_FUNC_OFFSET(19885, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, _gloffset_FramebufferTexture2DEXT),
- NAME_FUNC_OFFSET(19908, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, _gloffset_FramebufferTexture3DEXT),
- NAME_FUNC_OFFSET(19931, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, _gloffset_GenFramebuffersEXT),
- NAME_FUNC_OFFSET(19949, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, _gloffset_GenRenderbuffersEXT),
- NAME_FUNC_OFFSET(19968, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, _gloffset_GenerateMipmapEXT),
- NAME_FUNC_OFFSET(19985, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, _gloffset_GetFramebufferAttachmentParameterivEXT),
- NAME_FUNC_OFFSET(20023, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, _gloffset_GetRenderbufferParameterivEXT),
- NAME_FUNC_OFFSET(20052, glIsFramebufferEXT, glIsFramebufferEXT, NULL, _gloffset_IsFramebufferEXT),
- NAME_FUNC_OFFSET(20068, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, _gloffset_IsRenderbufferEXT),
- NAME_FUNC_OFFSET(20085, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, _gloffset_RenderbufferStorageEXT),
- NAME_FUNC_OFFSET(20107, gl_dispatch_stub_783, gl_dispatch_stub_783, NULL, _gloffset_BlitFramebufferEXT),
- NAME_FUNC_OFFSET(20125, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, _gloffset_FramebufferTextureLayerEXT),
- NAME_FUNC_OFFSET(20151, glProvokingVertexEXT, glProvokingVertexEXT, NULL, _gloffset_ProvokingVertexEXT),
+ NAME_FUNC_OFFSET(14050, glBeginTransformFeedbackEXT, glBeginTransformFeedbackEXT, NULL, _gloffset_BeginTransformFeedbackEXT),
+ NAME_FUNC_OFFSET(14078, glBindBufferBaseEXT, glBindBufferBaseEXT, NULL, _gloffset_BindBufferBaseEXT),
+ NAME_FUNC_OFFSET(14098, glBindBufferOffsetEXT, glBindBufferOffsetEXT, NULL, _gloffset_BindBufferOffsetEXT),
+ NAME_FUNC_OFFSET(14120, glBindBufferRangeEXT, glBindBufferRangeEXT, NULL, _gloffset_BindBufferRangeEXT),
+ NAME_FUNC_OFFSET(14141, glEndTransformFeedbackEXT, glEndTransformFeedbackEXT, NULL, _gloffset_EndTransformFeedbackEXT),
+ NAME_FUNC_OFFSET(14167, glGetTransformFeedbackVaryingEXT, glGetTransformFeedbackVaryingEXT, NULL, _gloffset_GetTransformFeedbackVaryingEXT),
+ NAME_FUNC_OFFSET(14200, glTransformFeedbackVaryingsEXT, glTransformFeedbackVaryingsEXT, NULL, _gloffset_TransformFeedbackVaryingsEXT),
+ NAME_FUNC_OFFSET(14231, glProvokingVertexEXT, glProvokingVertexEXT, NULL, _gloffset_ProvokingVertexEXT),
+ NAME_FUNC_OFFSET(14252, gl_dispatch_stub_803, gl_dispatch_stub_803, NULL, _gloffset_GetTexParameterPointervAPPLE),
+ NAME_FUNC_OFFSET(14283, gl_dispatch_stub_804, gl_dispatch_stub_804, NULL, _gloffset_TextureRangeAPPLE),
+ NAME_FUNC_OFFSET(14303, glGetObjectParameterivAPPLE, glGetObjectParameterivAPPLE, NULL, _gloffset_GetObjectParameterivAPPLE),
+ NAME_FUNC_OFFSET(14331, glObjectPurgeableAPPLE, glObjectPurgeableAPPLE, NULL, _gloffset_ObjectPurgeableAPPLE),
+ NAME_FUNC_OFFSET(14354, glObjectUnpurgeableAPPLE, glObjectUnpurgeableAPPLE, NULL, _gloffset_ObjectUnpurgeableAPPLE),
+ NAME_FUNC_OFFSET(14379, gl_dispatch_stub_808, gl_dispatch_stub_808, NULL, _gloffset_StencilFuncSeparateATI),
+ NAME_FUNC_OFFSET(14404, gl_dispatch_stub_809, gl_dispatch_stub_809, NULL, _gloffset_ProgramEnvParameters4fvEXT),
+ NAME_FUNC_OFFSET(14433, gl_dispatch_stub_810, gl_dispatch_stub_810, NULL, _gloffset_ProgramLocalParameters4fvEXT),
+ NAME_FUNC_OFFSET(14464, gl_dispatch_stub_811, gl_dispatch_stub_811, NULL, _gloffset_GetQueryObjecti64vEXT),
+ NAME_FUNC_OFFSET(14488, gl_dispatch_stub_812, gl_dispatch_stub_812, NULL, _gloffset_GetQueryObjectui64vEXT),
+ NAME_FUNC_OFFSET(14513, glEGLImageTargetRenderbufferStorageOES, glEGLImageTargetRenderbufferStorageOES, NULL, _gloffset_EGLImageTargetRenderbufferStorageOES),
+ NAME_FUNC_OFFSET(14552, glEGLImageTargetTexture2DOES, glEGLImageTargetTexture2DOES, NULL, _gloffset_EGLImageTargetTexture2DOES),
+ NAME_FUNC_OFFSET(14581, glArrayElement, glArrayElement, NULL, _gloffset_ArrayElement),
+ NAME_FUNC_OFFSET(14599, glBindTexture, glBindTexture, NULL, _gloffset_BindTexture),
+ NAME_FUNC_OFFSET(14616, glDrawArrays, glDrawArrays, NULL, _gloffset_DrawArrays),
+ NAME_FUNC_OFFSET(14632, glAreTexturesResident, glAreTexturesResidentEXT, glAreTexturesResidentEXT, _gloffset_AreTexturesResident),
+ NAME_FUNC_OFFSET(14657, glCopyTexImage1D, glCopyTexImage1D, NULL, _gloffset_CopyTexImage1D),
+ NAME_FUNC_OFFSET(14677, glCopyTexImage2D, glCopyTexImage2D, NULL, _gloffset_CopyTexImage2D),
+ NAME_FUNC_OFFSET(14697, glCopyTexSubImage1D, glCopyTexSubImage1D, NULL, _gloffset_CopyTexSubImage1D),
+ NAME_FUNC_OFFSET(14720, glCopyTexSubImage2D, glCopyTexSubImage2D, NULL, _gloffset_CopyTexSubImage2D),
+ NAME_FUNC_OFFSET(14743, glDeleteTextures, glDeleteTexturesEXT, glDeleteTexturesEXT, _gloffset_DeleteTextures),
+ NAME_FUNC_OFFSET(14763, glGenTextures, glGenTexturesEXT, glGenTexturesEXT, _gloffset_GenTextures),
+ NAME_FUNC_OFFSET(14780, glGetPointerv, glGetPointerv, NULL, _gloffset_GetPointerv),
+ NAME_FUNC_OFFSET(14797, glIsTexture, glIsTextureEXT, glIsTextureEXT, _gloffset_IsTexture),
+ NAME_FUNC_OFFSET(14812, glPrioritizeTextures, glPrioritizeTextures, NULL, _gloffset_PrioritizeTextures),
+ NAME_FUNC_OFFSET(14836, glTexSubImage1D, glTexSubImage1D, NULL, _gloffset_TexSubImage1D),
+ NAME_FUNC_OFFSET(14855, glTexSubImage2D, glTexSubImage2D, NULL, _gloffset_TexSubImage2D),
+ NAME_FUNC_OFFSET(14874, glBlendColor, glBlendColor, NULL, _gloffset_BlendColor),
+ NAME_FUNC_OFFSET(14890, glBlendEquation, glBlendEquation, NULL, _gloffset_BlendEquation),
+ NAME_FUNC_OFFSET(14909, glDrawRangeElements, glDrawRangeElements, NULL, _gloffset_DrawRangeElements),
+ NAME_FUNC_OFFSET(14932, glColorTable, glColorTable, NULL, _gloffset_ColorTable),
+ NAME_FUNC_OFFSET(14948, glColorTable, glColorTable, NULL, _gloffset_ColorTable),
+ NAME_FUNC_OFFSET(14964, glColorTableParameterfv, glColorTableParameterfv, NULL, _gloffset_ColorTableParameterfv),
+ NAME_FUNC_OFFSET(14991, glColorTableParameteriv, glColorTableParameteriv, NULL, _gloffset_ColorTableParameteriv),
+ NAME_FUNC_OFFSET(15018, glCopyColorTable, glCopyColorTable, NULL, _gloffset_CopyColorTable),
+ NAME_FUNC_OFFSET(15038, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable),
+ NAME_FUNC_OFFSET(15057, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable),
+ NAME_FUNC_OFFSET(15076, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv),
+ NAME_FUNC_OFFSET(15106, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv),
+ NAME_FUNC_OFFSET(15136, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv),
+ NAME_FUNC_OFFSET(15166, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv),
+ NAME_FUNC_OFFSET(15196, glColorSubTable, glColorSubTable, NULL, _gloffset_ColorSubTable),
+ NAME_FUNC_OFFSET(15215, glCopyColorSubTable, glCopyColorSubTable, NULL, _gloffset_CopyColorSubTable),
+ NAME_FUNC_OFFSET(15238, glConvolutionFilter1D, glConvolutionFilter1D, NULL, _gloffset_ConvolutionFilter1D),
+ NAME_FUNC_OFFSET(15263, glConvolutionFilter2D, glConvolutionFilter2D, NULL, _gloffset_ConvolutionFilter2D),
+ NAME_FUNC_OFFSET(15288, glConvolutionParameterf, glConvolutionParameterf, NULL, _gloffset_ConvolutionParameterf),
+ NAME_FUNC_OFFSET(15315, glConvolutionParameterfv, glConvolutionParameterfv, NULL, _gloffset_ConvolutionParameterfv),
+ NAME_FUNC_OFFSET(15343, glConvolutionParameteri, glConvolutionParameteri, NULL, _gloffset_ConvolutionParameteri),
+ NAME_FUNC_OFFSET(15370, glConvolutionParameteriv, glConvolutionParameteriv, NULL, _gloffset_ConvolutionParameteriv),
+ NAME_FUNC_OFFSET(15398, glCopyConvolutionFilter1D, glCopyConvolutionFilter1D, NULL, _gloffset_CopyConvolutionFilter1D),
+ NAME_FUNC_OFFSET(15427, glCopyConvolutionFilter2D, glCopyConvolutionFilter2D, NULL, _gloffset_CopyConvolutionFilter2D),
+ NAME_FUNC_OFFSET(15456, glGetConvolutionFilter, gl_dispatch_stub_356, gl_dispatch_stub_356, _gloffset_GetConvolutionFilter),
+ NAME_FUNC_OFFSET(15482, glGetConvolutionParameterfv, gl_dispatch_stub_357, gl_dispatch_stub_357, _gloffset_GetConvolutionParameterfv),
+ NAME_FUNC_OFFSET(15513, glGetConvolutionParameteriv, gl_dispatch_stub_358, gl_dispatch_stub_358, _gloffset_GetConvolutionParameteriv),
+ NAME_FUNC_OFFSET(15544, glGetSeparableFilter, gl_dispatch_stub_359, gl_dispatch_stub_359, _gloffset_GetSeparableFilter),
+ NAME_FUNC_OFFSET(15568, glSeparableFilter2D, glSeparableFilter2D, NULL, _gloffset_SeparableFilter2D),
+ NAME_FUNC_OFFSET(15591, glGetHistogram, gl_dispatch_stub_361, gl_dispatch_stub_361, _gloffset_GetHistogram),
+ NAME_FUNC_OFFSET(15609, glGetHistogramParameterfv, gl_dispatch_stub_362, gl_dispatch_stub_362, _gloffset_GetHistogramParameterfv),
+ NAME_FUNC_OFFSET(15638, glGetHistogramParameteriv, gl_dispatch_stub_363, gl_dispatch_stub_363, _gloffset_GetHistogramParameteriv),
+ NAME_FUNC_OFFSET(15667, glGetMinmax, gl_dispatch_stub_364, gl_dispatch_stub_364, _gloffset_GetMinmax),
+ NAME_FUNC_OFFSET(15682, glGetMinmaxParameterfv, gl_dispatch_stub_365, gl_dispatch_stub_365, _gloffset_GetMinmaxParameterfv),
+ NAME_FUNC_OFFSET(15708, glGetMinmaxParameteriv, gl_dispatch_stub_366, gl_dispatch_stub_366, _gloffset_GetMinmaxParameteriv),
+ NAME_FUNC_OFFSET(15734, glHistogram, glHistogram, NULL, _gloffset_Histogram),
+ NAME_FUNC_OFFSET(15749, glMinmax, glMinmax, NULL, _gloffset_Minmax),
+ NAME_FUNC_OFFSET(15761, glResetHistogram, glResetHistogram, NULL, _gloffset_ResetHistogram),
+ NAME_FUNC_OFFSET(15781, glResetMinmax, glResetMinmax, NULL, _gloffset_ResetMinmax),
+ NAME_FUNC_OFFSET(15798, glTexImage3D, glTexImage3D, NULL, _gloffset_TexImage3D),
+ NAME_FUNC_OFFSET(15814, glTexSubImage3D, glTexSubImage3D, NULL, _gloffset_TexSubImage3D),
+ NAME_FUNC_OFFSET(15833, glCopyTexSubImage3D, glCopyTexSubImage3D, NULL, _gloffset_CopyTexSubImage3D),
+ NAME_FUNC_OFFSET(15856, glActiveTextureARB, glActiveTextureARB, NULL, _gloffset_ActiveTextureARB),
+ NAME_FUNC_OFFSET(15872, glClientActiveTextureARB, glClientActiveTextureARB, NULL, _gloffset_ClientActiveTextureARB),
+ NAME_FUNC_OFFSET(15894, glMultiTexCoord1dARB, glMultiTexCoord1dARB, NULL, _gloffset_MultiTexCoord1dARB),
+ NAME_FUNC_OFFSET(15912, glMultiTexCoord1dvARB, glMultiTexCoord1dvARB, NULL, _gloffset_MultiTexCoord1dvARB),
+ NAME_FUNC_OFFSET(15931, glMultiTexCoord1fARB, glMultiTexCoord1fARB, NULL, _gloffset_MultiTexCoord1fARB),
+ NAME_FUNC_OFFSET(15949, glMultiTexCoord1fvARB, glMultiTexCoord1fvARB, NULL, _gloffset_MultiTexCoord1fvARB),
+ NAME_FUNC_OFFSET(15968, glMultiTexCoord1iARB, glMultiTexCoord1iARB, NULL, _gloffset_MultiTexCoord1iARB),
+ NAME_FUNC_OFFSET(15986, glMultiTexCoord1ivARB, glMultiTexCoord1ivARB, NULL, _gloffset_MultiTexCoord1ivARB),
+ NAME_FUNC_OFFSET(16005, glMultiTexCoord1sARB, glMultiTexCoord1sARB, NULL, _gloffset_MultiTexCoord1sARB),
+ NAME_FUNC_OFFSET(16023, glMultiTexCoord1svARB, glMultiTexCoord1svARB, NULL, _gloffset_MultiTexCoord1svARB),
+ NAME_FUNC_OFFSET(16042, glMultiTexCoord2dARB, glMultiTexCoord2dARB, NULL, _gloffset_MultiTexCoord2dARB),
+ NAME_FUNC_OFFSET(16060, glMultiTexCoord2dvARB, glMultiTexCoord2dvARB, NULL, _gloffset_MultiTexCoord2dvARB),
+ NAME_FUNC_OFFSET(16079, glMultiTexCoord2fARB, glMultiTexCoord2fARB, NULL, _gloffset_MultiTexCoord2fARB),
+ NAME_FUNC_OFFSET(16097, glMultiTexCoord2fvARB, glMultiTexCoord2fvARB, NULL, _gloffset_MultiTexCoord2fvARB),
+ NAME_FUNC_OFFSET(16116, glMultiTexCoord2iARB, glMultiTexCoord2iARB, NULL, _gloffset_MultiTexCoord2iARB),
+ NAME_FUNC_OFFSET(16134, glMultiTexCoord2ivARB, glMultiTexCoord2ivARB, NULL, _gloffset_MultiTexCoord2ivARB),
+ NAME_FUNC_OFFSET(16153, glMultiTexCoord2sARB, glMultiTexCoord2sARB, NULL, _gloffset_MultiTexCoord2sARB),
+ NAME_FUNC_OFFSET(16171, glMultiTexCoord2svARB, glMultiTexCoord2svARB, NULL, _gloffset_MultiTexCoord2svARB),
+ NAME_FUNC_OFFSET(16190, glMultiTexCoord3dARB, glMultiTexCoord3dARB, NULL, _gloffset_MultiTexCoord3dARB),
+ NAME_FUNC_OFFSET(16208, glMultiTexCoord3dvARB, glMultiTexCoord3dvARB, NULL, _gloffset_MultiTexCoord3dvARB),
+ NAME_FUNC_OFFSET(16227, glMultiTexCoord3fARB, glMultiTexCoord3fARB, NULL, _gloffset_MultiTexCoord3fARB),
+ NAME_FUNC_OFFSET(16245, glMultiTexCoord3fvARB, glMultiTexCoord3fvARB, NULL, _gloffset_MultiTexCoord3fvARB),
+ NAME_FUNC_OFFSET(16264, glMultiTexCoord3iARB, glMultiTexCoord3iARB, NULL, _gloffset_MultiTexCoord3iARB),
+ NAME_FUNC_OFFSET(16282, glMultiTexCoord3ivARB, glMultiTexCoord3ivARB, NULL, _gloffset_MultiTexCoord3ivARB),
+ NAME_FUNC_OFFSET(16301, glMultiTexCoord3sARB, glMultiTexCoord3sARB, NULL, _gloffset_MultiTexCoord3sARB),
+ NAME_FUNC_OFFSET(16319, glMultiTexCoord3svARB, glMultiTexCoord3svARB, NULL, _gloffset_MultiTexCoord3svARB),
+ NAME_FUNC_OFFSET(16338, glMultiTexCoord4dARB, glMultiTexCoord4dARB, NULL, _gloffset_MultiTexCoord4dARB),
+ NAME_FUNC_OFFSET(16356, glMultiTexCoord4dvARB, glMultiTexCoord4dvARB, NULL, _gloffset_MultiTexCoord4dvARB),
+ NAME_FUNC_OFFSET(16375, glMultiTexCoord4fARB, glMultiTexCoord4fARB, NULL, _gloffset_MultiTexCoord4fARB),
+ NAME_FUNC_OFFSET(16393, glMultiTexCoord4fvARB, glMultiTexCoord4fvARB, NULL, _gloffset_MultiTexCoord4fvARB),
+ NAME_FUNC_OFFSET(16412, glMultiTexCoord4iARB, glMultiTexCoord4iARB, NULL, _gloffset_MultiTexCoord4iARB),
+ NAME_FUNC_OFFSET(16430, glMultiTexCoord4ivARB, glMultiTexCoord4ivARB, NULL, _gloffset_MultiTexCoord4ivARB),
+ NAME_FUNC_OFFSET(16449, glMultiTexCoord4sARB, glMultiTexCoord4sARB, NULL, _gloffset_MultiTexCoord4sARB),
+ NAME_FUNC_OFFSET(16467, glMultiTexCoord4svARB, glMultiTexCoord4svARB, NULL, _gloffset_MultiTexCoord4svARB),
+ NAME_FUNC_OFFSET(16486, glStencilOpSeparate, glStencilOpSeparate, NULL, _gloffset_StencilOpSeparate),
+ NAME_FUNC_OFFSET(16509, glLoadTransposeMatrixdARB, glLoadTransposeMatrixdARB, NULL, _gloffset_LoadTransposeMatrixdARB),
+ NAME_FUNC_OFFSET(16532, glLoadTransposeMatrixfARB, glLoadTransposeMatrixfARB, NULL, _gloffset_LoadTransposeMatrixfARB),
+ NAME_FUNC_OFFSET(16555, glMultTransposeMatrixdARB, glMultTransposeMatrixdARB, NULL, _gloffset_MultTransposeMatrixdARB),
+ NAME_FUNC_OFFSET(16578, glMultTransposeMatrixfARB, glMultTransposeMatrixfARB, NULL, _gloffset_MultTransposeMatrixfARB),
+ NAME_FUNC_OFFSET(16601, glSampleCoverageARB, glSampleCoverageARB, NULL, _gloffset_SampleCoverageARB),
+ NAME_FUNC_OFFSET(16618, glCompressedTexImage1DARB, glCompressedTexImage1DARB, NULL, _gloffset_CompressedTexImage1DARB),
+ NAME_FUNC_OFFSET(16641, glCompressedTexImage2DARB, glCompressedTexImage2DARB, NULL, _gloffset_CompressedTexImage2DARB),
+ NAME_FUNC_OFFSET(16664, glCompressedTexImage3DARB, glCompressedTexImage3DARB, NULL, _gloffset_CompressedTexImage3DARB),
+ NAME_FUNC_OFFSET(16687, glCompressedTexSubImage1DARB, glCompressedTexSubImage1DARB, NULL, _gloffset_CompressedTexSubImage1DARB),
+ NAME_FUNC_OFFSET(16713, glCompressedTexSubImage2DARB, glCompressedTexSubImage2DARB, NULL, _gloffset_CompressedTexSubImage2DARB),
+ NAME_FUNC_OFFSET(16739, glCompressedTexSubImage3DARB, glCompressedTexSubImage3DARB, NULL, _gloffset_CompressedTexSubImage3DARB),
+ NAME_FUNC_OFFSET(16765, glGetCompressedTexImageARB, glGetCompressedTexImageARB, NULL, _gloffset_GetCompressedTexImageARB),
+ NAME_FUNC_OFFSET(16789, glDisableVertexAttribArrayARB, glDisableVertexAttribArrayARB, NULL, _gloffset_DisableVertexAttribArrayARB),
+ NAME_FUNC_OFFSET(16816, glEnableVertexAttribArrayARB, glEnableVertexAttribArrayARB, NULL, _gloffset_EnableVertexAttribArrayARB),
+ NAME_FUNC_OFFSET(16842, glGetVertexAttribdvARB, glGetVertexAttribdvARB, NULL, _gloffset_GetVertexAttribdvARB),
+ NAME_FUNC_OFFSET(16862, glGetVertexAttribfvARB, glGetVertexAttribfvARB, NULL, _gloffset_GetVertexAttribfvARB),
+ NAME_FUNC_OFFSET(16882, glGetVertexAttribivARB, glGetVertexAttribivARB, NULL, _gloffset_GetVertexAttribivARB),
+ NAME_FUNC_OFFSET(16902, glProgramEnvParameter4dARB, glProgramEnvParameter4dARB, NULL, _gloffset_ProgramEnvParameter4dARB),
+ NAME_FUNC_OFFSET(16925, glProgramEnvParameter4dvARB, glProgramEnvParameter4dvARB, NULL, _gloffset_ProgramEnvParameter4dvARB),
+ NAME_FUNC_OFFSET(16949, glProgramEnvParameter4fARB, glProgramEnvParameter4fARB, NULL, _gloffset_ProgramEnvParameter4fARB),
+ NAME_FUNC_OFFSET(16972, glProgramEnvParameter4fvARB, glProgramEnvParameter4fvARB, NULL, _gloffset_ProgramEnvParameter4fvARB),
+ NAME_FUNC_OFFSET(16996, glVertexAttrib1dARB, glVertexAttrib1dARB, NULL, _gloffset_VertexAttrib1dARB),
+ NAME_FUNC_OFFSET(17013, glVertexAttrib1dvARB, glVertexAttrib1dvARB, NULL, _gloffset_VertexAttrib1dvARB),
+ NAME_FUNC_OFFSET(17031, glVertexAttrib1fARB, glVertexAttrib1fARB, NULL, _gloffset_VertexAttrib1fARB),
+ NAME_FUNC_OFFSET(17048, glVertexAttrib1fvARB, glVertexAttrib1fvARB, NULL, _gloffset_VertexAttrib1fvARB),
+ NAME_FUNC_OFFSET(17066, glVertexAttrib1sARB, glVertexAttrib1sARB, NULL, _gloffset_VertexAttrib1sARB),
+ NAME_FUNC_OFFSET(17083, glVertexAttrib1svARB, glVertexAttrib1svARB, NULL, _gloffset_VertexAttrib1svARB),
+ NAME_FUNC_OFFSET(17101, glVertexAttrib2dARB, glVertexAttrib2dARB, NULL, _gloffset_VertexAttrib2dARB),
+ NAME_FUNC_OFFSET(17118, glVertexAttrib2dvARB, glVertexAttrib2dvARB, NULL, _gloffset_VertexAttrib2dvARB),
+ NAME_FUNC_OFFSET(17136, glVertexAttrib2fARB, glVertexAttrib2fARB, NULL, _gloffset_VertexAttrib2fARB),
+ NAME_FUNC_OFFSET(17153, glVertexAttrib2fvARB, glVertexAttrib2fvARB, NULL, _gloffset_VertexAttrib2fvARB),
+ NAME_FUNC_OFFSET(17171, glVertexAttrib2sARB, glVertexAttrib2sARB, NULL, _gloffset_VertexAttrib2sARB),
+ NAME_FUNC_OFFSET(17188, glVertexAttrib2svARB, glVertexAttrib2svARB, NULL, _gloffset_VertexAttrib2svARB),
+ NAME_FUNC_OFFSET(17206, glVertexAttrib3dARB, glVertexAttrib3dARB, NULL, _gloffset_VertexAttrib3dARB),
+ NAME_FUNC_OFFSET(17223, glVertexAttrib3dvARB, glVertexAttrib3dvARB, NULL, _gloffset_VertexAttrib3dvARB),
+ NAME_FUNC_OFFSET(17241, glVertexAttrib3fARB, glVertexAttrib3fARB, NULL, _gloffset_VertexAttrib3fARB),
+ NAME_FUNC_OFFSET(17258, glVertexAttrib3fvARB, glVertexAttrib3fvARB, NULL, _gloffset_VertexAttrib3fvARB),
+ NAME_FUNC_OFFSET(17276, glVertexAttrib3sARB, glVertexAttrib3sARB, NULL, _gloffset_VertexAttrib3sARB),
+ NAME_FUNC_OFFSET(17293, glVertexAttrib3svARB, glVertexAttrib3svARB, NULL, _gloffset_VertexAttrib3svARB),
+ NAME_FUNC_OFFSET(17311, glVertexAttrib4NbvARB, glVertexAttrib4NbvARB, NULL, _gloffset_VertexAttrib4NbvARB),
+ NAME_FUNC_OFFSET(17330, glVertexAttrib4NivARB, glVertexAttrib4NivARB, NULL, _gloffset_VertexAttrib4NivARB),
+ NAME_FUNC_OFFSET(17349, glVertexAttrib4NsvARB, glVertexAttrib4NsvARB, NULL, _gloffset_VertexAttrib4NsvARB),
+ NAME_FUNC_OFFSET(17368, glVertexAttrib4NubARB, glVertexAttrib4NubARB, NULL, _gloffset_VertexAttrib4NubARB),
+ NAME_FUNC_OFFSET(17387, glVertexAttrib4NubvARB, glVertexAttrib4NubvARB, NULL, _gloffset_VertexAttrib4NubvARB),
+ NAME_FUNC_OFFSET(17407, glVertexAttrib4NuivARB, glVertexAttrib4NuivARB, NULL, _gloffset_VertexAttrib4NuivARB),
+ NAME_FUNC_OFFSET(17427, glVertexAttrib4NusvARB, glVertexAttrib4NusvARB, NULL, _gloffset_VertexAttrib4NusvARB),
+ NAME_FUNC_OFFSET(17447, glVertexAttrib4bvARB, glVertexAttrib4bvARB, NULL, _gloffset_VertexAttrib4bvARB),
+ NAME_FUNC_OFFSET(17465, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL, _gloffset_VertexAttrib4dARB),
+ NAME_FUNC_OFFSET(17482, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL, _gloffset_VertexAttrib4dvARB),
+ NAME_FUNC_OFFSET(17500, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL, _gloffset_VertexAttrib4fARB),
+ NAME_FUNC_OFFSET(17517, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL, _gloffset_VertexAttrib4fvARB),
+ NAME_FUNC_OFFSET(17535, glVertexAttrib4ivARB, glVertexAttrib4ivARB, NULL, _gloffset_VertexAttrib4ivARB),
+ NAME_FUNC_OFFSET(17553, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL, _gloffset_VertexAttrib4sARB),
+ NAME_FUNC_OFFSET(17570, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL, _gloffset_VertexAttrib4svARB),
+ NAME_FUNC_OFFSET(17588, glVertexAttrib4ubvARB, glVertexAttrib4ubvARB, NULL, _gloffset_VertexAttrib4ubvARB),
+ NAME_FUNC_OFFSET(17607, glVertexAttrib4uivARB, glVertexAttrib4uivARB, NULL, _gloffset_VertexAttrib4uivARB),
+ NAME_FUNC_OFFSET(17626, glVertexAttrib4usvARB, glVertexAttrib4usvARB, NULL, _gloffset_VertexAttrib4usvARB),
+ NAME_FUNC_OFFSET(17645, glVertexAttribPointerARB, glVertexAttribPointerARB, NULL, _gloffset_VertexAttribPointerARB),
+ NAME_FUNC_OFFSET(17667, glBindBufferARB, glBindBufferARB, NULL, _gloffset_BindBufferARB),
+ NAME_FUNC_OFFSET(17680, glBufferDataARB, glBufferDataARB, NULL, _gloffset_BufferDataARB),
+ NAME_FUNC_OFFSET(17693, glBufferSubDataARB, glBufferSubDataARB, NULL, _gloffset_BufferSubDataARB),
+ NAME_FUNC_OFFSET(17709, glDeleteBuffersARB, glDeleteBuffersARB, NULL, _gloffset_DeleteBuffersARB),
+ NAME_FUNC_OFFSET(17725, glGenBuffersARB, glGenBuffersARB, NULL, _gloffset_GenBuffersARB),
+ NAME_FUNC_OFFSET(17738, glGetBufferParameterivARB, glGetBufferParameterivARB, NULL, _gloffset_GetBufferParameterivARB),
+ NAME_FUNC_OFFSET(17761, glGetBufferPointervARB, glGetBufferPointervARB, NULL, _gloffset_GetBufferPointervARB),
+ NAME_FUNC_OFFSET(17781, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL, _gloffset_GetBufferSubDataARB),
+ NAME_FUNC_OFFSET(17800, glIsBufferARB, glIsBufferARB, NULL, _gloffset_IsBufferARB),
+ NAME_FUNC_OFFSET(17811, glMapBufferARB, glMapBufferARB, NULL, _gloffset_MapBufferARB),
+ NAME_FUNC_OFFSET(17823, glUnmapBufferARB, glUnmapBufferARB, NULL, _gloffset_UnmapBufferARB),
+ NAME_FUNC_OFFSET(17837, glBeginQueryARB, glBeginQueryARB, NULL, _gloffset_BeginQueryARB),
+ NAME_FUNC_OFFSET(17850, glDeleteQueriesARB, glDeleteQueriesARB, NULL, _gloffset_DeleteQueriesARB),
+ NAME_FUNC_OFFSET(17866, glEndQueryARB, glEndQueryARB, NULL, _gloffset_EndQueryARB),
+ NAME_FUNC_OFFSET(17877, glGenQueriesARB, glGenQueriesARB, NULL, _gloffset_GenQueriesARB),
+ NAME_FUNC_OFFSET(17890, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL, _gloffset_GetQueryObjectivARB),
+ NAME_FUNC_OFFSET(17909, glGetQueryObjectuivARB, glGetQueryObjectuivARB, NULL, _gloffset_GetQueryObjectuivARB),
+ NAME_FUNC_OFFSET(17929, glGetQueryivARB, glGetQueryivARB, NULL, _gloffset_GetQueryivARB),
+ NAME_FUNC_OFFSET(17942, glIsQueryARB, glIsQueryARB, NULL, _gloffset_IsQueryARB),
+ NAME_FUNC_OFFSET(17952, glCompileShaderARB, glCompileShaderARB, NULL, _gloffset_CompileShaderARB),
+ NAME_FUNC_OFFSET(17968, glGetActiveUniformARB, glGetActiveUniformARB, NULL, _gloffset_GetActiveUniformARB),
+ NAME_FUNC_OFFSET(17987, glGetShaderSourceARB, glGetShaderSourceARB, NULL, _gloffset_GetShaderSourceARB),
+ NAME_FUNC_OFFSET(18005, glGetUniformLocationARB, glGetUniformLocationARB, NULL, _gloffset_GetUniformLocationARB),
+ NAME_FUNC_OFFSET(18026, glGetUniformfvARB, glGetUniformfvARB, NULL, _gloffset_GetUniformfvARB),
+ NAME_FUNC_OFFSET(18041, glGetUniformivARB, glGetUniformivARB, NULL, _gloffset_GetUniformivARB),
+ NAME_FUNC_OFFSET(18056, glLinkProgramARB, glLinkProgramARB, NULL, _gloffset_LinkProgramARB),
+ NAME_FUNC_OFFSET(18070, glShaderSourceARB, glShaderSourceARB, NULL, _gloffset_ShaderSourceARB),
+ NAME_FUNC_OFFSET(18085, glUniform1fARB, glUniform1fARB, NULL, _gloffset_Uniform1fARB),
+ NAME_FUNC_OFFSET(18097, glUniform1fvARB, glUniform1fvARB, NULL, _gloffset_Uniform1fvARB),
+ NAME_FUNC_OFFSET(18110, glUniform1iARB, glUniform1iARB, NULL, _gloffset_Uniform1iARB),
+ NAME_FUNC_OFFSET(18122, glUniform1ivARB, glUniform1ivARB, NULL, _gloffset_Uniform1ivARB),
+ NAME_FUNC_OFFSET(18135, glUniform2fARB, glUniform2fARB, NULL, _gloffset_Uniform2fARB),
+ NAME_FUNC_OFFSET(18147, glUniform2fvARB, glUniform2fvARB, NULL, _gloffset_Uniform2fvARB),
+ NAME_FUNC_OFFSET(18160, glUniform2iARB, glUniform2iARB, NULL, _gloffset_Uniform2iARB),
+ NAME_FUNC_OFFSET(18172, glUniform2ivARB, glUniform2ivARB, NULL, _gloffset_Uniform2ivARB),
+ NAME_FUNC_OFFSET(18185, glUniform3fARB, glUniform3fARB, NULL, _gloffset_Uniform3fARB),
+ NAME_FUNC_OFFSET(18197, glUniform3fvARB, glUniform3fvARB, NULL, _gloffset_Uniform3fvARB),
+ NAME_FUNC_OFFSET(18210, glUniform3iARB, glUniform3iARB, NULL, _gloffset_Uniform3iARB),
+ NAME_FUNC_OFFSET(18222, glUniform3ivARB, glUniform3ivARB, NULL, _gloffset_Uniform3ivARB),
+ NAME_FUNC_OFFSET(18235, glUniform4fARB, glUniform4fARB, NULL, _gloffset_Uniform4fARB),
+ NAME_FUNC_OFFSET(18247, glUniform4fvARB, glUniform4fvARB, NULL, _gloffset_Uniform4fvARB),
+ NAME_FUNC_OFFSET(18260, glUniform4iARB, glUniform4iARB, NULL, _gloffset_Uniform4iARB),
+ NAME_FUNC_OFFSET(18272, glUniform4ivARB, glUniform4ivARB, NULL, _gloffset_Uniform4ivARB),
+ NAME_FUNC_OFFSET(18285, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL, _gloffset_UniformMatrix2fvARB),
+ NAME_FUNC_OFFSET(18304, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL, _gloffset_UniformMatrix3fvARB),
+ NAME_FUNC_OFFSET(18323, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL, _gloffset_UniformMatrix4fvARB),
+ NAME_FUNC_OFFSET(18342, glUseProgramObjectARB, glUseProgramObjectARB, NULL, _gloffset_UseProgramObjectARB),
+ NAME_FUNC_OFFSET(18355, glValidateProgramARB, glValidateProgramARB, NULL, _gloffset_ValidateProgramARB),
+ NAME_FUNC_OFFSET(18373, glBindAttribLocationARB, glBindAttribLocationARB, NULL, _gloffset_BindAttribLocationARB),
+ NAME_FUNC_OFFSET(18394, glGetActiveAttribARB, glGetActiveAttribARB, NULL, _gloffset_GetActiveAttribARB),
+ NAME_FUNC_OFFSET(18412, glGetAttribLocationARB, glGetAttribLocationARB, NULL, _gloffset_GetAttribLocationARB),
+ NAME_FUNC_OFFSET(18432, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB),
+ NAME_FUNC_OFFSET(18446, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB),
+ NAME_FUNC_OFFSET(18463, glRenderbufferStorageMultisample, glRenderbufferStorageMultisample, NULL, _gloffset_RenderbufferStorageMultisample),
+ NAME_FUNC_OFFSET(18499, gl_dispatch_stub_584, gl_dispatch_stub_584, NULL, _gloffset_SampleMaskSGIS),
+ NAME_FUNC_OFFSET(18515, gl_dispatch_stub_585, gl_dispatch_stub_585, NULL, _gloffset_SamplePatternSGIS),
+ NAME_FUNC_OFFSET(18534, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT),
+ NAME_FUNC_OFFSET(18552, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT),
+ NAME_FUNC_OFFSET(18573, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT),
+ NAME_FUNC_OFFSET(18595, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT),
+ NAME_FUNC_OFFSET(18614, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT),
+ NAME_FUNC_OFFSET(18636, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT),
+ NAME_FUNC_OFFSET(18659, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, _gloffset_SecondaryColor3bEXT),
+ NAME_FUNC_OFFSET(18678, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, _gloffset_SecondaryColor3bvEXT),
+ NAME_FUNC_OFFSET(18698, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, _gloffset_SecondaryColor3dEXT),
+ NAME_FUNC_OFFSET(18717, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, _gloffset_SecondaryColor3dvEXT),
+ NAME_FUNC_OFFSET(18737, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, _gloffset_SecondaryColor3fEXT),
+ NAME_FUNC_OFFSET(18756, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, _gloffset_SecondaryColor3fvEXT),
+ NAME_FUNC_OFFSET(18776, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, _gloffset_SecondaryColor3iEXT),
+ NAME_FUNC_OFFSET(18795, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, _gloffset_SecondaryColor3ivEXT),
+ NAME_FUNC_OFFSET(18815, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, _gloffset_SecondaryColor3sEXT),
+ NAME_FUNC_OFFSET(18834, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, _gloffset_SecondaryColor3svEXT),
+ NAME_FUNC_OFFSET(18854, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, _gloffset_SecondaryColor3ubEXT),
+ NAME_FUNC_OFFSET(18874, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, _gloffset_SecondaryColor3ubvEXT),
+ NAME_FUNC_OFFSET(18895, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, _gloffset_SecondaryColor3uiEXT),
+ NAME_FUNC_OFFSET(18915, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, _gloffset_SecondaryColor3uivEXT),
+ NAME_FUNC_OFFSET(18936, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, _gloffset_SecondaryColor3usEXT),
+ NAME_FUNC_OFFSET(18956, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, _gloffset_SecondaryColor3usvEXT),
+ NAME_FUNC_OFFSET(18977, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, _gloffset_SecondaryColorPointerEXT),
+ NAME_FUNC_OFFSET(19001, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, _gloffset_MultiDrawArraysEXT),
+ NAME_FUNC_OFFSET(19019, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, _gloffset_MultiDrawElementsEXT),
+ NAME_FUNC_OFFSET(19039, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, _gloffset_FogCoordPointerEXT),
+ NAME_FUNC_OFFSET(19057, glFogCoorddEXT, glFogCoorddEXT, NULL, _gloffset_FogCoorddEXT),
+ NAME_FUNC_OFFSET(19069, glFogCoorddvEXT, glFogCoorddvEXT, NULL, _gloffset_FogCoorddvEXT),
+ NAME_FUNC_OFFSET(19082, glFogCoordfEXT, glFogCoordfEXT, NULL, _gloffset_FogCoordfEXT),
+ NAME_FUNC_OFFSET(19094, glFogCoordfvEXT, glFogCoordfvEXT, NULL, _gloffset_FogCoordfvEXT),
+ NAME_FUNC_OFFSET(19107, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT),
+ NAME_FUNC_OFFSET(19127, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT),
+ NAME_FUNC_OFFSET(19151, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA),
+ NAME_FUNC_OFFSET(19165, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA),
+ NAME_FUNC_OFFSET(19182, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA),
+ NAME_FUNC_OFFSET(19197, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA),
+ NAME_FUNC_OFFSET(19215, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA),
+ NAME_FUNC_OFFSET(19229, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA),
+ NAME_FUNC_OFFSET(19246, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA),
+ NAME_FUNC_OFFSET(19261, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA),
+ NAME_FUNC_OFFSET(19279, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA),
+ NAME_FUNC_OFFSET(19293, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA),
+ NAME_FUNC_OFFSET(19310, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA),
+ NAME_FUNC_OFFSET(19325, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA),
+ NAME_FUNC_OFFSET(19343, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA),
+ NAME_FUNC_OFFSET(19357, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA),
+ NAME_FUNC_OFFSET(19374, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA),
+ NAME_FUNC_OFFSET(19389, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA),
+ NAME_FUNC_OFFSET(19407, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA),
+ NAME_FUNC_OFFSET(19421, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA),
+ NAME_FUNC_OFFSET(19438, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA),
+ NAME_FUNC_OFFSET(19453, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA),
+ NAME_FUNC_OFFSET(19471, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA),
+ NAME_FUNC_OFFSET(19485, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA),
+ NAME_FUNC_OFFSET(19502, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA),
+ NAME_FUNC_OFFSET(19517, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA),
+ NAME_FUNC_OFFSET(19535, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA),
+ NAME_FUNC_OFFSET(19549, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA),
+ NAME_FUNC_OFFSET(19566, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA),
+ NAME_FUNC_OFFSET(19581, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA),
+ NAME_FUNC_OFFSET(19599, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA),
+ NAME_FUNC_OFFSET(19613, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA),
+ NAME_FUNC_OFFSET(19630, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA),
+ NAME_FUNC_OFFSET(19645, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA),
+ NAME_FUNC_OFFSET(19663, glBindProgramNV, glBindProgramNV, NULL, _gloffset_BindProgramNV),
+ NAME_FUNC_OFFSET(19680, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV),
+ NAME_FUNC_OFFSET(19700, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV),
+ NAME_FUNC_OFFSET(19717, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV),
+ NAME_FUNC_OFFSET(19743, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV),
+ NAME_FUNC_OFFSET(19772, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV),
+ NAME_FUNC_OFFSET(19787, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV),
+ NAME_FUNC_OFFSET(19805, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV),
+ NAME_FUNC_OFFSET(19824, gl_dispatch_stub_755, gl_dispatch_stub_755, NULL, _gloffset_DeleteVertexArraysAPPLE),
+ NAME_FUNC_OFFSET(19845, gl_dispatch_stub_757, gl_dispatch_stub_757, NULL, _gloffset_IsVertexArrayAPPLE),
+ NAME_FUNC_OFFSET(19861, gl_dispatch_stub_765, gl_dispatch_stub_765, NULL, _gloffset_BlendEquationSeparateEXT),
+ NAME_FUNC_OFFSET(19885, gl_dispatch_stub_765, gl_dispatch_stub_765, NULL, _gloffset_BlendEquationSeparateEXT),
+ NAME_FUNC_OFFSET(19912, glBindFramebufferEXT, glBindFramebufferEXT, NULL, _gloffset_BindFramebufferEXT),
+ NAME_FUNC_OFFSET(19930, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, _gloffset_BindRenderbufferEXT),
+ NAME_FUNC_OFFSET(19949, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, _gloffset_CheckFramebufferStatusEXT),
+ NAME_FUNC_OFFSET(19974, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, _gloffset_DeleteFramebuffersEXT),
+ NAME_FUNC_OFFSET(19995, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, _gloffset_DeleteRenderbuffersEXT),
+ NAME_FUNC_OFFSET(20017, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, _gloffset_FramebufferRenderbufferEXT),
+ NAME_FUNC_OFFSET(20043, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, _gloffset_FramebufferTexture1DEXT),
+ NAME_FUNC_OFFSET(20066, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, _gloffset_FramebufferTexture2DEXT),
+ NAME_FUNC_OFFSET(20089, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, _gloffset_FramebufferTexture3DEXT),
+ NAME_FUNC_OFFSET(20112, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, _gloffset_GenFramebuffersEXT),
+ NAME_FUNC_OFFSET(20130, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, _gloffset_GenRenderbuffersEXT),
+ NAME_FUNC_OFFSET(20149, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, _gloffset_GenerateMipmapEXT),
+ NAME_FUNC_OFFSET(20166, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, _gloffset_GetFramebufferAttachmentParameterivEXT),
+ NAME_FUNC_OFFSET(20204, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, _gloffset_GetRenderbufferParameterivEXT),
+ NAME_FUNC_OFFSET(20233, glIsFramebufferEXT, glIsFramebufferEXT, NULL, _gloffset_IsFramebufferEXT),
+ NAME_FUNC_OFFSET(20249, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, _gloffset_IsRenderbufferEXT),
+ NAME_FUNC_OFFSET(20266, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, _gloffset_RenderbufferStorageEXT),
+ NAME_FUNC_OFFSET(20288, gl_dispatch_stub_783, gl_dispatch_stub_783, NULL, _gloffset_BlitFramebufferEXT),
+ NAME_FUNC_OFFSET(20306, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, _gloffset_FramebufferTextureLayerEXT),
+ NAME_FUNC_OFFSET(20332, glBeginTransformFeedbackEXT, glBeginTransformFeedbackEXT, NULL, _gloffset_BeginTransformFeedbackEXT),
+ NAME_FUNC_OFFSET(20357, glBindBufferBaseEXT, glBindBufferBaseEXT, NULL, _gloffset_BindBufferBaseEXT),
+ NAME_FUNC_OFFSET(20374, glBindBufferRangeEXT, glBindBufferRangeEXT, NULL, _gloffset_BindBufferRangeEXT),
+ NAME_FUNC_OFFSET(20392, glEndTransformFeedbackEXT, glEndTransformFeedbackEXT, NULL, _gloffset_EndTransformFeedbackEXT),
+ NAME_FUNC_OFFSET(20415, glGetTransformFeedbackVaryingEXT, glGetTransformFeedbackVaryingEXT, NULL, _gloffset_GetTransformFeedbackVaryingEXT),
+ NAME_FUNC_OFFSET(20445, glTransformFeedbackVaryingsEXT, glTransformFeedbackVaryingsEXT, NULL, _gloffset_TransformFeedbackVaryingsEXT),
+ NAME_FUNC_OFFSET(20473, glProvokingVertexEXT, glProvokingVertexEXT, NULL, _gloffset_ProvokingVertexEXT),
NAME_FUNC_OFFSET(-1, NULL, NULL, NULL, 0)
};
diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c
index fa8d409caa..1e1aa41611 100644
--- a/src/mesa/main/api_exec.c
+++ b/src/mesa/main/api_exec.c
@@ -89,6 +89,7 @@
#include "texobj.h"
#include "texparam.h"
#include "texstate.h"
+#include "transformfeedback.h"
#include "mtypes.h"
#include "varray.h"
#include "viewport.h"
@@ -477,6 +478,18 @@ _mesa_init_exec_table(struct _glapi_table *exec)
/* ???. GL_EXT_depth_bounds_test */
SET_DepthBoundsEXT(exec, _mesa_DepthBoundsEXT);
+ /* 352. GL_EXT_transform_feedback */
+#if _HAVE_FULL_GL
+ SET_BeginTransformFeedbackEXT(exec, _mesa_BeginTransformFeedback);
+ SET_EndTransformFeedbackEXT(exec, _mesa_EndTransformFeedback);
+ SET_BindBufferRangeEXT(exec, _mesa_BindBufferRange);
+ SET_BindBufferBaseEXT(exec, _mesa_BindBufferBase);
+ SET_BindBufferOffsetEXT(exec, _mesa_BindBufferOffsetEXT);
+ SET_TransformFeedbackVaryingsEXT(exec, _mesa_TransformFeedbackVaryings);
+ SET_GetTransformFeedbackVaryingEXT(exec, _mesa_GetTransformFeedbackVarying);
+#endif
+
+ /* 364. GL_EXT_provoking_vertex */
SET_ProvokingVertexEXT(exec, _mesa_ProvokingVertexEXT);
/* ARB 1. GL_ARB_multitexture */
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 71d1514fe4..235cafcf1e 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -32,6 +32,7 @@
#include "glheader.h"
+#include "enums.h"
#include "hash.h"
#include "imports.h"
#include "image.h"
@@ -46,7 +47,7 @@
/*#define BOUNDS_CHECK*/
-#ifdef FEATURE_OES_mapbuffer
+#if FEATURE_OES_mapbuffer
#define DEFAULT_ACCESS GL_MAP_WRITE_BIT
#else
#define DEFAULT_ACCESS (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT)
@@ -82,6 +83,13 @@ get_buffer_target(GLcontext *ctx, GLenum target)
return &ctx->CopyWriteBuffer;
}
break;
+#if FEATURE_EXT_transform_feedback
+ case GL_TRANSFORM_FEEDBACK_BUFFER:
+ if (ctx->Extensions.EXT_transform_feedback) {
+ return &ctx->TransformFeedback.CurrentBuffer;
+ }
+ break;
+#endif
default:
return NULL;
}
@@ -1376,31 +1384,49 @@ _mesa_GetBufferParameterivARB(GLenum target, GLenum pname, GLint *params)
bufObj = get_buffer(ctx, target);
if (!bufObj) {
- _mesa_error(ctx, GL_INVALID_ENUM, "GetBufferParameterivARB(target)" );
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferParameterivARB(target)" );
return;
}
if (!_mesa_is_bufferobj(bufObj)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "GetBufferParameterivARB" );
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetBufferParameterivARB" );
return;
}
switch (pname) {
case GL_BUFFER_SIZE_ARB:
*params = (GLint) bufObj->Size;
- break;
+ return;
case GL_BUFFER_USAGE_ARB:
*params = bufObj->Usage;
- break;
+ return;
case GL_BUFFER_ACCESS_ARB:
*params = simplified_access_mode(bufObj->AccessFlags);
- break;
+ return;
case GL_BUFFER_MAPPED_ARB:
*params = _mesa_bufferobj_mapped(bufObj);
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferParameterivARB(pname)");
return;
+ case GL_BUFFER_ACCESS_FLAGS:
+ if (ctx->VersionMajor < 3)
+ goto invalid_pname;
+ *params = bufObj->AccessFlags;
+ return;
+ case GL_BUFFER_MAP_OFFSET:
+ if (ctx->VersionMajor < 3)
+ goto invalid_pname;
+ *params = (GLint) bufObj->Offset;
+ return;
+ case GL_BUFFER_MAP_LENGTH:
+ if (ctx->VersionMajor < 3)
+ goto invalid_pname;
+ *params = (GLint) bufObj->Length;
+ return;
+ default:
+ ; /* fall-through */
}
+
+invalid_pname:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferParameterivARB(pname=%s)",
+ _mesa_lookup_enum_by_nr(pname));
}
@@ -1418,31 +1444,49 @@ _mesa_GetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params)
bufObj = get_buffer(ctx, target);
if (!bufObj) {
- _mesa_error(ctx, GL_INVALID_ENUM, "GetBufferParameteri64v(target)" );
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferParameteri64v(target)" );
return;
}
if (!_mesa_is_bufferobj(bufObj)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "GetBufferParameteri64v" );
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetBufferParameteri64v" );
return;
}
switch (pname) {
case GL_BUFFER_SIZE_ARB:
*params = bufObj->Size;
- break;
+ return;
case GL_BUFFER_USAGE_ARB:
*params = bufObj->Usage;
- break;
+ return;
case GL_BUFFER_ACCESS_ARB:
*params = simplified_access_mode(bufObj->AccessFlags);
- break;
+ return;
+ case GL_BUFFER_ACCESS_FLAGS:
+ if (ctx->VersionMajor < 3)
+ goto invalid_pname;
+ *params = bufObj->AccessFlags;
+ return;
case GL_BUFFER_MAPPED_ARB:
*params = _mesa_bufferobj_mapped(bufObj);
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferParameteri64v(pname)");
return;
+ case GL_BUFFER_MAP_OFFSET:
+ if (ctx->VersionMajor < 3)
+ goto invalid_pname;
+ *params = bufObj->Offset;
+ return;
+ case GL_BUFFER_MAP_LENGTH:
+ if (ctx->VersionMajor < 3)
+ goto invalid_pname;
+ *params = bufObj->Length;
+ return;
+ default:
+ ; /* fall-through */
}
+
+invalid_pname:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferParameteri64v(pname=%s)",
+ _mesa_lookup_enum_by_nr(pname));
}
diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h
index 2eac1cc2ed..30b48e4bd0 100644
--- a/src/mesa/main/config.h
+++ b/src/mesa/main/config.h
@@ -262,6 +262,11 @@
/** For GL_ATI_envmap_bump - support bump mapping on first 8 units */
#define SUPPORTED_ATI_BUMP_UNITS 0xff
+/** For GL_EXT_transform_feedback */
+#define MAX_FEEDBACK_ATTRIBS 32
+
+
+
/**
* \name Mesa-specific parameters
*/
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 73126b9575..2074b32b25 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -123,6 +123,7 @@
#include "stencil.h"
#include "texcompress_s3tc.h"
#include "texstate.h"
+#include "transformfeedback.h"
#include "mtypes.h"
#include "varray.h"
#include "version.h"
@@ -560,6 +561,11 @@ _mesa_init_constants(GLcontext *ctx)
/* GL_EXT_provoking_vertex */
ctx->Const.QuadsFollowProvokingVertexConvention = GL_TRUE;
+
+ /* GL_EXT_transform_feedback */
+ ctx->Const.MaxTransformFeedbackSeparateAttribs = MAX_FEEDBACK_ATTRIBS;
+ ctx->Const.MaxTransformFeedbackSeparateComponents = 4 * MAX_FEEDBACK_ATTRIBS;
+ ctx->Const.MaxTransformFeedbackInterleavedComponents = 4 * MAX_FEEDBACK_ATTRIBS;
}
@@ -684,6 +690,7 @@ init_attrib_groups(GLcontext *ctx)
_mesa_init_shader_state( ctx );
_mesa_init_stencil( ctx );
_mesa_init_transform( ctx );
+ _mesa_init_transform_feedback( ctx );
_mesa_init_varray( ctx );
_mesa_init_viewport( ctx );
@@ -873,7 +880,7 @@ _mesa_initialize_context(GLcontext *ctx,
ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE;
}
-#ifdef FEATURE_extra_context_init
+#if FEATURE_extra_context_init
_mesa_initialize_context_extra(ctx);
#endif
@@ -969,6 +976,7 @@ _mesa_free_context_data( GLcontext *ctx )
_mesa_free_sync_data(ctx);
#endif
_mesa_free_varray_data(ctx);
+ _mesa_free_transform_feedback(ctx);
_mesa_delete_array_object(ctx, ctx->Array.DefaultArrayObj);
diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c
index 33b35e03c7..9bcfc1008a 100644
--- a/src/mesa/main/debug.c
+++ b/src/mesa/main/debug.c
@@ -85,7 +85,7 @@ void
_mesa_print_state( const char *msg, GLuint state )
{
_mesa_debug(NULL,
- "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+ "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
msg,
state,
(state & _NEW_MODELVIEW) ? "ctx->ModelView, " : "",
@@ -105,6 +105,7 @@ _mesa_print_state( const char *msg, GLuint state )
(state & _NEW_POLYGON) ? "ctx->Polygon, " : "",
(state & _NEW_POLYGONSTIPPLE) ? "ctx->PolygonStipple, " : "",
(state & _NEW_SCISSOR) ? "ctx->Scissor, " : "",
+ (state & _NEW_STENCIL) ? "ctx->Stencil, " : "",
(state & _NEW_TEXTURE) ? "ctx->Texture, " : "",
(state & _NEW_TRANSFORM) ? "ctx->Transform, " : "",
(state & _NEW_VIEWPORT) ? "ctx->Viewport, " : "",
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index 43aadb1de5..cc5fc130df 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -396,6 +396,10 @@ typedef enum
/* GL_EXT_provoking_vertex */
OPCODE_PROVOKING_VERTEX,
+ /* GL_EXT_transform_feedback */
+ OPCODE_BEGIN_TRANSFORM_FEEDBACK,
+ OPCODE_END_TRANSFORM_FEEDBACK,
+
/* The following three are meta instructions */
OPCODE_ERROR, /* raise compiled-in error */
OPCODE_CONTINUE,
@@ -6104,6 +6108,37 @@ save_ProvokingVertexEXT(GLenum mode)
}
+/** GL_EXT_transform_feedback */
+static void GLAPIENTRY
+save_BeginTransformFeedback(GLenum mode)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = alloc_instruction(ctx, OPCODE_BEGIN_TRANSFORM_FEEDBACK, 1);
+ if (n) {
+ n[1].e = mode;
+ }
+ if (ctx->ExecuteFlag) {
+ CALL_BeginTransformFeedbackEXT(ctx->Exec, (mode));
+ }
+}
+
+
+/** GL_EXT_transform_feedback */
+static void GLAPIENTRY
+save_EndTransformFeedback(void)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = alloc_instruction(ctx, OPCODE_END_TRANSFORM_FEEDBACK, 0);
+ if (ctx->ExecuteFlag) {
+ CALL_EndTransformFeedbackEXT(ctx->Exec, ());
+ }
+}
+
+
/* aka UseProgram() */
static void GLAPIENTRY
save_UseProgramObjectARB(GLhandleARB program)
@@ -7199,6 +7234,12 @@ execute_list(GLcontext *ctx, GLuint list)
case OPCODE_PROVOKING_VERTEX:
CALL_ProvokingVertexEXT(ctx->Exec, (n[1].e));
break;
+ case OPCODE_BEGIN_TRANSFORM_FEEDBACK:
+ CALL_BeginTransformFeedbackEXT(ctx->Exec, (n[1].e));
+ break;
+ case OPCODE_END_TRANSFORM_FEEDBACK:
+ CALL_EndTransformFeedbackEXT(ctx->Exec, ());
+ break;
case OPCODE_STENCIL_FUNC:
CALL_StencilFunc(ctx->Exec, (n[1].e, n[2].i, n[3].ui));
break;
@@ -9267,7 +9308,7 @@ _mesa_init_save_table(struct _glapi_table *table)
/* 299. GL_EXT_blend_equation_separate */
SET_BlendEquationSeparateEXT(table, save_BlendEquationSeparateEXT);
- /* GL_EXT_gpu_program_parmaeters */
+ /* GL_EXT_gpu_program_parameters */
#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
SET_ProgramEnvParameters4fvEXT(table, save_ProgramEnvParameters4fvEXT);
SET_ProgramLocalParameters4fvEXT(table, save_ProgramLocalParameters4fvEXT);
@@ -9282,6 +9323,12 @@ _mesa_init_save_table(struct _glapi_table *table)
/* ARB 59. GL_ARB_copy_buffer */
SET_CopyBufferSubData(table, _mesa_CopyBufferSubData); /* no dlist save */
+ /* 352. GL_EXT_transform_feedback */
+#if FEATURE_EXT_transform_feedback
+ SET_BeginTransformFeedbackEXT(table, save_BeginTransformFeedback);
+ SET_EndTransformFeedbackEXT(table, save_EndTransformFeedback);
+#endif
+
/* 364. GL_EXT_provoking_vertex */
SET_ProvokingVertexEXT(table, save_ProvokingVertexEXT);
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index f5c88a63e6..f9decc31ab 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -982,6 +982,16 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state)
ctx->Texture.CubeMapSeamless = state;
break;
+#if FEATURE_EXT_transform_feedback
+ case GL_RASTERIZER_DISCARD:
+ CHECK_EXTENSION(EXT_transform_feedback, cap);
+ if (ctx->TransformFeedback.RasterDiscard != state) {
+ ctx->TransformFeedback.RasterDiscard = state;
+ FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
+ }
+ break;
+#endif
+
default:
_mesa_error(ctx, GL_INVALID_ENUM,
"%s(0x%x)", state ? "glEnable" : "glDisable", cap);
@@ -1493,6 +1503,12 @@ _mesa_IsEnabled( GLenum cap )
CHECK_EXTENSION(ARB_seamless_cube_map);
return ctx->Texture.CubeMapSeamless;
+#if FEATURE_EXT_transform_feedback
+ case GL_RASTERIZER_DISCARD:
+ CHECK_EXTENSION(EXT_transform_feedback);
+ return ctx->TransformFeedback.RasterDiscard;
+#endif
+
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled(0x%x)", (int) cap);
return GL_FALSE;
diff --git a/src/mesa/main/enums.c b/src/mesa/main/enums.c
index 06d51d4e5c..45f6a64356 100644
--- a/src/mesa/main/enums.c
+++ b/src/mesa/main/enums.c
@@ -694,6 +694,7 @@ LONGSTRING static const char enum_string_table[] =
"GL_INTENSITY8\0"
"GL_INTENSITY8_EXT\0"
"GL_INTENSITY_EXT\0"
+ "GL_INTERLEAVED_ATTRIBS_EXT\0"
"GL_INTERPOLATE\0"
"GL_INTERPOLATE_ARB\0"
"GL_INTERPOLATE_EXT\0"
@@ -976,6 +977,9 @@ LONGSTRING static const char enum_string_table[] =
"GL_MAX_TEXTURE_UNITS_ARB\0"
"GL_MAX_TRACK_MATRICES_NV\0"
"GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV\0"
+ "GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT\0"
+ "GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT\0"
+ "GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT\0"
"GL_MAX_VARYING_FLOATS\0"
"GL_MAX_VARYING_FLOATS_ARB\0"
"GL_MAX_VERTEX_ATTRIBS\0"
@@ -1268,6 +1272,7 @@ LONGSTRING static const char enum_string_table[] =
"GL_PRIMARY_COLOR\0"
"GL_PRIMARY_COLOR_ARB\0"
"GL_PRIMARY_COLOR_EXT\0"
+ "GL_PRIMITIVES_GENERATED_EXT\0"
"GL_PROGRAM_ADDRESS_REGISTERS_ARB\0"
"GL_PROGRAM_ALU_INSTRUCTIONS_ARB\0"
"GL_PROGRAM_ATTRIBS_ARB\0"
@@ -1341,6 +1346,7 @@ LONGSTRING static const char enum_string_table[] =
"GL_QUERY_WAIT_NV\0"
"GL_R\0"
"GL_R3_G3_B2\0"
+ "GL_RASTERIZER_DISCARD_EXT\0"
"GL_RASTER_POSITION_UNCLIPPED_IBM\0"
"GL_READ_BUFFER\0"
"GL_READ_FRAMEBUFFER\0"
@@ -1471,6 +1477,7 @@ LONGSTRING static const char enum_string_table[] =
"GL_SELECTION_BUFFER_POINTER\0"
"GL_SELECTION_BUFFER_SIZE\0"
"GL_SEPARABLE_2D\0"
+ "GL_SEPARATE_ATTRIBS_EXT\0"
"GL_SEPARATE_SPECULAR_COLOR\0"
"GL_SEPARATE_SPECULAR_COLOR_EXT\0"
"GL_SET\0"
@@ -1800,6 +1807,14 @@ LONGSTRING static const char enum_string_table[] =
"GL_TRACK_MATRIX_NV\0"
"GL_TRACK_MATRIX_TRANSFORM_NV\0"
"GL_TRANSFORM_BIT\0"
+ "GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT\0"
+ "GL_TRANSFORM_FEEDBACK_BUFFER_EXT\0"
+ "GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT\0"
+ "GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT\0"
+ "GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT\0"
+ "GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT\0"
+ "GL_TRANSFORM_FEEDBACK_VARYINGS_EXT\0"
+ "GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT\0"
"GL_TRANSPOSE_COLOR_MATRIX\0"
"GL_TRANSPOSE_COLOR_MATRIX_ARB\0"
"GL_TRANSPOSE_CURRENT_MATRIX_ARB\0"
@@ -1929,7 +1944,7 @@ LONGSTRING static const char enum_string_table[] =
"GL_ZOOM_Y\0"
;
-static const enum_elt all_enums[1891] =
+static const enum_elt all_enums[1906] =
{
{ 0, 0x00000600 }, /* GL_2D */
{ 6, 0x00001407 }, /* GL_2_BYTES */
@@ -2589,1318 +2604,1333 @@ static const enum_elt all_enums[1891] =
{ 13839, 0x0000804B }, /* GL_INTENSITY8 */
{ 13853, 0x0000804B }, /* GL_INTENSITY8_EXT */
{ 13871, 0x00008049 }, /* GL_INTENSITY_EXT */
- { 13888, 0x00008575 }, /* GL_INTERPOLATE */
- { 13903, 0x00008575 }, /* GL_INTERPOLATE_ARB */
- { 13922, 0x00008575 }, /* GL_INTERPOLATE_EXT */
- { 13941, 0x00008B53 }, /* GL_INT_VEC2 */
- { 13953, 0x00008B53 }, /* GL_INT_VEC2_ARB */
- { 13969, 0x00008B54 }, /* GL_INT_VEC3 */
- { 13981, 0x00008B54 }, /* GL_INT_VEC3_ARB */
- { 13997, 0x00008B55 }, /* GL_INT_VEC4 */
- { 14009, 0x00008B55 }, /* GL_INT_VEC4_ARB */
- { 14025, 0x00000500 }, /* GL_INVALID_ENUM */
- { 14041, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION */
- { 14074, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_EXT */
- { 14111, 0x00000502 }, /* GL_INVALID_OPERATION */
- { 14132, 0x00000501 }, /* GL_INVALID_VALUE */
- { 14149, 0x0000862B }, /* GL_INVERSE_NV */
- { 14163, 0x0000862D }, /* GL_INVERSE_TRANSPOSE_NV */
- { 14187, 0x0000150A }, /* GL_INVERT */
- { 14197, 0x00001E00 }, /* GL_KEEP */
- { 14205, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION */
- { 14231, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION_EXT */
- { 14261, 0x00000406 }, /* GL_LEFT */
- { 14269, 0x00000203 }, /* GL_LEQUAL */
- { 14279, 0x00000201 }, /* GL_LESS */
- { 14287, 0x00004000 }, /* GL_LIGHT0 */
- { 14297, 0x00004001 }, /* GL_LIGHT1 */
- { 14307, 0x00004002 }, /* GL_LIGHT2 */
- { 14317, 0x00004003 }, /* GL_LIGHT3 */
- { 14327, 0x00004004 }, /* GL_LIGHT4 */
- { 14337, 0x00004005 }, /* GL_LIGHT5 */
- { 14347, 0x00004006 }, /* GL_LIGHT6 */
- { 14357, 0x00004007 }, /* GL_LIGHT7 */
- { 14367, 0x00000B50 }, /* GL_LIGHTING */
- { 14379, 0x00000040 }, /* GL_LIGHTING_BIT */
- { 14395, 0x00000B53 }, /* GL_LIGHT_MODEL_AMBIENT */
- { 14418, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL */
- { 14447, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL_EXT */
- { 14480, 0x00000B51 }, /* GL_LIGHT_MODEL_LOCAL_VIEWER */
- { 14508, 0x00000B52 }, /* GL_LIGHT_MODEL_TWO_SIDE */
- { 14532, 0x00001B01 }, /* GL_LINE */
- { 14540, 0x00002601 }, /* GL_LINEAR */
- { 14550, 0x00001208 }, /* GL_LINEAR_ATTENUATION */
- { 14572, 0x00008170 }, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */
- { 14602, 0x0000844F }, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */
- { 14633, 0x00002703 }, /* GL_LINEAR_MIPMAP_LINEAR */
- { 14657, 0x00002701 }, /* GL_LINEAR_MIPMAP_NEAREST */
- { 14682, 0x00000001 }, /* GL_LINES */
- { 14691, 0x00000004 }, /* GL_LINE_BIT */
- { 14703, 0x00000002 }, /* GL_LINE_LOOP */
- { 14716, 0x00000707 }, /* GL_LINE_RESET_TOKEN */
- { 14736, 0x00000B20 }, /* GL_LINE_SMOOTH */
- { 14751, 0x00000C52 }, /* GL_LINE_SMOOTH_HINT */
- { 14771, 0x00000B24 }, /* GL_LINE_STIPPLE */
- { 14787, 0x00000B25 }, /* GL_LINE_STIPPLE_PATTERN */
- { 14811, 0x00000B26 }, /* GL_LINE_STIPPLE_REPEAT */
- { 14834, 0x00000003 }, /* GL_LINE_STRIP */
- { 14848, 0x00000702 }, /* GL_LINE_TOKEN */
- { 14862, 0x00000B21 }, /* GL_LINE_WIDTH */
- { 14876, 0x00000B23 }, /* GL_LINE_WIDTH_GRANULARITY */
- { 14902, 0x00000B22 }, /* GL_LINE_WIDTH_RANGE */
- { 14922, 0x00008B82 }, /* GL_LINK_STATUS */
- { 14937, 0x00000B32 }, /* GL_LIST_BASE */
- { 14950, 0x00020000 }, /* GL_LIST_BIT */
- { 14962, 0x00000B33 }, /* GL_LIST_INDEX */
- { 14976, 0x00000B30 }, /* GL_LIST_MODE */
- { 14989, 0x00000101 }, /* GL_LOAD */
- { 14997, 0x00000BF1 }, /* GL_LOGIC_OP */
- { 15009, 0x00000BF0 }, /* GL_LOGIC_OP_MODE */
- { 15026, 0x00008CA1 }, /* GL_LOWER_LEFT */
- { 15040, 0x00001909 }, /* GL_LUMINANCE */
- { 15053, 0x00008041 }, /* GL_LUMINANCE12 */
- { 15068, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12 */
- { 15091, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12_EXT */
- { 15118, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4 */
- { 15140, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4_EXT */
- { 15166, 0x00008041 }, /* GL_LUMINANCE12_EXT */
- { 15185, 0x00008042 }, /* GL_LUMINANCE16 */
- { 15200, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16 */
- { 15223, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16_EXT */
- { 15250, 0x00008042 }, /* GL_LUMINANCE16_EXT */
- { 15269, 0x0000803F }, /* GL_LUMINANCE4 */
- { 15283, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4 */
- { 15304, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4_EXT */
- { 15329, 0x0000803F }, /* GL_LUMINANCE4_EXT */
- { 15347, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2 */
- { 15368, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2_EXT */
- { 15393, 0x00008040 }, /* GL_LUMINANCE8 */
- { 15407, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8 */
- { 15428, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8_EXT */
- { 15453, 0x00008040 }, /* GL_LUMINANCE8_EXT */
- { 15471, 0x0000190A }, /* GL_LUMINANCE_ALPHA */
- { 15490, 0x00000D90 }, /* GL_MAP1_COLOR_4 */
- { 15506, 0x00000DD0 }, /* GL_MAP1_GRID_DOMAIN */
- { 15526, 0x00000DD1 }, /* GL_MAP1_GRID_SEGMENTS */
- { 15548, 0x00000D91 }, /* GL_MAP1_INDEX */
- { 15562, 0x00000D92 }, /* GL_MAP1_NORMAL */
- { 15577, 0x00000D93 }, /* GL_MAP1_TEXTURE_COORD_1 */
- { 15601, 0x00000D94 }, /* GL_MAP1_TEXTURE_COORD_2 */
- { 15625, 0x00000D95 }, /* GL_MAP1_TEXTURE_COORD_3 */
- { 15649, 0x00000D96 }, /* GL_MAP1_TEXTURE_COORD_4 */
- { 15673, 0x00000D97 }, /* GL_MAP1_VERTEX_3 */
- { 15690, 0x00000D98 }, /* GL_MAP1_VERTEX_4 */
- { 15707, 0x00008660 }, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */
- { 15735, 0x0000866A }, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */
- { 15764, 0x0000866B }, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */
- { 15793, 0x0000866C }, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */
- { 15822, 0x0000866D }, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */
- { 15851, 0x0000866E }, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */
- { 15880, 0x0000866F }, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */
- { 15909, 0x00008661 }, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */
- { 15937, 0x00008662 }, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */
- { 15965, 0x00008663 }, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */
- { 15993, 0x00008664 }, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */
- { 16021, 0x00008665 }, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */
- { 16049, 0x00008666 }, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */
- { 16077, 0x00008667 }, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */
- { 16105, 0x00008668 }, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */
- { 16133, 0x00008669 }, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */
- { 16161, 0x00000DB0 }, /* GL_MAP2_COLOR_4 */
- { 16177, 0x00000DD2 }, /* GL_MAP2_GRID_DOMAIN */
- { 16197, 0x00000DD3 }, /* GL_MAP2_GRID_SEGMENTS */
- { 16219, 0x00000DB1 }, /* GL_MAP2_INDEX */
- { 16233, 0x00000DB2 }, /* GL_MAP2_NORMAL */
- { 16248, 0x00000DB3 }, /* GL_MAP2_TEXTURE_COORD_1 */
- { 16272, 0x00000DB4 }, /* GL_MAP2_TEXTURE_COORD_2 */
- { 16296, 0x00000DB5 }, /* GL_MAP2_TEXTURE_COORD_3 */
- { 16320, 0x00000DB6 }, /* GL_MAP2_TEXTURE_COORD_4 */
- { 16344, 0x00000DB7 }, /* GL_MAP2_VERTEX_3 */
- { 16361, 0x00000DB8 }, /* GL_MAP2_VERTEX_4 */
- { 16378, 0x00008670 }, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */
- { 16406, 0x0000867A }, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */
- { 16435, 0x0000867B }, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */
- { 16464, 0x0000867C }, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */
- { 16493, 0x0000867D }, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */
- { 16522, 0x0000867E }, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */
- { 16551, 0x0000867F }, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */
- { 16580, 0x00008671 }, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */
- { 16608, 0x00008672 }, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */
- { 16636, 0x00008673 }, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */
- { 16664, 0x00008674 }, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */
- { 16692, 0x00008675 }, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */
- { 16720, 0x00008676 }, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */
- { 16748, 0x00008677 }, /* GL_MAP2_VERTEX_ATTRIB7_4_NV */
- { 16776, 0x00008678 }, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */
- { 16804, 0x00008679 }, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */
- { 16832, 0x00000D10 }, /* GL_MAP_COLOR */
- { 16845, 0x00000010 }, /* GL_MAP_FLUSH_EXPLICIT_BIT */
- { 16871, 0x00000008 }, /* GL_MAP_INVALIDATE_BUFFER_BIT */
- { 16900, 0x00000004 }, /* GL_MAP_INVALIDATE_RANGE_BIT */
- { 16928, 0x00000001 }, /* GL_MAP_READ_BIT */
- { 16944, 0x00000D11 }, /* GL_MAP_STENCIL */
- { 16959, 0x00000020 }, /* GL_MAP_UNSYNCHRONIZED_BIT */
- { 16985, 0x00000002 }, /* GL_MAP_WRITE_BIT */
- { 17002, 0x000088C0 }, /* GL_MATRIX0_ARB */
- { 17017, 0x00008630 }, /* GL_MATRIX0_NV */
- { 17031, 0x000088CA }, /* GL_MATRIX10_ARB */
- { 17047, 0x000088CB }, /* GL_MATRIX11_ARB */
- { 17063, 0x000088CC }, /* GL_MATRIX12_ARB */
- { 17079, 0x000088CD }, /* GL_MATRIX13_ARB */
- { 17095, 0x000088CE }, /* GL_MATRIX14_ARB */
- { 17111, 0x000088CF }, /* GL_MATRIX15_ARB */
- { 17127, 0x000088D0 }, /* GL_MATRIX16_ARB */
- { 17143, 0x000088D1 }, /* GL_MATRIX17_ARB */
- { 17159, 0x000088D2 }, /* GL_MATRIX18_ARB */
- { 17175, 0x000088D3 }, /* GL_MATRIX19_ARB */
- { 17191, 0x000088C1 }, /* GL_MATRIX1_ARB */
- { 17206, 0x00008631 }, /* GL_MATRIX1_NV */
- { 17220, 0x000088D4 }, /* GL_MATRIX20_ARB */
- { 17236, 0x000088D5 }, /* GL_MATRIX21_ARB */
- { 17252, 0x000088D6 }, /* GL_MATRIX22_ARB */
- { 17268, 0x000088D7 }, /* GL_MATRIX23_ARB */
- { 17284, 0x000088D8 }, /* GL_MATRIX24_ARB */
- { 17300, 0x000088D9 }, /* GL_MATRIX25_ARB */
- { 17316, 0x000088DA }, /* GL_MATRIX26_ARB */
- { 17332, 0x000088DB }, /* GL_MATRIX27_ARB */
- { 17348, 0x000088DC }, /* GL_MATRIX28_ARB */
- { 17364, 0x000088DD }, /* GL_MATRIX29_ARB */
- { 17380, 0x000088C2 }, /* GL_MATRIX2_ARB */
- { 17395, 0x00008632 }, /* GL_MATRIX2_NV */
- { 17409, 0x000088DE }, /* GL_MATRIX30_ARB */
- { 17425, 0x000088DF }, /* GL_MATRIX31_ARB */
- { 17441, 0x000088C3 }, /* GL_MATRIX3_ARB */
- { 17456, 0x00008633 }, /* GL_MATRIX3_NV */
- { 17470, 0x000088C4 }, /* GL_MATRIX4_ARB */
- { 17485, 0x00008634 }, /* GL_MATRIX4_NV */
- { 17499, 0x000088C5 }, /* GL_MATRIX5_ARB */
- { 17514, 0x00008635 }, /* GL_MATRIX5_NV */
- { 17528, 0x000088C6 }, /* GL_MATRIX6_ARB */
- { 17543, 0x00008636 }, /* GL_MATRIX6_NV */
- { 17557, 0x000088C7 }, /* GL_MATRIX7_ARB */
- { 17572, 0x00008637 }, /* GL_MATRIX7_NV */
- { 17586, 0x000088C8 }, /* GL_MATRIX8_ARB */
- { 17601, 0x000088C9 }, /* GL_MATRIX9_ARB */
- { 17616, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_ARB */
- { 17642, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */
- { 17676, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */
- { 17707, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */
- { 17740, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */
- { 17771, 0x00000BA0 }, /* GL_MATRIX_MODE */
- { 17786, 0x00008840 }, /* GL_MATRIX_PALETTE_ARB */
- { 17808, 0x00008008 }, /* GL_MAX */
- { 17815, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE */
- { 17838, 0x000088FF }, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */
- { 17870, 0x00000D35 }, /* GL_MAX_ATTRIB_STACK_DEPTH */
- { 17896, 0x00000D3B }, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */
- { 17929, 0x00008177 }, /* GL_MAX_CLIPMAP_DEPTH_SGIX */
- { 17955, 0x00008178 }, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */
- { 17989, 0x00000D32 }, /* GL_MAX_CLIP_PLANES */
- { 18008, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS */
- { 18033, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS_EXT */
- { 18062, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */
- { 18094, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI */
- { 18130, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */
- { 18166, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB */
- { 18206, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT */
- { 18232, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT_EXT */
- { 18262, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH */
- { 18287, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH_EXT */
- { 18316, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */
- { 18345, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB */
- { 18378, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS */
- { 18398, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ARB */
- { 18422, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ATI */
- { 18446, 0x000080E9 }, /* GL_MAX_ELEMENTS_INDICES */
- { 18470, 0x000080E8 }, /* GL_MAX_ELEMENTS_VERTICES */
- { 18495, 0x00000D30 }, /* GL_MAX_EVAL_ORDER */
- { 18513, 0x00008008 }, /* GL_MAX_EXT */
- { 18524, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */
- { 18559, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB */
- { 18598, 0x00000D31 }, /* GL_MAX_LIGHTS */
- { 18612, 0x00000B31 }, /* GL_MAX_LIST_NESTING */
- { 18632, 0x00008841 }, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */
- { 18670, 0x00000D36 }, /* GL_MAX_MODELVIEW_STACK_DEPTH */
- { 18699, 0x00000D37 }, /* GL_MAX_NAME_STACK_DEPTH */
- { 18723, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_ARB */
- { 18751, 0x00000D34 }, /* GL_MAX_PIXEL_MAP_TABLE */
- { 18774, 0x000088B1 }, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */
- { 18811, 0x0000880B }, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */
- { 18847, 0x000088AD }, /* GL_MAX_PROGRAM_ATTRIBS_ARB */
- { 18874, 0x000088F5 }, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */
- { 18903, 0x000088B5 }, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */
- { 18937, 0x000088F4 }, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */
- { 18973, 0x000088F6 }, /* GL_MAX_PROGRAM_IF_DEPTH_NV */
- { 19000, 0x000088A1 }, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */
- { 19032, 0x000088B4 }, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */
- { 19068, 0x000088F8 }, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */
- { 19097, 0x000088F7 }, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */
- { 19126, 0x0000862F }, /* GL_MAX_PROGRAM_MATRICES_ARB */
- { 19154, 0x0000862E }, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */
- { 19192, 0x000088B3 }, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
- { 19236, 0x0000880E }, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
- { 19279, 0x000088AF }, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */
- { 19313, 0x000088A3 }, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
- { 19352, 0x000088AB }, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */
- { 19389, 0x000088A7 }, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */
- { 19427, 0x00008810 }, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
- { 19470, 0x0000880F }, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
- { 19513, 0x000088A9 }, /* GL_MAX_PROGRAM_PARAMETERS_ARB */
- { 19543, 0x000088A5 }, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */
- { 19574, 0x0000880D }, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */
- { 19610, 0x0000880C }, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */
- { 19646, 0x00000D38 }, /* GL_MAX_PROJECTION_STACK_DEPTH */
- { 19676, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */
- { 19710, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_NV */
- { 19743, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE */
- { 19768, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_EXT */
- { 19797, 0x00008D57 }, /* GL_MAX_SAMPLES */
- { 19812, 0x00008D57 }, /* GL_MAX_SAMPLES_EXT */
- { 19831, 0x00009111 }, /* GL_MAX_SERVER_WAIT_TIMEOUT */
- { 19858, 0x00008504 }, /* GL_MAX_SHININESS_NV */
- { 19878, 0x00008505 }, /* GL_MAX_SPOT_EXPONENT_NV */
- { 19902, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS */
- { 19924, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS_ARB */
- { 19950, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS */
- { 19977, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS_ARB */
- { 20008, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS */
- { 20032, 0x000084FF }, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */
- { 20066, 0x00000D33 }, /* GL_MAX_TEXTURE_SIZE */
- { 20086, 0x00000D39 }, /* GL_MAX_TEXTURE_STACK_DEPTH */
- { 20113, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS */
- { 20134, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS_ARB */
- { 20159, 0x0000862F }, /* GL_MAX_TRACK_MATRICES_NV */
- { 20184, 0x0000862E }, /* GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV */
- { 20219, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS */
- { 20241, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS_ARB */
- { 20267, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS */
- { 20289, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS_ARB */
- { 20315, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */
- { 20349, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */
- { 20387, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */
- { 20420, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB */
- { 20457, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_ARB */
- { 20481, 0x00000D3A }, /* GL_MAX_VIEWPORT_DIMS */
- { 20502, 0x00008007 }, /* GL_MIN */
- { 20509, 0x0000802E }, /* GL_MINMAX */
- { 20519, 0x0000802E }, /* GL_MINMAX_EXT */
- { 20533, 0x0000802F }, /* GL_MINMAX_FORMAT */
- { 20550, 0x0000802F }, /* GL_MINMAX_FORMAT_EXT */
- { 20571, 0x00008030 }, /* GL_MINMAX_SINK */
- { 20586, 0x00008030 }, /* GL_MINMAX_SINK_EXT */
- { 20605, 0x00008007 }, /* GL_MIN_EXT */
- { 20616, 0x00008370 }, /* GL_MIRRORED_REPEAT */
- { 20635, 0x00008370 }, /* GL_MIRRORED_REPEAT_ARB */
- { 20658, 0x00008370 }, /* GL_MIRRORED_REPEAT_IBM */
- { 20681, 0x00008742 }, /* GL_MIRROR_CLAMP_ATI */
- { 20701, 0x00008742 }, /* GL_MIRROR_CLAMP_EXT */
- { 20721, 0x00008912 }, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */
- { 20751, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_ATI */
- { 20779, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */
- { 20807, 0x00001700 }, /* GL_MODELVIEW */
- { 20820, 0x00001700 }, /* GL_MODELVIEW0_ARB */
- { 20838, 0x0000872A }, /* GL_MODELVIEW10_ARB */
- { 20857, 0x0000872B }, /* GL_MODELVIEW11_ARB */
- { 20876, 0x0000872C }, /* GL_MODELVIEW12_ARB */
- { 20895, 0x0000872D }, /* GL_MODELVIEW13_ARB */
- { 20914, 0x0000872E }, /* GL_MODELVIEW14_ARB */
- { 20933, 0x0000872F }, /* GL_MODELVIEW15_ARB */
- { 20952, 0x00008730 }, /* GL_MODELVIEW16_ARB */
- { 20971, 0x00008731 }, /* GL_MODELVIEW17_ARB */
- { 20990, 0x00008732 }, /* GL_MODELVIEW18_ARB */
- { 21009, 0x00008733 }, /* GL_MODELVIEW19_ARB */
- { 21028, 0x0000850A }, /* GL_MODELVIEW1_ARB */
- { 21046, 0x00008734 }, /* GL_MODELVIEW20_ARB */
- { 21065, 0x00008735 }, /* GL_MODELVIEW21_ARB */
- { 21084, 0x00008736 }, /* GL_MODELVIEW22_ARB */
- { 21103, 0x00008737 }, /* GL_MODELVIEW23_ARB */
- { 21122, 0x00008738 }, /* GL_MODELVIEW24_ARB */
- { 21141, 0x00008739 }, /* GL_MODELVIEW25_ARB */
- { 21160, 0x0000873A }, /* GL_MODELVIEW26_ARB */
- { 21179, 0x0000873B }, /* GL_MODELVIEW27_ARB */
- { 21198, 0x0000873C }, /* GL_MODELVIEW28_ARB */
- { 21217, 0x0000873D }, /* GL_MODELVIEW29_ARB */
- { 21236, 0x00008722 }, /* GL_MODELVIEW2_ARB */
- { 21254, 0x0000873E }, /* GL_MODELVIEW30_ARB */
- { 21273, 0x0000873F }, /* GL_MODELVIEW31_ARB */
- { 21292, 0x00008723 }, /* GL_MODELVIEW3_ARB */
- { 21310, 0x00008724 }, /* GL_MODELVIEW4_ARB */
- { 21328, 0x00008725 }, /* GL_MODELVIEW5_ARB */
- { 21346, 0x00008726 }, /* GL_MODELVIEW6_ARB */
- { 21364, 0x00008727 }, /* GL_MODELVIEW7_ARB */
- { 21382, 0x00008728 }, /* GL_MODELVIEW8_ARB */
- { 21400, 0x00008729 }, /* GL_MODELVIEW9_ARB */
- { 21418, 0x00000BA6 }, /* GL_MODELVIEW_MATRIX */
- { 21438, 0x00008629 }, /* GL_MODELVIEW_PROJECTION_NV */
- { 21465, 0x00000BA3 }, /* GL_MODELVIEW_STACK_DEPTH */
- { 21490, 0x00002100 }, /* GL_MODULATE */
- { 21502, 0x00008744 }, /* GL_MODULATE_ADD_ATI */
- { 21522, 0x00008745 }, /* GL_MODULATE_SIGNED_ADD_ATI */
- { 21549, 0x00008746 }, /* GL_MODULATE_SUBTRACT_ATI */
- { 21574, 0x00000103 }, /* GL_MULT */
- { 21582, 0x0000809D }, /* GL_MULTISAMPLE */
- { 21597, 0x000086B2 }, /* GL_MULTISAMPLE_3DFX */
- { 21617, 0x0000809D }, /* GL_MULTISAMPLE_ARB */
- { 21636, 0x20000000 }, /* GL_MULTISAMPLE_BIT */
- { 21655, 0x20000000 }, /* GL_MULTISAMPLE_BIT_3DFX */
- { 21679, 0x20000000 }, /* GL_MULTISAMPLE_BIT_ARB */
- { 21702, 0x00008534 }, /* GL_MULTISAMPLE_FILTER_HINT_NV */
- { 21732, 0x00002A25 }, /* GL_N3F_V3F */
- { 21743, 0x00000D70 }, /* GL_NAME_STACK_DEPTH */
- { 21763, 0x0000150E }, /* GL_NAND */
- { 21771, 0x00002600 }, /* GL_NEAREST */
- { 21782, 0x0000844E }, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */
- { 21813, 0x0000844D }, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */
- { 21845, 0x00002702 }, /* GL_NEAREST_MIPMAP_LINEAR */
- { 21870, 0x00002700 }, /* GL_NEAREST_MIPMAP_NEAREST */
- { 21896, 0x00000200 }, /* GL_NEVER */
- { 21905, 0x00001102 }, /* GL_NICEST */
- { 21915, 0x00000000 }, /* GL_NONE */
- { 21923, 0x00001505 }, /* GL_NOOP */
- { 21931, 0x00001508 }, /* GL_NOR */
- { 21938, 0x00000BA1 }, /* GL_NORMALIZE */
- { 21951, 0x00008075 }, /* GL_NORMAL_ARRAY */
- { 21967, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING */
- { 21998, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING_ARB */
- { 22033, 0x0000808F }, /* GL_NORMAL_ARRAY_POINTER */
- { 22057, 0x0000807F }, /* GL_NORMAL_ARRAY_STRIDE */
- { 22080, 0x0000807E }, /* GL_NORMAL_ARRAY_TYPE */
- { 22101, 0x00008511 }, /* GL_NORMAL_MAP */
- { 22115, 0x00008511 }, /* GL_NORMAL_MAP_ARB */
- { 22133, 0x00008511 }, /* GL_NORMAL_MAP_NV */
- { 22150, 0x00000205 }, /* GL_NOTEQUAL */
- { 22162, 0x00000000 }, /* GL_NO_ERROR */
- { 22174, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */
- { 22208, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB */
- { 22246, 0x00008B89 }, /* GL_OBJECT_ACTIVE_ATTRIBUTES_ARB */
- { 22278, 0x00008B8A }, /* GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB */
- { 22320, 0x00008B86 }, /* GL_OBJECT_ACTIVE_UNIFORMS_ARB */
- { 22350, 0x00008B87 }, /* GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB */
- { 22390, 0x00008B85 }, /* GL_OBJECT_ATTACHED_OBJECTS_ARB */
- { 22421, 0x00008B81 }, /* GL_OBJECT_COMPILE_STATUS_ARB */
- { 22450, 0x00008B80 }, /* GL_OBJECT_DELETE_STATUS_ARB */
- { 22478, 0x00008B84 }, /* GL_OBJECT_INFO_LOG_LENGTH_ARB */
- { 22508, 0x00002401 }, /* GL_OBJECT_LINEAR */
- { 22525, 0x00008B82 }, /* GL_OBJECT_LINK_STATUS_ARB */
- { 22551, 0x00002501 }, /* GL_OBJECT_PLANE */
- { 22567, 0x00008B88 }, /* GL_OBJECT_SHADER_SOURCE_LENGTH_ARB */
- { 22602, 0x00008B4F }, /* GL_OBJECT_SUBTYPE_ARB */
- { 22624, 0x00009112 }, /* GL_OBJECT_TYPE */
- { 22639, 0x00008B4E }, /* GL_OBJECT_TYPE_ARB */
- { 22658, 0x00008B83 }, /* GL_OBJECT_VALIDATE_STATUS_ARB */
- { 22688, 0x00008165 }, /* GL_OCCLUSION_TEST_HP */
- { 22709, 0x00008166 }, /* GL_OCCLUSION_TEST_RESULT_HP */
- { 22737, 0x00000001 }, /* GL_ONE */
- { 22744, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA */
- { 22772, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA_EXT */
- { 22804, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR */
- { 22832, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR_EXT */
- { 22864, 0x00000305 }, /* GL_ONE_MINUS_DST_ALPHA */
- { 22887, 0x00000307 }, /* GL_ONE_MINUS_DST_COLOR */
- { 22910, 0x00000303 }, /* GL_ONE_MINUS_SRC_ALPHA */
- { 22933, 0x00000301 }, /* GL_ONE_MINUS_SRC_COLOR */
- { 22956, 0x00008598 }, /* GL_OPERAND0_ALPHA */
- { 22974, 0x00008598 }, /* GL_OPERAND0_ALPHA_ARB */
- { 22996, 0x00008598 }, /* GL_OPERAND0_ALPHA_EXT */
- { 23018, 0x00008590 }, /* GL_OPERAND0_RGB */
- { 23034, 0x00008590 }, /* GL_OPERAND0_RGB_ARB */
- { 23054, 0x00008590 }, /* GL_OPERAND0_RGB_EXT */
- { 23074, 0x00008599 }, /* GL_OPERAND1_ALPHA */
- { 23092, 0x00008599 }, /* GL_OPERAND1_ALPHA_ARB */
- { 23114, 0x00008599 }, /* GL_OPERAND1_ALPHA_EXT */
- { 23136, 0x00008591 }, /* GL_OPERAND1_RGB */
- { 23152, 0x00008591 }, /* GL_OPERAND1_RGB_ARB */
- { 23172, 0x00008591 }, /* GL_OPERAND1_RGB_EXT */
- { 23192, 0x0000859A }, /* GL_OPERAND2_ALPHA */
- { 23210, 0x0000859A }, /* GL_OPERAND2_ALPHA_ARB */
- { 23232, 0x0000859A }, /* GL_OPERAND2_ALPHA_EXT */
- { 23254, 0x00008592 }, /* GL_OPERAND2_RGB */
- { 23270, 0x00008592 }, /* GL_OPERAND2_RGB_ARB */
- { 23290, 0x00008592 }, /* GL_OPERAND2_RGB_EXT */
- { 23310, 0x0000859B }, /* GL_OPERAND3_ALPHA_NV */
- { 23331, 0x00008593 }, /* GL_OPERAND3_RGB_NV */
- { 23350, 0x00001507 }, /* GL_OR */
- { 23356, 0x00000A01 }, /* GL_ORDER */
- { 23365, 0x0000150D }, /* GL_OR_INVERTED */
- { 23380, 0x0000150B }, /* GL_OR_REVERSE */
- { 23394, 0x00000505 }, /* GL_OUT_OF_MEMORY */
- { 23411, 0x00000D05 }, /* GL_PACK_ALIGNMENT */
- { 23429, 0x0000806C }, /* GL_PACK_IMAGE_HEIGHT */
- { 23450, 0x00008758 }, /* GL_PACK_INVERT_MESA */
- { 23470, 0x00000D01 }, /* GL_PACK_LSB_FIRST */
- { 23488, 0x00000D02 }, /* GL_PACK_ROW_LENGTH */
- { 23507, 0x0000806B }, /* GL_PACK_SKIP_IMAGES */
- { 23527, 0x00000D04 }, /* GL_PACK_SKIP_PIXELS */
- { 23547, 0x00000D03 }, /* GL_PACK_SKIP_ROWS */
- { 23565, 0x00000D00 }, /* GL_PACK_SWAP_BYTES */
- { 23584, 0x00008B92 }, /* GL_PALETTE4_R5_G6_B5_OES */
- { 23609, 0x00008B94 }, /* GL_PALETTE4_RGB5_A1_OES */
- { 23633, 0x00008B90 }, /* GL_PALETTE4_RGB8_OES */
- { 23654, 0x00008B93 }, /* GL_PALETTE4_RGBA4_OES */
- { 23676, 0x00008B91 }, /* GL_PALETTE4_RGBA8_OES */
- { 23698, 0x00008B97 }, /* GL_PALETTE8_R5_G6_B5_OES */
- { 23723, 0x00008B99 }, /* GL_PALETTE8_RGB5_A1_OES */
- { 23747, 0x00008B95 }, /* GL_PALETTE8_RGB8_OES */
- { 23768, 0x00008B98 }, /* GL_PALETTE8_RGBA4_OES */
- { 23790, 0x00008B96 }, /* GL_PALETTE8_RGBA8_OES */
- { 23812, 0x00000700 }, /* GL_PASS_THROUGH_TOKEN */
- { 23834, 0x00000C50 }, /* GL_PERSPECTIVE_CORRECTION_HINT */
- { 23865, 0x00000C79 }, /* GL_PIXEL_MAP_A_TO_A */
- { 23885, 0x00000CB9 }, /* GL_PIXEL_MAP_A_TO_A_SIZE */
- { 23910, 0x00000C78 }, /* GL_PIXEL_MAP_B_TO_B */
- { 23930, 0x00000CB8 }, /* GL_PIXEL_MAP_B_TO_B_SIZE */
- { 23955, 0x00000C77 }, /* GL_PIXEL_MAP_G_TO_G */
- { 23975, 0x00000CB7 }, /* GL_PIXEL_MAP_G_TO_G_SIZE */
- { 24000, 0x00000C75 }, /* GL_PIXEL_MAP_I_TO_A */
- { 24020, 0x00000CB5 }, /* GL_PIXEL_MAP_I_TO_A_SIZE */
- { 24045, 0x00000C74 }, /* GL_PIXEL_MAP_I_TO_B */
- { 24065, 0x00000CB4 }, /* GL_PIXEL_MAP_I_TO_B_SIZE */
- { 24090, 0x00000C73 }, /* GL_PIXEL_MAP_I_TO_G */
- { 24110, 0x00000CB3 }, /* GL_PIXEL_MAP_I_TO_G_SIZE */
- { 24135, 0x00000C70 }, /* GL_PIXEL_MAP_I_TO_I */
- { 24155, 0x00000CB0 }, /* GL_PIXEL_MAP_I_TO_I_SIZE */
- { 24180, 0x00000C72 }, /* GL_PIXEL_MAP_I_TO_R */
- { 24200, 0x00000CB2 }, /* GL_PIXEL_MAP_I_TO_R_SIZE */
- { 24225, 0x00000C76 }, /* GL_PIXEL_MAP_R_TO_R */
- { 24245, 0x00000CB6 }, /* GL_PIXEL_MAP_R_TO_R_SIZE */
- { 24270, 0x00000C71 }, /* GL_PIXEL_MAP_S_TO_S */
- { 24290, 0x00000CB1 }, /* GL_PIXEL_MAP_S_TO_S_SIZE */
- { 24315, 0x00000020 }, /* GL_PIXEL_MODE_BIT */
- { 24333, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER */
- { 24354, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING */
- { 24383, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING_EXT */
- { 24416, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER_EXT */
- { 24441, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER */
- { 24464, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING */
- { 24495, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING_EXT */
- { 24530, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER_EXT */
- { 24557, 0x00001B00 }, /* GL_POINT */
- { 24566, 0x00000000 }, /* GL_POINTS */
- { 24576, 0x00000002 }, /* GL_POINT_BIT */
- { 24589, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION */
- { 24619, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_ARB */
- { 24653, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_EXT */
- { 24687, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_SGIS */
- { 24722, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE */
- { 24751, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_ARB */
- { 24784, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_EXT */
- { 24817, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_SGIS */
- { 24851, 0x00000B11 }, /* GL_POINT_SIZE */
- { 24865, 0x00000B13 }, /* GL_POINT_SIZE_GRANULARITY */
- { 24891, 0x00008127 }, /* GL_POINT_SIZE_MAX */
- { 24909, 0x00008127 }, /* GL_POINT_SIZE_MAX_ARB */
- { 24931, 0x00008127 }, /* GL_POINT_SIZE_MAX_EXT */
- { 24953, 0x00008127 }, /* GL_POINT_SIZE_MAX_SGIS */
- { 24976, 0x00008126 }, /* GL_POINT_SIZE_MIN */
- { 24994, 0x00008126 }, /* GL_POINT_SIZE_MIN_ARB */
- { 25016, 0x00008126 }, /* GL_POINT_SIZE_MIN_EXT */
- { 25038, 0x00008126 }, /* GL_POINT_SIZE_MIN_SGIS */
- { 25061, 0x00000B12 }, /* GL_POINT_SIZE_RANGE */
- { 25081, 0x00000B10 }, /* GL_POINT_SMOOTH */
- { 25097, 0x00000C51 }, /* GL_POINT_SMOOTH_HINT */
- { 25118, 0x00008861 }, /* GL_POINT_SPRITE */
- { 25134, 0x00008861 }, /* GL_POINT_SPRITE_ARB */
- { 25154, 0x00008CA0 }, /* GL_POINT_SPRITE_COORD_ORIGIN */
- { 25183, 0x00008861 }, /* GL_POINT_SPRITE_NV */
- { 25202, 0x00008863 }, /* GL_POINT_SPRITE_R_MODE_NV */
- { 25228, 0x00000701 }, /* GL_POINT_TOKEN */
- { 25243, 0x00000009 }, /* GL_POLYGON */
- { 25254, 0x00000008 }, /* GL_POLYGON_BIT */
- { 25269, 0x00000B40 }, /* GL_POLYGON_MODE */
- { 25285, 0x00008039 }, /* GL_POLYGON_OFFSET_BIAS */
- { 25308, 0x00008038 }, /* GL_POLYGON_OFFSET_FACTOR */
- { 25333, 0x00008037 }, /* GL_POLYGON_OFFSET_FILL */
- { 25356, 0x00002A02 }, /* GL_POLYGON_OFFSET_LINE */
- { 25379, 0x00002A01 }, /* GL_POLYGON_OFFSET_POINT */
- { 25403, 0x00002A00 }, /* GL_POLYGON_OFFSET_UNITS */
- { 25427, 0x00000B41 }, /* GL_POLYGON_SMOOTH */
- { 25445, 0x00000C53 }, /* GL_POLYGON_SMOOTH_HINT */
- { 25468, 0x00000B42 }, /* GL_POLYGON_STIPPLE */
- { 25487, 0x00000010 }, /* GL_POLYGON_STIPPLE_BIT */
- { 25510, 0x00000703 }, /* GL_POLYGON_TOKEN */
- { 25527, 0x00001203 }, /* GL_POSITION */
- { 25539, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */
- { 25571, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI */
- { 25607, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */
- { 25640, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI */
- { 25677, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */
- { 25708, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI */
- { 25743, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */
- { 25775, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI */
- { 25811, 0x000080D2 }, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */
- { 25844, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */
- { 25876, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI */
- { 25912, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */
- { 25945, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI */
- { 25982, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS */
- { 26012, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS_SGI */
- { 26046, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE */
- { 26077, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE_SGI */
- { 26112, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS */
- { 26143, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS_EXT */
- { 26178, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE */
- { 26210, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE_EXT */
- { 26246, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS */
- { 26276, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS_EXT */
- { 26310, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE */
- { 26341, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE_EXT */
- { 26376, 0x000080D1 }, /* GL_POST_CONVOLUTION_COLOR_TABLE */
- { 26408, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS */
- { 26439, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS_EXT */
- { 26474, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE */
- { 26506, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE_EXT */
- { 26542, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS */
- { 26571, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS_EXT */
- { 26604, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE */
- { 26634, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE_EXT */
- { 26668, 0x0000817B }, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */
- { 26707, 0x00008179 }, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */
- { 26740, 0x0000817C }, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */
- { 26780, 0x0000817A }, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */
- { 26814, 0x00008578 }, /* GL_PREVIOUS */
- { 26826, 0x00008578 }, /* GL_PREVIOUS_ARB */
- { 26842, 0x00008578 }, /* GL_PREVIOUS_EXT */
- { 26858, 0x00008577 }, /* GL_PRIMARY_COLOR */
- { 26875, 0x00008577 }, /* GL_PRIMARY_COLOR_ARB */
- { 26896, 0x00008577 }, /* GL_PRIMARY_COLOR_EXT */
- { 26917, 0x000088B0 }, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */
- { 26950, 0x00008805 }, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */
- { 26982, 0x000088AC }, /* GL_PROGRAM_ATTRIBS_ARB */
- { 27005, 0x00008677 }, /* GL_PROGRAM_BINDING_ARB */
- { 27028, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_ARB */
- { 27058, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_NV */
- { 27087, 0x00008874 }, /* GL_PROGRAM_ERROR_STRING_ARB */
- { 27115, 0x00008876 }, /* GL_PROGRAM_FORMAT_ARB */
- { 27137, 0x00008875 }, /* GL_PROGRAM_FORMAT_ASCII_ARB */
- { 27165, 0x000088A0 }, /* GL_PROGRAM_INSTRUCTIONS_ARB */
- { 27193, 0x00008627 }, /* GL_PROGRAM_LENGTH_ARB */
- { 27215, 0x00008627 }, /* GL_PROGRAM_LENGTH_NV */
- { 27236, 0x000088B2 }, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
- { 27276, 0x00008808 }, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
- { 27315, 0x000088AE }, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */
- { 27345, 0x000088A2 }, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
- { 27380, 0x000088AA }, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */
- { 27413, 0x000088A6 }, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */
- { 27447, 0x0000880A }, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
- { 27486, 0x00008809 }, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
- { 27525, 0x00008B40 }, /* GL_PROGRAM_OBJECT_ARB */
- { 27547, 0x000088A8 }, /* GL_PROGRAM_PARAMETERS_ARB */
- { 27573, 0x00008644 }, /* GL_PROGRAM_PARAMETER_NV */
- { 27597, 0x00008647 }, /* GL_PROGRAM_RESIDENT_NV */
- { 27620, 0x00008628 }, /* GL_PROGRAM_STRING_ARB */
- { 27642, 0x00008628 }, /* GL_PROGRAM_STRING_NV */
- { 27663, 0x00008646 }, /* GL_PROGRAM_TARGET_NV */
- { 27684, 0x000088A4 }, /* GL_PROGRAM_TEMPORARIES_ARB */
- { 27711, 0x00008807 }, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */
- { 27743, 0x00008806 }, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */
- { 27775, 0x000088B6 }, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */
- { 27810, 0x00001701 }, /* GL_PROJECTION */
- { 27824, 0x00000BA7 }, /* GL_PROJECTION_MATRIX */
- { 27845, 0x00000BA4 }, /* GL_PROJECTION_STACK_DEPTH */
- { 27871, 0x00008E4F }, /* GL_PROVOKING_VERTEX */
- { 27891, 0x00008E4F }, /* GL_PROVOKING_VERTEX_EXT */
- { 27915, 0x000080D3 }, /* GL_PROXY_COLOR_TABLE */
- { 27936, 0x00008025 }, /* GL_PROXY_HISTOGRAM */
- { 27955, 0x00008025 }, /* GL_PROXY_HISTOGRAM_EXT */
- { 27978, 0x000080D5 }, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */
- { 28017, 0x000080D4 }, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */
- { 28055, 0x00008063 }, /* GL_PROXY_TEXTURE_1D */
- { 28075, 0x00008C19 }, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */
- { 28105, 0x00008063 }, /* GL_PROXY_TEXTURE_1D_EXT */
- { 28129, 0x00008064 }, /* GL_PROXY_TEXTURE_2D */
- { 28149, 0x00008C1B }, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */
- { 28179, 0x00008064 }, /* GL_PROXY_TEXTURE_2D_EXT */
- { 28203, 0x00008070 }, /* GL_PROXY_TEXTURE_3D */
- { 28223, 0x000080BD }, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */
- { 28256, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP */
- { 28282, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP_ARB */
- { 28312, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */
- { 28343, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_NV */
- { 28373, 0x00008A1D }, /* GL_PURGEABLE_APPLE */
- { 28392, 0x00002003 }, /* GL_Q */
- { 28397, 0x00001209 }, /* GL_QUADRATIC_ATTENUATION */
- { 28422, 0x00000007 }, /* GL_QUADS */
- { 28431, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */
- { 28475, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT */
- { 28523, 0x00008614 }, /* GL_QUAD_MESH_SUN */
- { 28540, 0x00000008 }, /* GL_QUAD_STRIP */
- { 28554, 0x00008E16 }, /* GL_QUERY_BY_REGION_NO_WAIT_NV */
- { 28584, 0x00008E15 }, /* GL_QUERY_BY_REGION_WAIT_NV */
- { 28611, 0x00008864 }, /* GL_QUERY_COUNTER_BITS */
- { 28633, 0x00008864 }, /* GL_QUERY_COUNTER_BITS_ARB */
- { 28659, 0x00008E14 }, /* GL_QUERY_NO_WAIT_NV */
- { 28679, 0x00008866 }, /* GL_QUERY_RESULT */
- { 28695, 0x00008866 }, /* GL_QUERY_RESULT_ARB */
- { 28715, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE */
- { 28741, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE_ARB */
- { 28771, 0x00008E13 }, /* GL_QUERY_WAIT_NV */
- { 28788, 0x00002002 }, /* GL_R */
- { 28793, 0x00002A10 }, /* GL_R3_G3_B2 */
- { 28805, 0x00019262 }, /* GL_RASTER_POSITION_UNCLIPPED_IBM */
- { 28838, 0x00000C02 }, /* GL_READ_BUFFER */
- { 28853, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER */
- { 28873, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING */
- { 28901, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING_EXT */
- { 28933, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER_EXT */
- { 28957, 0x000088B8 }, /* GL_READ_ONLY */
- { 28970, 0x000088B8 }, /* GL_READ_ONLY_ARB */
- { 28987, 0x000088BA }, /* GL_READ_WRITE */
- { 29001, 0x000088BA }, /* GL_READ_WRITE_ARB */
- { 29019, 0x00001903 }, /* GL_RED */
- { 29026, 0x00008016 }, /* GL_REDUCE */
- { 29036, 0x00008016 }, /* GL_REDUCE_EXT */
- { 29050, 0x00000D15 }, /* GL_RED_BIAS */
- { 29062, 0x00000D52 }, /* GL_RED_BITS */
- { 29074, 0x00000D14 }, /* GL_RED_SCALE */
- { 29087, 0x00008512 }, /* GL_REFLECTION_MAP */
- { 29105, 0x00008512 }, /* GL_REFLECTION_MAP_ARB */
- { 29127, 0x00008512 }, /* GL_REFLECTION_MAP_NV */
- { 29148, 0x00008A19 }, /* GL_RELEASED_APPLE */
- { 29166, 0x00001C00 }, /* GL_RENDER */
- { 29176, 0x00008D41 }, /* GL_RENDERBUFFER */
- { 29192, 0x00008D53 }, /* GL_RENDERBUFFER_ALPHA_SIZE */
- { 29219, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING */
- { 29243, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_EXT */
- { 29271, 0x00008D52 }, /* GL_RENDERBUFFER_BLUE_SIZE */
- { 29297, 0x00008D54 }, /* GL_RENDERBUFFER_DEPTH_SIZE */
- { 29324, 0x00008D41 }, /* GL_RENDERBUFFER_EXT */
- { 29344, 0x00008D51 }, /* GL_RENDERBUFFER_GREEN_SIZE */
- { 29371, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT */
- { 29394, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_EXT */
- { 29421, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT */
- { 29453, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_EXT */
- { 29489, 0x00008D50 }, /* GL_RENDERBUFFER_RED_SIZE */
- { 29514, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES */
- { 29538, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES_EXT */
- { 29566, 0x00008D55 }, /* GL_RENDERBUFFER_STENCIL_SIZE */
- { 29595, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH */
- { 29617, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_EXT */
- { 29643, 0x00001F01 }, /* GL_RENDERER */
- { 29655, 0x00000C40 }, /* GL_RENDER_MODE */
- { 29670, 0x00002901 }, /* GL_REPEAT */
- { 29680, 0x00001E01 }, /* GL_REPLACE */
- { 29691, 0x00008062 }, /* GL_REPLACE_EXT */
- { 29706, 0x00008153 }, /* GL_REPLICATE_BORDER_HP */
- { 29729, 0x0000803A }, /* GL_RESCALE_NORMAL */
- { 29747, 0x0000803A }, /* GL_RESCALE_NORMAL_EXT */
- { 29769, 0x00008A1B }, /* GL_RETAINED_APPLE */
- { 29787, 0x00000102 }, /* GL_RETURN */
- { 29797, 0x00001907 }, /* GL_RGB */
- { 29804, 0x00008052 }, /* GL_RGB10 */
- { 29813, 0x00008059 }, /* GL_RGB10_A2 */
- { 29825, 0x00008059 }, /* GL_RGB10_A2_EXT */
- { 29841, 0x00008052 }, /* GL_RGB10_EXT */
- { 29854, 0x00008053 }, /* GL_RGB12 */
- { 29863, 0x00008053 }, /* GL_RGB12_EXT */
- { 29876, 0x00008054 }, /* GL_RGB16 */
- { 29885, 0x00008054 }, /* GL_RGB16_EXT */
- { 29898, 0x0000804E }, /* GL_RGB2_EXT */
- { 29910, 0x0000804F }, /* GL_RGB4 */
- { 29918, 0x0000804F }, /* GL_RGB4_EXT */
- { 29930, 0x000083A1 }, /* GL_RGB4_S3TC */
- { 29943, 0x00008050 }, /* GL_RGB5 */
- { 29951, 0x00008057 }, /* GL_RGB5_A1 */
- { 29962, 0x00008057 }, /* GL_RGB5_A1_EXT */
- { 29977, 0x00008050 }, /* GL_RGB5_EXT */
- { 29989, 0x00008051 }, /* GL_RGB8 */
- { 29997, 0x00008051 }, /* GL_RGB8_EXT */
- { 30009, 0x00001908 }, /* GL_RGBA */
- { 30017, 0x0000805A }, /* GL_RGBA12 */
- { 30027, 0x0000805A }, /* GL_RGBA12_EXT */
- { 30041, 0x0000805B }, /* GL_RGBA16 */
- { 30051, 0x0000805B }, /* GL_RGBA16_EXT */
- { 30065, 0x00008055 }, /* GL_RGBA2 */
- { 30074, 0x00008055 }, /* GL_RGBA2_EXT */
- { 30087, 0x00008056 }, /* GL_RGBA4 */
- { 30096, 0x000083A5 }, /* GL_RGBA4_DXT5_S3TC */
- { 30115, 0x00008056 }, /* GL_RGBA4_EXT */
- { 30128, 0x000083A3 }, /* GL_RGBA4_S3TC */
- { 30142, 0x00008058 }, /* GL_RGBA8 */
- { 30151, 0x00008058 }, /* GL_RGBA8_EXT */
- { 30164, 0x00008F97 }, /* GL_RGBA8_SNORM */
- { 30179, 0x000083A4 }, /* GL_RGBA_DXT5_S3TC */
- { 30197, 0x00000C31 }, /* GL_RGBA_MODE */
- { 30210, 0x000083A2 }, /* GL_RGBA_S3TC */
- { 30223, 0x00008F93 }, /* GL_RGBA_SNORM */
- { 30237, 0x000083A0 }, /* GL_RGB_S3TC */
- { 30249, 0x00008573 }, /* GL_RGB_SCALE */
- { 30262, 0x00008573 }, /* GL_RGB_SCALE_ARB */
- { 30279, 0x00008573 }, /* GL_RGB_SCALE_EXT */
- { 30296, 0x00000407 }, /* GL_RIGHT */
- { 30305, 0x00002000 }, /* GL_S */
- { 30310, 0x00008B5D }, /* GL_SAMPLER_1D */
- { 30324, 0x00008B61 }, /* GL_SAMPLER_1D_SHADOW */
- { 30345, 0x00008B5E }, /* GL_SAMPLER_2D */
- { 30359, 0x00008B62 }, /* GL_SAMPLER_2D_SHADOW */
- { 30380, 0x00008B5F }, /* GL_SAMPLER_3D */
- { 30394, 0x00008B60 }, /* GL_SAMPLER_CUBE */
- { 30410, 0x000080A9 }, /* GL_SAMPLES */
- { 30421, 0x000086B4 }, /* GL_SAMPLES_3DFX */
- { 30437, 0x000080A9 }, /* GL_SAMPLES_ARB */
- { 30452, 0x00008914 }, /* GL_SAMPLES_PASSED */
- { 30470, 0x00008914 }, /* GL_SAMPLES_PASSED_ARB */
- { 30492, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE */
- { 30520, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE_ARB */
- { 30552, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE */
- { 30575, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE_ARB */
- { 30602, 0x000080A8 }, /* GL_SAMPLE_BUFFERS */
- { 30620, 0x000086B3 }, /* GL_SAMPLE_BUFFERS_3DFX */
- { 30643, 0x000080A8 }, /* GL_SAMPLE_BUFFERS_ARB */
- { 30665, 0x000080A0 }, /* GL_SAMPLE_COVERAGE */
- { 30684, 0x000080A0 }, /* GL_SAMPLE_COVERAGE_ARB */
- { 30707, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT */
- { 30733, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT_ARB */
- { 30763, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE */
- { 30788, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE_ARB */
- { 30817, 0x00080000 }, /* GL_SCISSOR_BIT */
- { 30832, 0x00000C10 }, /* GL_SCISSOR_BOX */
- { 30847, 0x00000C11 }, /* GL_SCISSOR_TEST */
- { 30863, 0x0000845E }, /* GL_SECONDARY_COLOR_ARRAY */
- { 30888, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */
- { 30928, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB */
- { 30972, 0x0000845D }, /* GL_SECONDARY_COLOR_ARRAY_POINTER */
- { 31005, 0x0000845A }, /* GL_SECONDARY_COLOR_ARRAY_SIZE */
- { 31035, 0x0000845C }, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */
- { 31067, 0x0000845B }, /* GL_SECONDARY_COLOR_ARRAY_TYPE */
- { 31097, 0x00001C02 }, /* GL_SELECT */
- { 31107, 0x00000DF3 }, /* GL_SELECTION_BUFFER_POINTER */
- { 31135, 0x00000DF4 }, /* GL_SELECTION_BUFFER_SIZE */
- { 31160, 0x00008012 }, /* GL_SEPARABLE_2D */
- { 31176, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR */
- { 31203, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR_EXT */
- { 31234, 0x0000150F }, /* GL_SET */
- { 31241, 0x00008B48 }, /* GL_SHADER_OBJECT_ARB */
- { 31262, 0x00008B88 }, /* GL_SHADER_SOURCE_LENGTH */
- { 31286, 0x00008B4F }, /* GL_SHADER_TYPE */
- { 31301, 0x00000B54 }, /* GL_SHADE_MODEL */
- { 31316, 0x00008B8C }, /* GL_SHADING_LANGUAGE_VERSION */
- { 31344, 0x000080BF }, /* GL_SHADOW_AMBIENT_SGIX */
- { 31367, 0x000081FB }, /* GL_SHARED_TEXTURE_PALETTE_EXT */
- { 31397, 0x00001601 }, /* GL_SHININESS */
- { 31410, 0x00001402 }, /* GL_SHORT */
- { 31419, 0x00009119 }, /* GL_SIGNALED */
- { 31431, 0x00008F9C }, /* GL_SIGNED_NORMALIZED */
- { 31452, 0x000081F9 }, /* GL_SINGLE_COLOR */
- { 31468, 0x000081F9 }, /* GL_SINGLE_COLOR_EXT */
- { 31488, 0x000085CC }, /* GL_SLICE_ACCUM_SUN */
- { 31507, 0x00008C46 }, /* GL_SLUMINANCE */
- { 31521, 0x00008C47 }, /* GL_SLUMINANCE8 */
- { 31536, 0x00008C45 }, /* GL_SLUMINANCE8_ALPHA8 */
- { 31558, 0x00008C44 }, /* GL_SLUMINANCE_ALPHA */
- { 31578, 0x00001D01 }, /* GL_SMOOTH */
- { 31588, 0x00000B23 }, /* GL_SMOOTH_LINE_WIDTH_GRANULARITY */
- { 31621, 0x00000B22 }, /* GL_SMOOTH_LINE_WIDTH_RANGE */
- { 31648, 0x00000B13 }, /* GL_SMOOTH_POINT_SIZE_GRANULARITY */
- { 31681, 0x00000B12 }, /* GL_SMOOTH_POINT_SIZE_RANGE */
- { 31708, 0x00008588 }, /* GL_SOURCE0_ALPHA */
- { 31725, 0x00008588 }, /* GL_SOURCE0_ALPHA_ARB */
- { 31746, 0x00008588 }, /* GL_SOURCE0_ALPHA_EXT */
- { 31767, 0x00008580 }, /* GL_SOURCE0_RGB */
- { 31782, 0x00008580 }, /* GL_SOURCE0_RGB_ARB */
- { 31801, 0x00008580 }, /* GL_SOURCE0_RGB_EXT */
- { 31820, 0x00008589 }, /* GL_SOURCE1_ALPHA */
- { 31837, 0x00008589 }, /* GL_SOURCE1_ALPHA_ARB */
- { 31858, 0x00008589 }, /* GL_SOURCE1_ALPHA_EXT */
- { 31879, 0x00008581 }, /* GL_SOURCE1_RGB */
- { 31894, 0x00008581 }, /* GL_SOURCE1_RGB_ARB */
- { 31913, 0x00008581 }, /* GL_SOURCE1_RGB_EXT */
- { 31932, 0x0000858A }, /* GL_SOURCE2_ALPHA */
- { 31949, 0x0000858A }, /* GL_SOURCE2_ALPHA_ARB */
- { 31970, 0x0000858A }, /* GL_SOURCE2_ALPHA_EXT */
- { 31991, 0x00008582 }, /* GL_SOURCE2_RGB */
- { 32006, 0x00008582 }, /* GL_SOURCE2_RGB_ARB */
- { 32025, 0x00008582 }, /* GL_SOURCE2_RGB_EXT */
- { 32044, 0x0000858B }, /* GL_SOURCE3_ALPHA_NV */
- { 32064, 0x00008583 }, /* GL_SOURCE3_RGB_NV */
- { 32082, 0x00001202 }, /* GL_SPECULAR */
- { 32094, 0x00002402 }, /* GL_SPHERE_MAP */
- { 32108, 0x00001206 }, /* GL_SPOT_CUTOFF */
- { 32123, 0x00001204 }, /* GL_SPOT_DIRECTION */
- { 32141, 0x00001205 }, /* GL_SPOT_EXPONENT */
- { 32158, 0x00008588 }, /* GL_SRC0_ALPHA */
- { 32172, 0x00008580 }, /* GL_SRC0_RGB */
- { 32184, 0x00008589 }, /* GL_SRC1_ALPHA */
- { 32198, 0x00008581 }, /* GL_SRC1_RGB */
- { 32210, 0x0000858A }, /* GL_SRC2_ALPHA */
- { 32224, 0x00008582 }, /* GL_SRC2_RGB */
- { 32236, 0x00000302 }, /* GL_SRC_ALPHA */
- { 32249, 0x00000308 }, /* GL_SRC_ALPHA_SATURATE */
- { 32271, 0x00000300 }, /* GL_SRC_COLOR */
- { 32284, 0x00008C40 }, /* GL_SRGB */
- { 32292, 0x00008C41 }, /* GL_SRGB8 */
- { 32301, 0x00008C43 }, /* GL_SRGB8_ALPHA8 */
- { 32317, 0x00008C42 }, /* GL_SRGB_ALPHA */
- { 32331, 0x00000503 }, /* GL_STACK_OVERFLOW */
- { 32349, 0x00000504 }, /* GL_STACK_UNDERFLOW */
- { 32368, 0x000088E6 }, /* GL_STATIC_COPY */
- { 32383, 0x000088E6 }, /* GL_STATIC_COPY_ARB */
- { 32402, 0x000088E4 }, /* GL_STATIC_DRAW */
- { 32417, 0x000088E4 }, /* GL_STATIC_DRAW_ARB */
- { 32436, 0x000088E5 }, /* GL_STATIC_READ */
- { 32451, 0x000088E5 }, /* GL_STATIC_READ_ARB */
- { 32470, 0x00001802 }, /* GL_STENCIL */
- { 32481, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT */
- { 32503, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_EXT */
- { 32529, 0x00008801 }, /* GL_STENCIL_BACK_FAIL */
- { 32550, 0x00008801 }, /* GL_STENCIL_BACK_FAIL_ATI */
- { 32575, 0x00008800 }, /* GL_STENCIL_BACK_FUNC */
- { 32596, 0x00008800 }, /* GL_STENCIL_BACK_FUNC_ATI */
- { 32621, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */
- { 32653, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI */
- { 32689, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */
- { 32721, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI */
- { 32757, 0x00008CA3 }, /* GL_STENCIL_BACK_REF */
- { 32777, 0x00008CA4 }, /* GL_STENCIL_BACK_VALUE_MASK */
- { 32804, 0x00008CA5 }, /* GL_STENCIL_BACK_WRITEMASK */
- { 32830, 0x00000D57 }, /* GL_STENCIL_BITS */
- { 32846, 0x00000400 }, /* GL_STENCIL_BUFFER_BIT */
- { 32868, 0x00000B91 }, /* GL_STENCIL_CLEAR_VALUE */
- { 32891, 0x00000B94 }, /* GL_STENCIL_FAIL */
- { 32907, 0x00000B92 }, /* GL_STENCIL_FUNC */
- { 32923, 0x00001901 }, /* GL_STENCIL_INDEX */
- { 32940, 0x00008D46 }, /* GL_STENCIL_INDEX1 */
- { 32958, 0x00008D49 }, /* GL_STENCIL_INDEX16 */
- { 32977, 0x00008D49 }, /* GL_STENCIL_INDEX16_EXT */
- { 33000, 0x00008D46 }, /* GL_STENCIL_INDEX1_EXT */
- { 33022, 0x00008D47 }, /* GL_STENCIL_INDEX4 */
- { 33040, 0x00008D47 }, /* GL_STENCIL_INDEX4_EXT */
- { 33062, 0x00008D48 }, /* GL_STENCIL_INDEX8 */
- { 33080, 0x00008D48 }, /* GL_STENCIL_INDEX8_EXT */
- { 33102, 0x00008D45 }, /* GL_STENCIL_INDEX_EXT */
- { 33123, 0x00000B95 }, /* GL_STENCIL_PASS_DEPTH_FAIL */
- { 33150, 0x00000B96 }, /* GL_STENCIL_PASS_DEPTH_PASS */
- { 33177, 0x00000B97 }, /* GL_STENCIL_REF */
- { 33192, 0x00000B90 }, /* GL_STENCIL_TEST */
- { 33208, 0x00008910 }, /* GL_STENCIL_TEST_TWO_SIDE_EXT */
- { 33237, 0x00000B93 }, /* GL_STENCIL_VALUE_MASK */
- { 33259, 0x00000B98 }, /* GL_STENCIL_WRITEMASK */
- { 33280, 0x00000C33 }, /* GL_STEREO */
- { 33290, 0x000085BE }, /* GL_STORAGE_CACHED_APPLE */
- { 33314, 0x000085BD }, /* GL_STORAGE_PRIVATE_APPLE */
- { 33339, 0x000085BF }, /* GL_STORAGE_SHARED_APPLE */
- { 33363, 0x000088E2 }, /* GL_STREAM_COPY */
- { 33378, 0x000088E2 }, /* GL_STREAM_COPY_ARB */
- { 33397, 0x000088E0 }, /* GL_STREAM_DRAW */
- { 33412, 0x000088E0 }, /* GL_STREAM_DRAW_ARB */
- { 33431, 0x000088E1 }, /* GL_STREAM_READ */
- { 33446, 0x000088E1 }, /* GL_STREAM_READ_ARB */
- { 33465, 0x00000D50 }, /* GL_SUBPIXEL_BITS */
- { 33482, 0x000084E7 }, /* GL_SUBTRACT */
- { 33494, 0x000084E7 }, /* GL_SUBTRACT_ARB */
- { 33510, 0x00009113 }, /* GL_SYNC_CONDITION */
- { 33528, 0x00009116 }, /* GL_SYNC_FENCE */
- { 33542, 0x00009115 }, /* GL_SYNC_FLAGS */
- { 33556, 0x00000001 }, /* GL_SYNC_FLUSH_COMMANDS_BIT */
- { 33583, 0x00009117 }, /* GL_SYNC_GPU_COMMANDS_COMPLETE */
- { 33613, 0x00009114 }, /* GL_SYNC_STATUS */
- { 33628, 0x00002001 }, /* GL_T */
- { 33633, 0x00002A2A }, /* GL_T2F_C3F_V3F */
- { 33648, 0x00002A2C }, /* GL_T2F_C4F_N3F_V3F */
- { 33667, 0x00002A29 }, /* GL_T2F_C4UB_V3F */
- { 33683, 0x00002A2B }, /* GL_T2F_N3F_V3F */
- { 33698, 0x00002A27 }, /* GL_T2F_V3F */
- { 33709, 0x00002A2D }, /* GL_T4F_C4F_N3F_V4F */
- { 33728, 0x00002A28 }, /* GL_T4F_V4F */
- { 33739, 0x00008031 }, /* GL_TABLE_TOO_LARGE_EXT */
- { 33762, 0x00001702 }, /* GL_TEXTURE */
- { 33773, 0x000084C0 }, /* GL_TEXTURE0 */
- { 33785, 0x000084C0 }, /* GL_TEXTURE0_ARB */
- { 33801, 0x000084C1 }, /* GL_TEXTURE1 */
- { 33813, 0x000084CA }, /* GL_TEXTURE10 */
- { 33826, 0x000084CA }, /* GL_TEXTURE10_ARB */
- { 33843, 0x000084CB }, /* GL_TEXTURE11 */
- { 33856, 0x000084CB }, /* GL_TEXTURE11_ARB */
- { 33873, 0x000084CC }, /* GL_TEXTURE12 */
- { 33886, 0x000084CC }, /* GL_TEXTURE12_ARB */
- { 33903, 0x000084CD }, /* GL_TEXTURE13 */
- { 33916, 0x000084CD }, /* GL_TEXTURE13_ARB */
- { 33933, 0x000084CE }, /* GL_TEXTURE14 */
- { 33946, 0x000084CE }, /* GL_TEXTURE14_ARB */
- { 33963, 0x000084CF }, /* GL_TEXTURE15 */
- { 33976, 0x000084CF }, /* GL_TEXTURE15_ARB */
- { 33993, 0x000084D0 }, /* GL_TEXTURE16 */
- { 34006, 0x000084D0 }, /* GL_TEXTURE16_ARB */
- { 34023, 0x000084D1 }, /* GL_TEXTURE17 */
- { 34036, 0x000084D1 }, /* GL_TEXTURE17_ARB */
- { 34053, 0x000084D2 }, /* GL_TEXTURE18 */
- { 34066, 0x000084D2 }, /* GL_TEXTURE18_ARB */
- { 34083, 0x000084D3 }, /* GL_TEXTURE19 */
- { 34096, 0x000084D3 }, /* GL_TEXTURE19_ARB */
- { 34113, 0x000084C1 }, /* GL_TEXTURE1_ARB */
- { 34129, 0x000084C2 }, /* GL_TEXTURE2 */
- { 34141, 0x000084D4 }, /* GL_TEXTURE20 */
- { 34154, 0x000084D4 }, /* GL_TEXTURE20_ARB */
- { 34171, 0x000084D5 }, /* GL_TEXTURE21 */
- { 34184, 0x000084D5 }, /* GL_TEXTURE21_ARB */
- { 34201, 0x000084D6 }, /* GL_TEXTURE22 */
- { 34214, 0x000084D6 }, /* GL_TEXTURE22_ARB */
- { 34231, 0x000084D7 }, /* GL_TEXTURE23 */
- { 34244, 0x000084D7 }, /* GL_TEXTURE23_ARB */
- { 34261, 0x000084D8 }, /* GL_TEXTURE24 */
- { 34274, 0x000084D8 }, /* GL_TEXTURE24_ARB */
- { 34291, 0x000084D9 }, /* GL_TEXTURE25 */
- { 34304, 0x000084D9 }, /* GL_TEXTURE25_ARB */
- { 34321, 0x000084DA }, /* GL_TEXTURE26 */
- { 34334, 0x000084DA }, /* GL_TEXTURE26_ARB */
- { 34351, 0x000084DB }, /* GL_TEXTURE27 */
- { 34364, 0x000084DB }, /* GL_TEXTURE27_ARB */
- { 34381, 0x000084DC }, /* GL_TEXTURE28 */
- { 34394, 0x000084DC }, /* GL_TEXTURE28_ARB */
- { 34411, 0x000084DD }, /* GL_TEXTURE29 */
- { 34424, 0x000084DD }, /* GL_TEXTURE29_ARB */
- { 34441, 0x000084C2 }, /* GL_TEXTURE2_ARB */
- { 34457, 0x000084C3 }, /* GL_TEXTURE3 */
- { 34469, 0x000084DE }, /* GL_TEXTURE30 */
- { 34482, 0x000084DE }, /* GL_TEXTURE30_ARB */
- { 34499, 0x000084DF }, /* GL_TEXTURE31 */
- { 34512, 0x000084DF }, /* GL_TEXTURE31_ARB */
- { 34529, 0x000084C3 }, /* GL_TEXTURE3_ARB */
- { 34545, 0x000084C4 }, /* GL_TEXTURE4 */
- { 34557, 0x000084C4 }, /* GL_TEXTURE4_ARB */
- { 34573, 0x000084C5 }, /* GL_TEXTURE5 */
- { 34585, 0x000084C5 }, /* GL_TEXTURE5_ARB */
- { 34601, 0x000084C6 }, /* GL_TEXTURE6 */
- { 34613, 0x000084C6 }, /* GL_TEXTURE6_ARB */
- { 34629, 0x000084C7 }, /* GL_TEXTURE7 */
- { 34641, 0x000084C7 }, /* GL_TEXTURE7_ARB */
- { 34657, 0x000084C8 }, /* GL_TEXTURE8 */
- { 34669, 0x000084C8 }, /* GL_TEXTURE8_ARB */
- { 34685, 0x000084C9 }, /* GL_TEXTURE9 */
- { 34697, 0x000084C9 }, /* GL_TEXTURE9_ARB */
- { 34713, 0x00000DE0 }, /* GL_TEXTURE_1D */
- { 34727, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY_EXT */
- { 34751, 0x00000DE1 }, /* GL_TEXTURE_2D */
- { 34765, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY_EXT */
- { 34789, 0x0000806F }, /* GL_TEXTURE_3D */
- { 34803, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE */
- { 34825, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE_EXT */
- { 34851, 0x0000813C }, /* GL_TEXTURE_BASE_LEVEL */
- { 34873, 0x00008068 }, /* GL_TEXTURE_BINDING_1D */
- { 34895, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */
- { 34927, 0x00008069 }, /* GL_TEXTURE_BINDING_2D */
- { 34949, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */
- { 34981, 0x0000806A }, /* GL_TEXTURE_BINDING_3D */
- { 35003, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP */
- { 35031, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_ARB */
- { 35063, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */
- { 35096, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_NV */
- { 35128, 0x00040000 }, /* GL_TEXTURE_BIT */
- { 35143, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE */
- { 35164, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE_EXT */
- { 35189, 0x00001005 }, /* GL_TEXTURE_BORDER */
- { 35207, 0x00001004 }, /* GL_TEXTURE_BORDER_COLOR */
- { 35231, 0x00008171 }, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */
- { 35262, 0x00008176 }, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */
- { 35292, 0x00008172 }, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */
- { 35322, 0x00008175 }, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */
- { 35357, 0x00008173 }, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */
- { 35388, 0x00008174 }, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */
- { 35426, 0x000080BC }, /* GL_TEXTURE_COLOR_TABLE_SGI */
- { 35453, 0x000081EF }, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */
- { 35485, 0x000080BF }, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
- { 35519, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC */
- { 35543, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC_ARB */
- { 35571, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE */
- { 35595, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE_ARB */
- { 35623, 0x0000819B }, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */
- { 35656, 0x0000819A }, /* GL_TEXTURE_COMPARE_SGIX */
- { 35680, 0x00001003 }, /* GL_TEXTURE_COMPONENTS */
- { 35702, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED */
- { 35724, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED_ARB */
- { 35750, 0x000086A3 }, /* GL_TEXTURE_COMPRESSED_FORMATS_ARB */
- { 35784, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */
- { 35817, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB */
- { 35854, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT */
- { 35882, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT_ARB */
- { 35914, 0x00008078 }, /* GL_TEXTURE_COORD_ARRAY */
- { 35937, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */
- { 35975, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB */
- { 36017, 0x00008092 }, /* GL_TEXTURE_COORD_ARRAY_POINTER */
- { 36048, 0x00008088 }, /* GL_TEXTURE_COORD_ARRAY_SIZE */
- { 36076, 0x0000808A }, /* GL_TEXTURE_COORD_ARRAY_STRIDE */
- { 36106, 0x00008089 }, /* GL_TEXTURE_COORD_ARRAY_TYPE */
- { 36134, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP */
- { 36154, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_ARB */
- { 36178, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */
- { 36209, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB */
- { 36244, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */
- { 36275, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB */
- { 36310, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */
- { 36341, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB */
- { 36376, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */
- { 36407, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB */
- { 36442, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */
- { 36473, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB */
- { 36508, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */
- { 36539, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */
- { 36574, 0x000088F4 }, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */
- { 36603, 0x00008071 }, /* GL_TEXTURE_DEPTH */
- { 36620, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */
- { 36642, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */
- { 36668, 0x00002300 }, /* GL_TEXTURE_ENV */
- { 36683, 0x00002201 }, /* GL_TEXTURE_ENV_COLOR */
- { 36704, 0x00002200 }, /* GL_TEXTURE_ENV_MODE */
- { 36724, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL */
- { 36750, 0x00002500 }, /* GL_TEXTURE_GEN_MODE */
- { 36770, 0x00000C63 }, /* GL_TEXTURE_GEN_Q */
- { 36787, 0x00000C62 }, /* GL_TEXTURE_GEN_R */
- { 36804, 0x00000C60 }, /* GL_TEXTURE_GEN_S */
- { 36821, 0x00000C61 }, /* GL_TEXTURE_GEN_T */
- { 36838, 0x0000819D }, /* GL_TEXTURE_GEQUAL_R_SGIX */
- { 36863, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE */
- { 36885, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE_EXT */
- { 36911, 0x00001001 }, /* GL_TEXTURE_HEIGHT */
- { 36929, 0x000080ED }, /* GL_TEXTURE_INDEX_SIZE_EXT */
- { 36955, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE */
- { 36981, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE_EXT */
- { 37011, 0x00001003 }, /* GL_TEXTURE_INTERNAL_FORMAT */
- { 37038, 0x0000819C }, /* GL_TEXTURE_LEQUAL_R_SGIX */
- { 37063, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS */
- { 37083, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS_EXT */
- { 37107, 0x00008190 }, /* GL_TEXTURE_LOD_BIAS_R_SGIX */
- { 37134, 0x0000818E }, /* GL_TEXTURE_LOD_BIAS_S_SGIX */
- { 37161, 0x0000818F }, /* GL_TEXTURE_LOD_BIAS_T_SGIX */
- { 37188, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE */
- { 37214, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE_EXT */
- { 37244, 0x00002800 }, /* GL_TEXTURE_MAG_FILTER */
- { 37266, 0x00000BA8 }, /* GL_TEXTURE_MATRIX */
- { 37284, 0x000084FE }, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */
- { 37314, 0x0000836B }, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */
- { 37342, 0x00008369 }, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */
- { 37370, 0x0000836A }, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */
- { 37398, 0x0000813D }, /* GL_TEXTURE_MAX_LEVEL */
- { 37419, 0x0000813B }, /* GL_TEXTURE_MAX_LOD */
- { 37438, 0x00002801 }, /* GL_TEXTURE_MIN_FILTER */
- { 37460, 0x0000813A }, /* GL_TEXTURE_MIN_LOD */
- { 37479, 0x00008066 }, /* GL_TEXTURE_PRIORITY */
- { 37499, 0x000085B7 }, /* GL_TEXTURE_RANGE_LENGTH_APPLE */
- { 37529, 0x000085B8 }, /* GL_TEXTURE_RANGE_POINTER_APPLE */
- { 37560, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_ARB */
- { 37585, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_NV */
- { 37609, 0x0000805C }, /* GL_TEXTURE_RED_SIZE */
- { 37629, 0x0000805C }, /* GL_TEXTURE_RED_SIZE_EXT */
- { 37653, 0x00008067 }, /* GL_TEXTURE_RESIDENT */
- { 37673, 0x00000BA5 }, /* GL_TEXTURE_STACK_DEPTH */
- { 37696, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE */
- { 37720, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE_EXT */
- { 37748, 0x000085BC }, /* GL_TEXTURE_STORAGE_HINT_APPLE */
- { 37778, 0x00008065 }, /* GL_TEXTURE_TOO_LARGE_EXT */
- { 37803, 0x0000888F }, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */
- { 37837, 0x00001000 }, /* GL_TEXTURE_WIDTH */
- { 37854, 0x00008072 }, /* GL_TEXTURE_WRAP_R */
- { 37872, 0x00002802 }, /* GL_TEXTURE_WRAP_S */
- { 37890, 0x00002803 }, /* GL_TEXTURE_WRAP_T */
- { 37908, 0x0000911B }, /* GL_TIMEOUT_EXPIRED */
- { 37927, 0x000088BF }, /* GL_TIME_ELAPSED_EXT */
- { 37947, 0x00008648 }, /* GL_TRACK_MATRIX_NV */
- { 37966, 0x00008649 }, /* GL_TRACK_MATRIX_TRANSFORM_NV */
- { 37995, 0x00001000 }, /* GL_TRANSFORM_BIT */
- { 38012, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX */
- { 38038, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX_ARB */
- { 38068, 0x000088B7 }, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */
- { 38100, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX */
- { 38130, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX_ARB */
- { 38164, 0x0000862C }, /* GL_TRANSPOSE_NV */
- { 38180, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX */
- { 38211, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX_ARB */
- { 38246, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX */
- { 38274, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX_ARB */
- { 38306, 0x00000004 }, /* GL_TRIANGLES */
- { 38319, 0x00000006 }, /* GL_TRIANGLE_FAN */
- { 38335, 0x00008615 }, /* GL_TRIANGLE_MESH_SUN */
- { 38356, 0x00000005 }, /* GL_TRIANGLE_STRIP */
- { 38374, 0x00000001 }, /* GL_TRUE */
- { 38382, 0x00008A1C }, /* GL_UNDEFINED_APPLE */
- { 38401, 0x00000CF5 }, /* GL_UNPACK_ALIGNMENT */
- { 38421, 0x0000806E }, /* GL_UNPACK_IMAGE_HEIGHT */
- { 38444, 0x00000CF1 }, /* GL_UNPACK_LSB_FIRST */
- { 38464, 0x00000CF2 }, /* GL_UNPACK_ROW_LENGTH */
- { 38485, 0x0000806D }, /* GL_UNPACK_SKIP_IMAGES */
- { 38507, 0x00000CF4 }, /* GL_UNPACK_SKIP_PIXELS */
- { 38529, 0x00000CF3 }, /* GL_UNPACK_SKIP_ROWS */
- { 38549, 0x00000CF0 }, /* GL_UNPACK_SWAP_BYTES */
- { 38570, 0x00009118 }, /* GL_UNSIGNALED */
- { 38584, 0x00001401 }, /* GL_UNSIGNED_BYTE */
- { 38601, 0x00008362 }, /* GL_UNSIGNED_BYTE_2_3_3_REV */
- { 38628, 0x00008032 }, /* GL_UNSIGNED_BYTE_3_3_2 */
- { 38651, 0x00001405 }, /* GL_UNSIGNED_INT */
- { 38667, 0x00008036 }, /* GL_UNSIGNED_INT_10_10_10_2 */
- { 38694, 0x000084FA }, /* GL_UNSIGNED_INT_24_8 */
- { 38715, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_EXT */
- { 38740, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_NV */
- { 38764, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV */
- { 38795, 0x00008035 }, /* GL_UNSIGNED_INT_8_8_8_8 */
- { 38819, 0x00008367 }, /* GL_UNSIGNED_INT_8_8_8_8_REV */
- { 38847, 0x00008C17 }, /* GL_UNSIGNED_NORMALIZED */
- { 38870, 0x00001403 }, /* GL_UNSIGNED_SHORT */
- { 38888, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */
- { 38918, 0x00008033 }, /* GL_UNSIGNED_SHORT_4_4_4_4 */
- { 38944, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */
- { 38974, 0x00008034 }, /* GL_UNSIGNED_SHORT_5_5_5_1 */
- { 39000, 0x00008363 }, /* GL_UNSIGNED_SHORT_5_6_5 */
- { 39024, 0x00008364 }, /* GL_UNSIGNED_SHORT_5_6_5_REV */
- { 39052, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_APPLE */
- { 39080, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_MESA */
- { 39107, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */
- { 39139, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_MESA */
- { 39170, 0x00008CA2 }, /* GL_UPPER_LEFT */
- { 39184, 0x00002A20 }, /* GL_V2F */
- { 39191, 0x00002A21 }, /* GL_V3F */
- { 39198, 0x00008B83 }, /* GL_VALIDATE_STATUS */
- { 39217, 0x00001F00 }, /* GL_VENDOR */
- { 39227, 0x00001F02 }, /* GL_VERSION */
- { 39238, 0x00008074 }, /* GL_VERTEX_ARRAY */
- { 39254, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING */
- { 39278, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING_APPLE */
- { 39308, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING */
- { 39339, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING_ARB */
- { 39374, 0x0000808E }, /* GL_VERTEX_ARRAY_POINTER */
- { 39398, 0x0000807A }, /* GL_VERTEX_ARRAY_SIZE */
- { 39419, 0x0000807C }, /* GL_VERTEX_ARRAY_STRIDE */
- { 39442, 0x0000807B }, /* GL_VERTEX_ARRAY_TYPE */
- { 39463, 0x00008650 }, /* GL_VERTEX_ATTRIB_ARRAY0_NV */
- { 39490, 0x0000865A }, /* GL_VERTEX_ATTRIB_ARRAY10_NV */
- { 39518, 0x0000865B }, /* GL_VERTEX_ATTRIB_ARRAY11_NV */
- { 39546, 0x0000865C }, /* GL_VERTEX_ATTRIB_ARRAY12_NV */
- { 39574, 0x0000865D }, /* GL_VERTEX_ATTRIB_ARRAY13_NV */
- { 39602, 0x0000865E }, /* GL_VERTEX_ATTRIB_ARRAY14_NV */
- { 39630, 0x0000865F }, /* GL_VERTEX_ATTRIB_ARRAY15_NV */
- { 39658, 0x00008651 }, /* GL_VERTEX_ATTRIB_ARRAY1_NV */
- { 39685, 0x00008652 }, /* GL_VERTEX_ATTRIB_ARRAY2_NV */
- { 39712, 0x00008653 }, /* GL_VERTEX_ATTRIB_ARRAY3_NV */
- { 39739, 0x00008654 }, /* GL_VERTEX_ATTRIB_ARRAY4_NV */
- { 39766, 0x00008655 }, /* GL_VERTEX_ATTRIB_ARRAY5_NV */
- { 39793, 0x00008656 }, /* GL_VERTEX_ATTRIB_ARRAY6_NV */
- { 39820, 0x00008657 }, /* GL_VERTEX_ATTRIB_ARRAY7_NV */
- { 39847, 0x00008658 }, /* GL_VERTEX_ATTRIB_ARRAY8_NV */
- { 39874, 0x00008659 }, /* GL_VERTEX_ATTRIB_ARRAY9_NV */
- { 39901, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */
- { 39939, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB */
- { 39981, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */
- { 40012, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */
- { 40047, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */
- { 40081, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */
- { 40119, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */
- { 40150, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */
- { 40185, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */
- { 40213, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */
- { 40245, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */
- { 40275, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */
- { 40309, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */
- { 40337, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */
- { 40369, 0x000086A7 }, /* GL_VERTEX_BLEND_ARB */
- { 40389, 0x00008620 }, /* GL_VERTEX_PROGRAM_ARB */
- { 40411, 0x0000864A }, /* GL_VERTEX_PROGRAM_BINDING_NV */
- { 40440, 0x00008620 }, /* GL_VERTEX_PROGRAM_NV */
- { 40461, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE */
- { 40490, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */
- { 40523, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */
- { 40555, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE */
- { 40582, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */
- { 40613, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */
- { 40643, 0x00008B31 }, /* GL_VERTEX_SHADER */
- { 40660, 0x00008B31 }, /* GL_VERTEX_SHADER_ARB */
- { 40681, 0x00008621 }, /* GL_VERTEX_STATE_PROGRAM_NV */
- { 40708, 0x00000BA2 }, /* GL_VIEWPORT */
- { 40720, 0x00000800 }, /* GL_VIEWPORT_BIT */
- { 40736, 0x00008A1A }, /* GL_VOLATILE_APPLE */
- { 40754, 0x0000911D }, /* GL_WAIT_FAILED */
- { 40769, 0x000086AD }, /* GL_WEIGHT_ARRAY_ARB */
- { 40789, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */
- { 40820, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB */
- { 40855, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_ARB */
- { 40883, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_ARB */
- { 40908, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_ARB */
- { 40935, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_ARB */
- { 40960, 0x000086A6 }, /* GL_WEIGHT_SUM_UNITY_ARB */
- { 40984, 0x000081D4 }, /* GL_WRAP_BORDER_SUN */
- { 41003, 0x000088B9 }, /* GL_WRITE_ONLY */
- { 41017, 0x000088B9 }, /* GL_WRITE_ONLY_ARB */
- { 41035, 0x00001506 }, /* GL_XOR */
- { 41042, 0x000085B9 }, /* GL_YCBCR_422_APPLE */
- { 41061, 0x00008757 }, /* GL_YCBCR_MESA */
- { 41075, 0x00000000 }, /* GL_ZERO */
- { 41083, 0x00000D16 }, /* GL_ZOOM_X */
- { 41093, 0x00000D17 }, /* GL_ZOOM_Y */
+ { 13888, 0x00008C8C }, /* GL_INTERLEAVED_ATTRIBS_EXT */
+ { 13915, 0x00008575 }, /* GL_INTERPOLATE */
+ { 13930, 0x00008575 }, /* GL_INTERPOLATE_ARB */
+ { 13949, 0x00008575 }, /* GL_INTERPOLATE_EXT */
+ { 13968, 0x00008B53 }, /* GL_INT_VEC2 */
+ { 13980, 0x00008B53 }, /* GL_INT_VEC2_ARB */
+ { 13996, 0x00008B54 }, /* GL_INT_VEC3 */
+ { 14008, 0x00008B54 }, /* GL_INT_VEC3_ARB */
+ { 14024, 0x00008B55 }, /* GL_INT_VEC4 */
+ { 14036, 0x00008B55 }, /* GL_INT_VEC4_ARB */
+ { 14052, 0x00000500 }, /* GL_INVALID_ENUM */
+ { 14068, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION */
+ { 14101, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_EXT */
+ { 14138, 0x00000502 }, /* GL_INVALID_OPERATION */
+ { 14159, 0x00000501 }, /* GL_INVALID_VALUE */
+ { 14176, 0x0000862B }, /* GL_INVERSE_NV */
+ { 14190, 0x0000862D }, /* GL_INVERSE_TRANSPOSE_NV */
+ { 14214, 0x0000150A }, /* GL_INVERT */
+ { 14224, 0x00001E00 }, /* GL_KEEP */
+ { 14232, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION */
+ { 14258, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION_EXT */
+ { 14288, 0x00000406 }, /* GL_LEFT */
+ { 14296, 0x00000203 }, /* GL_LEQUAL */
+ { 14306, 0x00000201 }, /* GL_LESS */
+ { 14314, 0x00004000 }, /* GL_LIGHT0 */
+ { 14324, 0x00004001 }, /* GL_LIGHT1 */
+ { 14334, 0x00004002 }, /* GL_LIGHT2 */
+ { 14344, 0x00004003 }, /* GL_LIGHT3 */
+ { 14354, 0x00004004 }, /* GL_LIGHT4 */
+ { 14364, 0x00004005 }, /* GL_LIGHT5 */
+ { 14374, 0x00004006 }, /* GL_LIGHT6 */
+ { 14384, 0x00004007 }, /* GL_LIGHT7 */
+ { 14394, 0x00000B50 }, /* GL_LIGHTING */
+ { 14406, 0x00000040 }, /* GL_LIGHTING_BIT */
+ { 14422, 0x00000B53 }, /* GL_LIGHT_MODEL_AMBIENT */
+ { 14445, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL */
+ { 14474, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL_EXT */
+ { 14507, 0x00000B51 }, /* GL_LIGHT_MODEL_LOCAL_VIEWER */
+ { 14535, 0x00000B52 }, /* GL_LIGHT_MODEL_TWO_SIDE */
+ { 14559, 0x00001B01 }, /* GL_LINE */
+ { 14567, 0x00002601 }, /* GL_LINEAR */
+ { 14577, 0x00001208 }, /* GL_LINEAR_ATTENUATION */
+ { 14599, 0x00008170 }, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */
+ { 14629, 0x0000844F }, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */
+ { 14660, 0x00002703 }, /* GL_LINEAR_MIPMAP_LINEAR */
+ { 14684, 0x00002701 }, /* GL_LINEAR_MIPMAP_NEAREST */
+ { 14709, 0x00000001 }, /* GL_LINES */
+ { 14718, 0x00000004 }, /* GL_LINE_BIT */
+ { 14730, 0x00000002 }, /* GL_LINE_LOOP */
+ { 14743, 0x00000707 }, /* GL_LINE_RESET_TOKEN */
+ { 14763, 0x00000B20 }, /* GL_LINE_SMOOTH */
+ { 14778, 0x00000C52 }, /* GL_LINE_SMOOTH_HINT */
+ { 14798, 0x00000B24 }, /* GL_LINE_STIPPLE */
+ { 14814, 0x00000B25 }, /* GL_LINE_STIPPLE_PATTERN */
+ { 14838, 0x00000B26 }, /* GL_LINE_STIPPLE_REPEAT */
+ { 14861, 0x00000003 }, /* GL_LINE_STRIP */
+ { 14875, 0x00000702 }, /* GL_LINE_TOKEN */
+ { 14889, 0x00000B21 }, /* GL_LINE_WIDTH */
+ { 14903, 0x00000B23 }, /* GL_LINE_WIDTH_GRANULARITY */
+ { 14929, 0x00000B22 }, /* GL_LINE_WIDTH_RANGE */
+ { 14949, 0x00008B82 }, /* GL_LINK_STATUS */
+ { 14964, 0x00000B32 }, /* GL_LIST_BASE */
+ { 14977, 0x00020000 }, /* GL_LIST_BIT */
+ { 14989, 0x00000B33 }, /* GL_LIST_INDEX */
+ { 15003, 0x00000B30 }, /* GL_LIST_MODE */
+ { 15016, 0x00000101 }, /* GL_LOAD */
+ { 15024, 0x00000BF1 }, /* GL_LOGIC_OP */
+ { 15036, 0x00000BF0 }, /* GL_LOGIC_OP_MODE */
+ { 15053, 0x00008CA1 }, /* GL_LOWER_LEFT */
+ { 15067, 0x00001909 }, /* GL_LUMINANCE */
+ { 15080, 0x00008041 }, /* GL_LUMINANCE12 */
+ { 15095, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12 */
+ { 15118, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12_EXT */
+ { 15145, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4 */
+ { 15167, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4_EXT */
+ { 15193, 0x00008041 }, /* GL_LUMINANCE12_EXT */
+ { 15212, 0x00008042 }, /* GL_LUMINANCE16 */
+ { 15227, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16 */
+ { 15250, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16_EXT */
+ { 15277, 0x00008042 }, /* GL_LUMINANCE16_EXT */
+ { 15296, 0x0000803F }, /* GL_LUMINANCE4 */
+ { 15310, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4 */
+ { 15331, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4_EXT */
+ { 15356, 0x0000803F }, /* GL_LUMINANCE4_EXT */
+ { 15374, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2 */
+ { 15395, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2_EXT */
+ { 15420, 0x00008040 }, /* GL_LUMINANCE8 */
+ { 15434, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8 */
+ { 15455, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8_EXT */
+ { 15480, 0x00008040 }, /* GL_LUMINANCE8_EXT */
+ { 15498, 0x0000190A }, /* GL_LUMINANCE_ALPHA */
+ { 15517, 0x00000D90 }, /* GL_MAP1_COLOR_4 */
+ { 15533, 0x00000DD0 }, /* GL_MAP1_GRID_DOMAIN */
+ { 15553, 0x00000DD1 }, /* GL_MAP1_GRID_SEGMENTS */
+ { 15575, 0x00000D91 }, /* GL_MAP1_INDEX */
+ { 15589, 0x00000D92 }, /* GL_MAP1_NORMAL */
+ { 15604, 0x00000D93 }, /* GL_MAP1_TEXTURE_COORD_1 */
+ { 15628, 0x00000D94 }, /* GL_MAP1_TEXTURE_COORD_2 */
+ { 15652, 0x00000D95 }, /* GL_MAP1_TEXTURE_COORD_3 */
+ { 15676, 0x00000D96 }, /* GL_MAP1_TEXTURE_COORD_4 */
+ { 15700, 0x00000D97 }, /* GL_MAP1_VERTEX_3 */
+ { 15717, 0x00000D98 }, /* GL_MAP1_VERTEX_4 */
+ { 15734, 0x00008660 }, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */
+ { 15762, 0x0000866A }, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */
+ { 15791, 0x0000866B }, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */
+ { 15820, 0x0000866C }, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */
+ { 15849, 0x0000866D }, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */
+ { 15878, 0x0000866E }, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */
+ { 15907, 0x0000866F }, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */
+ { 15936, 0x00008661 }, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */
+ { 15964, 0x00008662 }, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */
+ { 15992, 0x00008663 }, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */
+ { 16020, 0x00008664 }, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */
+ { 16048, 0x00008665 }, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */
+ { 16076, 0x00008666 }, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */
+ { 16104, 0x00008667 }, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */
+ { 16132, 0x00008668 }, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */
+ { 16160, 0x00008669 }, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */
+ { 16188, 0x00000DB0 }, /* GL_MAP2_COLOR_4 */
+ { 16204, 0x00000DD2 }, /* GL_MAP2_GRID_DOMAIN */
+ { 16224, 0x00000DD3 }, /* GL_MAP2_GRID_SEGMENTS */
+ { 16246, 0x00000DB1 }, /* GL_MAP2_INDEX */
+ { 16260, 0x00000DB2 }, /* GL_MAP2_NORMAL */
+ { 16275, 0x00000DB3 }, /* GL_MAP2_TEXTURE_COORD_1 */
+ { 16299, 0x00000DB4 }, /* GL_MAP2_TEXTURE_COORD_2 */
+ { 16323, 0x00000DB5 }, /* GL_MAP2_TEXTURE_COORD_3 */
+ { 16347, 0x00000DB6 }, /* GL_MAP2_TEXTURE_COORD_4 */
+ { 16371, 0x00000DB7 }, /* GL_MAP2_VERTEX_3 */
+ { 16388, 0x00000DB8 }, /* GL_MAP2_VERTEX_4 */
+ { 16405, 0x00008670 }, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */
+ { 16433, 0x0000867A }, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */
+ { 16462, 0x0000867B }, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */
+ { 16491, 0x0000867C }, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */
+ { 16520, 0x0000867D }, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */
+ { 16549, 0x0000867E }, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */
+ { 16578, 0x0000867F }, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */
+ { 16607, 0x00008671 }, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */
+ { 16635, 0x00008672 }, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */
+ { 16663, 0x00008673 }, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */
+ { 16691, 0x00008674 }, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */
+ { 16719, 0x00008675 }, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */
+ { 16747, 0x00008676 }, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */
+ { 16775, 0x00008677 }, /* GL_MAP2_VERTEX_ATTRIB7_4_NV */
+ { 16803, 0x00008678 }, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */
+ { 16831, 0x00008679 }, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */
+ { 16859, 0x00000D10 }, /* GL_MAP_COLOR */
+ { 16872, 0x00000010 }, /* GL_MAP_FLUSH_EXPLICIT_BIT */
+ { 16898, 0x00000008 }, /* GL_MAP_INVALIDATE_BUFFER_BIT */
+ { 16927, 0x00000004 }, /* GL_MAP_INVALIDATE_RANGE_BIT */
+ { 16955, 0x00000001 }, /* GL_MAP_READ_BIT */
+ { 16971, 0x00000D11 }, /* GL_MAP_STENCIL */
+ { 16986, 0x00000020 }, /* GL_MAP_UNSYNCHRONIZED_BIT */
+ { 17012, 0x00000002 }, /* GL_MAP_WRITE_BIT */
+ { 17029, 0x000088C0 }, /* GL_MATRIX0_ARB */
+ { 17044, 0x00008630 }, /* GL_MATRIX0_NV */
+ { 17058, 0x000088CA }, /* GL_MATRIX10_ARB */
+ { 17074, 0x000088CB }, /* GL_MATRIX11_ARB */
+ { 17090, 0x000088CC }, /* GL_MATRIX12_ARB */
+ { 17106, 0x000088CD }, /* GL_MATRIX13_ARB */
+ { 17122, 0x000088CE }, /* GL_MATRIX14_ARB */
+ { 17138, 0x000088CF }, /* GL_MATRIX15_ARB */
+ { 17154, 0x000088D0 }, /* GL_MATRIX16_ARB */
+ { 17170, 0x000088D1 }, /* GL_MATRIX17_ARB */
+ { 17186, 0x000088D2 }, /* GL_MATRIX18_ARB */
+ { 17202, 0x000088D3 }, /* GL_MATRIX19_ARB */
+ { 17218, 0x000088C1 }, /* GL_MATRIX1_ARB */
+ { 17233, 0x00008631 }, /* GL_MATRIX1_NV */
+ { 17247, 0x000088D4 }, /* GL_MATRIX20_ARB */
+ { 17263, 0x000088D5 }, /* GL_MATRIX21_ARB */
+ { 17279, 0x000088D6 }, /* GL_MATRIX22_ARB */
+ { 17295, 0x000088D7 }, /* GL_MATRIX23_ARB */
+ { 17311, 0x000088D8 }, /* GL_MATRIX24_ARB */
+ { 17327, 0x000088D9 }, /* GL_MATRIX25_ARB */
+ { 17343, 0x000088DA }, /* GL_MATRIX26_ARB */
+ { 17359, 0x000088DB }, /* GL_MATRIX27_ARB */
+ { 17375, 0x000088DC }, /* GL_MATRIX28_ARB */
+ { 17391, 0x000088DD }, /* GL_MATRIX29_ARB */
+ { 17407, 0x000088C2 }, /* GL_MATRIX2_ARB */
+ { 17422, 0x00008632 }, /* GL_MATRIX2_NV */
+ { 17436, 0x000088DE }, /* GL_MATRIX30_ARB */
+ { 17452, 0x000088DF }, /* GL_MATRIX31_ARB */
+ { 17468, 0x000088C3 }, /* GL_MATRIX3_ARB */
+ { 17483, 0x00008633 }, /* GL_MATRIX3_NV */
+ { 17497, 0x000088C4 }, /* GL_MATRIX4_ARB */
+ { 17512, 0x00008634 }, /* GL_MATRIX4_NV */
+ { 17526, 0x000088C5 }, /* GL_MATRIX5_ARB */
+ { 17541, 0x00008635 }, /* GL_MATRIX5_NV */
+ { 17555, 0x000088C6 }, /* GL_MATRIX6_ARB */
+ { 17570, 0x00008636 }, /* GL_MATRIX6_NV */
+ { 17584, 0x000088C7 }, /* GL_MATRIX7_ARB */
+ { 17599, 0x00008637 }, /* GL_MATRIX7_NV */
+ { 17613, 0x000088C8 }, /* GL_MATRIX8_ARB */
+ { 17628, 0x000088C9 }, /* GL_MATRIX9_ARB */
+ { 17643, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_ARB */
+ { 17669, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */
+ { 17703, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */
+ { 17734, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */
+ { 17767, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */
+ { 17798, 0x00000BA0 }, /* GL_MATRIX_MODE */
+ { 17813, 0x00008840 }, /* GL_MATRIX_PALETTE_ARB */
+ { 17835, 0x00008008 }, /* GL_MAX */
+ { 17842, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE */
+ { 17865, 0x000088FF }, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */
+ { 17897, 0x00000D35 }, /* GL_MAX_ATTRIB_STACK_DEPTH */
+ { 17923, 0x00000D3B }, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */
+ { 17956, 0x00008177 }, /* GL_MAX_CLIPMAP_DEPTH_SGIX */
+ { 17982, 0x00008178 }, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */
+ { 18016, 0x00000D32 }, /* GL_MAX_CLIP_PLANES */
+ { 18035, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS */
+ { 18060, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS_EXT */
+ { 18089, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */
+ { 18121, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI */
+ { 18157, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */
+ { 18193, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB */
+ { 18233, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT */
+ { 18259, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT_EXT */
+ { 18289, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH */
+ { 18314, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH_EXT */
+ { 18343, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */
+ { 18372, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB */
+ { 18405, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS */
+ { 18425, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ARB */
+ { 18449, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ATI */
+ { 18473, 0x000080E9 }, /* GL_MAX_ELEMENTS_INDICES */
+ { 18497, 0x000080E8 }, /* GL_MAX_ELEMENTS_VERTICES */
+ { 18522, 0x00000D30 }, /* GL_MAX_EVAL_ORDER */
+ { 18540, 0x00008008 }, /* GL_MAX_EXT */
+ { 18551, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */
+ { 18586, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB */
+ { 18625, 0x00000D31 }, /* GL_MAX_LIGHTS */
+ { 18639, 0x00000B31 }, /* GL_MAX_LIST_NESTING */
+ { 18659, 0x00008841 }, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */
+ { 18697, 0x00000D36 }, /* GL_MAX_MODELVIEW_STACK_DEPTH */
+ { 18726, 0x00000D37 }, /* GL_MAX_NAME_STACK_DEPTH */
+ { 18750, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_ARB */
+ { 18778, 0x00000D34 }, /* GL_MAX_PIXEL_MAP_TABLE */
+ { 18801, 0x000088B1 }, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */
+ { 18838, 0x0000880B }, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */
+ { 18874, 0x000088AD }, /* GL_MAX_PROGRAM_ATTRIBS_ARB */
+ { 18901, 0x000088F5 }, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */
+ { 18930, 0x000088B5 }, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */
+ { 18964, 0x000088F4 }, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */
+ { 19000, 0x000088F6 }, /* GL_MAX_PROGRAM_IF_DEPTH_NV */
+ { 19027, 0x000088A1 }, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */
+ { 19059, 0x000088B4 }, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */
+ { 19095, 0x000088F8 }, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */
+ { 19124, 0x000088F7 }, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */
+ { 19153, 0x0000862F }, /* GL_MAX_PROGRAM_MATRICES_ARB */
+ { 19181, 0x0000862E }, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */
+ { 19219, 0x000088B3 }, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
+ { 19263, 0x0000880E }, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
+ { 19306, 0x000088AF }, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */
+ { 19340, 0x000088A3 }, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
+ { 19379, 0x000088AB }, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */
+ { 19416, 0x000088A7 }, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */
+ { 19454, 0x00008810 }, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
+ { 19497, 0x0000880F }, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
+ { 19540, 0x000088A9 }, /* GL_MAX_PROGRAM_PARAMETERS_ARB */
+ { 19570, 0x000088A5 }, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */
+ { 19601, 0x0000880D }, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */
+ { 19637, 0x0000880C }, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */
+ { 19673, 0x00000D38 }, /* GL_MAX_PROJECTION_STACK_DEPTH */
+ { 19703, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */
+ { 19737, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_NV */
+ { 19770, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE */
+ { 19795, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_EXT */
+ { 19824, 0x00008D57 }, /* GL_MAX_SAMPLES */
+ { 19839, 0x00008D57 }, /* GL_MAX_SAMPLES_EXT */
+ { 19858, 0x00009111 }, /* GL_MAX_SERVER_WAIT_TIMEOUT */
+ { 19885, 0x00008504 }, /* GL_MAX_SHININESS_NV */
+ { 19905, 0x00008505 }, /* GL_MAX_SPOT_EXPONENT_NV */
+ { 19929, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS */
+ { 19951, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS_ARB */
+ { 19977, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS */
+ { 20004, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS_ARB */
+ { 20035, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS */
+ { 20059, 0x000084FF }, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */
+ { 20093, 0x00000D33 }, /* GL_MAX_TEXTURE_SIZE */
+ { 20113, 0x00000D39 }, /* GL_MAX_TEXTURE_STACK_DEPTH */
+ { 20140, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS */
+ { 20161, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS_ARB */
+ { 20186, 0x0000862F }, /* GL_MAX_TRACK_MATRICES_NV */
+ { 20211, 0x0000862E }, /* GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV */
+ { 20246, 0x00008C8A }, /* GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT */
+ { 20299, 0x00008C8B }, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT */
+ { 20346, 0x00008C80 }, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT */
+ { 20396, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS */
+ { 20418, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS_ARB */
+ { 20444, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS */
+ { 20466, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS_ARB */
+ { 20492, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */
+ { 20526, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */
+ { 20564, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */
+ { 20597, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB */
+ { 20634, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_ARB */
+ { 20658, 0x00000D3A }, /* GL_MAX_VIEWPORT_DIMS */
+ { 20679, 0x00008007 }, /* GL_MIN */
+ { 20686, 0x0000802E }, /* GL_MINMAX */
+ { 20696, 0x0000802E }, /* GL_MINMAX_EXT */
+ { 20710, 0x0000802F }, /* GL_MINMAX_FORMAT */
+ { 20727, 0x0000802F }, /* GL_MINMAX_FORMAT_EXT */
+ { 20748, 0x00008030 }, /* GL_MINMAX_SINK */
+ { 20763, 0x00008030 }, /* GL_MINMAX_SINK_EXT */
+ { 20782, 0x00008007 }, /* GL_MIN_EXT */
+ { 20793, 0x00008370 }, /* GL_MIRRORED_REPEAT */
+ { 20812, 0x00008370 }, /* GL_MIRRORED_REPEAT_ARB */
+ { 20835, 0x00008370 }, /* GL_MIRRORED_REPEAT_IBM */
+ { 20858, 0x00008742 }, /* GL_MIRROR_CLAMP_ATI */
+ { 20878, 0x00008742 }, /* GL_MIRROR_CLAMP_EXT */
+ { 20898, 0x00008912 }, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */
+ { 20928, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_ATI */
+ { 20956, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */
+ { 20984, 0x00001700 }, /* GL_MODELVIEW */
+ { 20997, 0x00001700 }, /* GL_MODELVIEW0_ARB */
+ { 21015, 0x0000872A }, /* GL_MODELVIEW10_ARB */
+ { 21034, 0x0000872B }, /* GL_MODELVIEW11_ARB */
+ { 21053, 0x0000872C }, /* GL_MODELVIEW12_ARB */
+ { 21072, 0x0000872D }, /* GL_MODELVIEW13_ARB */
+ { 21091, 0x0000872E }, /* GL_MODELVIEW14_ARB */
+ { 21110, 0x0000872F }, /* GL_MODELVIEW15_ARB */
+ { 21129, 0x00008730 }, /* GL_MODELVIEW16_ARB */
+ { 21148, 0x00008731 }, /* GL_MODELVIEW17_ARB */
+ { 21167, 0x00008732 }, /* GL_MODELVIEW18_ARB */
+ { 21186, 0x00008733 }, /* GL_MODELVIEW19_ARB */
+ { 21205, 0x0000850A }, /* GL_MODELVIEW1_ARB */
+ { 21223, 0x00008734 }, /* GL_MODELVIEW20_ARB */
+ { 21242, 0x00008735 }, /* GL_MODELVIEW21_ARB */
+ { 21261, 0x00008736 }, /* GL_MODELVIEW22_ARB */
+ { 21280, 0x00008737 }, /* GL_MODELVIEW23_ARB */
+ { 21299, 0x00008738 }, /* GL_MODELVIEW24_ARB */
+ { 21318, 0x00008739 }, /* GL_MODELVIEW25_ARB */
+ { 21337, 0x0000873A }, /* GL_MODELVIEW26_ARB */
+ { 21356, 0x0000873B }, /* GL_MODELVIEW27_ARB */
+ { 21375, 0x0000873C }, /* GL_MODELVIEW28_ARB */
+ { 21394, 0x0000873D }, /* GL_MODELVIEW29_ARB */
+ { 21413, 0x00008722 }, /* GL_MODELVIEW2_ARB */
+ { 21431, 0x0000873E }, /* GL_MODELVIEW30_ARB */
+ { 21450, 0x0000873F }, /* GL_MODELVIEW31_ARB */
+ { 21469, 0x00008723 }, /* GL_MODELVIEW3_ARB */
+ { 21487, 0x00008724 }, /* GL_MODELVIEW4_ARB */
+ { 21505, 0x00008725 }, /* GL_MODELVIEW5_ARB */
+ { 21523, 0x00008726 }, /* GL_MODELVIEW6_ARB */
+ { 21541, 0x00008727 }, /* GL_MODELVIEW7_ARB */
+ { 21559, 0x00008728 }, /* GL_MODELVIEW8_ARB */
+ { 21577, 0x00008729 }, /* GL_MODELVIEW9_ARB */
+ { 21595, 0x00000BA6 }, /* GL_MODELVIEW_MATRIX */
+ { 21615, 0x00008629 }, /* GL_MODELVIEW_PROJECTION_NV */
+ { 21642, 0x00000BA3 }, /* GL_MODELVIEW_STACK_DEPTH */
+ { 21667, 0x00002100 }, /* GL_MODULATE */
+ { 21679, 0x00008744 }, /* GL_MODULATE_ADD_ATI */
+ { 21699, 0x00008745 }, /* GL_MODULATE_SIGNED_ADD_ATI */
+ { 21726, 0x00008746 }, /* GL_MODULATE_SUBTRACT_ATI */
+ { 21751, 0x00000103 }, /* GL_MULT */
+ { 21759, 0x0000809D }, /* GL_MULTISAMPLE */
+ { 21774, 0x000086B2 }, /* GL_MULTISAMPLE_3DFX */
+ { 21794, 0x0000809D }, /* GL_MULTISAMPLE_ARB */
+ { 21813, 0x20000000 }, /* GL_MULTISAMPLE_BIT */
+ { 21832, 0x20000000 }, /* GL_MULTISAMPLE_BIT_3DFX */
+ { 21856, 0x20000000 }, /* GL_MULTISAMPLE_BIT_ARB */
+ { 21879, 0x00008534 }, /* GL_MULTISAMPLE_FILTER_HINT_NV */
+ { 21909, 0x00002A25 }, /* GL_N3F_V3F */
+ { 21920, 0x00000D70 }, /* GL_NAME_STACK_DEPTH */
+ { 21940, 0x0000150E }, /* GL_NAND */
+ { 21948, 0x00002600 }, /* GL_NEAREST */
+ { 21959, 0x0000844E }, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */
+ { 21990, 0x0000844D }, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */
+ { 22022, 0x00002702 }, /* GL_NEAREST_MIPMAP_LINEAR */
+ { 22047, 0x00002700 }, /* GL_NEAREST_MIPMAP_NEAREST */
+ { 22073, 0x00000200 }, /* GL_NEVER */
+ { 22082, 0x00001102 }, /* GL_NICEST */
+ { 22092, 0x00000000 }, /* GL_NONE */
+ { 22100, 0x00001505 }, /* GL_NOOP */
+ { 22108, 0x00001508 }, /* GL_NOR */
+ { 22115, 0x00000BA1 }, /* GL_NORMALIZE */
+ { 22128, 0x00008075 }, /* GL_NORMAL_ARRAY */
+ { 22144, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING */
+ { 22175, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING_ARB */
+ { 22210, 0x0000808F }, /* GL_NORMAL_ARRAY_POINTER */
+ { 22234, 0x0000807F }, /* GL_NORMAL_ARRAY_STRIDE */
+ { 22257, 0x0000807E }, /* GL_NORMAL_ARRAY_TYPE */
+ { 22278, 0x00008511 }, /* GL_NORMAL_MAP */
+ { 22292, 0x00008511 }, /* GL_NORMAL_MAP_ARB */
+ { 22310, 0x00008511 }, /* GL_NORMAL_MAP_NV */
+ { 22327, 0x00000205 }, /* GL_NOTEQUAL */
+ { 22339, 0x00000000 }, /* GL_NO_ERROR */
+ { 22351, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */
+ { 22385, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB */
+ { 22423, 0x00008B89 }, /* GL_OBJECT_ACTIVE_ATTRIBUTES_ARB */
+ { 22455, 0x00008B8A }, /* GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB */
+ { 22497, 0x00008B86 }, /* GL_OBJECT_ACTIVE_UNIFORMS_ARB */
+ { 22527, 0x00008B87 }, /* GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB */
+ { 22567, 0x00008B85 }, /* GL_OBJECT_ATTACHED_OBJECTS_ARB */
+ { 22598, 0x00008B81 }, /* GL_OBJECT_COMPILE_STATUS_ARB */
+ { 22627, 0x00008B80 }, /* GL_OBJECT_DELETE_STATUS_ARB */
+ { 22655, 0x00008B84 }, /* GL_OBJECT_INFO_LOG_LENGTH_ARB */
+ { 22685, 0x00002401 }, /* GL_OBJECT_LINEAR */
+ { 22702, 0x00008B82 }, /* GL_OBJECT_LINK_STATUS_ARB */
+ { 22728, 0x00002501 }, /* GL_OBJECT_PLANE */
+ { 22744, 0x00008B88 }, /* GL_OBJECT_SHADER_SOURCE_LENGTH_ARB */
+ { 22779, 0x00008B4F }, /* GL_OBJECT_SUBTYPE_ARB */
+ { 22801, 0x00009112 }, /* GL_OBJECT_TYPE */
+ { 22816, 0x00008B4E }, /* GL_OBJECT_TYPE_ARB */
+ { 22835, 0x00008B83 }, /* GL_OBJECT_VALIDATE_STATUS_ARB */
+ { 22865, 0x00008165 }, /* GL_OCCLUSION_TEST_HP */
+ { 22886, 0x00008166 }, /* GL_OCCLUSION_TEST_RESULT_HP */
+ { 22914, 0x00000001 }, /* GL_ONE */
+ { 22921, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA */
+ { 22949, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA_EXT */
+ { 22981, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR */
+ { 23009, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR_EXT */
+ { 23041, 0x00000305 }, /* GL_ONE_MINUS_DST_ALPHA */
+ { 23064, 0x00000307 }, /* GL_ONE_MINUS_DST_COLOR */
+ { 23087, 0x00000303 }, /* GL_ONE_MINUS_SRC_ALPHA */
+ { 23110, 0x00000301 }, /* GL_ONE_MINUS_SRC_COLOR */
+ { 23133, 0x00008598 }, /* GL_OPERAND0_ALPHA */
+ { 23151, 0x00008598 }, /* GL_OPERAND0_ALPHA_ARB */
+ { 23173, 0x00008598 }, /* GL_OPERAND0_ALPHA_EXT */
+ { 23195, 0x00008590 }, /* GL_OPERAND0_RGB */
+ { 23211, 0x00008590 }, /* GL_OPERAND0_RGB_ARB */
+ { 23231, 0x00008590 }, /* GL_OPERAND0_RGB_EXT */
+ { 23251, 0x00008599 }, /* GL_OPERAND1_ALPHA */
+ { 23269, 0x00008599 }, /* GL_OPERAND1_ALPHA_ARB */
+ { 23291, 0x00008599 }, /* GL_OPERAND1_ALPHA_EXT */
+ { 23313, 0x00008591 }, /* GL_OPERAND1_RGB */
+ { 23329, 0x00008591 }, /* GL_OPERAND1_RGB_ARB */
+ { 23349, 0x00008591 }, /* GL_OPERAND1_RGB_EXT */
+ { 23369, 0x0000859A }, /* GL_OPERAND2_ALPHA */
+ { 23387, 0x0000859A }, /* GL_OPERAND2_ALPHA_ARB */
+ { 23409, 0x0000859A }, /* GL_OPERAND2_ALPHA_EXT */
+ { 23431, 0x00008592 }, /* GL_OPERAND2_RGB */
+ { 23447, 0x00008592 }, /* GL_OPERAND2_RGB_ARB */
+ { 23467, 0x00008592 }, /* GL_OPERAND2_RGB_EXT */
+ { 23487, 0x0000859B }, /* GL_OPERAND3_ALPHA_NV */
+ { 23508, 0x00008593 }, /* GL_OPERAND3_RGB_NV */
+ { 23527, 0x00001507 }, /* GL_OR */
+ { 23533, 0x00000A01 }, /* GL_ORDER */
+ { 23542, 0x0000150D }, /* GL_OR_INVERTED */
+ { 23557, 0x0000150B }, /* GL_OR_REVERSE */
+ { 23571, 0x00000505 }, /* GL_OUT_OF_MEMORY */
+ { 23588, 0x00000D05 }, /* GL_PACK_ALIGNMENT */
+ { 23606, 0x0000806C }, /* GL_PACK_IMAGE_HEIGHT */
+ { 23627, 0x00008758 }, /* GL_PACK_INVERT_MESA */
+ { 23647, 0x00000D01 }, /* GL_PACK_LSB_FIRST */
+ { 23665, 0x00000D02 }, /* GL_PACK_ROW_LENGTH */
+ { 23684, 0x0000806B }, /* GL_PACK_SKIP_IMAGES */
+ { 23704, 0x00000D04 }, /* GL_PACK_SKIP_PIXELS */
+ { 23724, 0x00000D03 }, /* GL_PACK_SKIP_ROWS */
+ { 23742, 0x00000D00 }, /* GL_PACK_SWAP_BYTES */
+ { 23761, 0x00008B92 }, /* GL_PALETTE4_R5_G6_B5_OES */
+ { 23786, 0x00008B94 }, /* GL_PALETTE4_RGB5_A1_OES */
+ { 23810, 0x00008B90 }, /* GL_PALETTE4_RGB8_OES */
+ { 23831, 0x00008B93 }, /* GL_PALETTE4_RGBA4_OES */
+ { 23853, 0x00008B91 }, /* GL_PALETTE4_RGBA8_OES */
+ { 23875, 0x00008B97 }, /* GL_PALETTE8_R5_G6_B5_OES */
+ { 23900, 0x00008B99 }, /* GL_PALETTE8_RGB5_A1_OES */
+ { 23924, 0x00008B95 }, /* GL_PALETTE8_RGB8_OES */
+ { 23945, 0x00008B98 }, /* GL_PALETTE8_RGBA4_OES */
+ { 23967, 0x00008B96 }, /* GL_PALETTE8_RGBA8_OES */
+ { 23989, 0x00000700 }, /* GL_PASS_THROUGH_TOKEN */
+ { 24011, 0x00000C50 }, /* GL_PERSPECTIVE_CORRECTION_HINT */
+ { 24042, 0x00000C79 }, /* GL_PIXEL_MAP_A_TO_A */
+ { 24062, 0x00000CB9 }, /* GL_PIXEL_MAP_A_TO_A_SIZE */
+ { 24087, 0x00000C78 }, /* GL_PIXEL_MAP_B_TO_B */
+ { 24107, 0x00000CB8 }, /* GL_PIXEL_MAP_B_TO_B_SIZE */
+ { 24132, 0x00000C77 }, /* GL_PIXEL_MAP_G_TO_G */
+ { 24152, 0x00000CB7 }, /* GL_PIXEL_MAP_G_TO_G_SIZE */
+ { 24177, 0x00000C75 }, /* GL_PIXEL_MAP_I_TO_A */
+ { 24197, 0x00000CB5 }, /* GL_PIXEL_MAP_I_TO_A_SIZE */
+ { 24222, 0x00000C74 }, /* GL_PIXEL_MAP_I_TO_B */
+ { 24242, 0x00000CB4 }, /* GL_PIXEL_MAP_I_TO_B_SIZE */
+ { 24267, 0x00000C73 }, /* GL_PIXEL_MAP_I_TO_G */
+ { 24287, 0x00000CB3 }, /* GL_PIXEL_MAP_I_TO_G_SIZE */
+ { 24312, 0x00000C70 }, /* GL_PIXEL_MAP_I_TO_I */
+ { 24332, 0x00000CB0 }, /* GL_PIXEL_MAP_I_TO_I_SIZE */
+ { 24357, 0x00000C72 }, /* GL_PIXEL_MAP_I_TO_R */
+ { 24377, 0x00000CB2 }, /* GL_PIXEL_MAP_I_TO_R_SIZE */
+ { 24402, 0x00000C76 }, /* GL_PIXEL_MAP_R_TO_R */
+ { 24422, 0x00000CB6 }, /* GL_PIXEL_MAP_R_TO_R_SIZE */
+ { 24447, 0x00000C71 }, /* GL_PIXEL_MAP_S_TO_S */
+ { 24467, 0x00000CB1 }, /* GL_PIXEL_MAP_S_TO_S_SIZE */
+ { 24492, 0x00000020 }, /* GL_PIXEL_MODE_BIT */
+ { 24510, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER */
+ { 24531, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING */
+ { 24560, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING_EXT */
+ { 24593, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER_EXT */
+ { 24618, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER */
+ { 24641, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING */
+ { 24672, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING_EXT */
+ { 24707, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER_EXT */
+ { 24734, 0x00001B00 }, /* GL_POINT */
+ { 24743, 0x00000000 }, /* GL_POINTS */
+ { 24753, 0x00000002 }, /* GL_POINT_BIT */
+ { 24766, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION */
+ { 24796, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_ARB */
+ { 24830, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_EXT */
+ { 24864, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_SGIS */
+ { 24899, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE */
+ { 24928, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_ARB */
+ { 24961, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_EXT */
+ { 24994, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_SGIS */
+ { 25028, 0x00000B11 }, /* GL_POINT_SIZE */
+ { 25042, 0x00000B13 }, /* GL_POINT_SIZE_GRANULARITY */
+ { 25068, 0x00008127 }, /* GL_POINT_SIZE_MAX */
+ { 25086, 0x00008127 }, /* GL_POINT_SIZE_MAX_ARB */
+ { 25108, 0x00008127 }, /* GL_POINT_SIZE_MAX_EXT */
+ { 25130, 0x00008127 }, /* GL_POINT_SIZE_MAX_SGIS */
+ { 25153, 0x00008126 }, /* GL_POINT_SIZE_MIN */
+ { 25171, 0x00008126 }, /* GL_POINT_SIZE_MIN_ARB */
+ { 25193, 0x00008126 }, /* GL_POINT_SIZE_MIN_EXT */
+ { 25215, 0x00008126 }, /* GL_POINT_SIZE_MIN_SGIS */
+ { 25238, 0x00000B12 }, /* GL_POINT_SIZE_RANGE */
+ { 25258, 0x00000B10 }, /* GL_POINT_SMOOTH */
+ { 25274, 0x00000C51 }, /* GL_POINT_SMOOTH_HINT */
+ { 25295, 0x00008861 }, /* GL_POINT_SPRITE */
+ { 25311, 0x00008861 }, /* GL_POINT_SPRITE_ARB */
+ { 25331, 0x00008CA0 }, /* GL_POINT_SPRITE_COORD_ORIGIN */
+ { 25360, 0x00008861 }, /* GL_POINT_SPRITE_NV */
+ { 25379, 0x00008863 }, /* GL_POINT_SPRITE_R_MODE_NV */
+ { 25405, 0x00000701 }, /* GL_POINT_TOKEN */
+ { 25420, 0x00000009 }, /* GL_POLYGON */
+ { 25431, 0x00000008 }, /* GL_POLYGON_BIT */
+ { 25446, 0x00000B40 }, /* GL_POLYGON_MODE */
+ { 25462, 0x00008039 }, /* GL_POLYGON_OFFSET_BIAS */
+ { 25485, 0x00008038 }, /* GL_POLYGON_OFFSET_FACTOR */
+ { 25510, 0x00008037 }, /* GL_POLYGON_OFFSET_FILL */
+ { 25533, 0x00002A02 }, /* GL_POLYGON_OFFSET_LINE */
+ { 25556, 0x00002A01 }, /* GL_POLYGON_OFFSET_POINT */
+ { 25580, 0x00002A00 }, /* GL_POLYGON_OFFSET_UNITS */
+ { 25604, 0x00000B41 }, /* GL_POLYGON_SMOOTH */
+ { 25622, 0x00000C53 }, /* GL_POLYGON_SMOOTH_HINT */
+ { 25645, 0x00000B42 }, /* GL_POLYGON_STIPPLE */
+ { 25664, 0x00000010 }, /* GL_POLYGON_STIPPLE_BIT */
+ { 25687, 0x00000703 }, /* GL_POLYGON_TOKEN */
+ { 25704, 0x00001203 }, /* GL_POSITION */
+ { 25716, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */
+ { 25748, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI */
+ { 25784, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */
+ { 25817, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI */
+ { 25854, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */
+ { 25885, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI */
+ { 25920, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */
+ { 25952, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI */
+ { 25988, 0x000080D2 }, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */
+ { 26021, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */
+ { 26053, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI */
+ { 26089, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */
+ { 26122, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI */
+ { 26159, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS */
+ { 26189, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS_SGI */
+ { 26223, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE */
+ { 26254, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE_SGI */
+ { 26289, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS */
+ { 26320, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS_EXT */
+ { 26355, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE */
+ { 26387, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE_EXT */
+ { 26423, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS */
+ { 26453, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS_EXT */
+ { 26487, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE */
+ { 26518, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE_EXT */
+ { 26553, 0x000080D1 }, /* GL_POST_CONVOLUTION_COLOR_TABLE */
+ { 26585, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS */
+ { 26616, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS_EXT */
+ { 26651, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE */
+ { 26683, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE_EXT */
+ { 26719, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS */
+ { 26748, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS_EXT */
+ { 26781, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE */
+ { 26811, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE_EXT */
+ { 26845, 0x0000817B }, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */
+ { 26884, 0x00008179 }, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */
+ { 26917, 0x0000817C }, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */
+ { 26957, 0x0000817A }, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */
+ { 26991, 0x00008578 }, /* GL_PREVIOUS */
+ { 27003, 0x00008578 }, /* GL_PREVIOUS_ARB */
+ { 27019, 0x00008578 }, /* GL_PREVIOUS_EXT */
+ { 27035, 0x00008577 }, /* GL_PRIMARY_COLOR */
+ { 27052, 0x00008577 }, /* GL_PRIMARY_COLOR_ARB */
+ { 27073, 0x00008577 }, /* GL_PRIMARY_COLOR_EXT */
+ { 27094, 0x00008C87 }, /* GL_PRIMITIVES_GENERATED_EXT */
+ { 27122, 0x000088B0 }, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */
+ { 27155, 0x00008805 }, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */
+ { 27187, 0x000088AC }, /* GL_PROGRAM_ATTRIBS_ARB */
+ { 27210, 0x00008677 }, /* GL_PROGRAM_BINDING_ARB */
+ { 27233, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_ARB */
+ { 27263, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_NV */
+ { 27292, 0x00008874 }, /* GL_PROGRAM_ERROR_STRING_ARB */
+ { 27320, 0x00008876 }, /* GL_PROGRAM_FORMAT_ARB */
+ { 27342, 0x00008875 }, /* GL_PROGRAM_FORMAT_ASCII_ARB */
+ { 27370, 0x000088A0 }, /* GL_PROGRAM_INSTRUCTIONS_ARB */
+ { 27398, 0x00008627 }, /* GL_PROGRAM_LENGTH_ARB */
+ { 27420, 0x00008627 }, /* GL_PROGRAM_LENGTH_NV */
+ { 27441, 0x000088B2 }, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
+ { 27481, 0x00008808 }, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
+ { 27520, 0x000088AE }, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */
+ { 27550, 0x000088A2 }, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
+ { 27585, 0x000088AA }, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */
+ { 27618, 0x000088A6 }, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */
+ { 27652, 0x0000880A }, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
+ { 27691, 0x00008809 }, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
+ { 27730, 0x00008B40 }, /* GL_PROGRAM_OBJECT_ARB */
+ { 27752, 0x000088A8 }, /* GL_PROGRAM_PARAMETERS_ARB */
+ { 27778, 0x00008644 }, /* GL_PROGRAM_PARAMETER_NV */
+ { 27802, 0x00008647 }, /* GL_PROGRAM_RESIDENT_NV */
+ { 27825, 0x00008628 }, /* GL_PROGRAM_STRING_ARB */
+ { 27847, 0x00008628 }, /* GL_PROGRAM_STRING_NV */
+ { 27868, 0x00008646 }, /* GL_PROGRAM_TARGET_NV */
+ { 27889, 0x000088A4 }, /* GL_PROGRAM_TEMPORARIES_ARB */
+ { 27916, 0x00008807 }, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */
+ { 27948, 0x00008806 }, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */
+ { 27980, 0x000088B6 }, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */
+ { 28015, 0x00001701 }, /* GL_PROJECTION */
+ { 28029, 0x00000BA7 }, /* GL_PROJECTION_MATRIX */
+ { 28050, 0x00000BA4 }, /* GL_PROJECTION_STACK_DEPTH */
+ { 28076, 0x00008E4F }, /* GL_PROVOKING_VERTEX */
+ { 28096, 0x00008E4F }, /* GL_PROVOKING_VERTEX_EXT */
+ { 28120, 0x000080D3 }, /* GL_PROXY_COLOR_TABLE */
+ { 28141, 0x00008025 }, /* GL_PROXY_HISTOGRAM */
+ { 28160, 0x00008025 }, /* GL_PROXY_HISTOGRAM_EXT */
+ { 28183, 0x000080D5 }, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */
+ { 28222, 0x000080D4 }, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */
+ { 28260, 0x00008063 }, /* GL_PROXY_TEXTURE_1D */
+ { 28280, 0x00008C19 }, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */
+ { 28310, 0x00008063 }, /* GL_PROXY_TEXTURE_1D_EXT */
+ { 28334, 0x00008064 }, /* GL_PROXY_TEXTURE_2D */
+ { 28354, 0x00008C1B }, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */
+ { 28384, 0x00008064 }, /* GL_PROXY_TEXTURE_2D_EXT */
+ { 28408, 0x00008070 }, /* GL_PROXY_TEXTURE_3D */
+ { 28428, 0x000080BD }, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */
+ { 28461, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP */
+ { 28487, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP_ARB */
+ { 28517, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */
+ { 28548, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_NV */
+ { 28578, 0x00008A1D }, /* GL_PURGEABLE_APPLE */
+ { 28597, 0x00002003 }, /* GL_Q */
+ { 28602, 0x00001209 }, /* GL_QUADRATIC_ATTENUATION */
+ { 28627, 0x00000007 }, /* GL_QUADS */
+ { 28636, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */
+ { 28680, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT */
+ { 28728, 0x00008614 }, /* GL_QUAD_MESH_SUN */
+ { 28745, 0x00000008 }, /* GL_QUAD_STRIP */
+ { 28759, 0x00008E16 }, /* GL_QUERY_BY_REGION_NO_WAIT_NV */
+ { 28789, 0x00008E15 }, /* GL_QUERY_BY_REGION_WAIT_NV */
+ { 28816, 0x00008864 }, /* GL_QUERY_COUNTER_BITS */
+ { 28838, 0x00008864 }, /* GL_QUERY_COUNTER_BITS_ARB */
+ { 28864, 0x00008E14 }, /* GL_QUERY_NO_WAIT_NV */
+ { 28884, 0x00008866 }, /* GL_QUERY_RESULT */
+ { 28900, 0x00008866 }, /* GL_QUERY_RESULT_ARB */
+ { 28920, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE */
+ { 28946, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE_ARB */
+ { 28976, 0x00008E13 }, /* GL_QUERY_WAIT_NV */
+ { 28993, 0x00002002 }, /* GL_R */
+ { 28998, 0x00002A10 }, /* GL_R3_G3_B2 */
+ { 29010, 0x00008C89 }, /* GL_RASTERIZER_DISCARD_EXT */
+ { 29036, 0x00019262 }, /* GL_RASTER_POSITION_UNCLIPPED_IBM */
+ { 29069, 0x00000C02 }, /* GL_READ_BUFFER */
+ { 29084, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER */
+ { 29104, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING */
+ { 29132, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING_EXT */
+ { 29164, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER_EXT */
+ { 29188, 0x000088B8 }, /* GL_READ_ONLY */
+ { 29201, 0x000088B8 }, /* GL_READ_ONLY_ARB */
+ { 29218, 0x000088BA }, /* GL_READ_WRITE */
+ { 29232, 0x000088BA }, /* GL_READ_WRITE_ARB */
+ { 29250, 0x00001903 }, /* GL_RED */
+ { 29257, 0x00008016 }, /* GL_REDUCE */
+ { 29267, 0x00008016 }, /* GL_REDUCE_EXT */
+ { 29281, 0x00000D15 }, /* GL_RED_BIAS */
+ { 29293, 0x00000D52 }, /* GL_RED_BITS */
+ { 29305, 0x00000D14 }, /* GL_RED_SCALE */
+ { 29318, 0x00008512 }, /* GL_REFLECTION_MAP */
+ { 29336, 0x00008512 }, /* GL_REFLECTION_MAP_ARB */
+ { 29358, 0x00008512 }, /* GL_REFLECTION_MAP_NV */
+ { 29379, 0x00008A19 }, /* GL_RELEASED_APPLE */
+ { 29397, 0x00001C00 }, /* GL_RENDER */
+ { 29407, 0x00008D41 }, /* GL_RENDERBUFFER */
+ { 29423, 0x00008D53 }, /* GL_RENDERBUFFER_ALPHA_SIZE */
+ { 29450, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING */
+ { 29474, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_EXT */
+ { 29502, 0x00008D52 }, /* GL_RENDERBUFFER_BLUE_SIZE */
+ { 29528, 0x00008D54 }, /* GL_RENDERBUFFER_DEPTH_SIZE */
+ { 29555, 0x00008D41 }, /* GL_RENDERBUFFER_EXT */
+ { 29575, 0x00008D51 }, /* GL_RENDERBUFFER_GREEN_SIZE */
+ { 29602, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT */
+ { 29625, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_EXT */
+ { 29652, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT */
+ { 29684, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_EXT */
+ { 29720, 0x00008D50 }, /* GL_RENDERBUFFER_RED_SIZE */
+ { 29745, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES */
+ { 29769, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES_EXT */
+ { 29797, 0x00008D55 }, /* GL_RENDERBUFFER_STENCIL_SIZE */
+ { 29826, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH */
+ { 29848, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_EXT */
+ { 29874, 0x00001F01 }, /* GL_RENDERER */
+ { 29886, 0x00000C40 }, /* GL_RENDER_MODE */
+ { 29901, 0x00002901 }, /* GL_REPEAT */
+ { 29911, 0x00001E01 }, /* GL_REPLACE */
+ { 29922, 0x00008062 }, /* GL_REPLACE_EXT */
+ { 29937, 0x00008153 }, /* GL_REPLICATE_BORDER_HP */
+ { 29960, 0x0000803A }, /* GL_RESCALE_NORMAL */
+ { 29978, 0x0000803A }, /* GL_RESCALE_NORMAL_EXT */
+ { 30000, 0x00008A1B }, /* GL_RETAINED_APPLE */
+ { 30018, 0x00000102 }, /* GL_RETURN */
+ { 30028, 0x00001907 }, /* GL_RGB */
+ { 30035, 0x00008052 }, /* GL_RGB10 */
+ { 30044, 0x00008059 }, /* GL_RGB10_A2 */
+ { 30056, 0x00008059 }, /* GL_RGB10_A2_EXT */
+ { 30072, 0x00008052 }, /* GL_RGB10_EXT */
+ { 30085, 0x00008053 }, /* GL_RGB12 */
+ { 30094, 0x00008053 }, /* GL_RGB12_EXT */
+ { 30107, 0x00008054 }, /* GL_RGB16 */
+ { 30116, 0x00008054 }, /* GL_RGB16_EXT */
+ { 30129, 0x0000804E }, /* GL_RGB2_EXT */
+ { 30141, 0x0000804F }, /* GL_RGB4 */
+ { 30149, 0x0000804F }, /* GL_RGB4_EXT */
+ { 30161, 0x000083A1 }, /* GL_RGB4_S3TC */
+ { 30174, 0x00008050 }, /* GL_RGB5 */
+ { 30182, 0x00008057 }, /* GL_RGB5_A1 */
+ { 30193, 0x00008057 }, /* GL_RGB5_A1_EXT */
+ { 30208, 0x00008050 }, /* GL_RGB5_EXT */
+ { 30220, 0x00008051 }, /* GL_RGB8 */
+ { 30228, 0x00008051 }, /* GL_RGB8_EXT */
+ { 30240, 0x00001908 }, /* GL_RGBA */
+ { 30248, 0x0000805A }, /* GL_RGBA12 */
+ { 30258, 0x0000805A }, /* GL_RGBA12_EXT */
+ { 30272, 0x0000805B }, /* GL_RGBA16 */
+ { 30282, 0x0000805B }, /* GL_RGBA16_EXT */
+ { 30296, 0x00008055 }, /* GL_RGBA2 */
+ { 30305, 0x00008055 }, /* GL_RGBA2_EXT */
+ { 30318, 0x00008056 }, /* GL_RGBA4 */
+ { 30327, 0x000083A5 }, /* GL_RGBA4_DXT5_S3TC */
+ { 30346, 0x00008056 }, /* GL_RGBA4_EXT */
+ { 30359, 0x000083A3 }, /* GL_RGBA4_S3TC */
+ { 30373, 0x00008058 }, /* GL_RGBA8 */
+ { 30382, 0x00008058 }, /* GL_RGBA8_EXT */
+ { 30395, 0x00008F97 }, /* GL_RGBA8_SNORM */
+ { 30410, 0x000083A4 }, /* GL_RGBA_DXT5_S3TC */
+ { 30428, 0x00000C31 }, /* GL_RGBA_MODE */
+ { 30441, 0x000083A2 }, /* GL_RGBA_S3TC */
+ { 30454, 0x00008F93 }, /* GL_RGBA_SNORM */
+ { 30468, 0x000083A0 }, /* GL_RGB_S3TC */
+ { 30480, 0x00008573 }, /* GL_RGB_SCALE */
+ { 30493, 0x00008573 }, /* GL_RGB_SCALE_ARB */
+ { 30510, 0x00008573 }, /* GL_RGB_SCALE_EXT */
+ { 30527, 0x00000407 }, /* GL_RIGHT */
+ { 30536, 0x00002000 }, /* GL_S */
+ { 30541, 0x00008B5D }, /* GL_SAMPLER_1D */
+ { 30555, 0x00008B61 }, /* GL_SAMPLER_1D_SHADOW */
+ { 30576, 0x00008B5E }, /* GL_SAMPLER_2D */
+ { 30590, 0x00008B62 }, /* GL_SAMPLER_2D_SHADOW */
+ { 30611, 0x00008B5F }, /* GL_SAMPLER_3D */
+ { 30625, 0x00008B60 }, /* GL_SAMPLER_CUBE */
+ { 30641, 0x000080A9 }, /* GL_SAMPLES */
+ { 30652, 0x000086B4 }, /* GL_SAMPLES_3DFX */
+ { 30668, 0x000080A9 }, /* GL_SAMPLES_ARB */
+ { 30683, 0x00008914 }, /* GL_SAMPLES_PASSED */
+ { 30701, 0x00008914 }, /* GL_SAMPLES_PASSED_ARB */
+ { 30723, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE */
+ { 30751, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE_ARB */
+ { 30783, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE */
+ { 30806, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE_ARB */
+ { 30833, 0x000080A8 }, /* GL_SAMPLE_BUFFERS */
+ { 30851, 0x000086B3 }, /* GL_SAMPLE_BUFFERS_3DFX */
+ { 30874, 0x000080A8 }, /* GL_SAMPLE_BUFFERS_ARB */
+ { 30896, 0x000080A0 }, /* GL_SAMPLE_COVERAGE */
+ { 30915, 0x000080A0 }, /* GL_SAMPLE_COVERAGE_ARB */
+ { 30938, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT */
+ { 30964, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT_ARB */
+ { 30994, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE */
+ { 31019, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE_ARB */
+ { 31048, 0x00080000 }, /* GL_SCISSOR_BIT */
+ { 31063, 0x00000C10 }, /* GL_SCISSOR_BOX */
+ { 31078, 0x00000C11 }, /* GL_SCISSOR_TEST */
+ { 31094, 0x0000845E }, /* GL_SECONDARY_COLOR_ARRAY */
+ { 31119, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */
+ { 31159, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB */
+ { 31203, 0x0000845D }, /* GL_SECONDARY_COLOR_ARRAY_POINTER */
+ { 31236, 0x0000845A }, /* GL_SECONDARY_COLOR_ARRAY_SIZE */
+ { 31266, 0x0000845C }, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */
+ { 31298, 0x0000845B }, /* GL_SECONDARY_COLOR_ARRAY_TYPE */
+ { 31328, 0x00001C02 }, /* GL_SELECT */
+ { 31338, 0x00000DF3 }, /* GL_SELECTION_BUFFER_POINTER */
+ { 31366, 0x00000DF4 }, /* GL_SELECTION_BUFFER_SIZE */
+ { 31391, 0x00008012 }, /* GL_SEPARABLE_2D */
+ { 31407, 0x00008C8D }, /* GL_SEPARATE_ATTRIBS_EXT */
+ { 31431, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR */
+ { 31458, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR_EXT */
+ { 31489, 0x0000150F }, /* GL_SET */
+ { 31496, 0x00008B48 }, /* GL_SHADER_OBJECT_ARB */
+ { 31517, 0x00008B88 }, /* GL_SHADER_SOURCE_LENGTH */
+ { 31541, 0x00008B4F }, /* GL_SHADER_TYPE */
+ { 31556, 0x00000B54 }, /* GL_SHADE_MODEL */
+ { 31571, 0x00008B8C }, /* GL_SHADING_LANGUAGE_VERSION */
+ { 31599, 0x000080BF }, /* GL_SHADOW_AMBIENT_SGIX */
+ { 31622, 0x000081FB }, /* GL_SHARED_TEXTURE_PALETTE_EXT */
+ { 31652, 0x00001601 }, /* GL_SHININESS */
+ { 31665, 0x00001402 }, /* GL_SHORT */
+ { 31674, 0x00009119 }, /* GL_SIGNALED */
+ { 31686, 0x00008F9C }, /* GL_SIGNED_NORMALIZED */
+ { 31707, 0x000081F9 }, /* GL_SINGLE_COLOR */
+ { 31723, 0x000081F9 }, /* GL_SINGLE_COLOR_EXT */
+ { 31743, 0x000085CC }, /* GL_SLICE_ACCUM_SUN */
+ { 31762, 0x00008C46 }, /* GL_SLUMINANCE */
+ { 31776, 0x00008C47 }, /* GL_SLUMINANCE8 */
+ { 31791, 0x00008C45 }, /* GL_SLUMINANCE8_ALPHA8 */
+ { 31813, 0x00008C44 }, /* GL_SLUMINANCE_ALPHA */
+ { 31833, 0x00001D01 }, /* GL_SMOOTH */
+ { 31843, 0x00000B23 }, /* GL_SMOOTH_LINE_WIDTH_GRANULARITY */
+ { 31876, 0x00000B22 }, /* GL_SMOOTH_LINE_WIDTH_RANGE */
+ { 31903, 0x00000B13 }, /* GL_SMOOTH_POINT_SIZE_GRANULARITY */
+ { 31936, 0x00000B12 }, /* GL_SMOOTH_POINT_SIZE_RANGE */
+ { 31963, 0x00008588 }, /* GL_SOURCE0_ALPHA */
+ { 31980, 0x00008588 }, /* GL_SOURCE0_ALPHA_ARB */
+ { 32001, 0x00008588 }, /* GL_SOURCE0_ALPHA_EXT */
+ { 32022, 0x00008580 }, /* GL_SOURCE0_RGB */
+ { 32037, 0x00008580 }, /* GL_SOURCE0_RGB_ARB */
+ { 32056, 0x00008580 }, /* GL_SOURCE0_RGB_EXT */
+ { 32075, 0x00008589 }, /* GL_SOURCE1_ALPHA */
+ { 32092, 0x00008589 }, /* GL_SOURCE1_ALPHA_ARB */
+ { 32113, 0x00008589 }, /* GL_SOURCE1_ALPHA_EXT */
+ { 32134, 0x00008581 }, /* GL_SOURCE1_RGB */
+ { 32149, 0x00008581 }, /* GL_SOURCE1_RGB_ARB */
+ { 32168, 0x00008581 }, /* GL_SOURCE1_RGB_EXT */
+ { 32187, 0x0000858A }, /* GL_SOURCE2_ALPHA */
+ { 32204, 0x0000858A }, /* GL_SOURCE2_ALPHA_ARB */
+ { 32225, 0x0000858A }, /* GL_SOURCE2_ALPHA_EXT */
+ { 32246, 0x00008582 }, /* GL_SOURCE2_RGB */
+ { 32261, 0x00008582 }, /* GL_SOURCE2_RGB_ARB */
+ { 32280, 0x00008582 }, /* GL_SOURCE2_RGB_EXT */
+ { 32299, 0x0000858B }, /* GL_SOURCE3_ALPHA_NV */
+ { 32319, 0x00008583 }, /* GL_SOURCE3_RGB_NV */
+ { 32337, 0x00001202 }, /* GL_SPECULAR */
+ { 32349, 0x00002402 }, /* GL_SPHERE_MAP */
+ { 32363, 0x00001206 }, /* GL_SPOT_CUTOFF */
+ { 32378, 0x00001204 }, /* GL_SPOT_DIRECTION */
+ { 32396, 0x00001205 }, /* GL_SPOT_EXPONENT */
+ { 32413, 0x00008588 }, /* GL_SRC0_ALPHA */
+ { 32427, 0x00008580 }, /* GL_SRC0_RGB */
+ { 32439, 0x00008589 }, /* GL_SRC1_ALPHA */
+ { 32453, 0x00008581 }, /* GL_SRC1_RGB */
+ { 32465, 0x0000858A }, /* GL_SRC2_ALPHA */
+ { 32479, 0x00008582 }, /* GL_SRC2_RGB */
+ { 32491, 0x00000302 }, /* GL_SRC_ALPHA */
+ { 32504, 0x00000308 }, /* GL_SRC_ALPHA_SATURATE */
+ { 32526, 0x00000300 }, /* GL_SRC_COLOR */
+ { 32539, 0x00008C40 }, /* GL_SRGB */
+ { 32547, 0x00008C41 }, /* GL_SRGB8 */
+ { 32556, 0x00008C43 }, /* GL_SRGB8_ALPHA8 */
+ { 32572, 0x00008C42 }, /* GL_SRGB_ALPHA */
+ { 32586, 0x00000503 }, /* GL_STACK_OVERFLOW */
+ { 32604, 0x00000504 }, /* GL_STACK_UNDERFLOW */
+ { 32623, 0x000088E6 }, /* GL_STATIC_COPY */
+ { 32638, 0x000088E6 }, /* GL_STATIC_COPY_ARB */
+ { 32657, 0x000088E4 }, /* GL_STATIC_DRAW */
+ { 32672, 0x000088E4 }, /* GL_STATIC_DRAW_ARB */
+ { 32691, 0x000088E5 }, /* GL_STATIC_READ */
+ { 32706, 0x000088E5 }, /* GL_STATIC_READ_ARB */
+ { 32725, 0x00001802 }, /* GL_STENCIL */
+ { 32736, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT */
+ { 32758, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_EXT */
+ { 32784, 0x00008801 }, /* GL_STENCIL_BACK_FAIL */
+ { 32805, 0x00008801 }, /* GL_STENCIL_BACK_FAIL_ATI */
+ { 32830, 0x00008800 }, /* GL_STENCIL_BACK_FUNC */
+ { 32851, 0x00008800 }, /* GL_STENCIL_BACK_FUNC_ATI */
+ { 32876, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */
+ { 32908, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI */
+ { 32944, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */
+ { 32976, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI */
+ { 33012, 0x00008CA3 }, /* GL_STENCIL_BACK_REF */
+ { 33032, 0x00008CA4 }, /* GL_STENCIL_BACK_VALUE_MASK */
+ { 33059, 0x00008CA5 }, /* GL_STENCIL_BACK_WRITEMASK */
+ { 33085, 0x00000D57 }, /* GL_STENCIL_BITS */
+ { 33101, 0x00000400 }, /* GL_STENCIL_BUFFER_BIT */
+ { 33123, 0x00000B91 }, /* GL_STENCIL_CLEAR_VALUE */
+ { 33146, 0x00000B94 }, /* GL_STENCIL_FAIL */
+ { 33162, 0x00000B92 }, /* GL_STENCIL_FUNC */
+ { 33178, 0x00001901 }, /* GL_STENCIL_INDEX */
+ { 33195, 0x00008D46 }, /* GL_STENCIL_INDEX1 */
+ { 33213, 0x00008D49 }, /* GL_STENCIL_INDEX16 */
+ { 33232, 0x00008D49 }, /* GL_STENCIL_INDEX16_EXT */
+ { 33255, 0x00008D46 }, /* GL_STENCIL_INDEX1_EXT */
+ { 33277, 0x00008D47 }, /* GL_STENCIL_INDEX4 */
+ { 33295, 0x00008D47 }, /* GL_STENCIL_INDEX4_EXT */
+ { 33317, 0x00008D48 }, /* GL_STENCIL_INDEX8 */
+ { 33335, 0x00008D48 }, /* GL_STENCIL_INDEX8_EXT */
+ { 33357, 0x00008D45 }, /* GL_STENCIL_INDEX_EXT */
+ { 33378, 0x00000B95 }, /* GL_STENCIL_PASS_DEPTH_FAIL */
+ { 33405, 0x00000B96 }, /* GL_STENCIL_PASS_DEPTH_PASS */
+ { 33432, 0x00000B97 }, /* GL_STENCIL_REF */
+ { 33447, 0x00000B90 }, /* GL_STENCIL_TEST */
+ { 33463, 0x00008910 }, /* GL_STENCIL_TEST_TWO_SIDE_EXT */
+ { 33492, 0x00000B93 }, /* GL_STENCIL_VALUE_MASK */
+ { 33514, 0x00000B98 }, /* GL_STENCIL_WRITEMASK */
+ { 33535, 0x00000C33 }, /* GL_STEREO */
+ { 33545, 0x000085BE }, /* GL_STORAGE_CACHED_APPLE */
+ { 33569, 0x000085BD }, /* GL_STORAGE_PRIVATE_APPLE */
+ { 33594, 0x000085BF }, /* GL_STORAGE_SHARED_APPLE */
+ { 33618, 0x000088E2 }, /* GL_STREAM_COPY */
+ { 33633, 0x000088E2 }, /* GL_STREAM_COPY_ARB */
+ { 33652, 0x000088E0 }, /* GL_STREAM_DRAW */
+ { 33667, 0x000088E0 }, /* GL_STREAM_DRAW_ARB */
+ { 33686, 0x000088E1 }, /* GL_STREAM_READ */
+ { 33701, 0x000088E1 }, /* GL_STREAM_READ_ARB */
+ { 33720, 0x00000D50 }, /* GL_SUBPIXEL_BITS */
+ { 33737, 0x000084E7 }, /* GL_SUBTRACT */
+ { 33749, 0x000084E7 }, /* GL_SUBTRACT_ARB */
+ { 33765, 0x00009113 }, /* GL_SYNC_CONDITION */
+ { 33783, 0x00009116 }, /* GL_SYNC_FENCE */
+ { 33797, 0x00009115 }, /* GL_SYNC_FLAGS */
+ { 33811, 0x00000001 }, /* GL_SYNC_FLUSH_COMMANDS_BIT */
+ { 33838, 0x00009117 }, /* GL_SYNC_GPU_COMMANDS_COMPLETE */
+ { 33868, 0x00009114 }, /* GL_SYNC_STATUS */
+ { 33883, 0x00002001 }, /* GL_T */
+ { 33888, 0x00002A2A }, /* GL_T2F_C3F_V3F */
+ { 33903, 0x00002A2C }, /* GL_T2F_C4F_N3F_V3F */
+ { 33922, 0x00002A29 }, /* GL_T2F_C4UB_V3F */
+ { 33938, 0x00002A2B }, /* GL_T2F_N3F_V3F */
+ { 33953, 0x00002A27 }, /* GL_T2F_V3F */
+ { 33964, 0x00002A2D }, /* GL_T4F_C4F_N3F_V4F */
+ { 33983, 0x00002A28 }, /* GL_T4F_V4F */
+ { 33994, 0x00008031 }, /* GL_TABLE_TOO_LARGE_EXT */
+ { 34017, 0x00001702 }, /* GL_TEXTURE */
+ { 34028, 0x000084C0 }, /* GL_TEXTURE0 */
+ { 34040, 0x000084C0 }, /* GL_TEXTURE0_ARB */
+ { 34056, 0x000084C1 }, /* GL_TEXTURE1 */
+ { 34068, 0x000084CA }, /* GL_TEXTURE10 */
+ { 34081, 0x000084CA }, /* GL_TEXTURE10_ARB */
+ { 34098, 0x000084CB }, /* GL_TEXTURE11 */
+ { 34111, 0x000084CB }, /* GL_TEXTURE11_ARB */
+ { 34128, 0x000084CC }, /* GL_TEXTURE12 */
+ { 34141, 0x000084CC }, /* GL_TEXTURE12_ARB */
+ { 34158, 0x000084CD }, /* GL_TEXTURE13 */
+ { 34171, 0x000084CD }, /* GL_TEXTURE13_ARB */
+ { 34188, 0x000084CE }, /* GL_TEXTURE14 */
+ { 34201, 0x000084CE }, /* GL_TEXTURE14_ARB */
+ { 34218, 0x000084CF }, /* GL_TEXTURE15 */
+ { 34231, 0x000084CF }, /* GL_TEXTURE15_ARB */
+ { 34248, 0x000084D0 }, /* GL_TEXTURE16 */
+ { 34261, 0x000084D0 }, /* GL_TEXTURE16_ARB */
+ { 34278, 0x000084D1 }, /* GL_TEXTURE17 */
+ { 34291, 0x000084D1 }, /* GL_TEXTURE17_ARB */
+ { 34308, 0x000084D2 }, /* GL_TEXTURE18 */
+ { 34321, 0x000084D2 }, /* GL_TEXTURE18_ARB */
+ { 34338, 0x000084D3 }, /* GL_TEXTURE19 */
+ { 34351, 0x000084D3 }, /* GL_TEXTURE19_ARB */
+ { 34368, 0x000084C1 }, /* GL_TEXTURE1_ARB */
+ { 34384, 0x000084C2 }, /* GL_TEXTURE2 */
+ { 34396, 0x000084D4 }, /* GL_TEXTURE20 */
+ { 34409, 0x000084D4 }, /* GL_TEXTURE20_ARB */
+ { 34426, 0x000084D5 }, /* GL_TEXTURE21 */
+ { 34439, 0x000084D5 }, /* GL_TEXTURE21_ARB */
+ { 34456, 0x000084D6 }, /* GL_TEXTURE22 */
+ { 34469, 0x000084D6 }, /* GL_TEXTURE22_ARB */
+ { 34486, 0x000084D7 }, /* GL_TEXTURE23 */
+ { 34499, 0x000084D7 }, /* GL_TEXTURE23_ARB */
+ { 34516, 0x000084D8 }, /* GL_TEXTURE24 */
+ { 34529, 0x000084D8 }, /* GL_TEXTURE24_ARB */
+ { 34546, 0x000084D9 }, /* GL_TEXTURE25 */
+ { 34559, 0x000084D9 }, /* GL_TEXTURE25_ARB */
+ { 34576, 0x000084DA }, /* GL_TEXTURE26 */
+ { 34589, 0x000084DA }, /* GL_TEXTURE26_ARB */
+ { 34606, 0x000084DB }, /* GL_TEXTURE27 */
+ { 34619, 0x000084DB }, /* GL_TEXTURE27_ARB */
+ { 34636, 0x000084DC }, /* GL_TEXTURE28 */
+ { 34649, 0x000084DC }, /* GL_TEXTURE28_ARB */
+ { 34666, 0x000084DD }, /* GL_TEXTURE29 */
+ { 34679, 0x000084DD }, /* GL_TEXTURE29_ARB */
+ { 34696, 0x000084C2 }, /* GL_TEXTURE2_ARB */
+ { 34712, 0x000084C3 }, /* GL_TEXTURE3 */
+ { 34724, 0x000084DE }, /* GL_TEXTURE30 */
+ { 34737, 0x000084DE }, /* GL_TEXTURE30_ARB */
+ { 34754, 0x000084DF }, /* GL_TEXTURE31 */
+ { 34767, 0x000084DF }, /* GL_TEXTURE31_ARB */
+ { 34784, 0x000084C3 }, /* GL_TEXTURE3_ARB */
+ { 34800, 0x000084C4 }, /* GL_TEXTURE4 */
+ { 34812, 0x000084C4 }, /* GL_TEXTURE4_ARB */
+ { 34828, 0x000084C5 }, /* GL_TEXTURE5 */
+ { 34840, 0x000084C5 }, /* GL_TEXTURE5_ARB */
+ { 34856, 0x000084C6 }, /* GL_TEXTURE6 */
+ { 34868, 0x000084C6 }, /* GL_TEXTURE6_ARB */
+ { 34884, 0x000084C7 }, /* GL_TEXTURE7 */
+ { 34896, 0x000084C7 }, /* GL_TEXTURE7_ARB */
+ { 34912, 0x000084C8 }, /* GL_TEXTURE8 */
+ { 34924, 0x000084C8 }, /* GL_TEXTURE8_ARB */
+ { 34940, 0x000084C9 }, /* GL_TEXTURE9 */
+ { 34952, 0x000084C9 }, /* GL_TEXTURE9_ARB */
+ { 34968, 0x00000DE0 }, /* GL_TEXTURE_1D */
+ { 34982, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY_EXT */
+ { 35006, 0x00000DE1 }, /* GL_TEXTURE_2D */
+ { 35020, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY_EXT */
+ { 35044, 0x0000806F }, /* GL_TEXTURE_3D */
+ { 35058, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE */
+ { 35080, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE_EXT */
+ { 35106, 0x0000813C }, /* GL_TEXTURE_BASE_LEVEL */
+ { 35128, 0x00008068 }, /* GL_TEXTURE_BINDING_1D */
+ { 35150, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */
+ { 35182, 0x00008069 }, /* GL_TEXTURE_BINDING_2D */
+ { 35204, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */
+ { 35236, 0x0000806A }, /* GL_TEXTURE_BINDING_3D */
+ { 35258, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP */
+ { 35286, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_ARB */
+ { 35318, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */
+ { 35351, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_NV */
+ { 35383, 0x00040000 }, /* GL_TEXTURE_BIT */
+ { 35398, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE */
+ { 35419, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE_EXT */
+ { 35444, 0x00001005 }, /* GL_TEXTURE_BORDER */
+ { 35462, 0x00001004 }, /* GL_TEXTURE_BORDER_COLOR */
+ { 35486, 0x00008171 }, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */
+ { 35517, 0x00008176 }, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */
+ { 35547, 0x00008172 }, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */
+ { 35577, 0x00008175 }, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */
+ { 35612, 0x00008173 }, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */
+ { 35643, 0x00008174 }, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */
+ { 35681, 0x000080BC }, /* GL_TEXTURE_COLOR_TABLE_SGI */
+ { 35708, 0x000081EF }, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */
+ { 35740, 0x000080BF }, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
+ { 35774, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC */
+ { 35798, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC_ARB */
+ { 35826, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE */
+ { 35850, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE_ARB */
+ { 35878, 0x0000819B }, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */
+ { 35911, 0x0000819A }, /* GL_TEXTURE_COMPARE_SGIX */
+ { 35935, 0x00001003 }, /* GL_TEXTURE_COMPONENTS */
+ { 35957, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED */
+ { 35979, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED_ARB */
+ { 36005, 0x000086A3 }, /* GL_TEXTURE_COMPRESSED_FORMATS_ARB */
+ { 36039, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */
+ { 36072, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB */
+ { 36109, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT */
+ { 36137, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT_ARB */
+ { 36169, 0x00008078 }, /* GL_TEXTURE_COORD_ARRAY */
+ { 36192, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */
+ { 36230, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB */
+ { 36272, 0x00008092 }, /* GL_TEXTURE_COORD_ARRAY_POINTER */
+ { 36303, 0x00008088 }, /* GL_TEXTURE_COORD_ARRAY_SIZE */
+ { 36331, 0x0000808A }, /* GL_TEXTURE_COORD_ARRAY_STRIDE */
+ { 36361, 0x00008089 }, /* GL_TEXTURE_COORD_ARRAY_TYPE */
+ { 36389, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP */
+ { 36409, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_ARB */
+ { 36433, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */
+ { 36464, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB */
+ { 36499, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */
+ { 36530, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB */
+ { 36565, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */
+ { 36596, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB */
+ { 36631, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */
+ { 36662, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB */
+ { 36697, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */
+ { 36728, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB */
+ { 36763, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */
+ { 36794, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */
+ { 36829, 0x000088F4 }, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */
+ { 36858, 0x00008071 }, /* GL_TEXTURE_DEPTH */
+ { 36875, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */
+ { 36897, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */
+ { 36923, 0x00002300 }, /* GL_TEXTURE_ENV */
+ { 36938, 0x00002201 }, /* GL_TEXTURE_ENV_COLOR */
+ { 36959, 0x00002200 }, /* GL_TEXTURE_ENV_MODE */
+ { 36979, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL */
+ { 37005, 0x00002500 }, /* GL_TEXTURE_GEN_MODE */
+ { 37025, 0x00000C63 }, /* GL_TEXTURE_GEN_Q */
+ { 37042, 0x00000C62 }, /* GL_TEXTURE_GEN_R */
+ { 37059, 0x00000C60 }, /* GL_TEXTURE_GEN_S */
+ { 37076, 0x00000C61 }, /* GL_TEXTURE_GEN_T */
+ { 37093, 0x0000819D }, /* GL_TEXTURE_GEQUAL_R_SGIX */
+ { 37118, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE */
+ { 37140, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE_EXT */
+ { 37166, 0x00001001 }, /* GL_TEXTURE_HEIGHT */
+ { 37184, 0x000080ED }, /* GL_TEXTURE_INDEX_SIZE_EXT */
+ { 37210, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE */
+ { 37236, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE_EXT */
+ { 37266, 0x00001003 }, /* GL_TEXTURE_INTERNAL_FORMAT */
+ { 37293, 0x0000819C }, /* GL_TEXTURE_LEQUAL_R_SGIX */
+ { 37318, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS */
+ { 37338, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS_EXT */
+ { 37362, 0x00008190 }, /* GL_TEXTURE_LOD_BIAS_R_SGIX */
+ { 37389, 0x0000818E }, /* GL_TEXTURE_LOD_BIAS_S_SGIX */
+ { 37416, 0x0000818F }, /* GL_TEXTURE_LOD_BIAS_T_SGIX */
+ { 37443, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE */
+ { 37469, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE_EXT */
+ { 37499, 0x00002800 }, /* GL_TEXTURE_MAG_FILTER */
+ { 37521, 0x00000BA8 }, /* GL_TEXTURE_MATRIX */
+ { 37539, 0x000084FE }, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */
+ { 37569, 0x0000836B }, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */
+ { 37597, 0x00008369 }, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */
+ { 37625, 0x0000836A }, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */
+ { 37653, 0x0000813D }, /* GL_TEXTURE_MAX_LEVEL */
+ { 37674, 0x0000813B }, /* GL_TEXTURE_MAX_LOD */
+ { 37693, 0x00002801 }, /* GL_TEXTURE_MIN_FILTER */
+ { 37715, 0x0000813A }, /* GL_TEXTURE_MIN_LOD */
+ { 37734, 0x00008066 }, /* GL_TEXTURE_PRIORITY */
+ { 37754, 0x000085B7 }, /* GL_TEXTURE_RANGE_LENGTH_APPLE */
+ { 37784, 0x000085B8 }, /* GL_TEXTURE_RANGE_POINTER_APPLE */
+ { 37815, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_ARB */
+ { 37840, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_NV */
+ { 37864, 0x0000805C }, /* GL_TEXTURE_RED_SIZE */
+ { 37884, 0x0000805C }, /* GL_TEXTURE_RED_SIZE_EXT */
+ { 37908, 0x00008067 }, /* GL_TEXTURE_RESIDENT */
+ { 37928, 0x00000BA5 }, /* GL_TEXTURE_STACK_DEPTH */
+ { 37951, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE */
+ { 37975, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE_EXT */
+ { 38003, 0x000085BC }, /* GL_TEXTURE_STORAGE_HINT_APPLE */
+ { 38033, 0x00008065 }, /* GL_TEXTURE_TOO_LARGE_EXT */
+ { 38058, 0x0000888F }, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */
+ { 38092, 0x00001000 }, /* GL_TEXTURE_WIDTH */
+ { 38109, 0x00008072 }, /* GL_TEXTURE_WRAP_R */
+ { 38127, 0x00002802 }, /* GL_TEXTURE_WRAP_S */
+ { 38145, 0x00002803 }, /* GL_TEXTURE_WRAP_T */
+ { 38163, 0x0000911B }, /* GL_TIMEOUT_EXPIRED */
+ { 38182, 0x000088BF }, /* GL_TIME_ELAPSED_EXT */
+ { 38202, 0x00008648 }, /* GL_TRACK_MATRIX_NV */
+ { 38221, 0x00008649 }, /* GL_TRACK_MATRIX_TRANSFORM_NV */
+ { 38250, 0x00001000 }, /* GL_TRANSFORM_BIT */
+ { 38267, 0x00008C8F }, /* GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT */
+ { 38308, 0x00008C8E }, /* GL_TRANSFORM_FEEDBACK_BUFFER_EXT */
+ { 38341, 0x00008C7F }, /* GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT */
+ { 38379, 0x00008C85 }, /* GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT */
+ { 38417, 0x00008C84 }, /* GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT */
+ { 38456, 0x00008C88 }, /* GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT */
+ { 38501, 0x00008C83 }, /* GL_TRANSFORM_FEEDBACK_VARYINGS_EXT */
+ { 38536, 0x00008C76 }, /* GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT */
+ { 38581, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX */
+ { 38607, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX_ARB */
+ { 38637, 0x000088B7 }, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */
+ { 38669, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX */
+ { 38699, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX_ARB */
+ { 38733, 0x0000862C }, /* GL_TRANSPOSE_NV */
+ { 38749, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX */
+ { 38780, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX_ARB */
+ { 38815, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX */
+ { 38843, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX_ARB */
+ { 38875, 0x00000004 }, /* GL_TRIANGLES */
+ { 38888, 0x00000006 }, /* GL_TRIANGLE_FAN */
+ { 38904, 0x00008615 }, /* GL_TRIANGLE_MESH_SUN */
+ { 38925, 0x00000005 }, /* GL_TRIANGLE_STRIP */
+ { 38943, 0x00000001 }, /* GL_TRUE */
+ { 38951, 0x00008A1C }, /* GL_UNDEFINED_APPLE */
+ { 38970, 0x00000CF5 }, /* GL_UNPACK_ALIGNMENT */
+ { 38990, 0x0000806E }, /* GL_UNPACK_IMAGE_HEIGHT */
+ { 39013, 0x00000CF1 }, /* GL_UNPACK_LSB_FIRST */
+ { 39033, 0x00000CF2 }, /* GL_UNPACK_ROW_LENGTH */
+ { 39054, 0x0000806D }, /* GL_UNPACK_SKIP_IMAGES */
+ { 39076, 0x00000CF4 }, /* GL_UNPACK_SKIP_PIXELS */
+ { 39098, 0x00000CF3 }, /* GL_UNPACK_SKIP_ROWS */
+ { 39118, 0x00000CF0 }, /* GL_UNPACK_SWAP_BYTES */
+ { 39139, 0x00009118 }, /* GL_UNSIGNALED */
+ { 39153, 0x00001401 }, /* GL_UNSIGNED_BYTE */
+ { 39170, 0x00008362 }, /* GL_UNSIGNED_BYTE_2_3_3_REV */
+ { 39197, 0x00008032 }, /* GL_UNSIGNED_BYTE_3_3_2 */
+ { 39220, 0x00001405 }, /* GL_UNSIGNED_INT */
+ { 39236, 0x00008036 }, /* GL_UNSIGNED_INT_10_10_10_2 */
+ { 39263, 0x000084FA }, /* GL_UNSIGNED_INT_24_8 */
+ { 39284, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_EXT */
+ { 39309, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_NV */
+ { 39333, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV */
+ { 39364, 0x00008035 }, /* GL_UNSIGNED_INT_8_8_8_8 */
+ { 39388, 0x00008367 }, /* GL_UNSIGNED_INT_8_8_8_8_REV */
+ { 39416, 0x00008C17 }, /* GL_UNSIGNED_NORMALIZED */
+ { 39439, 0x00001403 }, /* GL_UNSIGNED_SHORT */
+ { 39457, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */
+ { 39487, 0x00008033 }, /* GL_UNSIGNED_SHORT_4_4_4_4 */
+ { 39513, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */
+ { 39543, 0x00008034 }, /* GL_UNSIGNED_SHORT_5_5_5_1 */
+ { 39569, 0x00008363 }, /* GL_UNSIGNED_SHORT_5_6_5 */
+ { 39593, 0x00008364 }, /* GL_UNSIGNED_SHORT_5_6_5_REV */
+ { 39621, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_APPLE */
+ { 39649, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_MESA */
+ { 39676, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */
+ { 39708, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_MESA */
+ { 39739, 0x00008CA2 }, /* GL_UPPER_LEFT */
+ { 39753, 0x00002A20 }, /* GL_V2F */
+ { 39760, 0x00002A21 }, /* GL_V3F */
+ { 39767, 0x00008B83 }, /* GL_VALIDATE_STATUS */
+ { 39786, 0x00001F00 }, /* GL_VENDOR */
+ { 39796, 0x00001F02 }, /* GL_VERSION */
+ { 39807, 0x00008074 }, /* GL_VERTEX_ARRAY */
+ { 39823, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING */
+ { 39847, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING_APPLE */
+ { 39877, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING */
+ { 39908, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING_ARB */
+ { 39943, 0x0000808E }, /* GL_VERTEX_ARRAY_POINTER */
+ { 39967, 0x0000807A }, /* GL_VERTEX_ARRAY_SIZE */
+ { 39988, 0x0000807C }, /* GL_VERTEX_ARRAY_STRIDE */
+ { 40011, 0x0000807B }, /* GL_VERTEX_ARRAY_TYPE */
+ { 40032, 0x00008650 }, /* GL_VERTEX_ATTRIB_ARRAY0_NV */
+ { 40059, 0x0000865A }, /* GL_VERTEX_ATTRIB_ARRAY10_NV */
+ { 40087, 0x0000865B }, /* GL_VERTEX_ATTRIB_ARRAY11_NV */
+ { 40115, 0x0000865C }, /* GL_VERTEX_ATTRIB_ARRAY12_NV */
+ { 40143, 0x0000865D }, /* GL_VERTEX_ATTRIB_ARRAY13_NV */
+ { 40171, 0x0000865E }, /* GL_VERTEX_ATTRIB_ARRAY14_NV */
+ { 40199, 0x0000865F }, /* GL_VERTEX_ATTRIB_ARRAY15_NV */
+ { 40227, 0x00008651 }, /* GL_VERTEX_ATTRIB_ARRAY1_NV */
+ { 40254, 0x00008652 }, /* GL_VERTEX_ATTRIB_ARRAY2_NV */
+ { 40281, 0x00008653 }, /* GL_VERTEX_ATTRIB_ARRAY3_NV */
+ { 40308, 0x00008654 }, /* GL_VERTEX_ATTRIB_ARRAY4_NV */
+ { 40335, 0x00008655 }, /* GL_VERTEX_ATTRIB_ARRAY5_NV */
+ { 40362, 0x00008656 }, /* GL_VERTEX_ATTRIB_ARRAY6_NV */
+ { 40389, 0x00008657 }, /* GL_VERTEX_ATTRIB_ARRAY7_NV */
+ { 40416, 0x00008658 }, /* GL_VERTEX_ATTRIB_ARRAY8_NV */
+ { 40443, 0x00008659 }, /* GL_VERTEX_ATTRIB_ARRAY9_NV */
+ { 40470, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */
+ { 40508, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB */
+ { 40550, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */
+ { 40581, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */
+ { 40616, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */
+ { 40650, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */
+ { 40688, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */
+ { 40719, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */
+ { 40754, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */
+ { 40782, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */
+ { 40814, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */
+ { 40844, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */
+ { 40878, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */
+ { 40906, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */
+ { 40938, 0x000086A7 }, /* GL_VERTEX_BLEND_ARB */
+ { 40958, 0x00008620 }, /* GL_VERTEX_PROGRAM_ARB */
+ { 40980, 0x0000864A }, /* GL_VERTEX_PROGRAM_BINDING_NV */
+ { 41009, 0x00008620 }, /* GL_VERTEX_PROGRAM_NV */
+ { 41030, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE */
+ { 41059, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */
+ { 41092, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */
+ { 41124, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE */
+ { 41151, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */
+ { 41182, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */
+ { 41212, 0x00008B31 }, /* GL_VERTEX_SHADER */
+ { 41229, 0x00008B31 }, /* GL_VERTEX_SHADER_ARB */
+ { 41250, 0x00008621 }, /* GL_VERTEX_STATE_PROGRAM_NV */
+ { 41277, 0x00000BA2 }, /* GL_VIEWPORT */
+ { 41289, 0x00000800 }, /* GL_VIEWPORT_BIT */
+ { 41305, 0x00008A1A }, /* GL_VOLATILE_APPLE */
+ { 41323, 0x0000911D }, /* GL_WAIT_FAILED */
+ { 41338, 0x000086AD }, /* GL_WEIGHT_ARRAY_ARB */
+ { 41358, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */
+ { 41389, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB */
+ { 41424, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_ARB */
+ { 41452, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_ARB */
+ { 41477, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_ARB */
+ { 41504, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_ARB */
+ { 41529, 0x000086A6 }, /* GL_WEIGHT_SUM_UNITY_ARB */
+ { 41553, 0x000081D4 }, /* GL_WRAP_BORDER_SUN */
+ { 41572, 0x000088B9 }, /* GL_WRITE_ONLY */
+ { 41586, 0x000088B9 }, /* GL_WRITE_ONLY_ARB */
+ { 41604, 0x00001506 }, /* GL_XOR */
+ { 41611, 0x000085B9 }, /* GL_YCBCR_422_APPLE */
+ { 41630, 0x00008757 }, /* GL_YCBCR_MESA */
+ { 41644, 0x00000000 }, /* GL_ZERO */
+ { 41652, 0x00000D16 }, /* GL_ZOOM_X */
+ { 41662, 0x00000D17 }, /* GL_ZOOM_Y */
};
-static const unsigned reduced_enums[1357] =
+static const unsigned reduced_enums[1372] =
{
480, /* GL_FALSE */
- 703, /* GL_LINES */
- 705, /* GL_LINE_LOOP */
- 712, /* GL_LINE_STRIP */
- 1774, /* GL_TRIANGLES */
- 1777, /* GL_TRIANGLE_STRIP */
- 1775, /* GL_TRIANGLE_FAN */
- 1288, /* GL_QUADS */
- 1292, /* GL_QUAD_STRIP */
- 1173, /* GL_POLYGON */
- 1185, /* GL_POLYGON_STIPPLE_BIT */
- 1134, /* GL_PIXEL_MODE_BIT */
- 690, /* GL_LIGHTING_BIT */
+ 704, /* GL_LINES */
+ 706, /* GL_LINE_LOOP */
+ 713, /* GL_LINE_STRIP */
+ 1789, /* GL_TRIANGLES */
+ 1792, /* GL_TRIANGLE_STRIP */
+ 1790, /* GL_TRIANGLE_FAN */
+ 1293, /* GL_QUADS */
+ 1297, /* GL_QUAD_STRIP */
+ 1177, /* GL_POLYGON */
+ 1189, /* GL_POLYGON_STIPPLE_BIT */
+ 1138, /* GL_PIXEL_MODE_BIT */
+ 691, /* GL_LIGHTING_BIT */
510, /* GL_FOG_BIT */
8, /* GL_ACCUM */
- 722, /* GL_LOAD */
- 1353, /* GL_RETURN */
- 1006, /* GL_MULT */
+ 723, /* GL_LOAD */
+ 1359, /* GL_RETURN */
+ 1010, /* GL_MULT */
23, /* GL_ADD */
- 1022, /* GL_NEVER */
- 680, /* GL_LESS */
+ 1026, /* GL_NEVER */
+ 681, /* GL_LESS */
470, /* GL_EQUAL */
- 679, /* GL_LEQUAL */
+ 680, /* GL_LEQUAL */
600, /* GL_GREATER */
- 1037, /* GL_NOTEQUAL */
+ 1041, /* GL_NOTEQUAL */
599, /* GL_GEQUAL */
47, /* GL_ALWAYS */
- 1494, /* GL_SRC_COLOR */
- 1067, /* GL_ONE_MINUS_SRC_COLOR */
- 1492, /* GL_SRC_ALPHA */
- 1066, /* GL_ONE_MINUS_SRC_ALPHA */
+ 1501, /* GL_SRC_COLOR */
+ 1071, /* GL_ONE_MINUS_SRC_COLOR */
+ 1499, /* GL_SRC_ALPHA */
+ 1070, /* GL_ONE_MINUS_SRC_ALPHA */
449, /* GL_DST_ALPHA */
- 1064, /* GL_ONE_MINUS_DST_ALPHA */
+ 1068, /* GL_ONE_MINUS_DST_ALPHA */
450, /* GL_DST_COLOR */
- 1065, /* GL_ONE_MINUS_DST_COLOR */
- 1493, /* GL_SRC_ALPHA_SATURATE */
+ 1069, /* GL_ONE_MINUS_DST_COLOR */
+ 1500, /* GL_SRC_ALPHA_SATURATE */
587, /* GL_FRONT_LEFT */
588, /* GL_FRONT_RIGHT */
69, /* GL_BACK_LEFT */
70, /* GL_BACK_RIGHT */
584, /* GL_FRONT */
68, /* GL_BACK */
- 678, /* GL_LEFT */
- 1395, /* GL_RIGHT */
+ 679, /* GL_LEFT */
+ 1401, /* GL_RIGHT */
585, /* GL_FRONT_AND_BACK */
63, /* GL_AUX0 */
64, /* GL_AUX1 */
65, /* GL_AUX2 */
66, /* GL_AUX3 */
- 667, /* GL_INVALID_ENUM */
- 671, /* GL_INVALID_VALUE */
- 670, /* GL_INVALID_OPERATION */
- 1499, /* GL_STACK_OVERFLOW */
- 1500, /* GL_STACK_UNDERFLOW */
- 1092, /* GL_OUT_OF_MEMORY */
- 668, /* GL_INVALID_FRAMEBUFFER_OPERATION */
+ 668, /* GL_INVALID_ENUM */
+ 672, /* GL_INVALID_VALUE */
+ 671, /* GL_INVALID_OPERATION */
+ 1506, /* GL_STACK_OVERFLOW */
+ 1507, /* GL_STACK_UNDERFLOW */
+ 1096, /* GL_OUT_OF_MEMORY */
+ 669, /* GL_INVALID_FRAMEBUFFER_OPERATION */
0, /* GL_2D */
2, /* GL_3D */
3, /* GL_3D_COLOR */
4, /* GL_3D_COLOR_TEXTURE */
6, /* GL_4D_COLOR_TEXTURE */
- 1112, /* GL_PASS_THROUGH_TOKEN */
- 1172, /* GL_POINT_TOKEN */
- 713, /* GL_LINE_TOKEN */
- 1186, /* GL_POLYGON_TOKEN */
+ 1116, /* GL_PASS_THROUGH_TOKEN */
+ 1176, /* GL_POINT_TOKEN */
+ 714, /* GL_LINE_TOKEN */
+ 1190, /* GL_POLYGON_TOKEN */
74, /* GL_BITMAP_TOKEN */
448, /* GL_DRAW_PIXEL_TOKEN */
302, /* GL_COPY_PIXEL_TOKEN */
- 706, /* GL_LINE_RESET_TOKEN */
+ 707, /* GL_LINE_RESET_TOKEN */
473, /* GL_EXP */
474, /* GL_EXP2 */
338, /* GL_CW */
126, /* GL_CCW */
147, /* GL_COEFF */
- 1089, /* GL_ORDER */
+ 1093, /* GL_ORDER */
385, /* GL_DOMAIN */
312, /* GL_CURRENT_COLOR */
315, /* GL_CURRENT_INDEX */
@@ -3912,33 +3942,33 @@ static const unsigned reduced_enums[1357] =
329, /* GL_CURRENT_RASTER_POSITION */
330, /* GL_CURRENT_RASTER_POSITION_VALID */
327, /* GL_CURRENT_RASTER_DISTANCE */
- 1165, /* GL_POINT_SMOOTH */
- 1154, /* GL_POINT_SIZE */
- 1164, /* GL_POINT_SIZE_RANGE */
- 1155, /* GL_POINT_SIZE_GRANULARITY */
- 707, /* GL_LINE_SMOOTH */
- 714, /* GL_LINE_WIDTH */
- 716, /* GL_LINE_WIDTH_RANGE */
- 715, /* GL_LINE_WIDTH_GRANULARITY */
- 709, /* GL_LINE_STIPPLE */
- 710, /* GL_LINE_STIPPLE_PATTERN */
- 711, /* GL_LINE_STIPPLE_REPEAT */
- 721, /* GL_LIST_MODE */
- 887, /* GL_MAX_LIST_NESTING */
- 718, /* GL_LIST_BASE */
- 720, /* GL_LIST_INDEX */
- 1175, /* GL_POLYGON_MODE */
- 1182, /* GL_POLYGON_SMOOTH */
- 1184, /* GL_POLYGON_STIPPLE */
+ 1169, /* GL_POINT_SMOOTH */
+ 1158, /* GL_POINT_SIZE */
+ 1168, /* GL_POINT_SIZE_RANGE */
+ 1159, /* GL_POINT_SIZE_GRANULARITY */
+ 708, /* GL_LINE_SMOOTH */
+ 715, /* GL_LINE_WIDTH */
+ 717, /* GL_LINE_WIDTH_RANGE */
+ 716, /* GL_LINE_WIDTH_GRANULARITY */
+ 710, /* GL_LINE_STIPPLE */
+ 711, /* GL_LINE_STIPPLE_PATTERN */
+ 712, /* GL_LINE_STIPPLE_REPEAT */
+ 722, /* GL_LIST_MODE */
+ 888, /* GL_MAX_LIST_NESTING */
+ 719, /* GL_LIST_BASE */
+ 721, /* GL_LIST_INDEX */
+ 1179, /* GL_POLYGON_MODE */
+ 1186, /* GL_POLYGON_SMOOTH */
+ 1188, /* GL_POLYGON_STIPPLE */
459, /* GL_EDGE_FLAG */
305, /* GL_CULL_FACE */
306, /* GL_CULL_FACE_MODE */
586, /* GL_FRONT_FACE */
- 689, /* GL_LIGHTING */
- 694, /* GL_LIGHT_MODEL_LOCAL_VIEWER */
- 695, /* GL_LIGHT_MODEL_TWO_SIDE */
- 691, /* GL_LIGHT_MODEL_AMBIENT */
- 1441, /* GL_SHADE_MODEL */
+ 690, /* GL_LIGHTING */
+ 695, /* GL_LIGHT_MODEL_LOCAL_VIEWER */
+ 696, /* GL_LIGHT_MODEL_TWO_SIDE */
+ 692, /* GL_LIGHT_MODEL_AMBIENT */
+ 1448, /* GL_SHADE_MODEL */
194, /* GL_COLOR_MATERIAL_FACE */
195, /* GL_COLOR_MATERIAL_PARAMETER */
193, /* GL_COLOR_MATERIAL */
@@ -3955,24 +3985,24 @@ static const unsigned reduced_enums[1357] =
359, /* GL_DEPTH_CLEAR_VALUE */
370, /* GL_DEPTH_FUNC */
12, /* GL_ACCUM_CLEAR_VALUE */
- 1539, /* GL_STENCIL_TEST */
- 1523, /* GL_STENCIL_CLEAR_VALUE */
- 1525, /* GL_STENCIL_FUNC */
- 1541, /* GL_STENCIL_VALUE_MASK */
- 1524, /* GL_STENCIL_FAIL */
- 1536, /* GL_STENCIL_PASS_DEPTH_FAIL */
- 1537, /* GL_STENCIL_PASS_DEPTH_PASS */
- 1538, /* GL_STENCIL_REF */
- 1542, /* GL_STENCIL_WRITEMASK */
- 855, /* GL_MATRIX_MODE */
- 1027, /* GL_NORMALIZE */
- 1870, /* GL_VIEWPORT */
- 1001, /* GL_MODELVIEW_STACK_DEPTH */
- 1265, /* GL_PROJECTION_STACK_DEPTH */
- 1749, /* GL_TEXTURE_STACK_DEPTH */
- 999, /* GL_MODELVIEW_MATRIX */
- 1264, /* GL_PROJECTION_MATRIX */
- 1732, /* GL_TEXTURE_MATRIX */
+ 1546, /* GL_STENCIL_TEST */
+ 1530, /* GL_STENCIL_CLEAR_VALUE */
+ 1532, /* GL_STENCIL_FUNC */
+ 1548, /* GL_STENCIL_VALUE_MASK */
+ 1531, /* GL_STENCIL_FAIL */
+ 1543, /* GL_STENCIL_PASS_DEPTH_FAIL */
+ 1544, /* GL_STENCIL_PASS_DEPTH_PASS */
+ 1545, /* GL_STENCIL_REF */
+ 1549, /* GL_STENCIL_WRITEMASK */
+ 856, /* GL_MATRIX_MODE */
+ 1031, /* GL_NORMALIZE */
+ 1885, /* GL_VIEWPORT */
+ 1005, /* GL_MODELVIEW_STACK_DEPTH */
+ 1270, /* GL_PROJECTION_STACK_DEPTH */
+ 1756, /* GL_TEXTURE_STACK_DEPTH */
+ 1003, /* GL_MODELVIEW_MATRIX */
+ 1269, /* GL_PROJECTION_MATRIX */
+ 1739, /* GL_TEXTURE_MATRIX */
61, /* GL_ATTRIB_STACK_DEPTH */
137, /* GL_CLIENT_ATTRIB_STACK_DEPTH */
43, /* GL_ALPHA_TEST */
@@ -3982,72 +4012,72 @@ static const unsigned reduced_enums[1357] =
78, /* GL_BLEND_DST */
87, /* GL_BLEND_SRC */
75, /* GL_BLEND */
- 724, /* GL_LOGIC_OP_MODE */
+ 725, /* GL_LOGIC_OP_MODE */
641, /* GL_INDEX_LOGIC_OP */
192, /* GL_COLOR_LOGIC_OP */
67, /* GL_AUX_BUFFERS */
395, /* GL_DRAW_BUFFER */
- 1306, /* GL_READ_BUFFER */
- 1422, /* GL_SCISSOR_BOX */
- 1423, /* GL_SCISSOR_TEST */
+ 1312, /* GL_READ_BUFFER */
+ 1428, /* GL_SCISSOR_BOX */
+ 1429, /* GL_SCISSOR_TEST */
640, /* GL_INDEX_CLEAR_VALUE */
645, /* GL_INDEX_WRITEMASK */
189, /* GL_COLOR_CLEAR_VALUE */
231, /* GL_COLOR_WRITEMASK */
642, /* GL_INDEX_MODE */
- 1388, /* GL_RGBA_MODE */
+ 1394, /* GL_RGBA_MODE */
394, /* GL_DOUBLEBUFFER */
- 1543, /* GL_STEREO */
- 1345, /* GL_RENDER_MODE */
- 1113, /* GL_PERSPECTIVE_CORRECTION_HINT */
- 1166, /* GL_POINT_SMOOTH_HINT */
- 708, /* GL_LINE_SMOOTH_HINT */
- 1183, /* GL_POLYGON_SMOOTH_HINT */
+ 1550, /* GL_STEREO */
+ 1351, /* GL_RENDER_MODE */
+ 1117, /* GL_PERSPECTIVE_CORRECTION_HINT */
+ 1170, /* GL_POINT_SMOOTH_HINT */
+ 709, /* GL_LINE_SMOOTH_HINT */
+ 1187, /* GL_POLYGON_SMOOTH_HINT */
530, /* GL_FOG_HINT */
- 1713, /* GL_TEXTURE_GEN_S */
- 1714, /* GL_TEXTURE_GEN_T */
- 1712, /* GL_TEXTURE_GEN_R */
- 1711, /* GL_TEXTURE_GEN_Q */
- 1126, /* GL_PIXEL_MAP_I_TO_I */
- 1132, /* GL_PIXEL_MAP_S_TO_S */
- 1128, /* GL_PIXEL_MAP_I_TO_R */
- 1124, /* GL_PIXEL_MAP_I_TO_G */
- 1122, /* GL_PIXEL_MAP_I_TO_B */
- 1120, /* GL_PIXEL_MAP_I_TO_A */
- 1130, /* GL_PIXEL_MAP_R_TO_R */
- 1118, /* GL_PIXEL_MAP_G_TO_G */
- 1116, /* GL_PIXEL_MAP_B_TO_B */
- 1114, /* GL_PIXEL_MAP_A_TO_A */
- 1127, /* GL_PIXEL_MAP_I_TO_I_SIZE */
- 1133, /* GL_PIXEL_MAP_S_TO_S_SIZE */
- 1129, /* GL_PIXEL_MAP_I_TO_R_SIZE */
- 1125, /* GL_PIXEL_MAP_I_TO_G_SIZE */
- 1123, /* GL_PIXEL_MAP_I_TO_B_SIZE */
- 1121, /* GL_PIXEL_MAP_I_TO_A_SIZE */
- 1131, /* GL_PIXEL_MAP_R_TO_R_SIZE */
- 1119, /* GL_PIXEL_MAP_G_TO_G_SIZE */
- 1117, /* GL_PIXEL_MAP_B_TO_B_SIZE */
- 1115, /* GL_PIXEL_MAP_A_TO_A_SIZE */
- 1787, /* GL_UNPACK_SWAP_BYTES */
- 1782, /* GL_UNPACK_LSB_FIRST */
- 1783, /* GL_UNPACK_ROW_LENGTH */
- 1786, /* GL_UNPACK_SKIP_ROWS */
- 1785, /* GL_UNPACK_SKIP_PIXELS */
- 1780, /* GL_UNPACK_ALIGNMENT */
- 1101, /* GL_PACK_SWAP_BYTES */
- 1096, /* GL_PACK_LSB_FIRST */
- 1097, /* GL_PACK_ROW_LENGTH */
- 1100, /* GL_PACK_SKIP_ROWS */
- 1099, /* GL_PACK_SKIP_PIXELS */
- 1093, /* GL_PACK_ALIGNMENT */
- 802, /* GL_MAP_COLOR */
- 807, /* GL_MAP_STENCIL */
+ 1720, /* GL_TEXTURE_GEN_S */
+ 1721, /* GL_TEXTURE_GEN_T */
+ 1719, /* GL_TEXTURE_GEN_R */
+ 1718, /* GL_TEXTURE_GEN_Q */
+ 1130, /* GL_PIXEL_MAP_I_TO_I */
+ 1136, /* GL_PIXEL_MAP_S_TO_S */
+ 1132, /* GL_PIXEL_MAP_I_TO_R */
+ 1128, /* GL_PIXEL_MAP_I_TO_G */
+ 1126, /* GL_PIXEL_MAP_I_TO_B */
+ 1124, /* GL_PIXEL_MAP_I_TO_A */
+ 1134, /* GL_PIXEL_MAP_R_TO_R */
+ 1122, /* GL_PIXEL_MAP_G_TO_G */
+ 1120, /* GL_PIXEL_MAP_B_TO_B */
+ 1118, /* GL_PIXEL_MAP_A_TO_A */
+ 1131, /* GL_PIXEL_MAP_I_TO_I_SIZE */
+ 1137, /* GL_PIXEL_MAP_S_TO_S_SIZE */
+ 1133, /* GL_PIXEL_MAP_I_TO_R_SIZE */
+ 1129, /* GL_PIXEL_MAP_I_TO_G_SIZE */
+ 1127, /* GL_PIXEL_MAP_I_TO_B_SIZE */
+ 1125, /* GL_PIXEL_MAP_I_TO_A_SIZE */
+ 1135, /* GL_PIXEL_MAP_R_TO_R_SIZE */
+ 1123, /* GL_PIXEL_MAP_G_TO_G_SIZE */
+ 1121, /* GL_PIXEL_MAP_B_TO_B_SIZE */
+ 1119, /* GL_PIXEL_MAP_A_TO_A_SIZE */
+ 1802, /* GL_UNPACK_SWAP_BYTES */
+ 1797, /* GL_UNPACK_LSB_FIRST */
+ 1798, /* GL_UNPACK_ROW_LENGTH */
+ 1801, /* GL_UNPACK_SKIP_ROWS */
+ 1800, /* GL_UNPACK_SKIP_PIXELS */
+ 1795, /* GL_UNPACK_ALIGNMENT */
+ 1105, /* GL_PACK_SWAP_BYTES */
+ 1100, /* GL_PACK_LSB_FIRST */
+ 1101, /* GL_PACK_ROW_LENGTH */
+ 1104, /* GL_PACK_SKIP_ROWS */
+ 1103, /* GL_PACK_SKIP_PIXELS */
+ 1097, /* GL_PACK_ALIGNMENT */
+ 803, /* GL_MAP_COLOR */
+ 808, /* GL_MAP_STENCIL */
644, /* GL_INDEX_SHIFT */
643, /* GL_INDEX_OFFSET */
- 1320, /* GL_RED_SCALE */
- 1318, /* GL_RED_BIAS */
- 1889, /* GL_ZOOM_X */
- 1890, /* GL_ZOOM_Y */
+ 1326, /* GL_RED_SCALE */
+ 1324, /* GL_RED_BIAS */
+ 1904, /* GL_ZOOM_X */
+ 1905, /* GL_ZOOM_Y */
604, /* GL_GREEN_SCALE */
602, /* GL_GREEN_BIAS */
93, /* GL_BLUE_SCALE */
@@ -4056,87 +4086,87 @@ static const unsigned reduced_enums[1357] =
40, /* GL_ALPHA_BIAS */
372, /* GL_DEPTH_SCALE */
352, /* GL_DEPTH_BIAS */
- 882, /* GL_MAX_EVAL_ORDER */
- 886, /* GL_MAX_LIGHTS */
- 864, /* GL_MAX_CLIP_PLANES */
- 934, /* GL_MAX_TEXTURE_SIZE */
- 892, /* GL_MAX_PIXEL_MAP_TABLE */
- 860, /* GL_MAX_ATTRIB_STACK_DEPTH */
- 889, /* GL_MAX_MODELVIEW_STACK_DEPTH */
- 890, /* GL_MAX_NAME_STACK_DEPTH */
- 918, /* GL_MAX_PROJECTION_STACK_DEPTH */
- 935, /* GL_MAX_TEXTURE_STACK_DEPTH */
- 949, /* GL_MAX_VIEWPORT_DIMS */
- 861, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */
- 1553, /* GL_SUBPIXEL_BITS */
+ 883, /* GL_MAX_EVAL_ORDER */
+ 887, /* GL_MAX_LIGHTS */
+ 865, /* GL_MAX_CLIP_PLANES */
+ 935, /* GL_MAX_TEXTURE_SIZE */
+ 893, /* GL_MAX_PIXEL_MAP_TABLE */
+ 861, /* GL_MAX_ATTRIB_STACK_DEPTH */
+ 890, /* GL_MAX_MODELVIEW_STACK_DEPTH */
+ 891, /* GL_MAX_NAME_STACK_DEPTH */
+ 919, /* GL_MAX_PROJECTION_STACK_DEPTH */
+ 936, /* GL_MAX_TEXTURE_STACK_DEPTH */
+ 953, /* GL_MAX_VIEWPORT_DIMS */
+ 862, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */
+ 1560, /* GL_SUBPIXEL_BITS */
639, /* GL_INDEX_BITS */
- 1319, /* GL_RED_BITS */
+ 1325, /* GL_RED_BITS */
603, /* GL_GREEN_BITS */
92, /* GL_BLUE_BITS */
41, /* GL_ALPHA_BITS */
353, /* GL_DEPTH_BITS */
- 1521, /* GL_STENCIL_BITS */
+ 1528, /* GL_STENCIL_BITS */
14, /* GL_ACCUM_RED_BITS */
13, /* GL_ACCUM_GREEN_BITS */
10, /* GL_ACCUM_BLUE_BITS */
9, /* GL_ACCUM_ALPHA_BITS */
- 1015, /* GL_NAME_STACK_DEPTH */
+ 1019, /* GL_NAME_STACK_DEPTH */
62, /* GL_AUTO_NORMAL */
- 748, /* GL_MAP1_COLOR_4 */
- 751, /* GL_MAP1_INDEX */
- 752, /* GL_MAP1_NORMAL */
- 753, /* GL_MAP1_TEXTURE_COORD_1 */
- 754, /* GL_MAP1_TEXTURE_COORD_2 */
- 755, /* GL_MAP1_TEXTURE_COORD_3 */
- 756, /* GL_MAP1_TEXTURE_COORD_4 */
- 757, /* GL_MAP1_VERTEX_3 */
- 758, /* GL_MAP1_VERTEX_4 */
- 775, /* GL_MAP2_COLOR_4 */
- 778, /* GL_MAP2_INDEX */
- 779, /* GL_MAP2_NORMAL */
- 780, /* GL_MAP2_TEXTURE_COORD_1 */
- 781, /* GL_MAP2_TEXTURE_COORD_2 */
- 782, /* GL_MAP2_TEXTURE_COORD_3 */
- 783, /* GL_MAP2_TEXTURE_COORD_4 */
- 784, /* GL_MAP2_VERTEX_3 */
- 785, /* GL_MAP2_VERTEX_4 */
- 749, /* GL_MAP1_GRID_DOMAIN */
- 750, /* GL_MAP1_GRID_SEGMENTS */
- 776, /* GL_MAP2_GRID_DOMAIN */
- 777, /* GL_MAP2_GRID_SEGMENTS */
- 1636, /* GL_TEXTURE_1D */
- 1638, /* GL_TEXTURE_2D */
+ 749, /* GL_MAP1_COLOR_4 */
+ 752, /* GL_MAP1_INDEX */
+ 753, /* GL_MAP1_NORMAL */
+ 754, /* GL_MAP1_TEXTURE_COORD_1 */
+ 755, /* GL_MAP1_TEXTURE_COORD_2 */
+ 756, /* GL_MAP1_TEXTURE_COORD_3 */
+ 757, /* GL_MAP1_TEXTURE_COORD_4 */
+ 758, /* GL_MAP1_VERTEX_3 */
+ 759, /* GL_MAP1_VERTEX_4 */
+ 776, /* GL_MAP2_COLOR_4 */
+ 779, /* GL_MAP2_INDEX */
+ 780, /* GL_MAP2_NORMAL */
+ 781, /* GL_MAP2_TEXTURE_COORD_1 */
+ 782, /* GL_MAP2_TEXTURE_COORD_2 */
+ 783, /* GL_MAP2_TEXTURE_COORD_3 */
+ 784, /* GL_MAP2_TEXTURE_COORD_4 */
+ 785, /* GL_MAP2_VERTEX_3 */
+ 786, /* GL_MAP2_VERTEX_4 */
+ 750, /* GL_MAP1_GRID_DOMAIN */
+ 751, /* GL_MAP1_GRID_SEGMENTS */
+ 777, /* GL_MAP2_GRID_DOMAIN */
+ 778, /* GL_MAP2_GRID_SEGMENTS */
+ 1643, /* GL_TEXTURE_1D */
+ 1645, /* GL_TEXTURE_2D */
483, /* GL_FEEDBACK_BUFFER_POINTER */
484, /* GL_FEEDBACK_BUFFER_SIZE */
485, /* GL_FEEDBACK_BUFFER_TYPE */
- 1432, /* GL_SELECTION_BUFFER_POINTER */
- 1433, /* GL_SELECTION_BUFFER_SIZE */
- 1755, /* GL_TEXTURE_WIDTH */
- 1718, /* GL_TEXTURE_HEIGHT */
- 1673, /* GL_TEXTURE_COMPONENTS */
- 1657, /* GL_TEXTURE_BORDER_COLOR */
- 1656, /* GL_TEXTURE_BORDER */
+ 1438, /* GL_SELECTION_BUFFER_POINTER */
+ 1439, /* GL_SELECTION_BUFFER_SIZE */
+ 1762, /* GL_TEXTURE_WIDTH */
+ 1725, /* GL_TEXTURE_HEIGHT */
+ 1680, /* GL_TEXTURE_COMPONENTS */
+ 1664, /* GL_TEXTURE_BORDER_COLOR */
+ 1663, /* GL_TEXTURE_BORDER */
386, /* GL_DONT_CARE */
481, /* GL_FASTEST */
- 1023, /* GL_NICEST */
+ 1027, /* GL_NICEST */
48, /* GL_AMBIENT */
383, /* GL_DIFFUSE */
- 1481, /* GL_SPECULAR */
- 1187, /* GL_POSITION */
- 1484, /* GL_SPOT_DIRECTION */
- 1485, /* GL_SPOT_EXPONENT */
- 1483, /* GL_SPOT_CUTOFF */
+ 1488, /* GL_SPECULAR */
+ 1191, /* GL_POSITION */
+ 1491, /* GL_SPOT_DIRECTION */
+ 1492, /* GL_SPOT_EXPONENT */
+ 1490, /* GL_SPOT_CUTOFF */
276, /* GL_CONSTANT_ATTENUATION */
- 698, /* GL_LINEAR_ATTENUATION */
- 1287, /* GL_QUADRATIC_ATTENUATION */
+ 699, /* GL_LINEAR_ATTENUATION */
+ 1292, /* GL_QUADRATIC_ATTENUATION */
245, /* GL_COMPILE */
246, /* GL_COMPILE_AND_EXECUTE */
121, /* GL_BYTE */
- 1789, /* GL_UNSIGNED_BYTE */
- 1446, /* GL_SHORT */
- 1801, /* GL_UNSIGNED_SHORT */
+ 1804, /* GL_UNSIGNED_BYTE */
+ 1453, /* GL_SHORT */
+ 1816, /* GL_UNSIGNED_SHORT */
647, /* GL_INT */
- 1792, /* GL_UNSIGNED_INT */
+ 1807, /* GL_UNSIGNED_INT */
490, /* GL_FLOAT */
1, /* GL_2_BYTES */
5, /* GL_3_BYTES */
@@ -4148,148 +4178,148 @@ static const unsigned reduced_enums[1357] =
52, /* GL_AND_REVERSE */
300, /* GL_COPY */
51, /* GL_AND_INVERTED */
- 1025, /* GL_NOOP */
- 1885, /* GL_XOR */
- 1088, /* GL_OR */
- 1026, /* GL_NOR */
+ 1029, /* GL_NOOP */
+ 1900, /* GL_XOR */
+ 1092, /* GL_OR */
+ 1030, /* GL_NOR */
471, /* GL_EQUIV */
- 674, /* GL_INVERT */
- 1091, /* GL_OR_REVERSE */
+ 675, /* GL_INVERT */
+ 1095, /* GL_OR_REVERSE */
301, /* GL_COPY_INVERTED */
- 1090, /* GL_OR_INVERTED */
- 1016, /* GL_NAND */
- 1437, /* GL_SET */
+ 1094, /* GL_OR_INVERTED */
+ 1020, /* GL_NAND */
+ 1444, /* GL_SET */
468, /* GL_EMISSION */
- 1445, /* GL_SHININESS */
+ 1452, /* GL_SHININESS */
49, /* GL_AMBIENT_AND_DIFFUSE */
191, /* GL_COLOR_INDEXES */
- 966, /* GL_MODELVIEW */
- 1263, /* GL_PROJECTION */
- 1571, /* GL_TEXTURE */
+ 970, /* GL_MODELVIEW */
+ 1268, /* GL_PROJECTION */
+ 1578, /* GL_TEXTURE */
148, /* GL_COLOR */
347, /* GL_DEPTH */
- 1507, /* GL_STENCIL */
+ 1514, /* GL_STENCIL */
190, /* GL_COLOR_INDEX */
- 1526, /* GL_STENCIL_INDEX */
+ 1533, /* GL_STENCIL_INDEX */
360, /* GL_DEPTH_COMPONENT */
- 1315, /* GL_RED */
+ 1321, /* GL_RED */
601, /* GL_GREEN */
90, /* GL_BLUE */
31, /* GL_ALPHA */
- 1354, /* GL_RGB */
- 1373, /* GL_RGBA */
- 726, /* GL_LUMINANCE */
- 747, /* GL_LUMINANCE_ALPHA */
+ 1360, /* GL_RGB */
+ 1379, /* GL_RGBA */
+ 727, /* GL_LUMINANCE */
+ 748, /* GL_LUMINANCE_ALPHA */
73, /* GL_BITMAP */
- 1143, /* GL_POINT */
- 696, /* GL_LINE */
+ 1147, /* GL_POINT */
+ 697, /* GL_LINE */
486, /* GL_FILL */
- 1325, /* GL_RENDER */
+ 1331, /* GL_RENDER */
482, /* GL_FEEDBACK */
- 1431, /* GL_SELECT */
+ 1437, /* GL_SELECT */
489, /* GL_FLAT */
- 1456, /* GL_SMOOTH */
- 675, /* GL_KEEP */
- 1347, /* GL_REPLACE */
+ 1463, /* GL_SMOOTH */
+ 676, /* GL_KEEP */
+ 1353, /* GL_REPLACE */
629, /* GL_INCR */
343, /* GL_DECR */
- 1816, /* GL_VENDOR */
- 1344, /* GL_RENDERER */
- 1817, /* GL_VERSION */
+ 1831, /* GL_VENDOR */
+ 1350, /* GL_RENDERER */
+ 1832, /* GL_VERSION */
475, /* GL_EXTENSIONS */
- 1396, /* GL_S */
- 1562, /* GL_T */
- 1303, /* GL_R */
- 1286, /* GL_Q */
- 1002, /* GL_MODULATE */
+ 1402, /* GL_S */
+ 1569, /* GL_T */
+ 1308, /* GL_R */
+ 1291, /* GL_Q */
+ 1006, /* GL_MODULATE */
342, /* GL_DECAL */
- 1708, /* GL_TEXTURE_ENV_MODE */
- 1707, /* GL_TEXTURE_ENV_COLOR */
- 1706, /* GL_TEXTURE_ENV */
+ 1715, /* GL_TEXTURE_ENV_MODE */
+ 1714, /* GL_TEXTURE_ENV_COLOR */
+ 1713, /* GL_TEXTURE_ENV */
476, /* GL_EYE_LINEAR */
- 1049, /* GL_OBJECT_LINEAR */
- 1482, /* GL_SPHERE_MAP */
- 1710, /* GL_TEXTURE_GEN_MODE */
- 1051, /* GL_OBJECT_PLANE */
+ 1053, /* GL_OBJECT_LINEAR */
+ 1489, /* GL_SPHERE_MAP */
+ 1717, /* GL_TEXTURE_GEN_MODE */
+ 1055, /* GL_OBJECT_PLANE */
477, /* GL_EYE_PLANE */
- 1017, /* GL_NEAREST */
- 697, /* GL_LINEAR */
- 1021, /* GL_NEAREST_MIPMAP_NEAREST */
- 702, /* GL_LINEAR_MIPMAP_NEAREST */
- 1020, /* GL_NEAREST_MIPMAP_LINEAR */
- 701, /* GL_LINEAR_MIPMAP_LINEAR */
- 1731, /* GL_TEXTURE_MAG_FILTER */
- 1739, /* GL_TEXTURE_MIN_FILTER */
- 1757, /* GL_TEXTURE_WRAP_S */
- 1758, /* GL_TEXTURE_WRAP_T */
+ 1021, /* GL_NEAREST */
+ 698, /* GL_LINEAR */
+ 1025, /* GL_NEAREST_MIPMAP_NEAREST */
+ 703, /* GL_LINEAR_MIPMAP_NEAREST */
+ 1024, /* GL_NEAREST_MIPMAP_LINEAR */
+ 702, /* GL_LINEAR_MIPMAP_LINEAR */
+ 1738, /* GL_TEXTURE_MAG_FILTER */
+ 1746, /* GL_TEXTURE_MIN_FILTER */
+ 1764, /* GL_TEXTURE_WRAP_S */
+ 1765, /* GL_TEXTURE_WRAP_T */
127, /* GL_CLAMP */
- 1346, /* GL_REPEAT */
- 1181, /* GL_POLYGON_OFFSET_UNITS */
- 1180, /* GL_POLYGON_OFFSET_POINT */
- 1179, /* GL_POLYGON_OFFSET_LINE */
- 1304, /* GL_R3_G3_B2 */
- 1813, /* GL_V2F */
- 1814, /* GL_V3F */
+ 1352, /* GL_REPEAT */
+ 1185, /* GL_POLYGON_OFFSET_UNITS */
+ 1184, /* GL_POLYGON_OFFSET_POINT */
+ 1183, /* GL_POLYGON_OFFSET_LINE */
+ 1309, /* GL_R3_G3_B2 */
+ 1828, /* GL_V2F */
+ 1829, /* GL_V3F */
124, /* GL_C4UB_V2F */
125, /* GL_C4UB_V3F */
122, /* GL_C3F_V3F */
- 1014, /* GL_N3F_V3F */
+ 1018, /* GL_N3F_V3F */
123, /* GL_C4F_N3F_V3F */
- 1567, /* GL_T2F_V3F */
- 1569, /* GL_T4F_V4F */
- 1565, /* GL_T2F_C4UB_V3F */
- 1563, /* GL_T2F_C3F_V3F */
- 1566, /* GL_T2F_N3F_V3F */
- 1564, /* GL_T2F_C4F_N3F_V3F */
- 1568, /* GL_T4F_C4F_N3F_V4F */
+ 1574, /* GL_T2F_V3F */
+ 1576, /* GL_T4F_V4F */
+ 1572, /* GL_T2F_C4UB_V3F */
+ 1570, /* GL_T2F_C3F_V3F */
+ 1573, /* GL_T2F_N3F_V3F */
+ 1571, /* GL_T2F_C4F_N3F_V3F */
+ 1575, /* GL_T4F_C4F_N3F_V4F */
140, /* GL_CLIP_PLANE0 */
141, /* GL_CLIP_PLANE1 */
142, /* GL_CLIP_PLANE2 */
143, /* GL_CLIP_PLANE3 */
144, /* GL_CLIP_PLANE4 */
145, /* GL_CLIP_PLANE5 */
- 681, /* GL_LIGHT0 */
- 682, /* GL_LIGHT1 */
- 683, /* GL_LIGHT2 */
- 684, /* GL_LIGHT3 */
- 685, /* GL_LIGHT4 */
- 686, /* GL_LIGHT5 */
- 687, /* GL_LIGHT6 */
- 688, /* GL_LIGHT7 */
+ 682, /* GL_LIGHT0 */
+ 683, /* GL_LIGHT1 */
+ 684, /* GL_LIGHT2 */
+ 685, /* GL_LIGHT3 */
+ 686, /* GL_LIGHT4 */
+ 687, /* GL_LIGHT5 */
+ 688, /* GL_LIGHT6 */
+ 689, /* GL_LIGHT7 */
606, /* GL_HINT_BIT */
278, /* GL_CONSTANT_COLOR */
- 1062, /* GL_ONE_MINUS_CONSTANT_COLOR */
+ 1066, /* GL_ONE_MINUS_CONSTANT_COLOR */
273, /* GL_CONSTANT_ALPHA */
- 1060, /* GL_ONE_MINUS_CONSTANT_ALPHA */
+ 1064, /* GL_ONE_MINUS_CONSTANT_ALPHA */
76, /* GL_BLEND_COLOR */
589, /* GL_FUNC_ADD */
- 950, /* GL_MIN */
- 857, /* GL_MAX */
+ 954, /* GL_MIN */
+ 858, /* GL_MAX */
81, /* GL_BLEND_EQUATION */
593, /* GL_FUNC_SUBTRACT */
591, /* GL_FUNC_REVERSE_SUBTRACT */
281, /* GL_CONVOLUTION_1D */
282, /* GL_CONVOLUTION_2D */
- 1434, /* GL_SEPARABLE_2D */
+ 1440, /* GL_SEPARABLE_2D */
285, /* GL_CONVOLUTION_BORDER_MODE */
289, /* GL_CONVOLUTION_FILTER_SCALE */
287, /* GL_CONVOLUTION_FILTER_BIAS */
- 1316, /* GL_REDUCE */
+ 1322, /* GL_REDUCE */
291, /* GL_CONVOLUTION_FORMAT */
295, /* GL_CONVOLUTION_WIDTH */
293, /* GL_CONVOLUTION_HEIGHT */
- 873, /* GL_MAX_CONVOLUTION_WIDTH */
- 871, /* GL_MAX_CONVOLUTION_HEIGHT */
- 1220, /* GL_POST_CONVOLUTION_RED_SCALE */
- 1216, /* GL_POST_CONVOLUTION_GREEN_SCALE */
- 1211, /* GL_POST_CONVOLUTION_BLUE_SCALE */
- 1207, /* GL_POST_CONVOLUTION_ALPHA_SCALE */
- 1218, /* GL_POST_CONVOLUTION_RED_BIAS */
- 1214, /* GL_POST_CONVOLUTION_GREEN_BIAS */
- 1209, /* GL_POST_CONVOLUTION_BLUE_BIAS */
- 1205, /* GL_POST_CONVOLUTION_ALPHA_BIAS */
+ 874, /* GL_MAX_CONVOLUTION_WIDTH */
+ 872, /* GL_MAX_CONVOLUTION_HEIGHT */
+ 1224, /* GL_POST_CONVOLUTION_RED_SCALE */
+ 1220, /* GL_POST_CONVOLUTION_GREEN_SCALE */
+ 1215, /* GL_POST_CONVOLUTION_BLUE_SCALE */
+ 1211, /* GL_POST_CONVOLUTION_ALPHA_SCALE */
+ 1222, /* GL_POST_CONVOLUTION_RED_BIAS */
+ 1218, /* GL_POST_CONVOLUTION_GREEN_BIAS */
+ 1213, /* GL_POST_CONVOLUTION_BLUE_BIAS */
+ 1209, /* GL_POST_CONVOLUTION_ALPHA_BIAS */
607, /* GL_HISTOGRAM */
- 1269, /* GL_PROXY_HISTOGRAM */
+ 1274, /* GL_PROXY_HISTOGRAM */
623, /* GL_HISTOGRAM_WIDTH */
613, /* GL_HISTOGRAM_FORMAT */
619, /* GL_HISTOGRAM_RED_SIZE */
@@ -4298,134 +4328,134 @@ static const unsigned reduced_enums[1357] =
608, /* GL_HISTOGRAM_ALPHA_SIZE */
617, /* GL_HISTOGRAM_LUMINANCE_SIZE */
621, /* GL_HISTOGRAM_SINK */
- 951, /* GL_MINMAX */
- 953, /* GL_MINMAX_FORMAT */
- 955, /* GL_MINMAX_SINK */
- 1570, /* GL_TABLE_TOO_LARGE_EXT */
- 1791, /* GL_UNSIGNED_BYTE_3_3_2 */
- 1803, /* GL_UNSIGNED_SHORT_4_4_4_4 */
- 1805, /* GL_UNSIGNED_SHORT_5_5_5_1 */
- 1798, /* GL_UNSIGNED_INT_8_8_8_8 */
- 1793, /* GL_UNSIGNED_INT_10_10_10_2 */
- 1178, /* GL_POLYGON_OFFSET_FILL */
- 1177, /* GL_POLYGON_OFFSET_FACTOR */
- 1176, /* GL_POLYGON_OFFSET_BIAS */
- 1350, /* GL_RESCALE_NORMAL */
+ 955, /* GL_MINMAX */
+ 957, /* GL_MINMAX_FORMAT */
+ 959, /* GL_MINMAX_SINK */
+ 1577, /* GL_TABLE_TOO_LARGE_EXT */
+ 1806, /* GL_UNSIGNED_BYTE_3_3_2 */
+ 1818, /* GL_UNSIGNED_SHORT_4_4_4_4 */
+ 1820, /* GL_UNSIGNED_SHORT_5_5_5_1 */
+ 1813, /* GL_UNSIGNED_INT_8_8_8_8 */
+ 1808, /* GL_UNSIGNED_INT_10_10_10_2 */
+ 1182, /* GL_POLYGON_OFFSET_FILL */
+ 1181, /* GL_POLYGON_OFFSET_FACTOR */
+ 1180, /* GL_POLYGON_OFFSET_BIAS */
+ 1356, /* GL_RESCALE_NORMAL */
36, /* GL_ALPHA4 */
38, /* GL_ALPHA8 */
32, /* GL_ALPHA12 */
34, /* GL_ALPHA16 */
- 737, /* GL_LUMINANCE4 */
- 743, /* GL_LUMINANCE8 */
- 727, /* GL_LUMINANCE12 */
- 733, /* GL_LUMINANCE16 */
- 738, /* GL_LUMINANCE4_ALPHA4 */
- 741, /* GL_LUMINANCE6_ALPHA2 */
- 744, /* GL_LUMINANCE8_ALPHA8 */
- 730, /* GL_LUMINANCE12_ALPHA4 */
- 728, /* GL_LUMINANCE12_ALPHA12 */
- 734, /* GL_LUMINANCE16_ALPHA16 */
+ 738, /* GL_LUMINANCE4 */
+ 744, /* GL_LUMINANCE8 */
+ 728, /* GL_LUMINANCE12 */
+ 734, /* GL_LUMINANCE16 */
+ 739, /* GL_LUMINANCE4_ALPHA4 */
+ 742, /* GL_LUMINANCE6_ALPHA2 */
+ 745, /* GL_LUMINANCE8_ALPHA8 */
+ 731, /* GL_LUMINANCE12_ALPHA4 */
+ 729, /* GL_LUMINANCE12_ALPHA12 */
+ 735, /* GL_LUMINANCE16_ALPHA16 */
648, /* GL_INTENSITY */
653, /* GL_INTENSITY4 */
655, /* GL_INTENSITY8 */
649, /* GL_INTENSITY12 */
651, /* GL_INTENSITY16 */
- 1363, /* GL_RGB2_EXT */
- 1364, /* GL_RGB4 */
- 1367, /* GL_RGB5 */
- 1371, /* GL_RGB8 */
- 1355, /* GL_RGB10 */
- 1359, /* GL_RGB12 */
- 1361, /* GL_RGB16 */
- 1378, /* GL_RGBA2 */
- 1380, /* GL_RGBA4 */
- 1368, /* GL_RGB5_A1 */
- 1384, /* GL_RGBA8 */
- 1356, /* GL_RGB10_A2 */
- 1374, /* GL_RGBA12 */
- 1376, /* GL_RGBA16 */
- 1746, /* GL_TEXTURE_RED_SIZE */
- 1716, /* GL_TEXTURE_GREEN_SIZE */
- 1654, /* GL_TEXTURE_BLUE_SIZE */
- 1641, /* GL_TEXTURE_ALPHA_SIZE */
- 1729, /* GL_TEXTURE_LUMINANCE_SIZE */
- 1720, /* GL_TEXTURE_INTENSITY_SIZE */
- 1348, /* GL_REPLACE_EXT */
- 1273, /* GL_PROXY_TEXTURE_1D */
- 1276, /* GL_PROXY_TEXTURE_2D */
- 1753, /* GL_TEXTURE_TOO_LARGE_EXT */
- 1741, /* GL_TEXTURE_PRIORITY */
- 1748, /* GL_TEXTURE_RESIDENT */
- 1644, /* GL_TEXTURE_BINDING_1D */
- 1646, /* GL_TEXTURE_BINDING_2D */
- 1648, /* GL_TEXTURE_BINDING_3D */
- 1098, /* GL_PACK_SKIP_IMAGES */
- 1094, /* GL_PACK_IMAGE_HEIGHT */
- 1784, /* GL_UNPACK_SKIP_IMAGES */
- 1781, /* GL_UNPACK_IMAGE_HEIGHT */
- 1640, /* GL_TEXTURE_3D */
- 1279, /* GL_PROXY_TEXTURE_3D */
- 1703, /* GL_TEXTURE_DEPTH */
- 1756, /* GL_TEXTURE_WRAP_R */
- 858, /* GL_MAX_3D_TEXTURE_SIZE */
- 1818, /* GL_VERTEX_ARRAY */
- 1028, /* GL_NORMAL_ARRAY */
+ 1369, /* GL_RGB2_EXT */
+ 1370, /* GL_RGB4 */
+ 1373, /* GL_RGB5 */
+ 1377, /* GL_RGB8 */
+ 1361, /* GL_RGB10 */
+ 1365, /* GL_RGB12 */
+ 1367, /* GL_RGB16 */
+ 1384, /* GL_RGBA2 */
+ 1386, /* GL_RGBA4 */
+ 1374, /* GL_RGB5_A1 */
+ 1390, /* GL_RGBA8 */
+ 1362, /* GL_RGB10_A2 */
+ 1380, /* GL_RGBA12 */
+ 1382, /* GL_RGBA16 */
+ 1753, /* GL_TEXTURE_RED_SIZE */
+ 1723, /* GL_TEXTURE_GREEN_SIZE */
+ 1661, /* GL_TEXTURE_BLUE_SIZE */
+ 1648, /* GL_TEXTURE_ALPHA_SIZE */
+ 1736, /* GL_TEXTURE_LUMINANCE_SIZE */
+ 1727, /* GL_TEXTURE_INTENSITY_SIZE */
+ 1354, /* GL_REPLACE_EXT */
+ 1278, /* GL_PROXY_TEXTURE_1D */
+ 1281, /* GL_PROXY_TEXTURE_2D */
+ 1760, /* GL_TEXTURE_TOO_LARGE_EXT */
+ 1748, /* GL_TEXTURE_PRIORITY */
+ 1755, /* GL_TEXTURE_RESIDENT */
+ 1651, /* GL_TEXTURE_BINDING_1D */
+ 1653, /* GL_TEXTURE_BINDING_2D */
+ 1655, /* GL_TEXTURE_BINDING_3D */
+ 1102, /* GL_PACK_SKIP_IMAGES */
+ 1098, /* GL_PACK_IMAGE_HEIGHT */
+ 1799, /* GL_UNPACK_SKIP_IMAGES */
+ 1796, /* GL_UNPACK_IMAGE_HEIGHT */
+ 1647, /* GL_TEXTURE_3D */
+ 1284, /* GL_PROXY_TEXTURE_3D */
+ 1710, /* GL_TEXTURE_DEPTH */
+ 1763, /* GL_TEXTURE_WRAP_R */
+ 859, /* GL_MAX_3D_TEXTURE_SIZE */
+ 1833, /* GL_VERTEX_ARRAY */
+ 1032, /* GL_NORMAL_ARRAY */
149, /* GL_COLOR_ARRAY */
633, /* GL_INDEX_ARRAY */
- 1681, /* GL_TEXTURE_COORD_ARRAY */
+ 1688, /* GL_TEXTURE_COORD_ARRAY */
460, /* GL_EDGE_FLAG_ARRAY */
- 1824, /* GL_VERTEX_ARRAY_SIZE */
- 1826, /* GL_VERTEX_ARRAY_TYPE */
- 1825, /* GL_VERTEX_ARRAY_STRIDE */
- 1033, /* GL_NORMAL_ARRAY_TYPE */
- 1032, /* GL_NORMAL_ARRAY_STRIDE */
+ 1839, /* GL_VERTEX_ARRAY_SIZE */
+ 1841, /* GL_VERTEX_ARRAY_TYPE */
+ 1840, /* GL_VERTEX_ARRAY_STRIDE */
+ 1037, /* GL_NORMAL_ARRAY_TYPE */
+ 1036, /* GL_NORMAL_ARRAY_STRIDE */
153, /* GL_COLOR_ARRAY_SIZE */
155, /* GL_COLOR_ARRAY_TYPE */
154, /* GL_COLOR_ARRAY_STRIDE */
638, /* GL_INDEX_ARRAY_TYPE */
637, /* GL_INDEX_ARRAY_STRIDE */
- 1685, /* GL_TEXTURE_COORD_ARRAY_SIZE */
- 1687, /* GL_TEXTURE_COORD_ARRAY_TYPE */
- 1686, /* GL_TEXTURE_COORD_ARRAY_STRIDE */
+ 1692, /* GL_TEXTURE_COORD_ARRAY_SIZE */
+ 1694, /* GL_TEXTURE_COORD_ARRAY_TYPE */
+ 1693, /* GL_TEXTURE_COORD_ARRAY_STRIDE */
464, /* GL_EDGE_FLAG_ARRAY_STRIDE */
- 1823, /* GL_VERTEX_ARRAY_POINTER */
- 1031, /* GL_NORMAL_ARRAY_POINTER */
+ 1838, /* GL_VERTEX_ARRAY_POINTER */
+ 1035, /* GL_NORMAL_ARRAY_POINTER */
152, /* GL_COLOR_ARRAY_POINTER */
636, /* GL_INDEX_ARRAY_POINTER */
- 1684, /* GL_TEXTURE_COORD_ARRAY_POINTER */
+ 1691, /* GL_TEXTURE_COORD_ARRAY_POINTER */
463, /* GL_EDGE_FLAG_ARRAY_POINTER */
- 1007, /* GL_MULTISAMPLE */
- 1408, /* GL_SAMPLE_ALPHA_TO_COVERAGE */
- 1410, /* GL_SAMPLE_ALPHA_TO_ONE */
- 1415, /* GL_SAMPLE_COVERAGE */
- 1412, /* GL_SAMPLE_BUFFERS */
- 1403, /* GL_SAMPLES */
- 1419, /* GL_SAMPLE_COVERAGE_VALUE */
- 1417, /* GL_SAMPLE_COVERAGE_INVERT */
+ 1011, /* GL_MULTISAMPLE */
+ 1414, /* GL_SAMPLE_ALPHA_TO_COVERAGE */
+ 1416, /* GL_SAMPLE_ALPHA_TO_ONE */
+ 1421, /* GL_SAMPLE_COVERAGE */
+ 1418, /* GL_SAMPLE_BUFFERS */
+ 1409, /* GL_SAMPLES */
+ 1425, /* GL_SAMPLE_COVERAGE_VALUE */
+ 1423, /* GL_SAMPLE_COVERAGE_INVERT */
196, /* GL_COLOR_MATRIX */
198, /* GL_COLOR_MATRIX_STACK_DEPTH */
- 867, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */
- 1203, /* GL_POST_COLOR_MATRIX_RED_SCALE */
- 1199, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */
- 1194, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */
- 1190, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */
- 1201, /* GL_POST_COLOR_MATRIX_RED_BIAS */
- 1197, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */
- 1192, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */
- 1188, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */
- 1664, /* GL_TEXTURE_COLOR_TABLE_SGI */
- 1280, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */
- 1666, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
+ 868, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */
+ 1207, /* GL_POST_COLOR_MATRIX_RED_SCALE */
+ 1203, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */
+ 1198, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */
+ 1194, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */
+ 1205, /* GL_POST_COLOR_MATRIX_RED_BIAS */
+ 1201, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */
+ 1196, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */
+ 1192, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */
+ 1671, /* GL_TEXTURE_COLOR_TABLE_SGI */
+ 1285, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */
+ 1673, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
80, /* GL_BLEND_DST_RGB */
89, /* GL_BLEND_SRC_RGB */
79, /* GL_BLEND_DST_ALPHA */
88, /* GL_BLEND_SRC_ALPHA */
202, /* GL_COLOR_TABLE */
- 1213, /* GL_POST_CONVOLUTION_COLOR_TABLE */
- 1196, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */
- 1268, /* GL_PROXY_COLOR_TABLE */
- 1272, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */
- 1271, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */
+ 1217, /* GL_POST_CONVOLUTION_COLOR_TABLE */
+ 1200, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */
+ 1273, /* GL_PROXY_COLOR_TABLE */
+ 1277, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */
+ 1276, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */
226, /* GL_COLOR_TABLE_SCALE */
206, /* GL_COLOR_TABLE_BIAS */
211, /* GL_COLOR_TABLE_FORMAT */
@@ -4438,62 +4468,62 @@ static const unsigned reduced_enums[1357] =
217, /* GL_COLOR_TABLE_INTENSITY_SIZE */
71, /* GL_BGR */
72, /* GL_BGRA */
- 881, /* GL_MAX_ELEMENTS_VERTICES */
- 880, /* GL_MAX_ELEMENTS_INDICES */
- 1719, /* GL_TEXTURE_INDEX_SIZE_EXT */
+ 882, /* GL_MAX_ELEMENTS_VERTICES */
+ 881, /* GL_MAX_ELEMENTS_INDICES */
+ 1726, /* GL_TEXTURE_INDEX_SIZE_EXT */
146, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */
- 1160, /* GL_POINT_SIZE_MIN */
- 1156, /* GL_POINT_SIZE_MAX */
- 1150, /* GL_POINT_FADE_THRESHOLD_SIZE */
- 1146, /* GL_POINT_DISTANCE_ATTENUATION */
+ 1164, /* GL_POINT_SIZE_MIN */
+ 1160, /* GL_POINT_SIZE_MAX */
+ 1154, /* GL_POINT_FADE_THRESHOLD_SIZE */
+ 1150, /* GL_POINT_DISTANCE_ATTENUATION */
128, /* GL_CLAMP_TO_BORDER */
131, /* GL_CLAMP_TO_EDGE */
- 1740, /* GL_TEXTURE_MIN_LOD */
- 1738, /* GL_TEXTURE_MAX_LOD */
- 1643, /* GL_TEXTURE_BASE_LEVEL */
- 1737, /* GL_TEXTURE_MAX_LEVEL */
+ 1747, /* GL_TEXTURE_MIN_LOD */
+ 1745, /* GL_TEXTURE_MAX_LOD */
+ 1650, /* GL_TEXTURE_BASE_LEVEL */
+ 1744, /* GL_TEXTURE_MAX_LEVEL */
626, /* GL_IGNORE_BORDER_HP */
277, /* GL_CONSTANT_BORDER_HP */
- 1349, /* GL_REPLICATE_BORDER_HP */
+ 1355, /* GL_REPLICATE_BORDER_HP */
283, /* GL_CONVOLUTION_BORDER_COLOR */
- 1057, /* GL_OCCLUSION_TEST_HP */
- 1058, /* GL_OCCLUSION_TEST_RESULT_HP */
- 699, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */
- 1658, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */
- 1660, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */
- 1662, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */
- 1663, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */
- 1661, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */
- 1659, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */
- 862, /* GL_MAX_CLIPMAP_DEPTH_SGIX */
- 863, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */
- 1223, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */
- 1225, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */
- 1222, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */
- 1224, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */
- 1727, /* GL_TEXTURE_LOD_BIAS_S_SGIX */
- 1728, /* GL_TEXTURE_LOD_BIAS_T_SGIX */
- 1726, /* GL_TEXTURE_LOD_BIAS_R_SGIX */
+ 1061, /* GL_OCCLUSION_TEST_HP */
+ 1062, /* GL_OCCLUSION_TEST_RESULT_HP */
+ 700, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */
+ 1665, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */
+ 1667, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */
+ 1669, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */
+ 1670, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */
+ 1668, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */
+ 1666, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */
+ 863, /* GL_MAX_CLIPMAP_DEPTH_SGIX */
+ 864, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */
+ 1227, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */
+ 1229, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */
+ 1226, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */
+ 1228, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */
+ 1734, /* GL_TEXTURE_LOD_BIAS_S_SGIX */
+ 1735, /* GL_TEXTURE_LOD_BIAS_T_SGIX */
+ 1733, /* GL_TEXTURE_LOD_BIAS_R_SGIX */
595, /* GL_GENERATE_MIPMAP */
596, /* GL_GENERATE_MIPMAP_HINT */
533, /* GL_FOG_OFFSET_SGIX */
534, /* GL_FOG_OFFSET_VALUE_SGIX */
- 1672, /* GL_TEXTURE_COMPARE_SGIX */
- 1671, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */
- 1723, /* GL_TEXTURE_LEQUAL_R_SGIX */
- 1715, /* GL_TEXTURE_GEQUAL_R_SGIX */
+ 1679, /* GL_TEXTURE_COMPARE_SGIX */
+ 1678, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */
+ 1730, /* GL_TEXTURE_LEQUAL_R_SGIX */
+ 1722, /* GL_TEXTURE_GEQUAL_R_SGIX */
361, /* GL_DEPTH_COMPONENT16 */
364, /* GL_DEPTH_COMPONENT24 */
367, /* GL_DEPTH_COMPONENT32 */
307, /* GL_CULL_VERTEX_EXT */
309, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */
308, /* GL_CULL_VERTEX_EYE_POSITION_EXT */
- 1882, /* GL_WRAP_BORDER_SUN */
- 1665, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */
- 692, /* GL_LIGHT_MODEL_COLOR_CONTROL */
- 1449, /* GL_SINGLE_COLOR */
- 1435, /* GL_SEPARATE_SPECULAR_COLOR */
- 1444, /* GL_SHARED_TEXTURE_PALETTE_EXT */
+ 1897, /* GL_WRAP_BORDER_SUN */
+ 1672, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */
+ 693, /* GL_LIGHT_MODEL_COLOR_CONTROL */
+ 1456, /* GL_SINGLE_COLOR */
+ 1442, /* GL_SEPARATE_SPECULAR_COLOR */
+ 1451, /* GL_SHARED_TEXTURE_PALETTE_EXT */
544, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */
545, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */
552, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */
@@ -4506,30 +4536,30 @@ static const unsigned reduced_enums[1357] =
581, /* GL_FRAMEBUFFER_UNDEFINED */
374, /* GL_DEPTH_STENCIL_ATTACHMENT */
632, /* GL_INDEX */
- 1790, /* GL_UNSIGNED_BYTE_2_3_3_REV */
- 1806, /* GL_UNSIGNED_SHORT_5_6_5 */
- 1807, /* GL_UNSIGNED_SHORT_5_6_5_REV */
- 1804, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */
- 1802, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */
- 1799, /* GL_UNSIGNED_INT_8_8_8_8_REV */
- 1797, /* GL_UNSIGNED_INT_2_10_10_10_REV */
- 1735, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */
- 1736, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */
- 1734, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */
- 958, /* GL_MIRRORED_REPEAT */
- 1391, /* GL_RGB_S3TC */
- 1366, /* GL_RGB4_S3TC */
- 1389, /* GL_RGBA_S3TC */
- 1383, /* GL_RGBA4_S3TC */
- 1387, /* GL_RGBA_DXT5_S3TC */
- 1381, /* GL_RGBA4_DXT5_S3TC */
+ 1805, /* GL_UNSIGNED_BYTE_2_3_3_REV */
+ 1821, /* GL_UNSIGNED_SHORT_5_6_5 */
+ 1822, /* GL_UNSIGNED_SHORT_5_6_5_REV */
+ 1819, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */
+ 1817, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */
+ 1814, /* GL_UNSIGNED_INT_8_8_8_8_REV */
+ 1812, /* GL_UNSIGNED_INT_2_10_10_10_REV */
+ 1742, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */
+ 1743, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */
+ 1741, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */
+ 962, /* GL_MIRRORED_REPEAT */
+ 1397, /* GL_RGB_S3TC */
+ 1372, /* GL_RGB4_S3TC */
+ 1395, /* GL_RGBA_S3TC */
+ 1389, /* GL_RGBA4_S3TC */
+ 1393, /* GL_RGBA_DXT5_S3TC */
+ 1387, /* GL_RGBA4_DXT5_S3TC */
265, /* GL_COMPRESSED_RGB_S3TC_DXT1_EXT */
260, /* GL_COMPRESSED_RGBA_S3TC_DXT1_EXT */
261, /* GL_COMPRESSED_RGBA_S3TC_DXT3_EXT */
262, /* GL_COMPRESSED_RGBA_S3TC_DXT5_EXT */
- 1019, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */
- 1018, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */
- 700, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */
+ 1023, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */
+ 1022, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */
+ 701, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */
520, /* GL_FOG_COORDINATE_SOURCE */
512, /* GL_FOG_COORD */
536, /* GL_FRAGMENT_DEPTH */
@@ -4540,279 +4570,279 @@ static const unsigned reduced_enums[1357] =
514, /* GL_FOG_COORDINATE_ARRAY */
200, /* GL_COLOR_SUM */
333, /* GL_CURRENT_SECONDARY_COLOR */
- 1428, /* GL_SECONDARY_COLOR_ARRAY_SIZE */
- 1430, /* GL_SECONDARY_COLOR_ARRAY_TYPE */
- 1429, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */
- 1427, /* GL_SECONDARY_COLOR_ARRAY_POINTER */
- 1424, /* GL_SECONDARY_COLOR_ARRAY */
+ 1434, /* GL_SECONDARY_COLOR_ARRAY_SIZE */
+ 1436, /* GL_SECONDARY_COLOR_ARRAY_TYPE */
+ 1435, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */
+ 1433, /* GL_SECONDARY_COLOR_ARRAY_POINTER */
+ 1430, /* GL_SECONDARY_COLOR_ARRAY */
331, /* GL_CURRENT_RASTER_SECONDARY_COLOR */
28, /* GL_ALIASED_POINT_SIZE_RANGE */
27, /* GL_ALIASED_LINE_WIDTH_RANGE */
- 1572, /* GL_TEXTURE0 */
- 1574, /* GL_TEXTURE1 */
- 1596, /* GL_TEXTURE2 */
- 1618, /* GL_TEXTURE3 */
- 1624, /* GL_TEXTURE4 */
- 1626, /* GL_TEXTURE5 */
- 1628, /* GL_TEXTURE6 */
- 1630, /* GL_TEXTURE7 */
- 1632, /* GL_TEXTURE8 */
- 1634, /* GL_TEXTURE9 */
- 1575, /* GL_TEXTURE10 */
- 1577, /* GL_TEXTURE11 */
- 1579, /* GL_TEXTURE12 */
- 1581, /* GL_TEXTURE13 */
- 1583, /* GL_TEXTURE14 */
- 1585, /* GL_TEXTURE15 */
- 1587, /* GL_TEXTURE16 */
- 1589, /* GL_TEXTURE17 */
- 1591, /* GL_TEXTURE18 */
- 1593, /* GL_TEXTURE19 */
- 1597, /* GL_TEXTURE20 */
- 1599, /* GL_TEXTURE21 */
- 1601, /* GL_TEXTURE22 */
- 1603, /* GL_TEXTURE23 */
- 1605, /* GL_TEXTURE24 */
- 1607, /* GL_TEXTURE25 */
- 1609, /* GL_TEXTURE26 */
- 1611, /* GL_TEXTURE27 */
- 1613, /* GL_TEXTURE28 */
- 1615, /* GL_TEXTURE29 */
- 1619, /* GL_TEXTURE30 */
- 1621, /* GL_TEXTURE31 */
+ 1579, /* GL_TEXTURE0 */
+ 1581, /* GL_TEXTURE1 */
+ 1603, /* GL_TEXTURE2 */
+ 1625, /* GL_TEXTURE3 */
+ 1631, /* GL_TEXTURE4 */
+ 1633, /* GL_TEXTURE5 */
+ 1635, /* GL_TEXTURE6 */
+ 1637, /* GL_TEXTURE7 */
+ 1639, /* GL_TEXTURE8 */
+ 1641, /* GL_TEXTURE9 */
+ 1582, /* GL_TEXTURE10 */
+ 1584, /* GL_TEXTURE11 */
+ 1586, /* GL_TEXTURE12 */
+ 1588, /* GL_TEXTURE13 */
+ 1590, /* GL_TEXTURE14 */
+ 1592, /* GL_TEXTURE15 */
+ 1594, /* GL_TEXTURE16 */
+ 1596, /* GL_TEXTURE17 */
+ 1598, /* GL_TEXTURE18 */
+ 1600, /* GL_TEXTURE19 */
+ 1604, /* GL_TEXTURE20 */
+ 1606, /* GL_TEXTURE21 */
+ 1608, /* GL_TEXTURE22 */
+ 1610, /* GL_TEXTURE23 */
+ 1612, /* GL_TEXTURE24 */
+ 1614, /* GL_TEXTURE25 */
+ 1616, /* GL_TEXTURE26 */
+ 1618, /* GL_TEXTURE27 */
+ 1620, /* GL_TEXTURE28 */
+ 1622, /* GL_TEXTURE29 */
+ 1626, /* GL_TEXTURE30 */
+ 1628, /* GL_TEXTURE31 */
18, /* GL_ACTIVE_TEXTURE */
134, /* GL_CLIENT_ACTIVE_TEXTURE */
- 936, /* GL_MAX_TEXTURE_UNITS */
- 1767, /* GL_TRANSPOSE_MODELVIEW_MATRIX */
- 1770, /* GL_TRANSPOSE_PROJECTION_MATRIX */
- 1772, /* GL_TRANSPOSE_TEXTURE_MATRIX */
- 1764, /* GL_TRANSPOSE_COLOR_MATRIX */
- 1554, /* GL_SUBTRACT */
- 921, /* GL_MAX_RENDERBUFFER_SIZE */
+ 937, /* GL_MAX_TEXTURE_UNITS */
+ 1782, /* GL_TRANSPOSE_MODELVIEW_MATRIX */
+ 1785, /* GL_TRANSPOSE_PROJECTION_MATRIX */
+ 1787, /* GL_TRANSPOSE_TEXTURE_MATRIX */
+ 1779, /* GL_TRANSPOSE_COLOR_MATRIX */
+ 1561, /* GL_SUBTRACT */
+ 922, /* GL_MAX_RENDERBUFFER_SIZE */
248, /* GL_COMPRESSED_ALPHA */
252, /* GL_COMPRESSED_LUMINANCE */
253, /* GL_COMPRESSED_LUMINANCE_ALPHA */
250, /* GL_COMPRESSED_INTENSITY */
256, /* GL_COMPRESSED_RGB */
257, /* GL_COMPRESSED_RGBA */
- 1679, /* GL_TEXTURE_COMPRESSION_HINT */
- 1744, /* GL_TEXTURE_RECTANGLE_ARB */
- 1651, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */
- 1283, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */
- 919, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */
+ 1686, /* GL_TEXTURE_COMPRESSION_HINT */
+ 1751, /* GL_TEXTURE_RECTANGLE_ARB */
+ 1658, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */
+ 1288, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */
+ 920, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */
373, /* GL_DEPTH_STENCIL */
- 1794, /* GL_UNSIGNED_INT_24_8 */
- 932, /* GL_MAX_TEXTURE_LOD_BIAS */
- 1733, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */
- 933, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */
- 1709, /* GL_TEXTURE_FILTER_CONTROL */
- 1724, /* GL_TEXTURE_LOD_BIAS */
+ 1809, /* GL_UNSIGNED_INT_24_8 */
+ 933, /* GL_MAX_TEXTURE_LOD_BIAS */
+ 1740, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */
+ 934, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */
+ 1716, /* GL_TEXTURE_FILTER_CONTROL */
+ 1731, /* GL_TEXTURE_LOD_BIAS */
233, /* GL_COMBINE4 */
- 926, /* GL_MAX_SHININESS_NV */
- 927, /* GL_MAX_SPOT_EXPONENT_NV */
+ 927, /* GL_MAX_SHININESS_NV */
+ 928, /* GL_MAX_SPOT_EXPONENT_NV */
630, /* GL_INCR_WRAP */
344, /* GL_DECR_WRAP */
- 978, /* GL_MODELVIEW1_ARB */
- 1034, /* GL_NORMAL_MAP */
- 1321, /* GL_REFLECTION_MAP */
- 1688, /* GL_TEXTURE_CUBE_MAP */
- 1649, /* GL_TEXTURE_BINDING_CUBE_MAP */
- 1696, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */
- 1690, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */
- 1698, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */
- 1692, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */
- 1700, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */
- 1694, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */
- 1281, /* GL_PROXY_TEXTURE_CUBE_MAP */
- 875, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */
- 1013, /* GL_MULTISAMPLE_FILTER_HINT_NV */
+ 982, /* GL_MODELVIEW1_ARB */
+ 1038, /* GL_NORMAL_MAP */
+ 1327, /* GL_REFLECTION_MAP */
+ 1695, /* GL_TEXTURE_CUBE_MAP */
+ 1656, /* GL_TEXTURE_BINDING_CUBE_MAP */
+ 1703, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */
+ 1697, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */
+ 1705, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */
+ 1699, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */
+ 1707, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */
+ 1701, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */
+ 1286, /* GL_PROXY_TEXTURE_CUBE_MAP */
+ 876, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */
+ 1017, /* GL_MULTISAMPLE_FILTER_HINT_NV */
528, /* GL_FOG_DISTANCE_MODE_NV */
479, /* GL_EYE_RADIAL_NV */
478, /* GL_EYE_PLANE_ABSOLUTE_NV */
232, /* GL_COMBINE */
239, /* GL_COMBINE_RGB */
234, /* GL_COMBINE_ALPHA */
- 1392, /* GL_RGB_SCALE */
+ 1398, /* GL_RGB_SCALE */
24, /* GL_ADD_SIGNED */
- 658, /* GL_INTERPOLATE */
+ 659, /* GL_INTERPOLATE */
272, /* GL_CONSTANT */
- 1229, /* GL_PRIMARY_COLOR */
- 1226, /* GL_PREVIOUS */
- 1464, /* GL_SOURCE0_RGB */
- 1470, /* GL_SOURCE1_RGB */
- 1476, /* GL_SOURCE2_RGB */
- 1480, /* GL_SOURCE3_RGB_NV */
- 1461, /* GL_SOURCE0_ALPHA */
- 1467, /* GL_SOURCE1_ALPHA */
- 1473, /* GL_SOURCE2_ALPHA */
- 1479, /* GL_SOURCE3_ALPHA_NV */
- 1071, /* GL_OPERAND0_RGB */
- 1077, /* GL_OPERAND1_RGB */
- 1083, /* GL_OPERAND2_RGB */
- 1087, /* GL_OPERAND3_RGB_NV */
- 1068, /* GL_OPERAND0_ALPHA */
- 1074, /* GL_OPERAND1_ALPHA */
- 1080, /* GL_OPERAND2_ALPHA */
- 1086, /* GL_OPERAND3_ALPHA_NV */
+ 1233, /* GL_PRIMARY_COLOR */
+ 1230, /* GL_PREVIOUS */
+ 1471, /* GL_SOURCE0_RGB */
+ 1477, /* GL_SOURCE1_RGB */
+ 1483, /* GL_SOURCE2_RGB */
+ 1487, /* GL_SOURCE3_RGB_NV */
+ 1468, /* GL_SOURCE0_ALPHA */
+ 1474, /* GL_SOURCE1_ALPHA */
+ 1480, /* GL_SOURCE2_ALPHA */
+ 1486, /* GL_SOURCE3_ALPHA_NV */
+ 1075, /* GL_OPERAND0_RGB */
+ 1081, /* GL_OPERAND1_RGB */
+ 1087, /* GL_OPERAND2_RGB */
+ 1091, /* GL_OPERAND3_RGB_NV */
+ 1072, /* GL_OPERAND0_ALPHA */
+ 1078, /* GL_OPERAND1_ALPHA */
+ 1084, /* GL_OPERAND2_ALPHA */
+ 1090, /* GL_OPERAND3_ALPHA_NV */
109, /* GL_BUFFER_OBJECT_APPLE */
- 1819, /* GL_VERTEX_ARRAY_BINDING */
- 1742, /* GL_TEXTURE_RANGE_LENGTH_APPLE */
- 1743, /* GL_TEXTURE_RANGE_POINTER_APPLE */
- 1886, /* GL_YCBCR_422_APPLE */
- 1808, /* GL_UNSIGNED_SHORT_8_8_APPLE */
- 1810, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */
- 1752, /* GL_TEXTURE_STORAGE_HINT_APPLE */
- 1545, /* GL_STORAGE_PRIVATE_APPLE */
- 1544, /* GL_STORAGE_CACHED_APPLE */
- 1546, /* GL_STORAGE_SHARED_APPLE */
- 1451, /* GL_SLICE_ACCUM_SUN */
- 1291, /* GL_QUAD_MESH_SUN */
- 1776, /* GL_TRIANGLE_MESH_SUN */
- 1858, /* GL_VERTEX_PROGRAM_ARB */
- 1869, /* GL_VERTEX_STATE_PROGRAM_NV */
- 1845, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */
- 1851, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */
- 1853, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */
- 1855, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */
+ 1834, /* GL_VERTEX_ARRAY_BINDING */
+ 1749, /* GL_TEXTURE_RANGE_LENGTH_APPLE */
+ 1750, /* GL_TEXTURE_RANGE_POINTER_APPLE */
+ 1901, /* GL_YCBCR_422_APPLE */
+ 1823, /* GL_UNSIGNED_SHORT_8_8_APPLE */
+ 1825, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */
+ 1759, /* GL_TEXTURE_STORAGE_HINT_APPLE */
+ 1552, /* GL_STORAGE_PRIVATE_APPLE */
+ 1551, /* GL_STORAGE_CACHED_APPLE */
+ 1553, /* GL_STORAGE_SHARED_APPLE */
+ 1458, /* GL_SLICE_ACCUM_SUN */
+ 1296, /* GL_QUAD_MESH_SUN */
+ 1791, /* GL_TRIANGLE_MESH_SUN */
+ 1873, /* GL_VERTEX_PROGRAM_ARB */
+ 1884, /* GL_VERTEX_STATE_PROGRAM_NV */
+ 1860, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */
+ 1866, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */
+ 1868, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */
+ 1870, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */
335, /* GL_CURRENT_VERTEX_ATTRIB */
- 1242, /* GL_PROGRAM_LENGTH_ARB */
- 1256, /* GL_PROGRAM_STRING_ARB */
- 1000, /* GL_MODELVIEW_PROJECTION_NV */
+ 1247, /* GL_PROGRAM_LENGTH_ARB */
+ 1261, /* GL_PROGRAM_STRING_ARB */
+ 1004, /* GL_MODELVIEW_PROJECTION_NV */
625, /* GL_IDENTITY_NV */
- 672, /* GL_INVERSE_NV */
- 1769, /* GL_TRANSPOSE_NV */
- 673, /* GL_INVERSE_TRANSPOSE_NV */
- 905, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */
- 904, /* GL_MAX_PROGRAM_MATRICES_ARB */
- 811, /* GL_MATRIX0_NV */
- 823, /* GL_MATRIX1_NV */
- 835, /* GL_MATRIX2_NV */
- 839, /* GL_MATRIX3_NV */
- 841, /* GL_MATRIX4_NV */
- 843, /* GL_MATRIX5_NV */
- 845, /* GL_MATRIX6_NV */
- 847, /* GL_MATRIX7_NV */
+ 673, /* GL_INVERSE_NV */
+ 1784, /* GL_TRANSPOSE_NV */
+ 674, /* GL_INVERSE_TRANSPOSE_NV */
+ 906, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */
+ 905, /* GL_MAX_PROGRAM_MATRICES_ARB */
+ 812, /* GL_MATRIX0_NV */
+ 824, /* GL_MATRIX1_NV */
+ 836, /* GL_MATRIX2_NV */
+ 840, /* GL_MATRIX3_NV */
+ 842, /* GL_MATRIX4_NV */
+ 844, /* GL_MATRIX5_NV */
+ 846, /* GL_MATRIX6_NV */
+ 848, /* GL_MATRIX7_NV */
319, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */
316, /* GL_CURRENT_MATRIX_ARB */
- 1861, /* GL_VERTEX_PROGRAM_POINT_SIZE */
- 1864, /* GL_VERTEX_PROGRAM_TWO_SIDE */
- 1254, /* GL_PROGRAM_PARAMETER_NV */
- 1849, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */
- 1258, /* GL_PROGRAM_TARGET_NV */
- 1255, /* GL_PROGRAM_RESIDENT_NV */
- 1761, /* GL_TRACK_MATRIX_NV */
- 1762, /* GL_TRACK_MATRIX_TRANSFORM_NV */
- 1859, /* GL_VERTEX_PROGRAM_BINDING_NV */
- 1236, /* GL_PROGRAM_ERROR_POSITION_ARB */
+ 1876, /* GL_VERTEX_PROGRAM_POINT_SIZE */
+ 1879, /* GL_VERTEX_PROGRAM_TWO_SIDE */
+ 1259, /* GL_PROGRAM_PARAMETER_NV */
+ 1864, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */
+ 1263, /* GL_PROGRAM_TARGET_NV */
+ 1260, /* GL_PROGRAM_RESIDENT_NV */
+ 1768, /* GL_TRACK_MATRIX_NV */
+ 1769, /* GL_TRACK_MATRIX_TRANSFORM_NV */
+ 1874, /* GL_VERTEX_PROGRAM_BINDING_NV */
+ 1241, /* GL_PROGRAM_ERROR_POSITION_ARB */
357, /* GL_DEPTH_CLAMP */
- 1827, /* GL_VERTEX_ATTRIB_ARRAY0_NV */
- 1834, /* GL_VERTEX_ATTRIB_ARRAY1_NV */
- 1835, /* GL_VERTEX_ATTRIB_ARRAY2_NV */
- 1836, /* GL_VERTEX_ATTRIB_ARRAY3_NV */
- 1837, /* GL_VERTEX_ATTRIB_ARRAY4_NV */
- 1838, /* GL_VERTEX_ATTRIB_ARRAY5_NV */
- 1839, /* GL_VERTEX_ATTRIB_ARRAY6_NV */
- 1840, /* GL_VERTEX_ATTRIB_ARRAY7_NV */
- 1841, /* GL_VERTEX_ATTRIB_ARRAY8_NV */
- 1842, /* GL_VERTEX_ATTRIB_ARRAY9_NV */
- 1828, /* GL_VERTEX_ATTRIB_ARRAY10_NV */
- 1829, /* GL_VERTEX_ATTRIB_ARRAY11_NV */
- 1830, /* GL_VERTEX_ATTRIB_ARRAY12_NV */
- 1831, /* GL_VERTEX_ATTRIB_ARRAY13_NV */
- 1832, /* GL_VERTEX_ATTRIB_ARRAY14_NV */
- 1833, /* GL_VERTEX_ATTRIB_ARRAY15_NV */
- 759, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */
- 766, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */
- 767, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */
- 768, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */
- 769, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */
- 770, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */
- 771, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */
- 772, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */
- 773, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */
- 774, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */
- 760, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */
- 761, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */
- 762, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */
- 763, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */
- 764, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */
- 765, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */
- 786, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */
- 793, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */
- 794, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */
- 795, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */
- 796, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */
- 797, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */
- 798, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */
- 1235, /* GL_PROGRAM_BINDING_ARB */
- 800, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */
- 801, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */
- 787, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */
- 788, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */
- 789, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */
- 790, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */
- 791, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */
- 792, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */
- 1677, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */
- 1674, /* GL_TEXTURE_COMPRESSED */
- 1039, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */
+ 1842, /* GL_VERTEX_ATTRIB_ARRAY0_NV */
+ 1849, /* GL_VERTEX_ATTRIB_ARRAY1_NV */
+ 1850, /* GL_VERTEX_ATTRIB_ARRAY2_NV */
+ 1851, /* GL_VERTEX_ATTRIB_ARRAY3_NV */
+ 1852, /* GL_VERTEX_ATTRIB_ARRAY4_NV */
+ 1853, /* GL_VERTEX_ATTRIB_ARRAY5_NV */
+ 1854, /* GL_VERTEX_ATTRIB_ARRAY6_NV */
+ 1855, /* GL_VERTEX_ATTRIB_ARRAY7_NV */
+ 1856, /* GL_VERTEX_ATTRIB_ARRAY8_NV */
+ 1857, /* GL_VERTEX_ATTRIB_ARRAY9_NV */
+ 1843, /* GL_VERTEX_ATTRIB_ARRAY10_NV */
+ 1844, /* GL_VERTEX_ATTRIB_ARRAY11_NV */
+ 1845, /* GL_VERTEX_ATTRIB_ARRAY12_NV */
+ 1846, /* GL_VERTEX_ATTRIB_ARRAY13_NV */
+ 1847, /* GL_VERTEX_ATTRIB_ARRAY14_NV */
+ 1848, /* GL_VERTEX_ATTRIB_ARRAY15_NV */
+ 760, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */
+ 767, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */
+ 768, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */
+ 769, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */
+ 770, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */
+ 771, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */
+ 772, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */
+ 773, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */
+ 774, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */
+ 775, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */
+ 761, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */
+ 762, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */
+ 763, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */
+ 764, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */
+ 765, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */
+ 766, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */
+ 787, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */
+ 794, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */
+ 795, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */
+ 796, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */
+ 797, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */
+ 798, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */
+ 799, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */
+ 1240, /* GL_PROGRAM_BINDING_ARB */
+ 801, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */
+ 802, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */
+ 788, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */
+ 789, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */
+ 790, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */
+ 791, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */
+ 792, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */
+ 793, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */
+ 1684, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */
+ 1681, /* GL_TEXTURE_COMPRESSED */
+ 1043, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */
270, /* GL_COMPRESSED_TEXTURE_FORMATS */
- 948, /* GL_MAX_VERTEX_UNITS_ARB */
+ 952, /* GL_MAX_VERTEX_UNITS_ARB */
22, /* GL_ACTIVE_VERTEX_UNITS_ARB */
- 1881, /* GL_WEIGHT_SUM_UNITY_ARB */
- 1857, /* GL_VERTEX_BLEND_ARB */
+ 1896, /* GL_WEIGHT_SUM_UNITY_ARB */
+ 1872, /* GL_VERTEX_BLEND_ARB */
337, /* GL_CURRENT_WEIGHT_ARB */
- 1880, /* GL_WEIGHT_ARRAY_TYPE_ARB */
- 1879, /* GL_WEIGHT_ARRAY_STRIDE_ARB */
- 1878, /* GL_WEIGHT_ARRAY_SIZE_ARB */
- 1877, /* GL_WEIGHT_ARRAY_POINTER_ARB */
- 1874, /* GL_WEIGHT_ARRAY_ARB */
+ 1895, /* GL_WEIGHT_ARRAY_TYPE_ARB */
+ 1894, /* GL_WEIGHT_ARRAY_STRIDE_ARB */
+ 1893, /* GL_WEIGHT_ARRAY_SIZE_ARB */
+ 1892, /* GL_WEIGHT_ARRAY_POINTER_ARB */
+ 1889, /* GL_WEIGHT_ARRAY_ARB */
387, /* GL_DOT3_RGB */
388, /* GL_DOT3_RGBA */
264, /* GL_COMPRESSED_RGB_FXT1_3DFX */
259, /* GL_COMPRESSED_RGBA_FXT1_3DFX */
- 1008, /* GL_MULTISAMPLE_3DFX */
- 1413, /* GL_SAMPLE_BUFFERS_3DFX */
- 1404, /* GL_SAMPLES_3DFX */
- 989, /* GL_MODELVIEW2_ARB */
- 992, /* GL_MODELVIEW3_ARB */
- 993, /* GL_MODELVIEW4_ARB */
- 994, /* GL_MODELVIEW5_ARB */
- 995, /* GL_MODELVIEW6_ARB */
- 996, /* GL_MODELVIEW7_ARB */
- 997, /* GL_MODELVIEW8_ARB */
- 998, /* GL_MODELVIEW9_ARB */
- 968, /* GL_MODELVIEW10_ARB */
- 969, /* GL_MODELVIEW11_ARB */
- 970, /* GL_MODELVIEW12_ARB */
- 971, /* GL_MODELVIEW13_ARB */
- 972, /* GL_MODELVIEW14_ARB */
- 973, /* GL_MODELVIEW15_ARB */
- 974, /* GL_MODELVIEW16_ARB */
- 975, /* GL_MODELVIEW17_ARB */
- 976, /* GL_MODELVIEW18_ARB */
- 977, /* GL_MODELVIEW19_ARB */
- 979, /* GL_MODELVIEW20_ARB */
- 980, /* GL_MODELVIEW21_ARB */
- 981, /* GL_MODELVIEW22_ARB */
- 982, /* GL_MODELVIEW23_ARB */
- 983, /* GL_MODELVIEW24_ARB */
- 984, /* GL_MODELVIEW25_ARB */
- 985, /* GL_MODELVIEW26_ARB */
- 986, /* GL_MODELVIEW27_ARB */
- 987, /* GL_MODELVIEW28_ARB */
- 988, /* GL_MODELVIEW29_ARB */
- 990, /* GL_MODELVIEW30_ARB */
- 991, /* GL_MODELVIEW31_ARB */
+ 1012, /* GL_MULTISAMPLE_3DFX */
+ 1419, /* GL_SAMPLE_BUFFERS_3DFX */
+ 1410, /* GL_SAMPLES_3DFX */
+ 993, /* GL_MODELVIEW2_ARB */
+ 996, /* GL_MODELVIEW3_ARB */
+ 997, /* GL_MODELVIEW4_ARB */
+ 998, /* GL_MODELVIEW5_ARB */
+ 999, /* GL_MODELVIEW6_ARB */
+ 1000, /* GL_MODELVIEW7_ARB */
+ 1001, /* GL_MODELVIEW8_ARB */
+ 1002, /* GL_MODELVIEW9_ARB */
+ 972, /* GL_MODELVIEW10_ARB */
+ 973, /* GL_MODELVIEW11_ARB */
+ 974, /* GL_MODELVIEW12_ARB */
+ 975, /* GL_MODELVIEW13_ARB */
+ 976, /* GL_MODELVIEW14_ARB */
+ 977, /* GL_MODELVIEW15_ARB */
+ 978, /* GL_MODELVIEW16_ARB */
+ 979, /* GL_MODELVIEW17_ARB */
+ 980, /* GL_MODELVIEW18_ARB */
+ 981, /* GL_MODELVIEW19_ARB */
+ 983, /* GL_MODELVIEW20_ARB */
+ 984, /* GL_MODELVIEW21_ARB */
+ 985, /* GL_MODELVIEW22_ARB */
+ 986, /* GL_MODELVIEW23_ARB */
+ 987, /* GL_MODELVIEW24_ARB */
+ 988, /* GL_MODELVIEW25_ARB */
+ 989, /* GL_MODELVIEW26_ARB */
+ 990, /* GL_MODELVIEW27_ARB */
+ 991, /* GL_MODELVIEW28_ARB */
+ 992, /* GL_MODELVIEW29_ARB */
+ 994, /* GL_MODELVIEW30_ARB */
+ 995, /* GL_MODELVIEW31_ARB */
392, /* GL_DOT3_RGB_EXT */
390, /* GL_DOT3_RGBA_EXT */
- 962, /* GL_MIRROR_CLAMP_EXT */
- 965, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */
- 1003, /* GL_MODULATE_ADD_ATI */
- 1004, /* GL_MODULATE_SIGNED_ADD_ATI */
- 1005, /* GL_MODULATE_SUBTRACT_ATI */
- 1887, /* GL_YCBCR_MESA */
- 1095, /* GL_PACK_INVERT_MESA */
+ 966, /* GL_MIRROR_CLAMP_EXT */
+ 969, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */
+ 1007, /* GL_MODULATE_ADD_ATI */
+ 1008, /* GL_MODULATE_SIGNED_ADD_ATI */
+ 1009, /* GL_MODULATE_SUBTRACT_ATI */
+ 1902, /* GL_YCBCR_MESA */
+ 1099, /* GL_PACK_INVERT_MESA */
340, /* GL_DEBUG_OBJECT_MESA */
341, /* GL_DEBUG_PRINT_MESA */
339, /* GL_DEBUG_ASSERT_MESA */
@@ -4826,24 +4856,24 @@ static const unsigned reduced_enums[1357] =
451, /* GL_DU8DV8_ATI */
115, /* GL_BUMP_ENVMAP_ATI */
119, /* GL_BUMP_TARGET_ATI */
- 1512, /* GL_STENCIL_BACK_FUNC */
- 1510, /* GL_STENCIL_BACK_FAIL */
- 1514, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */
- 1516, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */
+ 1519, /* GL_STENCIL_BACK_FUNC */
+ 1517, /* GL_STENCIL_BACK_FAIL */
+ 1521, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */
+ 1523, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */
537, /* GL_FRAGMENT_PROGRAM_ARB */
- 1233, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */
- 1261, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */
- 1260, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */
- 1245, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
- 1251, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
- 1250, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
- 894, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */
- 917, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */
- 916, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */
- 907, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
- 913, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
- 912, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
- 877, /* GL_MAX_DRAW_BUFFERS */
+ 1238, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */
+ 1266, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */
+ 1265, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */
+ 1250, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
+ 1256, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
+ 1255, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
+ 895, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */
+ 918, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */
+ 917, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */
+ 908, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
+ 914, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
+ 913, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
+ 878, /* GL_MAX_DRAW_BUFFERS */
396, /* GL_DRAW_BUFFER0 */
399, /* GL_DRAW_BUFFER1 */
420, /* GL_DRAW_BUFFER2 */
@@ -4861,166 +4891,166 @@ static const unsigned reduced_enums[1357] =
412, /* GL_DRAW_BUFFER14 */
415, /* GL_DRAW_BUFFER15 */
82, /* GL_BLEND_EQUATION_ALPHA */
- 856, /* GL_MATRIX_PALETTE_ARB */
- 888, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */
- 891, /* GL_MAX_PALETTE_MATRICES_ARB */
+ 857, /* GL_MATRIX_PALETTE_ARB */
+ 889, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */
+ 892, /* GL_MAX_PALETTE_MATRICES_ARB */
322, /* GL_CURRENT_PALETTE_MATRIX_ARB */
- 850, /* GL_MATRIX_INDEX_ARRAY_ARB */
+ 851, /* GL_MATRIX_INDEX_ARRAY_ARB */
317, /* GL_CURRENT_MATRIX_INDEX_ARB */
- 852, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */
- 854, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */
- 853, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */
- 851, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */
- 1704, /* GL_TEXTURE_DEPTH_SIZE */
+ 853, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */
+ 855, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */
+ 854, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */
+ 852, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */
+ 1711, /* GL_TEXTURE_DEPTH_SIZE */
380, /* GL_DEPTH_TEXTURE_MODE */
- 1669, /* GL_TEXTURE_COMPARE_MODE */
- 1667, /* GL_TEXTURE_COMPARE_FUNC */
+ 1676, /* GL_TEXTURE_COMPARE_MODE */
+ 1674, /* GL_TEXTURE_COMPARE_FUNC */
243, /* GL_COMPARE_R_TO_TEXTURE */
- 1167, /* GL_POINT_SPRITE */
+ 1171, /* GL_POINT_SPRITE */
297, /* GL_COORD_REPLACE */
- 1171, /* GL_POINT_SPRITE_R_MODE_NV */
- 1295, /* GL_QUERY_COUNTER_BITS */
+ 1175, /* GL_POINT_SPRITE_R_MODE_NV */
+ 1300, /* GL_QUERY_COUNTER_BITS */
324, /* GL_CURRENT_QUERY */
- 1298, /* GL_QUERY_RESULT */
- 1300, /* GL_QUERY_RESULT_AVAILABLE */
- 942, /* GL_MAX_VERTEX_ATTRIBS */
- 1847, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */
+ 1303, /* GL_QUERY_RESULT */
+ 1305, /* GL_QUERY_RESULT_AVAILABLE */
+ 946, /* GL_MAX_VERTEX_ATTRIBS */
+ 1862, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */
378, /* GL_DEPTH_STENCIL_TO_RGBA_NV */
377, /* GL_DEPTH_STENCIL_TO_BGRA_NV */
- 928, /* GL_MAX_TEXTURE_COORDS */
- 930, /* GL_MAX_TEXTURE_IMAGE_UNITS */
- 1238, /* GL_PROGRAM_ERROR_STRING_ARB */
- 1240, /* GL_PROGRAM_FORMAT_ASCII_ARB */
- 1239, /* GL_PROGRAM_FORMAT_ARB */
- 1754, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */
+ 929, /* GL_MAX_TEXTURE_COORDS */
+ 931, /* GL_MAX_TEXTURE_IMAGE_UNITS */
+ 1243, /* GL_PROGRAM_ERROR_STRING_ARB */
+ 1245, /* GL_PROGRAM_FORMAT_ASCII_ARB */
+ 1244, /* GL_PROGRAM_FORMAT_ARB */
+ 1761, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */
355, /* GL_DEPTH_BOUNDS_TEST_EXT */
354, /* GL_DEPTH_BOUNDS_EXT */
53, /* GL_ARRAY_BUFFER */
465, /* GL_ELEMENT_ARRAY_BUFFER */
54, /* GL_ARRAY_BUFFER_BINDING */
466, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */
- 1821, /* GL_VERTEX_ARRAY_BUFFER_BINDING */
- 1029, /* GL_NORMAL_ARRAY_BUFFER_BINDING */
+ 1836, /* GL_VERTEX_ARRAY_BUFFER_BINDING */
+ 1033, /* GL_NORMAL_ARRAY_BUFFER_BINDING */
150, /* GL_COLOR_ARRAY_BUFFER_BINDING */
634, /* GL_INDEX_ARRAY_BUFFER_BINDING */
- 1682, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */
+ 1689, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */
461, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */
- 1425, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */
+ 1431, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */
515, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */
- 1875, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */
- 1843, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */
- 1241, /* GL_PROGRAM_INSTRUCTIONS_ARB */
- 900, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */
- 1247, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
- 909, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
- 1259, /* GL_PROGRAM_TEMPORARIES_ARB */
- 915, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */
- 1249, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */
- 911, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */
- 1253, /* GL_PROGRAM_PARAMETERS_ARB */
- 914, /* GL_MAX_PROGRAM_PARAMETERS_ARB */
- 1248, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */
- 910, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */
- 1234, /* GL_PROGRAM_ATTRIBS_ARB */
- 895, /* GL_MAX_PROGRAM_ATTRIBS_ARB */
- 1246, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */
- 908, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */
- 1232, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */
- 893, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */
- 1244, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
- 906, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
- 901, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */
- 897, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */
- 1262, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */
- 1766, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */
- 1311, /* GL_READ_ONLY */
- 1883, /* GL_WRITE_ONLY */
- 1313, /* GL_READ_WRITE */
+ 1890, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */
+ 1858, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */
+ 1246, /* GL_PROGRAM_INSTRUCTIONS_ARB */
+ 901, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */
+ 1252, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
+ 910, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
+ 1264, /* GL_PROGRAM_TEMPORARIES_ARB */
+ 916, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */
+ 1254, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */
+ 912, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */
+ 1258, /* GL_PROGRAM_PARAMETERS_ARB */
+ 915, /* GL_MAX_PROGRAM_PARAMETERS_ARB */
+ 1253, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */
+ 911, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */
+ 1239, /* GL_PROGRAM_ATTRIBS_ARB */
+ 896, /* GL_MAX_PROGRAM_ATTRIBS_ARB */
+ 1251, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */
+ 909, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */
+ 1237, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */
+ 894, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */
+ 1249, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
+ 907, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
+ 902, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */
+ 898, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */
+ 1267, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */
+ 1781, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */
+ 1317, /* GL_READ_ONLY */
+ 1898, /* GL_WRITE_ONLY */
+ 1319, /* GL_READ_WRITE */
102, /* GL_BUFFER_ACCESS */
105, /* GL_BUFFER_MAPPED */
107, /* GL_BUFFER_MAP_POINTER */
- 1760, /* GL_TIME_ELAPSED_EXT */
- 810, /* GL_MATRIX0_ARB */
- 822, /* GL_MATRIX1_ARB */
- 834, /* GL_MATRIX2_ARB */
- 838, /* GL_MATRIX3_ARB */
- 840, /* GL_MATRIX4_ARB */
- 842, /* GL_MATRIX5_ARB */
- 844, /* GL_MATRIX6_ARB */
- 846, /* GL_MATRIX7_ARB */
- 848, /* GL_MATRIX8_ARB */
- 849, /* GL_MATRIX9_ARB */
- 812, /* GL_MATRIX10_ARB */
- 813, /* GL_MATRIX11_ARB */
- 814, /* GL_MATRIX12_ARB */
- 815, /* GL_MATRIX13_ARB */
- 816, /* GL_MATRIX14_ARB */
- 817, /* GL_MATRIX15_ARB */
- 818, /* GL_MATRIX16_ARB */
- 819, /* GL_MATRIX17_ARB */
- 820, /* GL_MATRIX18_ARB */
- 821, /* GL_MATRIX19_ARB */
- 824, /* GL_MATRIX20_ARB */
- 825, /* GL_MATRIX21_ARB */
- 826, /* GL_MATRIX22_ARB */
- 827, /* GL_MATRIX23_ARB */
- 828, /* GL_MATRIX24_ARB */
- 829, /* GL_MATRIX25_ARB */
- 830, /* GL_MATRIX26_ARB */
- 831, /* GL_MATRIX27_ARB */
- 832, /* GL_MATRIX28_ARB */
- 833, /* GL_MATRIX29_ARB */
- 836, /* GL_MATRIX30_ARB */
- 837, /* GL_MATRIX31_ARB */
- 1549, /* GL_STREAM_DRAW */
- 1551, /* GL_STREAM_READ */
- 1547, /* GL_STREAM_COPY */
- 1503, /* GL_STATIC_DRAW */
- 1505, /* GL_STATIC_READ */
- 1501, /* GL_STATIC_COPY */
+ 1767, /* GL_TIME_ELAPSED_EXT */
+ 811, /* GL_MATRIX0_ARB */
+ 823, /* GL_MATRIX1_ARB */
+ 835, /* GL_MATRIX2_ARB */
+ 839, /* GL_MATRIX3_ARB */
+ 841, /* GL_MATRIX4_ARB */
+ 843, /* GL_MATRIX5_ARB */
+ 845, /* GL_MATRIX6_ARB */
+ 847, /* GL_MATRIX7_ARB */
+ 849, /* GL_MATRIX8_ARB */
+ 850, /* GL_MATRIX9_ARB */
+ 813, /* GL_MATRIX10_ARB */
+ 814, /* GL_MATRIX11_ARB */
+ 815, /* GL_MATRIX12_ARB */
+ 816, /* GL_MATRIX13_ARB */
+ 817, /* GL_MATRIX14_ARB */
+ 818, /* GL_MATRIX15_ARB */
+ 819, /* GL_MATRIX16_ARB */
+ 820, /* GL_MATRIX17_ARB */
+ 821, /* GL_MATRIX18_ARB */
+ 822, /* GL_MATRIX19_ARB */
+ 825, /* GL_MATRIX20_ARB */
+ 826, /* GL_MATRIX21_ARB */
+ 827, /* GL_MATRIX22_ARB */
+ 828, /* GL_MATRIX23_ARB */
+ 829, /* GL_MATRIX24_ARB */
+ 830, /* GL_MATRIX25_ARB */
+ 831, /* GL_MATRIX26_ARB */
+ 832, /* GL_MATRIX27_ARB */
+ 833, /* GL_MATRIX28_ARB */
+ 834, /* GL_MATRIX29_ARB */
+ 837, /* GL_MATRIX30_ARB */
+ 838, /* GL_MATRIX31_ARB */
+ 1556, /* GL_STREAM_DRAW */
+ 1558, /* GL_STREAM_READ */
+ 1554, /* GL_STREAM_COPY */
+ 1510, /* GL_STATIC_DRAW */
+ 1512, /* GL_STATIC_READ */
+ 1508, /* GL_STATIC_COPY */
455, /* GL_DYNAMIC_DRAW */
457, /* GL_DYNAMIC_READ */
453, /* GL_DYNAMIC_COPY */
- 1135, /* GL_PIXEL_PACK_BUFFER */
- 1139, /* GL_PIXEL_UNPACK_BUFFER */
- 1136, /* GL_PIXEL_PACK_BUFFER_BINDING */
- 1140, /* GL_PIXEL_UNPACK_BUFFER_BINDING */
+ 1139, /* GL_PIXEL_PACK_BUFFER */
+ 1143, /* GL_PIXEL_UNPACK_BUFFER */
+ 1140, /* GL_PIXEL_PACK_BUFFER_BINDING */
+ 1144, /* GL_PIXEL_UNPACK_BUFFER_BINDING */
348, /* GL_DEPTH24_STENCIL8 */
- 1750, /* GL_TEXTURE_STENCIL_SIZE */
- 1702, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */
- 896, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */
- 899, /* GL_MAX_PROGRAM_IF_DEPTH_NV */
- 903, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */
- 902, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */
- 859, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */
- 1540, /* GL_STENCIL_TEST_TWO_SIDE_EXT */
+ 1757, /* GL_TEXTURE_STENCIL_SIZE */
+ 1709, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */
+ 897, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */
+ 900, /* GL_MAX_PROGRAM_IF_DEPTH_NV */
+ 904, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */
+ 903, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */
+ 860, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */
+ 1547, /* GL_STENCIL_TEST_TWO_SIDE_EXT */
17, /* GL_ACTIVE_STENCIL_FACE_EXT */
- 963, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */
- 1406, /* GL_SAMPLES_PASSED */
+ 967, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */
+ 1412, /* GL_SAMPLES_PASSED */
110, /* GL_BUFFER_SERIALIZED_MODIFY_APPLE */
104, /* GL_BUFFER_FLUSHING_UNMAP_APPLE */
- 1324, /* GL_RELEASED_APPLE */
- 1872, /* GL_VOLATILE_APPLE */
- 1352, /* GL_RETAINED_APPLE */
- 1779, /* GL_UNDEFINED_APPLE */
- 1285, /* GL_PURGEABLE_APPLE */
+ 1330, /* GL_RELEASED_APPLE */
+ 1887, /* GL_VOLATILE_APPLE */
+ 1358, /* GL_RETAINED_APPLE */
+ 1794, /* GL_UNDEFINED_APPLE */
+ 1290, /* GL_PURGEABLE_APPLE */
538, /* GL_FRAGMENT_SHADER */
- 1867, /* GL_VERTEX_SHADER */
- 1252, /* GL_PROGRAM_OBJECT_ARB */
- 1438, /* GL_SHADER_OBJECT_ARB */
- 884, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */
- 946, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */
- 940, /* GL_MAX_VARYING_FLOATS */
- 944, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */
- 869, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */
- 1055, /* GL_OBJECT_TYPE_ARB */
- 1440, /* GL_SHADER_TYPE */
+ 1882, /* GL_VERTEX_SHADER */
+ 1257, /* GL_PROGRAM_OBJECT_ARB */
+ 1445, /* GL_SHADER_OBJECT_ARB */
+ 885, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */
+ 950, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */
+ 944, /* GL_MAX_VARYING_FLOATS */
+ 948, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */
+ 870, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */
+ 1059, /* GL_OBJECT_TYPE_ARB */
+ 1447, /* GL_SHADER_TYPE */
503, /* GL_FLOAT_VEC2 */
505, /* GL_FLOAT_VEC3 */
507, /* GL_FLOAT_VEC4 */
- 661, /* GL_INT_VEC2 */
- 663, /* GL_INT_VEC3 */
- 665, /* GL_INT_VEC4 */
+ 662, /* GL_INT_VEC2 */
+ 664, /* GL_INT_VEC3 */
+ 666, /* GL_INT_VEC4 */
94, /* GL_BOOL */
96, /* GL_BOOL_VEC2 */
98, /* GL_BOOL_VEC3 */
@@ -5028,12 +5058,12 @@ static const unsigned reduced_enums[1357] =
491, /* GL_FLOAT_MAT2 */
495, /* GL_FLOAT_MAT3 */
499, /* GL_FLOAT_MAT4 */
- 1397, /* GL_SAMPLER_1D */
- 1399, /* GL_SAMPLER_2D */
- 1401, /* GL_SAMPLER_3D */
- 1402, /* GL_SAMPLER_CUBE */
- 1398, /* GL_SAMPLER_1D_SHADOW */
- 1400, /* GL_SAMPLER_2D_SHADOW */
+ 1403, /* GL_SAMPLER_1D */
+ 1405, /* GL_SAMPLER_2D */
+ 1407, /* GL_SAMPLER_3D */
+ 1408, /* GL_SAMPLER_CUBE */
+ 1404, /* GL_SAMPLER_1D_SHADOW */
+ 1406, /* GL_SAMPLER_2D_SHADOW */
493, /* GL_FLOAT_MAT2x3 */
494, /* GL_FLOAT_MAT2x4 */
497, /* GL_FLOAT_MAT3x2 */
@@ -5042,61 +5072,76 @@ static const unsigned reduced_enums[1357] =
502, /* GL_FLOAT_MAT4x3 */
346, /* GL_DELETE_STATUS */
247, /* GL_COMPILE_STATUS */
- 717, /* GL_LINK_STATUS */
- 1815, /* GL_VALIDATE_STATUS */
+ 718, /* GL_LINK_STATUS */
+ 1830, /* GL_VALIDATE_STATUS */
646, /* GL_INFO_LOG_LENGTH */
56, /* GL_ATTACHED_SHADERS */
20, /* GL_ACTIVE_UNIFORMS */
21, /* GL_ACTIVE_UNIFORM_MAX_LENGTH */
- 1439, /* GL_SHADER_SOURCE_LENGTH */
+ 1446, /* GL_SHADER_SOURCE_LENGTH */
15, /* GL_ACTIVE_ATTRIBUTES */
16, /* GL_ACTIVE_ATTRIBUTE_MAX_LENGTH */
540, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */
- 1442, /* GL_SHADING_LANGUAGE_VERSION */
+ 1449, /* GL_SHADING_LANGUAGE_VERSION */
323, /* GL_CURRENT_PROGRAM */
- 1104, /* GL_PALETTE4_RGB8_OES */
- 1106, /* GL_PALETTE4_RGBA8_OES */
- 1102, /* GL_PALETTE4_R5_G6_B5_OES */
- 1105, /* GL_PALETTE4_RGBA4_OES */
- 1103, /* GL_PALETTE4_RGB5_A1_OES */
- 1109, /* GL_PALETTE8_RGB8_OES */
- 1111, /* GL_PALETTE8_RGBA8_OES */
- 1107, /* GL_PALETTE8_R5_G6_B5_OES */
- 1110, /* GL_PALETTE8_RGBA4_OES */
- 1108, /* GL_PALETTE8_RGB5_A1_OES */
+ 1108, /* GL_PALETTE4_RGB8_OES */
+ 1110, /* GL_PALETTE4_RGBA8_OES */
+ 1106, /* GL_PALETTE4_R5_G6_B5_OES */
+ 1109, /* GL_PALETTE4_RGBA4_OES */
+ 1107, /* GL_PALETTE4_RGB5_A1_OES */
+ 1113, /* GL_PALETTE8_RGB8_OES */
+ 1115, /* GL_PALETTE8_RGBA8_OES */
+ 1111, /* GL_PALETTE8_R5_G6_B5_OES */
+ 1114, /* GL_PALETTE8_RGBA4_OES */
+ 1112, /* GL_PALETTE8_RGB5_A1_OES */
628, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */
627, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */
- 1800, /* GL_UNSIGNED_NORMALIZED */
- 1637, /* GL_TEXTURE_1D_ARRAY_EXT */
- 1274, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */
- 1639, /* GL_TEXTURE_2D_ARRAY_EXT */
- 1277, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */
- 1645, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */
- 1647, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */
- 1495, /* GL_SRGB */
- 1496, /* GL_SRGB8 */
- 1498, /* GL_SRGB_ALPHA */
- 1497, /* GL_SRGB8_ALPHA8 */
- 1455, /* GL_SLUMINANCE_ALPHA */
- 1454, /* GL_SLUMINANCE8_ALPHA8 */
- 1452, /* GL_SLUMINANCE */
- 1453, /* GL_SLUMINANCE8 */
+ 1815, /* GL_UNSIGNED_NORMALIZED */
+ 1644, /* GL_TEXTURE_1D_ARRAY_EXT */
+ 1279, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */
+ 1646, /* GL_TEXTURE_2D_ARRAY_EXT */
+ 1282, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */
+ 1652, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */
+ 1654, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */
+ 1502, /* GL_SRGB */
+ 1503, /* GL_SRGB8 */
+ 1505, /* GL_SRGB_ALPHA */
+ 1504, /* GL_SRGB8_ALPHA8 */
+ 1462, /* GL_SLUMINANCE_ALPHA */
+ 1461, /* GL_SLUMINANCE8_ALPHA8 */
+ 1459, /* GL_SLUMINANCE */
+ 1460, /* GL_SLUMINANCE8 */
268, /* GL_COMPRESSED_SRGB */
269, /* GL_COMPRESSED_SRGB_ALPHA */
266, /* GL_COMPRESSED_SLUMINANCE */
267, /* GL_COMPRESSED_SLUMINANCE_ALPHA */
- 1169, /* GL_POINT_SPRITE_COORD_ORIGIN */
- 725, /* GL_LOWER_LEFT */
- 1812, /* GL_UPPER_LEFT */
- 1518, /* GL_STENCIL_BACK_REF */
- 1519, /* GL_STENCIL_BACK_VALUE_MASK */
- 1520, /* GL_STENCIL_BACK_WRITEMASK */
+ 1778, /* GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT */
+ 1773, /* GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT */
+ 943, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT */
+ 1777, /* GL_TRANSFORM_FEEDBACK_VARYINGS_EXT */
+ 1775, /* GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT */
+ 1774, /* GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT */
+ 1236, /* GL_PRIMITIVES_GENERATED_EXT */
+ 1776, /* GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT */
+ 1310, /* GL_RASTERIZER_DISCARD_EXT */
+ 941, /* GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT */
+ 942, /* GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT */
+ 658, /* GL_INTERLEAVED_ATTRIBS_EXT */
+ 1441, /* GL_SEPARATE_ATTRIBS_EXT */
+ 1772, /* GL_TRANSFORM_FEEDBACK_BUFFER_EXT */
+ 1771, /* GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT */
+ 1173, /* GL_POINT_SPRITE_COORD_ORIGIN */
+ 726, /* GL_LOWER_LEFT */
+ 1827, /* GL_UPPER_LEFT */
+ 1525, /* GL_STENCIL_BACK_REF */
+ 1526, /* GL_STENCIL_BACK_VALUE_MASK */
+ 1527, /* GL_STENCIL_BACK_WRITEMASK */
445, /* GL_DRAW_FRAMEBUFFER_BINDING */
- 1328, /* GL_RENDERBUFFER_BINDING */
- 1307, /* GL_READ_FRAMEBUFFER */
+ 1334, /* GL_RENDERBUFFER_BINDING */
+ 1313, /* GL_READ_FRAMEBUFFER */
444, /* GL_DRAW_FRAMEBUFFER */
- 1308, /* GL_READ_FRAMEBUFFER_BINDING */
- 1339, /* GL_RENDERBUFFER_SAMPLES */
+ 1314, /* GL_READ_FRAMEBUFFER_BINDING */
+ 1345, /* GL_RENDERBUFFER_SAMPLES */
550, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */
548, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */
559, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */
@@ -5112,7 +5157,7 @@ static const unsigned reduced_enums[1357] =
578, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER */
582, /* GL_FRAMEBUFFER_UNSUPPORTED */
580, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */
- 865, /* GL_MAX_COLOR_ATTACHMENTS */
+ 866, /* GL_MAX_COLOR_ATTACHMENTS */
156, /* GL_COLOR_ATTACHMENT0 */
158, /* GL_COLOR_ATTACHMENT1 */
172, /* GL_COLOR_ATTACHMENT2 */
@@ -5130,58 +5175,58 @@ static const unsigned reduced_enums[1357] =
167, /* GL_COLOR_ATTACHMENT14 */
169, /* GL_COLOR_ATTACHMENT15 */
350, /* GL_DEPTH_ATTACHMENT */
- 1508, /* GL_STENCIL_ATTACHMENT */
+ 1515, /* GL_STENCIL_ATTACHMENT */
541, /* GL_FRAMEBUFFER */
- 1326, /* GL_RENDERBUFFER */
- 1342, /* GL_RENDERBUFFER_WIDTH */
- 1334, /* GL_RENDERBUFFER_HEIGHT */
- 1336, /* GL_RENDERBUFFER_INTERNAL_FORMAT */
- 1535, /* GL_STENCIL_INDEX_EXT */
- 1527, /* GL_STENCIL_INDEX1 */
- 1531, /* GL_STENCIL_INDEX4 */
- 1533, /* GL_STENCIL_INDEX8 */
- 1528, /* GL_STENCIL_INDEX16 */
- 1338, /* GL_RENDERBUFFER_RED_SIZE */
- 1333, /* GL_RENDERBUFFER_GREEN_SIZE */
- 1330, /* GL_RENDERBUFFER_BLUE_SIZE */
- 1327, /* GL_RENDERBUFFER_ALPHA_SIZE */
- 1331, /* GL_RENDERBUFFER_DEPTH_SIZE */
- 1341, /* GL_RENDERBUFFER_STENCIL_SIZE */
+ 1332, /* GL_RENDERBUFFER */
+ 1348, /* GL_RENDERBUFFER_WIDTH */
+ 1340, /* GL_RENDERBUFFER_HEIGHT */
+ 1342, /* GL_RENDERBUFFER_INTERNAL_FORMAT */
+ 1542, /* GL_STENCIL_INDEX_EXT */
+ 1534, /* GL_STENCIL_INDEX1 */
+ 1538, /* GL_STENCIL_INDEX4 */
+ 1540, /* GL_STENCIL_INDEX8 */
+ 1535, /* GL_STENCIL_INDEX16 */
+ 1344, /* GL_RENDERBUFFER_RED_SIZE */
+ 1339, /* GL_RENDERBUFFER_GREEN_SIZE */
+ 1336, /* GL_RENDERBUFFER_BLUE_SIZE */
+ 1333, /* GL_RENDERBUFFER_ALPHA_SIZE */
+ 1337, /* GL_RENDERBUFFER_DEPTH_SIZE */
+ 1347, /* GL_RENDERBUFFER_STENCIL_SIZE */
576, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */
- 923, /* GL_MAX_SAMPLES */
- 1302, /* GL_QUERY_WAIT_NV */
- 1297, /* GL_QUERY_NO_WAIT_NV */
- 1294, /* GL_QUERY_BY_REGION_WAIT_NV */
- 1293, /* GL_QUERY_BY_REGION_NO_WAIT_NV */
- 1289, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */
+ 924, /* GL_MAX_SAMPLES */
+ 1307, /* GL_QUERY_WAIT_NV */
+ 1302, /* GL_QUERY_NO_WAIT_NV */
+ 1299, /* GL_QUERY_BY_REGION_WAIT_NV */
+ 1298, /* GL_QUERY_BY_REGION_NO_WAIT_NV */
+ 1294, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */
487, /* GL_FIRST_VERTEX_CONVENTION */
- 676, /* GL_LAST_VERTEX_CONVENTION */
- 1266, /* GL_PROVOKING_VERTEX */
+ 677, /* GL_LAST_VERTEX_CONVENTION */
+ 1271, /* GL_PROVOKING_VERTEX */
303, /* GL_COPY_READ_BUFFER */
304, /* GL_COPY_WRITE_BUFFER */
- 1390, /* GL_RGBA_SNORM */
- 1386, /* GL_RGBA8_SNORM */
- 1448, /* GL_SIGNED_NORMALIZED */
- 925, /* GL_MAX_SERVER_WAIT_TIMEOUT */
- 1054, /* GL_OBJECT_TYPE */
- 1556, /* GL_SYNC_CONDITION */
- 1561, /* GL_SYNC_STATUS */
- 1558, /* GL_SYNC_FLAGS */
- 1557, /* GL_SYNC_FENCE */
- 1560, /* GL_SYNC_GPU_COMMANDS_COMPLETE */
- 1788, /* GL_UNSIGNALED */
- 1447, /* GL_SIGNALED */
+ 1396, /* GL_RGBA_SNORM */
+ 1392, /* GL_RGBA8_SNORM */
+ 1455, /* GL_SIGNED_NORMALIZED */
+ 926, /* GL_MAX_SERVER_WAIT_TIMEOUT */
+ 1058, /* GL_OBJECT_TYPE */
+ 1563, /* GL_SYNC_CONDITION */
+ 1568, /* GL_SYNC_STATUS */
+ 1565, /* GL_SYNC_FLAGS */
+ 1564, /* GL_SYNC_FENCE */
+ 1567, /* GL_SYNC_GPU_COMMANDS_COMPLETE */
+ 1803, /* GL_UNSIGNALED */
+ 1454, /* GL_SIGNALED */
46, /* GL_ALREADY_SIGNALED */
- 1759, /* GL_TIMEOUT_EXPIRED */
+ 1766, /* GL_TIMEOUT_EXPIRED */
271, /* GL_CONDITION_SATISFIED */
- 1873, /* GL_WAIT_FAILED */
+ 1888, /* GL_WAIT_FAILED */
472, /* GL_EVAL_BIT */
- 1305, /* GL_RASTER_POSITION_UNCLIPPED_IBM */
- 719, /* GL_LIST_BIT */
- 1653, /* GL_TEXTURE_BIT */
- 1421, /* GL_SCISSOR_BIT */
+ 1311, /* GL_RASTER_POSITION_UNCLIPPED_IBM */
+ 720, /* GL_LIST_BIT */
+ 1660, /* GL_TEXTURE_BIT */
+ 1427, /* GL_SCISSOR_BIT */
29, /* GL_ALL_ATTRIB_BITS */
- 1010, /* GL_MULTISAMPLE_BIT */
+ 1014, /* GL_MULTISAMPLE_BIT */
30, /* GL_ALL_CLIENT_ATTRIB_BITS */
};
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 30245d6aaf..f7b0e5abf5 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -146,6 +146,7 @@ static const struct {
{ OFF, "GL_EXT_texture_sRGB", F(EXT_texture_sRGB) },
{ OFF, "GL_EXT_texture_swizzle", F(EXT_texture_swizzle) },
{ OFF, "GL_EXT_timer_query", F(EXT_timer_query) },
+ { OFF, "GL_EXT_transform_feedback", F(EXT_transform_feedback) },
{ ON, "GL_EXT_vertex_array", F(EXT_vertex_array) },
{ OFF, "GL_EXT_vertex_array_bgra", F(EXT_vertex_array_bgra) },
{ OFF, "GL_EXT_vertex_array_set", F(EXT_vertex_array_set) },
@@ -319,6 +320,9 @@ _mesa_enable_sw_extensions(GLcontext *ctx)
ctx->Extensions.EXT_texture_sRGB = GL_TRUE;
#endif
ctx->Extensions.EXT_texture_swizzle = GL_TRUE;
+#if FEATURE_EXT_transform_feedback
+ ctx->Extensions.EXT_transform_feedback = GL_TRUE;
+#endif
ctx->Extensions.EXT_vertex_array_bgra = GL_TRUE;
/*ctx->Extensions.IBM_multimode_draw_arrays = GL_TRUE;*/
ctx->Extensions.MESA_pack_invert = GL_TRUE;
@@ -480,7 +484,7 @@ _mesa_enable_2_1_extensions(GLcontext *ctx)
#if FEATURE_EXT_texture_sRGB
ctx->Extensions.EXT_texture_sRGB = GL_TRUE;
#endif
-#ifdef FEATURE_ARB_shading_language_120
+#if FEATURE_ARB_shading_language_120
ctx->Extensions.ARB_shading_language_120 = GL_TRUE;
#endif
}
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 14c533e0d4..e3e006bb94 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -180,8 +180,12 @@ _mesa_get_attachment(GLcontext *ctx, struct gl_framebuffer *fb,
return &fb->Attachment[BUFFER_COLOR0 + i];
case GL_DEPTH_STENCIL_ATTACHMENT:
/* fall-through */
+ case GL_DEPTH_BUFFER:
+ /* fall-through / new in GL 3.0 */
case GL_DEPTH_ATTACHMENT_EXT:
return &fb->Attachment[BUFFER_DEPTH];
+ case GL_STENCIL_BUFFER:
+ /* fall-through / new in GL 3.0 */
case GL_STENCIL_ATTACHMENT_EXT:
return &fb->Attachment[BUFFER_STENCIL];
default:
@@ -625,7 +629,7 @@ _mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb)
}
}
-#ifndef FEATURE_OES_framebuffer_object
+#if !FEATURE_OES_framebuffer_object
/* Check that all DrawBuffers are present */
for (j = 0; j < ctx->Const.MaxDrawBuffers; j++) {
if (fb->ColorDrawBuffer[j] != GL_NONE) {
@@ -1549,6 +1553,7 @@ framebuffer_texture(GLcontext *ctx, const char *caller, GLenum target,
texObj = _mesa_lookup_texture(ctx, texture);
if (texObj != NULL) {
if (textarget == 0) {
+ /* XXX what's the purpose of this? */
err = (texObj->Target != GL_TEXTURE_3D) &&
(texObj->Target != GL_TEXTURE_1D_ARRAY_EXT) &&
(texObj->Target != GL_TEXTURE_2D_ARRAY_EXT);
@@ -1559,6 +1564,13 @@ framebuffer_texture(GLcontext *ctx, const char *caller, GLenum target,
: (texObj->Target != textarget);
}
}
+ else {
+ /* can't render to a non-existant texture */
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glFramebufferTexture%sEXT(non existant texture)",
+ caller);
+ return;
+ }
if (err) {
_mesa_error(ctx, GL_INVALID_OPERATION,
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index 6a85162d5d..5a654e5c2a 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -986,6 +986,10 @@ _mesa_dest_buffer_exists(GLcontext *ctx, GLenum format)
return GL_TRUE;
}
+
+/**
+ * Used to answer the GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES query.
+ */
GLenum
_mesa_get_color_read_format(GLcontext *ctx)
{
@@ -999,6 +1003,10 @@ _mesa_get_color_read_format(GLcontext *ctx)
}
}
+
+/**
+ * Used to answer the GL_IMPLEMENTATION_COLOR_READ_TYPE_OES query.
+ */
GLenum
_mesa_get_color_read_type(GLcontext *ctx)
{
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index edc4400912..eaa6d7f730 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -77,9 +77,6 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
if (!params)
return;
- if (ctx->NewState)
- _mesa_update_state(ctx);
-
if (ctx->Driver.GetBooleanv &&
ctx->Driver.GetBooleanv(ctx, pname, params))
return;
@@ -107,6 +104,8 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.AlphaBias);
break;
case GL_ALPHA_BITS:
+ if (ctx->NewState & _NEW_BUFFERS)
+ _mesa_update_state(ctx);
params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.alphaBits);
break;
case GL_ALPHA_SCALE:
@@ -167,6 +166,8 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.BlueBias);
break;
case GL_BLUE_BITS:
+ if (ctx->NewState & _NEW_BUFFERS)
+ _mesa_update_state(ctx);
params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.blueBits);
break;
case GL_BLUE_SCALE:
@@ -221,27 +222,21 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
params[0] = ENUM_TO_BOOLEAN(ctx->Polygon.CullFaceMode);
break;
case GL_CURRENT_COLOR:
- {
FLUSH_CURRENT(ctx, 0);
params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]);
params[1] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]);
params[2] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]);
params[3] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]);
- }
break;
case GL_CURRENT_INDEX:
- {
FLUSH_CURRENT(ctx, 0);
params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]);
- }
break;
case GL_CURRENT_NORMAL:
- {
FLUSH_CURRENT(ctx, 0);
params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]);
params[1] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]);
params[2] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]);
- }
break;
case GL_CURRENT_RASTER_COLOR:
params[0] = FLOAT_TO_BOOLEAN(ctx->Current.RasterColor[0]);
@@ -334,10 +329,8 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
params[0] = ENUM_TO_BOOLEAN(ctx->DrawBuffer->ColorDrawBuffer[0]);
break;
case GL_EDGE_FLAG:
- {
FLUSH_CURRENT(ctx, 0);
params[0] = (ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0);
- }
break;
case GL_FEEDBACK_BUFFER_SIZE:
params[0] = INT_TO_BOOLEAN(ctx->Feedback.BufferSize);
@@ -379,12 +372,16 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.GreenBias);
break;
case GL_GREEN_BITS:
+ if (ctx->NewState & _NEW_BUFFERS)
+ _mesa_update_state(ctx);
params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.greenBits);
break;
case GL_GREEN_SCALE:
params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.GreenScale);
break;
case GL_INDEX_BITS:
+ if (ctx->NewState & _NEW_BUFFERS)
+ _mesa_update_state(ctx);
params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.indexBits);
break;
case GL_INDEX_CLEAR_VALUE:
@@ -815,6 +812,8 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.RedBias);
break;
case GL_RED_BITS:
+ if (ctx->NewState & _NEW_BUFFERS)
+ _mesa_update_state(ctx);
params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.redBits);
break;
case GL_RED_SCALE:
@@ -917,6 +916,10 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
CHECK_EXT1(MESA_texture_array, "GetBooleanv");
params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_ARRAY_INDEX]->Name);
break;
+ case GL_MAX_ARRAY_TEXTURE_LAYERS_EXT:
+ CHECK_EXT1(MESA_texture_array, "GetBooleanv");
+ params[0] = INT_TO_BOOLEAN(ctx->Const.MaxArrayTextureLayers);
+ break;
case GL_TEXTURE_GEN_S:
params[0] = ((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0);
break;
@@ -1341,13 +1344,11 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
break;
case GL_CURRENT_SECONDARY_COLOR_EXT:
CHECK_EXT1(EXT_secondary_color, "GetBooleanv");
- {
FLUSH_CURRENT(ctx, 0);
params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]);
params[1] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]);
params[2] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]);
params[3] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]);
- }
break;
case GL_SECONDARY_COLOR_ARRAY_EXT:
CHECK_EXT1(EXT_secondary_color, "GetBooleanv");
@@ -1367,10 +1368,8 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
break;
case GL_CURRENT_FOG_COORDINATE_EXT:
CHECK_EXT1(EXT_fog_coord, "GetBooleanv");
- {
FLUSH_CURRENT(ctx, 0);
params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_FOG][0]);
- }
break;
case GL_FOG_COORDINATE_ARRAY_EXT:
CHECK_EXT1(EXT_fog_coord, "GetBooleanv");
@@ -1923,6 +1922,26 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
CHECK_EXT1(ARB_sync, "GetBooleanv");
params[0] = INT64_TO_BOOLEAN(ctx->Const.MaxServerWaitTimeout);
break;
+ case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
+ CHECK_EXT1(EXT_transform_feedback, "GetBooleanv");
+ params[0] = INT_TO_BOOLEAN(ctx->TransformFeedback.CurrentBuffer->Name);
+ break;
+ case GL_RASTERIZER_DISCARD:
+ CHECK_EXT1(EXT_transform_feedback, "GetBooleanv");
+ params[0] = ctx->TransformFeedback.RasterDiscard;
+ break;
+ case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS:
+ CHECK_EXT1(EXT_transform_feedback, "GetBooleanv");
+ params[0] = INT_TO_BOOLEAN(ctx->Const.MaxTransformFeedbackInterleavedComponents);
+ break;
+ case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:
+ CHECK_EXT1(EXT_transform_feedback, "GetBooleanv");
+ params[0] = INT_TO_BOOLEAN(ctx->Const.MaxTransformFeedbackSeparateAttribs);
+ break;
+ case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS:
+ CHECK_EXT1(EXT_transform_feedback, "GetBooleanv");
+ params[0] = INT_TO_BOOLEAN(ctx->Const.MaxTransformFeedbackSeparateComponents);
+ break;
case GL_NUM_EXTENSIONS:
params[0] = INT_TO_BOOLEAN(_mesa_get_extension_count(ctx));
break;
@@ -1932,6 +1951,9 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
case GL_MINOR_VERSION:
params[0] = INT_TO_BOOLEAN(ctx->VersionMinor);
break;
+ case GL_CONTEXT_FLAGS:
+ params[0] = INT_TO_BOOLEAN(ctx->Const.ContextFlags);
+ break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv(pname=0x%x)", pname);
}
@@ -1946,9 +1968,6 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
if (!params)
return;
- if (ctx->NewState)
- _mesa_update_state(ctx);
-
if (ctx->Driver.GetFloatv &&
ctx->Driver.GetFloatv(ctx, pname, params))
return;
@@ -1976,6 +1995,8 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
params[0] = ctx->Pixel.AlphaBias;
break;
case GL_ALPHA_BITS:
+ if (ctx->NewState & _NEW_BUFFERS)
+ _mesa_update_state(ctx);
params[0] = (GLfloat)(ctx->DrawBuffer->Visual.alphaBits);
break;
case GL_ALPHA_SCALE:
@@ -2036,6 +2057,8 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
params[0] = ctx->Pixel.BlueBias;
break;
case GL_BLUE_BITS:
+ if (ctx->NewState & _NEW_BUFFERS)
+ _mesa_update_state(ctx);
params[0] = (GLfloat)(ctx->DrawBuffer->Visual.blueBits);
break;
case GL_BLUE_SCALE:
@@ -2090,27 +2113,21 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
params[0] = ENUM_TO_FLOAT(ctx->Polygon.CullFaceMode);
break;
case GL_CURRENT_COLOR:
- {
FLUSH_CURRENT(ctx, 0);
params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0];
params[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1];
params[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2];
params[3] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3];
- }
break;
case GL_CURRENT_INDEX:
- {
FLUSH_CURRENT(ctx, 0);
params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0];
- }
break;
case GL_CURRENT_NORMAL:
- {
FLUSH_CURRENT(ctx, 0);
params[0] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0];
params[1] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1];
params[2] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2];
- }
break;
case GL_CURRENT_RASTER_COLOR:
params[0] = ctx->Current.RasterColor[0];
@@ -2203,10 +2220,8 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
params[0] = ENUM_TO_FLOAT(ctx->DrawBuffer->ColorDrawBuffer[0]);
break;
case GL_EDGE_FLAG:
- {
FLUSH_CURRENT(ctx, 0);
params[0] = BOOLEAN_TO_FLOAT((ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0));
- }
break;
case GL_FEEDBACK_BUFFER_SIZE:
params[0] = (GLfloat)(ctx->Feedback.BufferSize);
@@ -2248,12 +2263,16 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
params[0] = ctx->Pixel.GreenBias;
break;
case GL_GREEN_BITS:
+ if (ctx->NewState & _NEW_BUFFERS)
+ _mesa_update_state(ctx);
params[0] = (GLfloat)(ctx->DrawBuffer->Visual.greenBits);
break;
case GL_GREEN_SCALE:
params[0] = ctx->Pixel.GreenScale;
break;
case GL_INDEX_BITS:
+ if (ctx->NewState & _NEW_BUFFERS)
+ _mesa_update_state(ctx);
params[0] = (GLfloat)(ctx->DrawBuffer->Visual.indexBits);
break;
case GL_INDEX_CLEAR_VALUE:
@@ -2684,6 +2703,8 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
params[0] = ctx->Pixel.RedBias;
break;
case GL_RED_BITS:
+ if (ctx->NewState & _NEW_BUFFERS)
+ _mesa_update_state(ctx);
params[0] = (GLfloat)(ctx->DrawBuffer->Visual.redBits);
break;
case GL_RED_SCALE:
@@ -2786,6 +2807,10 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
CHECK_EXT1(MESA_texture_array, "GetFloatv");
params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_ARRAY_INDEX]->Name);
break;
+ case GL_MAX_ARRAY_TEXTURE_LAYERS_EXT:
+ CHECK_EXT1(MESA_texture_array, "GetFloatv");
+ params[0] = (GLfloat)(ctx->Const.MaxArrayTextureLayers);
+ break;
case GL_TEXTURE_GEN_S:
params[0] = BOOLEAN_TO_FLOAT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0));
break;
@@ -3210,13 +3235,11 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
break;
case GL_CURRENT_SECONDARY_COLOR_EXT:
CHECK_EXT1(EXT_secondary_color, "GetFloatv");
- {
FLUSH_CURRENT(ctx, 0);
params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0];
params[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1];
params[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2];
params[3] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3];
- }
break;
case GL_SECONDARY_COLOR_ARRAY_EXT:
CHECK_EXT1(EXT_secondary_color, "GetFloatv");
@@ -3236,10 +3259,8 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
break;
case GL_CURRENT_FOG_COORDINATE_EXT:
CHECK_EXT1(EXT_fog_coord, "GetFloatv");
- {
FLUSH_CURRENT(ctx, 0);
params[0] = ctx->Current.Attrib[VERT_ATTRIB_FOG][0];
- }
break;
case GL_FOG_COORDINATE_ARRAY_EXT:
CHECK_EXT1(EXT_fog_coord, "GetFloatv");
@@ -3792,6 +3813,26 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
CHECK_EXT1(ARB_sync, "GetFloatv");
params[0] = (GLfloat)(ctx->Const.MaxServerWaitTimeout);
break;
+ case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
+ CHECK_EXT1(EXT_transform_feedback, "GetFloatv");
+ params[0] = (GLfloat)(ctx->TransformFeedback.CurrentBuffer->Name);
+ break;
+ case GL_RASTERIZER_DISCARD:
+ CHECK_EXT1(EXT_transform_feedback, "GetFloatv");
+ params[0] = BOOLEAN_TO_FLOAT(ctx->TransformFeedback.RasterDiscard);
+ break;
+ case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS:
+ CHECK_EXT1(EXT_transform_feedback, "GetFloatv");
+ params[0] = (GLfloat)(ctx->Const.MaxTransformFeedbackInterleavedComponents);
+ break;
+ case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:
+ CHECK_EXT1(EXT_transform_feedback, "GetFloatv");
+ params[0] = (GLfloat)(ctx->Const.MaxTransformFeedbackSeparateAttribs);
+ break;
+ case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS:
+ CHECK_EXT1(EXT_transform_feedback, "GetFloatv");
+ params[0] = (GLfloat)(ctx->Const.MaxTransformFeedbackSeparateComponents);
+ break;
case GL_NUM_EXTENSIONS:
params[0] = (GLfloat)(_mesa_get_extension_count(ctx));
break;
@@ -3801,6 +3842,9 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
case GL_MINOR_VERSION:
params[0] = (GLfloat)(ctx->VersionMinor);
break;
+ case GL_CONTEXT_FLAGS:
+ params[0] = (GLfloat)(ctx->Const.ContextFlags);
+ break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetFloatv(pname=0x%x)", pname);
}
@@ -3815,9 +3859,6 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
if (!params)
return;
- if (ctx->NewState)
- _mesa_update_state(ctx);
-
if (ctx->Driver.GetIntegerv &&
ctx->Driver.GetIntegerv(ctx, pname, params))
return;
@@ -3845,6 +3886,8 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
params[0] = IROUND(ctx->Pixel.AlphaBias);
break;
case GL_ALPHA_BITS:
+ if (ctx->NewState & _NEW_BUFFERS)
+ _mesa_update_state(ctx);
params[0] = ctx->DrawBuffer->Visual.alphaBits;
break;
case GL_ALPHA_SCALE:
@@ -3905,6 +3948,8 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
params[0] = IROUND(ctx->Pixel.BlueBias);
break;
case GL_BLUE_BITS:
+ if (ctx->NewState & _NEW_BUFFERS)
+ _mesa_update_state(ctx);
params[0] = ctx->DrawBuffer->Visual.blueBits;
break;
case GL_BLUE_SCALE:
@@ -3959,27 +4004,21 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
params[0] = ENUM_TO_INT(ctx->Polygon.CullFaceMode);
break;
case GL_CURRENT_COLOR:
- {
FLUSH_CURRENT(ctx, 0);
params[0] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]);
params[1] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]);
params[2] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]);
params[3] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]);
- }
break;
case GL_CURRENT_INDEX:
- {
FLUSH_CURRENT(ctx, 0);
params[0] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]);
- }
break;
case GL_CURRENT_NORMAL:
- {
FLUSH_CURRENT(ctx, 0);
params[0] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]);
params[1] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]);
params[2] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]);
- }
break;
case GL_CURRENT_RASTER_COLOR:
params[0] = FLOAT_TO_INT(ctx->Current.RasterColor[0]);
@@ -4072,10 +4111,8 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
params[0] = ENUM_TO_INT(ctx->DrawBuffer->ColorDrawBuffer[0]);
break;
case GL_EDGE_FLAG:
- {
FLUSH_CURRENT(ctx, 0);
params[0] = BOOLEAN_TO_INT((ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0));
- }
break;
case GL_FEEDBACK_BUFFER_SIZE:
params[0] = ctx->Feedback.BufferSize;
@@ -4117,12 +4154,16 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
params[0] = IROUND(ctx->Pixel.GreenBias);
break;
case GL_GREEN_BITS:
+ if (ctx->NewState & _NEW_BUFFERS)
+ _mesa_update_state(ctx);
params[0] = ctx->DrawBuffer->Visual.greenBits;
break;
case GL_GREEN_SCALE:
params[0] = IROUND(ctx->Pixel.GreenScale);
break;
case GL_INDEX_BITS:
+ if (ctx->NewState & _NEW_BUFFERS)
+ _mesa_update_state(ctx);
params[0] = ctx->DrawBuffer->Visual.indexBits;
break;
case GL_INDEX_CLEAR_VALUE:
@@ -4553,6 +4594,8 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
params[0] = IROUND(ctx->Pixel.RedBias);
break;
case GL_RED_BITS:
+ if (ctx->NewState & _NEW_BUFFERS)
+ _mesa_update_state(ctx);
params[0] = ctx->DrawBuffer->Visual.redBits;
break;
case GL_RED_SCALE:
@@ -4655,6 +4698,10 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
CHECK_EXT1(MESA_texture_array, "GetIntegerv");
params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_ARRAY_INDEX]->Name;
break;
+ case GL_MAX_ARRAY_TEXTURE_LAYERS_EXT:
+ CHECK_EXT1(MESA_texture_array, "GetIntegerv");
+ params[0] = ctx->Const.MaxArrayTextureLayers;
+ break;
case GL_TEXTURE_GEN_S:
params[0] = BOOLEAN_TO_INT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0));
break;
@@ -5079,13 +5126,11 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
break;
case GL_CURRENT_SECONDARY_COLOR_EXT:
CHECK_EXT1(EXT_secondary_color, "GetIntegerv");
- {
FLUSH_CURRENT(ctx, 0);
params[0] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]);
params[1] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]);
params[2] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]);
params[3] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]);
- }
break;
case GL_SECONDARY_COLOR_ARRAY_EXT:
CHECK_EXT1(EXT_secondary_color, "GetIntegerv");
@@ -5105,10 +5150,8 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
break;
case GL_CURRENT_FOG_COORDINATE_EXT:
CHECK_EXT1(EXT_fog_coord, "GetIntegerv");
- {
FLUSH_CURRENT(ctx, 0);
params[0] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_FOG][0]);
- }
break;
case GL_FOG_COORDINATE_ARRAY_EXT:
CHECK_EXT1(EXT_fog_coord, "GetIntegerv");
@@ -5661,6 +5704,26 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
CHECK_EXT1(ARB_sync, "GetIntegerv");
params[0] = INT64_TO_INT(ctx->Const.MaxServerWaitTimeout);
break;
+ case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
+ CHECK_EXT1(EXT_transform_feedback, "GetIntegerv");
+ params[0] = ctx->TransformFeedback.CurrentBuffer->Name;
+ break;
+ case GL_RASTERIZER_DISCARD:
+ CHECK_EXT1(EXT_transform_feedback, "GetIntegerv");
+ params[0] = BOOLEAN_TO_INT(ctx->TransformFeedback.RasterDiscard);
+ break;
+ case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS:
+ CHECK_EXT1(EXT_transform_feedback, "GetIntegerv");
+ params[0] = ctx->Const.MaxTransformFeedbackInterleavedComponents;
+ break;
+ case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:
+ CHECK_EXT1(EXT_transform_feedback, "GetIntegerv");
+ params[0] = ctx->Const.MaxTransformFeedbackSeparateAttribs;
+ break;
+ case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS:
+ CHECK_EXT1(EXT_transform_feedback, "GetIntegerv");
+ params[0] = ctx->Const.MaxTransformFeedbackSeparateComponents;
+ break;
case GL_NUM_EXTENSIONS:
params[0] = _mesa_get_extension_count(ctx);
break;
@@ -5670,6 +5733,9 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
case GL_MINOR_VERSION:
params[0] = ctx->VersionMinor;
break;
+ case GL_CONTEXT_FLAGS:
+ params[0] = ctx->Const.ContextFlags;
+ break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv(pname=0x%x)", pname);
}
@@ -5685,9 +5751,6 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params )
if (!params)
return;
- if (ctx->NewState)
- _mesa_update_state(ctx);
-
if (ctx->Driver.GetInteger64v &&
ctx->Driver.GetInteger64v(ctx, pname, params))
return;
@@ -5715,6 +5778,8 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params )
params[0] = IROUND64(ctx->Pixel.AlphaBias);
break;
case GL_ALPHA_BITS:
+ if (ctx->NewState & _NEW_BUFFERS)
+ _mesa_update_state(ctx);
params[0] = (GLint64)(ctx->DrawBuffer->Visual.alphaBits);
break;
case GL_ALPHA_SCALE:
@@ -5775,6 +5840,8 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params )
params[0] = IROUND64(ctx->Pixel.BlueBias);
break;
case GL_BLUE_BITS:
+ if (ctx->NewState & _NEW_BUFFERS)
+ _mesa_update_state(ctx);
params[0] = (GLint64)(ctx->DrawBuffer->Visual.blueBits);
break;
case GL_BLUE_SCALE:
@@ -5829,27 +5896,21 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params )
params[0] = ENUM_TO_INT64(ctx->Polygon.CullFaceMode);
break;
case GL_CURRENT_COLOR:
- {
FLUSH_CURRENT(ctx, 0);
params[0] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]);
params[1] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]);
params[2] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]);
params[3] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]);
- }
break;
case GL_CURRENT_INDEX:
- {
FLUSH_CURRENT(ctx, 0);
params[0] = IROUND64(ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]);
- }
break;
case GL_CURRENT_NORMAL:
- {
FLUSH_CURRENT(ctx, 0);
params[0] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]);
params[1] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]);
params[2] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]);
- }
break;
case GL_CURRENT_RASTER_COLOR:
params[0] = FLOAT_TO_INT64(ctx->Current.RasterColor[0]);
@@ -5942,10 +6003,8 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params )
params[0] = ENUM_TO_INT64(ctx->DrawBuffer->ColorDrawBuffer[0]);
break;
case GL_EDGE_FLAG:
- {
FLUSH_CURRENT(ctx, 0);
params[0] = BOOLEAN_TO_INT64((ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0));
- }
break;
case GL_FEEDBACK_BUFFER_SIZE:
params[0] = (GLint64)(ctx->Feedback.BufferSize);
@@ -5987,12 +6046,16 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params )
params[0] = IROUND64(ctx->Pixel.GreenBias);
break;
case GL_GREEN_BITS:
+ if (ctx->NewState & _NEW_BUFFERS)
+ _mesa_update_state(ctx);
params[0] = (GLint64)(ctx->DrawBuffer->Visual.greenBits);
break;
case GL_GREEN_SCALE:
params[0] = IROUND64(ctx->Pixel.GreenScale);
break;
case GL_INDEX_BITS:
+ if (ctx->NewState & _NEW_BUFFERS)
+ _mesa_update_state(ctx);
params[0] = (GLint64)(ctx->DrawBuffer->Visual.indexBits);
break;
case GL_INDEX_CLEAR_VALUE:
@@ -6423,6 +6486,8 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params )
params[0] = IROUND64(ctx->Pixel.RedBias);
break;
case GL_RED_BITS:
+ if (ctx->NewState & _NEW_BUFFERS)
+ _mesa_update_state(ctx);
params[0] = (GLint64)(ctx->DrawBuffer->Visual.redBits);
break;
case GL_RED_SCALE:
@@ -6525,6 +6590,10 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params )
CHECK_EXT1(MESA_texture_array, "GetInteger64v");
params[0] = (GLint64)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_ARRAY_INDEX]->Name);
break;
+ case GL_MAX_ARRAY_TEXTURE_LAYERS_EXT:
+ CHECK_EXT1(MESA_texture_array, "GetInteger64v");
+ params[0] = (GLint64)(ctx->Const.MaxArrayTextureLayers);
+ break;
case GL_TEXTURE_GEN_S:
params[0] = BOOLEAN_TO_INT64(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0));
break;
@@ -6949,13 +7018,11 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params )
break;
case GL_CURRENT_SECONDARY_COLOR_EXT:
CHECK_EXT1(EXT_secondary_color, "GetInteger64v");
- {
FLUSH_CURRENT(ctx, 0);
params[0] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]);
params[1] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]);
params[2] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]);
params[3] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]);
- }
break;
case GL_SECONDARY_COLOR_ARRAY_EXT:
CHECK_EXT1(EXT_secondary_color, "GetInteger64v");
@@ -6975,10 +7042,8 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params )
break;
case GL_CURRENT_FOG_COORDINATE_EXT:
CHECK_EXT1(EXT_fog_coord, "GetInteger64v");
- {
FLUSH_CURRENT(ctx, 0);
params[0] = IROUND64(ctx->Current.Attrib[VERT_ATTRIB_FOG][0]);
- }
break;
case GL_FOG_COORDINATE_ARRAY_EXT:
CHECK_EXT1(EXT_fog_coord, "GetInteger64v");
@@ -7531,6 +7596,26 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params )
CHECK_EXT1(ARB_sync, "GetInteger64v");
params[0] = ctx->Const.MaxServerWaitTimeout;
break;
+ case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
+ CHECK_EXT1(EXT_transform_feedback, "GetInteger64v");
+ params[0] = (GLint64)(ctx->TransformFeedback.CurrentBuffer->Name);
+ break;
+ case GL_RASTERIZER_DISCARD:
+ CHECK_EXT1(EXT_transform_feedback, "GetInteger64v");
+ params[0] = BOOLEAN_TO_INT64(ctx->TransformFeedback.RasterDiscard);
+ break;
+ case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS:
+ CHECK_EXT1(EXT_transform_feedback, "GetInteger64v");
+ params[0] = (GLint64)(ctx->Const.MaxTransformFeedbackInterleavedComponents);
+ break;
+ case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:
+ CHECK_EXT1(EXT_transform_feedback, "GetInteger64v");
+ params[0] = (GLint64)(ctx->Const.MaxTransformFeedbackSeparateAttribs);
+ break;
+ case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS:
+ CHECK_EXT1(EXT_transform_feedback, "GetInteger64v");
+ params[0] = (GLint64)(ctx->Const.MaxTransformFeedbackSeparateComponents);
+ break;
case GL_NUM_EXTENSIONS:
params[0] = (GLint64)(_mesa_get_extension_count(ctx));
break;
@@ -7540,6 +7625,9 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params )
case GL_MINOR_VERSION:
params[0] = (GLint64)(ctx->VersionMinor);
break;
+ case GL_CONTEXT_FLAGS:
+ params[0] = (GLint64)(ctx->Const.ContextFlags);
+ break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetInteger64v(pname=0x%x)", pname);
}
@@ -7578,14 +7666,12 @@ _mesa_GetBooleanIndexedv( GLenum pname, GLuint index, GLboolean *params )
if (!params)
return;
- if (ctx->NewState)
- _mesa_update_state(ctx);
-
switch (pname) {
case GL_BLEND:
CHECK_EXT1(EXT_draw_buffers2, "GetBooleanIndexedv");
if (index >= ctx->Const.MaxDrawBuffers) {
_mesa_error(ctx, GL_INVALID_VALUE, "glGetBooleanIndexedv(index=%u), index", pname);
+ return;
}
params[0] = INT_TO_BOOLEAN(((ctx->Color.BlendEnabled >> index) & 1));
break;
@@ -7593,12 +7679,37 @@ _mesa_GetBooleanIndexedv( GLenum pname, GLuint index, GLboolean *params )
CHECK_EXT1(EXT_draw_buffers2, "GetBooleanIndexedv");
if (index >= ctx->Const.MaxDrawBuffers) {
_mesa_error(ctx, GL_INVALID_VALUE, "glGetBooleanIndexedv(index=%u), index", pname);
+ return;
}
params[0] = INT_TO_BOOLEAN(ctx->Color.ColorMask[index][RCOMP] ? 1 : 0);
params[1] = INT_TO_BOOLEAN(ctx->Color.ColorMask[index][GCOMP] ? 1 : 0);
params[2] = INT_TO_BOOLEAN(ctx->Color.ColorMask[index][BCOMP] ? 1 : 0);
params[3] = INT_TO_BOOLEAN(ctx->Color.ColorMask[index][ACOMP] ? 1 : 0);
break;
+ case GL_TRANSFORM_FEEDBACK_BUFFER_START:
+ CHECK_EXT1(EXT_transform_feedback, "GetBooleanIndexedv");
+ if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glGetBooleanIndexedv(index=%u), index", pname);
+ return;
+ }
+ params[0] = INT64_TO_BOOLEAN(ctx->TransformFeedback.Offset[index]);
+ break;
+ case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE:
+ CHECK_EXT1(EXT_transform_feedback, "GetBooleanIndexedv");
+ if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glGetBooleanIndexedv(index=%u), index", pname);
+ return;
+ }
+ params[0] = INT64_TO_BOOLEAN(ctx->TransformFeedback.Size[index]);
+ break;
+ case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
+ CHECK_EXT1(EXT_transform_feedback, "GetBooleanIndexedv");
+ if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glGetBooleanIndexedv(index=%u), index", pname);
+ return;
+ }
+ params[0] = INT_TO_BOOLEAN(ctx->TransformFeedback.Buffers[index]->Name);
+ break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanIndexedv(pname=0x%x)", pname);
}
@@ -7613,14 +7724,12 @@ _mesa_GetIntegerIndexedv( GLenum pname, GLuint index, GLint *params )
if (!params)
return;
- if (ctx->NewState)
- _mesa_update_state(ctx);
-
switch (pname) {
case GL_BLEND:
CHECK_EXT1(EXT_draw_buffers2, "GetIntegerIndexedv");
if (index >= ctx->Const.MaxDrawBuffers) {
_mesa_error(ctx, GL_INVALID_VALUE, "glGetIntegerIndexedv(index=%u), index", pname);
+ return;
}
params[0] = ((ctx->Color.BlendEnabled >> index) & 1);
break;
@@ -7628,12 +7737,37 @@ _mesa_GetIntegerIndexedv( GLenum pname, GLuint index, GLint *params )
CHECK_EXT1(EXT_draw_buffers2, "GetIntegerIndexedv");
if (index >= ctx->Const.MaxDrawBuffers) {
_mesa_error(ctx, GL_INVALID_VALUE, "glGetIntegerIndexedv(index=%u), index", pname);
+ return;
}
params[0] = ctx->Color.ColorMask[index][RCOMP] ? 1 : 0;
params[1] = ctx->Color.ColorMask[index][GCOMP] ? 1 : 0;
params[2] = ctx->Color.ColorMask[index][BCOMP] ? 1 : 0;
params[3] = ctx->Color.ColorMask[index][ACOMP] ? 1 : 0;
break;
+ case GL_TRANSFORM_FEEDBACK_BUFFER_START:
+ CHECK_EXT1(EXT_transform_feedback, "GetIntegerIndexedv");
+ if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glGetIntegerIndexedv(index=%u), index", pname);
+ return;
+ }
+ params[0] = INT64_TO_INT(ctx->TransformFeedback.Offset[index]);
+ break;
+ case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE:
+ CHECK_EXT1(EXT_transform_feedback, "GetIntegerIndexedv");
+ if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glGetIntegerIndexedv(index=%u), index", pname);
+ return;
+ }
+ params[0] = INT64_TO_INT(ctx->TransformFeedback.Size[index]);
+ break;
+ case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
+ CHECK_EXT1(EXT_transform_feedback, "GetIntegerIndexedv");
+ if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glGetIntegerIndexedv(index=%u), index", pname);
+ return;
+ }
+ params[0] = ctx->TransformFeedback.Buffers[index]->Name;
+ break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerIndexedv(pname=0x%x)", pname);
}
@@ -7649,14 +7783,12 @@ _mesa_GetInteger64Indexedv( GLenum pname, GLuint index, GLint64 *params )
if (!params)
return;
- if (ctx->NewState)
- _mesa_update_state(ctx);
-
switch (pname) {
case GL_BLEND:
CHECK_EXT1(EXT_draw_buffers2, "GetInteger64Indexedv");
if (index >= ctx->Const.MaxDrawBuffers) {
_mesa_error(ctx, GL_INVALID_VALUE, "glGetInteger64Indexedv(index=%u), index", pname);
+ return;
}
params[0] = (GLint64)(((ctx->Color.BlendEnabled >> index) & 1));
break;
@@ -7664,12 +7796,37 @@ _mesa_GetInteger64Indexedv( GLenum pname, GLuint index, GLint64 *params )
CHECK_EXT1(EXT_draw_buffers2, "GetInteger64Indexedv");
if (index >= ctx->Const.MaxDrawBuffers) {
_mesa_error(ctx, GL_INVALID_VALUE, "glGetInteger64Indexedv(index=%u), index", pname);
+ return;
}
params[0] = (GLint64)(ctx->Color.ColorMask[index][RCOMP] ? 1 : 0);
params[1] = (GLint64)(ctx->Color.ColorMask[index][GCOMP] ? 1 : 0);
params[2] = (GLint64)(ctx->Color.ColorMask[index][BCOMP] ? 1 : 0);
params[3] = (GLint64)(ctx->Color.ColorMask[index][ACOMP] ? 1 : 0);
break;
+ case GL_TRANSFORM_FEEDBACK_BUFFER_START:
+ CHECK_EXT1(EXT_transform_feedback, "GetInteger64Indexedv");
+ if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glGetInteger64Indexedv(index=%u), index", pname);
+ return;
+ }
+ params[0] = ctx->TransformFeedback.Offset[index];
+ break;
+ case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE:
+ CHECK_EXT1(EXT_transform_feedback, "GetInteger64Indexedv");
+ if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glGetInteger64Indexedv(index=%u), index", pname);
+ return;
+ }
+ params[0] = ctx->TransformFeedback.Size[index];
+ break;
+ case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
+ CHECK_EXT1(EXT_transform_feedback, "GetInteger64Indexedv");
+ if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glGetInteger64Indexedv(index=%u), index", pname);
+ return;
+ }
+ params[0] = (GLint64)(ctx->TransformFeedback.Buffers[index]->Name);
+ break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetInteger64Indexedv(pname=0x%x)", pname);
}
diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py
index 9d5a51d58c..bfaca1536d 100644
--- a/src/mesa/main/get_gen.py
+++ b/src/mesa/main/get_gen.py
@@ -49,123 +49,132 @@ TypeStrings = {
}
+NoState = None
+NoExt = None
+FlushCurrent = 1
+
+
# Each entry is a tuple of:
# - the GL state name, such as GL_CURRENT_COLOR
# - the state datatype, one of GLint, GLfloat, GLboolean or GLenum
# - list of code fragments to get the state, such as ["ctx->Foo.Bar"]
# - optional extra code or empty string. If present, "CONVERSION" will be
# replaced by ENUM_TO_FLOAT, INT_TO_FLOAT, etc.
-# - optional extensions to check, or None
+# - state flags: either NoExt, FlushCurrent or "_NEW_xxx"
+# if NoExt, do nothing special
+# if FlushCurrent, emit FLUSH_CURRENT() call
+# if "_NEW_xxx", call _mesa_update_state() if that dirty state flag is set
+# - optional extensions to check, or NoExt
#
StateVars = [
( "GL_ACCUM_RED_BITS", GLint, ["ctx->DrawBuffer->Visual.accumRedBits"],
- "", None ),
+ "", NoState, NoExt ),
( "GL_ACCUM_GREEN_BITS", GLint, ["ctx->DrawBuffer->Visual.accumGreenBits"],
- "", None ),
+ "", NoState, NoExt ),
( "GL_ACCUM_BLUE_BITS", GLint, ["ctx->DrawBuffer->Visual.accumBlueBits"],
- "", None ),
+ "", NoState, NoExt ),
( "GL_ACCUM_ALPHA_BITS", GLint, ["ctx->DrawBuffer->Visual.accumAlphaBits"],
- "", None ),
+ "", NoState, NoExt ),
( "GL_ACCUM_CLEAR_VALUE", GLfloatN,
[ "ctx->Accum.ClearColor[0]",
"ctx->Accum.ClearColor[1]",
"ctx->Accum.ClearColor[2]",
"ctx->Accum.ClearColor[3]" ],
- "", None ),
- ( "GL_ALPHA_BIAS", GLfloat, ["ctx->Pixel.AlphaBias"], "", None ),
+ "", NoState, NoExt ),
+ ( "GL_ALPHA_BIAS", GLfloat, ["ctx->Pixel.AlphaBias"], "", NoState, NoExt ),
( "GL_ALPHA_BITS", GLint, ["ctx->DrawBuffer->Visual.alphaBits"],
- "", None ),
- ( "GL_ALPHA_SCALE", GLfloat, ["ctx->Pixel.AlphaScale"], "", None ),
- ( "GL_ALPHA_TEST", GLboolean, ["ctx->Color.AlphaEnabled"], "", None ),
- ( "GL_ALPHA_TEST_FUNC", GLenum, ["ctx->Color.AlphaFunc"], "", None ),
- ( "GL_ALPHA_TEST_REF", GLfloatN, ["ctx->Color.AlphaRef"], "", None ),
- ( "GL_ATTRIB_STACK_DEPTH", GLint, ["ctx->AttribStackDepth"], "", None ),
- ( "GL_AUTO_NORMAL", GLboolean, ["ctx->Eval.AutoNormal"], "", None ),
+ "", "_NEW_BUFFERS", NoExt ),
+ ( "GL_ALPHA_SCALE", GLfloat, ["ctx->Pixel.AlphaScale"], "", NoState, NoExt ),
+ ( "GL_ALPHA_TEST", GLboolean, ["ctx->Color.AlphaEnabled"], "", NoState, NoExt ),
+ ( "GL_ALPHA_TEST_FUNC", GLenum, ["ctx->Color.AlphaFunc"], "", NoState, NoExt ),
+ ( "GL_ALPHA_TEST_REF", GLfloatN, ["ctx->Color.AlphaRef"], "", NoState, NoExt ),
+ ( "GL_ATTRIB_STACK_DEPTH", GLint, ["ctx->AttribStackDepth"], "", NoState, NoExt ),
+ ( "GL_AUTO_NORMAL", GLboolean, ["ctx->Eval.AutoNormal"], "", NoState, NoExt ),
( "GL_AUX_BUFFERS", GLint, ["ctx->DrawBuffer->Visual.numAuxBuffers"],
- "", None ),
- ( "GL_BLEND", GLboolean, ["(ctx->Color.BlendEnabled & 1)"], "", None ),
- ( "GL_BLEND_DST", GLenum, ["ctx->Color.BlendDstRGB"], "", None ),
- ( "GL_BLEND_SRC", GLenum, ["ctx->Color.BlendSrcRGB"], "", None ),
- ( "GL_BLEND_SRC_RGB_EXT", GLenum, ["ctx->Color.BlendSrcRGB"], "", None ),
- ( "GL_BLEND_DST_RGB_EXT", GLenum, ["ctx->Color.BlendDstRGB"], "", None ),
- ( "GL_BLEND_SRC_ALPHA_EXT", GLenum, ["ctx->Color.BlendSrcA"], "", None ),
- ( "GL_BLEND_DST_ALPHA_EXT", GLenum, ["ctx->Color.BlendDstA"], "", None ),
- ( "GL_BLEND_EQUATION", GLenum, ["ctx->Color.BlendEquationRGB "], "", None),
+ "", NoState, NoExt ),
+ ( "GL_BLEND", GLboolean, ["(ctx->Color.BlendEnabled & 1)"], "", NoState, NoExt ),
+ ( "GL_BLEND_DST", GLenum, ["ctx->Color.BlendDstRGB"], "", NoState, NoExt ),
+ ( "GL_BLEND_SRC", GLenum, ["ctx->Color.BlendSrcRGB"], "", NoState, NoExt ),
+ ( "GL_BLEND_SRC_RGB_EXT", GLenum, ["ctx->Color.BlendSrcRGB"], "", NoState, NoExt ),
+ ( "GL_BLEND_DST_RGB_EXT", GLenum, ["ctx->Color.BlendDstRGB"], "", NoState, NoExt ),
+ ( "GL_BLEND_SRC_ALPHA_EXT", GLenum, ["ctx->Color.BlendSrcA"], "", NoState, NoExt ),
+ ( "GL_BLEND_DST_ALPHA_EXT", GLenum, ["ctx->Color.BlendDstA"], "", NoState, NoExt ),
+ ( "GL_BLEND_EQUATION", GLenum, ["ctx->Color.BlendEquationRGB "], "", NoState, NoExt),
( "GL_BLEND_EQUATION_ALPHA_EXT", GLenum, ["ctx->Color.BlendEquationA "],
- "", None ),
+ "", NoState, NoExt ),
( "GL_BLEND_COLOR_EXT", GLfloatN,
[ "ctx->Color.BlendColor[0]",
"ctx->Color.BlendColor[1]",
"ctx->Color.BlendColor[2]",
- "ctx->Color.BlendColor[3]"], "", None ),
- ( "GL_BLUE_BIAS", GLfloat, ["ctx->Pixel.BlueBias"], "", None ),
- ( "GL_BLUE_BITS", GLint, ["ctx->DrawBuffer->Visual.blueBits"], "", None ),
- ( "GL_BLUE_SCALE", GLfloat, ["ctx->Pixel.BlueScale"], "", None ),
+ "ctx->Color.BlendColor[3]"], "", NoState, NoExt ),
+ ( "GL_BLUE_BIAS", GLfloat, ["ctx->Pixel.BlueBias"], "", NoState, NoExt ),
+ ( "GL_BLUE_BITS", GLint, ["ctx->DrawBuffer->Visual.blueBits"], "", "_NEW_BUFFERS", NoExt ),
+ ( "GL_BLUE_SCALE", GLfloat, ["ctx->Pixel.BlueScale"], "", NoState, NoExt ),
( "GL_CLIENT_ATTRIB_STACK_DEPTH", GLint,
- ["ctx->ClientAttribStackDepth"], "", None ),
+ ["ctx->ClientAttribStackDepth"], "", NoState, NoExt ),
( "GL_CLIP_PLANE0", GLboolean,
- [ "(ctx->Transform.ClipPlanesEnabled >> 0) & 1" ], "", None ),
+ [ "(ctx->Transform.ClipPlanesEnabled >> 0) & 1" ], "", NoState, NoExt ),
( "GL_CLIP_PLANE1", GLboolean,
- [ "(ctx->Transform.ClipPlanesEnabled >> 1) & 1" ], "", None ),
+ [ "(ctx->Transform.ClipPlanesEnabled >> 1) & 1" ], "", NoState, NoExt ),
( "GL_CLIP_PLANE2", GLboolean,
- [ "(ctx->Transform.ClipPlanesEnabled >> 2) & 1" ], "", None ),
+ [ "(ctx->Transform.ClipPlanesEnabled >> 2) & 1" ], "", NoState, NoExt ),
( "GL_CLIP_PLANE3", GLboolean,
- [ "(ctx->Transform.ClipPlanesEnabled >> 3) & 1" ], "", None ),
+ [ "(ctx->Transform.ClipPlanesEnabled >> 3) & 1" ], "", NoState, NoExt ),
( "GL_CLIP_PLANE4", GLboolean,
- [ "(ctx->Transform.ClipPlanesEnabled >> 4) & 1" ], "", None ),
+ [ "(ctx->Transform.ClipPlanesEnabled >> 4) & 1" ], "", NoState, NoExt ),
( "GL_CLIP_PLANE5", GLboolean,
- [ "(ctx->Transform.ClipPlanesEnabled >> 5) & 1" ], "", None ),
+ [ "(ctx->Transform.ClipPlanesEnabled >> 5) & 1" ], "", NoState, NoExt ),
( "GL_COLOR_CLEAR_VALUE", GLfloatN,
[ "ctx->Color.ClearColor[0]",
"ctx->Color.ClearColor[1]",
"ctx->Color.ClearColor[2]",
- "ctx->Color.ClearColor[3]" ], "", None ),
+ "ctx->Color.ClearColor[3]" ], "", NoState, NoExt ),
( "GL_COLOR_MATERIAL", GLboolean,
- ["ctx->Light.ColorMaterialEnabled"], "", None ),
+ ["ctx->Light.ColorMaterialEnabled"], "", NoState, NoExt ),
( "GL_COLOR_MATERIAL_FACE", GLenum,
- ["ctx->Light.ColorMaterialFace"], "", None ),
+ ["ctx->Light.ColorMaterialFace"], "", NoState, NoExt ),
( "GL_COLOR_MATERIAL_PARAMETER", GLenum,
- ["ctx->Light.ColorMaterialMode"], "", None ),
+ ["ctx->Light.ColorMaterialMode"], "", NoState, NoExt ),
( "GL_COLOR_WRITEMASK", GLint,
[ "ctx->Color.ColorMask[0][RCOMP] ? 1 : 0",
"ctx->Color.ColorMask[0][GCOMP] ? 1 : 0",
"ctx->Color.ColorMask[0][BCOMP] ? 1 : 0",
- "ctx->Color.ColorMask[0][ACOMP] ? 1 : 0" ], "", None ),
- ( "GL_CULL_FACE", GLboolean, ["ctx->Polygon.CullFlag"], "", None ),
- ( "GL_CULL_FACE_MODE", GLenum, ["ctx->Polygon.CullFaceMode"], "", None ),
+ "ctx->Color.ColorMask[0][ACOMP] ? 1 : 0" ], "", NoState, NoExt ),
+ ( "GL_CULL_FACE", GLboolean, ["ctx->Polygon.CullFlag"], "", NoState, NoExt ),
+ ( "GL_CULL_FACE_MODE", GLenum, ["ctx->Polygon.CullFaceMode"], "", NoState, NoExt ),
( "GL_CURRENT_COLOR", GLfloatN,
[ "ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]",
"ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]",
"ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]",
"ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]" ],
- "FLUSH_CURRENT(ctx, 0);", None ),
+ "", FlushCurrent, NoExt ),
( "GL_CURRENT_INDEX", GLfloat,
[ "ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]" ],
- "FLUSH_CURRENT(ctx, 0);", None ),
+ "", FlushCurrent, NoExt ),
( "GL_CURRENT_NORMAL", GLfloatN,
[ "ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]",
"ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]",
"ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]"],
- "FLUSH_CURRENT(ctx, 0);", None ),
+ "", FlushCurrent, NoExt ),
( "GL_CURRENT_RASTER_COLOR", GLfloatN,
["ctx->Current.RasterColor[0]",
"ctx->Current.RasterColor[1]",
"ctx->Current.RasterColor[2]",
- "ctx->Current.RasterColor[3]"], "", None ),
+ "ctx->Current.RasterColor[3]"], "", NoState, NoExt ),
( "GL_CURRENT_RASTER_DISTANCE", GLfloat,
- ["ctx->Current.RasterDistance"], "", None ),
+ ["ctx->Current.RasterDistance"], "", NoState, NoExt ),
( "GL_CURRENT_RASTER_INDEX", GLfloat,
- ["1.0"], "", None ),
+ ["1.0"], "", NoState, NoExt ),
( "GL_CURRENT_RASTER_POSITION", GLfloat,
["ctx->Current.RasterPos[0]",
"ctx->Current.RasterPos[1]",
"ctx->Current.RasterPos[2]",
- "ctx->Current.RasterPos[3]"], "", None ),
+ "ctx->Current.RasterPos[3]"], "", NoState, NoExt ),
( "GL_CURRENT_RASTER_SECONDARY_COLOR", GLfloatN,
["ctx->Current.RasterSecondaryColor[0]",
"ctx->Current.RasterSecondaryColor[1]",
"ctx->Current.RasterSecondaryColor[2]",
- "ctx->Current.RasterSecondaryColor[3]"], "", None ),
+ "ctx->Current.RasterSecondaryColor[3]"], "", NoState, NoExt ),
( "GL_CURRENT_RASTER_TEXTURE_COORDS", GLfloat,
["ctx->Current.RasterTexCoords[unit][0]",
"ctx->Current.RasterTexCoords[unit][1]",
@@ -177,9 +186,9 @@ StateVars = [
"glGet(raster tex coords, unit %u)", unit);
return;
}""",
- None ),
+ NoState, NoExt ),
( "GL_CURRENT_RASTER_POSITION_VALID", GLboolean,
- ["ctx->Current.RasterPosValid"], "", None ),
+ ["ctx->Current.RasterPosValid"], "", NoState, NoExt ),
( "GL_CURRENT_TEXTURE_COORDS", GLfloat,
["ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][0]",
"ctx->Current.Attrib[VERT_ATTRIB_TEX0 + unit][1]",
@@ -192,85 +201,85 @@ StateVars = [
return;
}
FLUSH_CURRENT(ctx, 0);""",
- None ),
- ( "GL_DEPTH_BIAS", GLfloat, ["ctx->Pixel.DepthBias"], "", None ),
+ NoState, NoExt ),
+ ( "GL_DEPTH_BIAS", GLfloat, ["ctx->Pixel.DepthBias"], "", NoState, NoExt ),
( "GL_DEPTH_BITS", GLint, ["ctx->DrawBuffer->Visual.depthBits"],
- "", None ),
- ( "GL_DEPTH_CLEAR_VALUE", GLfloatN, ["((GLfloat) ctx->Depth.Clear)"], "", None ),
- ( "GL_DEPTH_FUNC", GLenum, ["ctx->Depth.Func"], "", None ),
+ "", NoState, NoExt ),
+ ( "GL_DEPTH_CLEAR_VALUE", GLfloatN, ["((GLfloat) ctx->Depth.Clear)"], "", NoState, NoExt ),
+ ( "GL_DEPTH_FUNC", GLenum, ["ctx->Depth.Func"], "", NoState, NoExt ),
( "GL_DEPTH_RANGE", GLfloatN,
- [ "ctx->Viewport.Near", "ctx->Viewport.Far" ], "", None ),
- ( "GL_DEPTH_SCALE", GLfloat, ["ctx->Pixel.DepthScale"], "", None ),
- ( "GL_DEPTH_TEST", GLboolean, ["ctx->Depth.Test"], "", None ),
- ( "GL_DEPTH_WRITEMASK", GLboolean, ["ctx->Depth.Mask"], "", None ),
- ( "GL_DITHER", GLboolean, ["ctx->Color.DitherFlag"], "", None ),
+ [ "ctx->Viewport.Near", "ctx->Viewport.Far" ], "", NoState, NoExt ),
+ ( "GL_DEPTH_SCALE", GLfloat, ["ctx->Pixel.DepthScale"], "", NoState, NoExt ),
+ ( "GL_DEPTH_TEST", GLboolean, ["ctx->Depth.Test"], "", NoState, NoExt ),
+ ( "GL_DEPTH_WRITEMASK", GLboolean, ["ctx->Depth.Mask"], "", NoState, NoExt ),
+ ( "GL_DITHER", GLboolean, ["ctx->Color.DitherFlag"], "", NoState, NoExt ),
( "GL_DOUBLEBUFFER", GLboolean,
- ["ctx->DrawBuffer->Visual.doubleBufferMode"], "", None ),
- ( "GL_DRAW_BUFFER", GLenum, ["ctx->DrawBuffer->ColorDrawBuffer[0]"], "", None ),
+ ["ctx->DrawBuffer->Visual.doubleBufferMode"], "", NoState, NoExt ),
+ ( "GL_DRAW_BUFFER", GLenum, ["ctx->DrawBuffer->ColorDrawBuffer[0]"], "", NoState, NoExt ),
( "GL_EDGE_FLAG", GLboolean, ["(ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0)"],
- "FLUSH_CURRENT(ctx, 0);", None ),
- ( "GL_FEEDBACK_BUFFER_SIZE", GLint, ["ctx->Feedback.BufferSize"], "", None ),
- ( "GL_FEEDBACK_BUFFER_TYPE", GLenum, ["ctx->Feedback.Type"], "", None ),
- ( "GL_FOG", GLboolean, ["ctx->Fog.Enabled"], "", None ),
+ "", FlushCurrent, NoExt ),
+ ( "GL_FEEDBACK_BUFFER_SIZE", GLint, ["ctx->Feedback.BufferSize"], "", NoState, NoExt ),
+ ( "GL_FEEDBACK_BUFFER_TYPE", GLenum, ["ctx->Feedback.Type"], "", NoState, NoExt ),
+ ( "GL_FOG", GLboolean, ["ctx->Fog.Enabled"], "", NoState, NoExt ),
( "GL_FOG_COLOR", GLfloatN,
[ "ctx->Fog.Color[0]",
"ctx->Fog.Color[1]",
"ctx->Fog.Color[2]",
- "ctx->Fog.Color[3]" ], "", None ),
- ( "GL_FOG_DENSITY", GLfloat, ["ctx->Fog.Density"], "", None ),
- ( "GL_FOG_END", GLfloat, ["ctx->Fog.End"], "", None ),
- ( "GL_FOG_HINT", GLenum, ["ctx->Hint.Fog"], "", None ),
- ( "GL_FOG_INDEX", GLfloat, ["ctx->Fog.Index"], "", None ),
- ( "GL_FOG_MODE", GLenum, ["ctx->Fog.Mode"], "", None ),
- ( "GL_FOG_START", GLfloat, ["ctx->Fog.Start"], "", None ),
- ( "GL_FRONT_FACE", GLenum, ["ctx->Polygon.FrontFace"], "", None ),
- ( "GL_GREEN_BIAS", GLfloat, ["ctx->Pixel.GreenBias"], "", None ),
+ "ctx->Fog.Color[3]" ], "", NoState, NoExt ),
+ ( "GL_FOG_DENSITY", GLfloat, ["ctx->Fog.Density"], "", NoState, NoExt ),
+ ( "GL_FOG_END", GLfloat, ["ctx->Fog.End"], "", NoState, NoExt ),
+ ( "GL_FOG_HINT", GLenum, ["ctx->Hint.Fog"], "", NoState, NoExt ),
+ ( "GL_FOG_INDEX", GLfloat, ["ctx->Fog.Index"], "", NoState, NoExt ),
+ ( "GL_FOG_MODE", GLenum, ["ctx->Fog.Mode"], "", NoState, NoExt ),
+ ( "GL_FOG_START", GLfloat, ["ctx->Fog.Start"], "", NoState, NoExt ),
+ ( "GL_FRONT_FACE", GLenum, ["ctx->Polygon.FrontFace"], "", NoState, NoExt ),
+ ( "GL_GREEN_BIAS", GLfloat, ["ctx->Pixel.GreenBias"], "", NoState, NoExt ),
( "GL_GREEN_BITS", GLint, ["ctx->DrawBuffer->Visual.greenBits"],
- "", None ),
- ( "GL_GREEN_SCALE", GLfloat, ["ctx->Pixel.GreenScale"], "", None ),
+ "", "_NEW_BUFFERS", NoExt ),
+ ( "GL_GREEN_SCALE", GLfloat, ["ctx->Pixel.GreenScale"], "", NoState, NoExt ),
( "GL_INDEX_BITS", GLint, ["ctx->DrawBuffer->Visual.indexBits"],
- "", None ),
- ( "GL_INDEX_CLEAR_VALUE", GLint, ["ctx->Color.ClearIndex"], "", None ),
+ "", "_NEW_BUFFERS", NoExt ),
+ ( "GL_INDEX_CLEAR_VALUE", GLint, ["ctx->Color.ClearIndex"], "", NoState, NoExt ),
( "GL_INDEX_MODE", GLboolean, ["GL_FALSE"],
- "", None ),
- ( "GL_INDEX_OFFSET", GLint, ["ctx->Pixel.IndexOffset"], "", None ),
- ( "GL_INDEX_SHIFT", GLint, ["ctx->Pixel.IndexShift"], "", None ),
- ( "GL_INDEX_WRITEMASK", GLint, ["ctx->Color.IndexMask"], "", None ),
- ( "GL_LIGHT0", GLboolean, ["ctx->Light.Light[0].Enabled"], "", None ),
- ( "GL_LIGHT1", GLboolean, ["ctx->Light.Light[1].Enabled"], "", None ),
- ( "GL_LIGHT2", GLboolean, ["ctx->Light.Light[2].Enabled"], "", None ),
- ( "GL_LIGHT3", GLboolean, ["ctx->Light.Light[3].Enabled"], "", None ),
- ( "GL_LIGHT4", GLboolean, ["ctx->Light.Light[4].Enabled"], "", None ),
- ( "GL_LIGHT5", GLboolean, ["ctx->Light.Light[5].Enabled"], "", None ),
- ( "GL_LIGHT6", GLboolean, ["ctx->Light.Light[6].Enabled"], "", None ),
- ( "GL_LIGHT7", GLboolean, ["ctx->Light.Light[7].Enabled"], "", None ),
- ( "GL_LIGHTING", GLboolean, ["ctx->Light.Enabled"], "", None ),
+ "", NoState, NoExt ),
+ ( "GL_INDEX_OFFSET", GLint, ["ctx->Pixel.IndexOffset"], "", NoState, NoExt ),
+ ( "GL_INDEX_SHIFT", GLint, ["ctx->Pixel.IndexShift"], "", NoState, NoExt ),
+ ( "GL_INDEX_WRITEMASK", GLint, ["ctx->Color.IndexMask"], "", NoState, NoExt ),
+ ( "GL_LIGHT0", GLboolean, ["ctx->Light.Light[0].Enabled"], "", NoState, NoExt ),
+ ( "GL_LIGHT1", GLboolean, ["ctx->Light.Light[1].Enabled"], "", NoState, NoExt ),
+ ( "GL_LIGHT2", GLboolean, ["ctx->Light.Light[2].Enabled"], "", NoState, NoExt ),
+ ( "GL_LIGHT3", GLboolean, ["ctx->Light.Light[3].Enabled"], "", NoState, NoExt ),
+ ( "GL_LIGHT4", GLboolean, ["ctx->Light.Light[4].Enabled"], "", NoState, NoExt ),
+ ( "GL_LIGHT5", GLboolean, ["ctx->Light.Light[5].Enabled"], "", NoState, NoExt ),
+ ( "GL_LIGHT6", GLboolean, ["ctx->Light.Light[6].Enabled"], "", NoState, NoExt ),
+ ( "GL_LIGHT7", GLboolean, ["ctx->Light.Light[7].Enabled"], "", NoState, NoExt ),
+ ( "GL_LIGHTING", GLboolean, ["ctx->Light.Enabled"], "", NoState, NoExt ),
( "GL_LIGHT_MODEL_AMBIENT", GLfloatN,
["ctx->Light.Model.Ambient[0]",
"ctx->Light.Model.Ambient[1]",
"ctx->Light.Model.Ambient[2]",
- "ctx->Light.Model.Ambient[3]"], "", None ),
+ "ctx->Light.Model.Ambient[3]"], "", NoState, NoExt ),
( "GL_LIGHT_MODEL_COLOR_CONTROL", GLenum,
- ["ctx->Light.Model.ColorControl"], "", None ),
+ ["ctx->Light.Model.ColorControl"], "", NoState, NoExt ),
( "GL_LIGHT_MODEL_LOCAL_VIEWER", GLboolean,
- ["ctx->Light.Model.LocalViewer"], "", None ),
- ( "GL_LIGHT_MODEL_TWO_SIDE", GLboolean, ["ctx->Light.Model.TwoSide"], "", None ),
- ( "GL_LINE_SMOOTH", GLboolean, ["ctx->Line.SmoothFlag"], "", None ),
- ( "GL_LINE_SMOOTH_HINT", GLenum, ["ctx->Hint.LineSmooth"], "", None ),
- ( "GL_LINE_STIPPLE", GLboolean, ["ctx->Line.StippleFlag"], "", None ),
- ( "GL_LINE_STIPPLE_PATTERN", GLint, ["ctx->Line.StipplePattern"], "", None ),
- ( "GL_LINE_STIPPLE_REPEAT", GLint, ["ctx->Line.StippleFactor"], "", None ),
- ( "GL_LINE_WIDTH", GLfloat, ["ctx->Line.Width"], "", None ),
+ ["ctx->Light.Model.LocalViewer"], "", NoState, NoExt ),
+ ( "GL_LIGHT_MODEL_TWO_SIDE", GLboolean, ["ctx->Light.Model.TwoSide"], "", NoState, NoExt ),
+ ( "GL_LINE_SMOOTH", GLboolean, ["ctx->Line.SmoothFlag"], "", NoState, NoExt ),
+ ( "GL_LINE_SMOOTH_HINT", GLenum, ["ctx->Hint.LineSmooth"], "", NoState, NoExt ),
+ ( "GL_LINE_STIPPLE", GLboolean, ["ctx->Line.StippleFlag"], "", NoState, NoExt ),
+ ( "GL_LINE_STIPPLE_PATTERN", GLint, ["ctx->Line.StipplePattern"], "", NoState, NoExt ),
+ ( "GL_LINE_STIPPLE_REPEAT", GLint, ["ctx->Line.StippleFactor"], "", NoState, NoExt ),
+ ( "GL_LINE_WIDTH", GLfloat, ["ctx->Line.Width"], "", NoState, NoExt ),
( "GL_LINE_WIDTH_GRANULARITY", GLfloat,
- ["ctx->Const.LineWidthGranularity"], "", None ),
+ ["ctx->Const.LineWidthGranularity"], "", NoState, NoExt ),
( "GL_LINE_WIDTH_RANGE", GLfloat,
["ctx->Const.MinLineWidthAA",
- "ctx->Const.MaxLineWidthAA"], "", None ),
+ "ctx->Const.MaxLineWidthAA"], "", NoState, NoExt ),
( "GL_ALIASED_LINE_WIDTH_RANGE", GLfloat,
["ctx->Const.MinLineWidth",
- "ctx->Const.MaxLineWidth"], "", None ),
- ( "GL_LIST_BASE", GLint, ["ctx->List.ListBase"], "", None ),
- ( "GL_LIST_INDEX", GLint, ["(ctx->ListState.CurrentList ? ctx->ListState.CurrentList->Name : 0)"], "", None ),
+ "ctx->Const.MaxLineWidth"], "", NoState, NoExt ),
+ ( "GL_LIST_BASE", GLint, ["ctx->List.ListBase"], "", NoState, NoExt ),
+ ( "GL_LIST_INDEX", GLint, ["(ctx->ListState.CurrentList ? ctx->ListState.CurrentList->Name : 0)"], "", NoState, NoExt ),
( "GL_LIST_MODE", GLenum, ["mode"],
"""GLenum mode;
if (!ctx->CompileFlag)
@@ -278,193 +287,195 @@ StateVars = [
else if (ctx->ExecuteFlag)
mode = GL_COMPILE_AND_EXECUTE;
else
- mode = GL_COMPILE;""", None ),
- ( "GL_INDEX_LOGIC_OP", GLboolean, ["ctx->Color.IndexLogicOpEnabled"], "", None ),
- ( "GL_COLOR_LOGIC_OP", GLboolean, ["ctx->Color.ColorLogicOpEnabled"], "", None ),
- ( "GL_LOGIC_OP_MODE", GLenum, ["ctx->Color.LogicOp"], "", None ),
- ( "GL_MAP1_COLOR_4", GLboolean, ["ctx->Eval.Map1Color4"], "", None ),
+ mode = GL_COMPILE;""", NoState, NoExt ),
+ ( "GL_INDEX_LOGIC_OP", GLboolean, ["ctx->Color.IndexLogicOpEnabled"], "", NoState, NoExt ),
+ ( "GL_COLOR_LOGIC_OP", GLboolean, ["ctx->Color.ColorLogicOpEnabled"], "", NoState, NoExt ),
+ ( "GL_LOGIC_OP_MODE", GLenum, ["ctx->Color.LogicOp"], "", NoState, NoExt ),
+ ( "GL_MAP1_COLOR_4", GLboolean, ["ctx->Eval.Map1Color4"], "", NoState, NoExt ),
( "GL_MAP1_GRID_DOMAIN", GLfloat,
["ctx->Eval.MapGrid1u1",
- "ctx->Eval.MapGrid1u2"], "", None ),
- ( "GL_MAP1_GRID_SEGMENTS", GLint, ["ctx->Eval.MapGrid1un"], "", None ),
- ( "GL_MAP1_INDEX", GLboolean, ["ctx->Eval.Map1Index"], "", None ),
- ( "GL_MAP1_NORMAL", GLboolean, ["ctx->Eval.Map1Normal"], "", None ),
- ( "GL_MAP1_TEXTURE_COORD_1", GLboolean, ["ctx->Eval.Map1TextureCoord1"], "", None ),
- ( "GL_MAP1_TEXTURE_COORD_2", GLboolean, ["ctx->Eval.Map1TextureCoord2"], "", None ),
- ( "GL_MAP1_TEXTURE_COORD_3", GLboolean, ["ctx->Eval.Map1TextureCoord3"], "", None ),
- ( "GL_MAP1_TEXTURE_COORD_4", GLboolean, ["ctx->Eval.Map1TextureCoord4"], "", None ),
- ( "GL_MAP1_VERTEX_3", GLboolean, ["ctx->Eval.Map1Vertex3"], "", None ),
- ( "GL_MAP1_VERTEX_4", GLboolean, ["ctx->Eval.Map1Vertex4"], "", None ),
- ( "GL_MAP2_COLOR_4", GLboolean, ["ctx->Eval.Map2Color4"], "", None ),
+ "ctx->Eval.MapGrid1u2"], "", NoState, NoExt ),
+ ( "GL_MAP1_GRID_SEGMENTS", GLint, ["ctx->Eval.MapGrid1un"], "", NoState, NoExt ),
+ ( "GL_MAP1_INDEX", GLboolean, ["ctx->Eval.Map1Index"], "", NoState, NoExt ),
+ ( "GL_MAP1_NORMAL", GLboolean, ["ctx->Eval.Map1Normal"], "", NoState, NoExt ),
+ ( "GL_MAP1_TEXTURE_COORD_1", GLboolean, ["ctx->Eval.Map1TextureCoord1"], "", NoState, NoExt ),
+ ( "GL_MAP1_TEXTURE_COORD_2", GLboolean, ["ctx->Eval.Map1TextureCoord2"], "", NoState, NoExt ),
+ ( "GL_MAP1_TEXTURE_COORD_3", GLboolean, ["ctx->Eval.Map1TextureCoord3"], "", NoState, NoExt ),
+ ( "GL_MAP1_TEXTURE_COORD_4", GLboolean, ["ctx->Eval.Map1TextureCoord4"], "", NoState, NoExt ),
+ ( "GL_MAP1_VERTEX_3", GLboolean, ["ctx->Eval.Map1Vertex3"], "", NoState, NoExt ),
+ ( "GL_MAP1_VERTEX_4", GLboolean, ["ctx->Eval.Map1Vertex4"], "", NoState, NoExt ),
+ ( "GL_MAP2_COLOR_4", GLboolean, ["ctx->Eval.Map2Color4"], "", NoState, NoExt ),
( "GL_MAP2_GRID_DOMAIN", GLfloat,
["ctx->Eval.MapGrid2u1",
"ctx->Eval.MapGrid2u2",
"ctx->Eval.MapGrid2v1",
- "ctx->Eval.MapGrid2v2"], "", None ),
+ "ctx->Eval.MapGrid2v2"], "", NoState, NoExt ),
( "GL_MAP2_GRID_SEGMENTS", GLint,
["ctx->Eval.MapGrid2un",
- "ctx->Eval.MapGrid2vn"], "", None ),
- ( "GL_MAP2_INDEX", GLboolean, ["ctx->Eval.Map2Index"], "", None ),
- ( "GL_MAP2_NORMAL", GLboolean, ["ctx->Eval.Map2Normal"], "", None ),
- ( "GL_MAP2_TEXTURE_COORD_1", GLboolean, ["ctx->Eval.Map2TextureCoord1"], "", None ),
- ( "GL_MAP2_TEXTURE_COORD_2", GLboolean, ["ctx->Eval.Map2TextureCoord2"], "", None ),
- ( "GL_MAP2_TEXTURE_COORD_3", GLboolean, ["ctx->Eval.Map2TextureCoord3"], "", None ),
- ( "GL_MAP2_TEXTURE_COORD_4", GLboolean, ["ctx->Eval.Map2TextureCoord4"], "", None ),
- ( "GL_MAP2_VERTEX_3", GLboolean, ["ctx->Eval.Map2Vertex3"], "", None ),
- ( "GL_MAP2_VERTEX_4", GLboolean, ["ctx->Eval.Map2Vertex4"], "", None ),
- ( "GL_MAP_COLOR", GLboolean, ["ctx->Pixel.MapColorFlag"], "", None ),
- ( "GL_MAP_STENCIL", GLboolean, ["ctx->Pixel.MapStencilFlag"], "", None ),
- ( "GL_MATRIX_MODE", GLenum, ["ctx->Transform.MatrixMode"], "", None ),
-
- ( "GL_MAX_ATTRIB_STACK_DEPTH", GLint, ["MAX_ATTRIB_STACK_DEPTH"], "", None ),
- ( "GL_MAX_CLIENT_ATTRIB_STACK_DEPTH", GLint, ["MAX_CLIENT_ATTRIB_STACK_DEPTH"], "", None ),
- ( "GL_MAX_CLIP_PLANES", GLint, ["ctx->Const.MaxClipPlanes"], "", None ),
- ( "GL_MAX_ELEMENTS_VERTICES", GLint, ["ctx->Const.MaxArrayLockSize"], "", None ),
- ( "GL_MAX_ELEMENTS_INDICES", GLint, ["ctx->Const.MaxArrayLockSize"], "", None ),
- ( "GL_MAX_EVAL_ORDER", GLint, ["MAX_EVAL_ORDER"], "", None ),
- ( "GL_MAX_LIGHTS", GLint, ["ctx->Const.MaxLights"], "", None ),
- ( "GL_MAX_LIST_NESTING", GLint, ["MAX_LIST_NESTING"], "", None ),
- ( "GL_MAX_MODELVIEW_STACK_DEPTH", GLint, ["MAX_MODELVIEW_STACK_DEPTH"], "", None ),
- ( "GL_MAX_NAME_STACK_DEPTH", GLint, ["MAX_NAME_STACK_DEPTH"], "", None ),
- ( "GL_MAX_PIXEL_MAP_TABLE", GLint, ["MAX_PIXEL_MAP_TABLE"], "", None ),
- ( "GL_MAX_PROJECTION_STACK_DEPTH", GLint, ["MAX_PROJECTION_STACK_DEPTH"], "", None ),
- ( "GL_MAX_TEXTURE_SIZE", GLint, ["1 << (ctx->Const.MaxTextureLevels - 1)"], "", None ),
- ( "GL_MAX_3D_TEXTURE_SIZE", GLint, ["1 << (ctx->Const.Max3DTextureLevels - 1)"], "", None ),
- ( "GL_MAX_TEXTURE_STACK_DEPTH", GLint, ["MAX_TEXTURE_STACK_DEPTH"], "", None ),
+ "ctx->Eval.MapGrid2vn"], "", NoState, NoExt ),
+ ( "GL_MAP2_INDEX", GLboolean, ["ctx->Eval.Map2Index"], "", NoState, NoExt ),
+ ( "GL_MAP2_NORMAL", GLboolean, ["ctx->Eval.Map2Normal"], "", NoState, NoExt ),
+ ( "GL_MAP2_TEXTURE_COORD_1", GLboolean, ["ctx->Eval.Map2TextureCoord1"], "", NoState, NoExt ),
+ ( "GL_MAP2_TEXTURE_COORD_2", GLboolean, ["ctx->Eval.Map2TextureCoord2"], "", NoState, NoExt ),
+ ( "GL_MAP2_TEXTURE_COORD_3", GLboolean, ["ctx->Eval.Map2TextureCoord3"], "", NoState, NoExt ),
+ ( "GL_MAP2_TEXTURE_COORD_4", GLboolean, ["ctx->Eval.Map2TextureCoord4"], "", NoState, NoExt ),
+ ( "GL_MAP2_VERTEX_3", GLboolean, ["ctx->Eval.Map2Vertex3"], "", NoState, NoExt ),
+ ( "GL_MAP2_VERTEX_4", GLboolean, ["ctx->Eval.Map2Vertex4"], "", NoState, NoExt ),
+ ( "GL_MAP_COLOR", GLboolean, ["ctx->Pixel.MapColorFlag"], "", NoState, NoExt ),
+ ( "GL_MAP_STENCIL", GLboolean, ["ctx->Pixel.MapStencilFlag"], "", NoState, NoExt ),
+ ( "GL_MATRIX_MODE", GLenum, ["ctx->Transform.MatrixMode"], "", NoState, NoExt ),
+
+ ( "GL_MAX_ATTRIB_STACK_DEPTH", GLint, ["MAX_ATTRIB_STACK_DEPTH"], "", NoState, NoExt ),
+ ( "GL_MAX_CLIENT_ATTRIB_STACK_DEPTH", GLint, ["MAX_CLIENT_ATTRIB_STACK_DEPTH"], "", NoState, NoExt ),
+ ( "GL_MAX_CLIP_PLANES", GLint, ["ctx->Const.MaxClipPlanes"], "", NoState, NoExt ),
+ ( "GL_MAX_ELEMENTS_VERTICES", GLint, ["ctx->Const.MaxArrayLockSize"], "", NoState, NoExt ),
+ ( "GL_MAX_ELEMENTS_INDICES", GLint, ["ctx->Const.MaxArrayLockSize"], "", NoState, NoExt ),
+ ( "GL_MAX_EVAL_ORDER", GLint, ["MAX_EVAL_ORDER"], "", NoState, NoExt ),
+ ( "GL_MAX_LIGHTS", GLint, ["ctx->Const.MaxLights"], "", NoState, NoExt ),
+ ( "GL_MAX_LIST_NESTING", GLint, ["MAX_LIST_NESTING"], "", NoState, NoExt ),
+ ( "GL_MAX_MODELVIEW_STACK_DEPTH", GLint, ["MAX_MODELVIEW_STACK_DEPTH"], "", NoState, NoExt ),
+ ( "GL_MAX_NAME_STACK_DEPTH", GLint, ["MAX_NAME_STACK_DEPTH"], "", NoState, NoExt ),
+ ( "GL_MAX_PIXEL_MAP_TABLE", GLint, ["MAX_PIXEL_MAP_TABLE"], "", NoState, NoExt ),
+ ( "GL_MAX_PROJECTION_STACK_DEPTH", GLint, ["MAX_PROJECTION_STACK_DEPTH"], "", NoState, NoExt ),
+ ( "GL_MAX_TEXTURE_SIZE", GLint, ["1 << (ctx->Const.MaxTextureLevels - 1)"], "", NoState, NoExt ),
+ ( "GL_MAX_3D_TEXTURE_SIZE", GLint, ["1 << (ctx->Const.Max3DTextureLevels - 1)"], "", NoState, NoExt ),
+ ( "GL_MAX_TEXTURE_STACK_DEPTH", GLint, ["MAX_TEXTURE_STACK_DEPTH"], "", NoState, NoExt ),
( "GL_MAX_VIEWPORT_DIMS", GLint,
["ctx->Const.MaxViewportWidth", "ctx->Const.MaxViewportHeight"],
- "", None ),
+ "", NoState, NoExt ),
( "GL_MODELVIEW_MATRIX", GLfloat,
[ "matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]",
"matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]",
"matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]",
"matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ],
- "const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m;", None ),
- ( "GL_MODELVIEW_STACK_DEPTH", GLint, ["ctx->ModelviewMatrixStack.Depth + 1"], "", None ),
- ( "GL_NAME_STACK_DEPTH", GLint, ["ctx->Select.NameStackDepth"], "", None ),
- ( "GL_NORMALIZE", GLboolean, ["ctx->Transform.Normalize"], "", None ),
- ( "GL_PACK_ALIGNMENT", GLint, ["ctx->Pack.Alignment"], "", None ),
- ( "GL_PACK_LSB_FIRST", GLboolean, ["ctx->Pack.LsbFirst"], "", None ),
- ( "GL_PACK_ROW_LENGTH", GLint, ["ctx->Pack.RowLength"], "", None ),
- ( "GL_PACK_SKIP_PIXELS", GLint, ["ctx->Pack.SkipPixels"], "", None ),
- ( "GL_PACK_SKIP_ROWS", GLint, ["ctx->Pack.SkipRows"], "", None ),
- ( "GL_PACK_SWAP_BYTES", GLboolean, ["ctx->Pack.SwapBytes"], "", None ),
- ( "GL_PACK_SKIP_IMAGES_EXT", GLint, ["ctx->Pack.SkipImages"], "", None ),
- ( "GL_PACK_IMAGE_HEIGHT_EXT", GLint, ["ctx->Pack.ImageHeight"], "", None ),
- ( "GL_PACK_INVERT_MESA", GLboolean, ["ctx->Pack.Invert"], "", None ),
+ "const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m;", NoState, NoExt ),
+ ( "GL_MODELVIEW_STACK_DEPTH", GLint, ["ctx->ModelviewMatrixStack.Depth + 1"], "", NoState, NoExt ),
+ ( "GL_NAME_STACK_DEPTH", GLint, ["ctx->Select.NameStackDepth"], "", NoState, NoExt ),
+ ( "GL_NORMALIZE", GLboolean, ["ctx->Transform.Normalize"], "", NoState, NoExt ),
+ ( "GL_PACK_ALIGNMENT", GLint, ["ctx->Pack.Alignment"], "", NoState, NoExt ),
+ ( "GL_PACK_LSB_FIRST", GLboolean, ["ctx->Pack.LsbFirst"], "", NoState, NoExt ),
+ ( "GL_PACK_ROW_LENGTH", GLint, ["ctx->Pack.RowLength"], "", NoState, NoExt ),
+ ( "GL_PACK_SKIP_PIXELS", GLint, ["ctx->Pack.SkipPixels"], "", NoState, NoExt ),
+ ( "GL_PACK_SKIP_ROWS", GLint, ["ctx->Pack.SkipRows"], "", NoState, NoExt ),
+ ( "GL_PACK_SWAP_BYTES", GLboolean, ["ctx->Pack.SwapBytes"], "", NoState, NoExt ),
+ ( "GL_PACK_SKIP_IMAGES_EXT", GLint, ["ctx->Pack.SkipImages"], "", NoState, NoExt ),
+ ( "GL_PACK_IMAGE_HEIGHT_EXT", GLint, ["ctx->Pack.ImageHeight"], "", NoState, NoExt ),
+ ( "GL_PACK_INVERT_MESA", GLboolean, ["ctx->Pack.Invert"], "", NoState, NoExt ),
( "GL_PERSPECTIVE_CORRECTION_HINT", GLenum,
- ["ctx->Hint.PerspectiveCorrection"], "", None ),
- ( "GL_PIXEL_MAP_A_TO_A_SIZE", GLint, ["ctx->PixelMaps.AtoA.Size"], "", None ),
- ( "GL_PIXEL_MAP_B_TO_B_SIZE", GLint, ["ctx->PixelMaps.BtoB.Size"], "", None ),
- ( "GL_PIXEL_MAP_G_TO_G_SIZE", GLint, ["ctx->PixelMaps.GtoG.Size"], "", None ),
- ( "GL_PIXEL_MAP_I_TO_A_SIZE", GLint, ["ctx->PixelMaps.ItoA.Size"], "", None ),
- ( "GL_PIXEL_MAP_I_TO_B_SIZE", GLint, ["ctx->PixelMaps.ItoB.Size"], "", None ),
- ( "GL_PIXEL_MAP_I_TO_G_SIZE", GLint, ["ctx->PixelMaps.ItoG.Size"], "", None ),
- ( "GL_PIXEL_MAP_I_TO_I_SIZE", GLint, ["ctx->PixelMaps.ItoI.Size"], "", None ),
- ( "GL_PIXEL_MAP_I_TO_R_SIZE", GLint, ["ctx->PixelMaps.ItoR.Size"], "", None ),
- ( "GL_PIXEL_MAP_R_TO_R_SIZE", GLint, ["ctx->PixelMaps.RtoR.Size"], "", None ),
- ( "GL_PIXEL_MAP_S_TO_S_SIZE", GLint, ["ctx->PixelMaps.StoS.Size"], "", None ),
- ( "GL_POINT_SIZE", GLfloat, ["ctx->Point.Size"], "", None ),
+ ["ctx->Hint.PerspectiveCorrection"], "", NoState, NoExt ),
+ ( "GL_PIXEL_MAP_A_TO_A_SIZE", GLint, ["ctx->PixelMaps.AtoA.Size"], "", NoState, NoExt ),
+ ( "GL_PIXEL_MAP_B_TO_B_SIZE", GLint, ["ctx->PixelMaps.BtoB.Size"], "", NoState, NoExt ),
+ ( "GL_PIXEL_MAP_G_TO_G_SIZE", GLint, ["ctx->PixelMaps.GtoG.Size"], "", NoState, NoExt ),
+ ( "GL_PIXEL_MAP_I_TO_A_SIZE", GLint, ["ctx->PixelMaps.ItoA.Size"], "", NoState, NoExt ),
+ ( "GL_PIXEL_MAP_I_TO_B_SIZE", GLint, ["ctx->PixelMaps.ItoB.Size"], "", NoState, NoExt ),
+ ( "GL_PIXEL_MAP_I_TO_G_SIZE", GLint, ["ctx->PixelMaps.ItoG.Size"], "", NoState, NoExt ),
+ ( "GL_PIXEL_MAP_I_TO_I_SIZE", GLint, ["ctx->PixelMaps.ItoI.Size"], "", NoState, NoExt ),
+ ( "GL_PIXEL_MAP_I_TO_R_SIZE", GLint, ["ctx->PixelMaps.ItoR.Size"], "", NoState, NoExt ),
+ ( "GL_PIXEL_MAP_R_TO_R_SIZE", GLint, ["ctx->PixelMaps.RtoR.Size"], "", NoState, NoExt ),
+ ( "GL_PIXEL_MAP_S_TO_S_SIZE", GLint, ["ctx->PixelMaps.StoS.Size"], "", NoState, NoExt ),
+ ( "GL_POINT_SIZE", GLfloat, ["ctx->Point.Size"], "", NoState, NoExt ),
( "GL_POINT_SIZE_GRANULARITY", GLfloat,
- ["ctx->Const.PointSizeGranularity"], "", None ),
+ ["ctx->Const.PointSizeGranularity"], "", NoState, NoExt ),
( "GL_POINT_SIZE_RANGE", GLfloat,
["ctx->Const.MinPointSizeAA",
- "ctx->Const.MaxPointSizeAA"], "", None ),
+ "ctx->Const.MaxPointSizeAA"], "", NoState, NoExt ),
( "GL_ALIASED_POINT_SIZE_RANGE", GLfloat,
["ctx->Const.MinPointSize",
- "ctx->Const.MaxPointSize"], "", None ),
- ( "GL_POINT_SMOOTH", GLboolean, ["ctx->Point.SmoothFlag"], "", None ),
- ( "GL_POINT_SMOOTH_HINT", GLenum, ["ctx->Hint.PointSmooth"], "", None ),
- ( "GL_POINT_SIZE_MIN_EXT", GLfloat, ["ctx->Point.MinSize"], "", None ),
- ( "GL_POINT_SIZE_MAX_EXT", GLfloat, ["ctx->Point.MaxSize"], "", None ),
+ "ctx->Const.MaxPointSize"], "", NoState, NoExt ),
+ ( "GL_POINT_SMOOTH", GLboolean, ["ctx->Point.SmoothFlag"], "", NoState, NoExt ),
+ ( "GL_POINT_SMOOTH_HINT", GLenum, ["ctx->Hint.PointSmooth"], "", NoState, NoExt ),
+ ( "GL_POINT_SIZE_MIN_EXT", GLfloat, ["ctx->Point.MinSize"], "", NoState, NoExt ),
+ ( "GL_POINT_SIZE_MAX_EXT", GLfloat, ["ctx->Point.MaxSize"], "", NoState, NoExt ),
( "GL_POINT_FADE_THRESHOLD_SIZE_EXT", GLfloat,
- ["ctx->Point.Threshold"], "", None ),
+ ["ctx->Point.Threshold"], "", NoState, NoExt ),
( "GL_DISTANCE_ATTENUATION_EXT", GLfloat,
["ctx->Point.Params[0]",
"ctx->Point.Params[1]",
- "ctx->Point.Params[2]"], "", None ),
+ "ctx->Point.Params[2]"], "", NoState, NoExt ),
( "GL_POLYGON_MODE", GLenum,
["ctx->Polygon.FrontMode",
- "ctx->Polygon.BackMode"], "", None ),
- ( "GL_POLYGON_OFFSET_BIAS_EXT", GLfloat, ["ctx->Polygon.OffsetUnits"], "", None ),
- ( "GL_POLYGON_OFFSET_FACTOR", GLfloat, ["ctx->Polygon.OffsetFactor "], "", None ),
- ( "GL_POLYGON_OFFSET_UNITS", GLfloat, ["ctx->Polygon.OffsetUnits "], "", None ),
- ( "GL_POLYGON_OFFSET_POINT", GLboolean, ["ctx->Polygon.OffsetPoint"], "", None ),
- ( "GL_POLYGON_OFFSET_LINE", GLboolean, ["ctx->Polygon.OffsetLine"], "", None ),
- ( "GL_POLYGON_OFFSET_FILL", GLboolean, ["ctx->Polygon.OffsetFill"], "", None ),
- ( "GL_POLYGON_SMOOTH", GLboolean, ["ctx->Polygon.SmoothFlag"], "", None ),
- ( "GL_POLYGON_SMOOTH_HINT", GLenum, ["ctx->Hint.PolygonSmooth"], "", None ),
- ( "GL_POLYGON_STIPPLE", GLboolean, ["ctx->Polygon.StippleFlag"], "", None ),
+ "ctx->Polygon.BackMode"], "", NoState, NoExt ),
+ ( "GL_POLYGON_OFFSET_BIAS_EXT", GLfloat, ["ctx->Polygon.OffsetUnits"], "", NoState, NoExt ),
+ ( "GL_POLYGON_OFFSET_FACTOR", GLfloat, ["ctx->Polygon.OffsetFactor "], "", NoState, NoExt ),
+ ( "GL_POLYGON_OFFSET_UNITS", GLfloat, ["ctx->Polygon.OffsetUnits "], "", NoState, NoExt ),
+ ( "GL_POLYGON_OFFSET_POINT", GLboolean, ["ctx->Polygon.OffsetPoint"], "", NoState, NoExt ),
+ ( "GL_POLYGON_OFFSET_LINE", GLboolean, ["ctx->Polygon.OffsetLine"], "", NoState, NoExt ),
+ ( "GL_POLYGON_OFFSET_FILL", GLboolean, ["ctx->Polygon.OffsetFill"], "", NoState, NoExt ),
+ ( "GL_POLYGON_SMOOTH", GLboolean, ["ctx->Polygon.SmoothFlag"], "", NoState, NoExt ),
+ ( "GL_POLYGON_SMOOTH_HINT", GLenum, ["ctx->Hint.PolygonSmooth"], "", NoState, NoExt ),
+ ( "GL_POLYGON_STIPPLE", GLboolean, ["ctx->Polygon.StippleFlag"], "", NoState, NoExt ),
( "GL_PROJECTION_MATRIX", GLfloat,
[ "matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]",
"matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]",
"matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]",
"matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ],
- "const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m;", None ),
+ "const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m;", NoState, NoExt ),
( "GL_PROJECTION_STACK_DEPTH", GLint,
- ["ctx->ProjectionMatrixStack.Depth + 1"], "", None ),
- ( "GL_READ_BUFFER", GLenum, ["ctx->ReadBuffer->ColorReadBuffer"], "", None ),
- ( "GL_RED_BIAS", GLfloat, ["ctx->Pixel.RedBias"], "", None ),
- ( "GL_RED_BITS", GLint, ["ctx->DrawBuffer->Visual.redBits"], "", None ),
- ( "GL_RED_SCALE", GLfloat, ["ctx->Pixel.RedScale"], "", None ),
- ( "GL_RENDER_MODE", GLenum, ["ctx->RenderMode"], "", None ),
+ ["ctx->ProjectionMatrixStack.Depth + 1"], "", NoState, NoExt ),
+ ( "GL_READ_BUFFER", GLenum, ["ctx->ReadBuffer->ColorReadBuffer"], "", NoState, NoExt ),
+ ( "GL_RED_BIAS", GLfloat, ["ctx->Pixel.RedBias"], "", NoState, NoExt ),
+ ( "GL_RED_BITS", GLint, ["ctx->DrawBuffer->Visual.redBits"], "", "_NEW_BUFFERS", NoExt ),
+ ( "GL_RED_SCALE", GLfloat, ["ctx->Pixel.RedScale"], "", NoState, NoExt ),
+ ( "GL_RENDER_MODE", GLenum, ["ctx->RenderMode"], "", NoState, NoExt ),
( "GL_RESCALE_NORMAL", GLboolean,
- ["ctx->Transform.RescaleNormals"], "", None ),
+ ["ctx->Transform.RescaleNormals"], "", NoState, NoExt ),
( "GL_RGBA_MODE", GLboolean, ["GL_TRUE"],
- "", None ),
+ "", NoState, NoExt ),
( "GL_SCISSOR_BOX", GLint,
["ctx->Scissor.X",
"ctx->Scissor.Y",
"ctx->Scissor.Width",
- "ctx->Scissor.Height"], "", None ),
- ( "GL_SCISSOR_TEST", GLboolean, ["ctx->Scissor.Enabled"], "", None ),
- ( "GL_SELECTION_BUFFER_SIZE", GLint, ["ctx->Select.BufferSize"], "", None ),
- ( "GL_SHADE_MODEL", GLenum, ["ctx->Light.ShadeModel"], "", None ),
+ "ctx->Scissor.Height"], "", NoState, NoExt ),
+ ( "GL_SCISSOR_TEST", GLboolean, ["ctx->Scissor.Enabled"], "", NoState, NoExt ),
+ ( "GL_SELECTION_BUFFER_SIZE", GLint, ["ctx->Select.BufferSize"], "", NoState, NoExt ),
+ ( "GL_SHADE_MODEL", GLenum, ["ctx->Light.ShadeModel"], "", NoState, NoExt ),
( "GL_SHARED_TEXTURE_PALETTE_EXT", GLboolean,
- ["ctx->Texture.SharedPalette"], "", None ),
- ( "GL_STENCIL_BITS", GLint, ["ctx->DrawBuffer->Visual.stencilBits"], "", None ),
- ( "GL_STENCIL_CLEAR_VALUE", GLint, ["ctx->Stencil.Clear"], "", None ),
+ ["ctx->Texture.SharedPalette"], "", NoState, NoExt ),
+ ( "GL_STENCIL_BITS", GLint, ["ctx->DrawBuffer->Visual.stencilBits"], "", NoState, NoExt ),
+ ( "GL_STENCIL_CLEAR_VALUE", GLint, ["ctx->Stencil.Clear"], "", NoState, NoExt ),
( "GL_STENCIL_FAIL", GLenum,
- ["ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]"], "", None ),
+ ["ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]"], "", NoState, NoExt ),
( "GL_STENCIL_FUNC", GLenum,
- ["ctx->Stencil.Function[ctx->Stencil.ActiveFace]"], "", None ),
+ ["ctx->Stencil.Function[ctx->Stencil.ActiveFace]"], "", NoState, NoExt ),
( "GL_STENCIL_PASS_DEPTH_FAIL", GLenum,
- ["ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]"], "", None ),
+ ["ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]"], "", NoState, NoExt ),
( "GL_STENCIL_PASS_DEPTH_PASS", GLenum,
- ["ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]"], "", None ),
+ ["ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]"], "", NoState, NoExt ),
( "GL_STENCIL_REF", GLint,
- ["ctx->Stencil.Ref[ctx->Stencil.ActiveFace]"], "", None ),
- ( "GL_STENCIL_TEST", GLboolean, ["ctx->Stencil.Enabled"], "", None ),
+ ["ctx->Stencil.Ref[ctx->Stencil.ActiveFace]"], "", NoState, NoExt ),
+ ( "GL_STENCIL_TEST", GLboolean, ["ctx->Stencil.Enabled"], "", NoState, NoExt ),
( "GL_STENCIL_VALUE_MASK", GLint,
- ["ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]"], "", None ),
+ ["ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]"], "", NoState, NoExt ),
( "GL_STENCIL_WRITEMASK", GLint,
- ["ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]"], "", None ),
+ ["ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]"], "", NoState, NoExt ),
( "GL_STEREO", GLboolean, ["ctx->DrawBuffer->Visual.stereoMode"],
- "", None ),
- ( "GL_SUBPIXEL_BITS", GLint, ["ctx->Const.SubPixelBits"], "", None ),
- ( "GL_TEXTURE_1D", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_1D)"], "", None ),
- ( "GL_TEXTURE_2D", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_2D)"], "", None ),
- ( "GL_TEXTURE_3D", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_3D)"], "", None ),
- ( "GL_TEXTURE_1D_ARRAY_EXT", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_1D_ARRAY_EXT)"], "", ["MESA_texture_array"] ),
- ( "GL_TEXTURE_2D_ARRAY_EXT", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_2D_ARRAY_EXT)"], "", ["MESA_texture_array"] ),
+ "", NoState, NoExt ),
+ ( "GL_SUBPIXEL_BITS", GLint, ["ctx->Const.SubPixelBits"], "", NoState, NoExt ),
+ ( "GL_TEXTURE_1D", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_1D)"], "", NoState, NoExt ),
+ ( "GL_TEXTURE_2D", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_2D)"], "", NoState, NoExt ),
+ ( "GL_TEXTURE_3D", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_3D)"], "", NoState, NoExt ),
+ ( "GL_TEXTURE_1D_ARRAY_EXT", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_1D_ARRAY_EXT)"], "", NoState, ["MESA_texture_array"] ),
+ ( "GL_TEXTURE_2D_ARRAY_EXT", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_2D_ARRAY_EXT)"], "", NoState, ["MESA_texture_array"] ),
( "GL_TEXTURE_BINDING_1D", GLint,
- ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_INDEX]->Name"], "", None ),
+ ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_INDEX]->Name"], "", NoState, NoExt ),
( "GL_TEXTURE_BINDING_2D", GLint,
- ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_INDEX]->Name"], "", None ),
+ ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_INDEX]->Name"], "", NoState, NoExt ),
( "GL_TEXTURE_BINDING_3D", GLint,
- ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_3D_INDEX]->Name"], "", None ),
+ ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_3D_INDEX]->Name"], "", NoState, NoExt ),
( "GL_TEXTURE_BINDING_1D_ARRAY_EXT", GLint,
- ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_ARRAY_INDEX]->Name"], "", ["MESA_texture_array"] ),
+ ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_ARRAY_INDEX]->Name"], "", NoState, ["MESA_texture_array"] ),
( "GL_TEXTURE_BINDING_2D_ARRAY_EXT", GLint,
- ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_ARRAY_INDEX]->Name"], "", ["MESA_texture_array"] ),
+ ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_ARRAY_INDEX]->Name"], "", NoState, ["MESA_texture_array"] ),
+ ( "GL_MAX_ARRAY_TEXTURE_LAYERS_EXT", GLint,
+ ["ctx->Const.MaxArrayTextureLayers"], "", NoState, ["MESA_texture_array"] ),
( "GL_TEXTURE_GEN_S", GLboolean,
- ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0)"], "", None ),
+ ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0)"], "", NoState, NoExt ),
( "GL_TEXTURE_GEN_T", GLboolean,
- ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & T_BIT) ? 1 : 0)"], "", None ),
+ ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & T_BIT) ? 1 : 0)"], "", NoState, NoExt ),
( "GL_TEXTURE_GEN_R", GLboolean,
- ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & R_BIT) ? 1 : 0)"], "", None ),
+ ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & R_BIT) ? 1 : 0)"], "", NoState, NoExt ),
( "GL_TEXTURE_GEN_Q", GLboolean,
- ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & Q_BIT) ? 1 : 0)"], "", None ),
+ ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & Q_BIT) ? 1 : 0)"], "", NoState, NoExt ),
( "GL_TEXTURE_MATRIX", GLfloat,
["matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]",
"matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]",
@@ -478,7 +489,7 @@ StateVars = [
return;
}
matrix = ctx->TextureMatrixStack[unit].Top->m;""",
- None ),
+ NoState, NoExt ),
( "GL_TEXTURE_STACK_DEPTH", GLint,
["ctx->TextureMatrixStack[unit].Depth + 1"],
"""const GLuint unit = ctx->Texture.CurrentUnit;
@@ -487,77 +498,77 @@ StateVars = [
"glGet(texture stack depth, unit %u)", unit);
return;
}""",
- None ),
- ( "GL_UNPACK_ALIGNMENT", GLint, ["ctx->Unpack.Alignment"], "", None ),
- ( "GL_UNPACK_LSB_FIRST", GLboolean, ["ctx->Unpack.LsbFirst"], "", None ),
- ( "GL_UNPACK_ROW_LENGTH", GLint, ["ctx->Unpack.RowLength"], "", None ),
- ( "GL_UNPACK_SKIP_PIXELS", GLint, ["ctx->Unpack.SkipPixels"], "", None ),
- ( "GL_UNPACK_SKIP_ROWS", GLint, ["ctx->Unpack.SkipRows"], "", None ),
- ( "GL_UNPACK_SWAP_BYTES", GLboolean, ["ctx->Unpack.SwapBytes"], "", None ),
- ( "GL_UNPACK_SKIP_IMAGES_EXT", GLint, ["ctx->Unpack.SkipImages"], "", None ),
- ( "GL_UNPACK_IMAGE_HEIGHT_EXT", GLint, ["ctx->Unpack.ImageHeight"], "", None ),
- ( "GL_UNPACK_CLIENT_STORAGE_APPLE", GLboolean, ["ctx->Unpack.ClientStorage"], "", None ),
+ NoState, NoExt ),
+ ( "GL_UNPACK_ALIGNMENT", GLint, ["ctx->Unpack.Alignment"], "", NoState, NoExt ),
+ ( "GL_UNPACK_LSB_FIRST", GLboolean, ["ctx->Unpack.LsbFirst"], "", NoState, NoExt ),
+ ( "GL_UNPACK_ROW_LENGTH", GLint, ["ctx->Unpack.RowLength"], "", NoState, NoExt ),
+ ( "GL_UNPACK_SKIP_PIXELS", GLint, ["ctx->Unpack.SkipPixels"], "", NoState, NoExt ),
+ ( "GL_UNPACK_SKIP_ROWS", GLint, ["ctx->Unpack.SkipRows"], "", NoState, NoExt ),
+ ( "GL_UNPACK_SWAP_BYTES", GLboolean, ["ctx->Unpack.SwapBytes"], "", NoState, NoExt ),
+ ( "GL_UNPACK_SKIP_IMAGES_EXT", GLint, ["ctx->Unpack.SkipImages"], "", NoState, NoExt ),
+ ( "GL_UNPACK_IMAGE_HEIGHT_EXT", GLint, ["ctx->Unpack.ImageHeight"], "", NoState, NoExt ),
+ ( "GL_UNPACK_CLIENT_STORAGE_APPLE", GLboolean, ["ctx->Unpack.ClientStorage"], "", NoState, NoExt ),
( "GL_VIEWPORT", GLint, [ "ctx->Viewport.X", "ctx->Viewport.Y",
- "ctx->Viewport.Width", "ctx->Viewport.Height" ], "", None ),
- ( "GL_ZOOM_X", GLfloat, ["ctx->Pixel.ZoomX"], "", None ),
- ( "GL_ZOOM_Y", GLfloat, ["ctx->Pixel.ZoomY"], "", None ),
+ "ctx->Viewport.Width", "ctx->Viewport.Height" ], "", NoState, NoExt ),
+ ( "GL_ZOOM_X", GLfloat, ["ctx->Pixel.ZoomX"], "", NoState, NoExt ),
+ ( "GL_ZOOM_Y", GLfloat, ["ctx->Pixel.ZoomY"], "", NoState, NoExt ),
# Vertex arrays
- ( "GL_VERTEX_ARRAY", GLboolean, ["ctx->Array.ArrayObj->Vertex.Enabled"], "", None ),
- ( "GL_VERTEX_ARRAY_SIZE", GLint, ["ctx->Array.ArrayObj->Vertex.Size"], "", None ),
- ( "GL_VERTEX_ARRAY_TYPE", GLenum, ["ctx->Array.ArrayObj->Vertex.Type"], "", None ),
- ( "GL_VERTEX_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->Vertex.Stride"], "", None ),
- ( "GL_VERTEX_ARRAY_COUNT_EXT", GLint, ["0"], "", None ),
- ( "GL_NORMAL_ARRAY", GLenum, ["ctx->Array.ArrayObj->Normal.Enabled"], "", None ),
- ( "GL_NORMAL_ARRAY_TYPE", GLenum, ["ctx->Array.ArrayObj->Normal.Type"], "", None ),
- ( "GL_NORMAL_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->Normal.Stride"], "", None ),
- ( "GL_NORMAL_ARRAY_COUNT_EXT", GLint, ["0"], "", None ),
- ( "GL_COLOR_ARRAY", GLboolean, ["ctx->Array.ArrayObj->Color.Enabled"], "", None ),
- ( "GL_COLOR_ARRAY_SIZE", GLint, ["ctx->Array.ArrayObj->Color.Size"], "", None ),
- ( "GL_COLOR_ARRAY_TYPE", GLenum, ["ctx->Array.ArrayObj->Color.Type"], "", None ),
- ( "GL_COLOR_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->Color.Stride"], "", None ),
- ( "GL_COLOR_ARRAY_COUNT_EXT", GLint, ["0"], "", None ),
- ( "GL_INDEX_ARRAY", GLboolean, ["ctx->Array.ArrayObj->Index.Enabled"], "", None ),
- ( "GL_INDEX_ARRAY_TYPE", GLenum, ["ctx->Array.ArrayObj->Index.Type"], "", None ),
- ( "GL_INDEX_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->Index.Stride"], "", None ),
- ( "GL_INDEX_ARRAY_COUNT_EXT", GLint, ["0"], "", None ),
+ ( "GL_VERTEX_ARRAY", GLboolean, ["ctx->Array.ArrayObj->Vertex.Enabled"], "", NoState, NoExt ),
+ ( "GL_VERTEX_ARRAY_SIZE", GLint, ["ctx->Array.ArrayObj->Vertex.Size"], "", NoState, NoExt ),
+ ( "GL_VERTEX_ARRAY_TYPE", GLenum, ["ctx->Array.ArrayObj->Vertex.Type"], "", NoState, NoExt ),
+ ( "GL_VERTEX_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->Vertex.Stride"], "", NoState, NoExt ),
+ ( "GL_VERTEX_ARRAY_COUNT_EXT", GLint, ["0"], "", NoState, NoExt ),
+ ( "GL_NORMAL_ARRAY", GLenum, ["ctx->Array.ArrayObj->Normal.Enabled"], "", NoState, NoExt ),
+ ( "GL_NORMAL_ARRAY_TYPE", GLenum, ["ctx->Array.ArrayObj->Normal.Type"], "", NoState, NoExt ),
+ ( "GL_NORMAL_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->Normal.Stride"], "", NoState, NoExt ),
+ ( "GL_NORMAL_ARRAY_COUNT_EXT", GLint, ["0"], "", NoState, NoExt ),
+ ( "GL_COLOR_ARRAY", GLboolean, ["ctx->Array.ArrayObj->Color.Enabled"], "", NoState, NoExt ),
+ ( "GL_COLOR_ARRAY_SIZE", GLint, ["ctx->Array.ArrayObj->Color.Size"], "", NoState, NoExt ),
+ ( "GL_COLOR_ARRAY_TYPE", GLenum, ["ctx->Array.ArrayObj->Color.Type"], "", NoState, NoExt ),
+ ( "GL_COLOR_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->Color.Stride"], "", NoState, NoExt ),
+ ( "GL_COLOR_ARRAY_COUNT_EXT", GLint, ["0"], "", NoState, NoExt ),
+ ( "GL_INDEX_ARRAY", GLboolean, ["ctx->Array.ArrayObj->Index.Enabled"], "", NoState, NoExt ),
+ ( "GL_INDEX_ARRAY_TYPE", GLenum, ["ctx->Array.ArrayObj->Index.Type"], "", NoState, NoExt ),
+ ( "GL_INDEX_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->Index.Stride"], "", NoState, NoExt ),
+ ( "GL_INDEX_ARRAY_COUNT_EXT", GLint, ["0"], "", NoState, NoExt ),
( "GL_TEXTURE_COORD_ARRAY", GLboolean,
- ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Enabled"], "", None ),
+ ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Enabled"], "", NoState, NoExt ),
( "GL_TEXTURE_COORD_ARRAY_SIZE", GLint,
- ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Size"], "", None ),
+ ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Size"], "", NoState, NoExt ),
( "GL_TEXTURE_COORD_ARRAY_TYPE", GLenum,
- ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Type"], "", None ),
+ ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Type"], "", NoState, NoExt ),
( "GL_TEXTURE_COORD_ARRAY_STRIDE", GLint,
- ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Stride"], "", None ),
- ( "GL_TEXTURE_COORD_ARRAY_COUNT_EXT", GLint, ["0"], "", None ),
- ( "GL_EDGE_FLAG_ARRAY", GLboolean, ["ctx->Array.ArrayObj->EdgeFlag.Enabled"], "", None ),
- ( "GL_EDGE_FLAG_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->EdgeFlag.Stride"], "", None ),
- ( "GL_EDGE_FLAG_ARRAY_COUNT_EXT", GLint, ["0"], "", None ),
+ ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Stride"], "", NoState, NoExt ),
+ ( "GL_TEXTURE_COORD_ARRAY_COUNT_EXT", GLint, ["0"], "", NoState, NoExt ),
+ ( "GL_EDGE_FLAG_ARRAY", GLboolean, ["ctx->Array.ArrayObj->EdgeFlag.Enabled"], "", NoState, NoExt ),
+ ( "GL_EDGE_FLAG_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->EdgeFlag.Stride"], "", NoState, NoExt ),
+ ( "GL_EDGE_FLAG_ARRAY_COUNT_EXT", GLint, ["0"], "", NoState, NoExt ),
# GL_ARB_multitexture
( "GL_MAX_TEXTURE_UNITS_ARB", GLint,
- ["ctx->Const.MaxTextureUnits"], "", ["ARB_multitexture"] ),
+ ["ctx->Const.MaxTextureUnits"], "", NoState, ["ARB_multitexture"] ),
( "GL_ACTIVE_TEXTURE_ARB", GLint,
- [ "GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit"], "", ["ARB_multitexture"] ),
+ [ "GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit"], "", NoState, ["ARB_multitexture"] ),
( "GL_CLIENT_ACTIVE_TEXTURE_ARB", GLint,
- ["GL_TEXTURE0_ARB + ctx->Array.ActiveTexture"], "", ["ARB_multitexture"] ),
+ ["GL_TEXTURE0_ARB + ctx->Array.ActiveTexture"], "", NoState, ["ARB_multitexture"] ),
# GL_ARB_texture_cube_map
( "GL_TEXTURE_CUBE_MAP_ARB", GLboolean,
- ["_mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB)"], "", ["ARB_texture_cube_map"] ),
+ ["_mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB)"], "", NoState, ["ARB_texture_cube_map"] ),
( "GL_TEXTURE_BINDING_CUBE_MAP_ARB", GLint,
["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_CUBE_INDEX]->Name"],
- "", ["ARB_texture_cube_map"] ),
+ "", NoState, ["ARB_texture_cube_map"] ),
( "GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB", GLint,
["(1 << (ctx->Const.MaxCubeTextureLevels - 1))"],
- "", ["ARB_texture_cube_map"]),
+ "", NoState, ["ARB_texture_cube_map"]),
# GL_ARB_texture_compression */
( "GL_TEXTURE_COMPRESSION_HINT_ARB", GLint,
- ["ctx->Hint.TextureCompression"], "", None ),
+ ["ctx->Hint.TextureCompression"], "", NoState, NoExt ),
( "GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB", GLint,
["_mesa_get_compressed_formats(ctx, NULL, GL_FALSE)"],
- "", None ),
+ "", NoState, NoExt ),
( "GL_COMPRESSED_TEXTURE_FORMATS_ARB", GLenum,
[],
"""GLint formats[100];
@@ -565,13 +576,13 @@ StateVars = [
ASSERT(n <= 100);
for (i = 0; i < n; i++)
params[i] = CONVERSION(formats[i]);""",
- None ),
+ NoState, NoExt ),
# GL_EXT_compiled_vertex_array
( "GL_ARRAY_ELEMENT_LOCK_FIRST_EXT", GLint, ["ctx->Array.LockFirst"],
- "", ["EXT_compiled_vertex_array"] ),
+ "", NoState, ["EXT_compiled_vertex_array"] ),
( "GL_ARRAY_ELEMENT_LOCK_COUNT_EXT", GLint, ["ctx->Array.LockCount"],
- "", ["EXT_compiled_vertex_array"] ),
+ "", NoState, ["EXT_compiled_vertex_array"] ),
# GL_ARB_transpose_matrix
( "GL_TRANSPOSE_COLOR_MATRIX_ARB", GLfloat,
@@ -579,25 +590,29 @@ StateVars = [
"matrix[1]", "matrix[5]", "matrix[9]", "matrix[13]",
"matrix[2]", "matrix[6]", "matrix[10]", "matrix[14]",
"matrix[3]", "matrix[7]", "matrix[11]", "matrix[15]"],
- "const GLfloat *matrix = ctx->ColorMatrixStack.Top->m;", None ),
+ "const GLfloat *matrix = ctx->ColorMatrixStack.Top->m;",
+ NoState, NoExt ),
( "GL_TRANSPOSE_MODELVIEW_MATRIX_ARB", GLfloat,
["matrix[0]", "matrix[4]", "matrix[8]", "matrix[12]",
"matrix[1]", "matrix[5]", "matrix[9]", "matrix[13]",
"matrix[2]", "matrix[6]", "matrix[10]", "matrix[14]",
"matrix[3]", "matrix[7]", "matrix[11]", "matrix[15]"],
- "const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m;", None ),
+ "const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m;",
+ NoState, NoExt ),
( "GL_TRANSPOSE_PROJECTION_MATRIX_ARB", GLfloat,
["matrix[0]", "matrix[4]", "matrix[8]", "matrix[12]",
"matrix[1]", "matrix[5]", "matrix[9]", "matrix[13]",
"matrix[2]", "matrix[6]", "matrix[10]", "matrix[14]",
"matrix[3]", "matrix[7]", "matrix[11]", "matrix[15]"],
- "const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m;", None ),
+ "const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m;",
+ NoState, NoExt ),
( "GL_TRANSPOSE_TEXTURE_MATRIX_ARB", GLfloat,
["matrix[0]", "matrix[4]", "matrix[8]", "matrix[12]",
"matrix[1]", "matrix[5]", "matrix[9]", "matrix[13]",
"matrix[2]", "matrix[6]", "matrix[10]", "matrix[14]",
"matrix[3]", "matrix[7]", "matrix[11]", "matrix[15]"],
- "const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m;", None ),
+ "const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m;",
+ NoState, NoExt ),
# GL_SGI_color_matrix (also in 1.2 imaging)
( "GL_COLOR_MATRIX_SGI", GLfloat,
@@ -605,343 +620,373 @@ StateVars = [
"matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]",
"matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]",
"matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ],
- "const GLfloat *matrix = ctx->ColorMatrixStack.Top->m;", None ),
+ "const GLfloat *matrix = ctx->ColorMatrixStack.Top->m;",
+ NoState, NoExt ),
( "GL_COLOR_MATRIX_STACK_DEPTH_SGI", GLint,
- ["ctx->ColorMatrixStack.Depth + 1"], "", None ),
+ ["ctx->ColorMatrixStack.Depth + 1"], "", NoState, NoExt ),
( "GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI", GLint,
- ["MAX_COLOR_STACK_DEPTH"], "", None ),
+ ["MAX_COLOR_STACK_DEPTH"], "", NoState, NoExt ),
( "GL_POST_COLOR_MATRIX_RED_SCALE_SGI", GLfloat,
- ["ctx->Pixel.PostColorMatrixScale[0]"], "", None ),
+ ["ctx->Pixel.PostColorMatrixScale[0]"], "", NoState, NoExt ),
( "GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI", GLfloat,
- ["ctx->Pixel.PostColorMatrixScale[1]"], "", None ),
+ ["ctx->Pixel.PostColorMatrixScale[1]"], "", NoState, NoExt ),
( "GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI", GLfloat,
- ["ctx->Pixel.PostColorMatrixScale[2]"], "", None ),
+ ["ctx->Pixel.PostColorMatrixScale[2]"], "", NoState, NoExt ),
( "GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI", GLfloat,
- ["ctx->Pixel.PostColorMatrixScale[3]"], "", None ),
+ ["ctx->Pixel.PostColorMatrixScale[3]"], "", NoState, NoExt ),
( "GL_POST_COLOR_MATRIX_RED_BIAS_SGI", GLfloat,
- ["ctx->Pixel.PostColorMatrixBias[0]"], "", None ),
+ ["ctx->Pixel.PostColorMatrixBias[0]"], "", NoState, NoExt ),
( "GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI", GLfloat,
- ["ctx->Pixel.PostColorMatrixBias[1]"], "", None ),
+ ["ctx->Pixel.PostColorMatrixBias[1]"], "", NoState, NoExt ),
( "GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI", GLfloat,
- ["ctx->Pixel.PostColorMatrixBias[2]"], "", None ),
+ ["ctx->Pixel.PostColorMatrixBias[2]"], "", NoState, NoExt ),
( "GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI", GLfloat,
- ["ctx->Pixel.PostColorMatrixBias[3]"], "", None ),
+ ["ctx->Pixel.PostColorMatrixBias[3]"], "", NoState, NoExt ),
# GL_EXT_convolution (also in 1.2 imaging)
( "GL_CONVOLUTION_1D_EXT", GLboolean,
- ["ctx->Pixel.Convolution1DEnabled"], "", ["EXT_convolution"] ),
+ ["ctx->Pixel.Convolution1DEnabled"], "", NoState, ["EXT_convolution"] ),
( "GL_CONVOLUTION_2D_EXT", GLboolean,
- ["ctx->Pixel.Convolution2DEnabled"], "", ["EXT_convolution"] ),
+ ["ctx->Pixel.Convolution2DEnabled"], "", NoState, ["EXT_convolution"] ),
( "GL_SEPARABLE_2D_EXT", GLboolean,
- ["ctx->Pixel.Separable2DEnabled"], "", ["EXT_convolution"] ),
+ ["ctx->Pixel.Separable2DEnabled"], "", NoState, ["EXT_convolution"] ),
( "GL_POST_CONVOLUTION_RED_SCALE_EXT", GLfloat,
- ["ctx->Pixel.PostConvolutionScale[0]"], "", ["EXT_convolution"] ),
+ ["ctx->Pixel.PostConvolutionScale[0]"], "", NoState, ["EXT_convolution"] ),
( "GL_POST_CONVOLUTION_GREEN_SCALE_EXT", GLfloat,
- ["ctx->Pixel.PostConvolutionScale[1]"], "", ["EXT_convolution"] ),
+ ["ctx->Pixel.PostConvolutionScale[1]"], "", NoState, ["EXT_convolution"] ),
( "GL_POST_CONVOLUTION_BLUE_SCALE_EXT", GLfloat,
- ["ctx->Pixel.PostConvolutionScale[2]"], "", ["EXT_convolution"] ),
+ ["ctx->Pixel.PostConvolutionScale[2]"], "", NoState, ["EXT_convolution"] ),
( "GL_POST_CONVOLUTION_ALPHA_SCALE_EXT", GLfloat,
- ["ctx->Pixel.PostConvolutionScale[3]"], "", ["EXT_convolution"] ),
+ ["ctx->Pixel.PostConvolutionScale[3]"], "", NoState, ["EXT_convolution"] ),
( "GL_POST_CONVOLUTION_RED_BIAS_EXT", GLfloat,
- ["ctx->Pixel.PostConvolutionBias[0]"], "", ["EXT_convolution"] ),
+ ["ctx->Pixel.PostConvolutionBias[0]"], "", NoState, ["EXT_convolution"] ),
( "GL_POST_CONVOLUTION_GREEN_BIAS_EXT", GLfloat,
- ["ctx->Pixel.PostConvolutionBias[1]"], "", ["EXT_convolution"] ),
+ ["ctx->Pixel.PostConvolutionBias[1]"], "", NoState, ["EXT_convolution"] ),
( "GL_POST_CONVOLUTION_BLUE_BIAS_EXT", GLfloat,
- ["ctx->Pixel.PostConvolutionBias[2]"], "", ["EXT_convolution"] ),
+ ["ctx->Pixel.PostConvolutionBias[2]"], "", NoState, ["EXT_convolution"] ),
( "GL_POST_CONVOLUTION_ALPHA_BIAS_EXT", GLfloat,
- ["ctx->Pixel.PostConvolutionBias[3]"], "", ["EXT_convolution"] ),
+ ["ctx->Pixel.PostConvolutionBias[3]"], "", NoState, ["EXT_convolution"] ),
# GL_EXT_histogram / GL_ARB_imaging
( "GL_HISTOGRAM", GLboolean,
- [ "ctx->Pixel.HistogramEnabled" ], "", ["EXT_histogram"] ),
+ [ "ctx->Pixel.HistogramEnabled" ], "", NoState, ["EXT_histogram"] ),
( "GL_MINMAX", GLboolean,
- [ "ctx->Pixel.MinMaxEnabled" ], "", ["EXT_histogram"] ),
+ [ "ctx->Pixel.MinMaxEnabled" ], "", NoState, ["EXT_histogram"] ),
# GL_SGI_color_table / GL_ARB_imaging
( "GL_COLOR_TABLE_SGI", GLboolean,
- ["ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION]"], "", ["SGI_color_table"] ),
+ ["ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION]"], "",
+ NoState, ["SGI_color_table"] ),
( "GL_POST_CONVOLUTION_COLOR_TABLE_SGI", GLboolean,
- ["ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION]"], "", ["SGI_color_table"] ),
+ ["ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION]"], "",
+ NoState, ["SGI_color_table"] ),
( "GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI", GLboolean,
- ["ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX]"], "", ["SGI_color_table"] ),
+ ["ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX]"], "",
+ NoState, ["SGI_color_table"] ),
# GL_SGI_texture_color_table
( "GL_TEXTURE_COLOR_TABLE_SGI", GLboolean,
["ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled"],
- "", ["SGI_texture_color_table"] ),
+ "", NoState, ["SGI_texture_color_table"] ),
# GL_EXT_secondary_color
( "GL_COLOR_SUM_EXT", GLboolean,
- ["ctx->Fog.ColorSumEnabled"], "",
+ ["ctx->Fog.ColorSumEnabled"], "", NoState,
["EXT_secondary_color", "ARB_vertex_program"] ),
( "GL_CURRENT_SECONDARY_COLOR_EXT", GLfloatN,
["ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]",
"ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]",
"ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]",
"ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]"],
- "FLUSH_CURRENT(ctx, 0);", ["EXT_secondary_color"] ),
+ "", FlushCurrent, ["EXT_secondary_color"] ),
( "GL_SECONDARY_COLOR_ARRAY_EXT", GLboolean,
- ["ctx->Array.ArrayObj->SecondaryColor.Enabled"], "", ["EXT_secondary_color"] ),
+ ["ctx->Array.ArrayObj->SecondaryColor.Enabled"],
+ "", NoState, ["EXT_secondary_color"] ),
( "GL_SECONDARY_COLOR_ARRAY_TYPE_EXT", GLenum,
- ["ctx->Array.ArrayObj->SecondaryColor.Type"], "", ["EXT_secondary_color"] ),
+ ["ctx->Array.ArrayObj->SecondaryColor.Type"],
+ "", NoState, ["EXT_secondary_color"] ),
( "GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT", GLint,
- ["ctx->Array.ArrayObj->SecondaryColor.Stride"], "", ["EXT_secondary_color"] ),
+ ["ctx->Array.ArrayObj->SecondaryColor.Stride"],
+ "", NoState, ["EXT_secondary_color"] ),
( "GL_SECONDARY_COLOR_ARRAY_SIZE_EXT", GLint,
- ["ctx->Array.ArrayObj->SecondaryColor.Size"], "", ["EXT_secondary_color"] ),
+ ["ctx->Array.ArrayObj->SecondaryColor.Size"],
+ "", NoState, ["EXT_secondary_color"] ),
# GL_EXT_fog_coord
( "GL_CURRENT_FOG_COORDINATE_EXT", GLfloat,
["ctx->Current.Attrib[VERT_ATTRIB_FOG][0]"],
- "FLUSH_CURRENT(ctx, 0);", ["EXT_fog_coord"] ),
- ( "GL_FOG_COORDINATE_ARRAY_EXT", GLboolean, ["ctx->Array.ArrayObj->FogCoord.Enabled"],
- "", ["EXT_fog_coord"] ),
- ( "GL_FOG_COORDINATE_ARRAY_TYPE_EXT", GLenum, ["ctx->Array.ArrayObj->FogCoord.Type"],
- "", ["EXT_fog_coord"] ),
- ( "GL_FOG_COORDINATE_ARRAY_STRIDE_EXT", GLint, ["ctx->Array.ArrayObj->FogCoord.Stride"],
- "", ["EXT_fog_coord"] ),
- ( "GL_FOG_COORDINATE_SOURCE_EXT", GLenum, ["ctx->Fog.FogCoordinateSource"],
- "", ["EXT_fog_coord"] ),
+ "", FlushCurrent, ["EXT_fog_coord"] ),
+ ( "GL_FOG_COORDINATE_ARRAY_EXT", GLboolean,
+ ["ctx->Array.ArrayObj->FogCoord.Enabled"],
+ "", NoState, ["EXT_fog_coord"] ),
+ ( "GL_FOG_COORDINATE_ARRAY_TYPE_EXT", GLenum,
+ ["ctx->Array.ArrayObj->FogCoord.Type"],
+ "", NoState, ["EXT_fog_coord"] ),
+ ( "GL_FOG_COORDINATE_ARRAY_STRIDE_EXT", GLint,
+ ["ctx->Array.ArrayObj->FogCoord.Stride"],
+ "", NoState, ["EXT_fog_coord"] ),
+ ( "GL_FOG_COORDINATE_SOURCE_EXT", GLenum,
+ ["ctx->Fog.FogCoordinateSource"],
+ "", NoState, ["EXT_fog_coord"] ),
# GL_EXT_texture_lod_bias
( "GL_MAX_TEXTURE_LOD_BIAS_EXT", GLfloat,
- ["ctx->Const.MaxTextureLodBias"], "", ["EXT_texture_lod_bias"]),
+ ["ctx->Const.MaxTextureLodBias"], "", NoState, ["EXT_texture_lod_bias"]),
# GL_EXT_texture_filter_anisotropic
( "GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT", GLfloat,
- ["ctx->Const.MaxTextureMaxAnisotropy"], "", ["EXT_texture_filter_anisotropic"]),
+ ["ctx->Const.MaxTextureMaxAnisotropy"],
+ "", NoState, ["EXT_texture_filter_anisotropic"]),
# GL_ARB_multisample
( "GL_MULTISAMPLE_ARB", GLboolean,
- ["ctx->Multisample.Enabled"], "", None ),
+ ["ctx->Multisample.Enabled"], "", NoState, NoExt ),
( "GL_SAMPLE_ALPHA_TO_COVERAGE_ARB", GLboolean,
- ["ctx->Multisample.SampleAlphaToCoverage"], "", None ),
+ ["ctx->Multisample.SampleAlphaToCoverage"], "", NoState, NoExt ),
( "GL_SAMPLE_ALPHA_TO_ONE_ARB", GLboolean,
- ["ctx->Multisample.SampleAlphaToOne"], "", None ),
+ ["ctx->Multisample.SampleAlphaToOne"], "", NoState, NoExt ),
( "GL_SAMPLE_COVERAGE_ARB", GLboolean,
- ["ctx->Multisample.SampleCoverage"], "", None ),
+ ["ctx->Multisample.SampleCoverage"], "", NoState, NoExt ),
( "GL_SAMPLE_COVERAGE_VALUE_ARB", GLfloat,
- ["ctx->Multisample.SampleCoverageValue"], "", None ),
+ ["ctx->Multisample.SampleCoverageValue"], "", NoState, NoExt ),
( "GL_SAMPLE_COVERAGE_INVERT_ARB", GLboolean,
- ["ctx->Multisample.SampleCoverageInvert"], "", None ),
+ ["ctx->Multisample.SampleCoverageInvert"], "", NoState, NoExt ),
( "GL_SAMPLE_BUFFERS_ARB", GLint,
- ["ctx->DrawBuffer->Visual.sampleBuffers"], "", None ),
+ ["ctx->DrawBuffer->Visual.sampleBuffers"], "", NoState, NoExt ),
( "GL_SAMPLES_ARB", GLint,
- ["ctx->DrawBuffer->Visual.samples"], "", None ),
+ ["ctx->DrawBuffer->Visual.samples"], "", NoState, NoExt ),
# GL_IBM_rasterpos_clip
( "GL_RASTER_POSITION_UNCLIPPED_IBM", GLboolean,
- ["ctx->Transform.RasterPositionUnclipped"], "", ["IBM_rasterpos_clip"] ),
+ ["ctx->Transform.RasterPositionUnclipped"],
+ "", NoState, ["IBM_rasterpos_clip"] ),
# GL_NV_point_sprite
( "GL_POINT_SPRITE_NV", GLboolean, ["ctx->Point.PointSprite"], # == GL_POINT_SPRITE_ARB
- "", ["NV_point_sprite", "ARB_point_sprite"] ),
+ "", NoState, ["NV_point_sprite", "ARB_point_sprite"] ),
( "GL_POINT_SPRITE_R_MODE_NV", GLenum, ["ctx->Point.SpriteRMode"],
- "", ["NV_point_sprite"] ),
+ "", NoState, ["NV_point_sprite"] ),
( "GL_POINT_SPRITE_COORD_ORIGIN", GLenum, ["ctx->Point.SpriteOrigin"],
- "", ["NV_point_sprite", "ARB_point_sprite"] ),
+ "", NoState, ["NV_point_sprite", "ARB_point_sprite"] ),
# GL_SGIS_generate_mipmap
( "GL_GENERATE_MIPMAP_HINT_SGIS", GLenum, ["ctx->Hint.GenerateMipmap"],
- "", ["SGIS_generate_mipmap"] ),
+ "", NoState, ["SGIS_generate_mipmap"] ),
# GL_NV_vertex_program
( "GL_VERTEX_PROGRAM_BINDING_NV", GLint,
["(ctx->VertexProgram.Current ? ctx->VertexProgram.Current->Base.Id : 0)"],
- "", ["NV_vertex_program"] ),
+ "", NoState, ["NV_vertex_program"] ),
( "GL_VERTEX_ATTRIB_ARRAY0_NV", GLboolean,
- ["ctx->Array.ArrayObj->VertexAttrib[0].Enabled"], "", ["NV_vertex_program"] ),
+ ["ctx->Array.ArrayObj->VertexAttrib[0].Enabled"],
+ "", NoState, ["NV_vertex_program"] ),
( "GL_VERTEX_ATTRIB_ARRAY1_NV", GLboolean,
- ["ctx->Array.ArrayObj->VertexAttrib[1].Enabled"], "", ["NV_vertex_program"] ),
+ ["ctx->Array.ArrayObj->VertexAttrib[1].Enabled"],
+ "", NoState, ["NV_vertex_program"] ),
( "GL_VERTEX_ATTRIB_ARRAY2_NV", GLboolean,
- ["ctx->Array.ArrayObj->VertexAttrib[2].Enabled"], "", ["NV_vertex_program"] ),
+ ["ctx->Array.ArrayObj->VertexAttrib[2].Enabled"],
+ "", NoState, ["NV_vertex_program"] ),
( "GL_VERTEX_ATTRIB_ARRAY3_NV", GLboolean,
- ["ctx->Array.ArrayObj->VertexAttrib[3].Enabled"], "", ["NV_vertex_program"] ),
+ ["ctx->Array.ArrayObj->VertexAttrib[3].Enabled"],
+ "", NoState, ["NV_vertex_program"] ),
( "GL_VERTEX_ATTRIB_ARRAY4_NV", GLboolean,
- ["ctx->Array.ArrayObj->VertexAttrib[4].Enabled"], "", ["NV_vertex_program"] ),
+ ["ctx->Array.ArrayObj->VertexAttrib[4].Enabled"],
+ "", NoState, ["NV_vertex_program"] ),
( "GL_VERTEX_ATTRIB_ARRAY5_NV", GLboolean,
- ["ctx->Array.ArrayObj->VertexAttrib[5].Enabled"], "", ["NV_vertex_program"] ),
+ ["ctx->Array.ArrayObj->VertexAttrib[5].Enabled"],
+ "", NoState, ["NV_vertex_program"] ),
( "GL_VERTEX_ATTRIB_ARRAY6_NV", GLboolean,
- ["ctx->Array.ArrayObj->VertexAttrib[6].Enabled"], "", ["NV_vertex_program"] ),
+ ["ctx->Array.ArrayObj->VertexAttrib[6].Enabled"],
+ "", NoState, ["NV_vertex_program"] ),
( "GL_VERTEX_ATTRIB_ARRAY7_NV", GLboolean,
- ["ctx->Array.ArrayObj->VertexAttrib[7].Enabled"], "", ["NV_vertex_program"] ),
+ ["ctx->Array.ArrayObj->VertexAttrib[7].Enabled"],
+ "", NoState, ["NV_vertex_program"] ),
( "GL_VERTEX_ATTRIB_ARRAY8_NV", GLboolean,
- ["ctx->Array.ArrayObj->VertexAttrib[8].Enabled"], "", ["NV_vertex_program"] ),
+ ["ctx->Array.ArrayObj->VertexAttrib[8].Enabled"],
+ "", NoState, ["NV_vertex_program"] ),
( "GL_VERTEX_ATTRIB_ARRAY9_NV", GLboolean,
- ["ctx->Array.ArrayObj->VertexAttrib[9].Enabled"], "", ["NV_vertex_program"] ),
+ ["ctx->Array.ArrayObj->VertexAttrib[9].Enabled"],
+ "", NoState, ["NV_vertex_program"] ),
( "GL_VERTEX_ATTRIB_ARRAY10_NV", GLboolean,
- ["ctx->Array.ArrayObj->VertexAttrib[10].Enabled"], "", ["NV_vertex_program"] ),
+ ["ctx->Array.ArrayObj->VertexAttrib[10].Enabled"],
+ "", NoState, ["NV_vertex_program"] ),
( "GL_VERTEX_ATTRIB_ARRAY11_NV", GLboolean,
- ["ctx->Array.ArrayObj->VertexAttrib[11].Enabled"], "", ["NV_vertex_program"] ),
+ ["ctx->Array.ArrayObj->VertexAttrib[11].Enabled"],
+ "", NoState, ["NV_vertex_program"] ),
( "GL_VERTEX_ATTRIB_ARRAY12_NV", GLboolean,
- ["ctx->Array.ArrayObj->VertexAttrib[12].Enabled"], "", ["NV_vertex_program"] ),
+ ["ctx->Array.ArrayObj->VertexAttrib[12].Enabled"],
+ "", NoState, ["NV_vertex_program"] ),
( "GL_VERTEX_ATTRIB_ARRAY13_NV", GLboolean,
- ["ctx->Array.ArrayObj->VertexAttrib[13].Enabled"], "", ["NV_vertex_program"] ),
+ ["ctx->Array.ArrayObj->VertexAttrib[13].Enabled"],
+ "", NoState, ["NV_vertex_program"] ),
( "GL_VERTEX_ATTRIB_ARRAY14_NV", GLboolean,
- ["ctx->Array.ArrayObj->VertexAttrib[14].Enabled"], "", ["NV_vertex_program"] ),
+ ["ctx->Array.ArrayObj->VertexAttrib[14].Enabled"],
+ "", NoState, ["NV_vertex_program"] ),
( "GL_VERTEX_ATTRIB_ARRAY15_NV", GLboolean,
- ["ctx->Array.ArrayObj->VertexAttrib[15].Enabled"], "", ["NV_vertex_program"] ),
+ ["ctx->Array.ArrayObj->VertexAttrib[15].Enabled"],
+ "", NoState, ["NV_vertex_program"] ),
( "GL_MAP1_VERTEX_ATTRIB0_4_NV", GLboolean,
- ["ctx->Eval.Map1Attrib[0]"], "", ["NV_vertex_program"] ),
+ ["ctx->Eval.Map1Attrib[0]"], "", NoState, ["NV_vertex_program"] ),
( "GL_MAP1_VERTEX_ATTRIB1_4_NV", GLboolean,
- ["ctx->Eval.Map1Attrib[1]"], "", ["NV_vertex_program"] ),
+ ["ctx->Eval.Map1Attrib[1]"], "", NoState, ["NV_vertex_program"] ),
( "GL_MAP1_VERTEX_ATTRIB2_4_NV", GLboolean,
- ["ctx->Eval.Map1Attrib[2]"], "", ["NV_vertex_program"] ),
+ ["ctx->Eval.Map1Attrib[2]"], "", NoState, ["NV_vertex_program"] ),
( "GL_MAP1_VERTEX_ATTRIB3_4_NV", GLboolean,
- ["ctx->Eval.Map1Attrib[3]"], "", ["NV_vertex_program"] ),
+ ["ctx->Eval.Map1Attrib[3]"], "", NoState, ["NV_vertex_program"] ),
( "GL_MAP1_VERTEX_ATTRIB4_4_NV", GLboolean,
- ["ctx->Eval.Map1Attrib[4]"], "", ["NV_vertex_program"] ),
+ ["ctx->Eval.Map1Attrib[4]"], "", NoState, ["NV_vertex_program"] ),
( "GL_MAP1_VERTEX_ATTRIB5_4_NV", GLboolean,
- ["ctx->Eval.Map1Attrib[5]"], "", ["NV_vertex_program"] ),
+ ["ctx->Eval.Map1Attrib[5]"], "", NoState, ["NV_vertex_program"] ),
( "GL_MAP1_VERTEX_ATTRIB6_4_NV", GLboolean,
- ["ctx->Eval.Map1Attrib[6]"], "", ["NV_vertex_program"] ),
+ ["ctx->Eval.Map1Attrib[6]"], "", NoState, ["NV_vertex_program"] ),
( "GL_MAP1_VERTEX_ATTRIB7_4_NV", GLboolean,
- ["ctx->Eval.Map1Attrib[7]"], "", ["NV_vertex_program"] ),
+ ["ctx->Eval.Map1Attrib[7]"], "", NoState, ["NV_vertex_program"] ),
( "GL_MAP1_VERTEX_ATTRIB8_4_NV", GLboolean,
- ["ctx->Eval.Map1Attrib[8]"], "", ["NV_vertex_program"] ),
+ ["ctx->Eval.Map1Attrib[8]"], "", NoState, ["NV_vertex_program"] ),
( "GL_MAP1_VERTEX_ATTRIB9_4_NV", GLboolean,
- ["ctx->Eval.Map1Attrib[9]"], "", ["NV_vertex_program"] ),
+ ["ctx->Eval.Map1Attrib[9]"], "", NoState, ["NV_vertex_program"] ),
( "GL_MAP1_VERTEX_ATTRIB10_4_NV", GLboolean,
- ["ctx->Eval.Map1Attrib[10]"], "", ["NV_vertex_program"] ),
+ ["ctx->Eval.Map1Attrib[10]"], "", NoState, ["NV_vertex_program"] ),
( "GL_MAP1_VERTEX_ATTRIB11_4_NV", GLboolean,
- ["ctx->Eval.Map1Attrib[11]"], "", ["NV_vertex_program"] ),
+ ["ctx->Eval.Map1Attrib[11]"], "", NoState, ["NV_vertex_program"] ),
( "GL_MAP1_VERTEX_ATTRIB12_4_NV", GLboolean,
- ["ctx->Eval.Map1Attrib[12]"], "", ["NV_vertex_program"] ),
+ ["ctx->Eval.Map1Attrib[12]"], "", NoState, ["NV_vertex_program"] ),
( "GL_MAP1_VERTEX_ATTRIB13_4_NV", GLboolean,
- ["ctx->Eval.Map1Attrib[13]"], "", ["NV_vertex_program"] ),
+ ["ctx->Eval.Map1Attrib[13]"], "", NoState, ["NV_vertex_program"] ),
( "GL_MAP1_VERTEX_ATTRIB14_4_NV", GLboolean,
- ["ctx->Eval.Map1Attrib[14]"], "", ["NV_vertex_program"] ),
+ ["ctx->Eval.Map1Attrib[14]"], "", NoState, ["NV_vertex_program"] ),
( "GL_MAP1_VERTEX_ATTRIB15_4_NV", GLboolean,
- ["ctx->Eval.Map1Attrib[15]"], "", ["NV_vertex_program"] ),
+ ["ctx->Eval.Map1Attrib[15]"], "", NoState, ["NV_vertex_program"] ),
# GL_NV_fragment_program
( "GL_FRAGMENT_PROGRAM_NV", GLboolean,
- ["ctx->FragmentProgram.Enabled"], "", ["NV_fragment_program"] ),
+ ["ctx->FragmentProgram.Enabled"], "", NoState, ["NV_fragment_program"] ),
( "GL_FRAGMENT_PROGRAM_BINDING_NV", GLint,
["ctx->FragmentProgram.Current ? ctx->FragmentProgram.Current->Base.Id : 0"],
- "", ["NV_fragment_program"] ),
+ "", NoState, ["NV_fragment_program"] ),
( "GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV", GLint,
- ["MAX_NV_FRAGMENT_PROGRAM_PARAMS"], "", ["NV_fragment_program"] ),
+ ["MAX_NV_FRAGMENT_PROGRAM_PARAMS"], "", NoState, ["NV_fragment_program"] ),
# GL_NV_texture_rectangle
( "GL_TEXTURE_RECTANGLE_NV", GLboolean,
- ["_mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV)"], "", ["NV_texture_rectangle"] ),
+ ["_mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV)"], "", NoState, ["NV_texture_rectangle"] ),
( "GL_TEXTURE_BINDING_RECTANGLE_NV", GLint,
["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_RECT_INDEX]->Name"],
- "", ["NV_texture_rectangle"] ),
+ "", NoState, ["NV_texture_rectangle"] ),
( "GL_MAX_RECTANGLE_TEXTURE_SIZE_NV", GLint,
- ["ctx->Const.MaxTextureRectSize"], "", ["NV_texture_rectangle"] ),
+ ["ctx->Const.MaxTextureRectSize"], "", NoState, ["NV_texture_rectangle"] ),
# GL_EXT_stencil_two_side
( "GL_STENCIL_TEST_TWO_SIDE_EXT", GLboolean,
- ["ctx->Stencil.TestTwoSide"], "", ["EXT_stencil_two_side"] ),
+ ["ctx->Stencil.TestTwoSide"], "", NoState, ["EXT_stencil_two_side"] ),
( "GL_ACTIVE_STENCIL_FACE_EXT", GLenum,
["ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT"],
- "", ["EXT_stencil_two_side"] ),
+ "", NoState, ["EXT_stencil_two_side"] ),
# GL_NV_light_max_exponent
( "GL_MAX_SHININESS_NV", GLfloat,
- ["ctx->Const.MaxShininess"], "", ["NV_light_max_exponent"] ),
+ ["ctx->Const.MaxShininess"], "", NoState, ["NV_light_max_exponent"] ),
( "GL_MAX_SPOT_EXPONENT_NV", GLfloat,
- ["ctx->Const.MaxSpotExponent"], "", ["NV_light_max_exponent"] ),
+ ["ctx->Const.MaxSpotExponent"], "", NoState, ["NV_light_max_exponent"] ),
# GL_ARB_vertex_buffer_object
( "GL_ARRAY_BUFFER_BINDING_ARB", GLint,
- ["ctx->Array.ArrayBufferObj->Name"], "", None ),
+ ["ctx->Array.ArrayBufferObj->Name"], "", NoState, NoExt ),
( "GL_VERTEX_ARRAY_BUFFER_BINDING_ARB", GLint,
- ["ctx->Array.ArrayObj->Vertex.BufferObj->Name"], "", None ),
+ ["ctx->Array.ArrayObj->Vertex.BufferObj->Name"], "", NoState, NoExt ),
( "GL_NORMAL_ARRAY_BUFFER_BINDING_ARB", GLint,
- ["ctx->Array.ArrayObj->Normal.BufferObj->Name"], "", None ),
+ ["ctx->Array.ArrayObj->Normal.BufferObj->Name"], "", NoState, NoExt ),
( "GL_COLOR_ARRAY_BUFFER_BINDING_ARB", GLint,
- ["ctx->Array.ArrayObj->Color.BufferObj->Name"], "", None ),
+ ["ctx->Array.ArrayObj->Color.BufferObj->Name"], "", NoState, NoExt ),
( "GL_INDEX_ARRAY_BUFFER_BINDING_ARB", GLint,
- ["ctx->Array.ArrayObj->Index.BufferObj->Name"], "", None ),
+ ["ctx->Array.ArrayObj->Index.BufferObj->Name"], "", NoState, NoExt ),
( "GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB", GLint,
["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].BufferObj->Name"],
- "", None ),
+ "", NoState, NoExt ),
( "GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB", GLint,
- ["ctx->Array.ArrayObj->EdgeFlag.BufferObj->Name"], "", None ),
+ ["ctx->Array.ArrayObj->EdgeFlag.BufferObj->Name"], "", NoState, NoExt ),
( "GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB", GLint,
["ctx->Array.ArrayObj->SecondaryColor.BufferObj->Name"],
- "", None ),
+ "", NoState, NoExt ),
( "GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB", GLint,
["ctx->Array.ArrayObj->FogCoord.BufferObj->Name"],
- "", None ),
+ "", NoState, NoExt ),
# GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB - not supported
( "GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB", GLint,
["ctx->Array.ElementArrayBufferObj->Name"],
- "", None ),
+ "", NoState, NoExt ),
# GL_EXT_pixel_buffer_object
( "GL_PIXEL_PACK_BUFFER_BINDING_EXT", GLint,
- ["ctx->Pack.BufferObj->Name"], "", ["EXT_pixel_buffer_object"] ),
+ ["ctx->Pack.BufferObj->Name"], "", NoState, ["EXT_pixel_buffer_object"] ),
( "GL_PIXEL_UNPACK_BUFFER_BINDING_EXT", GLint,
- ["ctx->Unpack.BufferObj->Name"], "", ["EXT_pixel_buffer_object"] ),
+ ["ctx->Unpack.BufferObj->Name"], "", NoState, ["EXT_pixel_buffer_object"] ),
# GL_ARB_vertex_program
( "GL_VERTEX_PROGRAM_ARB", GLboolean, # == GL_VERTEX_PROGRAM_NV
- ["ctx->VertexProgram.Enabled"], "",
+ ["ctx->VertexProgram.Enabled"], "", NoState,
["ARB_vertex_program", "NV_vertex_program"] ),
( "GL_VERTEX_PROGRAM_POINT_SIZE_ARB", GLboolean, # == GL_VERTEX_PROGRAM_POINT_SIZE_NV
- ["ctx->VertexProgram.PointSizeEnabled"], "",
+ ["ctx->VertexProgram.PointSizeEnabled"], "", NoState,
["ARB_vertex_program", "NV_vertex_program"] ),
( "GL_VERTEX_PROGRAM_TWO_SIDE_ARB", GLboolean, # == GL_VERTEX_PROGRAM_TWO_SIDE_NV
- ["ctx->VertexProgram.TwoSideEnabled"], "",
+ ["ctx->VertexProgram.TwoSideEnabled"], "", NoState,
["ARB_vertex_program", "NV_vertex_program"] ),
( "GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB", GLint, # == GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV
- ["ctx->Const.MaxProgramMatrixStackDepth"], "",
+ ["ctx->Const.MaxProgramMatrixStackDepth"], "", NoState,
["ARB_vertex_program", "ARB_fragment_program", "NV_vertex_program"] ),
( "GL_MAX_PROGRAM_MATRICES_ARB", GLint, # == GL_MAX_TRACK_MATRICES_NV
- ["ctx->Const.MaxProgramMatrices"], "",
+ ["ctx->Const.MaxProgramMatrices"], "", NoState,
["ARB_vertex_program", "ARB_fragment_program", "NV_vertex_program"] ),
( "GL_CURRENT_MATRIX_STACK_DEPTH_ARB", GLboolean, # == GL_CURRENT_MATRIX_STACK_DEPTH_NV
- ["ctx->CurrentStack->Depth + 1"], "",
+ ["ctx->CurrentStack->Depth + 1"], "", NoState,
["ARB_vertex_program", "ARB_fragment_program", "NV_vertex_program"] ),
( "GL_CURRENT_MATRIX_ARB", GLfloat, # == GL_CURRENT_MATRIX_NV
["matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]",
"matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]",
"matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]",
"matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ],
- "const GLfloat *matrix = ctx->CurrentStack->Top->m;",
+ "const GLfloat *matrix = ctx->CurrentStack->Top->m;", NoState,
["ARB_vertex_program", "ARB_fragment_program", "NV_fragment_program"] ),
( "GL_TRANSPOSE_CURRENT_MATRIX_ARB", GLfloat,
["matrix[0]", "matrix[4]", "matrix[8]", "matrix[12]",
"matrix[1]", "matrix[5]", "matrix[9]", "matrix[13]",
"matrix[2]", "matrix[6]", "matrix[10]", "matrix[14]",
"matrix[3]", "matrix[7]", "matrix[11]", "matrix[15]"],
- "const GLfloat *matrix = ctx->CurrentStack->Top->m;",
+ "const GLfloat *matrix = ctx->CurrentStack->Top->m;", NoState,
["ARB_vertex_program", "ARB_fragment_program"] ),
( "GL_MAX_VERTEX_ATTRIBS_ARB", GLint,
- ["ctx->Const.VertexProgram.MaxAttribs"], "", ["ARB_vertex_program"] ),
+ ["ctx->Const.VertexProgram.MaxAttribs"], "", NoState, ["ARB_vertex_program"] ),
( "GL_PROGRAM_ERROR_POSITION_ARB", GLint, # == GL_PROGRAM_ERROR_POSITION_NV
- ["ctx->Program.ErrorPos"], "", ["NV_vertex_program",
+ ["ctx->Program.ErrorPos"], "", NoState, ["NV_vertex_program",
"ARB_vertex_program", "NV_fragment_program", "ARB_fragment_program"] ),
# GL_ARB_fragment_program
( "GL_FRAGMENT_PROGRAM_ARB", GLboolean,
- ["ctx->FragmentProgram.Enabled"], "", ["ARB_fragment_program"] ),
+ ["ctx->FragmentProgram.Enabled"], "", NoState, ["ARB_fragment_program"] ),
( "GL_MAX_TEXTURE_COORDS_ARB", GLint, # == GL_MAX_TEXTURE_COORDS_NV
- ["ctx->Const.MaxTextureCoordUnits"], "",
+ ["ctx->Const.MaxTextureCoordUnits"], "", NoState,
["ARB_fragment_program", "NV_fragment_program"] ),
( "GL_MAX_TEXTURE_IMAGE_UNITS_ARB", GLint, # == GL_MAX_TEXTURE_IMAGE_UNITS_NV
- ["ctx->Const.MaxTextureImageUnits"], "",
+ ["ctx->Const.MaxTextureImageUnits"], "", NoState,
["ARB_fragment_program", "NV_fragment_program"] ),
# GL_EXT_depth_bounds_test
( "GL_DEPTH_BOUNDS_TEST_EXT", GLboolean,
- ["ctx->Depth.BoundsTest"], "", ["EXT_depth_bounds_test"] ),
+ ["ctx->Depth.BoundsTest"], "", NoState, ["EXT_depth_bounds_test"] ),
( "GL_DEPTH_BOUNDS_EXT", GLfloat,
["ctx->Depth.BoundsMin", "ctx->Depth.BoundsMax"],
- "", ["EXT_depth_bounds_test"] ),
+ "", NoState, ["EXT_depth_bounds_test"] ),
# GL_ARB_depth_clamp
( "GL_DEPTH_CLAMP", GLboolean, ["ctx->Transform.DepthClamp"], "",
- ["ARB_depth_clamp"] ),
+ NoState, ["ARB_depth_clamp"] ),
# GL_ARB_draw_buffers
( "GL_MAX_DRAW_BUFFERS_ARB", GLint,
- ["ctx->Const.MaxDrawBuffers"], "", None ),
+ ["ctx->Const.MaxDrawBuffers"], "", NoState, NoExt ),
( "GL_DRAW_BUFFER0_ARB", GLenum,
- ["ctx->DrawBuffer->ColorDrawBuffer[0]"], "", None ),
+ ["ctx->DrawBuffer->ColorDrawBuffer[0]"], "", NoState, NoExt ),
( "GL_DRAW_BUFFER1_ARB", GLenum,
["buffer"],
"""GLenum buffer;
@@ -949,7 +994,7 @@ StateVars = [
_mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)");
return;
}
- buffer = ctx->DrawBuffer->ColorDrawBuffer[1];""", None ),
+ buffer = ctx->DrawBuffer->ColorDrawBuffer[1];""", NoState, NoExt ),
( "GL_DRAW_BUFFER2_ARB", GLenum,
["buffer"],
"""GLenum buffer;
@@ -957,7 +1002,7 @@ StateVars = [
_mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)");
return;
}
- buffer = ctx->DrawBuffer->ColorDrawBuffer[2];""", None ),
+ buffer = ctx->DrawBuffer->ColorDrawBuffer[2];""", NoState, NoExt ),
( "GL_DRAW_BUFFER3_ARB", GLenum,
["buffer"],
"""GLenum buffer;
@@ -965,117 +1010,171 @@ StateVars = [
_mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)");
return;
}
- buffer = ctx->DrawBuffer->ColorDrawBuffer[3];""", None ),
+ buffer = ctx->DrawBuffer->ColorDrawBuffer[3];""", NoState, NoExt ),
# XXX Add more GL_DRAW_BUFFERn_ARB entries as needed in the future
# GL_OES_read_format
( "GL_IMPLEMENTATION_COLOR_READ_TYPE_OES", GLint,
- ["_mesa_get_color_read_type(ctx)"], "", ["OES_read_format"] ),
+ ["_mesa_get_color_read_type(ctx)"], "", NoState, ["OES_read_format"] ),
( "GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES", GLint,
- ["_mesa_get_color_read_format(ctx)"], "", ["OES_read_format"] ),
+ ["_mesa_get_color_read_format(ctx)"], "", NoState, ["OES_read_format"] ),
# GL_ATI_fragment_shader
- ( "GL_NUM_FRAGMENT_REGISTERS_ATI", GLint, ["6"], "", ["ATI_fragment_shader"] ),
- ( "GL_NUM_FRAGMENT_CONSTANTS_ATI", GLint, ["8"], "", ["ATI_fragment_shader"] ),
- ( "GL_NUM_PASSES_ATI", GLint, ["2"], "", ["ATI_fragment_shader"] ),
- ( "GL_NUM_INSTRUCTIONS_PER_PASS_ATI", GLint, ["8"], "", ["ATI_fragment_shader"] ),
- ( "GL_NUM_INSTRUCTIONS_TOTAL_ATI", GLint, ["16"], "", ["ATI_fragment_shader"] ),
- ( "GL_COLOR_ALPHA_PAIRING_ATI", GLboolean, ["GL_TRUE"], "", ["ATI_fragment_shader"] ),
- ( "GL_NUM_LOOPBACK_COMPONENTS_ATI", GLint, ["3"], "", ["ATI_fragment_shader"] ),
- ( "GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI", GLint, ["3"], "", ["ATI_fragment_shader"] ),
+ ( "GL_NUM_FRAGMENT_REGISTERS_ATI", GLint, ["6"],
+ "", NoState, ["ATI_fragment_shader"] ),
+ ( "GL_NUM_FRAGMENT_CONSTANTS_ATI", GLint, ["8"],
+ "", NoState, ["ATI_fragment_shader"] ),
+ ( "GL_NUM_PASSES_ATI", GLint, ["2"],
+ "", NoState, ["ATI_fragment_shader"] ),
+ ( "GL_NUM_INSTRUCTIONS_PER_PASS_ATI", GLint, ["8"],
+ "", NoState, ["ATI_fragment_shader"] ),
+ ( "GL_NUM_INSTRUCTIONS_TOTAL_ATI", GLint, ["16"],
+ "", NoState, ["ATI_fragment_shader"] ),
+ ( "GL_COLOR_ALPHA_PAIRING_ATI", GLboolean, ["GL_TRUE"],
+ "", NoState, ["ATI_fragment_shader"] ),
+ ( "GL_NUM_LOOPBACK_COMPONENTS_ATI", GLint, ["3"],
+ "", NoState, ["ATI_fragment_shader"] ),
+ ( "GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI", GLint, ["3"],
+ "", NoState, ["ATI_fragment_shader"] ),
# OpenGL 2.0
- ( "GL_STENCIL_BACK_FUNC", GLenum, ["ctx->Stencil.Function[1]"], "", None ),
- ( "GL_STENCIL_BACK_VALUE_MASK", GLint, ["ctx->Stencil.ValueMask[1]"], "", None ),
- ( "GL_STENCIL_BACK_WRITEMASK", GLint, ["ctx->Stencil.WriteMask[1]"], "", None ),
- ( "GL_STENCIL_BACK_REF", GLint, ["ctx->Stencil.Ref[1]"], "", None ),
- ( "GL_STENCIL_BACK_FAIL", GLenum, ["ctx->Stencil.FailFunc[1]"], "", None ),
- ( "GL_STENCIL_BACK_PASS_DEPTH_FAIL", GLenum, ["ctx->Stencil.ZFailFunc[1]"], "", None ),
- ( "GL_STENCIL_BACK_PASS_DEPTH_PASS", GLenum, ["ctx->Stencil.ZPassFunc[1]"], "", None ),
+ ( "GL_STENCIL_BACK_FUNC", GLenum, ["ctx->Stencil.Function[1]"],
+ "", NoState, NoExt ),
+ ( "GL_STENCIL_BACK_VALUE_MASK", GLint, ["ctx->Stencil.ValueMask[1]"],
+ "", NoState, NoExt ),
+ ( "GL_STENCIL_BACK_WRITEMASK", GLint, ["ctx->Stencil.WriteMask[1]"],
+ "", NoState, NoExt ),
+ ( "GL_STENCIL_BACK_REF", GLint, ["ctx->Stencil.Ref[1]"],
+ "", NoState, NoExt ),
+ ( "GL_STENCIL_BACK_FAIL", GLenum, ["ctx->Stencil.FailFunc[1]"],
+ "", NoState, NoExt ),
+ ( "GL_STENCIL_BACK_PASS_DEPTH_FAIL", GLenum, ["ctx->Stencil.ZFailFunc[1]"],
+ "", NoState, NoExt ),
+ ( "GL_STENCIL_BACK_PASS_DEPTH_PASS", GLenum, ["ctx->Stencil.ZPassFunc[1]"],
+ "", NoState, NoExt ),
# GL_EXT_framebuffer_object
( "GL_FRAMEBUFFER_BINDING_EXT", GLint, ["ctx->DrawBuffer->Name"], "",
- ["EXT_framebuffer_object"] ),
+ NoState, ["EXT_framebuffer_object"] ),
( "GL_RENDERBUFFER_BINDING_EXT", GLint,
["ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0"], "",
- ["EXT_framebuffer_object"] ),
+ NoState, ["EXT_framebuffer_object"] ),
( "GL_MAX_COLOR_ATTACHMENTS_EXT", GLint,
["ctx->Const.MaxColorAttachments"], "",
- ["EXT_framebuffer_object"] ),
+ NoState, ["EXT_framebuffer_object"] ),
( "GL_MAX_RENDERBUFFER_SIZE_EXT", GLint,
["ctx->Const.MaxRenderbufferSize"], "",
- ["EXT_framebuffer_object"] ),
+ NoState, ["EXT_framebuffer_object"] ),
# GL_EXT_framebuffer_blit
# NOTE: GL_DRAW_FRAMEBUFFER_BINDING_EXT == GL_FRAMEBUFFER_BINDING_EXT
( "GL_READ_FRAMEBUFFER_BINDING_EXT", GLint, ["ctx->ReadBuffer->Name"], "",
- ["EXT_framebuffer_blit"] ),
+ NoState, ["EXT_framebuffer_blit"] ),
# GL_EXT_provoking_vertex
( "GL_PROVOKING_VERTEX_EXT", GLboolean,
- ["ctx->Light.ProvokingVertex"], "", ["EXT_provoking_vertex"] ),
+ ["ctx->Light.ProvokingVertex"], "", NoState, ["EXT_provoking_vertex"] ),
( "GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT", GLboolean,
["ctx->Const.QuadsFollowProvokingVertexConvention"], "",
- ["EXT_provoking_vertex"] ),
+ NoState, ["EXT_provoking_vertex"] ),
# GL_ARB_fragment_shader
( "GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB", GLint,
["ctx->Const.FragmentProgram.MaxUniformComponents"], "",
- ["ARB_fragment_shader"] ),
+ NoState, ["ARB_fragment_shader"] ),
( "GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB", GLenum,
- ["ctx->Hint.FragmentShaderDerivative"], "", ["ARB_fragment_shader"] ),
+ ["ctx->Hint.FragmentShaderDerivative"],
+ "", NoState, ["ARB_fragment_shader"] ),
# GL_ARB_vertex_shader
( "GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB", GLint,
["ctx->Const.VertexProgram.MaxUniformComponents"], "",
- ["ARB_vertex_shader"] ),
+ NoState, ["ARB_vertex_shader"] ),
( "GL_MAX_VARYING_FLOATS_ARB", GLint,
- ["ctx->Const.MaxVarying * 4"], "", ["ARB_vertex_shader"] ),
+ ["ctx->Const.MaxVarying * 4"], "", NoState, ["ARB_vertex_shader"] ),
( "GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB", GLint,
- ["ctx->Const.MaxVertexTextureImageUnits"], "", ["ARB_vertex_shader"] ),
+ ["ctx->Const.MaxVertexTextureImageUnits"],
+ "", NoState, ["ARB_vertex_shader"] ),
( "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB", GLint,
- ["ctx->Const.MaxCombinedTextureImageUnits"], "", ["ARB_vertex_shader"] ),
+ ["ctx->Const.MaxCombinedTextureImageUnits"],
+ "", NoState, ["ARB_vertex_shader"] ),
# GL_ARB_shader_objects
# Actually, this token isn't part of GL_ARB_shader_objects, but is
# close enough for now.
( "GL_CURRENT_PROGRAM", GLint,
["ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0"],
- "", ["ARB_shader_objects"] ),
+ "", NoState, ["ARB_shader_objects"] ),
# GL_ARB_framebuffer_object
( "GL_MAX_SAMPLES", GLint, ["ctx->Const.MaxSamples"], "",
- ["ARB_framebuffer_object"] ),
+ NoState, ["ARB_framebuffer_object"] ),
# GL_APPLE_vertex_array_object
( "GL_VERTEX_ARRAY_BINDING_APPLE", GLint, ["ctx->Array.ArrayObj->Name"], "",
- ["APPLE_vertex_array_object"] ),
+ NoState, ["APPLE_vertex_array_object"] ),
# GL_ARB_seamless_cube_map
( "GL_TEXTURE_CUBE_MAP_SEAMLESS", GLboolean, ["ctx->Texture.CubeMapSeamless"], "",
- ["ARB_seamless_cube_map"] ),
+ NoState, ["ARB_seamless_cube_map"] ),
# GL_ARB_sync
( "GL_MAX_SERVER_WAIT_TIMEOUT", GLint64, ["ctx->Const.MaxServerWaitTimeout"], "",
- ["ARB_sync"] ),
+ NoState, ["ARB_sync"] ),
+
+ # GL_EXT_transform_feedback
+ ( "GL_TRANSFORM_FEEDBACK_BUFFER_BINDING", GLint,
+ ["ctx->TransformFeedback.CurrentBuffer->Name"], "",
+ NoState, ["EXT_transform_feedback"] ),
+ ( "GL_RASTERIZER_DISCARD", GLboolean,
+ ["ctx->TransformFeedback.RasterDiscard"], "",
+ NoState, ["EXT_transform_feedback"] ),
+ ( "GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS", GLint,
+ ["ctx->Const.MaxTransformFeedbackInterleavedComponents"], "",
+ NoState, ["EXT_transform_feedback"] ),
+ ( "GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS", GLint,
+ ["ctx->Const.MaxTransformFeedbackSeparateAttribs"], "",
+ NoState, ["EXT_transform_feedback"] ),
+ ( "GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS", GLint,
+ ["ctx->Const.MaxTransformFeedbackSeparateComponents"], "",
+ NoState, ["EXT_transform_feedback"] ),
# GL3
- ( "GL_NUM_EXTENSIONS", GLint, ["_mesa_get_extension_count(ctx)"], "", None ),
- ( "GL_MAJOR_VERSION", GLint, ["ctx->VersionMajor"], "", None ),
- ( "GL_MINOR_VERSION", GLint, ["ctx->VersionMinor"], "", None )
+ ( "GL_NUM_EXTENSIONS", GLint, ["_mesa_get_extension_count(ctx)"], "", NoState, NoExt ),
+ ( "GL_MAJOR_VERSION", GLint, ["ctx->VersionMajor"], "", NoState, NoExt ),
+ ( "GL_MINOR_VERSION", GLint, ["ctx->VersionMinor"], "", NoState, NoExt ),
+ ( "GL_CONTEXT_FLAGS", GLint, ["ctx->Const.ContextFlags"], "", NoState, NoExt )
]
# These are queried via glGetIntegetIndexdvEXT() or glGetIntegeri_v()
+# The tuples are the same as above, with one exception: the "optional"
+# code field is instead the max legal index value.
IndexedStateVars = [
+ # GL_EXT_draw_buffers2 / GL3
( "GL_BLEND", GLint, ["((ctx->Color.BlendEnabled >> index) & 1)"],
- "ctx->Const.MaxDrawBuffers", ["EXT_draw_buffers2"] ),
+ "ctx->Const.MaxDrawBuffers", NoState, ["EXT_draw_buffers2"] ),
( "GL_COLOR_WRITEMASK", GLint,
[ "ctx->Color.ColorMask[index][RCOMP] ? 1 : 0",
"ctx->Color.ColorMask[index][GCOMP] ? 1 : 0",
"ctx->Color.ColorMask[index][BCOMP] ? 1 : 0",
"ctx->Color.ColorMask[index][ACOMP] ? 1 : 0" ],
- "ctx->Const.MaxDrawBuffers", ["EXT_draw_buffers2"] ),
+ "ctx->Const.MaxDrawBuffers", NoState, ["EXT_draw_buffers2"] ),
+
+ # GL_EXT_transform_feedback
+ ( "GL_TRANSFORM_FEEDBACK_BUFFER_START", GLint64,
+ ["ctx->TransformFeedback.Offset[index]"],
+ "ctx->Const.MaxTransformFeedbackSeparateAttribs",
+ NoState, ["EXT_transform_feedback"] ),
+ ( "GL_TRANSFORM_FEEDBACK_BUFFER_SIZE", GLint64,
+ ["ctx->TransformFeedback.Size[index]"],
+ "ctx->Const.MaxTransformFeedbackSeparateAttribs",
+ NoState, ["EXT_transform_feedback"] ),
+ ( "GL_TRANSFORM_FEEDBACK_BUFFER_BINDING", GLint,
+ ["ctx->TransformFeedback.Buffers[index]->Name"],
+ "ctx->Const.MaxTransformFeedbackSeparateAttribs",
+ NoState, ["EXT_transform_feedback"] ),
+
# XXX more to come...
]
@@ -1152,9 +1251,6 @@ def EmitGetFunction(stateVars, returnType, indexed):
print " if (!params)"
print " return;"
print ""
- print " if (ctx->NewState)"
- print " _mesa_update_state(ctx);"
- print ""
if indexed == 0:
print " if (ctx->Driver.%s &&" % function
print " ctx->Driver.%s(ctx, pname, params))" % function
@@ -1164,12 +1260,14 @@ def EmitGetFunction(stateVars, returnType, indexed):
for state in stateVars:
if indexed:
- (name, varType, state, indexMax, extensions) = state
+ (name, varType, state, indexMax, dirtyFlags, extensions) = state
optionalCode = 0
else:
- (name, varType, state, optionalCode, extensions) = state
+ (name, varType, state, optionalCode, dirtyFlags, extensions) = state
indexMax = 0
print " case " + name + ":"
+
+ # Do extension check
if extensions:
if len(extensions) == 1:
print (' CHECK_EXT1(%s, "%s");' %
@@ -1184,9 +1282,20 @@ def EmitGetFunction(stateVars, returnType, indexed):
assert len(extensions) == 4
print (' CHECK_EXT4(%s, %s, %s, %s, "%s");' %
(extensions[0], extensions[1], extensions[2], extensions[3], function))
+
+ # Do dirty state check
+ if dirtyFlags:
+ if dirtyFlags == FlushCurrent:
+ print (' FLUSH_CURRENT(ctx, 0);')
+ else:
+ print (' if (ctx->NewState & %s)' % dirtyFlags)
+ print (' _mesa_update_state(ctx);')
+
+ # Do index validation for glGet*Indexed() calls
if indexMax:
print (' if (index >= %s) {' % indexMax)
print (' _mesa_error(ctx, GL_INVALID_VALUE, "gl%s(index=%%u), index", pname);' % function)
+ print (' return;')
print (' }')
conversion = ConversionFunc(varType, returnType)
diff --git a/src/mesa/main/mfeatures.h b/src/mesa/main/mfeatures.h
index cb96c4d1d0..6ed05da7ac 100644
--- a/src/mesa/main/mfeatures.h
+++ b/src/mesa/main/mfeatures.h
@@ -68,62 +68,84 @@
* enabled or not.
*/
+#ifndef FEATURE_ES1
+#define FEATURE_ES1 0
+#endif
+#ifndef FEATURE_ES2
+#define FEATURE_ES2 0
+#endif
+
+#define FEATURE_ES (FEATURE_ES1 || FEATURE_ES2)
+
+#ifndef FEATURE_GL
+#define FEATURE_GL !FEATURE_ES
+#endif
+
#ifdef IN_DRI_DRIVER
-#define FEATURE_remap_table 1
+#define FEATURE_remap_table 1
#else
-#define FEATURE_remap_table 0
+#define FEATURE_remap_table 0
#endif
-#define FEATURE_accum _HAVE_FULL_GL
-#define FEATURE_arrayelt _HAVE_FULL_GL
-#define FEATURE_attrib_stack _HAVE_FULL_GL
+#define FEATURE_dispatch 1
+#define FEATURE_texgen 1
+#define FEATURE_userclip 1
+
+#define FEATURE_accum FEATURE_GL
+#define FEATURE_arrayelt FEATURE_GL
+#define FEATURE_attrib_stack FEATURE_GL
/* this disables vtxfmt, api_loopback, and api_noop completely */
-#define FEATURE_beginend _HAVE_FULL_GL
-#define FEATURE_colortable _HAVE_FULL_GL
-#define FEATURE_convolve _HAVE_FULL_GL
-#define FEATURE_dispatch _HAVE_FULL_GL
-#define FEATURE_dlist (_HAVE_FULL_GL && FEATURE_arrayelt && FEATURE_beginend)
-#define FEATURE_draw_read_buffer _HAVE_FULL_GL
-#define FEATURE_drawpix _HAVE_FULL_GL
-#define FEATURE_evaluators _HAVE_FULL_GL
-#define FEATURE_feedback _HAVE_FULL_GL
-#define FEATURE_fixedpt 0
-#define FEATURE_histogram _HAVE_FULL_GL
-#define FEATURE_pixel_transfer _HAVE_FULL_GL
-#define FEATURE_point_size_array 0
-#define FEATURE_queryobj _HAVE_FULL_GL
-#define FEATURE_rastpos _HAVE_FULL_GL
-#define FEATURE_texgen _HAVE_FULL_GL
-#define FEATURE_texture_fxt1 _HAVE_FULL_GL
-#define FEATURE_texture_s3tc _HAVE_FULL_GL
-#define FEATURE_userclip _HAVE_FULL_GL
-#define FEATURE_vertex_array_byte 0
-#define FEATURE_es2_glsl 0
-
-#define FEATURE_ARB_fragment_program _HAVE_FULL_GL
-#define FEATURE_ARB_framebuffer_object _HAVE_FULL_GL
-#define FEATURE_ARB_map_buffer_range _HAVE_FULL_GL
-#define FEATURE_ARB_pixel_buffer_object _HAVE_FULL_GL
-#define FEATURE_ARB_vertex_buffer_object _HAVE_FULL_GL
-#define FEATURE_ARB_vertex_program _HAVE_FULL_GL
-#define FEATURE_ARB_vertex_shader _HAVE_FULL_GL
-#define FEATURE_ARB_fragment_shader _HAVE_FULL_GL
-#define FEATURE_ARB_shader_objects (FEATURE_ARB_vertex_shader || FEATURE_ARB_fragment_shader)
-#define FEATURE_ARB_shading_language_100 FEATURE_ARB_shader_objects
-#define FEATURE_ARB_shading_language_120 FEATURE_ARB_shader_objects
-#define FEATURE_ARB_sync _HAVE_FULL_GL
-
-#define FEATURE_EXT_framebuffer_blit _HAVE_FULL_GL
-#define FEATURE_EXT_framebuffer_object _HAVE_FULL_GL
-#define FEATURE_EXT_pixel_buffer_object _HAVE_FULL_GL
-#define FEATURE_APPLE_object_purgeable _HAVE_FULL_GL
-#define FEATURE_EXT_texture_sRGB _HAVE_FULL_GL
-#define FEATURE_ATI_fragment_shader _HAVE_FULL_GL
-#define FEATURE_NV_fence _HAVE_FULL_GL
-#define FEATURE_NV_fragment_program _HAVE_FULL_GL
-#define FEATURE_NV_vertex_program _HAVE_FULL_GL
-
-#define FEATURE_OES_EGL_image _HAVE_FULL_GL
+#define FEATURE_beginend FEATURE_GL
+#define FEATURE_colortable FEATURE_GL
+#define FEATURE_convolve FEATURE_GL
+#define FEATURE_dlist (FEATURE_GL && FEATURE_arrayelt && FEATURE_beginend)
+#define FEATURE_draw_read_buffer FEATURE_GL
+#define FEATURE_drawpix FEATURE_GL
+#define FEATURE_evaluators FEATURE_GL
+#define FEATURE_feedback FEATURE_GL
+#define FEATURE_histogram FEATURE_GL
+#define FEATURE_pixel_transfer FEATURE_GL
+#define FEATURE_queryobj FEATURE_GL
+#define FEATURE_rastpos FEATURE_GL
+#define FEATURE_texture_fxt1 FEATURE_GL
+#define FEATURE_texture_s3tc FEATURE_GL
+
+#define FEATURE_extra_context_init FEATURE_ES
+#define FEATURE_fixedpt FEATURE_ES
+#define FEATURE_point_size_array FEATURE_ES
+#define FEATURE_vertex_array_byte FEATURE_ES
+
+#define FEATURE_es2_glsl FEATURE_ES2
+
+#define FEATURE_ARB_fragment_program 1
+#define FEATURE_ARB_vertex_program 1
+#define FEATURE_ARB_vertex_shader 1
+#define FEATURE_ARB_fragment_shader 1
+#define FEATURE_ARB_shader_objects (FEATURE_ARB_vertex_shader || FEATURE_ARB_fragment_shader)
+#define FEATURE_ARB_shading_language_100 FEATURE_ARB_shader_objects
+#define FEATURE_ARB_shading_language_120 FEATURE_ARB_shader_objects
+
+#define FEATURE_ARB_framebuffer_object (FEATURE_GL && FEATURE_EXT_framebuffer_object)
+#define FEATURE_ARB_map_buffer_range FEATURE_GL
+#define FEATURE_ARB_pixel_buffer_object (FEATURE_GL && FEATURE_EXT_pixel_buffer_object)
+#define FEATURE_ARB_sync FEATURE_GL
+#define FEATURE_ARB_vertex_buffer_object 1
+
+#define FEATURE_EXT_framebuffer_blit FEATURE_GL
+#define FEATURE_EXT_framebuffer_object 1
+#define FEATURE_EXT_pixel_buffer_object 1
+#define FEATURE_EXT_texture_sRGB FEATURE_GL
+#define FEATURE_EXT_transform_feedback FEATURE_GL
+
+#define FEATURE_APPLE_object_purgeable FEATURE_GL
+#define FEATURE_ATI_fragment_shader FEATURE_GL
+#define FEATURE_NV_fence FEATURE_GL
+#define FEATURE_NV_fragment_program FEATURE_GL
+#define FEATURE_NV_vertex_program FEATURE_GL
+#define FEATURE_OES_EGL_image 1
+#define FEATURE_OES_draw_texture FEATURE_ES1
+#define FEATURE_OES_framebuffer_object FEATURE_ES
+#define FEATURE_OES_mapbuffer FEATURE_ES
#endif /* FEATURES_H */
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 9d9b475dd1..7657efb077 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1910,6 +1910,11 @@ struct gl_query_state
/** GL_NV_conditional_render */
struct gl_query_object *CondRenderQuery;
+
+ /** GL_EXT_transform_feedback */
+ struct gl_query_object *PrimitivesGenerated;
+ struct gl_query_object *PrimitivesWritten;
+
GLenum CondRenderMode;
};
@@ -1976,6 +1981,13 @@ struct gl_shader_program
/** User-defined attribute bindings (glBindAttribLocation) */
struct gl_program_parameter_list *Attributes;
+ /** Transform feedback varyings */
+ struct {
+ GLenum BufferMode;
+ GLuint NumVarying;
+ GLchar **VaryingNames; /**< Array [NumVarying] of char * */
+ } TransformFeedback;
+
/* post-link info: */
struct gl_vertex_program *VertexProgram; /**< Linked vertex program */
struct gl_fragment_program *FragmentProgram; /**< Linked fragment prog */
@@ -2017,6 +2029,29 @@ struct gl_shader_state
/**
+ * Context state for transform feedback.
+ */
+struct gl_transform_feedback
+{
+ GLboolean Active; /**< Is transform feedback enabled? */
+ GLenum Mode; /**< GL_POINTS, GL_LINES or GL_TRIANGLES */
+ /** Start of feedback data in dest buffer */
+ GLintptr Offset[MAX_FEEDBACK_ATTRIBS];
+ /** Max data to put into dest buffer (in bytes) */
+ GLsizeiptr Size[MAX_FEEDBACK_ATTRIBS];
+ GLboolean RasterDiscard; /**< GL_RASTERIZER_DISCARD */
+
+ /** The general binding point (GL_TRANSFORM_FEEDBACK_BUFFER) */
+ struct gl_buffer_object *CurrentBuffer;
+
+ /** The feedback buffers */
+ GLuint BufferNames[MAX_FEEDBACK_ATTRIBS];
+ struct gl_buffer_object *Buffers[MAX_FEEDBACK_ATTRIBS];
+};
+
+
+
+/**
* State which can be shared by multiple contexts:
*/
struct gl_shared_state
@@ -2385,6 +2420,14 @@ struct gl_constants
/**< GL_EXT_provoking_vertex */
GLboolean QuadsFollowProvokingVertexConvention;
+
+ /**< OpenGL version 3.x */
+ GLbitfield ContextFlags; /**< Ex: GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT */
+
+ /** GL_EXT_transform_feedback */
+ GLuint MaxTransformFeedbackSeparateAttribs;
+ GLuint MaxTransformFeedbackSeparateComponents;
+ GLuint MaxTransformFeedbackInterleavedComponents;
};
@@ -2486,6 +2529,7 @@ struct gl_extensions
GLboolean EXT_texture_mirror_clamp;
GLboolean EXT_texture_sRGB;
GLboolean EXT_texture_swizzle;
+ GLboolean EXT_transform_feedback;
GLboolean EXT_timer_query;
GLboolean EXT_vertex_array;
GLboolean EXT_vertex_array_bgra;
@@ -2953,6 +2997,8 @@ struct __GLcontextRec
struct gl_query_state Query; /**< occlusion, timer queries */
+ struct gl_transform_feedback TransformFeedback;
+
struct gl_buffer_object *CopyReadBuffer; /**< GL_ARB_copy_buffer */
struct gl_buffer_object *CopyWriteBuffer; /**< GL_ARB_copy_buffer */
/*@}*/
diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c
index e14511a388..a907dac836 100644
--- a/src/mesa/main/queryobj.c
+++ b/src/mesa/main/queryobj.c
@@ -130,6 +130,42 @@ _mesa_init_query_object_functions(struct dd_function_table *driver)
}
+/**
+ * Return pointer to the query object binding point for the given target.
+ * \return NULL if invalid target, else the address of binding point
+ */
+static struct gl_query_object **
+get_query_binding_point(GLcontext *ctx, GLenum target)
+{
+ switch (target) {
+ case GL_SAMPLES_PASSED_ARB:
+ if (ctx->Extensions.ARB_occlusion_query)
+ return &ctx->Query.CurrentOcclusionObject;
+ else
+ return NULL;
+ case GL_TIME_ELAPSED_EXT:
+ if (ctx->Extensions.EXT_timer_query)
+ return &ctx->Query.CurrentTimerObject;
+ else
+ return NULL;
+#if FEATURE_EXT_transform_feedback
+ case GL_PRIMITIVES_GENERATED:
+ if (ctx->Extensions.EXT_transform_feedback)
+ return &ctx->Query.PrimitivesGenerated;
+ else
+ return NULL;
+ case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
+ if (ctx->Extensions.EXT_transform_feedback)
+ return &ctx->Query.PrimitivesWritten;
+ else
+ return NULL;
+#endif
+ default:
+ return NULL;
+ }
+}
+
+
void GLAPIENTRY
_mesa_GenQueriesARB(GLsizei n, GLuint *ids)
{
@@ -214,36 +250,16 @@ _mesa_IsQueryARB(GLuint id)
static void GLAPIENTRY
_mesa_BeginQueryARB(GLenum target, GLuint id)
{
- struct gl_query_object *q;
+ struct gl_query_object *q, **bindpt;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
FLUSH_VERTICES(ctx, _NEW_DEPTH);
- switch (target) {
- case GL_SAMPLES_PASSED_ARB:
- if (!ctx->Extensions.ARB_occlusion_query) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glBeginQueryARB(target)");
- return;
- }
- if (ctx->Query.CurrentOcclusionObject) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glBeginQueryARB");
- return;
- }
- break;
- case GL_TIME_ELAPSED_EXT:
- if (!ctx->Extensions.EXT_timer_query) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glBeginQueryARB(target)");
- return;
- }
- if (ctx->Query.CurrentTimerObject) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glBeginQueryARB");
- return;
- }
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glBeginQueryARB(target)");
- return;
+ bindpt = get_query_binding_point(ctx, target);
+ if (!bindpt) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glBeginQueryARB(target)");
+ return;
}
if (id == 0) {
@@ -275,12 +291,8 @@ _mesa_BeginQueryARB(GLenum target, GLuint id)
q->Result = 0;
q->Ready = GL_FALSE;
- if (target == GL_SAMPLES_PASSED_ARB) {
- ctx->Query.CurrentOcclusionObject = q;
- }
- else if (target == GL_TIME_ELAPSED_EXT) {
- ctx->Query.CurrentTimerObject = q;
- }
+ /* XXX should probably refcount query objects */
+ *bindpt = q;
ctx->Driver.BeginQuery(ctx, q);
}
@@ -289,34 +301,22 @@ _mesa_BeginQueryARB(GLenum target, GLuint id)
static void GLAPIENTRY
_mesa_EndQueryARB(GLenum target)
{
- struct gl_query_object *q;
+ struct gl_query_object *q, **bindpt;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
FLUSH_VERTICES(ctx, _NEW_DEPTH);
- switch (target) {
- case GL_SAMPLES_PASSED_ARB:
- if (!ctx->Extensions.ARB_occlusion_query) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glEndQueryARB(target)");
- return;
- }
- q = ctx->Query.CurrentOcclusionObject;
- ctx->Query.CurrentOcclusionObject = NULL;
- break;
- case GL_TIME_ELAPSED_EXT:
- if (!ctx->Extensions.EXT_timer_query) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glEndQueryARB(target)");
- return;
- }
- q = ctx->Query.CurrentTimerObject;
- ctx->Query.CurrentTimerObject = NULL;
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glEndQueryARB(target)");
- return;
+ bindpt = get_query_binding_point(ctx, target);
+ if (!bindpt) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glEndQueryARB(target)");
+ return;
}
+ /* XXX should probably refcount query objects */
+ q = *bindpt;
+ *bindpt = NULL;
+
if (!q || !q->Active) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glEndQueryARB(no matching glBeginQueryARB)");
@@ -331,30 +331,18 @@ _mesa_EndQueryARB(GLenum target)
void GLAPIENTRY
_mesa_GetQueryivARB(GLenum target, GLenum pname, GLint *params)
{
- struct gl_query_object *q;
+ struct gl_query_object *q, **bindpt;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
- switch (target) {
- case GL_SAMPLES_PASSED_ARB:
- if (!ctx->Extensions.ARB_occlusion_query) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glEndQueryARB(target)");
- return;
- }
- q = ctx->Query.CurrentOcclusionObject;
- break;
- case GL_TIME_ELAPSED_EXT:
- if (!ctx->Extensions.EXT_timer_query) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glEndQueryARB(target)");
- return;
- }
- q = ctx->Query.CurrentTimerObject;
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetQueryivARB(target)");
- return;
+ bindpt = get_query_binding_point(ctx, target);
+ if (!bindpt) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetQueryARB(target)");
+ return;
}
+ q = *bindpt;
+
switch (pname) {
case GL_QUERY_COUNTER_BITS_ARB:
*params = 8 * sizeof(q->Result);
diff --git a/src/mesa/main/remap_helper.h b/src/mesa/main/remap_helper.h
index ee898efa5f..c13341be98 100644
--- a/src/mesa/main/remap_helper.h
+++ b/src/mesa/main/remap_helper.h
@@ -1242,3137 +1242,3171 @@ static const char _mesa_function_pool[] =
"iip\0"
"glGetTexGendv\0"
"\0"
- /* _mesa_function_pool[8307]: ColorMaskIndexedEXT (will be remapped) */
- "iiiii\0"
- "glColorMaskIndexedEXT\0"
+ /* _mesa_function_pool[8307]: GetVertexAttribfvNV (will be remapped) */
+ "iip\0"
+ "glGetVertexAttribfvNV\0"
"\0"
- /* _mesa_function_pool[8336]: LoadProgramNV (will be remapped) */
+ /* _mesa_function_pool[8334]: BeginTransformFeedbackEXT (will be remapped) */
+ "i\0"
+ "glBeginTransformFeedbackEXT\0"
+ "glBeginTransformFeedback\0"
+ "\0"
+ /* _mesa_function_pool[8390]: LoadProgramNV (will be remapped) */
"iiip\0"
"glLoadProgramNV\0"
"\0"
- /* _mesa_function_pool[8358]: WaitSync (will be remapped) */
+ /* _mesa_function_pool[8412]: WaitSync (will be remapped) */
"iii\0"
"glWaitSync\0"
"\0"
- /* _mesa_function_pool[8374]: EndList (offset 1) */
+ /* _mesa_function_pool[8428]: EndList (offset 1) */
"\0"
"glEndList\0"
"\0"
- /* _mesa_function_pool[8386]: VertexAttrib4fvNV (will be remapped) */
+ /* _mesa_function_pool[8440]: VertexAttrib4fvNV (will be remapped) */
"ip\0"
"glVertexAttrib4fvNV\0"
"\0"
- /* _mesa_function_pool[8410]: GetAttachedObjectsARB (will be remapped) */
+ /* _mesa_function_pool[8464]: GetAttachedObjectsARB (will be remapped) */
"iipp\0"
"glGetAttachedObjectsARB\0"
"\0"
- /* _mesa_function_pool[8440]: Uniform3fvARB (will be remapped) */
+ /* _mesa_function_pool[8494]: Uniform3fvARB (will be remapped) */
"iip\0"
"glUniform3fv\0"
"glUniform3fvARB\0"
"\0"
- /* _mesa_function_pool[8474]: EvalCoord1fv (offset 231) */
+ /* _mesa_function_pool[8528]: EvalCoord1fv (offset 231) */
"p\0"
"glEvalCoord1fv\0"
"\0"
- /* _mesa_function_pool[8492]: DrawRangeElements (offset 338) */
+ /* _mesa_function_pool[8546]: DrawRangeElements (offset 338) */
"iiiiip\0"
"glDrawRangeElements\0"
"glDrawRangeElementsEXT\0"
"\0"
- /* _mesa_function_pool[8543]: EvalMesh2 (offset 238) */
+ /* _mesa_function_pool[8597]: EvalMesh2 (offset 238) */
"iiiii\0"
"glEvalMesh2\0"
"\0"
- /* _mesa_function_pool[8562]: Vertex4fv (offset 145) */
+ /* _mesa_function_pool[8616]: Vertex4fv (offset 145) */
"p\0"
"glVertex4fv\0"
"\0"
- /* _mesa_function_pool[8577]: SpriteParameterfvSGIX (dynamic) */
+ /* _mesa_function_pool[8631]: SpriteParameterfvSGIX (dynamic) */
"ip\0"
"glSpriteParameterfvSGIX\0"
"\0"
- /* _mesa_function_pool[8605]: CheckFramebufferStatusEXT (will be remapped) */
+ /* _mesa_function_pool[8659]: CheckFramebufferStatusEXT (will be remapped) */
"i\0"
"glCheckFramebufferStatus\0"
"glCheckFramebufferStatusEXT\0"
"\0"
- /* _mesa_function_pool[8661]: GlobalAlphaFactoruiSUN (dynamic) */
+ /* _mesa_function_pool[8715]: GlobalAlphaFactoruiSUN (dynamic) */
"i\0"
"glGlobalAlphaFactoruiSUN\0"
"\0"
- /* _mesa_function_pool[8689]: GetHandleARB (will be remapped) */
+ /* _mesa_function_pool[8743]: GetHandleARB (will be remapped) */
"i\0"
"glGetHandleARB\0"
"\0"
- /* _mesa_function_pool[8707]: GetVertexAttribivARB (will be remapped) */
+ /* _mesa_function_pool[8761]: GetVertexAttribivARB (will be remapped) */
"iip\0"
"glGetVertexAttribiv\0"
"glGetVertexAttribivARB\0"
"\0"
- /* _mesa_function_pool[8755]: GetCombinerInputParameterfvNV (will be remapped) */
+ /* _mesa_function_pool[8809]: GetCombinerInputParameterfvNV (will be remapped) */
"iiiip\0"
"glGetCombinerInputParameterfvNV\0"
"\0"
- /* _mesa_function_pool[8794]: CreateProgram (will be remapped) */
+ /* _mesa_function_pool[8848]: CreateProgram (will be remapped) */
"\0"
"glCreateProgram\0"
"\0"
- /* _mesa_function_pool[8812]: LoadTransposeMatrixdARB (will be remapped) */
+ /* _mesa_function_pool[8866]: LoadTransposeMatrixdARB (will be remapped) */
"p\0"
"glLoadTransposeMatrixd\0"
"glLoadTransposeMatrixdARB\0"
"\0"
- /* _mesa_function_pool[8864]: GetMinmax (offset 364) */
+ /* _mesa_function_pool[8918]: GetMinmax (offset 364) */
"iiiip\0"
"glGetMinmax\0"
"glGetMinmaxEXT\0"
"\0"
- /* _mesa_function_pool[8898]: StencilFuncSeparate (will be remapped) */
+ /* _mesa_function_pool[8952]: StencilFuncSeparate (will be remapped) */
"iiii\0"
"glStencilFuncSeparate\0"
"\0"
- /* _mesa_function_pool[8926]: SecondaryColor3sEXT (will be remapped) */
+ /* _mesa_function_pool[8980]: SecondaryColor3sEXT (will be remapped) */
"iii\0"
"glSecondaryColor3s\0"
"glSecondaryColor3sEXT\0"
"\0"
- /* _mesa_function_pool[8972]: Color3fVertex3fvSUN (dynamic) */
+ /* _mesa_function_pool[9026]: Color3fVertex3fvSUN (dynamic) */
"pp\0"
"glColor3fVertex3fvSUN\0"
"\0"
- /* _mesa_function_pool[8998]: Normal3fv (offset 57) */
+ /* _mesa_function_pool[9052]: Normal3fv (offset 57) */
"p\0"
"glNormal3fv\0"
"\0"
- /* _mesa_function_pool[9013]: GlobalAlphaFactorbSUN (dynamic) */
+ /* _mesa_function_pool[9067]: GlobalAlphaFactorbSUN (dynamic) */
"i\0"
"glGlobalAlphaFactorbSUN\0"
"\0"
- /* _mesa_function_pool[9040]: Color3us (offset 23) */
+ /* _mesa_function_pool[9094]: Color3us (offset 23) */
"iii\0"
"glColor3us\0"
"\0"
- /* _mesa_function_pool[9056]: ImageTransformParameterfvHP (dynamic) */
+ /* _mesa_function_pool[9110]: ImageTransformParameterfvHP (dynamic) */
"iip\0"
"glImageTransformParameterfvHP\0"
"\0"
- /* _mesa_function_pool[9091]: VertexAttrib4ivARB (will be remapped) */
+ /* _mesa_function_pool[9145]: VertexAttrib4ivARB (will be remapped) */
"ip\0"
"glVertexAttrib4iv\0"
"glVertexAttrib4ivARB\0"
"\0"
- /* _mesa_function_pool[9134]: End (offset 43) */
+ /* _mesa_function_pool[9188]: End (offset 43) */
"\0"
"glEnd\0"
"\0"
- /* _mesa_function_pool[9142]: VertexAttrib3fNV (will be remapped) */
+ /* _mesa_function_pool[9196]: VertexAttrib3fNV (will be remapped) */
"ifff\0"
"glVertexAttrib3fNV\0"
"\0"
- /* _mesa_function_pool[9167]: VertexAttribs2dvNV (will be remapped) */
+ /* _mesa_function_pool[9221]: VertexAttribs2dvNV (will be remapped) */
"iip\0"
"glVertexAttribs2dvNV\0"
"\0"
- /* _mesa_function_pool[9193]: GetQueryObjectui64vEXT (will be remapped) */
+ /* _mesa_function_pool[9247]: GetQueryObjectui64vEXT (will be remapped) */
"iip\0"
"glGetQueryObjectui64vEXT\0"
"\0"
- /* _mesa_function_pool[9223]: MultiTexCoord3fvARB (offset 395) */
+ /* _mesa_function_pool[9277]: MultiTexCoord3fvARB (offset 395) */
"ip\0"
"glMultiTexCoord3fv\0"
"glMultiTexCoord3fvARB\0"
"\0"
- /* _mesa_function_pool[9268]: SecondaryColor3dEXT (will be remapped) */
+ /* _mesa_function_pool[9322]: SecondaryColor3dEXT (will be remapped) */
"ddd\0"
"glSecondaryColor3d\0"
"glSecondaryColor3dEXT\0"
"\0"
- /* _mesa_function_pool[9314]: Color3ub (offset 19) */
+ /* _mesa_function_pool[9368]: Color3ub (offset 19) */
"iii\0"
"glColor3ub\0"
"\0"
- /* _mesa_function_pool[9330]: GetProgramParameterfvNV (will be remapped) */
+ /* _mesa_function_pool[9384]: GetProgramParameterfvNV (will be remapped) */
"iiip\0"
"glGetProgramParameterfvNV\0"
"\0"
- /* _mesa_function_pool[9362]: TangentPointerEXT (dynamic) */
+ /* _mesa_function_pool[9416]: TangentPointerEXT (dynamic) */
"iip\0"
"glTangentPointerEXT\0"
"\0"
- /* _mesa_function_pool[9387]: Color4fNormal3fVertex3fvSUN (dynamic) */
+ /* _mesa_function_pool[9441]: Color4fNormal3fVertex3fvSUN (dynamic) */
"ppp\0"
"glColor4fNormal3fVertex3fvSUN\0"
"\0"
- /* _mesa_function_pool[9422]: GetInstrumentsSGIX (dynamic) */
+ /* _mesa_function_pool[9476]: GetInstrumentsSGIX (dynamic) */
"\0"
"glGetInstrumentsSGIX\0"
"\0"
- /* _mesa_function_pool[9445]: Color3ui (offset 21) */
+ /* _mesa_function_pool[9499]: Color3ui (offset 21) */
"iii\0"
"glColor3ui\0"
"\0"
- /* _mesa_function_pool[9461]: EvalMapsNV (dynamic) */
+ /* _mesa_function_pool[9515]: EvalMapsNV (dynamic) */
"ii\0"
"glEvalMapsNV\0"
"\0"
- /* _mesa_function_pool[9478]: TexSubImage2D (offset 333) */
+ /* _mesa_function_pool[9532]: TexSubImage2D (offset 333) */
"iiiiiiiip\0"
"glTexSubImage2D\0"
"glTexSubImage2DEXT\0"
"\0"
- /* _mesa_function_pool[9524]: FragmentLightivSGIX (dynamic) */
+ /* _mesa_function_pool[9578]: FragmentLightivSGIX (dynamic) */
"iip\0"
"glFragmentLightivSGIX\0"
"\0"
- /* _mesa_function_pool[9551]: GetTexParameterPointervAPPLE (will be remapped) */
+ /* _mesa_function_pool[9605]: GetTexParameterPointervAPPLE (will be remapped) */
"iip\0"
"glGetTexParameterPointervAPPLE\0"
"\0"
- /* _mesa_function_pool[9587]: TexGenfv (offset 191) */
+ /* _mesa_function_pool[9641]: TexGenfv (offset 191) */
"iip\0"
"glTexGenfv\0"
"\0"
- /* _mesa_function_pool[9603]: PixelTransformParameterfvEXT (dynamic) */
- "iip\0"
- "glPixelTransformParameterfvEXT\0"
+ /* _mesa_function_pool[9657]: GetTransformFeedbackVaryingEXT (will be remapped) */
+ "iiipppp\0"
+ "glGetTransformFeedbackVaryingEXT\0"
+ "glGetTransformFeedbackVarying\0"
"\0"
- /* _mesa_function_pool[9639]: VertexAttrib4bvARB (will be remapped) */
+ /* _mesa_function_pool[9729]: VertexAttrib4bvARB (will be remapped) */
"ip\0"
"glVertexAttrib4bv\0"
"glVertexAttrib4bvARB\0"
"\0"
- /* _mesa_function_pool[9682]: AlphaFragmentOp2ATI (will be remapped) */
+ /* _mesa_function_pool[9772]: AlphaFragmentOp2ATI (will be remapped) */
"iiiiiiiii\0"
"glAlphaFragmentOp2ATI\0"
"\0"
- /* _mesa_function_pool[9715]: GetIntegerIndexedvEXT (will be remapped) */
+ /* _mesa_function_pool[9805]: GetIntegerIndexedvEXT (will be remapped) */
"iip\0"
"glGetIntegerIndexedvEXT\0"
"\0"
- /* _mesa_function_pool[9744]: MultiTexCoord4sARB (offset 406) */
+ /* _mesa_function_pool[9834]: MultiTexCoord4sARB (offset 406) */
"iiiii\0"
"glMultiTexCoord4s\0"
"glMultiTexCoord4sARB\0"
"\0"
- /* _mesa_function_pool[9790]: GetFragmentMaterialivSGIX (dynamic) */
+ /* _mesa_function_pool[9880]: GetFragmentMaterialivSGIX (dynamic) */
"iip\0"
"glGetFragmentMaterialivSGIX\0"
"\0"
- /* _mesa_function_pool[9823]: WindowPos4dMESA (will be remapped) */
+ /* _mesa_function_pool[9913]: WindowPos4dMESA (will be remapped) */
"dddd\0"
"glWindowPos4dMESA\0"
"\0"
- /* _mesa_function_pool[9847]: WeightPointerARB (dynamic) */
+ /* _mesa_function_pool[9937]: WeightPointerARB (dynamic) */
"iiip\0"
"glWeightPointerARB\0"
"\0"
- /* _mesa_function_pool[9872]: WindowPos2dMESA (will be remapped) */
+ /* _mesa_function_pool[9962]: WindowPos2dMESA (will be remapped) */
"dd\0"
"glWindowPos2d\0"
"glWindowPos2dARB\0"
"glWindowPos2dMESA\0"
"\0"
- /* _mesa_function_pool[9925]: FramebufferTexture3DEXT (will be remapped) */
+ /* _mesa_function_pool[10015]: FramebufferTexture3DEXT (will be remapped) */
"iiiiii\0"
"glFramebufferTexture3D\0"
"glFramebufferTexture3DEXT\0"
"\0"
- /* _mesa_function_pool[9982]: BlendEquation (offset 337) */
+ /* _mesa_function_pool[10072]: BlendEquation (offset 337) */
"i\0"
"glBlendEquation\0"
"glBlendEquationEXT\0"
"\0"
- /* _mesa_function_pool[10020]: VertexAttrib3dNV (will be remapped) */
+ /* _mesa_function_pool[10110]: VertexAttrib3dNV (will be remapped) */
"iddd\0"
"glVertexAttrib3dNV\0"
"\0"
- /* _mesa_function_pool[10045]: VertexAttrib3dARB (will be remapped) */
+ /* _mesa_function_pool[10135]: VertexAttrib3dARB (will be remapped) */
"iddd\0"
"glVertexAttrib3d\0"
"glVertexAttrib3dARB\0"
"\0"
- /* _mesa_function_pool[10088]: ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (dynamic) */
+ /* _mesa_function_pool[10178]: ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (dynamic) */
"ppppp\0"
"glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN\0"
"\0"
- /* _mesa_function_pool[10152]: VertexAttrib4fARB (will be remapped) */
+ /* _mesa_function_pool[10242]: VertexAttrib4fARB (will be remapped) */
"iffff\0"
"glVertexAttrib4f\0"
"glVertexAttrib4fARB\0"
"\0"
- /* _mesa_function_pool[10196]: GetError (offset 261) */
+ /* _mesa_function_pool[10286]: GetError (offset 261) */
"\0"
"glGetError\0"
"\0"
- /* _mesa_function_pool[10209]: IndexFuncEXT (dynamic) */
+ /* _mesa_function_pool[10299]: IndexFuncEXT (dynamic) */
"if\0"
"glIndexFuncEXT\0"
"\0"
- /* _mesa_function_pool[10228]: TexCoord3dv (offset 111) */
+ /* _mesa_function_pool[10318]: TexCoord3dv (offset 111) */
"p\0"
"glTexCoord3dv\0"
"\0"
- /* _mesa_function_pool[10245]: Indexdv (offset 45) */
+ /* _mesa_function_pool[10335]: Indexdv (offset 45) */
"p\0"
"glIndexdv\0"
"\0"
- /* _mesa_function_pool[10258]: FramebufferTexture2DEXT (will be remapped) */
+ /* _mesa_function_pool[10348]: FramebufferTexture2DEXT (will be remapped) */
"iiiii\0"
"glFramebufferTexture2D\0"
"glFramebufferTexture2DEXT\0"
"\0"
- /* _mesa_function_pool[10314]: Normal3s (offset 60) */
+ /* _mesa_function_pool[10404]: Normal3s (offset 60) */
"iii\0"
"glNormal3s\0"
"\0"
- /* _mesa_function_pool[10330]: GetObjectParameterivAPPLE (will be remapped) */
+ /* _mesa_function_pool[10420]: GetObjectParameterivAPPLE (will be remapped) */
"iiip\0"
"glGetObjectParameterivAPPLE\0"
"\0"
- /* _mesa_function_pool[10364]: PushName (offset 201) */
+ /* _mesa_function_pool[10454]: PushName (offset 201) */
"i\0"
"glPushName\0"
"\0"
- /* _mesa_function_pool[10378]: MultiTexCoord2dvARB (offset 385) */
+ /* _mesa_function_pool[10468]: MultiTexCoord2dvARB (offset 385) */
"ip\0"
"glMultiTexCoord2dv\0"
"glMultiTexCoord2dvARB\0"
"\0"
- /* _mesa_function_pool[10423]: CullParameterfvEXT (will be remapped) */
+ /* _mesa_function_pool[10513]: CullParameterfvEXT (will be remapped) */
"ip\0"
"glCullParameterfvEXT\0"
"\0"
- /* _mesa_function_pool[10448]: Normal3i (offset 58) */
+ /* _mesa_function_pool[10538]: Normal3i (offset 58) */
"iii\0"
"glNormal3i\0"
"\0"
- /* _mesa_function_pool[10464]: ProgramNamedParameter4fvNV (will be remapped) */
+ /* _mesa_function_pool[10554]: ProgramNamedParameter4fvNV (will be remapped) */
"iipp\0"
"glProgramNamedParameter4fvNV\0"
"\0"
- /* _mesa_function_pool[10499]: SecondaryColorPointerEXT (will be remapped) */
+ /* _mesa_function_pool[10589]: SecondaryColorPointerEXT (will be remapped) */
"iiip\0"
"glSecondaryColorPointer\0"
"glSecondaryColorPointerEXT\0"
"\0"
- /* _mesa_function_pool[10556]: VertexAttrib4fvARB (will be remapped) */
+ /* _mesa_function_pool[10646]: VertexAttrib4fvARB (will be remapped) */
"ip\0"
"glVertexAttrib4fv\0"
"glVertexAttrib4fvARB\0"
"\0"
- /* _mesa_function_pool[10599]: ColorPointerListIBM (dynamic) */
+ /* _mesa_function_pool[10689]: ColorPointerListIBM (dynamic) */
"iiipi\0"
"glColorPointerListIBM\0"
"\0"
- /* _mesa_function_pool[10628]: GetActiveUniformARB (will be remapped) */
+ /* _mesa_function_pool[10718]: GetActiveUniformARB (will be remapped) */
"iiipppp\0"
"glGetActiveUniform\0"
"glGetActiveUniformARB\0"
"\0"
- /* _mesa_function_pool[10678]: ImageTransformParameteriHP (dynamic) */
+ /* _mesa_function_pool[10768]: ImageTransformParameteriHP (dynamic) */
"iii\0"
"glImageTransformParameteriHP\0"
"\0"
- /* _mesa_function_pool[10712]: Normal3b (offset 52) */
+ /* _mesa_function_pool[10802]: Normal3b (offset 52) */
"iii\0"
"glNormal3b\0"
"\0"
- /* _mesa_function_pool[10728]: Normal3d (offset 54) */
+ /* _mesa_function_pool[10818]: Normal3d (offset 54) */
"ddd\0"
"glNormal3d\0"
"\0"
- /* _mesa_function_pool[10744]: Normal3f (offset 56) */
+ /* _mesa_function_pool[10834]: Normal3f (offset 56) */
"fff\0"
"glNormal3f\0"
"\0"
- /* _mesa_function_pool[10760]: MultiTexCoord1svARB (offset 383) */
+ /* _mesa_function_pool[10850]: MultiTexCoord1svARB (offset 383) */
"ip\0"
"glMultiTexCoord1sv\0"
"glMultiTexCoord1svARB\0"
"\0"
- /* _mesa_function_pool[10805]: Indexi (offset 48) */
+ /* _mesa_function_pool[10895]: Indexi (offset 48) */
"i\0"
"glIndexi\0"
"\0"
- /* _mesa_function_pool[10817]: EGLImageTargetTexture2DOES (will be remapped) */
+ /* _mesa_function_pool[10907]: EGLImageTargetTexture2DOES (will be remapped) */
"ip\0"
"glEGLImageTargetTexture2DOES\0"
"\0"
- /* _mesa_function_pool[10850]: EndQueryARB (will be remapped) */
+ /* _mesa_function_pool[10940]: EndQueryARB (will be remapped) */
"i\0"
"glEndQuery\0"
"glEndQueryARB\0"
"\0"
- /* _mesa_function_pool[10878]: DeleteFencesNV (will be remapped) */
+ /* _mesa_function_pool[10968]: DeleteFencesNV (will be remapped) */
"ip\0"
"glDeleteFencesNV\0"
"\0"
- /* _mesa_function_pool[10899]: DepthMask (offset 211) */
+ /* _mesa_function_pool[10989]: DeformationMap3dSGIX (dynamic) */
+ "iddiiddiiddiip\0"
+ "glDeformationMap3dSGIX\0"
+ "\0"
+ /* _mesa_function_pool[11028]: BindBufferRangeEXT (will be remapped) */
+ "iiiii\0"
+ "glBindBufferRangeEXT\0"
+ "glBindBufferRange\0"
+ "\0"
+ /* _mesa_function_pool[11074]: DepthMask (offset 211) */
"i\0"
"glDepthMask\0"
"\0"
- /* _mesa_function_pool[10914]: IsShader (will be remapped) */
+ /* _mesa_function_pool[11089]: IsShader (will be remapped) */
"i\0"
"glIsShader\0"
"\0"
- /* _mesa_function_pool[10928]: Indexf (offset 46) */
+ /* _mesa_function_pool[11103]: Indexf (offset 46) */
"f\0"
"glIndexf\0"
"\0"
- /* _mesa_function_pool[10940]: GetImageTransformParameterivHP (dynamic) */
+ /* _mesa_function_pool[11115]: GetImageTransformParameterivHP (dynamic) */
"iip\0"
"glGetImageTransformParameterivHP\0"
"\0"
- /* _mesa_function_pool[10978]: Indexd (offset 44) */
+ /* _mesa_function_pool[11153]: Indexd (offset 44) */
"d\0"
"glIndexd\0"
"\0"
- /* _mesa_function_pool[10990]: GetMaterialiv (offset 270) */
+ /* _mesa_function_pool[11165]: GetMaterialiv (offset 270) */
"iip\0"
"glGetMaterialiv\0"
"\0"
- /* _mesa_function_pool[11011]: StencilOp (offset 244) */
+ /* _mesa_function_pool[11186]: StencilOp (offset 244) */
"iii\0"
"glStencilOp\0"
"\0"
- /* _mesa_function_pool[11028]: WindowPos4ivMESA (will be remapped) */
+ /* _mesa_function_pool[11203]: WindowPos4ivMESA (will be remapped) */
"p\0"
"glWindowPos4ivMESA\0"
"\0"
- /* _mesa_function_pool[11050]: MultiTexCoord3svARB (offset 399) */
+ /* _mesa_function_pool[11225]: MultiTexCoord3svARB (offset 399) */
"ip\0"
"glMultiTexCoord3sv\0"
"glMultiTexCoord3svARB\0"
"\0"
- /* _mesa_function_pool[11095]: TexEnvfv (offset 185) */
+ /* _mesa_function_pool[11270]: TexEnvfv (offset 185) */
"iip\0"
"glTexEnvfv\0"
"\0"
- /* _mesa_function_pool[11111]: MultiTexCoord4iARB (offset 404) */
+ /* _mesa_function_pool[11286]: MultiTexCoord4iARB (offset 404) */
"iiiii\0"
"glMultiTexCoord4i\0"
"glMultiTexCoord4iARB\0"
"\0"
- /* _mesa_function_pool[11157]: Indexs (offset 50) */
+ /* _mesa_function_pool[11332]: Indexs (offset 50) */
"i\0"
"glIndexs\0"
"\0"
- /* _mesa_function_pool[11169]: Binormal3ivEXT (dynamic) */
+ /* _mesa_function_pool[11344]: Binormal3ivEXT (dynamic) */
"p\0"
"glBinormal3ivEXT\0"
"\0"
- /* _mesa_function_pool[11189]: ResizeBuffersMESA (will be remapped) */
+ /* _mesa_function_pool[11364]: ResizeBuffersMESA (will be remapped) */
"\0"
"glResizeBuffersMESA\0"
"\0"
- /* _mesa_function_pool[11211]: GetUniformivARB (will be remapped) */
+ /* _mesa_function_pool[11386]: GetUniformivARB (will be remapped) */
"iip\0"
"glGetUniformiv\0"
"glGetUniformivARB\0"
"\0"
- /* _mesa_function_pool[11249]: PixelTexGenParameteriSGIS (will be remapped) */
+ /* _mesa_function_pool[11424]: PixelTexGenParameteriSGIS (will be remapped) */
"ii\0"
"glPixelTexGenParameteriSGIS\0"
"\0"
- /* _mesa_function_pool[11281]: VertexPointervINTEL (dynamic) */
+ /* _mesa_function_pool[11456]: VertexPointervINTEL (dynamic) */
"iip\0"
"glVertexPointervINTEL\0"
"\0"
- /* _mesa_function_pool[11308]: Vertex2i (offset 130) */
+ /* _mesa_function_pool[11483]: Vertex2i (offset 130) */
"ii\0"
"glVertex2i\0"
"\0"
- /* _mesa_function_pool[11323]: LoadMatrixf (offset 291) */
+ /* _mesa_function_pool[11498]: LoadMatrixf (offset 291) */
"p\0"
"glLoadMatrixf\0"
"\0"
- /* _mesa_function_pool[11340]: Vertex2f (offset 128) */
+ /* _mesa_function_pool[11515]: Vertex2f (offset 128) */
"ff\0"
"glVertex2f\0"
"\0"
- /* _mesa_function_pool[11355]: ReplacementCodeuiColor4fNormal3fVertex3fvSUN (dynamic) */
+ /* _mesa_function_pool[11530]: ReplacementCodeuiColor4fNormal3fVertex3fvSUN (dynamic) */
"pppp\0"
"glReplacementCodeuiColor4fNormal3fVertex3fvSUN\0"
"\0"
- /* _mesa_function_pool[11408]: Color4bv (offset 26) */
+ /* _mesa_function_pool[11583]: Color4bv (offset 26) */
"p\0"
"glColor4bv\0"
"\0"
- /* _mesa_function_pool[11422]: VertexPointer (offset 321) */
+ /* _mesa_function_pool[11597]: VertexPointer (offset 321) */
"iiip\0"
"glVertexPointer\0"
"\0"
- /* _mesa_function_pool[11444]: SecondaryColor3uiEXT (will be remapped) */
+ /* _mesa_function_pool[11619]: SecondaryColor3uiEXT (will be remapped) */
"iii\0"
"glSecondaryColor3ui\0"
"glSecondaryColor3uiEXT\0"
"\0"
- /* _mesa_function_pool[11492]: StartInstrumentsSGIX (dynamic) */
+ /* _mesa_function_pool[11667]: StartInstrumentsSGIX (dynamic) */
"\0"
"glStartInstrumentsSGIX\0"
"\0"
- /* _mesa_function_pool[11517]: SecondaryColor3usvEXT (will be remapped) */
+ /* _mesa_function_pool[11692]: SecondaryColor3usvEXT (will be remapped) */
"p\0"
"glSecondaryColor3usv\0"
"glSecondaryColor3usvEXT\0"
"\0"
- /* _mesa_function_pool[11565]: VertexAttrib2fvNV (will be remapped) */
+ /* _mesa_function_pool[11740]: VertexAttrib2fvNV (will be remapped) */
"ip\0"
"glVertexAttrib2fvNV\0"
"\0"
- /* _mesa_function_pool[11589]: ProgramLocalParameter4dvARB (will be remapped) */
+ /* _mesa_function_pool[11764]: ProgramLocalParameter4dvARB (will be remapped) */
"iip\0"
"glProgramLocalParameter4dvARB\0"
"\0"
- /* _mesa_function_pool[11624]: DeleteLists (offset 4) */
+ /* _mesa_function_pool[11799]: DeleteLists (offset 4) */
"ii\0"
"glDeleteLists\0"
"\0"
- /* _mesa_function_pool[11642]: LogicOp (offset 242) */
+ /* _mesa_function_pool[11817]: LogicOp (offset 242) */
"i\0"
"glLogicOp\0"
"\0"
- /* _mesa_function_pool[11655]: MatrixIndexuivARB (dynamic) */
+ /* _mesa_function_pool[11830]: MatrixIndexuivARB (dynamic) */
"ip\0"
"glMatrixIndexuivARB\0"
"\0"
- /* _mesa_function_pool[11679]: Vertex2s (offset 132) */
+ /* _mesa_function_pool[11854]: Vertex2s (offset 132) */
"ii\0"
"glVertex2s\0"
"\0"
- /* _mesa_function_pool[11694]: RenderbufferStorageMultisample (will be remapped) */
+ /* _mesa_function_pool[11869]: RenderbufferStorageMultisample (will be remapped) */
"iiiii\0"
"glRenderbufferStorageMultisample\0"
"glRenderbufferStorageMultisampleEXT\0"
"\0"
- /* _mesa_function_pool[11770]: TexCoord4fv (offset 121) */
+ /* _mesa_function_pool[11945]: TexCoord4fv (offset 121) */
"p\0"
"glTexCoord4fv\0"
"\0"
- /* _mesa_function_pool[11787]: Tangent3sEXT (dynamic) */
+ /* _mesa_function_pool[11962]: Tangent3sEXT (dynamic) */
"iii\0"
"glTangent3sEXT\0"
"\0"
- /* _mesa_function_pool[11807]: GlobalAlphaFactorfSUN (dynamic) */
+ /* _mesa_function_pool[11982]: GlobalAlphaFactorfSUN (dynamic) */
"f\0"
"glGlobalAlphaFactorfSUN\0"
"\0"
- /* _mesa_function_pool[11834]: MultiTexCoord3iARB (offset 396) */
+ /* _mesa_function_pool[12009]: MultiTexCoord3iARB (offset 396) */
"iiii\0"
"glMultiTexCoord3i\0"
"glMultiTexCoord3iARB\0"
"\0"
- /* _mesa_function_pool[11879]: IsProgram (will be remapped) */
+ /* _mesa_function_pool[12054]: IsProgram (will be remapped) */
"i\0"
"glIsProgram\0"
"\0"
- /* _mesa_function_pool[11894]: TexCoordPointerListIBM (dynamic) */
+ /* _mesa_function_pool[12069]: TexCoordPointerListIBM (dynamic) */
"iiipi\0"
"glTexCoordPointerListIBM\0"
"\0"
- /* _mesa_function_pool[11926]: GlobalAlphaFactorusSUN (dynamic) */
+ /* _mesa_function_pool[12101]: GlobalAlphaFactorusSUN (dynamic) */
"i\0"
"glGlobalAlphaFactorusSUN\0"
"\0"
- /* _mesa_function_pool[11954]: VertexAttrib2dvNV (will be remapped) */
+ /* _mesa_function_pool[12129]: VertexAttrib2dvNV (will be remapped) */
"ip\0"
"glVertexAttrib2dvNV\0"
"\0"
- /* _mesa_function_pool[11978]: FramebufferRenderbufferEXT (will be remapped) */
+ /* _mesa_function_pool[12153]: FramebufferRenderbufferEXT (will be remapped) */
"iiii\0"
"glFramebufferRenderbuffer\0"
"glFramebufferRenderbufferEXT\0"
"\0"
- /* _mesa_function_pool[12039]: VertexAttrib1dvNV (will be remapped) */
+ /* _mesa_function_pool[12214]: VertexAttrib1dvNV (will be remapped) */
"ip\0"
"glVertexAttrib1dvNV\0"
"\0"
- /* _mesa_function_pool[12063]: GenTextures (offset 328) */
+ /* _mesa_function_pool[12238]: GenTextures (offset 328) */
"ip\0"
"glGenTextures\0"
"glGenTexturesEXT\0"
"\0"
- /* _mesa_function_pool[12098]: SetFenceNV (will be remapped) */
+ /* _mesa_function_pool[12273]: SetFenceNV (will be remapped) */
"ii\0"
"glSetFenceNV\0"
"\0"
- /* _mesa_function_pool[12115]: FramebufferTexture1DEXT (will be remapped) */
+ /* _mesa_function_pool[12290]: FramebufferTexture1DEXT (will be remapped) */
"iiiii\0"
"glFramebufferTexture1D\0"
"glFramebufferTexture1DEXT\0"
"\0"
- /* _mesa_function_pool[12171]: GetCombinerOutputParameterivNV (will be remapped) */
+ /* _mesa_function_pool[12346]: GetCombinerOutputParameterivNV (will be remapped) */
"iiip\0"
"glGetCombinerOutputParameterivNV\0"
"\0"
- /* _mesa_function_pool[12210]: MultiModeDrawArraysIBM (will be remapped) */
- "pppii\0"
- "glMultiModeDrawArraysIBM\0"
- "\0"
- /* _mesa_function_pool[12242]: PixelTexGenParameterivSGIS (will be remapped) */
+ /* _mesa_function_pool[12385]: PixelTexGenParameterivSGIS (will be remapped) */
"ip\0"
"glPixelTexGenParameterivSGIS\0"
"\0"
- /* _mesa_function_pool[12275]: TextureNormalEXT (dynamic) */
+ /* _mesa_function_pool[12418]: TextureNormalEXT (dynamic) */
"i\0"
"glTextureNormalEXT\0"
"\0"
- /* _mesa_function_pool[12297]: IndexPointerListIBM (dynamic) */
+ /* _mesa_function_pool[12440]: IndexPointerListIBM (dynamic) */
"iipi\0"
"glIndexPointerListIBM\0"
"\0"
- /* _mesa_function_pool[12325]: WeightfvARB (dynamic) */
+ /* _mesa_function_pool[12468]: WeightfvARB (dynamic) */
"ip\0"
"glWeightfvARB\0"
"\0"
- /* _mesa_function_pool[12343]: RasterPos2sv (offset 69) */
+ /* _mesa_function_pool[12486]: RasterPos2sv (offset 69) */
"p\0"
"glRasterPos2sv\0"
"\0"
- /* _mesa_function_pool[12361]: Color4ubv (offset 36) */
+ /* _mesa_function_pool[12504]: Color4ubv (offset 36) */
"p\0"
"glColor4ubv\0"
"\0"
- /* _mesa_function_pool[12376]: DrawBuffer (offset 202) */
+ /* _mesa_function_pool[12519]: DrawBuffer (offset 202) */
"i\0"
"glDrawBuffer\0"
"\0"
- /* _mesa_function_pool[12392]: TexCoord2fv (offset 105) */
+ /* _mesa_function_pool[12535]: TexCoord2fv (offset 105) */
"p\0"
"glTexCoord2fv\0"
"\0"
- /* _mesa_function_pool[12409]: WindowPos4fMESA (will be remapped) */
+ /* _mesa_function_pool[12552]: WindowPos4fMESA (will be remapped) */
"ffff\0"
"glWindowPos4fMESA\0"
"\0"
- /* _mesa_function_pool[12433]: TexCoord1sv (offset 101) */
+ /* _mesa_function_pool[12576]: TexCoord1sv (offset 101) */
"p\0"
"glTexCoord1sv\0"
"\0"
- /* _mesa_function_pool[12450]: WindowPos3dvMESA (will be remapped) */
+ /* _mesa_function_pool[12593]: WindowPos3dvMESA (will be remapped) */
"p\0"
"glWindowPos3dv\0"
"glWindowPos3dvARB\0"
"glWindowPos3dvMESA\0"
"\0"
- /* _mesa_function_pool[12505]: DepthFunc (offset 245) */
+ /* _mesa_function_pool[12648]: DepthFunc (offset 245) */
"i\0"
"glDepthFunc\0"
"\0"
- /* _mesa_function_pool[12520]: PixelMapusv (offset 253) */
+ /* _mesa_function_pool[12663]: PixelMapusv (offset 253) */
"iip\0"
"glPixelMapusv\0"
"\0"
- /* _mesa_function_pool[12539]: GetQueryObjecti64vEXT (will be remapped) */
+ /* _mesa_function_pool[12682]: GetQueryObjecti64vEXT (will be remapped) */
"iip\0"
"glGetQueryObjecti64vEXT\0"
"\0"
- /* _mesa_function_pool[12568]: MultiTexCoord1dARB (offset 376) */
+ /* _mesa_function_pool[12711]: MultiTexCoord1dARB (offset 376) */
"id\0"
"glMultiTexCoord1d\0"
"glMultiTexCoord1dARB\0"
"\0"
- /* _mesa_function_pool[12611]: PointParameterivNV (will be remapped) */
+ /* _mesa_function_pool[12754]: PointParameterivNV (will be remapped) */
"ip\0"
"glPointParameteriv\0"
"glPointParameterivNV\0"
"\0"
- /* _mesa_function_pool[12655]: BlendFunc (offset 241) */
+ /* _mesa_function_pool[12798]: BlendFunc (offset 241) */
"ii\0"
"glBlendFunc\0"
"\0"
- /* _mesa_function_pool[12671]: Uniform2fvARB (will be remapped) */
+ /* _mesa_function_pool[12814]: EndTransformFeedbackEXT (will be remapped) */
+ "\0"
+ "glEndTransformFeedbackEXT\0"
+ "glEndTransformFeedback\0"
+ "\0"
+ /* _mesa_function_pool[12865]: Uniform2fvARB (will be remapped) */
"iip\0"
"glUniform2fv\0"
"glUniform2fvARB\0"
"\0"
- /* _mesa_function_pool[12705]: BufferParameteriAPPLE (will be remapped) */
+ /* _mesa_function_pool[12899]: BufferParameteriAPPLE (will be remapped) */
"iii\0"
"glBufferParameteriAPPLE\0"
"\0"
- /* _mesa_function_pool[12734]: MultiTexCoord3dvARB (offset 393) */
+ /* _mesa_function_pool[12928]: MultiTexCoord3dvARB (offset 393) */
"ip\0"
"glMultiTexCoord3dv\0"
"glMultiTexCoord3dvARB\0"
"\0"
- /* _mesa_function_pool[12779]: ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (dynamic) */
+ /* _mesa_function_pool[12973]: ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (dynamic) */
"pppp\0"
"glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN\0"
"\0"
- /* _mesa_function_pool[12835]: DeleteObjectARB (will be remapped) */
+ /* _mesa_function_pool[13029]: DeleteObjectARB (will be remapped) */
"i\0"
"glDeleteObjectARB\0"
"\0"
- /* _mesa_function_pool[12856]: MatrixIndexPointerARB (dynamic) */
+ /* _mesa_function_pool[13050]: MatrixIndexPointerARB (dynamic) */
"iiip\0"
"glMatrixIndexPointerARB\0"
"\0"
- /* _mesa_function_pool[12886]: ProgramNamedParameter4dvNV (will be remapped) */
+ /* _mesa_function_pool[13080]: ProgramNamedParameter4dvNV (will be remapped) */
"iipp\0"
"glProgramNamedParameter4dvNV\0"
"\0"
- /* _mesa_function_pool[12921]: Tangent3fvEXT (dynamic) */
+ /* _mesa_function_pool[13115]: Tangent3fvEXT (dynamic) */
"p\0"
"glTangent3fvEXT\0"
"\0"
- /* _mesa_function_pool[12940]: Flush (offset 217) */
+ /* _mesa_function_pool[13134]: Flush (offset 217) */
"\0"
"glFlush\0"
"\0"
- /* _mesa_function_pool[12950]: Color4uiv (offset 38) */
+ /* _mesa_function_pool[13144]: Color4uiv (offset 38) */
"p\0"
"glColor4uiv\0"
"\0"
- /* _mesa_function_pool[12965]: GenVertexArrays (will be remapped) */
+ /* _mesa_function_pool[13159]: GenVertexArrays (will be remapped) */
"ip\0"
"glGenVertexArrays\0"
"\0"
- /* _mesa_function_pool[12987]: RasterPos3sv (offset 77) */
+ /* _mesa_function_pool[13181]: RasterPos3sv (offset 77) */
"p\0"
"glRasterPos3sv\0"
"\0"
- /* _mesa_function_pool[13005]: BindFramebufferEXT (will be remapped) */
+ /* _mesa_function_pool[13199]: BindFramebufferEXT (will be remapped) */
"ii\0"
"glBindFramebuffer\0"
"glBindFramebufferEXT\0"
"\0"
- /* _mesa_function_pool[13048]: ReferencePlaneSGIX (dynamic) */
+ /* _mesa_function_pool[13242]: ReferencePlaneSGIX (dynamic) */
"p\0"
"glReferencePlaneSGIX\0"
"\0"
- /* _mesa_function_pool[13072]: PushAttrib (offset 219) */
+ /* _mesa_function_pool[13266]: PushAttrib (offset 219) */
"i\0"
"glPushAttrib\0"
"\0"
- /* _mesa_function_pool[13088]: RasterPos2i (offset 66) */
+ /* _mesa_function_pool[13282]: RasterPos2i (offset 66) */
"ii\0"
"glRasterPos2i\0"
"\0"
- /* _mesa_function_pool[13106]: ValidateProgramARB (will be remapped) */
+ /* _mesa_function_pool[13300]: ValidateProgramARB (will be remapped) */
"i\0"
"glValidateProgram\0"
"glValidateProgramARB\0"
"\0"
- /* _mesa_function_pool[13148]: TexParameteriv (offset 181) */
+ /* _mesa_function_pool[13342]: TexParameteriv (offset 181) */
"iip\0"
"glTexParameteriv\0"
"\0"
- /* _mesa_function_pool[13170]: UnlockArraysEXT (will be remapped) */
+ /* _mesa_function_pool[13364]: UnlockArraysEXT (will be remapped) */
"\0"
"glUnlockArraysEXT\0"
"\0"
- /* _mesa_function_pool[13190]: TexCoord2fColor3fVertex3fSUN (dynamic) */
+ /* _mesa_function_pool[13384]: TexCoord2fColor3fVertex3fSUN (dynamic) */
"ffffffff\0"
"glTexCoord2fColor3fVertex3fSUN\0"
"\0"
- /* _mesa_function_pool[13231]: WindowPos3fvMESA (will be remapped) */
+ /* _mesa_function_pool[13425]: WindowPos3fvMESA (will be remapped) */
"p\0"
"glWindowPos3fv\0"
"glWindowPos3fvARB\0"
"glWindowPos3fvMESA\0"
"\0"
- /* _mesa_function_pool[13286]: RasterPos2f (offset 64) */
+ /* _mesa_function_pool[13480]: RasterPos2f (offset 64) */
"ff\0"
"glRasterPos2f\0"
"\0"
- /* _mesa_function_pool[13304]: VertexAttrib1svNV (will be remapped) */
+ /* _mesa_function_pool[13498]: VertexAttrib1svNV (will be remapped) */
"ip\0"
"glVertexAttrib1svNV\0"
"\0"
- /* _mesa_function_pool[13328]: RasterPos2d (offset 62) */
+ /* _mesa_function_pool[13522]: RasterPos2d (offset 62) */
"dd\0"
"glRasterPos2d\0"
"\0"
- /* _mesa_function_pool[13346]: RasterPos3fv (offset 73) */
+ /* _mesa_function_pool[13540]: RasterPos3fv (offset 73) */
"p\0"
"glRasterPos3fv\0"
"\0"
- /* _mesa_function_pool[13364]: CopyTexSubImage3D (offset 373) */
+ /* _mesa_function_pool[13558]: CopyTexSubImage3D (offset 373) */
"iiiiiiiii\0"
"glCopyTexSubImage3D\0"
"glCopyTexSubImage3DEXT\0"
"\0"
- /* _mesa_function_pool[13418]: VertexAttrib2dARB (will be remapped) */
+ /* _mesa_function_pool[13612]: VertexAttrib2dARB (will be remapped) */
"idd\0"
"glVertexAttrib2d\0"
"glVertexAttrib2dARB\0"
"\0"
- /* _mesa_function_pool[13460]: Color4ub (offset 35) */
+ /* _mesa_function_pool[13654]: Color4ub (offset 35) */
"iiii\0"
"glColor4ub\0"
"\0"
- /* _mesa_function_pool[13477]: GetInteger64v (will be remapped) */
+ /* _mesa_function_pool[13671]: GetInteger64v (will be remapped) */
"ip\0"
"glGetInteger64v\0"
"\0"
- /* _mesa_function_pool[13497]: TextureColorMaskSGIS (dynamic) */
+ /* _mesa_function_pool[13691]: TextureColorMaskSGIS (dynamic) */
"iiii\0"
"glTextureColorMaskSGIS\0"
"\0"
- /* _mesa_function_pool[13526]: RasterPos2s (offset 68) */
+ /* _mesa_function_pool[13720]: RasterPos2s (offset 68) */
"ii\0"
"glRasterPos2s\0"
"\0"
- /* _mesa_function_pool[13544]: GetColorTable (offset 343) */
+ /* _mesa_function_pool[13738]: GetColorTable (offset 343) */
"iiip\0"
"glGetColorTable\0"
"glGetColorTableSGI\0"
"glGetColorTableEXT\0"
"\0"
- /* _mesa_function_pool[13604]: SelectBuffer (offset 195) */
+ /* _mesa_function_pool[13798]: SelectBuffer (offset 195) */
"ip\0"
"glSelectBuffer\0"
"\0"
- /* _mesa_function_pool[13623]: Indexiv (offset 49) */
+ /* _mesa_function_pool[13817]: Indexiv (offset 49) */
"p\0"
"glIndexiv\0"
"\0"
- /* _mesa_function_pool[13636]: TexCoord3i (offset 114) */
+ /* _mesa_function_pool[13830]: TexCoord3i (offset 114) */
"iii\0"
"glTexCoord3i\0"
"\0"
- /* _mesa_function_pool[13654]: CopyColorTable (offset 342) */
+ /* _mesa_function_pool[13848]: CopyColorTable (offset 342) */
"iiiii\0"
"glCopyColorTable\0"
"glCopyColorTableSGI\0"
"\0"
- /* _mesa_function_pool[13698]: GetHistogramParameterfv (offset 362) */
+ /* _mesa_function_pool[13892]: GetHistogramParameterfv (offset 362) */
"iip\0"
"glGetHistogramParameterfv\0"
"glGetHistogramParameterfvEXT\0"
"\0"
- /* _mesa_function_pool[13758]: Frustum (offset 289) */
+ /* _mesa_function_pool[13952]: Frustum (offset 289) */
"dddddd\0"
"glFrustum\0"
"\0"
- /* _mesa_function_pool[13776]: GetString (offset 275) */
+ /* _mesa_function_pool[13970]: GetString (offset 275) */
"i\0"
"glGetString\0"
"\0"
- /* _mesa_function_pool[13791]: ColorPointervINTEL (dynamic) */
+ /* _mesa_function_pool[13985]: ColorPointervINTEL (dynamic) */
"iip\0"
"glColorPointervINTEL\0"
"\0"
- /* _mesa_function_pool[13817]: TexEnvf (offset 184) */
+ /* _mesa_function_pool[14011]: TexEnvf (offset 184) */
"iif\0"
"glTexEnvf\0"
"\0"
- /* _mesa_function_pool[13832]: TexCoord3d (offset 110) */
+ /* _mesa_function_pool[14026]: TexCoord3d (offset 110) */
"ddd\0"
"glTexCoord3d\0"
"\0"
- /* _mesa_function_pool[13850]: AlphaFragmentOp1ATI (will be remapped) */
+ /* _mesa_function_pool[14044]: AlphaFragmentOp1ATI (will be remapped) */
"iiiiii\0"
"glAlphaFragmentOp1ATI\0"
"\0"
- /* _mesa_function_pool[13880]: TexCoord3f (offset 112) */
+ /* _mesa_function_pool[14074]: TexCoord3f (offset 112) */
"fff\0"
"glTexCoord3f\0"
"\0"
- /* _mesa_function_pool[13898]: MultiTexCoord3ivARB (offset 397) */
+ /* _mesa_function_pool[14092]: MultiTexCoord3ivARB (offset 397) */
"ip\0"
"glMultiTexCoord3iv\0"
"glMultiTexCoord3ivARB\0"
"\0"
- /* _mesa_function_pool[13943]: MultiTexCoord2sARB (offset 390) */
+ /* _mesa_function_pool[14137]: MultiTexCoord2sARB (offset 390) */
"iii\0"
"glMultiTexCoord2s\0"
"glMultiTexCoord2sARB\0"
"\0"
- /* _mesa_function_pool[13987]: VertexAttrib1dvARB (will be remapped) */
+ /* _mesa_function_pool[14181]: VertexAttrib1dvARB (will be remapped) */
"ip\0"
"glVertexAttrib1dv\0"
"glVertexAttrib1dvARB\0"
"\0"
- /* _mesa_function_pool[14030]: DeleteTextures (offset 327) */
+ /* _mesa_function_pool[14224]: DeleteTextures (offset 327) */
"ip\0"
"glDeleteTextures\0"
"glDeleteTexturesEXT\0"
"\0"
- /* _mesa_function_pool[14071]: TexCoordPointerEXT (will be remapped) */
+ /* _mesa_function_pool[14265]: TexCoordPointerEXT (will be remapped) */
"iiiip\0"
"glTexCoordPointerEXT\0"
"\0"
- /* _mesa_function_pool[14099]: TexSubImage4DSGIS (dynamic) */
+ /* _mesa_function_pool[14293]: TexSubImage4DSGIS (dynamic) */
"iiiiiiiiiiiip\0"
"glTexSubImage4DSGIS\0"
"\0"
- /* _mesa_function_pool[14134]: TexCoord3s (offset 116) */
+ /* _mesa_function_pool[14328]: TexCoord3s (offset 116) */
"iii\0"
"glTexCoord3s\0"
"\0"
- /* _mesa_function_pool[14152]: GetTexLevelParameteriv (offset 285) */
+ /* _mesa_function_pool[14346]: GetTexLevelParameteriv (offset 285) */
"iiip\0"
"glGetTexLevelParameteriv\0"
"\0"
- /* _mesa_function_pool[14183]: CombinerStageParameterfvNV (dynamic) */
+ /* _mesa_function_pool[14377]: CombinerStageParameterfvNV (dynamic) */
"iip\0"
"glCombinerStageParameterfvNV\0"
"\0"
- /* _mesa_function_pool[14217]: StopInstrumentsSGIX (dynamic) */
+ /* _mesa_function_pool[14411]: StopInstrumentsSGIX (dynamic) */
"i\0"
"glStopInstrumentsSGIX\0"
"\0"
- /* _mesa_function_pool[14242]: TexCoord4fColor4fNormal3fVertex4fSUN (dynamic) */
+ /* _mesa_function_pool[14436]: TexCoord4fColor4fNormal3fVertex4fSUN (dynamic) */
"fffffffffffffff\0"
"glTexCoord4fColor4fNormal3fVertex4fSUN\0"
"\0"
- /* _mesa_function_pool[14298]: ClearAccum (offset 204) */
+ /* _mesa_function_pool[14492]: ClearAccum (offset 204) */
"ffff\0"
"glClearAccum\0"
"\0"
- /* _mesa_function_pool[14317]: DeformSGIX (dynamic) */
+ /* _mesa_function_pool[14511]: DeformSGIX (dynamic) */
"i\0"
"glDeformSGIX\0"
"\0"
- /* _mesa_function_pool[14333]: GetVertexAttribfvARB (will be remapped) */
+ /* _mesa_function_pool[14527]: GetVertexAttribfvARB (will be remapped) */
"iip\0"
"glGetVertexAttribfv\0"
"glGetVertexAttribfvARB\0"
"\0"
- /* _mesa_function_pool[14381]: SecondaryColor3ivEXT (will be remapped) */
+ /* _mesa_function_pool[14575]: SecondaryColor3ivEXT (will be remapped) */
"p\0"
"glSecondaryColor3iv\0"
"glSecondaryColor3ivEXT\0"
"\0"
- /* _mesa_function_pool[14427]: TexCoord4iv (offset 123) */
+ /* _mesa_function_pool[14621]: TexCoord4iv (offset 123) */
"p\0"
"glTexCoord4iv\0"
"\0"
- /* _mesa_function_pool[14444]: UniformMatrix4x2fv (will be remapped) */
+ /* _mesa_function_pool[14638]: UniformMatrix4x2fv (will be remapped) */
"iiip\0"
"glUniformMatrix4x2fv\0"
"\0"
- /* _mesa_function_pool[14471]: GetDetailTexFuncSGIS (dynamic) */
+ /* _mesa_function_pool[14665]: GetDetailTexFuncSGIS (dynamic) */
"ip\0"
"glGetDetailTexFuncSGIS\0"
"\0"
- /* _mesa_function_pool[14498]: GetCombinerStageParameterfvNV (dynamic) */
+ /* _mesa_function_pool[14692]: GetCombinerStageParameterfvNV (dynamic) */
"iip\0"
"glGetCombinerStageParameterfvNV\0"
"\0"
- /* _mesa_function_pool[14535]: PolygonOffset (offset 319) */
+ /* _mesa_function_pool[14729]: PolygonOffset (offset 319) */
"ff\0"
"glPolygonOffset\0"
"\0"
- /* _mesa_function_pool[14555]: BindVertexArray (will be remapped) */
+ /* _mesa_function_pool[14749]: BindVertexArray (will be remapped) */
"i\0"
"glBindVertexArray\0"
"\0"
- /* _mesa_function_pool[14576]: Color4ubVertex2fvSUN (dynamic) */
+ /* _mesa_function_pool[14770]: Color4ubVertex2fvSUN (dynamic) */
"pp\0"
"glColor4ubVertex2fvSUN\0"
"\0"
- /* _mesa_function_pool[14603]: Rectd (offset 86) */
+ /* _mesa_function_pool[14797]: Rectd (offset 86) */
"dddd\0"
"glRectd\0"
"\0"
- /* _mesa_function_pool[14617]: TexFilterFuncSGIS (dynamic) */
+ /* _mesa_function_pool[14811]: TexFilterFuncSGIS (dynamic) */
"iiip\0"
"glTexFilterFuncSGIS\0"
"\0"
- /* _mesa_function_pool[14643]: SampleMaskSGIS (will be remapped) */
+ /* _mesa_function_pool[14837]: SampleMaskSGIS (will be remapped) */
"fi\0"
"glSampleMaskSGIS\0"
"glSampleMaskEXT\0"
"\0"
- /* _mesa_function_pool[14680]: GetAttribLocationARB (will be remapped) */
+ /* _mesa_function_pool[14874]: GetAttribLocationARB (will be remapped) */
"ip\0"
"glGetAttribLocation\0"
"glGetAttribLocationARB\0"
"\0"
- /* _mesa_function_pool[14727]: RasterPos3i (offset 74) */
+ /* _mesa_function_pool[14921]: RasterPos3i (offset 74) */
"iii\0"
"glRasterPos3i\0"
"\0"
- /* _mesa_function_pool[14746]: VertexAttrib4ubvARB (will be remapped) */
+ /* _mesa_function_pool[14940]: VertexAttrib4ubvARB (will be remapped) */
"ip\0"
"glVertexAttrib4ubv\0"
"glVertexAttrib4ubvARB\0"
"\0"
- /* _mesa_function_pool[14791]: DetailTexFuncSGIS (dynamic) */
+ /* _mesa_function_pool[14985]: DetailTexFuncSGIS (dynamic) */
"iip\0"
"glDetailTexFuncSGIS\0"
"\0"
- /* _mesa_function_pool[14816]: Normal3fVertex3fSUN (dynamic) */
+ /* _mesa_function_pool[15010]: Normal3fVertex3fSUN (dynamic) */
"ffffff\0"
"glNormal3fVertex3fSUN\0"
"\0"
- /* _mesa_function_pool[14846]: CopyTexImage2D (offset 324) */
+ /* _mesa_function_pool[15040]: CopyTexImage2D (offset 324) */
"iiiiiiii\0"
"glCopyTexImage2D\0"
"glCopyTexImage2DEXT\0"
"\0"
- /* _mesa_function_pool[14893]: GetBufferPointervARB (will be remapped) */
+ /* _mesa_function_pool[15087]: GetBufferPointervARB (will be remapped) */
"iip\0"
"glGetBufferPointerv\0"
"glGetBufferPointervARB\0"
"\0"
- /* _mesa_function_pool[14941]: ProgramEnvParameter4fARB (will be remapped) */
+ /* _mesa_function_pool[15135]: ProgramEnvParameter4fARB (will be remapped) */
"iiffff\0"
"glProgramEnvParameter4fARB\0"
"glProgramParameter4fNV\0"
"\0"
- /* _mesa_function_pool[14999]: Uniform3ivARB (will be remapped) */
+ /* _mesa_function_pool[15193]: Uniform3ivARB (will be remapped) */
"iip\0"
"glUniform3iv\0"
"glUniform3ivARB\0"
"\0"
- /* _mesa_function_pool[15033]: Lightfv (offset 160) */
+ /* _mesa_function_pool[15227]: Lightfv (offset 160) */
"iip\0"
"glLightfv\0"
"\0"
- /* _mesa_function_pool[15048]: ClearDepth (offset 208) */
+ /* _mesa_function_pool[15242]: ClearDepth (offset 208) */
"d\0"
"glClearDepth\0"
"\0"
- /* _mesa_function_pool[15064]: GetFenceivNV (will be remapped) */
+ /* _mesa_function_pool[15258]: GetFenceivNV (will be remapped) */
"iip\0"
"glGetFenceivNV\0"
"\0"
- /* _mesa_function_pool[15084]: WindowPos4dvMESA (will be remapped) */
+ /* _mesa_function_pool[15278]: WindowPos4dvMESA (will be remapped) */
"p\0"
"glWindowPos4dvMESA\0"
"\0"
- /* _mesa_function_pool[15106]: ColorSubTable (offset 346) */
+ /* _mesa_function_pool[15300]: ColorSubTable (offset 346) */
"iiiiip\0"
"glColorSubTable\0"
"glColorSubTableEXT\0"
"\0"
- /* _mesa_function_pool[15149]: Color4fv (offset 30) */
+ /* _mesa_function_pool[15343]: Color4fv (offset 30) */
"p\0"
"glColor4fv\0"
"\0"
- /* _mesa_function_pool[15163]: MultiTexCoord4ivARB (offset 405) */
+ /* _mesa_function_pool[15357]: MultiTexCoord4ivARB (offset 405) */
"ip\0"
"glMultiTexCoord4iv\0"
"glMultiTexCoord4ivARB\0"
"\0"
- /* _mesa_function_pool[15208]: ProgramLocalParameters4fvEXT (will be remapped) */
+ /* _mesa_function_pool[15402]: ProgramLocalParameters4fvEXT (will be remapped) */
"iiip\0"
"glProgramLocalParameters4fvEXT\0"
"\0"
- /* _mesa_function_pool[15245]: ColorPointer (offset 308) */
+ /* _mesa_function_pool[15439]: ColorPointer (offset 308) */
"iiip\0"
"glColorPointer\0"
"\0"
- /* _mesa_function_pool[15266]: Rects (offset 92) */
+ /* _mesa_function_pool[15460]: Rects (offset 92) */
"iiii\0"
"glRects\0"
"\0"
- /* _mesa_function_pool[15280]: GetMapAttribParameterfvNV (dynamic) */
+ /* _mesa_function_pool[15474]: GetMapAttribParameterfvNV (dynamic) */
"iiip\0"
"glGetMapAttribParameterfvNV\0"
"\0"
- /* _mesa_function_pool[15314]: Lightiv (offset 162) */
+ /* _mesa_function_pool[15508]: Lightiv (offset 162) */
"iip\0"
"glLightiv\0"
"\0"
- /* _mesa_function_pool[15329]: VertexAttrib4sARB (will be remapped) */
+ /* _mesa_function_pool[15523]: VertexAttrib4sARB (will be remapped) */
"iiiii\0"
"glVertexAttrib4s\0"
"glVertexAttrib4sARB\0"
"\0"
- /* _mesa_function_pool[15373]: GetQueryObjectuivARB (will be remapped) */
+ /* _mesa_function_pool[15567]: GetQueryObjectuivARB (will be remapped) */
"iip\0"
"glGetQueryObjectuiv\0"
"glGetQueryObjectuivARB\0"
"\0"
- /* _mesa_function_pool[15421]: GetTexParameteriv (offset 283) */
+ /* _mesa_function_pool[15615]: GetTexParameteriv (offset 283) */
"iip\0"
"glGetTexParameteriv\0"
"\0"
- /* _mesa_function_pool[15446]: MapParameterivNV (dynamic) */
+ /* _mesa_function_pool[15640]: MapParameterivNV (dynamic) */
"iip\0"
"glMapParameterivNV\0"
"\0"
- /* _mesa_function_pool[15470]: GenRenderbuffersEXT (will be remapped) */
+ /* _mesa_function_pool[15664]: GenRenderbuffersEXT (will be remapped) */
"ip\0"
"glGenRenderbuffers\0"
"glGenRenderbuffersEXT\0"
"\0"
- /* _mesa_function_pool[15515]: VertexAttrib2dvARB (will be remapped) */
+ /* _mesa_function_pool[15709]: VertexAttrib2dvARB (will be remapped) */
"ip\0"
"glVertexAttrib2dv\0"
"glVertexAttrib2dvARB\0"
"\0"
- /* _mesa_function_pool[15558]: EdgeFlagPointerEXT (will be remapped) */
+ /* _mesa_function_pool[15752]: EdgeFlagPointerEXT (will be remapped) */
"iip\0"
"glEdgeFlagPointerEXT\0"
"\0"
- /* _mesa_function_pool[15584]: VertexAttribs2svNV (will be remapped) */
+ /* _mesa_function_pool[15778]: VertexAttribs2svNV (will be remapped) */
"iip\0"
"glVertexAttribs2svNV\0"
"\0"
- /* _mesa_function_pool[15610]: WeightbvARB (dynamic) */
+ /* _mesa_function_pool[15804]: WeightbvARB (dynamic) */
"ip\0"
"glWeightbvARB\0"
"\0"
- /* _mesa_function_pool[15628]: VertexAttrib2fvARB (will be remapped) */
+ /* _mesa_function_pool[15822]: VertexAttrib2fvARB (will be remapped) */
"ip\0"
"glVertexAttrib2fv\0"
"glVertexAttrib2fvARB\0"
"\0"
- /* _mesa_function_pool[15671]: GetBufferParameterivARB (will be remapped) */
+ /* _mesa_function_pool[15865]: GetBufferParameterivARB (will be remapped) */
"iip\0"
"glGetBufferParameteriv\0"
"glGetBufferParameterivARB\0"
"\0"
- /* _mesa_function_pool[15725]: Rectdv (offset 87) */
+ /* _mesa_function_pool[15919]: Rectdv (offset 87) */
"pp\0"
"glRectdv\0"
"\0"
- /* _mesa_function_pool[15738]: ListParameteriSGIX (dynamic) */
+ /* _mesa_function_pool[15932]: ListParameteriSGIX (dynamic) */
"iii\0"
"glListParameteriSGIX\0"
"\0"
- /* _mesa_function_pool[15764]: ReplacementCodeuiColor4fNormal3fVertex3fSUN (dynamic) */
+ /* _mesa_function_pool[15958]: ReplacementCodeuiColor4fNormal3fVertex3fSUN (dynamic) */
"iffffffffff\0"
"glReplacementCodeuiColor4fNormal3fVertex3fSUN\0"
"\0"
- /* _mesa_function_pool[15823]: InstrumentsBufferSGIX (dynamic) */
+ /* _mesa_function_pool[16017]: InstrumentsBufferSGIX (dynamic) */
"ip\0"
"glInstrumentsBufferSGIX\0"
"\0"
- /* _mesa_function_pool[15851]: VertexAttrib4NivARB (will be remapped) */
+ /* _mesa_function_pool[16045]: VertexAttrib4NivARB (will be remapped) */
"ip\0"
"glVertexAttrib4Niv\0"
"glVertexAttrib4NivARB\0"
"\0"
- /* _mesa_function_pool[15896]: GetAttachedShaders (will be remapped) */
+ /* _mesa_function_pool[16090]: GetAttachedShaders (will be remapped) */
"iipp\0"
"glGetAttachedShaders\0"
"\0"
- /* _mesa_function_pool[15923]: GenVertexArraysAPPLE (will be remapped) */
+ /* _mesa_function_pool[16117]: GenVertexArraysAPPLE (will be remapped) */
"ip\0"
"glGenVertexArraysAPPLE\0"
"\0"
- /* _mesa_function_pool[15950]: Materialiv (offset 172) */
+ /* _mesa_function_pool[16144]: Materialiv (offset 172) */
"iip\0"
"glMaterialiv\0"
"\0"
- /* _mesa_function_pool[15968]: PushClientAttrib (offset 335) */
+ /* _mesa_function_pool[16162]: PushClientAttrib (offset 335) */
"i\0"
"glPushClientAttrib\0"
"\0"
- /* _mesa_function_pool[15990]: ProgramEnvParameters4fvEXT (will be remapped) */
+ /* _mesa_function_pool[16184]: ProgramEnvParameters4fvEXT (will be remapped) */
"iiip\0"
"glProgramEnvParameters4fvEXT\0"
"\0"
- /* _mesa_function_pool[16025]: TexCoord2fColor4fNormal3fVertex3fvSUN (dynamic) */
+ /* _mesa_function_pool[16219]: TexCoord2fColor4fNormal3fVertex3fvSUN (dynamic) */
"pppp\0"
"glTexCoord2fColor4fNormal3fVertex3fvSUN\0"
"\0"
- /* _mesa_function_pool[16071]: WindowPos2iMESA (will be remapped) */
+ /* _mesa_function_pool[16265]: WindowPos2iMESA (will be remapped) */
"ii\0"
"glWindowPos2i\0"
"glWindowPos2iARB\0"
"glWindowPos2iMESA\0"
"\0"
- /* _mesa_function_pool[16124]: SecondaryColor3fvEXT (will be remapped) */
+ /* _mesa_function_pool[16318]: SecondaryColor3fvEXT (will be remapped) */
"p\0"
"glSecondaryColor3fv\0"
"glSecondaryColor3fvEXT\0"
"\0"
- /* _mesa_function_pool[16170]: PolygonMode (offset 174) */
+ /* _mesa_function_pool[16364]: PolygonMode (offset 174) */
"ii\0"
"glPolygonMode\0"
"\0"
- /* _mesa_function_pool[16188]: CompressedTexSubImage1DARB (will be remapped) */
+ /* _mesa_function_pool[16382]: CompressedTexSubImage1DARB (will be remapped) */
"iiiiiip\0"
"glCompressedTexSubImage1D\0"
"glCompressedTexSubImage1DARB\0"
"\0"
- /* _mesa_function_pool[16252]: GetVertexAttribivNV (will be remapped) */
+ /* _mesa_function_pool[16446]: GetVertexAttribivNV (will be remapped) */
"iip\0"
"glGetVertexAttribivNV\0"
"\0"
- /* _mesa_function_pool[16279]: GetProgramStringARB (will be remapped) */
+ /* _mesa_function_pool[16473]: GetProgramStringARB (will be remapped) */
"iip\0"
"glGetProgramStringARB\0"
"\0"
- /* _mesa_function_pool[16306]: TexBumpParameterfvATI (will be remapped) */
+ /* _mesa_function_pool[16500]: TexBumpParameterfvATI (will be remapped) */
"ip\0"
"glTexBumpParameterfvATI\0"
"\0"
- /* _mesa_function_pool[16334]: CompileShaderARB (will be remapped) */
+ /* _mesa_function_pool[16528]: CompileShaderARB (will be remapped) */
"i\0"
"glCompileShader\0"
"glCompileShaderARB\0"
"\0"
- /* _mesa_function_pool[16372]: DeleteShader (will be remapped) */
+ /* _mesa_function_pool[16566]: DeleteShader (will be remapped) */
"i\0"
"glDeleteShader\0"
"\0"
- /* _mesa_function_pool[16390]: DisableClientState (offset 309) */
+ /* _mesa_function_pool[16584]: DisableClientState (offset 309) */
"i\0"
"glDisableClientState\0"
"\0"
- /* _mesa_function_pool[16414]: TexGeni (offset 192) */
+ /* _mesa_function_pool[16608]: TexGeni (offset 192) */
"iii\0"
"glTexGeni\0"
"\0"
- /* _mesa_function_pool[16429]: TexGenf (offset 190) */
+ /* _mesa_function_pool[16623]: TexGenf (offset 190) */
"iif\0"
"glTexGenf\0"
"\0"
- /* _mesa_function_pool[16444]: Uniform3fARB (will be remapped) */
+ /* _mesa_function_pool[16638]: Uniform3fARB (will be remapped) */
"ifff\0"
"glUniform3f\0"
"glUniform3fARB\0"
"\0"
- /* _mesa_function_pool[16477]: TexGend (offset 188) */
+ /* _mesa_function_pool[16671]: TexGend (offset 188) */
"iid\0"
"glTexGend\0"
"\0"
- /* _mesa_function_pool[16492]: ListParameterfvSGIX (dynamic) */
+ /* _mesa_function_pool[16686]: ListParameterfvSGIX (dynamic) */
"iip\0"
"glListParameterfvSGIX\0"
"\0"
- /* _mesa_function_pool[16519]: GetPolygonStipple (offset 274) */
+ /* _mesa_function_pool[16713]: GetPolygonStipple (offset 274) */
"p\0"
"glGetPolygonStipple\0"
"\0"
- /* _mesa_function_pool[16542]: Tangent3dvEXT (dynamic) */
+ /* _mesa_function_pool[16736]: Tangent3dvEXT (dynamic) */
"p\0"
"glTangent3dvEXT\0"
"\0"
- /* _mesa_function_pool[16561]: GetVertexAttribfvNV (will be remapped) */
- "iip\0"
- "glGetVertexAttribfvNV\0"
+ /* _mesa_function_pool[16755]: BindBufferOffsetEXT (will be remapped) */
+ "iiii\0"
+ "glBindBufferOffsetEXT\0"
"\0"
- /* _mesa_function_pool[16588]: WindowPos3sMESA (will be remapped) */
+ /* _mesa_function_pool[16783]: WindowPos3sMESA (will be remapped) */
"iii\0"
"glWindowPos3s\0"
"glWindowPos3sARB\0"
"glWindowPos3sMESA\0"
"\0"
- /* _mesa_function_pool[16642]: VertexAttrib2svNV (will be remapped) */
+ /* _mesa_function_pool[16837]: VertexAttrib2svNV (will be remapped) */
"ip\0"
"glVertexAttrib2svNV\0"
"\0"
- /* _mesa_function_pool[16666]: VertexAttribs1fvNV (will be remapped) */
- "iip\0"
- "glVertexAttribs1fvNV\0"
+ /* _mesa_function_pool[16861]: DisableIndexedEXT (will be remapped) */
+ "ii\0"
+ "glDisableIndexedEXT\0"
"\0"
- /* _mesa_function_pool[16692]: TexCoord2fVertex3fvSUN (dynamic) */
+ /* _mesa_function_pool[16885]: BindBufferBaseEXT (will be remapped) */
+ "iii\0"
+ "glBindBufferBaseEXT\0"
+ "glBindBufferBase\0"
+ "\0"
+ /* _mesa_function_pool[16927]: TexCoord2fVertex3fvSUN (dynamic) */
"pp\0"
"glTexCoord2fVertex3fvSUN\0"
"\0"
- /* _mesa_function_pool[16721]: WindowPos4sMESA (will be remapped) */
+ /* _mesa_function_pool[16956]: WindowPos4sMESA (will be remapped) */
"iiii\0"
"glWindowPos4sMESA\0"
"\0"
- /* _mesa_function_pool[16745]: VertexAttrib4NuivARB (will be remapped) */
+ /* _mesa_function_pool[16980]: VertexAttrib4NuivARB (will be remapped) */
"ip\0"
"glVertexAttrib4Nuiv\0"
"glVertexAttrib4NuivARB\0"
"\0"
- /* _mesa_function_pool[16792]: ClientActiveTextureARB (offset 375) */
+ /* _mesa_function_pool[17027]: ClientActiveTextureARB (offset 375) */
"i\0"
"glClientActiveTexture\0"
"glClientActiveTextureARB\0"
"\0"
- /* _mesa_function_pool[16842]: PixelTexGenSGIX (will be remapped) */
+ /* _mesa_function_pool[17077]: PixelTexGenSGIX (will be remapped) */
"i\0"
"glPixelTexGenSGIX\0"
"\0"
- /* _mesa_function_pool[16863]: ReplacementCodeusvSUN (dynamic) */
+ /* _mesa_function_pool[17098]: ReplacementCodeusvSUN (dynamic) */
"p\0"
"glReplacementCodeusvSUN\0"
"\0"
- /* _mesa_function_pool[16890]: Uniform4fARB (will be remapped) */
+ /* _mesa_function_pool[17125]: Uniform4fARB (will be remapped) */
"iffff\0"
"glUniform4f\0"
"glUniform4fARB\0"
"\0"
- /* _mesa_function_pool[16924]: Color4sv (offset 34) */
+ /* _mesa_function_pool[17159]: Color4sv (offset 34) */
"p\0"
"glColor4sv\0"
"\0"
- /* _mesa_function_pool[16938]: FlushMappedBufferRange (will be remapped) */
+ /* _mesa_function_pool[17173]: FlushMappedBufferRange (will be remapped) */
"iii\0"
"glFlushMappedBufferRange\0"
"\0"
- /* _mesa_function_pool[16968]: IsProgramNV (will be remapped) */
+ /* _mesa_function_pool[17203]: IsProgramNV (will be remapped) */
"i\0"
"glIsProgramARB\0"
"glIsProgramNV\0"
"\0"
- /* _mesa_function_pool[17000]: FlushMappedBufferRangeAPPLE (will be remapped) */
+ /* _mesa_function_pool[17235]: FlushMappedBufferRangeAPPLE (will be remapped) */
"iii\0"
"glFlushMappedBufferRangeAPPLE\0"
"\0"
- /* _mesa_function_pool[17035]: PixelZoom (offset 246) */
+ /* _mesa_function_pool[17270]: PixelZoom (offset 246) */
"ff\0"
"glPixelZoom\0"
"\0"
- /* _mesa_function_pool[17051]: ReplacementCodePointerSUN (dynamic) */
+ /* _mesa_function_pool[17286]: ReplacementCodePointerSUN (dynamic) */
"iip\0"
"glReplacementCodePointerSUN\0"
"\0"
- /* _mesa_function_pool[17084]: ProgramEnvParameter4dARB (will be remapped) */
+ /* _mesa_function_pool[17319]: ProgramEnvParameter4dARB (will be remapped) */
"iidddd\0"
"glProgramEnvParameter4dARB\0"
"glProgramParameter4dNV\0"
"\0"
- /* _mesa_function_pool[17142]: ColorTableParameterfv (offset 340) */
+ /* _mesa_function_pool[17377]: ColorTableParameterfv (offset 340) */
"iip\0"
"glColorTableParameterfv\0"
"glColorTableParameterfvSGI\0"
"\0"
- /* _mesa_function_pool[17198]: FragmentLightModelfSGIX (dynamic) */
+ /* _mesa_function_pool[17433]: FragmentLightModelfSGIX (dynamic) */
"if\0"
"glFragmentLightModelfSGIX\0"
"\0"
- /* _mesa_function_pool[17228]: Binormal3bvEXT (dynamic) */
+ /* _mesa_function_pool[17463]: Binormal3bvEXT (dynamic) */
"p\0"
"glBinormal3bvEXT\0"
"\0"
- /* _mesa_function_pool[17248]: PixelMapuiv (offset 252) */
+ /* _mesa_function_pool[17483]: PixelMapuiv (offset 252) */
"iip\0"
"glPixelMapuiv\0"
"\0"
- /* _mesa_function_pool[17267]: Color3dv (offset 12) */
+ /* _mesa_function_pool[17502]: Color3dv (offset 12) */
"p\0"
"glColor3dv\0"
"\0"
- /* _mesa_function_pool[17281]: IsTexture (offset 330) */
+ /* _mesa_function_pool[17516]: IsTexture (offset 330) */
"i\0"
"glIsTexture\0"
"glIsTextureEXT\0"
"\0"
- /* _mesa_function_pool[17311]: VertexWeightfvEXT (dynamic) */
+ /* _mesa_function_pool[17546]: VertexWeightfvEXT (dynamic) */
"p\0"
"glVertexWeightfvEXT\0"
"\0"
- /* _mesa_function_pool[17334]: VertexAttrib1dARB (will be remapped) */
+ /* _mesa_function_pool[17569]: VertexAttrib1dARB (will be remapped) */
"id\0"
"glVertexAttrib1d\0"
"glVertexAttrib1dARB\0"
"\0"
- /* _mesa_function_pool[17375]: ImageTransformParameterivHP (dynamic) */
+ /* _mesa_function_pool[17610]: ImageTransformParameterivHP (dynamic) */
"iip\0"
"glImageTransformParameterivHP\0"
"\0"
- /* _mesa_function_pool[17410]: TexCoord4i (offset 122) */
+ /* _mesa_function_pool[17645]: TexCoord4i (offset 122) */
"iiii\0"
"glTexCoord4i\0"
"\0"
- /* _mesa_function_pool[17429]: DeleteQueriesARB (will be remapped) */
+ /* _mesa_function_pool[17664]: DeleteQueriesARB (will be remapped) */
"ip\0"
"glDeleteQueries\0"
"glDeleteQueriesARB\0"
"\0"
- /* _mesa_function_pool[17468]: Color4ubVertex2fSUN (dynamic) */
+ /* _mesa_function_pool[17703]: Color4ubVertex2fSUN (dynamic) */
"iiiiff\0"
"glColor4ubVertex2fSUN\0"
"\0"
- /* _mesa_function_pool[17498]: FragmentColorMaterialSGIX (dynamic) */
+ /* _mesa_function_pool[17733]: FragmentColorMaterialSGIX (dynamic) */
"ii\0"
"glFragmentColorMaterialSGIX\0"
"\0"
- /* _mesa_function_pool[17530]: CurrentPaletteMatrixARB (dynamic) */
+ /* _mesa_function_pool[17765]: CurrentPaletteMatrixARB (dynamic) */
"i\0"
"glCurrentPaletteMatrixARB\0"
"\0"
- /* _mesa_function_pool[17559]: GetMapdv (offset 266) */
+ /* _mesa_function_pool[17794]: GetMapdv (offset 266) */
"iip\0"
"glGetMapdv\0"
"\0"
- /* _mesa_function_pool[17575]: ObjectPurgeableAPPLE (will be remapped) */
+ /* _mesa_function_pool[17810]: ObjectPurgeableAPPLE (will be remapped) */
"iii\0"
"glObjectPurgeableAPPLE\0"
"\0"
- /* _mesa_function_pool[17603]: SamplePatternSGIS (will be remapped) */
+ /* _mesa_function_pool[17838]: SamplePatternSGIS (will be remapped) */
"i\0"
"glSamplePatternSGIS\0"
"glSamplePatternEXT\0"
"\0"
- /* _mesa_function_pool[17645]: PixelStoref (offset 249) */
+ /* _mesa_function_pool[17880]: PixelStoref (offset 249) */
"if\0"
"glPixelStoref\0"
"\0"
- /* _mesa_function_pool[17663]: IsQueryARB (will be remapped) */
+ /* _mesa_function_pool[17898]: IsQueryARB (will be remapped) */
"i\0"
"glIsQuery\0"
"glIsQueryARB\0"
"\0"
- /* _mesa_function_pool[17689]: ReplacementCodeuiColor4ubVertex3fSUN (dynamic) */
+ /* _mesa_function_pool[17924]: ReplacementCodeuiColor4ubVertex3fSUN (dynamic) */
"iiiiifff\0"
"glReplacementCodeuiColor4ubVertex3fSUN\0"
"\0"
- /* _mesa_function_pool[17738]: PixelStorei (offset 250) */
+ /* _mesa_function_pool[17973]: PixelStorei (offset 250) */
"ii\0"
"glPixelStorei\0"
"\0"
- /* _mesa_function_pool[17756]: VertexAttrib4usvARB (will be remapped) */
+ /* _mesa_function_pool[17991]: VertexAttrib4usvARB (will be remapped) */
"ip\0"
"glVertexAttrib4usv\0"
"glVertexAttrib4usvARB\0"
"\0"
- /* _mesa_function_pool[17801]: LinkProgramARB (will be remapped) */
+ /* _mesa_function_pool[18036]: LinkProgramARB (will be remapped) */
"i\0"
"glLinkProgram\0"
"glLinkProgramARB\0"
"\0"
- /* _mesa_function_pool[17835]: VertexAttrib2fNV (will be remapped) */
+ /* _mesa_function_pool[18070]: VertexAttrib2fNV (will be remapped) */
"iff\0"
"glVertexAttrib2fNV\0"
"\0"
- /* _mesa_function_pool[17859]: ShaderSourceARB (will be remapped) */
+ /* _mesa_function_pool[18094]: ShaderSourceARB (will be remapped) */
"iipp\0"
"glShaderSource\0"
"glShaderSourceARB\0"
"\0"
- /* _mesa_function_pool[17898]: FragmentMaterialiSGIX (dynamic) */
+ /* _mesa_function_pool[18133]: FragmentMaterialiSGIX (dynamic) */
"iii\0"
"glFragmentMaterialiSGIX\0"
"\0"
- /* _mesa_function_pool[17927]: EvalCoord2dv (offset 233) */
+ /* _mesa_function_pool[18162]: EvalCoord2dv (offset 233) */
"p\0"
"glEvalCoord2dv\0"
"\0"
- /* _mesa_function_pool[17945]: VertexAttrib3svARB (will be remapped) */
+ /* _mesa_function_pool[18180]: VertexAttrib3svARB (will be remapped) */
"ip\0"
"glVertexAttrib3sv\0"
"glVertexAttrib3svARB\0"
"\0"
- /* _mesa_function_pool[17988]: ColorMaterial (offset 151) */
+ /* _mesa_function_pool[18223]: ColorMaterial (offset 151) */
"ii\0"
"glColorMaterial\0"
"\0"
- /* _mesa_function_pool[18008]: CompressedTexSubImage3DARB (will be remapped) */
+ /* _mesa_function_pool[18243]: CompressedTexSubImage3DARB (will be remapped) */
"iiiiiiiiiip\0"
"glCompressedTexSubImage3D\0"
"glCompressedTexSubImage3DARB\0"
"\0"
- /* _mesa_function_pool[18076]: WindowPos2ivMESA (will be remapped) */
+ /* _mesa_function_pool[18311]: WindowPos2ivMESA (will be remapped) */
"p\0"
"glWindowPos2iv\0"
"glWindowPos2ivARB\0"
"glWindowPos2ivMESA\0"
"\0"
- /* _mesa_function_pool[18131]: IsFramebufferEXT (will be remapped) */
+ /* _mesa_function_pool[18366]: IsFramebufferEXT (will be remapped) */
"i\0"
"glIsFramebuffer\0"
"glIsFramebufferEXT\0"
"\0"
- /* _mesa_function_pool[18169]: Uniform4ivARB (will be remapped) */
+ /* _mesa_function_pool[18404]: Uniform4ivARB (will be remapped) */
"iip\0"
"glUniform4iv\0"
"glUniform4ivARB\0"
"\0"
- /* _mesa_function_pool[18203]: GetVertexAttribdvARB (will be remapped) */
+ /* _mesa_function_pool[18438]: GetVertexAttribdvARB (will be remapped) */
"iip\0"
"glGetVertexAttribdv\0"
"glGetVertexAttribdvARB\0"
"\0"
- /* _mesa_function_pool[18251]: TexBumpParameterivATI (will be remapped) */
+ /* _mesa_function_pool[18486]: TexBumpParameterivATI (will be remapped) */
"ip\0"
"glTexBumpParameterivATI\0"
"\0"
- /* _mesa_function_pool[18279]: GetSeparableFilter (offset 359) */
+ /* _mesa_function_pool[18514]: GetSeparableFilter (offset 359) */
"iiippp\0"
"glGetSeparableFilter\0"
"glGetSeparableFilterEXT\0"
"\0"
- /* _mesa_function_pool[18332]: Binormal3dEXT (dynamic) */
+ /* _mesa_function_pool[18567]: Binormal3dEXT (dynamic) */
"ddd\0"
"glBinormal3dEXT\0"
"\0"
- /* _mesa_function_pool[18353]: SpriteParameteriSGIX (dynamic) */
+ /* _mesa_function_pool[18588]: SpriteParameteriSGIX (dynamic) */
"ii\0"
"glSpriteParameteriSGIX\0"
"\0"
- /* _mesa_function_pool[18380]: RequestResidentProgramsNV (will be remapped) */
+ /* _mesa_function_pool[18615]: RequestResidentProgramsNV (will be remapped) */
"ip\0"
"glRequestResidentProgramsNV\0"
"\0"
- /* _mesa_function_pool[18412]: TagSampleBufferSGIX (dynamic) */
+ /* _mesa_function_pool[18647]: TagSampleBufferSGIX (dynamic) */
"\0"
"glTagSampleBufferSGIX\0"
"\0"
- /* _mesa_function_pool[18436]: ReplacementCodeusSUN (dynamic) */
- "i\0"
- "glReplacementCodeusSUN\0"
+ /* _mesa_function_pool[18671]: TransformFeedbackVaryingsEXT (will be remapped) */
+ "iipi\0"
+ "glTransformFeedbackVaryingsEXT\0"
+ "glTransformFeedbackVaryings\0"
"\0"
- /* _mesa_function_pool[18462]: FeedbackBuffer (offset 194) */
+ /* _mesa_function_pool[18736]: FeedbackBuffer (offset 194) */
"iip\0"
"glFeedbackBuffer\0"
"\0"
- /* _mesa_function_pool[18484]: RasterPos2iv (offset 67) */
+ /* _mesa_function_pool[18758]: RasterPos2iv (offset 67) */
"p\0"
"glRasterPos2iv\0"
"\0"
- /* _mesa_function_pool[18502]: TexImage1D (offset 182) */
+ /* _mesa_function_pool[18776]: TexImage1D (offset 182) */
"iiiiiiip\0"
"glTexImage1D\0"
"\0"
- /* _mesa_function_pool[18525]: ListParameterivSGIX (dynamic) */
+ /* _mesa_function_pool[18799]: ListParameterivSGIX (dynamic) */
"iip\0"
"glListParameterivSGIX\0"
"\0"
- /* _mesa_function_pool[18552]: MultiDrawElementsEXT (will be remapped) */
+ /* _mesa_function_pool[18826]: MultiDrawElementsEXT (will be remapped) */
"ipipi\0"
"glMultiDrawElements\0"
"glMultiDrawElementsEXT\0"
"\0"
- /* _mesa_function_pool[18602]: Color3s (offset 17) */
+ /* _mesa_function_pool[18876]: Color3s (offset 17) */
"iii\0"
"glColor3s\0"
"\0"
- /* _mesa_function_pool[18617]: Uniform1ivARB (will be remapped) */
+ /* _mesa_function_pool[18891]: Uniform1ivARB (will be remapped) */
"iip\0"
"glUniform1iv\0"
"glUniform1ivARB\0"
"\0"
- /* _mesa_function_pool[18651]: WindowPos2sMESA (will be remapped) */
+ /* _mesa_function_pool[18925]: WindowPos2sMESA (will be remapped) */
"ii\0"
"glWindowPos2s\0"
"glWindowPos2sARB\0"
"glWindowPos2sMESA\0"
"\0"
- /* _mesa_function_pool[18704]: WeightusvARB (dynamic) */
+ /* _mesa_function_pool[18978]: WeightusvARB (dynamic) */
"ip\0"
"glWeightusvARB\0"
"\0"
- /* _mesa_function_pool[18723]: TexCoordPointer (offset 320) */
+ /* _mesa_function_pool[18997]: TexCoordPointer (offset 320) */
"iiip\0"
"glTexCoordPointer\0"
"\0"
- /* _mesa_function_pool[18747]: FogCoordPointerEXT (will be remapped) */
+ /* _mesa_function_pool[19021]: FogCoordPointerEXT (will be remapped) */
"iip\0"
"glFogCoordPointer\0"
"glFogCoordPointerEXT\0"
"\0"
- /* _mesa_function_pool[18791]: IndexMaterialEXT (dynamic) */
+ /* _mesa_function_pool[19065]: IndexMaterialEXT (dynamic) */
"ii\0"
"glIndexMaterialEXT\0"
"\0"
- /* _mesa_function_pool[18814]: Color3i (offset 15) */
+ /* _mesa_function_pool[19088]: Color3i (offset 15) */
"iii\0"
"glColor3i\0"
"\0"
- /* _mesa_function_pool[18829]: FrontFace (offset 157) */
+ /* _mesa_function_pool[19103]: FrontFace (offset 157) */
"i\0"
"glFrontFace\0"
"\0"
- /* _mesa_function_pool[18844]: EvalCoord2d (offset 232) */
+ /* _mesa_function_pool[19118]: EvalCoord2d (offset 232) */
"dd\0"
"glEvalCoord2d\0"
"\0"
- /* _mesa_function_pool[18862]: SecondaryColor3ubvEXT (will be remapped) */
+ /* _mesa_function_pool[19136]: SecondaryColor3ubvEXT (will be remapped) */
"p\0"
"glSecondaryColor3ubv\0"
"glSecondaryColor3ubvEXT\0"
"\0"
- /* _mesa_function_pool[18910]: EvalCoord2f (offset 234) */
+ /* _mesa_function_pool[19184]: EvalCoord2f (offset 234) */
"ff\0"
"glEvalCoord2f\0"
"\0"
- /* _mesa_function_pool[18928]: VertexAttrib4dvARB (will be remapped) */
+ /* _mesa_function_pool[19202]: VertexAttrib4dvARB (will be remapped) */
"ip\0"
"glVertexAttrib4dv\0"
"glVertexAttrib4dvARB\0"
"\0"
- /* _mesa_function_pool[18971]: BindAttribLocationARB (will be remapped) */
+ /* _mesa_function_pool[19245]: BindAttribLocationARB (will be remapped) */
"iip\0"
"glBindAttribLocation\0"
"glBindAttribLocationARB\0"
"\0"
- /* _mesa_function_pool[19021]: Color3b (offset 9) */
+ /* _mesa_function_pool[19295]: Color3b (offset 9) */
"iii\0"
"glColor3b\0"
"\0"
- /* _mesa_function_pool[19036]: MultiTexCoord2dARB (offset 384) */
+ /* _mesa_function_pool[19310]: MultiTexCoord2dARB (offset 384) */
"idd\0"
"glMultiTexCoord2d\0"
"glMultiTexCoord2dARB\0"
"\0"
- /* _mesa_function_pool[19080]: ExecuteProgramNV (will be remapped) */
+ /* _mesa_function_pool[19354]: ExecuteProgramNV (will be remapped) */
"iip\0"
"glExecuteProgramNV\0"
"\0"
- /* _mesa_function_pool[19104]: Color3f (offset 13) */
+ /* _mesa_function_pool[19378]: Color3f (offset 13) */
"fff\0"
"glColor3f\0"
"\0"
- /* _mesa_function_pool[19119]: LightEnviSGIX (dynamic) */
+ /* _mesa_function_pool[19393]: LightEnviSGIX (dynamic) */
"ii\0"
"glLightEnviSGIX\0"
"\0"
- /* _mesa_function_pool[19139]: Color3d (offset 11) */
+ /* _mesa_function_pool[19413]: Color3d (offset 11) */
"ddd\0"
"glColor3d\0"
"\0"
- /* _mesa_function_pool[19154]: Normal3dv (offset 55) */
+ /* _mesa_function_pool[19428]: Normal3dv (offset 55) */
"p\0"
"glNormal3dv\0"
"\0"
- /* _mesa_function_pool[19169]: Lightf (offset 159) */
+ /* _mesa_function_pool[19443]: Lightf (offset 159) */
"iif\0"
"glLightf\0"
"\0"
- /* _mesa_function_pool[19183]: ReplacementCodeuiSUN (dynamic) */
+ /* _mesa_function_pool[19457]: ReplacementCodeuiSUN (dynamic) */
"i\0"
"glReplacementCodeuiSUN\0"
"\0"
- /* _mesa_function_pool[19209]: MatrixMode (offset 293) */
+ /* _mesa_function_pool[19483]: MatrixMode (offset 293) */
"i\0"
"glMatrixMode\0"
"\0"
- /* _mesa_function_pool[19225]: GetPixelMapusv (offset 273) */
+ /* _mesa_function_pool[19499]: GetPixelMapusv (offset 273) */
"ip\0"
"glGetPixelMapusv\0"
"\0"
- /* _mesa_function_pool[19246]: Lighti (offset 161) */
+ /* _mesa_function_pool[19520]: Lighti (offset 161) */
"iii\0"
"glLighti\0"
"\0"
- /* _mesa_function_pool[19260]: VertexAttribPointerNV (will be remapped) */
+ /* _mesa_function_pool[19534]: VertexAttribPointerNV (will be remapped) */
"iiiip\0"
"glVertexAttribPointerNV\0"
"\0"
- /* _mesa_function_pool[19291]: GetBooleanIndexedvEXT (will be remapped) */
+ /* _mesa_function_pool[19565]: GetBooleanIndexedvEXT (will be remapped) */
"iip\0"
"glGetBooleanIndexedvEXT\0"
"\0"
- /* _mesa_function_pool[19320]: GetFramebufferAttachmentParameterivEXT (will be remapped) */
+ /* _mesa_function_pool[19594]: GetFramebufferAttachmentParameterivEXT (will be remapped) */
"iiip\0"
"glGetFramebufferAttachmentParameteriv\0"
"glGetFramebufferAttachmentParameterivEXT\0"
"\0"
- /* _mesa_function_pool[19405]: PixelTransformParameterfEXT (dynamic) */
+ /* _mesa_function_pool[19679]: PixelTransformParameterfEXT (dynamic) */
"iif\0"
"glPixelTransformParameterfEXT\0"
"\0"
- /* _mesa_function_pool[19440]: MultiTexCoord4dvARB (offset 401) */
+ /* _mesa_function_pool[19714]: MultiTexCoord4dvARB (offset 401) */
"ip\0"
"glMultiTexCoord4dv\0"
"glMultiTexCoord4dvARB\0"
"\0"
- /* _mesa_function_pool[19485]: PixelTransformParameteriEXT (dynamic) */
+ /* _mesa_function_pool[19759]: PixelTransformParameteriEXT (dynamic) */
"iii\0"
"glPixelTransformParameteriEXT\0"
"\0"
- /* _mesa_function_pool[19520]: GetDoublev (offset 260) */
+ /* _mesa_function_pool[19794]: GetDoublev (offset 260) */
"ip\0"
"glGetDoublev\0"
"\0"
- /* _mesa_function_pool[19537]: MultMatrixd (offset 295) */
+ /* _mesa_function_pool[19811]: MultMatrixd (offset 295) */
"p\0"
"glMultMatrixd\0"
"\0"
- /* _mesa_function_pool[19554]: MultMatrixf (offset 294) */
+ /* _mesa_function_pool[19828]: MultMatrixf (offset 294) */
"p\0"
"glMultMatrixf\0"
"\0"
- /* _mesa_function_pool[19571]: TexCoord2fColor4ubVertex3fSUN (dynamic) */
+ /* _mesa_function_pool[19845]: TexCoord2fColor4ubVertex3fSUN (dynamic) */
"ffiiiifff\0"
"glTexCoord2fColor4ubVertex3fSUN\0"
"\0"
- /* _mesa_function_pool[19614]: Uniform1iARB (will be remapped) */
+ /* _mesa_function_pool[19888]: Uniform1iARB (will be remapped) */
"ii\0"
"glUniform1i\0"
"glUniform1iARB\0"
"\0"
- /* _mesa_function_pool[19645]: VertexAttribPointerARB (will be remapped) */
+ /* _mesa_function_pool[19919]: VertexAttribPointerARB (will be remapped) */
"iiiiip\0"
"glVertexAttribPointer\0"
"glVertexAttribPointerARB\0"
"\0"
- /* _mesa_function_pool[19700]: SharpenTexFuncSGIS (dynamic) */
+ /* _mesa_function_pool[19974]: SharpenTexFuncSGIS (dynamic) */
"iip\0"
"glSharpenTexFuncSGIS\0"
"\0"
- /* _mesa_function_pool[19726]: MultiTexCoord4fvARB (offset 403) */
+ /* _mesa_function_pool[20000]: MultiTexCoord4fvARB (offset 403) */
"ip\0"
"glMultiTexCoord4fv\0"
"glMultiTexCoord4fvARB\0"
"\0"
- /* _mesa_function_pool[19771]: UniformMatrix2x3fv (will be remapped) */
+ /* _mesa_function_pool[20045]: UniformMatrix2x3fv (will be remapped) */
"iiip\0"
"glUniformMatrix2x3fv\0"
"\0"
- /* _mesa_function_pool[19798]: TrackMatrixNV (will be remapped) */
+ /* _mesa_function_pool[20072]: TrackMatrixNV (will be remapped) */
"iiii\0"
"glTrackMatrixNV\0"
"\0"
- /* _mesa_function_pool[19820]: CombinerParameteriNV (will be remapped) */
+ /* _mesa_function_pool[20094]: CombinerParameteriNV (will be remapped) */
"ii\0"
"glCombinerParameteriNV\0"
"\0"
- /* _mesa_function_pool[19847]: DeleteAsyncMarkersSGIX (dynamic) */
+ /* _mesa_function_pool[20121]: DeleteAsyncMarkersSGIX (dynamic) */
"ii\0"
"glDeleteAsyncMarkersSGIX\0"
"\0"
- /* _mesa_function_pool[19876]: IsAsyncMarkerSGIX (dynamic) */
+ /* _mesa_function_pool[20150]: ReplacementCodeusSUN (dynamic) */
+ "i\0"
+ "glReplacementCodeusSUN\0"
+ "\0"
+ /* _mesa_function_pool[20176]: IsAsyncMarkerSGIX (dynamic) */
"i\0"
"glIsAsyncMarkerSGIX\0"
"\0"
- /* _mesa_function_pool[19899]: FrameZoomSGIX (dynamic) */
+ /* _mesa_function_pool[20199]: FrameZoomSGIX (dynamic) */
"i\0"
"glFrameZoomSGIX\0"
"\0"
- /* _mesa_function_pool[19918]: Normal3fVertex3fvSUN (dynamic) */
+ /* _mesa_function_pool[20218]: Normal3fVertex3fvSUN (dynamic) */
"pp\0"
"glNormal3fVertex3fvSUN\0"
"\0"
- /* _mesa_function_pool[19945]: RasterPos4sv (offset 85) */
+ /* _mesa_function_pool[20245]: RasterPos4sv (offset 85) */
"p\0"
"glRasterPos4sv\0"
"\0"
- /* _mesa_function_pool[19963]: VertexAttrib4NsvARB (will be remapped) */
+ /* _mesa_function_pool[20263]: VertexAttrib4NsvARB (will be remapped) */
"ip\0"
"glVertexAttrib4Nsv\0"
"glVertexAttrib4NsvARB\0"
"\0"
- /* _mesa_function_pool[20008]: VertexAttrib3fvARB (will be remapped) */
+ /* _mesa_function_pool[20308]: VertexAttrib3fvARB (will be remapped) */
"ip\0"
"glVertexAttrib3fv\0"
"glVertexAttrib3fvARB\0"
"\0"
- /* _mesa_function_pool[20051]: ClearColor (offset 206) */
+ /* _mesa_function_pool[20351]: ClearColor (offset 206) */
"ffff\0"
"glClearColor\0"
"\0"
- /* _mesa_function_pool[20070]: GetSynciv (will be remapped) */
+ /* _mesa_function_pool[20370]: GetSynciv (will be remapped) */
"iiipp\0"
"glGetSynciv\0"
"\0"
- /* _mesa_function_pool[20089]: DeleteFramebuffersEXT (will be remapped) */
+ /* _mesa_function_pool[20389]: DeleteFramebuffersEXT (will be remapped) */
"ip\0"
"glDeleteFramebuffers\0"
"glDeleteFramebuffersEXT\0"
"\0"
- /* _mesa_function_pool[20138]: GlobalAlphaFactorsSUN (dynamic) */
+ /* _mesa_function_pool[20438]: GlobalAlphaFactorsSUN (dynamic) */
"i\0"
"glGlobalAlphaFactorsSUN\0"
"\0"
- /* _mesa_function_pool[20165]: IsEnabledIndexedEXT (will be remapped) */
+ /* _mesa_function_pool[20465]: IsEnabledIndexedEXT (will be remapped) */
"ii\0"
"glIsEnabledIndexedEXT\0"
"\0"
- /* _mesa_function_pool[20191]: TexEnviv (offset 187) */
+ /* _mesa_function_pool[20491]: TexEnviv (offset 187) */
"iip\0"
"glTexEnviv\0"
"\0"
- /* _mesa_function_pool[20207]: TexSubImage3D (offset 372) */
+ /* _mesa_function_pool[20507]: TexSubImage3D (offset 372) */
"iiiiiiiiiip\0"
"glTexSubImage3D\0"
"glTexSubImage3DEXT\0"
"\0"
- /* _mesa_function_pool[20255]: Tangent3fEXT (dynamic) */
+ /* _mesa_function_pool[20555]: Tangent3fEXT (dynamic) */
"fff\0"
"glTangent3fEXT\0"
"\0"
- /* _mesa_function_pool[20275]: SecondaryColor3uivEXT (will be remapped) */
+ /* _mesa_function_pool[20575]: SecondaryColor3uivEXT (will be remapped) */
"p\0"
"glSecondaryColor3uiv\0"
"glSecondaryColor3uivEXT\0"
"\0"
- /* _mesa_function_pool[20323]: MatrixIndexubvARB (dynamic) */
+ /* _mesa_function_pool[20623]: MatrixIndexubvARB (dynamic) */
"ip\0"
"glMatrixIndexubvARB\0"
"\0"
- /* _mesa_function_pool[20347]: Color4fNormal3fVertex3fSUN (dynamic) */
+ /* _mesa_function_pool[20647]: Color4fNormal3fVertex3fSUN (dynamic) */
"ffffffffff\0"
"glColor4fNormal3fVertex3fSUN\0"
"\0"
- /* _mesa_function_pool[20388]: PixelTexGenParameterfSGIS (will be remapped) */
+ /* _mesa_function_pool[20688]: PixelTexGenParameterfSGIS (will be remapped) */
"if\0"
"glPixelTexGenParameterfSGIS\0"
"\0"
- /* _mesa_function_pool[20420]: CreateShader (will be remapped) */
+ /* _mesa_function_pool[20720]: CreateShader (will be remapped) */
"i\0"
"glCreateShader\0"
"\0"
- /* _mesa_function_pool[20438]: GetColorTableParameterfv (offset 344) */
+ /* _mesa_function_pool[20738]: GetColorTableParameterfv (offset 344) */
"iip\0"
"glGetColorTableParameterfv\0"
"glGetColorTableParameterfvSGI\0"
"glGetColorTableParameterfvEXT\0"
"\0"
- /* _mesa_function_pool[20530]: FragmentLightModelfvSGIX (dynamic) */
+ /* _mesa_function_pool[20830]: FragmentLightModelfvSGIX (dynamic) */
"ip\0"
"glFragmentLightModelfvSGIX\0"
"\0"
- /* _mesa_function_pool[20561]: Bitmap (offset 8) */
+ /* _mesa_function_pool[20861]: Bitmap (offset 8) */
"iiffffp\0"
"glBitmap\0"
"\0"
- /* _mesa_function_pool[20579]: MultiTexCoord3fARB (offset 394) */
+ /* _mesa_function_pool[20879]: MultiTexCoord3fARB (offset 394) */
"ifff\0"
"glMultiTexCoord3f\0"
"glMultiTexCoord3fARB\0"
"\0"
- /* _mesa_function_pool[20624]: GetTexLevelParameterfv (offset 284) */
+ /* _mesa_function_pool[20924]: GetTexLevelParameterfv (offset 284) */
"iiip\0"
"glGetTexLevelParameterfv\0"
"\0"
- /* _mesa_function_pool[20655]: GetPixelTexGenParameterfvSGIS (will be remapped) */
+ /* _mesa_function_pool[20955]: GetPixelTexGenParameterfvSGIS (will be remapped) */
"ip\0"
"glGetPixelTexGenParameterfvSGIS\0"
"\0"
- /* _mesa_function_pool[20691]: GenFramebuffersEXT (will be remapped) */
+ /* _mesa_function_pool[20991]: GenFramebuffersEXT (will be remapped) */
"ip\0"
"glGenFramebuffers\0"
"glGenFramebuffersEXT\0"
"\0"
- /* _mesa_function_pool[20734]: GetProgramParameterdvNV (will be remapped) */
+ /* _mesa_function_pool[21034]: GetProgramParameterdvNV (will be remapped) */
"iiip\0"
"glGetProgramParameterdvNV\0"
"\0"
- /* _mesa_function_pool[20766]: Vertex2sv (offset 133) */
+ /* _mesa_function_pool[21066]: Vertex2sv (offset 133) */
"p\0"
"glVertex2sv\0"
"\0"
- /* _mesa_function_pool[20781]: GetIntegerv (offset 263) */
+ /* _mesa_function_pool[21081]: GetIntegerv (offset 263) */
"ip\0"
"glGetIntegerv\0"
"\0"
- /* _mesa_function_pool[20799]: IsVertexArrayAPPLE (will be remapped) */
+ /* _mesa_function_pool[21099]: IsVertexArrayAPPLE (will be remapped) */
"i\0"
"glIsVertexArray\0"
"glIsVertexArrayAPPLE\0"
"\0"
- /* _mesa_function_pool[20839]: FragmentLightfvSGIX (dynamic) */
+ /* _mesa_function_pool[21139]: FragmentLightfvSGIX (dynamic) */
"iip\0"
"glFragmentLightfvSGIX\0"
"\0"
- /* _mesa_function_pool[20866]: DetachShader (will be remapped) */
+ /* _mesa_function_pool[21166]: DetachShader (will be remapped) */
"ii\0"
"glDetachShader\0"
"\0"
- /* _mesa_function_pool[20885]: VertexAttrib4NubARB (will be remapped) */
+ /* _mesa_function_pool[21185]: VertexAttrib4NubARB (will be remapped) */
"iiiii\0"
"glVertexAttrib4Nub\0"
"glVertexAttrib4NubARB\0"
"\0"
- /* _mesa_function_pool[20933]: GetProgramEnvParameterfvARB (will be remapped) */
+ /* _mesa_function_pool[21233]: GetProgramEnvParameterfvARB (will be remapped) */
"iip\0"
"glGetProgramEnvParameterfvARB\0"
"\0"
- /* _mesa_function_pool[20968]: GetTrackMatrixivNV (will be remapped) */
+ /* _mesa_function_pool[21268]: GetTrackMatrixivNV (will be remapped) */
"iiip\0"
"glGetTrackMatrixivNV\0"
"\0"
- /* _mesa_function_pool[20995]: VertexAttrib3svNV (will be remapped) */
+ /* _mesa_function_pool[21295]: VertexAttrib3svNV (will be remapped) */
"ip\0"
"glVertexAttrib3svNV\0"
"\0"
- /* _mesa_function_pool[21019]: Uniform4fvARB (will be remapped) */
+ /* _mesa_function_pool[21319]: Uniform4fvARB (will be remapped) */
"iip\0"
"glUniform4fv\0"
"glUniform4fvARB\0"
"\0"
- /* _mesa_function_pool[21053]: MultTransposeMatrixfARB (will be remapped) */
+ /* _mesa_function_pool[21353]: MultTransposeMatrixfARB (will be remapped) */
"p\0"
"glMultTransposeMatrixf\0"
"glMultTransposeMatrixfARB\0"
"\0"
- /* _mesa_function_pool[21105]: GetTexEnviv (offset 277) */
+ /* _mesa_function_pool[21405]: GetTexEnviv (offset 277) */
"iip\0"
"glGetTexEnviv\0"
"\0"
- /* _mesa_function_pool[21124]: ColorFragmentOp1ATI (will be remapped) */
+ /* _mesa_function_pool[21424]: ColorFragmentOp1ATI (will be remapped) */
"iiiiiii\0"
"glColorFragmentOp1ATI\0"
"\0"
- /* _mesa_function_pool[21155]: GetUniformfvARB (will be remapped) */
+ /* _mesa_function_pool[21455]: GetUniformfvARB (will be remapped) */
"iip\0"
"glGetUniformfv\0"
"glGetUniformfvARB\0"
"\0"
- /* _mesa_function_pool[21193]: EGLImageTargetRenderbufferStorageOES (will be remapped) */
+ /* _mesa_function_pool[21493]: EGLImageTargetRenderbufferStorageOES (will be remapped) */
"ip\0"
"glEGLImageTargetRenderbufferStorageOES\0"
"\0"
- /* _mesa_function_pool[21236]: PopClientAttrib (offset 334) */
+ /* _mesa_function_pool[21536]: PopClientAttrib (offset 334) */
"\0"
"glPopClientAttrib\0"
"\0"
- /* _mesa_function_pool[21256]: ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (dynamic) */
+ /* _mesa_function_pool[21556]: ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (dynamic) */
"iffffffffffff\0"
"glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN\0"
"\0"
- /* _mesa_function_pool[21327]: DetachObjectARB (will be remapped) */
+ /* _mesa_function_pool[21627]: DetachObjectARB (will be remapped) */
"ii\0"
"glDetachObjectARB\0"
"\0"
- /* _mesa_function_pool[21349]: VertexBlendARB (dynamic) */
+ /* _mesa_function_pool[21649]: VertexBlendARB (dynamic) */
"i\0"
"glVertexBlendARB\0"
"\0"
- /* _mesa_function_pool[21369]: WindowPos3iMESA (will be remapped) */
+ /* _mesa_function_pool[21669]: WindowPos3iMESA (will be remapped) */
"iii\0"
"glWindowPos3i\0"
"glWindowPos3iARB\0"
"glWindowPos3iMESA\0"
"\0"
- /* _mesa_function_pool[21423]: SeparableFilter2D (offset 360) */
+ /* _mesa_function_pool[21723]: SeparableFilter2D (offset 360) */
"iiiiiipp\0"
"glSeparableFilter2D\0"
"glSeparableFilter2DEXT\0"
"\0"
- /* _mesa_function_pool[21476]: ReplacementCodeuiColor4ubVertex3fvSUN (dynamic) */
+ /* _mesa_function_pool[21776]: ReplacementCodeuiColor4ubVertex3fvSUN (dynamic) */
"ppp\0"
"glReplacementCodeuiColor4ubVertex3fvSUN\0"
"\0"
- /* _mesa_function_pool[21521]: Map1d (offset 220) */
+ /* _mesa_function_pool[21821]: Map1d (offset 220) */
"iddiip\0"
"glMap1d\0"
"\0"
- /* _mesa_function_pool[21537]: Map1f (offset 221) */
+ /* _mesa_function_pool[21837]: Map1f (offset 221) */
"iffiip\0"
"glMap1f\0"
"\0"
- /* _mesa_function_pool[21553]: CompressedTexImage2DARB (will be remapped) */
+ /* _mesa_function_pool[21853]: CompressedTexImage2DARB (will be remapped) */
"iiiiiiip\0"
"glCompressedTexImage2D\0"
"glCompressedTexImage2DARB\0"
"\0"
- /* _mesa_function_pool[21612]: ArrayElement (offset 306) */
+ /* _mesa_function_pool[21912]: ArrayElement (offset 306) */
"i\0"
"glArrayElement\0"
"glArrayElementEXT\0"
"\0"
- /* _mesa_function_pool[21648]: TexImage2D (offset 183) */
+ /* _mesa_function_pool[21948]: TexImage2D (offset 183) */
"iiiiiiiip\0"
"glTexImage2D\0"
"\0"
- /* _mesa_function_pool[21672]: DepthBoundsEXT (will be remapped) */
+ /* _mesa_function_pool[21972]: DepthBoundsEXT (will be remapped) */
"dd\0"
"glDepthBoundsEXT\0"
"\0"
- /* _mesa_function_pool[21693]: ProgramParameters4fvNV (will be remapped) */
+ /* _mesa_function_pool[21993]: ProgramParameters4fvNV (will be remapped) */
"iiip\0"
"glProgramParameters4fvNV\0"
"\0"
- /* _mesa_function_pool[21724]: DeformationMap3fSGIX (dynamic) */
+ /* _mesa_function_pool[22024]: DeformationMap3fSGIX (dynamic) */
"iffiiffiiffiip\0"
"glDeformationMap3fSGIX\0"
"\0"
- /* _mesa_function_pool[21763]: GetProgramivNV (will be remapped) */
+ /* _mesa_function_pool[22063]: GetProgramivNV (will be remapped) */
"iip\0"
"glGetProgramivNV\0"
"\0"
- /* _mesa_function_pool[21785]: GetMinmaxParameteriv (offset 366) */
+ /* _mesa_function_pool[22085]: GetMinmaxParameteriv (offset 366) */
"iip\0"
"glGetMinmaxParameteriv\0"
"glGetMinmaxParameterivEXT\0"
"\0"
- /* _mesa_function_pool[21839]: PixelTransferf (offset 247) */
+ /* _mesa_function_pool[22139]: PixelTransferf (offset 247) */
"if\0"
"glPixelTransferf\0"
"\0"
- /* _mesa_function_pool[21860]: CopyTexImage1D (offset 323) */
+ /* _mesa_function_pool[22160]: CopyTexImage1D (offset 323) */
"iiiiiii\0"
"glCopyTexImage1D\0"
"glCopyTexImage1DEXT\0"
"\0"
- /* _mesa_function_pool[21906]: PushMatrix (offset 298) */
+ /* _mesa_function_pool[22206]: PushMatrix (offset 298) */
"\0"
"glPushMatrix\0"
"\0"
- /* _mesa_function_pool[21921]: Fogiv (offset 156) */
+ /* _mesa_function_pool[22221]: Fogiv (offset 156) */
"ip\0"
"glFogiv\0"
"\0"
- /* _mesa_function_pool[21933]: TexCoord1dv (offset 95) */
+ /* _mesa_function_pool[22233]: TexCoord1dv (offset 95) */
"p\0"
"glTexCoord1dv\0"
"\0"
- /* _mesa_function_pool[21950]: AlphaFragmentOp3ATI (will be remapped) */
+ /* _mesa_function_pool[22250]: AlphaFragmentOp3ATI (will be remapped) */
"iiiiiiiiiiii\0"
"glAlphaFragmentOp3ATI\0"
"\0"
- /* _mesa_function_pool[21986]: PixelTransferi (offset 248) */
+ /* _mesa_function_pool[22286]: PixelTransferi (offset 248) */
"ii\0"
"glPixelTransferi\0"
"\0"
- /* _mesa_function_pool[22007]: GetVertexAttribdvNV (will be remapped) */
+ /* _mesa_function_pool[22307]: GetVertexAttribdvNV (will be remapped) */
"iip\0"
"glGetVertexAttribdvNV\0"
"\0"
- /* _mesa_function_pool[22034]: VertexAttrib3fvNV (will be remapped) */
+ /* _mesa_function_pool[22334]: VertexAttrib3fvNV (will be remapped) */
"ip\0"
"glVertexAttrib3fvNV\0"
"\0"
- /* _mesa_function_pool[22058]: Rotatef (offset 300) */
+ /* _mesa_function_pool[22358]: Rotatef (offset 300) */
"ffff\0"
"glRotatef\0"
"\0"
- /* _mesa_function_pool[22074]: GetFinalCombinerInputParameterivNV (will be remapped) */
+ /* _mesa_function_pool[22374]: GetFinalCombinerInputParameterivNV (will be remapped) */
"iip\0"
"glGetFinalCombinerInputParameterivNV\0"
"\0"
- /* _mesa_function_pool[22116]: Vertex3i (offset 138) */
+ /* _mesa_function_pool[22416]: Vertex3i (offset 138) */
"iii\0"
"glVertex3i\0"
"\0"
- /* _mesa_function_pool[22132]: Vertex3f (offset 136) */
+ /* _mesa_function_pool[22432]: Vertex3f (offset 136) */
"fff\0"
"glVertex3f\0"
"\0"
- /* _mesa_function_pool[22148]: Clear (offset 203) */
+ /* _mesa_function_pool[22448]: Clear (offset 203) */
"i\0"
"glClear\0"
"\0"
- /* _mesa_function_pool[22159]: Vertex3d (offset 134) */
+ /* _mesa_function_pool[22459]: Vertex3d (offset 134) */
"ddd\0"
"glVertex3d\0"
"\0"
- /* _mesa_function_pool[22175]: GetMapParameterivNV (dynamic) */
+ /* _mesa_function_pool[22475]: GetMapParameterivNV (dynamic) */
"iip\0"
"glGetMapParameterivNV\0"
"\0"
- /* _mesa_function_pool[22202]: Uniform4iARB (will be remapped) */
+ /* _mesa_function_pool[22502]: Uniform4iARB (will be remapped) */
"iiiii\0"
"glUniform4i\0"
"glUniform4iARB\0"
"\0"
- /* _mesa_function_pool[22236]: ReadBuffer (offset 254) */
+ /* _mesa_function_pool[22536]: ReadBuffer (offset 254) */
"i\0"
"glReadBuffer\0"
"\0"
- /* _mesa_function_pool[22252]: ConvolutionParameteri (offset 352) */
+ /* _mesa_function_pool[22552]: ConvolutionParameteri (offset 352) */
"iii\0"
"glConvolutionParameteri\0"
"glConvolutionParameteriEXT\0"
"\0"
- /* _mesa_function_pool[22308]: Ortho (offset 296) */
+ /* _mesa_function_pool[22608]: Ortho (offset 296) */
"dddddd\0"
"glOrtho\0"
"\0"
- /* _mesa_function_pool[22324]: Binormal3sEXT (dynamic) */
+ /* _mesa_function_pool[22624]: Binormal3sEXT (dynamic) */
"iii\0"
"glBinormal3sEXT\0"
"\0"
- /* _mesa_function_pool[22345]: ListBase (offset 6) */
+ /* _mesa_function_pool[22645]: ListBase (offset 6) */
"i\0"
"glListBase\0"
"\0"
- /* _mesa_function_pool[22359]: Vertex3s (offset 140) */
+ /* _mesa_function_pool[22659]: Vertex3s (offset 140) */
"iii\0"
"glVertex3s\0"
"\0"
- /* _mesa_function_pool[22375]: ConvolutionParameterf (offset 350) */
+ /* _mesa_function_pool[22675]: ConvolutionParameterf (offset 350) */
"iif\0"
"glConvolutionParameterf\0"
"glConvolutionParameterfEXT\0"
"\0"
- /* _mesa_function_pool[22431]: GetColorTableParameteriv (offset 345) */
+ /* _mesa_function_pool[22731]: GetColorTableParameteriv (offset 345) */
"iip\0"
"glGetColorTableParameteriv\0"
"glGetColorTableParameterivSGI\0"
"glGetColorTableParameterivEXT\0"
"\0"
- /* _mesa_function_pool[22523]: ProgramEnvParameter4dvARB (will be remapped) */
+ /* _mesa_function_pool[22823]: ProgramEnvParameter4dvARB (will be remapped) */
"iip\0"
"glProgramEnvParameter4dvARB\0"
"glProgramParameter4dvNV\0"
"\0"
- /* _mesa_function_pool[22580]: ShadeModel (offset 177) */
+ /* _mesa_function_pool[22880]: ShadeModel (offset 177) */
"i\0"
"glShadeModel\0"
"\0"
- /* _mesa_function_pool[22596]: VertexAttribs2fvNV (will be remapped) */
+ /* _mesa_function_pool[22896]: VertexAttribs2fvNV (will be remapped) */
"iip\0"
"glVertexAttribs2fvNV\0"
"\0"
- /* _mesa_function_pool[22622]: Rectiv (offset 91) */
+ /* _mesa_function_pool[22922]: Rectiv (offset 91) */
"pp\0"
"glRectiv\0"
"\0"
- /* _mesa_function_pool[22635]: UseProgramObjectARB (will be remapped) */
+ /* _mesa_function_pool[22935]: UseProgramObjectARB (will be remapped) */
"i\0"
"glUseProgram\0"
"glUseProgramObjectARB\0"
"\0"
- /* _mesa_function_pool[22673]: GetMapParameterfvNV (dynamic) */
+ /* _mesa_function_pool[22973]: GetMapParameterfvNV (dynamic) */
"iip\0"
"glGetMapParameterfvNV\0"
"\0"
- /* _mesa_function_pool[22700]: EndConditionalRenderNV (will be remapped) */
+ /* _mesa_function_pool[23000]: EndConditionalRenderNV (will be remapped) */
"\0"
"glEndConditionalRenderNV\0"
"\0"
- /* _mesa_function_pool[22727]: PassTexCoordATI (will be remapped) */
+ /* _mesa_function_pool[23027]: PassTexCoordATI (will be remapped) */
"iii\0"
"glPassTexCoordATI\0"
"\0"
- /* _mesa_function_pool[22750]: DeleteProgram (will be remapped) */
+ /* _mesa_function_pool[23050]: DeleteProgram (will be remapped) */
"i\0"
"glDeleteProgram\0"
"\0"
- /* _mesa_function_pool[22769]: Tangent3ivEXT (dynamic) */
+ /* _mesa_function_pool[23069]: Tangent3ivEXT (dynamic) */
"p\0"
"glTangent3ivEXT\0"
"\0"
- /* _mesa_function_pool[22788]: Tangent3dEXT (dynamic) */
+ /* _mesa_function_pool[23088]: Tangent3dEXT (dynamic) */
"ddd\0"
"glTangent3dEXT\0"
"\0"
- /* _mesa_function_pool[22808]: SecondaryColor3dvEXT (will be remapped) */
+ /* _mesa_function_pool[23108]: SecondaryColor3dvEXT (will be remapped) */
"p\0"
"glSecondaryColor3dv\0"
"glSecondaryColor3dvEXT\0"
"\0"
- /* _mesa_function_pool[22854]: Vertex2fv (offset 129) */
+ /* _mesa_function_pool[23154]: Vertex2fv (offset 129) */
"p\0"
"glVertex2fv\0"
"\0"
- /* _mesa_function_pool[22869]: MultiDrawArraysEXT (will be remapped) */
+ /* _mesa_function_pool[23169]: MultiDrawArraysEXT (will be remapped) */
"ippi\0"
"glMultiDrawArrays\0"
"glMultiDrawArraysEXT\0"
"\0"
- /* _mesa_function_pool[22914]: BindRenderbufferEXT (will be remapped) */
+ /* _mesa_function_pool[23214]: BindRenderbufferEXT (will be remapped) */
"ii\0"
"glBindRenderbuffer\0"
"glBindRenderbufferEXT\0"
"\0"
- /* _mesa_function_pool[22959]: MultiTexCoord4dARB (offset 400) */
+ /* _mesa_function_pool[23259]: MultiTexCoord4dARB (offset 400) */
"idddd\0"
"glMultiTexCoord4d\0"
"glMultiTexCoord4dARB\0"
"\0"
- /* _mesa_function_pool[23005]: Vertex3sv (offset 141) */
+ /* _mesa_function_pool[23305]: Vertex3sv (offset 141) */
"p\0"
"glVertex3sv\0"
"\0"
- /* _mesa_function_pool[23020]: SecondaryColor3usEXT (will be remapped) */
+ /* _mesa_function_pool[23320]: SecondaryColor3usEXT (will be remapped) */
"iii\0"
"glSecondaryColor3us\0"
"glSecondaryColor3usEXT\0"
"\0"
- /* _mesa_function_pool[23068]: ProgramLocalParameter4fvARB (will be remapped) */
+ /* _mesa_function_pool[23368]: ProgramLocalParameter4fvARB (will be remapped) */
"iip\0"
"glProgramLocalParameter4fvARB\0"
"\0"
- /* _mesa_function_pool[23103]: DeleteProgramsNV (will be remapped) */
+ /* _mesa_function_pool[23403]: DeleteProgramsNV (will be remapped) */
"ip\0"
"glDeleteProgramsARB\0"
"glDeleteProgramsNV\0"
"\0"
- /* _mesa_function_pool[23146]: EvalMesh1 (offset 236) */
+ /* _mesa_function_pool[23446]: EvalMesh1 (offset 236) */
"iii\0"
"glEvalMesh1\0"
"\0"
- /* _mesa_function_pool[23163]: MultiTexCoord1sARB (offset 382) */
+ /* _mesa_function_pool[23463]: MultiTexCoord1sARB (offset 382) */
"ii\0"
"glMultiTexCoord1s\0"
"glMultiTexCoord1sARB\0"
"\0"
- /* _mesa_function_pool[23206]: ReplacementCodeuiColor3fVertex3fSUN (dynamic) */
+ /* _mesa_function_pool[23506]: ReplacementCodeuiColor3fVertex3fSUN (dynamic) */
"iffffff\0"
"glReplacementCodeuiColor3fVertex3fSUN\0"
"\0"
- /* _mesa_function_pool[23253]: GetVertexAttribPointervNV (will be remapped) */
+ /* _mesa_function_pool[23553]: GetVertexAttribPointervNV (will be remapped) */
"iip\0"
"glGetVertexAttribPointerv\0"
"glGetVertexAttribPointervARB\0"
"glGetVertexAttribPointervNV\0"
"\0"
- /* _mesa_function_pool[23341]: DisableIndexedEXT (will be remapped) */
- "ii\0"
- "glDisableIndexedEXT\0"
+ /* _mesa_function_pool[23641]: VertexAttribs1fvNV (will be remapped) */
+ "iip\0"
+ "glVertexAttribs1fvNV\0"
"\0"
- /* _mesa_function_pool[23365]: MultiTexCoord1dvARB (offset 377) */
+ /* _mesa_function_pool[23667]: MultiTexCoord1dvARB (offset 377) */
"ip\0"
"glMultiTexCoord1dv\0"
"glMultiTexCoord1dvARB\0"
"\0"
- /* _mesa_function_pool[23410]: Uniform2iARB (will be remapped) */
+ /* _mesa_function_pool[23712]: Uniform2iARB (will be remapped) */
"iii\0"
"glUniform2i\0"
"glUniform2iARB\0"
"\0"
- /* _mesa_function_pool[23442]: Vertex2iv (offset 131) */
+ /* _mesa_function_pool[23744]: Vertex2iv (offset 131) */
"p\0"
"glVertex2iv\0"
"\0"
- /* _mesa_function_pool[23457]: GetProgramStringNV (will be remapped) */
+ /* _mesa_function_pool[23759]: GetProgramStringNV (will be remapped) */
"iip\0"
"glGetProgramStringNV\0"
"\0"
- /* _mesa_function_pool[23483]: ColorPointerEXT (will be remapped) */
+ /* _mesa_function_pool[23785]: ColorPointerEXT (will be remapped) */
"iiiip\0"
"glColorPointerEXT\0"
"\0"
- /* _mesa_function_pool[23508]: LineWidth (offset 168) */
+ /* _mesa_function_pool[23810]: LineWidth (offset 168) */
"f\0"
"glLineWidth\0"
"\0"
- /* _mesa_function_pool[23523]: MapBufferARB (will be remapped) */
+ /* _mesa_function_pool[23825]: MapBufferARB (will be remapped) */
"ii\0"
"glMapBuffer\0"
"glMapBufferARB\0"
"\0"
- /* _mesa_function_pool[23554]: MultiDrawElementsBaseVertex (will be remapped) */
+ /* _mesa_function_pool[23856]: MultiDrawElementsBaseVertex (will be remapped) */
"ipipip\0"
"glMultiDrawElementsBaseVertex\0"
"\0"
- /* _mesa_function_pool[23592]: Binormal3svEXT (dynamic) */
+ /* _mesa_function_pool[23894]: Binormal3svEXT (dynamic) */
"p\0"
"glBinormal3svEXT\0"
"\0"
- /* _mesa_function_pool[23612]: ApplyTextureEXT (dynamic) */
+ /* _mesa_function_pool[23914]: ApplyTextureEXT (dynamic) */
"i\0"
"glApplyTextureEXT\0"
"\0"
- /* _mesa_function_pool[23633]: TexGendv (offset 189) */
+ /* _mesa_function_pool[23935]: TexGendv (offset 189) */
"iip\0"
"glTexGendv\0"
"\0"
- /* _mesa_function_pool[23649]: EnableIndexedEXT (will be remapped) */
+ /* _mesa_function_pool[23951]: EnableIndexedEXT (will be remapped) */
"ii\0"
"glEnableIndexedEXT\0"
"\0"
- /* _mesa_function_pool[23672]: TextureMaterialEXT (dynamic) */
+ /* _mesa_function_pool[23974]: TextureMaterialEXT (dynamic) */
"ii\0"
"glTextureMaterialEXT\0"
"\0"
- /* _mesa_function_pool[23697]: TextureLightEXT (dynamic) */
+ /* _mesa_function_pool[23999]: TextureLightEXT (dynamic) */
"i\0"
"glTextureLightEXT\0"
"\0"
- /* _mesa_function_pool[23718]: ResetMinmax (offset 370) */
+ /* _mesa_function_pool[24020]: ResetMinmax (offset 370) */
"i\0"
"glResetMinmax\0"
"glResetMinmaxEXT\0"
"\0"
- /* _mesa_function_pool[23752]: SpriteParameterfSGIX (dynamic) */
+ /* _mesa_function_pool[24054]: SpriteParameterfSGIX (dynamic) */
"if\0"
"glSpriteParameterfSGIX\0"
"\0"
- /* _mesa_function_pool[23779]: EnableClientState (offset 313) */
+ /* _mesa_function_pool[24081]: EnableClientState (offset 313) */
"i\0"
"glEnableClientState\0"
"\0"
- /* _mesa_function_pool[23802]: VertexAttrib4sNV (will be remapped) */
+ /* _mesa_function_pool[24104]: VertexAttrib4sNV (will be remapped) */
"iiiii\0"
"glVertexAttrib4sNV\0"
"\0"
- /* _mesa_function_pool[23828]: GetConvolutionParameterfv (offset 357) */
+ /* _mesa_function_pool[24130]: GetConvolutionParameterfv (offset 357) */
"iip\0"
"glGetConvolutionParameterfv\0"
"glGetConvolutionParameterfvEXT\0"
"\0"
- /* _mesa_function_pool[23892]: VertexAttribs4dvNV (will be remapped) */
+ /* _mesa_function_pool[24194]: VertexAttribs4dvNV (will be remapped) */
"iip\0"
"glVertexAttribs4dvNV\0"
"\0"
- /* _mesa_function_pool[23918]: VertexAttrib4dARB (will be remapped) */
+ /* _mesa_function_pool[24220]: MultiModeDrawArraysIBM (will be remapped) */
+ "pppii\0"
+ "glMultiModeDrawArraysIBM\0"
+ "\0"
+ /* _mesa_function_pool[24252]: VertexAttrib4dARB (will be remapped) */
"idddd\0"
"glVertexAttrib4d\0"
"glVertexAttrib4dARB\0"
"\0"
- /* _mesa_function_pool[23962]: GetTexBumpParameterfvATI (will be remapped) */
+ /* _mesa_function_pool[24296]: GetTexBumpParameterfvATI (will be remapped) */
"ip\0"
"glGetTexBumpParameterfvATI\0"
"\0"
- /* _mesa_function_pool[23993]: ProgramNamedParameter4dNV (will be remapped) */
+ /* _mesa_function_pool[24327]: ProgramNamedParameter4dNV (will be remapped) */
"iipdddd\0"
"glProgramNamedParameter4dNV\0"
"\0"
- /* _mesa_function_pool[24030]: GetMaterialfv (offset 269) */
+ /* _mesa_function_pool[24364]: GetMaterialfv (offset 269) */
"iip\0"
"glGetMaterialfv\0"
"\0"
- /* _mesa_function_pool[24051]: VertexWeightfEXT (dynamic) */
+ /* _mesa_function_pool[24385]: VertexWeightfEXT (dynamic) */
"f\0"
"glVertexWeightfEXT\0"
"\0"
- /* _mesa_function_pool[24073]: Binormal3fEXT (dynamic) */
+ /* _mesa_function_pool[24407]: Binormal3fEXT (dynamic) */
"fff\0"
"glBinormal3fEXT\0"
"\0"
- /* _mesa_function_pool[24094]: CallList (offset 2) */
+ /* _mesa_function_pool[24428]: CallList (offset 2) */
"i\0"
"glCallList\0"
"\0"
- /* _mesa_function_pool[24108]: Materialfv (offset 170) */
+ /* _mesa_function_pool[24442]: Materialfv (offset 170) */
"iip\0"
"glMaterialfv\0"
"\0"
- /* _mesa_function_pool[24126]: TexCoord3fv (offset 113) */
+ /* _mesa_function_pool[24460]: TexCoord3fv (offset 113) */
"p\0"
"glTexCoord3fv\0"
"\0"
- /* _mesa_function_pool[24143]: FogCoordfvEXT (will be remapped) */
+ /* _mesa_function_pool[24477]: FogCoordfvEXT (will be remapped) */
"p\0"
"glFogCoordfv\0"
"glFogCoordfvEXT\0"
"\0"
- /* _mesa_function_pool[24175]: MultiTexCoord1ivARB (offset 381) */
+ /* _mesa_function_pool[24509]: MultiTexCoord1ivARB (offset 381) */
"ip\0"
"glMultiTexCoord1iv\0"
"glMultiTexCoord1ivARB\0"
"\0"
- /* _mesa_function_pool[24220]: SecondaryColor3ubEXT (will be remapped) */
+ /* _mesa_function_pool[24554]: SecondaryColor3ubEXT (will be remapped) */
"iii\0"
"glSecondaryColor3ub\0"
"glSecondaryColor3ubEXT\0"
"\0"
- /* _mesa_function_pool[24268]: MultiTexCoord2ivARB (offset 389) */
+ /* _mesa_function_pool[24602]: MultiTexCoord2ivARB (offset 389) */
"ip\0"
"glMultiTexCoord2iv\0"
"glMultiTexCoord2ivARB\0"
"\0"
- /* _mesa_function_pool[24313]: FogFuncSGIS (dynamic) */
+ /* _mesa_function_pool[24647]: FogFuncSGIS (dynamic) */
"ip\0"
"glFogFuncSGIS\0"
"\0"
- /* _mesa_function_pool[24331]: CopyTexSubImage2D (offset 326) */
+ /* _mesa_function_pool[24665]: CopyTexSubImage2D (offset 326) */
"iiiiiiii\0"
"glCopyTexSubImage2D\0"
"glCopyTexSubImage2DEXT\0"
"\0"
- /* _mesa_function_pool[24384]: GetObjectParameterivARB (will be remapped) */
+ /* _mesa_function_pool[24718]: GetObjectParameterivARB (will be remapped) */
"iip\0"
"glGetObjectParameterivARB\0"
"\0"
- /* _mesa_function_pool[24415]: Color3iv (offset 16) */
+ /* _mesa_function_pool[24749]: Color3iv (offset 16) */
"p\0"
"glColor3iv\0"
"\0"
- /* _mesa_function_pool[24429]: TexCoord4fVertex4fSUN (dynamic) */
+ /* _mesa_function_pool[24763]: TexCoord4fVertex4fSUN (dynamic) */
"ffffffff\0"
"glTexCoord4fVertex4fSUN\0"
"\0"
- /* _mesa_function_pool[24463]: DrawElements (offset 311) */
+ /* _mesa_function_pool[24797]: DrawElements (offset 311) */
"iiip\0"
"glDrawElements\0"
"\0"
- /* _mesa_function_pool[24484]: BindVertexArrayAPPLE (will be remapped) */
+ /* _mesa_function_pool[24818]: BindVertexArrayAPPLE (will be remapped) */
"i\0"
"glBindVertexArrayAPPLE\0"
"\0"
- /* _mesa_function_pool[24510]: GetProgramLocalParameterdvARB (will be remapped) */
+ /* _mesa_function_pool[24844]: GetProgramLocalParameterdvARB (will be remapped) */
"iip\0"
"glGetProgramLocalParameterdvARB\0"
"\0"
- /* _mesa_function_pool[24547]: GetHistogramParameteriv (offset 363) */
+ /* _mesa_function_pool[24881]: GetHistogramParameteriv (offset 363) */
"iip\0"
"glGetHistogramParameteriv\0"
"glGetHistogramParameterivEXT\0"
"\0"
- /* _mesa_function_pool[24607]: MultiTexCoord1iARB (offset 380) */
+ /* _mesa_function_pool[24941]: MultiTexCoord1iARB (offset 380) */
"ii\0"
"glMultiTexCoord1i\0"
"glMultiTexCoord1iARB\0"
"\0"
- /* _mesa_function_pool[24650]: GetConvolutionFilter (offset 356) */
+ /* _mesa_function_pool[24984]: GetConvolutionFilter (offset 356) */
"iiip\0"
"glGetConvolutionFilter\0"
"glGetConvolutionFilterEXT\0"
"\0"
- /* _mesa_function_pool[24705]: GetProgramivARB (will be remapped) */
+ /* _mesa_function_pool[25039]: GetProgramivARB (will be remapped) */
"iip\0"
"glGetProgramivARB\0"
"\0"
- /* _mesa_function_pool[24728]: BlendFuncSeparateEXT (will be remapped) */
+ /* _mesa_function_pool[25062]: BlendFuncSeparateEXT (will be remapped) */
"iiii\0"
"glBlendFuncSeparate\0"
"glBlendFuncSeparateEXT\0"
"glBlendFuncSeparateINGR\0"
"\0"
- /* _mesa_function_pool[24801]: MapBufferRange (will be remapped) */
+ /* _mesa_function_pool[25135]: MapBufferRange (will be remapped) */
"iiii\0"
"glMapBufferRange\0"
"\0"
- /* _mesa_function_pool[24824]: ProgramParameters4dvNV (will be remapped) */
+ /* _mesa_function_pool[25158]: ProgramParameters4dvNV (will be remapped) */
"iiip\0"
"glProgramParameters4dvNV\0"
"\0"
- /* _mesa_function_pool[24855]: TexCoord2fColor3fVertex3fvSUN (dynamic) */
+ /* _mesa_function_pool[25189]: TexCoord2fColor3fVertex3fvSUN (dynamic) */
"ppp\0"
"glTexCoord2fColor3fVertex3fvSUN\0"
"\0"
- /* _mesa_function_pool[24892]: EvalPoint2 (offset 239) */
+ /* _mesa_function_pool[25226]: EvalPoint2 (offset 239) */
"ii\0"
"glEvalPoint2\0"
"\0"
- /* _mesa_function_pool[24909]: EvalPoint1 (offset 237) */
+ /* _mesa_function_pool[25243]: EvalPoint1 (offset 237) */
"i\0"
"glEvalPoint1\0"
"\0"
- /* _mesa_function_pool[24925]: Binormal3dvEXT (dynamic) */
+ /* _mesa_function_pool[25259]: Binormal3dvEXT (dynamic) */
"p\0"
"glBinormal3dvEXT\0"
"\0"
- /* _mesa_function_pool[24945]: PopMatrix (offset 297) */
+ /* _mesa_function_pool[25279]: PopMatrix (offset 297) */
"\0"
"glPopMatrix\0"
"\0"
- /* _mesa_function_pool[24959]: FinishFenceNV (will be remapped) */
+ /* _mesa_function_pool[25293]: FinishFenceNV (will be remapped) */
"i\0"
"glFinishFenceNV\0"
"\0"
- /* _mesa_function_pool[24978]: GetFogFuncSGIS (dynamic) */
+ /* _mesa_function_pool[25312]: GetFogFuncSGIS (dynamic) */
"p\0"
"glGetFogFuncSGIS\0"
"\0"
- /* _mesa_function_pool[24998]: GetUniformLocationARB (will be remapped) */
+ /* _mesa_function_pool[25332]: GetUniformLocationARB (will be remapped) */
"ip\0"
"glGetUniformLocation\0"
"glGetUniformLocationARB\0"
"\0"
- /* _mesa_function_pool[25047]: SecondaryColor3fEXT (will be remapped) */
+ /* _mesa_function_pool[25381]: SecondaryColor3fEXT (will be remapped) */
"fff\0"
"glSecondaryColor3f\0"
"glSecondaryColor3fEXT\0"
"\0"
- /* _mesa_function_pool[25093]: GetTexGeniv (offset 280) */
+ /* _mesa_function_pool[25427]: GetTexGeniv (offset 280) */
"iip\0"
"glGetTexGeniv\0"
"\0"
- /* _mesa_function_pool[25112]: CombinerInputNV (will be remapped) */
+ /* _mesa_function_pool[25446]: CombinerInputNV (will be remapped) */
"iiiiii\0"
"glCombinerInputNV\0"
"\0"
- /* _mesa_function_pool[25138]: VertexAttrib3sARB (will be remapped) */
+ /* _mesa_function_pool[25472]: VertexAttrib3sARB (will be remapped) */
"iiii\0"
"glVertexAttrib3s\0"
"glVertexAttrib3sARB\0"
"\0"
- /* _mesa_function_pool[25181]: ReplacementCodeuiNormal3fVertex3fvSUN (dynamic) */
+ /* _mesa_function_pool[25515]: ColorMaskIndexedEXT (will be remapped) */
+ "iiiii\0"
+ "glColorMaskIndexedEXT\0"
+ "\0"
+ /* _mesa_function_pool[25544]: ReplacementCodeuiNormal3fVertex3fvSUN (dynamic) */
"ppp\0"
"glReplacementCodeuiNormal3fVertex3fvSUN\0"
"\0"
- /* _mesa_function_pool[25226]: Map2d (offset 222) */
+ /* _mesa_function_pool[25589]: Map2d (offset 222) */
"iddiiddiip\0"
"glMap2d\0"
"\0"
- /* _mesa_function_pool[25246]: Map2f (offset 223) */
+ /* _mesa_function_pool[25609]: Map2f (offset 223) */
"iffiiffiip\0"
"glMap2f\0"
"\0"
- /* _mesa_function_pool[25266]: ProgramStringARB (will be remapped) */
+ /* _mesa_function_pool[25629]: ProgramStringARB (will be remapped) */
"iiip\0"
"glProgramStringARB\0"
"\0"
- /* _mesa_function_pool[25291]: Vertex4s (offset 148) */
+ /* _mesa_function_pool[25654]: Vertex4s (offset 148) */
"iiii\0"
"glVertex4s\0"
"\0"
- /* _mesa_function_pool[25308]: TexCoord4fVertex4fvSUN (dynamic) */
+ /* _mesa_function_pool[25671]: TexCoord4fVertex4fvSUN (dynamic) */
"pp\0"
"glTexCoord4fVertex4fvSUN\0"
"\0"
- /* _mesa_function_pool[25337]: VertexAttrib3sNV (will be remapped) */
+ /* _mesa_function_pool[25700]: VertexAttrib3sNV (will be remapped) */
"iiii\0"
"glVertexAttrib3sNV\0"
"\0"
- /* _mesa_function_pool[25362]: VertexAttrib1fNV (will be remapped) */
+ /* _mesa_function_pool[25725]: VertexAttrib1fNV (will be remapped) */
"if\0"
"glVertexAttrib1fNV\0"
"\0"
- /* _mesa_function_pool[25385]: Vertex4f (offset 144) */
+ /* _mesa_function_pool[25748]: Vertex4f (offset 144) */
"ffff\0"
"glVertex4f\0"
"\0"
- /* _mesa_function_pool[25402]: EvalCoord1d (offset 228) */
+ /* _mesa_function_pool[25765]: EvalCoord1d (offset 228) */
"d\0"
"glEvalCoord1d\0"
"\0"
- /* _mesa_function_pool[25419]: Vertex4d (offset 142) */
+ /* _mesa_function_pool[25782]: Vertex4d (offset 142) */
"dddd\0"
"glVertex4d\0"
"\0"
- /* _mesa_function_pool[25436]: RasterPos4dv (offset 79) */
+ /* _mesa_function_pool[25799]: RasterPos4dv (offset 79) */
"p\0"
"glRasterPos4dv\0"
"\0"
- /* _mesa_function_pool[25454]: FragmentLightfSGIX (dynamic) */
+ /* _mesa_function_pool[25817]: FragmentLightfSGIX (dynamic) */
"iif\0"
"glFragmentLightfSGIX\0"
"\0"
- /* _mesa_function_pool[25480]: GetCompressedTexImageARB (will be remapped) */
+ /* _mesa_function_pool[25843]: GetCompressedTexImageARB (will be remapped) */
"iip\0"
"glGetCompressedTexImage\0"
"glGetCompressedTexImageARB\0"
"\0"
- /* _mesa_function_pool[25536]: GetTexGenfv (offset 279) */
+ /* _mesa_function_pool[25899]: GetTexGenfv (offset 279) */
"iip\0"
"glGetTexGenfv\0"
"\0"
- /* _mesa_function_pool[25555]: Vertex4i (offset 146) */
+ /* _mesa_function_pool[25918]: Vertex4i (offset 146) */
"iiii\0"
"glVertex4i\0"
"\0"
- /* _mesa_function_pool[25572]: VertexWeightPointerEXT (dynamic) */
+ /* _mesa_function_pool[25935]: VertexWeightPointerEXT (dynamic) */
"iiip\0"
"glVertexWeightPointerEXT\0"
"\0"
- /* _mesa_function_pool[25603]: GetHistogram (offset 361) */
+ /* _mesa_function_pool[25966]: GetHistogram (offset 361) */
"iiiip\0"
"glGetHistogram\0"
"glGetHistogramEXT\0"
"\0"
- /* _mesa_function_pool[25643]: ActiveStencilFaceEXT (will be remapped) */
+ /* _mesa_function_pool[26006]: ActiveStencilFaceEXT (will be remapped) */
"i\0"
"glActiveStencilFaceEXT\0"
"\0"
- /* _mesa_function_pool[25669]: StencilFuncSeparateATI (will be remapped) */
+ /* _mesa_function_pool[26032]: StencilFuncSeparateATI (will be remapped) */
"iiii\0"
"glStencilFuncSeparateATI\0"
"\0"
- /* _mesa_function_pool[25700]: Materialf (offset 169) */
+ /* _mesa_function_pool[26063]: Materialf (offset 169) */
"iif\0"
"glMaterialf\0"
"\0"
- /* _mesa_function_pool[25717]: GetShaderSourceARB (will be remapped) */
+ /* _mesa_function_pool[26080]: GetShaderSourceARB (will be remapped) */
"iipp\0"
"glGetShaderSource\0"
"glGetShaderSourceARB\0"
"\0"
- /* _mesa_function_pool[25762]: IglooInterfaceSGIX (dynamic) */
+ /* _mesa_function_pool[26125]: IglooInterfaceSGIX (dynamic) */
"ip\0"
"glIglooInterfaceSGIX\0"
"\0"
- /* _mesa_function_pool[25787]: Materiali (offset 171) */
+ /* _mesa_function_pool[26150]: Materiali (offset 171) */
"iii\0"
"glMateriali\0"
"\0"
- /* _mesa_function_pool[25804]: VertexAttrib4dNV (will be remapped) */
+ /* _mesa_function_pool[26167]: VertexAttrib4dNV (will be remapped) */
"idddd\0"
"glVertexAttrib4dNV\0"
"\0"
- /* _mesa_function_pool[25830]: MultiModeDrawElementsIBM (will be remapped) */
+ /* _mesa_function_pool[26193]: MultiModeDrawElementsIBM (will be remapped) */
"ppipii\0"
"glMultiModeDrawElementsIBM\0"
"\0"
- /* _mesa_function_pool[25865]: Indexsv (offset 51) */
+ /* _mesa_function_pool[26228]: Indexsv (offset 51) */
"p\0"
"glIndexsv\0"
"\0"
- /* _mesa_function_pool[25878]: MultiTexCoord4svARB (offset 407) */
+ /* _mesa_function_pool[26241]: MultiTexCoord4svARB (offset 407) */
"ip\0"
"glMultiTexCoord4sv\0"
"glMultiTexCoord4svARB\0"
"\0"
- /* _mesa_function_pool[25923]: LightModelfv (offset 164) */
+ /* _mesa_function_pool[26286]: LightModelfv (offset 164) */
"ip\0"
"glLightModelfv\0"
"\0"
- /* _mesa_function_pool[25942]: TexCoord2dv (offset 103) */
+ /* _mesa_function_pool[26305]: TexCoord2dv (offset 103) */
"p\0"
"glTexCoord2dv\0"
"\0"
- /* _mesa_function_pool[25959]: GenQueriesARB (will be remapped) */
+ /* _mesa_function_pool[26322]: GenQueriesARB (will be remapped) */
"ip\0"
"glGenQueries\0"
"glGenQueriesARB\0"
"\0"
- /* _mesa_function_pool[25992]: EvalCoord1dv (offset 229) */
+ /* _mesa_function_pool[26355]: EvalCoord1dv (offset 229) */
"p\0"
"glEvalCoord1dv\0"
"\0"
- /* _mesa_function_pool[26010]: ReplacementCodeuiVertex3fSUN (dynamic) */
+ /* _mesa_function_pool[26373]: ReplacementCodeuiVertex3fSUN (dynamic) */
"ifff\0"
"glReplacementCodeuiVertex3fSUN\0"
"\0"
- /* _mesa_function_pool[26047]: Translated (offset 303) */
+ /* _mesa_function_pool[26410]: Translated (offset 303) */
"ddd\0"
"glTranslated\0"
"\0"
- /* _mesa_function_pool[26065]: Translatef (offset 304) */
+ /* _mesa_function_pool[26428]: Translatef (offset 304) */
"fff\0"
"glTranslatef\0"
"\0"
- /* _mesa_function_pool[26083]: StencilMask (offset 209) */
+ /* _mesa_function_pool[26446]: StencilMask (offset 209) */
"i\0"
"glStencilMask\0"
"\0"
- /* _mesa_function_pool[26100]: Tangent3iEXT (dynamic) */
+ /* _mesa_function_pool[26463]: Tangent3iEXT (dynamic) */
"iii\0"
"glTangent3iEXT\0"
"\0"
- /* _mesa_function_pool[26120]: GetLightiv (offset 265) */
+ /* _mesa_function_pool[26483]: GetLightiv (offset 265) */
"iip\0"
"glGetLightiv\0"
"\0"
- /* _mesa_function_pool[26138]: DrawMeshArraysSUN (dynamic) */
+ /* _mesa_function_pool[26501]: DrawMeshArraysSUN (dynamic) */
"iiii\0"
"glDrawMeshArraysSUN\0"
"\0"
- /* _mesa_function_pool[26164]: IsList (offset 287) */
+ /* _mesa_function_pool[26527]: IsList (offset 287) */
"i\0"
"glIsList\0"
"\0"
- /* _mesa_function_pool[26176]: IsSync (will be remapped) */
+ /* _mesa_function_pool[26539]: IsSync (will be remapped) */
"i\0"
"glIsSync\0"
"\0"
- /* _mesa_function_pool[26188]: RenderMode (offset 196) */
+ /* _mesa_function_pool[26551]: RenderMode (offset 196) */
"i\0"
"glRenderMode\0"
"\0"
- /* _mesa_function_pool[26204]: GetMapControlPointsNV (dynamic) */
+ /* _mesa_function_pool[26567]: GetMapControlPointsNV (dynamic) */
"iiiiiip\0"
"glGetMapControlPointsNV\0"
"\0"
- /* _mesa_function_pool[26237]: DrawBuffersARB (will be remapped) */
+ /* _mesa_function_pool[26600]: DrawBuffersARB (will be remapped) */
"ip\0"
"glDrawBuffers\0"
"glDrawBuffersARB\0"
"glDrawBuffersATI\0"
"\0"
- /* _mesa_function_pool[26289]: ProgramLocalParameter4fARB (will be remapped) */
+ /* _mesa_function_pool[26652]: ProgramLocalParameter4fARB (will be remapped) */
"iiffff\0"
"glProgramLocalParameter4fARB\0"
"\0"
- /* _mesa_function_pool[26326]: SpriteParameterivSGIX (dynamic) */
+ /* _mesa_function_pool[26689]: SpriteParameterivSGIX (dynamic) */
"ip\0"
"glSpriteParameterivSGIX\0"
"\0"
- /* _mesa_function_pool[26354]: ProvokingVertexEXT (will be remapped) */
+ /* _mesa_function_pool[26717]: ProvokingVertexEXT (will be remapped) */
"i\0"
"glProvokingVertexEXT\0"
"glProvokingVertex\0"
"\0"
- /* _mesa_function_pool[26396]: MultiTexCoord1fARB (offset 378) */
+ /* _mesa_function_pool[26759]: MultiTexCoord1fARB (offset 378) */
"if\0"
"glMultiTexCoord1f\0"
"glMultiTexCoord1fARB\0"
"\0"
- /* _mesa_function_pool[26439]: LoadName (offset 198) */
+ /* _mesa_function_pool[26802]: LoadName (offset 198) */
"i\0"
"glLoadName\0"
"\0"
- /* _mesa_function_pool[26453]: VertexAttribs4ubvNV (will be remapped) */
+ /* _mesa_function_pool[26816]: VertexAttribs4ubvNV (will be remapped) */
"iip\0"
"glVertexAttribs4ubvNV\0"
"\0"
- /* _mesa_function_pool[26480]: WeightsvARB (dynamic) */
+ /* _mesa_function_pool[26843]: WeightsvARB (dynamic) */
"ip\0"
"glWeightsvARB\0"
"\0"
- /* _mesa_function_pool[26498]: Uniform1fvARB (will be remapped) */
+ /* _mesa_function_pool[26861]: Uniform1fvARB (will be remapped) */
"iip\0"
"glUniform1fv\0"
"glUniform1fvARB\0"
"\0"
- /* _mesa_function_pool[26532]: CopyTexSubImage1D (offset 325) */
+ /* _mesa_function_pool[26895]: CopyTexSubImage1D (offset 325) */
"iiiiii\0"
"glCopyTexSubImage1D\0"
"glCopyTexSubImage1DEXT\0"
"\0"
- /* _mesa_function_pool[26583]: CullFace (offset 152) */
+ /* _mesa_function_pool[26946]: CullFace (offset 152) */
"i\0"
"glCullFace\0"
"\0"
- /* _mesa_function_pool[26597]: BindTexture (offset 307) */
+ /* _mesa_function_pool[26960]: BindTexture (offset 307) */
"ii\0"
"glBindTexture\0"
"glBindTextureEXT\0"
"\0"
- /* _mesa_function_pool[26632]: BeginFragmentShaderATI (will be remapped) */
+ /* _mesa_function_pool[26995]: BeginFragmentShaderATI (will be remapped) */
"\0"
"glBeginFragmentShaderATI\0"
"\0"
- /* _mesa_function_pool[26659]: MultiTexCoord4fARB (offset 402) */
+ /* _mesa_function_pool[27022]: MultiTexCoord4fARB (offset 402) */
"iffff\0"
"glMultiTexCoord4f\0"
"glMultiTexCoord4fARB\0"
"\0"
- /* _mesa_function_pool[26705]: VertexAttribs3svNV (will be remapped) */
+ /* _mesa_function_pool[27068]: VertexAttribs3svNV (will be remapped) */
"iip\0"
"glVertexAttribs3svNV\0"
"\0"
- /* _mesa_function_pool[26731]: StencilFunc (offset 243) */
+ /* _mesa_function_pool[27094]: StencilFunc (offset 243) */
"iii\0"
"glStencilFunc\0"
"\0"
- /* _mesa_function_pool[26750]: CopyPixels (offset 255) */
+ /* _mesa_function_pool[27113]: CopyPixels (offset 255) */
"iiiii\0"
"glCopyPixels\0"
"\0"
- /* _mesa_function_pool[26770]: Rectsv (offset 93) */
+ /* _mesa_function_pool[27133]: Rectsv (offset 93) */
"pp\0"
"glRectsv\0"
"\0"
- /* _mesa_function_pool[26783]: ReplacementCodeuivSUN (dynamic) */
+ /* _mesa_function_pool[27146]: ReplacementCodeuivSUN (dynamic) */
"p\0"
"glReplacementCodeuivSUN\0"
"\0"
- /* _mesa_function_pool[26810]: EnableVertexAttribArrayARB (will be remapped) */
+ /* _mesa_function_pool[27173]: EnableVertexAttribArrayARB (will be remapped) */
"i\0"
"glEnableVertexAttribArray\0"
"glEnableVertexAttribArrayARB\0"
"\0"
- /* _mesa_function_pool[26868]: NormalPointervINTEL (dynamic) */
+ /* _mesa_function_pool[27231]: NormalPointervINTEL (dynamic) */
"ip\0"
"glNormalPointervINTEL\0"
"\0"
- /* _mesa_function_pool[26894]: CopyConvolutionFilter2D (offset 355) */
+ /* _mesa_function_pool[27257]: CopyConvolutionFilter2D (offset 355) */
"iiiiii\0"
"glCopyConvolutionFilter2D\0"
"glCopyConvolutionFilter2DEXT\0"
"\0"
- /* _mesa_function_pool[26957]: WindowPos3ivMESA (will be remapped) */
+ /* _mesa_function_pool[27320]: WindowPos3ivMESA (will be remapped) */
"p\0"
"glWindowPos3iv\0"
"glWindowPos3ivARB\0"
"glWindowPos3ivMESA\0"
"\0"
- /* _mesa_function_pool[27012]: CopyBufferSubData (will be remapped) */
+ /* _mesa_function_pool[27375]: CopyBufferSubData (will be remapped) */
"iiiii\0"
"glCopyBufferSubData\0"
"\0"
- /* _mesa_function_pool[27039]: NormalPointer (offset 318) */
+ /* _mesa_function_pool[27402]: NormalPointer (offset 318) */
"iip\0"
"glNormalPointer\0"
"\0"
- /* _mesa_function_pool[27060]: TexParameterfv (offset 179) */
+ /* _mesa_function_pool[27423]: TexParameterfv (offset 179) */
"iip\0"
"glTexParameterfv\0"
"\0"
- /* _mesa_function_pool[27082]: IsBufferARB (will be remapped) */
+ /* _mesa_function_pool[27445]: IsBufferARB (will be remapped) */
"i\0"
"glIsBuffer\0"
"glIsBufferARB\0"
"\0"
- /* _mesa_function_pool[27110]: WindowPos4iMESA (will be remapped) */
+ /* _mesa_function_pool[27473]: WindowPos4iMESA (will be remapped) */
"iiii\0"
"glWindowPos4iMESA\0"
"\0"
- /* _mesa_function_pool[27134]: VertexAttrib4uivARB (will be remapped) */
+ /* _mesa_function_pool[27497]: VertexAttrib4uivARB (will be remapped) */
"ip\0"
"glVertexAttrib4uiv\0"
"glVertexAttrib4uivARB\0"
"\0"
- /* _mesa_function_pool[27179]: Tangent3bvEXT (dynamic) */
+ /* _mesa_function_pool[27542]: Tangent3bvEXT (dynamic) */
"p\0"
"glTangent3bvEXT\0"
"\0"
- /* _mesa_function_pool[27198]: UniformMatrix3x4fv (will be remapped) */
+ /* _mesa_function_pool[27561]: UniformMatrix3x4fv (will be remapped) */
"iiip\0"
"glUniformMatrix3x4fv\0"
"\0"
- /* _mesa_function_pool[27225]: ClipPlane (offset 150) */
+ /* _mesa_function_pool[27588]: ClipPlane (offset 150) */
"ip\0"
"glClipPlane\0"
"\0"
- /* _mesa_function_pool[27241]: Recti (offset 90) */
+ /* _mesa_function_pool[27604]: Recti (offset 90) */
"iiii\0"
"glRecti\0"
"\0"
- /* _mesa_function_pool[27255]: DrawRangeElementsBaseVertex (will be remapped) */
+ /* _mesa_function_pool[27618]: DrawRangeElementsBaseVertex (will be remapped) */
"iiiiipi\0"
"glDrawRangeElementsBaseVertex\0"
"\0"
- /* _mesa_function_pool[27294]: TexCoordPointervINTEL (dynamic) */
+ /* _mesa_function_pool[27657]: TexCoordPointervINTEL (dynamic) */
"iip\0"
"glTexCoordPointervINTEL\0"
"\0"
- /* _mesa_function_pool[27323]: DeleteBuffersARB (will be remapped) */
+ /* _mesa_function_pool[27686]: DeleteBuffersARB (will be remapped) */
"ip\0"
"glDeleteBuffers\0"
"glDeleteBuffersARB\0"
"\0"
- /* _mesa_function_pool[27362]: WindowPos4fvMESA (will be remapped) */
+ /* _mesa_function_pool[27725]: PixelTransformParameterfvEXT (dynamic) */
+ "iip\0"
+ "glPixelTransformParameterfvEXT\0"
+ "\0"
+ /* _mesa_function_pool[27761]: WindowPos4fvMESA (will be remapped) */
"p\0"
"glWindowPos4fvMESA\0"
"\0"
- /* _mesa_function_pool[27384]: GetPixelMapuiv (offset 272) */
+ /* _mesa_function_pool[27783]: GetPixelMapuiv (offset 272) */
"ip\0"
"glGetPixelMapuiv\0"
"\0"
- /* _mesa_function_pool[27405]: Rectf (offset 88) */
+ /* _mesa_function_pool[27804]: Rectf (offset 88) */
"ffff\0"
"glRectf\0"
"\0"
- /* _mesa_function_pool[27419]: VertexAttrib1sNV (will be remapped) */
+ /* _mesa_function_pool[27818]: VertexAttrib1sNV (will be remapped) */
"ii\0"
"glVertexAttrib1sNV\0"
"\0"
- /* _mesa_function_pool[27442]: Indexfv (offset 47) */
+ /* _mesa_function_pool[27841]: Indexfv (offset 47) */
"p\0"
"glIndexfv\0"
"\0"
- /* _mesa_function_pool[27455]: SecondaryColor3svEXT (will be remapped) */
+ /* _mesa_function_pool[27854]: SecondaryColor3svEXT (will be remapped) */
"p\0"
"glSecondaryColor3sv\0"
"glSecondaryColor3svEXT\0"
"\0"
- /* _mesa_function_pool[27501]: LoadTransposeMatrixfARB (will be remapped) */
+ /* _mesa_function_pool[27900]: LoadTransposeMatrixfARB (will be remapped) */
"p\0"
"glLoadTransposeMatrixf\0"
"glLoadTransposeMatrixfARB\0"
"\0"
- /* _mesa_function_pool[27553]: GetPointerv (offset 329) */
+ /* _mesa_function_pool[27952]: GetPointerv (offset 329) */
"ip\0"
"glGetPointerv\0"
"glGetPointervEXT\0"
"\0"
- /* _mesa_function_pool[27588]: Tangent3bEXT (dynamic) */
+ /* _mesa_function_pool[27987]: Tangent3bEXT (dynamic) */
"iii\0"
"glTangent3bEXT\0"
"\0"
- /* _mesa_function_pool[27608]: CombinerParameterfNV (will be remapped) */
+ /* _mesa_function_pool[28007]: CombinerParameterfNV (will be remapped) */
"if\0"
"glCombinerParameterfNV\0"
"\0"
- /* _mesa_function_pool[27635]: IndexMask (offset 212) */
+ /* _mesa_function_pool[28034]: IndexMask (offset 212) */
"i\0"
"glIndexMask\0"
"\0"
- /* _mesa_function_pool[27650]: BindProgramNV (will be remapped) */
+ /* _mesa_function_pool[28049]: BindProgramNV (will be remapped) */
"ii\0"
"glBindProgramARB\0"
"glBindProgramNV\0"
"\0"
- /* _mesa_function_pool[27687]: VertexAttrib4svARB (will be remapped) */
+ /* _mesa_function_pool[28086]: VertexAttrib4svARB (will be remapped) */
"ip\0"
"glVertexAttrib4sv\0"
"glVertexAttrib4svARB\0"
"\0"
- /* _mesa_function_pool[27730]: GetFloatv (offset 262) */
+ /* _mesa_function_pool[28129]: GetFloatv (offset 262) */
"ip\0"
"glGetFloatv\0"
"\0"
- /* _mesa_function_pool[27746]: CreateDebugObjectMESA (dynamic) */
+ /* _mesa_function_pool[28145]: CreateDebugObjectMESA (dynamic) */
"\0"
"glCreateDebugObjectMESA\0"
"\0"
- /* _mesa_function_pool[27772]: GetShaderiv (will be remapped) */
+ /* _mesa_function_pool[28171]: GetShaderiv (will be remapped) */
"iip\0"
"glGetShaderiv\0"
"\0"
- /* _mesa_function_pool[27791]: ClientWaitSync (will be remapped) */
+ /* _mesa_function_pool[28190]: ClientWaitSync (will be remapped) */
"iii\0"
"glClientWaitSync\0"
"\0"
- /* _mesa_function_pool[27813]: TexCoord4s (offset 124) */
+ /* _mesa_function_pool[28212]: TexCoord4s (offset 124) */
"iiii\0"
"glTexCoord4s\0"
"\0"
- /* _mesa_function_pool[27832]: TexCoord3sv (offset 117) */
+ /* _mesa_function_pool[28231]: TexCoord3sv (offset 117) */
"p\0"
"glTexCoord3sv\0"
"\0"
- /* _mesa_function_pool[27849]: BindFragmentShaderATI (will be remapped) */
+ /* _mesa_function_pool[28248]: BindFragmentShaderATI (will be remapped) */
"i\0"
"glBindFragmentShaderATI\0"
"\0"
- /* _mesa_function_pool[27876]: PopAttrib (offset 218) */
+ /* _mesa_function_pool[28275]: PopAttrib (offset 218) */
"\0"
"glPopAttrib\0"
"\0"
- /* _mesa_function_pool[27890]: Fogfv (offset 154) */
+ /* _mesa_function_pool[28289]: Fogfv (offset 154) */
"ip\0"
"glFogfv\0"
"\0"
- /* _mesa_function_pool[27902]: UnmapBufferARB (will be remapped) */
+ /* _mesa_function_pool[28301]: UnmapBufferARB (will be remapped) */
"i\0"
"glUnmapBuffer\0"
"glUnmapBufferARB\0"
"\0"
- /* _mesa_function_pool[27936]: InitNames (offset 197) */
+ /* _mesa_function_pool[28335]: InitNames (offset 197) */
"\0"
"glInitNames\0"
"\0"
- /* _mesa_function_pool[27950]: Normal3sv (offset 61) */
+ /* _mesa_function_pool[28349]: Normal3sv (offset 61) */
"p\0"
"glNormal3sv\0"
"\0"
- /* _mesa_function_pool[27965]: Minmax (offset 368) */
+ /* _mesa_function_pool[28364]: Minmax (offset 368) */
"iii\0"
"glMinmax\0"
"glMinmaxEXT\0"
"\0"
- /* _mesa_function_pool[27991]: TexCoord4d (offset 118) */
+ /* _mesa_function_pool[28390]: TexCoord4d (offset 118) */
"dddd\0"
"glTexCoord4d\0"
"\0"
- /* _mesa_function_pool[28010]: DeformationMap3dSGIX (dynamic) */
- "iddiiddiiddiip\0"
- "glDeformationMap3dSGIX\0"
- "\0"
- /* _mesa_function_pool[28049]: TexCoord4f (offset 120) */
+ /* _mesa_function_pool[28409]: TexCoord4f (offset 120) */
"ffff\0"
"glTexCoord4f\0"
"\0"
- /* _mesa_function_pool[28068]: FogCoorddvEXT (will be remapped) */
+ /* _mesa_function_pool[28428]: FogCoorddvEXT (will be remapped) */
"p\0"
"glFogCoorddv\0"
"glFogCoorddvEXT\0"
"\0"
- /* _mesa_function_pool[28100]: FinishTextureSUNX (dynamic) */
+ /* _mesa_function_pool[28460]: FinishTextureSUNX (dynamic) */
"\0"
"glFinishTextureSUNX\0"
"\0"
- /* _mesa_function_pool[28122]: GetFragmentLightfvSGIX (dynamic) */
+ /* _mesa_function_pool[28482]: GetFragmentLightfvSGIX (dynamic) */
"iip\0"
"glGetFragmentLightfvSGIX\0"
"\0"
- /* _mesa_function_pool[28152]: Binormal3fvEXT (dynamic) */
+ /* _mesa_function_pool[28512]: Binormal3fvEXT (dynamic) */
"p\0"
"glBinormal3fvEXT\0"
"\0"
- /* _mesa_function_pool[28172]: GetBooleanv (offset 258) */
+ /* _mesa_function_pool[28532]: GetBooleanv (offset 258) */
"ip\0"
"glGetBooleanv\0"
"\0"
- /* _mesa_function_pool[28190]: ColorFragmentOp3ATI (will be remapped) */
+ /* _mesa_function_pool[28550]: ColorFragmentOp3ATI (will be remapped) */
"iiiiiiiiiiiii\0"
"glColorFragmentOp3ATI\0"
"\0"
- /* _mesa_function_pool[28227]: Hint (offset 158) */
+ /* _mesa_function_pool[28587]: Hint (offset 158) */
"ii\0"
"glHint\0"
"\0"
- /* _mesa_function_pool[28238]: Color4dv (offset 28) */
+ /* _mesa_function_pool[28598]: Color4dv (offset 28) */
"p\0"
"glColor4dv\0"
"\0"
- /* _mesa_function_pool[28252]: VertexAttrib2svARB (will be remapped) */
+ /* _mesa_function_pool[28612]: VertexAttrib2svARB (will be remapped) */
"ip\0"
"glVertexAttrib2sv\0"
"glVertexAttrib2svARB\0"
"\0"
- /* _mesa_function_pool[28295]: AreProgramsResidentNV (will be remapped) */
+ /* _mesa_function_pool[28655]: AreProgramsResidentNV (will be remapped) */
"ipp\0"
"glAreProgramsResidentNV\0"
"\0"
- /* _mesa_function_pool[28324]: WindowPos3svMESA (will be remapped) */
+ /* _mesa_function_pool[28684]: WindowPos3svMESA (will be remapped) */
"p\0"
"glWindowPos3sv\0"
"glWindowPos3svARB\0"
"glWindowPos3svMESA\0"
"\0"
- /* _mesa_function_pool[28379]: CopyColorSubTable (offset 347) */
+ /* _mesa_function_pool[28739]: CopyColorSubTable (offset 347) */
"iiiii\0"
"glCopyColorSubTable\0"
"glCopyColorSubTableEXT\0"
"\0"
- /* _mesa_function_pool[28429]: WeightdvARB (dynamic) */
+ /* _mesa_function_pool[28789]: WeightdvARB (dynamic) */
"ip\0"
"glWeightdvARB\0"
"\0"
- /* _mesa_function_pool[28447]: DeleteRenderbuffersEXT (will be remapped) */
+ /* _mesa_function_pool[28807]: DeleteRenderbuffersEXT (will be remapped) */
"ip\0"
"glDeleteRenderbuffers\0"
"glDeleteRenderbuffersEXT\0"
"\0"
- /* _mesa_function_pool[28498]: VertexAttrib4NubvARB (will be remapped) */
+ /* _mesa_function_pool[28858]: VertexAttrib4NubvARB (will be remapped) */
"ip\0"
"glVertexAttrib4Nubv\0"
"glVertexAttrib4NubvARB\0"
"\0"
- /* _mesa_function_pool[28545]: VertexAttrib3dvNV (will be remapped) */
+ /* _mesa_function_pool[28905]: VertexAttrib3dvNV (will be remapped) */
"ip\0"
"glVertexAttrib3dvNV\0"
"\0"
- /* _mesa_function_pool[28569]: GetObjectParameterfvARB (will be remapped) */
+ /* _mesa_function_pool[28929]: GetObjectParameterfvARB (will be remapped) */
"iip\0"
"glGetObjectParameterfvARB\0"
"\0"
- /* _mesa_function_pool[28600]: Vertex4iv (offset 147) */
+ /* _mesa_function_pool[28960]: Vertex4iv (offset 147) */
"p\0"
"glVertex4iv\0"
"\0"
- /* _mesa_function_pool[28615]: GetProgramEnvParameterdvARB (will be remapped) */
+ /* _mesa_function_pool[28975]: GetProgramEnvParameterdvARB (will be remapped) */
"iip\0"
"glGetProgramEnvParameterdvARB\0"
"\0"
- /* _mesa_function_pool[28650]: TexCoord4dv (offset 119) */
+ /* _mesa_function_pool[29010]: TexCoord4dv (offset 119) */
"p\0"
"glTexCoord4dv\0"
"\0"
- /* _mesa_function_pool[28667]: LockArraysEXT (will be remapped) */
+ /* _mesa_function_pool[29027]: LockArraysEXT (will be remapped) */
"ii\0"
"glLockArraysEXT\0"
"\0"
- /* _mesa_function_pool[28687]: Begin (offset 7) */
+ /* _mesa_function_pool[29047]: Begin (offset 7) */
"i\0"
"glBegin\0"
"\0"
- /* _mesa_function_pool[28698]: LightModeli (offset 165) */
+ /* _mesa_function_pool[29058]: LightModeli (offset 165) */
"ii\0"
"glLightModeli\0"
"\0"
- /* _mesa_function_pool[28716]: Rectfv (offset 89) */
+ /* _mesa_function_pool[29076]: Rectfv (offset 89) */
"pp\0"
"glRectfv\0"
"\0"
- /* _mesa_function_pool[28729]: LightModelf (offset 163) */
+ /* _mesa_function_pool[29089]: LightModelf (offset 163) */
"if\0"
"glLightModelf\0"
"\0"
- /* _mesa_function_pool[28747]: GetTexParameterfv (offset 282) */
+ /* _mesa_function_pool[29107]: GetTexParameterfv (offset 282) */
"iip\0"
"glGetTexParameterfv\0"
"\0"
- /* _mesa_function_pool[28772]: GetLightfv (offset 264) */
+ /* _mesa_function_pool[29132]: GetLightfv (offset 264) */
"iip\0"
"glGetLightfv\0"
"\0"
- /* _mesa_function_pool[28790]: PixelTransformParameterivEXT (dynamic) */
+ /* _mesa_function_pool[29150]: PixelTransformParameterivEXT (dynamic) */
"iip\0"
"glPixelTransformParameterivEXT\0"
"\0"
- /* _mesa_function_pool[28826]: BinormalPointerEXT (dynamic) */
+ /* _mesa_function_pool[29186]: BinormalPointerEXT (dynamic) */
"iip\0"
"glBinormalPointerEXT\0"
"\0"
- /* _mesa_function_pool[28852]: VertexAttrib1dNV (will be remapped) */
+ /* _mesa_function_pool[29212]: VertexAttrib1dNV (will be remapped) */
"id\0"
"glVertexAttrib1dNV\0"
"\0"
- /* _mesa_function_pool[28875]: GetCombinerInputParameterivNV (will be remapped) */
+ /* _mesa_function_pool[29235]: GetCombinerInputParameterivNV (will be remapped) */
"iiiip\0"
"glGetCombinerInputParameterivNV\0"
"\0"
- /* _mesa_function_pool[28914]: Disable (offset 214) */
+ /* _mesa_function_pool[29274]: Disable (offset 214) */
"i\0"
"glDisable\0"
"\0"
- /* _mesa_function_pool[28927]: MultiTexCoord2fvARB (offset 387) */
+ /* _mesa_function_pool[29287]: MultiTexCoord2fvARB (offset 387) */
"ip\0"
"glMultiTexCoord2fv\0"
"glMultiTexCoord2fvARB\0"
"\0"
- /* _mesa_function_pool[28972]: GetRenderbufferParameterivEXT (will be remapped) */
+ /* _mesa_function_pool[29332]: GetRenderbufferParameterivEXT (will be remapped) */
"iip\0"
"glGetRenderbufferParameteriv\0"
"glGetRenderbufferParameterivEXT\0"
"\0"
- /* _mesa_function_pool[29038]: CombinerParameterivNV (will be remapped) */
+ /* _mesa_function_pool[29398]: CombinerParameterivNV (will be remapped) */
"ip\0"
"glCombinerParameterivNV\0"
"\0"
- /* _mesa_function_pool[29066]: GenFragmentShadersATI (will be remapped) */
+ /* _mesa_function_pool[29426]: GenFragmentShadersATI (will be remapped) */
"i\0"
"glGenFragmentShadersATI\0"
"\0"
- /* _mesa_function_pool[29093]: DrawArrays (offset 310) */
+ /* _mesa_function_pool[29453]: DrawArrays (offset 310) */
"iii\0"
"glDrawArrays\0"
"glDrawArraysEXT\0"
"\0"
- /* _mesa_function_pool[29127]: WeightuivARB (dynamic) */
+ /* _mesa_function_pool[29487]: WeightuivARB (dynamic) */
"ip\0"
"glWeightuivARB\0"
"\0"
- /* _mesa_function_pool[29146]: VertexAttrib2sARB (will be remapped) */
+ /* _mesa_function_pool[29506]: VertexAttrib2sARB (will be remapped) */
"iii\0"
"glVertexAttrib2s\0"
"glVertexAttrib2sARB\0"
"\0"
- /* _mesa_function_pool[29188]: ColorMask (offset 210) */
+ /* _mesa_function_pool[29548]: ColorMask (offset 210) */
"iiii\0"
"glColorMask\0"
"\0"
- /* _mesa_function_pool[29206]: GenAsyncMarkersSGIX (dynamic) */
+ /* _mesa_function_pool[29566]: GenAsyncMarkersSGIX (dynamic) */
"i\0"
"glGenAsyncMarkersSGIX\0"
"\0"
- /* _mesa_function_pool[29231]: Tangent3svEXT (dynamic) */
+ /* _mesa_function_pool[29591]: Tangent3svEXT (dynamic) */
"p\0"
"glTangent3svEXT\0"
"\0"
- /* _mesa_function_pool[29250]: GetListParameterivSGIX (dynamic) */
+ /* _mesa_function_pool[29610]: GetListParameterivSGIX (dynamic) */
"iip\0"
"glGetListParameterivSGIX\0"
"\0"
- /* _mesa_function_pool[29280]: BindBufferARB (will be remapped) */
+ /* _mesa_function_pool[29640]: BindBufferARB (will be remapped) */
"ii\0"
"glBindBuffer\0"
"glBindBufferARB\0"
"\0"
- /* _mesa_function_pool[29313]: GetInfoLogARB (will be remapped) */
+ /* _mesa_function_pool[29673]: GetInfoLogARB (will be remapped) */
"iipp\0"
"glGetInfoLogARB\0"
"\0"
- /* _mesa_function_pool[29335]: RasterPos4iv (offset 83) */
+ /* _mesa_function_pool[29695]: RasterPos4iv (offset 83) */
"p\0"
"glRasterPos4iv\0"
"\0"
- /* _mesa_function_pool[29353]: Enable (offset 215) */
+ /* _mesa_function_pool[29713]: Enable (offset 215) */
"i\0"
"glEnable\0"
"\0"
- /* _mesa_function_pool[29365]: LineStipple (offset 167) */
+ /* _mesa_function_pool[29725]: LineStipple (offset 167) */
"ii\0"
"glLineStipple\0"
"\0"
- /* _mesa_function_pool[29383]: VertexAttribs4svNV (will be remapped) */
+ /* _mesa_function_pool[29743]: VertexAttribs4svNV (will be remapped) */
"iip\0"
"glVertexAttribs4svNV\0"
"\0"
- /* _mesa_function_pool[29409]: EdgeFlagPointerListIBM (dynamic) */
+ /* _mesa_function_pool[29769]: EdgeFlagPointerListIBM (dynamic) */
"ipi\0"
"glEdgeFlagPointerListIBM\0"
"\0"
- /* _mesa_function_pool[29439]: UniformMatrix3x2fv (will be remapped) */
+ /* _mesa_function_pool[29799]: UniformMatrix3x2fv (will be remapped) */
"iiip\0"
"glUniformMatrix3x2fv\0"
"\0"
- /* _mesa_function_pool[29466]: GetMinmaxParameterfv (offset 365) */
+ /* _mesa_function_pool[29826]: GetMinmaxParameterfv (offset 365) */
"iip\0"
"glGetMinmaxParameterfv\0"
"glGetMinmaxParameterfvEXT\0"
"\0"
- /* _mesa_function_pool[29520]: VertexAttrib1fvARB (will be remapped) */
+ /* _mesa_function_pool[29880]: VertexAttrib1fvARB (will be remapped) */
"ip\0"
"glVertexAttrib1fv\0"
"glVertexAttrib1fvARB\0"
"\0"
- /* _mesa_function_pool[29563]: GenBuffersARB (will be remapped) */
+ /* _mesa_function_pool[29923]: GenBuffersARB (will be remapped) */
"ip\0"
"glGenBuffers\0"
"glGenBuffersARB\0"
"\0"
- /* _mesa_function_pool[29596]: VertexAttribs1svNV (will be remapped) */
+ /* _mesa_function_pool[29956]: VertexAttribs1svNV (will be remapped) */
"iip\0"
"glVertexAttribs1svNV\0"
"\0"
- /* _mesa_function_pool[29622]: Vertex3fv (offset 137) */
+ /* _mesa_function_pool[29982]: Vertex3fv (offset 137) */
"p\0"
"glVertex3fv\0"
"\0"
- /* _mesa_function_pool[29637]: GetTexBumpParameterivATI (will be remapped) */
+ /* _mesa_function_pool[29997]: GetTexBumpParameterivATI (will be remapped) */
"ip\0"
"glGetTexBumpParameterivATI\0"
"\0"
- /* _mesa_function_pool[29668]: Binormal3bEXT (dynamic) */
+ /* _mesa_function_pool[30028]: Binormal3bEXT (dynamic) */
"iii\0"
"glBinormal3bEXT\0"
"\0"
- /* _mesa_function_pool[29689]: FragmentMaterialivSGIX (dynamic) */
+ /* _mesa_function_pool[30049]: FragmentMaterialivSGIX (dynamic) */
"iip\0"
"glFragmentMaterialivSGIX\0"
"\0"
- /* _mesa_function_pool[29719]: IsRenderbufferEXT (will be remapped) */
+ /* _mesa_function_pool[30079]: IsRenderbufferEXT (will be remapped) */
"i\0"
"glIsRenderbuffer\0"
"glIsRenderbufferEXT\0"
"\0"
- /* _mesa_function_pool[29759]: GenProgramsNV (will be remapped) */
+ /* _mesa_function_pool[30119]: GenProgramsNV (will be remapped) */
"ip\0"
"glGenProgramsARB\0"
"glGenProgramsNV\0"
"\0"
- /* _mesa_function_pool[29796]: VertexAttrib4dvNV (will be remapped) */
+ /* _mesa_function_pool[30156]: VertexAttrib4dvNV (will be remapped) */
"ip\0"
"glVertexAttrib4dvNV\0"
"\0"
- /* _mesa_function_pool[29820]: EndFragmentShaderATI (will be remapped) */
+ /* _mesa_function_pool[30180]: EndFragmentShaderATI (will be remapped) */
"\0"
"glEndFragmentShaderATI\0"
"\0"
- /* _mesa_function_pool[29845]: Binormal3iEXT (dynamic) */
+ /* _mesa_function_pool[30205]: Binormal3iEXT (dynamic) */
"iii\0"
"glBinormal3iEXT\0"
"\0"
- /* _mesa_function_pool[29866]: WindowPos2fMESA (will be remapped) */
+ /* _mesa_function_pool[30226]: WindowPos2fMESA (will be remapped) */
"ff\0"
"glWindowPos2f\0"
"glWindowPos2fARB\0"
@@ -4386,405 +4420,412 @@ static const struct {
GLint remap_index;
} MESA_remap_table_functions[] = {
{ 1461, AttachShader_remap_index },
- { 8794, CreateProgram_remap_index },
- { 20420, CreateShader_remap_index },
- { 22750, DeleteProgram_remap_index },
- { 16372, DeleteShader_remap_index },
- { 20866, DetachShader_remap_index },
- { 15896, GetAttachedShaders_remap_index },
+ { 8848, CreateProgram_remap_index },
+ { 20720, CreateShader_remap_index },
+ { 23050, DeleteProgram_remap_index },
+ { 16566, DeleteShader_remap_index },
+ { 21166, DetachShader_remap_index },
+ { 16090, GetAttachedShaders_remap_index },
{ 4275, GetProgramInfoLog_remap_index },
{ 361, GetProgramiv_remap_index },
{ 5608, GetShaderInfoLog_remap_index },
- { 27772, GetShaderiv_remap_index },
- { 11879, IsProgram_remap_index },
- { 10914, IsShader_remap_index },
- { 8898, StencilFuncSeparate_remap_index },
+ { 28171, GetShaderiv_remap_index },
+ { 12054, IsProgram_remap_index },
+ { 11089, IsShader_remap_index },
+ { 8952, StencilFuncSeparate_remap_index },
{ 3487, StencilMaskSeparate_remap_index },
{ 6684, StencilOpSeparate_remap_index },
- { 19771, UniformMatrix2x3fv_remap_index },
+ { 20045, UniformMatrix2x3fv_remap_index },
{ 2615, UniformMatrix2x4fv_remap_index },
- { 29439, UniformMatrix3x2fv_remap_index },
- { 27198, UniformMatrix3x4fv_remap_index },
- { 14444, UniformMatrix4x2fv_remap_index },
+ { 29799, UniformMatrix3x2fv_remap_index },
+ { 27561, UniformMatrix3x4fv_remap_index },
+ { 14638, UniformMatrix4x2fv_remap_index },
{ 2937, UniformMatrix4x3fv_remap_index },
- { 8812, LoadTransposeMatrixdARB_remap_index },
- { 27501, LoadTransposeMatrixfARB_remap_index },
+ { 8866, LoadTransposeMatrixdARB_remap_index },
+ { 27900, LoadTransposeMatrixfARB_remap_index },
{ 4848, MultTransposeMatrixdARB_remap_index },
- { 21053, MultTransposeMatrixfARB_remap_index },
+ { 21353, MultTransposeMatrixfARB_remap_index },
{ 172, SampleCoverageARB_remap_index },
{ 5032, CompressedTexImage1DARB_remap_index },
- { 21553, CompressedTexImage2DARB_remap_index },
+ { 21853, CompressedTexImage2DARB_remap_index },
{ 3550, CompressedTexImage3DARB_remap_index },
- { 16188, CompressedTexSubImage1DARB_remap_index },
+ { 16382, CompressedTexSubImage1DARB_remap_index },
{ 1880, CompressedTexSubImage2DARB_remap_index },
- { 18008, CompressedTexSubImage3DARB_remap_index },
- { 25480, GetCompressedTexImageARB_remap_index },
+ { 18243, CompressedTexSubImage3DARB_remap_index },
+ { 25843, GetCompressedTexImageARB_remap_index },
{ 3395, DisableVertexAttribArrayARB_remap_index },
- { 26810, EnableVertexAttribArrayARB_remap_index },
- { 28615, GetProgramEnvParameterdvARB_remap_index },
- { 20933, GetProgramEnvParameterfvARB_remap_index },
- { 24510, GetProgramLocalParameterdvARB_remap_index },
+ { 27173, EnableVertexAttribArrayARB_remap_index },
+ { 28975, GetProgramEnvParameterdvARB_remap_index },
+ { 21233, GetProgramEnvParameterfvARB_remap_index },
+ { 24844, GetProgramLocalParameterdvARB_remap_index },
{ 7126, GetProgramLocalParameterfvARB_remap_index },
- { 16279, GetProgramStringARB_remap_index },
- { 24705, GetProgramivARB_remap_index },
- { 18203, GetVertexAttribdvARB_remap_index },
- { 14333, GetVertexAttribfvARB_remap_index },
- { 8707, GetVertexAttribivARB_remap_index },
- { 17084, ProgramEnvParameter4dARB_remap_index },
- { 22523, ProgramEnvParameter4dvARB_remap_index },
- { 14941, ProgramEnvParameter4fARB_remap_index },
+ { 16473, GetProgramStringARB_remap_index },
+ { 25039, GetProgramivARB_remap_index },
+ { 18438, GetVertexAttribdvARB_remap_index },
+ { 14527, GetVertexAttribfvARB_remap_index },
+ { 8761, GetVertexAttribivARB_remap_index },
+ { 17319, ProgramEnvParameter4dARB_remap_index },
+ { 22823, ProgramEnvParameter4dvARB_remap_index },
+ { 15135, ProgramEnvParameter4fARB_remap_index },
{ 7989, ProgramEnvParameter4fvARB_remap_index },
{ 3513, ProgramLocalParameter4dARB_remap_index },
- { 11589, ProgramLocalParameter4dvARB_remap_index },
- { 26289, ProgramLocalParameter4fARB_remap_index },
- { 23068, ProgramLocalParameter4fvARB_remap_index },
- { 25266, ProgramStringARB_remap_index },
- { 17334, VertexAttrib1dARB_remap_index },
- { 13987, VertexAttrib1dvARB_remap_index },
+ { 11764, ProgramLocalParameter4dvARB_remap_index },
+ { 26652, ProgramLocalParameter4fARB_remap_index },
+ { 23368, ProgramLocalParameter4fvARB_remap_index },
+ { 25629, ProgramStringARB_remap_index },
+ { 17569, VertexAttrib1dARB_remap_index },
+ { 14181, VertexAttrib1dvARB_remap_index },
{ 3688, VertexAttrib1fARB_remap_index },
- { 29520, VertexAttrib1fvARB_remap_index },
+ { 29880, VertexAttrib1fvARB_remap_index },
{ 6210, VertexAttrib1sARB_remap_index },
{ 2054, VertexAttrib1svARB_remap_index },
- { 13418, VertexAttrib2dARB_remap_index },
- { 15515, VertexAttrib2dvARB_remap_index },
+ { 13612, VertexAttrib2dARB_remap_index },
+ { 15709, VertexAttrib2dvARB_remap_index },
{ 1480, VertexAttrib2fARB_remap_index },
- { 15628, VertexAttrib2fvARB_remap_index },
- { 29146, VertexAttrib2sARB_remap_index },
- { 28252, VertexAttrib2svARB_remap_index },
- { 10045, VertexAttrib3dARB_remap_index },
+ { 15822, VertexAttrib2fvARB_remap_index },
+ { 29506, VertexAttrib2sARB_remap_index },
+ { 28612, VertexAttrib2svARB_remap_index },
+ { 10135, VertexAttrib3dARB_remap_index },
{ 7692, VertexAttrib3dvARB_remap_index },
{ 1567, VertexAttrib3fARB_remap_index },
- { 20008, VertexAttrib3fvARB_remap_index },
- { 25138, VertexAttrib3sARB_remap_index },
- { 17945, VertexAttrib3svARB_remap_index },
+ { 20308, VertexAttrib3fvARB_remap_index },
+ { 25472, VertexAttrib3sARB_remap_index },
+ { 18180, VertexAttrib3svARB_remap_index },
{ 4301, VertexAttrib4NbvARB_remap_index },
- { 15851, VertexAttrib4NivARB_remap_index },
- { 19963, VertexAttrib4NsvARB_remap_index },
- { 20885, VertexAttrib4NubARB_remap_index },
- { 28498, VertexAttrib4NubvARB_remap_index },
- { 16745, VertexAttrib4NuivARB_remap_index },
+ { 16045, VertexAttrib4NivARB_remap_index },
+ { 20263, VertexAttrib4NsvARB_remap_index },
+ { 21185, VertexAttrib4NubARB_remap_index },
+ { 28858, VertexAttrib4NubvARB_remap_index },
+ { 16980, VertexAttrib4NuivARB_remap_index },
{ 2810, VertexAttrib4NusvARB_remap_index },
- { 9639, VertexAttrib4bvARB_remap_index },
- { 23918, VertexAttrib4dARB_remap_index },
- { 18928, VertexAttrib4dvARB_remap_index },
- { 10152, VertexAttrib4fARB_remap_index },
- { 10556, VertexAttrib4fvARB_remap_index },
- { 9091, VertexAttrib4ivARB_remap_index },
- { 15329, VertexAttrib4sARB_remap_index },
- { 27687, VertexAttrib4svARB_remap_index },
- { 14746, VertexAttrib4ubvARB_remap_index },
- { 27134, VertexAttrib4uivARB_remap_index },
- { 17756, VertexAttrib4usvARB_remap_index },
- { 19645, VertexAttribPointerARB_remap_index },
- { 29280, BindBufferARB_remap_index },
+ { 9729, VertexAttrib4bvARB_remap_index },
+ { 24252, VertexAttrib4dARB_remap_index },
+ { 19202, VertexAttrib4dvARB_remap_index },
+ { 10242, VertexAttrib4fARB_remap_index },
+ { 10646, VertexAttrib4fvARB_remap_index },
+ { 9145, VertexAttrib4ivARB_remap_index },
+ { 15523, VertexAttrib4sARB_remap_index },
+ { 28086, VertexAttrib4svARB_remap_index },
+ { 14940, VertexAttrib4ubvARB_remap_index },
+ { 27497, VertexAttrib4uivARB_remap_index },
+ { 17991, VertexAttrib4usvARB_remap_index },
+ { 19919, VertexAttribPointerARB_remap_index },
+ { 29640, BindBufferARB_remap_index },
{ 5923, BufferDataARB_remap_index },
{ 1382, BufferSubDataARB_remap_index },
- { 27323, DeleteBuffersARB_remap_index },
- { 29563, GenBuffersARB_remap_index },
- { 15671, GetBufferParameterivARB_remap_index },
- { 14893, GetBufferPointervARB_remap_index },
+ { 27686, DeleteBuffersARB_remap_index },
+ { 29923, GenBuffersARB_remap_index },
+ { 15865, GetBufferParameterivARB_remap_index },
+ { 15087, GetBufferPointervARB_remap_index },
{ 1335, GetBufferSubDataARB_remap_index },
- { 27082, IsBufferARB_remap_index },
- { 23523, MapBufferARB_remap_index },
- { 27902, UnmapBufferARB_remap_index },
+ { 27445, IsBufferARB_remap_index },
+ { 23825, MapBufferARB_remap_index },
+ { 28301, UnmapBufferARB_remap_index },
{ 268, BeginQueryARB_remap_index },
- { 17429, DeleteQueriesARB_remap_index },
- { 10850, EndQueryARB_remap_index },
- { 25959, GenQueriesARB_remap_index },
+ { 17664, DeleteQueriesARB_remap_index },
+ { 10940, EndQueryARB_remap_index },
+ { 26322, GenQueriesARB_remap_index },
{ 1772, GetQueryObjectivARB_remap_index },
- { 15373, GetQueryObjectuivARB_remap_index },
+ { 15567, GetQueryObjectuivARB_remap_index },
{ 1624, GetQueryivARB_remap_index },
- { 17663, IsQueryARB_remap_index },
+ { 17898, IsQueryARB_remap_index },
{ 7302, AttachObjectARB_remap_index },
- { 16334, CompileShaderARB_remap_index },
+ { 16528, CompileShaderARB_remap_index },
{ 2879, CreateProgramObjectARB_remap_index },
{ 5868, CreateShaderObjectARB_remap_index },
- { 12835, DeleteObjectARB_remap_index },
- { 21327, DetachObjectARB_remap_index },
- { 10628, GetActiveUniformARB_remap_index },
- { 8410, GetAttachedObjectsARB_remap_index },
- { 8689, GetHandleARB_remap_index },
- { 29313, GetInfoLogARB_remap_index },
- { 28569, GetObjectParameterfvARB_remap_index },
- { 24384, GetObjectParameterivARB_remap_index },
- { 25717, GetShaderSourceARB_remap_index },
- { 24998, GetUniformLocationARB_remap_index },
- { 21155, GetUniformfvARB_remap_index },
- { 11211, GetUniformivARB_remap_index },
- { 17801, LinkProgramARB_remap_index },
- { 17859, ShaderSourceARB_remap_index },
+ { 13029, DeleteObjectARB_remap_index },
+ { 21627, DetachObjectARB_remap_index },
+ { 10718, GetActiveUniformARB_remap_index },
+ { 8464, GetAttachedObjectsARB_remap_index },
+ { 8743, GetHandleARB_remap_index },
+ { 29673, GetInfoLogARB_remap_index },
+ { 28929, GetObjectParameterfvARB_remap_index },
+ { 24718, GetObjectParameterivARB_remap_index },
+ { 26080, GetShaderSourceARB_remap_index },
+ { 25332, GetUniformLocationARB_remap_index },
+ { 21455, GetUniformfvARB_remap_index },
+ { 11386, GetUniformivARB_remap_index },
+ { 18036, LinkProgramARB_remap_index },
+ { 18094, ShaderSourceARB_remap_index },
{ 6584, Uniform1fARB_remap_index },
- { 26498, Uniform1fvARB_remap_index },
- { 19614, Uniform1iARB_remap_index },
- { 18617, Uniform1ivARB_remap_index },
+ { 26861, Uniform1fvARB_remap_index },
+ { 19888, Uniform1iARB_remap_index },
+ { 18891, Uniform1ivARB_remap_index },
{ 2003, Uniform2fARB_remap_index },
- { 12671, Uniform2fvARB_remap_index },
- { 23410, Uniform2iARB_remap_index },
+ { 12865, Uniform2fvARB_remap_index },
+ { 23712, Uniform2iARB_remap_index },
{ 2123, Uniform2ivARB_remap_index },
- { 16444, Uniform3fARB_remap_index },
- { 8440, Uniform3fvARB_remap_index },
+ { 16638, Uniform3fARB_remap_index },
+ { 8494, Uniform3fvARB_remap_index },
{ 5542, Uniform3iARB_remap_index },
- { 14999, Uniform3ivARB_remap_index },
- { 16890, Uniform4fARB_remap_index },
- { 21019, Uniform4fvARB_remap_index },
- { 22202, Uniform4iARB_remap_index },
- { 18169, Uniform4ivARB_remap_index },
+ { 15193, Uniform3ivARB_remap_index },
+ { 17125, Uniform4fARB_remap_index },
+ { 21319, Uniform4fvARB_remap_index },
+ { 22502, Uniform4iARB_remap_index },
+ { 18404, Uniform4ivARB_remap_index },
{ 7354, UniformMatrix2fvARB_remap_index },
{ 17, UniformMatrix3fvARB_remap_index },
{ 2475, UniformMatrix4fvARB_remap_index },
- { 22635, UseProgramObjectARB_remap_index },
- { 13106, ValidateProgramARB_remap_index },
- { 18971, BindAttribLocationARB_remap_index },
+ { 22935, UseProgramObjectARB_remap_index },
+ { 13300, ValidateProgramARB_remap_index },
+ { 19245, BindAttribLocationARB_remap_index },
{ 4346, GetActiveAttribARB_remap_index },
- { 14680, GetAttribLocationARB_remap_index },
- { 26237, DrawBuffersARB_remap_index },
- { 11694, RenderbufferStorageMultisample_remap_index },
- { 16938, FlushMappedBufferRange_remap_index },
- { 24801, MapBufferRange_remap_index },
- { 14555, BindVertexArray_remap_index },
- { 12965, GenVertexArrays_remap_index },
- { 27012, CopyBufferSubData_remap_index },
- { 27791, ClientWaitSync_remap_index },
+ { 14874, GetAttribLocationARB_remap_index },
+ { 26600, DrawBuffersARB_remap_index },
+ { 11869, RenderbufferStorageMultisample_remap_index },
+ { 17173, FlushMappedBufferRange_remap_index },
+ { 25135, MapBufferRange_remap_index },
+ { 14749, BindVertexArray_remap_index },
+ { 13159, GenVertexArrays_remap_index },
+ { 27375, CopyBufferSubData_remap_index },
+ { 28190, ClientWaitSync_remap_index },
{ 2394, DeleteSync_remap_index },
{ 6251, FenceSync_remap_index },
- { 13477, GetInteger64v_remap_index },
- { 20070, GetSynciv_remap_index },
- { 26176, IsSync_remap_index },
- { 8358, WaitSync_remap_index },
+ { 13671, GetInteger64v_remap_index },
+ { 20370, GetSynciv_remap_index },
+ { 26539, IsSync_remap_index },
+ { 8412, WaitSync_remap_index },
{ 3363, DrawElementsBaseVertex_remap_index },
- { 27255, DrawRangeElementsBaseVertex_remap_index },
- { 23554, MultiDrawElementsBaseVertex_remap_index },
+ { 27618, DrawRangeElementsBaseVertex_remap_index },
+ { 23856, MultiDrawElementsBaseVertex_remap_index },
{ 4711, PolygonOffsetEXT_remap_index },
- { 20655, GetPixelTexGenParameterfvSGIS_remap_index },
+ { 20955, GetPixelTexGenParameterfvSGIS_remap_index },
{ 3895, GetPixelTexGenParameterivSGIS_remap_index },
- { 20388, PixelTexGenParameterfSGIS_remap_index },
+ { 20688, PixelTexGenParameterfSGIS_remap_index },
{ 580, PixelTexGenParameterfvSGIS_remap_index },
- { 11249, PixelTexGenParameteriSGIS_remap_index },
- { 12242, PixelTexGenParameterivSGIS_remap_index },
- { 14643, SampleMaskSGIS_remap_index },
- { 17603, SamplePatternSGIS_remap_index },
- { 23483, ColorPointerEXT_remap_index },
- { 15558, EdgeFlagPointerEXT_remap_index },
+ { 11424, PixelTexGenParameteriSGIS_remap_index },
+ { 12385, PixelTexGenParameterivSGIS_remap_index },
+ { 14837, SampleMaskSGIS_remap_index },
+ { 17838, SamplePatternSGIS_remap_index },
+ { 23785, ColorPointerEXT_remap_index },
+ { 15752, EdgeFlagPointerEXT_remap_index },
{ 5196, IndexPointerEXT_remap_index },
{ 5276, NormalPointerEXT_remap_index },
- { 14071, TexCoordPointerEXT_remap_index },
+ { 14265, TexCoordPointerEXT_remap_index },
{ 6046, VertexPointerEXT_remap_index },
{ 3165, PointParameterfEXT_remap_index },
{ 6891, PointParameterfvEXT_remap_index },
- { 28667, LockArraysEXT_remap_index },
- { 13170, UnlockArraysEXT_remap_index },
+ { 29027, LockArraysEXT_remap_index },
+ { 13364, UnlockArraysEXT_remap_index },
{ 7898, CullParameterdvEXT_remap_index },
- { 10423, CullParameterfvEXT_remap_index },
+ { 10513, CullParameterfvEXT_remap_index },
{ 1151, SecondaryColor3bEXT_remap_index },
{ 7050, SecondaryColor3bvEXT_remap_index },
- { 9268, SecondaryColor3dEXT_remap_index },
- { 22808, SecondaryColor3dvEXT_remap_index },
- { 25047, SecondaryColor3fEXT_remap_index },
- { 16124, SecondaryColor3fvEXT_remap_index },
+ { 9322, SecondaryColor3dEXT_remap_index },
+ { 23108, SecondaryColor3dvEXT_remap_index },
+ { 25381, SecondaryColor3fEXT_remap_index },
+ { 16318, SecondaryColor3fvEXT_remap_index },
{ 426, SecondaryColor3iEXT_remap_index },
- { 14381, SecondaryColor3ivEXT_remap_index },
- { 8926, SecondaryColor3sEXT_remap_index },
- { 27455, SecondaryColor3svEXT_remap_index },
- { 24220, SecondaryColor3ubEXT_remap_index },
- { 18862, SecondaryColor3ubvEXT_remap_index },
- { 11444, SecondaryColor3uiEXT_remap_index },
- { 20275, SecondaryColor3uivEXT_remap_index },
- { 23020, SecondaryColor3usEXT_remap_index },
- { 11517, SecondaryColor3usvEXT_remap_index },
- { 10499, SecondaryColorPointerEXT_remap_index },
- { 22869, MultiDrawArraysEXT_remap_index },
- { 18552, MultiDrawElementsEXT_remap_index },
- { 18747, FogCoordPointerEXT_remap_index },
+ { 14575, SecondaryColor3ivEXT_remap_index },
+ { 8980, SecondaryColor3sEXT_remap_index },
+ { 27854, SecondaryColor3svEXT_remap_index },
+ { 24554, SecondaryColor3ubEXT_remap_index },
+ { 19136, SecondaryColor3ubvEXT_remap_index },
+ { 11619, SecondaryColor3uiEXT_remap_index },
+ { 20575, SecondaryColor3uivEXT_remap_index },
+ { 23320, SecondaryColor3usEXT_remap_index },
+ { 11692, SecondaryColor3usvEXT_remap_index },
+ { 10589, SecondaryColorPointerEXT_remap_index },
+ { 23169, MultiDrawArraysEXT_remap_index },
+ { 18826, MultiDrawElementsEXT_remap_index },
+ { 19021, FogCoordPointerEXT_remap_index },
{ 4044, FogCoorddEXT_remap_index },
- { 28068, FogCoorddvEXT_remap_index },
+ { 28428, FogCoorddvEXT_remap_index },
{ 4136, FogCoordfEXT_remap_index },
- { 24143, FogCoordfvEXT_remap_index },
- { 16842, PixelTexGenSGIX_remap_index },
- { 24728, BlendFuncSeparateEXT_remap_index },
+ { 24477, FogCoordfvEXT_remap_index },
+ { 17077, PixelTexGenSGIX_remap_index },
+ { 25062, BlendFuncSeparateEXT_remap_index },
{ 5958, FlushVertexArrayRangeNV_remap_index },
{ 4660, VertexArrayRangeNV_remap_index },
- { 25112, CombinerInputNV_remap_index },
+ { 25446, CombinerInputNV_remap_index },
{ 1946, CombinerOutputNV_remap_index },
- { 27608, CombinerParameterfNV_remap_index },
+ { 28007, CombinerParameterfNV_remap_index },
{ 4580, CombinerParameterfvNV_remap_index },
- { 19820, CombinerParameteriNV_remap_index },
- { 29038, CombinerParameterivNV_remap_index },
+ { 20094, CombinerParameteriNV_remap_index },
+ { 29398, CombinerParameterivNV_remap_index },
{ 6328, FinalCombinerInputNV_remap_index },
- { 8755, GetCombinerInputParameterfvNV_remap_index },
- { 28875, GetCombinerInputParameterivNV_remap_index },
+ { 8809, GetCombinerInputParameterfvNV_remap_index },
+ { 29235, GetCombinerInputParameterivNV_remap_index },
{ 6127, GetCombinerOutputParameterfvNV_remap_index },
- { 12171, GetCombinerOutputParameterivNV_remap_index },
+ { 12346, GetCombinerOutputParameterivNV_remap_index },
{ 5703, GetFinalCombinerInputParameterfvNV_remap_index },
- { 22074, GetFinalCombinerInputParameterivNV_remap_index },
- { 11189, ResizeBuffersMESA_remap_index },
- { 9872, WindowPos2dMESA_remap_index },
+ { 22374, GetFinalCombinerInputParameterivNV_remap_index },
+ { 11364, ResizeBuffersMESA_remap_index },
+ { 9962, WindowPos2dMESA_remap_index },
{ 944, WindowPos2dvMESA_remap_index },
- { 29866, WindowPos2fMESA_remap_index },
+ { 30226, WindowPos2fMESA_remap_index },
{ 6995, WindowPos2fvMESA_remap_index },
- { 16071, WindowPos2iMESA_remap_index },
- { 18076, WindowPos2ivMESA_remap_index },
- { 18651, WindowPos2sMESA_remap_index },
+ { 16265, WindowPos2iMESA_remap_index },
+ { 18311, WindowPos2ivMESA_remap_index },
+ { 18925, WindowPos2sMESA_remap_index },
{ 4946, WindowPos2svMESA_remap_index },
{ 6820, WindowPos3dMESA_remap_index },
- { 12450, WindowPos3dvMESA_remap_index },
+ { 12593, WindowPos3dvMESA_remap_index },
{ 472, WindowPos3fMESA_remap_index },
- { 13231, WindowPos3fvMESA_remap_index },
- { 21369, WindowPos3iMESA_remap_index },
- { 26957, WindowPos3ivMESA_remap_index },
- { 16588, WindowPos3sMESA_remap_index },
- { 28324, WindowPos3svMESA_remap_index },
- { 9823, WindowPos4dMESA_remap_index },
- { 15084, WindowPos4dvMESA_remap_index },
- { 12409, WindowPos4fMESA_remap_index },
- { 27362, WindowPos4fvMESA_remap_index },
- { 27110, WindowPos4iMESA_remap_index },
- { 11028, WindowPos4ivMESA_remap_index },
- { 16721, WindowPos4sMESA_remap_index },
+ { 13425, WindowPos3fvMESA_remap_index },
+ { 21669, WindowPos3iMESA_remap_index },
+ { 27320, WindowPos3ivMESA_remap_index },
+ { 16783, WindowPos3sMESA_remap_index },
+ { 28684, WindowPos3svMESA_remap_index },
+ { 9913, WindowPos4dMESA_remap_index },
+ { 15278, WindowPos4dvMESA_remap_index },
+ { 12552, WindowPos4fMESA_remap_index },
+ { 27761, WindowPos4fvMESA_remap_index },
+ { 27473, WindowPos4iMESA_remap_index },
+ { 11203, WindowPos4ivMESA_remap_index },
+ { 16956, WindowPos4sMESA_remap_index },
{ 2857, WindowPos4svMESA_remap_index },
- { 12210, MultiModeDrawArraysIBM_remap_index },
- { 25830, MultiModeDrawElementsIBM_remap_index },
- { 10878, DeleteFencesNV_remap_index },
- { 24959, FinishFenceNV_remap_index },
+ { 24220, MultiModeDrawArraysIBM_remap_index },
+ { 26193, MultiModeDrawElementsIBM_remap_index },
+ { 10968, DeleteFencesNV_remap_index },
+ { 25293, FinishFenceNV_remap_index },
{ 3287, GenFencesNV_remap_index },
- { 15064, GetFenceivNV_remap_index },
+ { 15258, GetFenceivNV_remap_index },
{ 7287, IsFenceNV_remap_index },
- { 12098, SetFenceNV_remap_index },
+ { 12273, SetFenceNV_remap_index },
{ 3744, TestFenceNV_remap_index },
- { 28295, AreProgramsResidentNV_remap_index },
- { 27650, BindProgramNV_remap_index },
- { 23103, DeleteProgramsNV_remap_index },
- { 19080, ExecuteProgramNV_remap_index },
- { 29759, GenProgramsNV_remap_index },
- { 20734, GetProgramParameterdvNV_remap_index },
- { 9330, GetProgramParameterfvNV_remap_index },
- { 23457, GetProgramStringNV_remap_index },
- { 21763, GetProgramivNV_remap_index },
- { 20968, GetTrackMatrixivNV_remap_index },
- { 23253, GetVertexAttribPointervNV_remap_index },
- { 22007, GetVertexAttribdvNV_remap_index },
- { 16561, GetVertexAttribfvNV_remap_index },
- { 16252, GetVertexAttribivNV_remap_index },
- { 16968, IsProgramNV_remap_index },
- { 8336, LoadProgramNV_remap_index },
- { 24824, ProgramParameters4dvNV_remap_index },
- { 21693, ProgramParameters4fvNV_remap_index },
- { 18380, RequestResidentProgramsNV_remap_index },
- { 19798, TrackMatrixNV_remap_index },
- { 28852, VertexAttrib1dNV_remap_index },
- { 12039, VertexAttrib1dvNV_remap_index },
- { 25362, VertexAttrib1fNV_remap_index },
+ { 28655, AreProgramsResidentNV_remap_index },
+ { 28049, BindProgramNV_remap_index },
+ { 23403, DeleteProgramsNV_remap_index },
+ { 19354, ExecuteProgramNV_remap_index },
+ { 30119, GenProgramsNV_remap_index },
+ { 21034, GetProgramParameterdvNV_remap_index },
+ { 9384, GetProgramParameterfvNV_remap_index },
+ { 23759, GetProgramStringNV_remap_index },
+ { 22063, GetProgramivNV_remap_index },
+ { 21268, GetTrackMatrixivNV_remap_index },
+ { 23553, GetVertexAttribPointervNV_remap_index },
+ { 22307, GetVertexAttribdvNV_remap_index },
+ { 8307, GetVertexAttribfvNV_remap_index },
+ { 16446, GetVertexAttribivNV_remap_index },
+ { 17203, IsProgramNV_remap_index },
+ { 8390, LoadProgramNV_remap_index },
+ { 25158, ProgramParameters4dvNV_remap_index },
+ { 21993, ProgramParameters4fvNV_remap_index },
+ { 18615, RequestResidentProgramsNV_remap_index },
+ { 20072, TrackMatrixNV_remap_index },
+ { 29212, VertexAttrib1dNV_remap_index },
+ { 12214, VertexAttrib1dvNV_remap_index },
+ { 25725, VertexAttrib1fNV_remap_index },
{ 2245, VertexAttrib1fvNV_remap_index },
- { 27419, VertexAttrib1sNV_remap_index },
- { 13304, VertexAttrib1svNV_remap_index },
+ { 27818, VertexAttrib1sNV_remap_index },
+ { 13498, VertexAttrib1svNV_remap_index },
{ 4251, VertexAttrib2dNV_remap_index },
- { 11954, VertexAttrib2dvNV_remap_index },
- { 17835, VertexAttrib2fNV_remap_index },
- { 11565, VertexAttrib2fvNV_remap_index },
+ { 12129, VertexAttrib2dvNV_remap_index },
+ { 18070, VertexAttrib2fNV_remap_index },
+ { 11740, VertexAttrib2fvNV_remap_index },
{ 5106, VertexAttrib2sNV_remap_index },
- { 16642, VertexAttrib2svNV_remap_index },
- { 10020, VertexAttrib3dNV_remap_index },
- { 28545, VertexAttrib3dvNV_remap_index },
- { 9142, VertexAttrib3fNV_remap_index },
- { 22034, VertexAttrib3fvNV_remap_index },
- { 25337, VertexAttrib3sNV_remap_index },
- { 20995, VertexAttrib3svNV_remap_index },
- { 25804, VertexAttrib4dNV_remap_index },
- { 29796, VertexAttrib4dvNV_remap_index },
+ { 16837, VertexAttrib2svNV_remap_index },
+ { 10110, VertexAttrib3dNV_remap_index },
+ { 28905, VertexAttrib3dvNV_remap_index },
+ { 9196, VertexAttrib3fNV_remap_index },
+ { 22334, VertexAttrib3fvNV_remap_index },
+ { 25700, VertexAttrib3sNV_remap_index },
+ { 21295, VertexAttrib3svNV_remap_index },
+ { 26167, VertexAttrib4dNV_remap_index },
+ { 30156, VertexAttrib4dvNV_remap_index },
{ 3945, VertexAttrib4fNV_remap_index },
- { 8386, VertexAttrib4fvNV_remap_index },
- { 23802, VertexAttrib4sNV_remap_index },
+ { 8440, VertexAttrib4fvNV_remap_index },
+ { 24104, VertexAttrib4sNV_remap_index },
{ 1293, VertexAttrib4svNV_remap_index },
{ 4409, VertexAttrib4ubNV_remap_index },
{ 734, VertexAttrib4ubvNV_remap_index },
- { 19260, VertexAttribPointerNV_remap_index },
+ { 19534, VertexAttribPointerNV_remap_index },
{ 2097, VertexAttribs1dvNV_remap_index },
- { 16666, VertexAttribs1fvNV_remap_index },
- { 29596, VertexAttribs1svNV_remap_index },
- { 9167, VertexAttribs2dvNV_remap_index },
- { 22596, VertexAttribs2fvNV_remap_index },
- { 15584, VertexAttribs2svNV_remap_index },
+ { 23641, VertexAttribs1fvNV_remap_index },
+ { 29956, VertexAttribs1svNV_remap_index },
+ { 9221, VertexAttribs2dvNV_remap_index },
+ { 22896, VertexAttribs2fvNV_remap_index },
+ { 15778, VertexAttribs2svNV_remap_index },
{ 4608, VertexAttribs3dvNV_remap_index },
{ 1977, VertexAttribs3fvNV_remap_index },
- { 26705, VertexAttribs3svNV_remap_index },
- { 23892, VertexAttribs4dvNV_remap_index },
+ { 27068, VertexAttribs3svNV_remap_index },
+ { 24194, VertexAttribs4dvNV_remap_index },
{ 4634, VertexAttribs4fvNV_remap_index },
- { 29383, VertexAttribs4svNV_remap_index },
- { 26453, VertexAttribs4ubvNV_remap_index },
- { 23962, GetTexBumpParameterfvATI_remap_index },
- { 29637, GetTexBumpParameterivATI_remap_index },
- { 16306, TexBumpParameterfvATI_remap_index },
- { 18251, TexBumpParameterivATI_remap_index },
- { 13850, AlphaFragmentOp1ATI_remap_index },
- { 9682, AlphaFragmentOp2ATI_remap_index },
- { 21950, AlphaFragmentOp3ATI_remap_index },
- { 26632, BeginFragmentShaderATI_remap_index },
- { 27849, BindFragmentShaderATI_remap_index },
- { 21124, ColorFragmentOp1ATI_remap_index },
+ { 29743, VertexAttribs4svNV_remap_index },
+ { 26816, VertexAttribs4ubvNV_remap_index },
+ { 24296, GetTexBumpParameterfvATI_remap_index },
+ { 29997, GetTexBumpParameterivATI_remap_index },
+ { 16500, TexBumpParameterfvATI_remap_index },
+ { 18486, TexBumpParameterivATI_remap_index },
+ { 14044, AlphaFragmentOp1ATI_remap_index },
+ { 9772, AlphaFragmentOp2ATI_remap_index },
+ { 22250, AlphaFragmentOp3ATI_remap_index },
+ { 26995, BeginFragmentShaderATI_remap_index },
+ { 28248, BindFragmentShaderATI_remap_index },
+ { 21424, ColorFragmentOp1ATI_remap_index },
{ 3823, ColorFragmentOp2ATI_remap_index },
- { 28190, ColorFragmentOp3ATI_remap_index },
+ { 28550, ColorFragmentOp3ATI_remap_index },
{ 4753, DeleteFragmentShaderATI_remap_index },
- { 29820, EndFragmentShaderATI_remap_index },
- { 29066, GenFragmentShadersATI_remap_index },
- { 22727, PassTexCoordATI_remap_index },
+ { 30180, EndFragmentShaderATI_remap_index },
+ { 29426, GenFragmentShadersATI_remap_index },
+ { 23027, PassTexCoordATI_remap_index },
{ 6026, SampleMapATI_remap_index },
{ 5799, SetFragmentShaderConstantATI_remap_index },
{ 319, PointParameteriNV_remap_index },
- { 12611, PointParameterivNV_remap_index },
- { 25643, ActiveStencilFaceEXT_remap_index },
- { 24484, BindVertexArrayAPPLE_remap_index },
+ { 12754, PointParameterivNV_remap_index },
+ { 26006, ActiveStencilFaceEXT_remap_index },
+ { 24818, BindVertexArrayAPPLE_remap_index },
{ 2522, DeleteVertexArraysAPPLE_remap_index },
- { 15923, GenVertexArraysAPPLE_remap_index },
- { 20799, IsVertexArrayAPPLE_remap_index },
+ { 16117, GenVertexArraysAPPLE_remap_index },
+ { 21099, IsVertexArrayAPPLE_remap_index },
{ 775, GetProgramNamedParameterdvNV_remap_index },
{ 3128, GetProgramNamedParameterfvNV_remap_index },
- { 23993, ProgramNamedParameter4dNV_remap_index },
- { 12886, ProgramNamedParameter4dvNV_remap_index },
+ { 24327, ProgramNamedParameter4dNV_remap_index },
+ { 13080, ProgramNamedParameter4dvNV_remap_index },
{ 7923, ProgramNamedParameter4fNV_remap_index },
- { 10464, ProgramNamedParameter4fvNV_remap_index },
- { 21672, DepthBoundsEXT_remap_index },
+ { 10554, ProgramNamedParameter4fvNV_remap_index },
+ { 21972, DepthBoundsEXT_remap_index },
{ 1043, BlendEquationSeparateEXT_remap_index },
- { 13005, BindFramebufferEXT_remap_index },
- { 22914, BindRenderbufferEXT_remap_index },
- { 8605, CheckFramebufferStatusEXT_remap_index },
- { 20089, DeleteFramebuffersEXT_remap_index },
- { 28447, DeleteRenderbuffersEXT_remap_index },
- { 11978, FramebufferRenderbufferEXT_remap_index },
- { 12115, FramebufferTexture1DEXT_remap_index },
- { 10258, FramebufferTexture2DEXT_remap_index },
- { 9925, FramebufferTexture3DEXT_remap_index },
- { 20691, GenFramebuffersEXT_remap_index },
- { 15470, GenRenderbuffersEXT_remap_index },
+ { 13199, BindFramebufferEXT_remap_index },
+ { 23214, BindRenderbufferEXT_remap_index },
+ { 8659, CheckFramebufferStatusEXT_remap_index },
+ { 20389, DeleteFramebuffersEXT_remap_index },
+ { 28807, DeleteRenderbuffersEXT_remap_index },
+ { 12153, FramebufferRenderbufferEXT_remap_index },
+ { 12290, FramebufferTexture1DEXT_remap_index },
+ { 10348, FramebufferTexture2DEXT_remap_index },
+ { 10015, FramebufferTexture3DEXT_remap_index },
+ { 20991, GenFramebuffersEXT_remap_index },
+ { 15664, GenRenderbuffersEXT_remap_index },
{ 5745, GenerateMipmapEXT_remap_index },
- { 19320, GetFramebufferAttachmentParameterivEXT_remap_index },
- { 28972, GetRenderbufferParameterivEXT_remap_index },
- { 18131, IsFramebufferEXT_remap_index },
- { 29719, IsRenderbufferEXT_remap_index },
+ { 19594, GetFramebufferAttachmentParameterivEXT_remap_index },
+ { 29332, GetRenderbufferParameterivEXT_remap_index },
+ { 18366, IsFramebufferEXT_remap_index },
+ { 30079, IsRenderbufferEXT_remap_index },
{ 7234, RenderbufferStorageEXT_remap_index },
{ 651, BlitFramebufferEXT_remap_index },
- { 12705, BufferParameteriAPPLE_remap_index },
- { 17000, FlushMappedBufferRangeAPPLE_remap_index },
+ { 12899, BufferParameteriAPPLE_remap_index },
+ { 17235, FlushMappedBufferRangeAPPLE_remap_index },
{ 2701, FramebufferTextureLayerEXT_remap_index },
- { 8307, ColorMaskIndexedEXT_remap_index },
- { 23341, DisableIndexedEXT_remap_index },
- { 23649, EnableIndexedEXT_remap_index },
- { 19291, GetBooleanIndexedvEXT_remap_index },
- { 9715, GetIntegerIndexedvEXT_remap_index },
- { 20165, IsEnabledIndexedEXT_remap_index },
+ { 25515, ColorMaskIndexedEXT_remap_index },
+ { 16861, DisableIndexedEXT_remap_index },
+ { 23951, EnableIndexedEXT_remap_index },
+ { 19565, GetBooleanIndexedvEXT_remap_index },
+ { 9805, GetIntegerIndexedvEXT_remap_index },
+ { 20465, IsEnabledIndexedEXT_remap_index },
{ 4074, BeginConditionalRenderNV_remap_index },
- { 22700, EndConditionalRenderNV_remap_index },
- { 26354, ProvokingVertexEXT_remap_index },
- { 9551, GetTexParameterPointervAPPLE_remap_index },
+ { 23000, EndConditionalRenderNV_remap_index },
+ { 8334, BeginTransformFeedbackEXT_remap_index },
+ { 16885, BindBufferBaseEXT_remap_index },
+ { 16755, BindBufferOffsetEXT_remap_index },
+ { 11028, BindBufferRangeEXT_remap_index },
+ { 12814, EndTransformFeedbackEXT_remap_index },
+ { 9657, GetTransformFeedbackVaryingEXT_remap_index },
+ { 18671, TransformFeedbackVaryingsEXT_remap_index },
+ { 26717, ProvokingVertexEXT_remap_index },
+ { 9605, GetTexParameterPointervAPPLE_remap_index },
{ 4436, TextureRangeAPPLE_remap_index },
- { 10330, GetObjectParameterivAPPLE_remap_index },
- { 17575, ObjectPurgeableAPPLE_remap_index },
+ { 10420, GetObjectParameterivAPPLE_remap_index },
+ { 17810, ObjectPurgeableAPPLE_remap_index },
{ 4900, ObjectUnpurgeableAPPLE_remap_index },
- { 25669, StencilFuncSeparateATI_remap_index },
- { 15990, ProgramEnvParameters4fvEXT_remap_index },
- { 15208, ProgramLocalParameters4fvEXT_remap_index },
- { 12539, GetQueryObjecti64vEXT_remap_index },
- { 9193, GetQueryObjectui64vEXT_remap_index },
- { 21193, EGLImageTargetRenderbufferStorageOES_remap_index },
- { 10817, EGLImageTargetTexture2DOES_remap_index },
+ { 26032, StencilFuncSeparateATI_remap_index },
+ { 16184, ProgramEnvParameters4fvEXT_remap_index },
+ { 15402, ProgramLocalParameters4fvEXT_remap_index },
+ { 12682, GetQueryObjecti64vEXT_remap_index },
+ { 9247, GetQueryObjectui64vEXT_remap_index },
+ { 21493, EGLImageTargetRenderbufferStorageOES_remap_index },
+ { 10907, EGLImageTargetTexture2DOES_remap_index },
{ -1, -1 }
};
@@ -4793,10 +4834,10 @@ static const struct gl_function_remap MESA_alt_functions[] = {
/* from GL_EXT_blend_color */
{ 2440, _gloffset_BlendColor },
/* from GL_EXT_blend_minmax */
- { 9982, _gloffset_BlendEquation },
+ { 10072, _gloffset_BlendEquation },
/* from GL_EXT_color_subtable */
- { 15106, _gloffset_ColorSubTable },
- { 28379, _gloffset_CopyColorSubTable },
+ { 15300, _gloffset_ColorSubTable },
+ { 28739, _gloffset_CopyColorSubTable },
/* from GL_EXT_convolution */
{ 213, _gloffset_ConvolutionFilter1D },
{ 2284, _gloffset_CopyConvolutionFilter1D },
@@ -4804,62 +4845,62 @@ static const struct gl_function_remap MESA_alt_functions[] = {
{ 7583, _gloffset_ConvolutionFilter2D },
{ 7749, _gloffset_ConvolutionParameteriv },
{ 8209, _gloffset_ConvolutionParameterfv },
- { 18279, _gloffset_GetSeparableFilter },
- { 21423, _gloffset_SeparableFilter2D },
- { 22252, _gloffset_ConvolutionParameteri },
- { 22375, _gloffset_ConvolutionParameterf },
- { 23828, _gloffset_GetConvolutionParameterfv },
- { 24650, _gloffset_GetConvolutionFilter },
- { 26894, _gloffset_CopyConvolutionFilter2D },
+ { 18514, _gloffset_GetSeparableFilter },
+ { 21723, _gloffset_SeparableFilter2D },
+ { 22552, _gloffset_ConvolutionParameteri },
+ { 22675, _gloffset_ConvolutionParameterf },
+ { 24130, _gloffset_GetConvolutionParameterfv },
+ { 24984, _gloffset_GetConvolutionFilter },
+ { 27257, _gloffset_CopyConvolutionFilter2D },
/* from GL_EXT_copy_texture */
- { 13364, _gloffset_CopyTexSubImage3D },
- { 14846, _gloffset_CopyTexImage2D },
- { 21860, _gloffset_CopyTexImage1D },
- { 24331, _gloffset_CopyTexSubImage2D },
- { 26532, _gloffset_CopyTexSubImage1D },
+ { 13558, _gloffset_CopyTexSubImage3D },
+ { 15040, _gloffset_CopyTexImage2D },
+ { 22160, _gloffset_CopyTexImage1D },
+ { 24665, _gloffset_CopyTexSubImage2D },
+ { 26895, _gloffset_CopyTexSubImage1D },
/* from GL_EXT_draw_range_elements */
- { 8492, _gloffset_DrawRangeElements },
+ { 8546, _gloffset_DrawRangeElements },
/* from GL_EXT_histogram */
{ 812, _gloffset_Histogram },
{ 3088, _gloffset_ResetHistogram },
- { 8864, _gloffset_GetMinmax },
- { 13698, _gloffset_GetHistogramParameterfv },
- { 21785, _gloffset_GetMinmaxParameteriv },
- { 23718, _gloffset_ResetMinmax },
- { 24547, _gloffset_GetHistogramParameteriv },
- { 25603, _gloffset_GetHistogram },
- { 27965, _gloffset_Minmax },
- { 29466, _gloffset_GetMinmaxParameterfv },
+ { 8918, _gloffset_GetMinmax },
+ { 13892, _gloffset_GetHistogramParameterfv },
+ { 22085, _gloffset_GetMinmaxParameteriv },
+ { 24020, _gloffset_ResetMinmax },
+ { 24881, _gloffset_GetHistogramParameteriv },
+ { 25966, _gloffset_GetHistogram },
+ { 28364, _gloffset_Minmax },
+ { 29826, _gloffset_GetMinmaxParameterfv },
/* from GL_EXT_paletted_texture */
{ 7445, _gloffset_ColorTable },
- { 13544, _gloffset_GetColorTable },
- { 20438, _gloffset_GetColorTableParameterfv },
- { 22431, _gloffset_GetColorTableParameteriv },
+ { 13738, _gloffset_GetColorTable },
+ { 20738, _gloffset_GetColorTableParameterfv },
+ { 22731, _gloffset_GetColorTableParameteriv },
/* from GL_EXT_subtexture */
{ 6166, _gloffset_TexSubImage1D },
- { 9478, _gloffset_TexSubImage2D },
+ { 9532, _gloffset_TexSubImage2D },
/* from GL_EXT_texture3D */
{ 1658, _gloffset_TexImage3D },
- { 20207, _gloffset_TexSubImage3D },
+ { 20507, _gloffset_TexSubImage3D },
/* from GL_EXT_texture_object */
{ 2964, _gloffset_PrioritizeTextures },
{ 6615, _gloffset_AreTexturesResident },
- { 12063, _gloffset_GenTextures },
- { 14030, _gloffset_DeleteTextures },
- { 17281, _gloffset_IsTexture },
- { 26597, _gloffset_BindTexture },
+ { 12238, _gloffset_GenTextures },
+ { 14224, _gloffset_DeleteTextures },
+ { 17516, _gloffset_IsTexture },
+ { 26960, _gloffset_BindTexture },
/* from GL_EXT_vertex_array */
- { 21612, _gloffset_ArrayElement },
- { 27553, _gloffset_GetPointerv },
- { 29093, _gloffset_DrawArrays },
+ { 21912, _gloffset_ArrayElement },
+ { 27952, _gloffset_GetPointerv },
+ { 29453, _gloffset_DrawArrays },
/* from GL_SGI_color_table */
{ 6733, _gloffset_ColorTableParameteriv },
{ 7445, _gloffset_ColorTable },
- { 13544, _gloffset_GetColorTable },
- { 13654, _gloffset_CopyColorTable },
- { 17142, _gloffset_ColorTableParameterfv },
- { 20438, _gloffset_GetColorTableParameterfv },
- { 22431, _gloffset_GetColorTableParameteriv },
+ { 13738, _gloffset_GetColorTable },
+ { 13848, _gloffset_CopyColorTable },
+ { 17377, _gloffset_ColorTableParameterfv },
+ { 20738, _gloffset_GetColorTableParameterfv },
+ { 22731, _gloffset_GetColorTableParameteriv },
/* from GL_VERSION_1_3 */
{ 381, _gloffset_MultiTexCoord3sARB },
{ 613, _gloffset_ActiveTextureARB },
@@ -4868,33 +4909,33 @@ static const struct gl_function_remap MESA_alt_functions[] = {
{ 5346, _gloffset_MultiTexCoord2iARB },
{ 5470, _gloffset_MultiTexCoord2svARB },
{ 7401, _gloffset_MultiTexCoord2fARB },
- { 9223, _gloffset_MultiTexCoord3fvARB },
- { 9744, _gloffset_MultiTexCoord4sARB },
- { 10378, _gloffset_MultiTexCoord2dvARB },
- { 10760, _gloffset_MultiTexCoord1svARB },
- { 11050, _gloffset_MultiTexCoord3svARB },
- { 11111, _gloffset_MultiTexCoord4iARB },
- { 11834, _gloffset_MultiTexCoord3iARB },
- { 12568, _gloffset_MultiTexCoord1dARB },
- { 12734, _gloffset_MultiTexCoord3dvARB },
- { 13898, _gloffset_MultiTexCoord3ivARB },
- { 13943, _gloffset_MultiTexCoord2sARB },
- { 15163, _gloffset_MultiTexCoord4ivARB },
- { 16792, _gloffset_ClientActiveTextureARB },
- { 19036, _gloffset_MultiTexCoord2dARB },
- { 19440, _gloffset_MultiTexCoord4dvARB },
- { 19726, _gloffset_MultiTexCoord4fvARB },
- { 20579, _gloffset_MultiTexCoord3fARB },
- { 22959, _gloffset_MultiTexCoord4dARB },
- { 23163, _gloffset_MultiTexCoord1sARB },
- { 23365, _gloffset_MultiTexCoord1dvARB },
- { 24175, _gloffset_MultiTexCoord1ivARB },
- { 24268, _gloffset_MultiTexCoord2ivARB },
- { 24607, _gloffset_MultiTexCoord1iARB },
- { 25878, _gloffset_MultiTexCoord4svARB },
- { 26396, _gloffset_MultiTexCoord1fARB },
- { 26659, _gloffset_MultiTexCoord4fARB },
- { 28927, _gloffset_MultiTexCoord2fvARB },
+ { 9277, _gloffset_MultiTexCoord3fvARB },
+ { 9834, _gloffset_MultiTexCoord4sARB },
+ { 10468, _gloffset_MultiTexCoord2dvARB },
+ { 10850, _gloffset_MultiTexCoord1svARB },
+ { 11225, _gloffset_MultiTexCoord3svARB },
+ { 11286, _gloffset_MultiTexCoord4iARB },
+ { 12009, _gloffset_MultiTexCoord3iARB },
+ { 12711, _gloffset_MultiTexCoord1dARB },
+ { 12928, _gloffset_MultiTexCoord3dvARB },
+ { 14092, _gloffset_MultiTexCoord3ivARB },
+ { 14137, _gloffset_MultiTexCoord2sARB },
+ { 15357, _gloffset_MultiTexCoord4ivARB },
+ { 17027, _gloffset_ClientActiveTextureARB },
+ { 19310, _gloffset_MultiTexCoord2dARB },
+ { 19714, _gloffset_MultiTexCoord4dvARB },
+ { 20000, _gloffset_MultiTexCoord4fvARB },
+ { 20879, _gloffset_MultiTexCoord3fARB },
+ { 23259, _gloffset_MultiTexCoord4dARB },
+ { 23463, _gloffset_MultiTexCoord1sARB },
+ { 23667, _gloffset_MultiTexCoord1dvARB },
+ { 24509, _gloffset_MultiTexCoord1ivARB },
+ { 24602, _gloffset_MultiTexCoord2ivARB },
+ { 24941, _gloffset_MultiTexCoord1iARB },
+ { 26241, _gloffset_MultiTexCoord4svARB },
+ { 26759, _gloffset_MultiTexCoord1fARB },
+ { 27022, _gloffset_MultiTexCoord4fARB },
+ { 29287, _gloffset_MultiTexCoord2fvARB },
{ -1, -1 }
};
@@ -4973,10 +5014,10 @@ static const struct gl_function_remap GL_ARB_map_buffer_range_functions[] = {
#if defined(need_GL_ARB_matrix_palette)
static const struct gl_function_remap GL_ARB_matrix_palette_functions[] = {
{ 3339, -1 }, /* MatrixIndexusvARB */
- { 11655, -1 }, /* MatrixIndexuivARB */
- { 12856, -1 }, /* MatrixIndexPointerARB */
- { 17530, -1 }, /* CurrentPaletteMatrixARB */
- { 20323, -1 }, /* MatrixIndexubvARB */
+ { 11830, -1 }, /* MatrixIndexuivARB */
+ { 13050, -1 }, /* MatrixIndexPointerARB */
+ { 17765, -1 }, /* CurrentPaletteMatrixARB */
+ { 20623, -1 }, /* MatrixIndexubvARB */
{ -1, -1 }
};
#endif
@@ -5048,14 +5089,14 @@ static const struct gl_function_remap GL_ARB_vertex_array_object_functions[] = {
static const struct gl_function_remap GL_ARB_vertex_blend_functions[] = {
{ 2226, -1 }, /* WeightubvARB */
{ 5633, -1 }, /* WeightivARB */
- { 9847, -1 }, /* WeightPointerARB */
- { 12325, -1 }, /* WeightfvARB */
- { 15610, -1 }, /* WeightbvARB */
- { 18704, -1 }, /* WeightusvARB */
- { 21349, -1 }, /* VertexBlendARB */
- { 26480, -1 }, /* WeightsvARB */
- { 28429, -1 }, /* WeightdvARB */
- { 29127, -1 }, /* WeightuivARB */
+ { 9937, -1 }, /* WeightPointerARB */
+ { 12468, -1 }, /* WeightfvARB */
+ { 15804, -1 }, /* WeightbvARB */
+ { 18978, -1 }, /* WeightusvARB */
+ { 21649, -1 }, /* VertexBlendARB */
+ { 26843, -1 }, /* WeightsvARB */
+ { 28789, -1 }, /* WeightdvARB */
+ { 29487, -1 }, /* WeightuivARB */
{ -1, -1 }
};
#endif
@@ -5146,15 +5187,15 @@ static const struct gl_function_remap GL_EXT_blend_func_separate_functions[] = {
#if defined(need_GL_EXT_blend_minmax)
static const struct gl_function_remap GL_EXT_blend_minmax_functions[] = {
- { 9982, _gloffset_BlendEquation },
+ { 10072, _gloffset_BlendEquation },
{ -1, -1 }
};
#endif
#if defined(need_GL_EXT_color_subtable)
static const struct gl_function_remap GL_EXT_color_subtable_functions[] = {
- { 15106, _gloffset_ColorSubTable },
- { 28379, _gloffset_CopyColorSubTable },
+ { 15300, _gloffset_ColorSubTable },
+ { 28739, _gloffset_CopyColorSubTable },
{ -1, -1 }
};
#endif
@@ -5174,52 +5215,52 @@ static const struct gl_function_remap GL_EXT_convolution_functions[] = {
{ 7583, _gloffset_ConvolutionFilter2D },
{ 7749, _gloffset_ConvolutionParameteriv },
{ 8209, _gloffset_ConvolutionParameterfv },
- { 18279, _gloffset_GetSeparableFilter },
- { 21423, _gloffset_SeparableFilter2D },
- { 22252, _gloffset_ConvolutionParameteri },
- { 22375, _gloffset_ConvolutionParameterf },
- { 23828, _gloffset_GetConvolutionParameterfv },
- { 24650, _gloffset_GetConvolutionFilter },
- { 26894, _gloffset_CopyConvolutionFilter2D },
+ { 18514, _gloffset_GetSeparableFilter },
+ { 21723, _gloffset_SeparableFilter2D },
+ { 22552, _gloffset_ConvolutionParameteri },
+ { 22675, _gloffset_ConvolutionParameterf },
+ { 24130, _gloffset_GetConvolutionParameterfv },
+ { 24984, _gloffset_GetConvolutionFilter },
+ { 27257, _gloffset_CopyConvolutionFilter2D },
{ -1, -1 }
};
#endif
#if defined(need_GL_EXT_coordinate_frame)
static const struct gl_function_remap GL_EXT_coordinate_frame_functions[] = {
- { 9362, -1 }, /* TangentPointerEXT */
- { 11169, -1 }, /* Binormal3ivEXT */
- { 11787, -1 }, /* Tangent3sEXT */
- { 12921, -1 }, /* Tangent3fvEXT */
- { 16542, -1 }, /* Tangent3dvEXT */
- { 17228, -1 }, /* Binormal3bvEXT */
- { 18332, -1 }, /* Binormal3dEXT */
- { 20255, -1 }, /* Tangent3fEXT */
- { 22324, -1 }, /* Binormal3sEXT */
- { 22769, -1 }, /* Tangent3ivEXT */
- { 22788, -1 }, /* Tangent3dEXT */
- { 23592, -1 }, /* Binormal3svEXT */
- { 24073, -1 }, /* Binormal3fEXT */
- { 24925, -1 }, /* Binormal3dvEXT */
- { 26100, -1 }, /* Tangent3iEXT */
- { 27179, -1 }, /* Tangent3bvEXT */
- { 27588, -1 }, /* Tangent3bEXT */
- { 28152, -1 }, /* Binormal3fvEXT */
- { 28826, -1 }, /* BinormalPointerEXT */
- { 29231, -1 }, /* Tangent3svEXT */
- { 29668, -1 }, /* Binormal3bEXT */
- { 29845, -1 }, /* Binormal3iEXT */
+ { 9416, -1 }, /* TangentPointerEXT */
+ { 11344, -1 }, /* Binormal3ivEXT */
+ { 11962, -1 }, /* Tangent3sEXT */
+ { 13115, -1 }, /* Tangent3fvEXT */
+ { 16736, -1 }, /* Tangent3dvEXT */
+ { 17463, -1 }, /* Binormal3bvEXT */
+ { 18567, -1 }, /* Binormal3dEXT */
+ { 20555, -1 }, /* Tangent3fEXT */
+ { 22624, -1 }, /* Binormal3sEXT */
+ { 23069, -1 }, /* Tangent3ivEXT */
+ { 23088, -1 }, /* Tangent3dEXT */
+ { 23894, -1 }, /* Binormal3svEXT */
+ { 24407, -1 }, /* Binormal3fEXT */
+ { 25259, -1 }, /* Binormal3dvEXT */
+ { 26463, -1 }, /* Tangent3iEXT */
+ { 27542, -1 }, /* Tangent3bvEXT */
+ { 27987, -1 }, /* Tangent3bEXT */
+ { 28512, -1 }, /* Binormal3fvEXT */
+ { 29186, -1 }, /* BinormalPointerEXT */
+ { 29591, -1 }, /* Tangent3svEXT */
+ { 30028, -1 }, /* Binormal3bEXT */
+ { 30205, -1 }, /* Binormal3iEXT */
{ -1, -1 }
};
#endif
#if defined(need_GL_EXT_copy_texture)
static const struct gl_function_remap GL_EXT_copy_texture_functions[] = {
- { 13364, _gloffset_CopyTexSubImage3D },
- { 14846, _gloffset_CopyTexImage2D },
- { 21860, _gloffset_CopyTexImage1D },
- { 24331, _gloffset_CopyTexSubImage2D },
- { 26532, _gloffset_CopyTexSubImage1D },
+ { 13558, _gloffset_CopyTexSubImage3D },
+ { 15040, _gloffset_CopyTexImage2D },
+ { 22160, _gloffset_CopyTexImage1D },
+ { 24665, _gloffset_CopyTexSubImage2D },
+ { 26895, _gloffset_CopyTexSubImage1D },
{ -1, -1 }
};
#endif
@@ -5247,7 +5288,7 @@ static const struct gl_function_remap GL_EXT_draw_buffers2_functions[] = {
#if defined(need_GL_EXT_draw_range_elements)
static const struct gl_function_remap GL_EXT_draw_range_elements_functions[] = {
- { 8492, _gloffset_DrawRangeElements },
+ { 8546, _gloffset_DrawRangeElements },
{ -1, -1 }
};
#endif
@@ -5291,37 +5332,37 @@ static const struct gl_function_remap GL_EXT_gpu_program_parameters_functions[]
static const struct gl_function_remap GL_EXT_histogram_functions[] = {
{ 812, _gloffset_Histogram },
{ 3088, _gloffset_ResetHistogram },
- { 8864, _gloffset_GetMinmax },
- { 13698, _gloffset_GetHistogramParameterfv },
- { 21785, _gloffset_GetMinmaxParameteriv },
- { 23718, _gloffset_ResetMinmax },
- { 24547, _gloffset_GetHistogramParameteriv },
- { 25603, _gloffset_GetHistogram },
- { 27965, _gloffset_Minmax },
- { 29466, _gloffset_GetMinmaxParameterfv },
+ { 8918, _gloffset_GetMinmax },
+ { 13892, _gloffset_GetHistogramParameterfv },
+ { 22085, _gloffset_GetMinmaxParameteriv },
+ { 24020, _gloffset_ResetMinmax },
+ { 24881, _gloffset_GetHistogramParameteriv },
+ { 25966, _gloffset_GetHistogram },
+ { 28364, _gloffset_Minmax },
+ { 29826, _gloffset_GetMinmaxParameterfv },
{ -1, -1 }
};
#endif
#if defined(need_GL_EXT_index_func)
static const struct gl_function_remap GL_EXT_index_func_functions[] = {
- { 10209, -1 }, /* IndexFuncEXT */
+ { 10299, -1 }, /* IndexFuncEXT */
{ -1, -1 }
};
#endif
#if defined(need_GL_EXT_index_material)
static const struct gl_function_remap GL_EXT_index_material_functions[] = {
- { 18791, -1 }, /* IndexMaterialEXT */
+ { 19065, -1 }, /* IndexMaterialEXT */
{ -1, -1 }
};
#endif
#if defined(need_GL_EXT_light_texture)
static const struct gl_function_remap GL_EXT_light_texture_functions[] = {
- { 23612, -1 }, /* ApplyTextureEXT */
- { 23672, -1 }, /* TextureMaterialEXT */
- { 23697, -1 }, /* TextureLightEXT */
+ { 23914, -1 }, /* ApplyTextureEXT */
+ { 23974, -1 }, /* TextureMaterialEXT */
+ { 23999, -1 }, /* TextureLightEXT */
{ -1, -1 }
};
#endif
@@ -5343,19 +5384,19 @@ static const struct gl_function_remap GL_EXT_multisample_functions[] = {
#if defined(need_GL_EXT_paletted_texture)
static const struct gl_function_remap GL_EXT_paletted_texture_functions[] = {
{ 7445, _gloffset_ColorTable },
- { 13544, _gloffset_GetColorTable },
- { 20438, _gloffset_GetColorTableParameterfv },
- { 22431, _gloffset_GetColorTableParameteriv },
+ { 13738, _gloffset_GetColorTable },
+ { 20738, _gloffset_GetColorTableParameterfv },
+ { 22731, _gloffset_GetColorTableParameteriv },
{ -1, -1 }
};
#endif
#if defined(need_GL_EXT_pixel_transform)
static const struct gl_function_remap GL_EXT_pixel_transform_functions[] = {
- { 9603, -1 }, /* PixelTransformParameterfvEXT */
- { 19405, -1 }, /* PixelTransformParameterfEXT */
- { 19485, -1 }, /* PixelTransformParameteriEXT */
- { 28790, -1 }, /* PixelTransformParameterivEXT */
+ { 19679, -1 }, /* PixelTransformParameterfEXT */
+ { 19759, -1 }, /* PixelTransformParameteriEXT */
+ { 27725, -1 }, /* PixelTransformParameterfvEXT */
+ { 29150, -1 }, /* PixelTransformParameterivEXT */
{ -1, -1 }
};
#endif
@@ -5398,7 +5439,7 @@ static const struct gl_function_remap GL_EXT_stencil_two_side_functions[] = {
#if defined(need_GL_EXT_subtexture)
static const struct gl_function_remap GL_EXT_subtexture_functions[] = {
{ 6166, _gloffset_TexSubImage1D },
- { 9478, _gloffset_TexSubImage2D },
+ { 9532, _gloffset_TexSubImage2D },
{ -1, -1 }
};
#endif
@@ -5406,7 +5447,7 @@ static const struct gl_function_remap GL_EXT_subtexture_functions[] = {
#if defined(need_GL_EXT_texture3D)
static const struct gl_function_remap GL_EXT_texture3D_functions[] = {
{ 1658, _gloffset_TexImage3D },
- { 20207, _gloffset_TexSubImage3D },
+ { 20507, _gloffset_TexSubImage3D },
{ -1, -1 }
};
#endif
@@ -5422,17 +5463,17 @@ static const struct gl_function_remap GL_EXT_texture_array_functions[] = {
static const struct gl_function_remap GL_EXT_texture_object_functions[] = {
{ 2964, _gloffset_PrioritizeTextures },
{ 6615, _gloffset_AreTexturesResident },
- { 12063, _gloffset_GenTextures },
- { 14030, _gloffset_DeleteTextures },
- { 17281, _gloffset_IsTexture },
- { 26597, _gloffset_BindTexture },
+ { 12238, _gloffset_GenTextures },
+ { 14224, _gloffset_DeleteTextures },
+ { 17516, _gloffset_IsTexture },
+ { 26960, _gloffset_BindTexture },
{ -1, -1 }
};
#endif
#if defined(need_GL_EXT_texture_perturb_normal)
static const struct gl_function_remap GL_EXT_texture_perturb_normal_functions[] = {
- { 12275, -1 }, /* TextureNormalEXT */
+ { 12418, -1 }, /* TextureNormalEXT */
{ -1, -1 }
};
#endif
@@ -5444,21 +5485,28 @@ static const struct gl_function_remap GL_EXT_timer_query_functions[] = {
};
#endif
+#if defined(need_GL_EXT_transform_feedback)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_EXT_transform_feedback_functions[] = {
+ { -1, -1 }
+};
+#endif
+
#if defined(need_GL_EXT_vertex_array)
/* functions defined in MESA_remap_table_functions are excluded */
static const struct gl_function_remap GL_EXT_vertex_array_functions[] = {
- { 21612, _gloffset_ArrayElement },
- { 27553, _gloffset_GetPointerv },
- { 29093, _gloffset_DrawArrays },
+ { 21912, _gloffset_ArrayElement },
+ { 27952, _gloffset_GetPointerv },
+ { 29453, _gloffset_DrawArrays },
{ -1, -1 }
};
#endif
#if defined(need_GL_EXT_vertex_weighting)
static const struct gl_function_remap GL_EXT_vertex_weighting_functions[] = {
- { 17311, -1 }, /* VertexWeightfvEXT */
- { 24051, -1 }, /* VertexWeightfEXT */
- { 25572, -1 }, /* VertexWeightPointerEXT */
+ { 17546, -1 }, /* VertexWeightfvEXT */
+ { 24385, -1 }, /* VertexWeightfEXT */
+ { 25935, -1 }, /* VertexWeightPointerEXT */
{ -1, -1 }
};
#endif
@@ -5467,10 +5515,10 @@ static const struct gl_function_remap GL_EXT_vertex_weighting_functions[] = {
static const struct gl_function_remap GL_HP_image_transform_functions[] = {
{ 2157, -1 }, /* GetImageTransformParameterfvHP */
{ 3305, -1 }, /* ImageTransformParameterfHP */
- { 9056, -1 }, /* ImageTransformParameterfvHP */
- { 10678, -1 }, /* ImageTransformParameteriHP */
- { 10940, -1 }, /* GetImageTransformParameterivHP */
- { 17375, -1 }, /* ImageTransformParameterivHP */
+ { 9110, -1 }, /* ImageTransformParameterfvHP */
+ { 10768, -1 }, /* ImageTransformParameteriHP */
+ { 11115, -1 }, /* GetImageTransformParameterivHP */
+ { 17610, -1 }, /* ImageTransformParameterivHP */
{ -1, -1 }
};
#endif
@@ -5488,10 +5536,10 @@ static const struct gl_function_remap GL_IBM_vertex_array_lists_functions[] = {
{ 5167, -1 }, /* NormalPointerListIBM */
{ 6789, -1 }, /* FogCoordPointerListIBM */
{ 7096, -1 }, /* VertexPointerListIBM */
- { 10599, -1 }, /* ColorPointerListIBM */
- { 11894, -1 }, /* TexCoordPointerListIBM */
- { 12297, -1 }, /* IndexPointerListIBM */
- { 29409, -1 }, /* EdgeFlagPointerListIBM */
+ { 10689, -1 }, /* ColorPointerListIBM */
+ { 12069, -1 }, /* TexCoordPointerListIBM */
+ { 12440, -1 }, /* IndexPointerListIBM */
+ { 29769, -1 }, /* EdgeFlagPointerListIBM */
{ -1, -1 }
};
#endif
@@ -5505,10 +5553,10 @@ static const struct gl_function_remap GL_INGR_blend_func_separate_functions[] =
#if defined(need_GL_INTEL_parallel_arrays)
static const struct gl_function_remap GL_INTEL_parallel_arrays_functions[] = {
- { 11281, -1 }, /* VertexPointervINTEL */
- { 13791, -1 }, /* ColorPointervINTEL */
- { 26868, -1 }, /* NormalPointervINTEL */
- { 27294, -1 }, /* TexCoordPointervINTEL */
+ { 11456, -1 }, /* VertexPointervINTEL */
+ { 13985, -1 }, /* ColorPointervINTEL */
+ { 27231, -1 }, /* NormalPointervINTEL */
+ { 27657, -1 }, /* TexCoordPointervINTEL */
{ -1, -1 }
};
#endif
@@ -5525,7 +5573,7 @@ static const struct gl_function_remap GL_MESA_shader_debug_functions[] = {
{ 1522, -1 }, /* GetDebugLogLengthMESA */
{ 3063, -1 }, /* ClearDebugLogMESA */
{ 4018, -1 }, /* GetDebugLogMESA */
- { 27746, -1 }, /* CreateDebugObjectMESA */
+ { 28145, -1 }, /* CreateDebugObjectMESA */
{ -1, -1 }
};
#endif
@@ -5549,12 +5597,12 @@ static const struct gl_function_remap GL_NV_evaluators_functions[] = {
{ 5834, -1 }, /* GetMapAttribParameterivNV */
{ 7551, -1 }, /* MapControlPointsNV */
{ 7650, -1 }, /* MapParameterfvNV */
- { 9461, -1 }, /* EvalMapsNV */
- { 15280, -1 }, /* GetMapAttribParameterfvNV */
- { 15446, -1 }, /* MapParameterivNV */
- { 22175, -1 }, /* GetMapParameterivNV */
- { 22673, -1 }, /* GetMapParameterfvNV */
- { 26204, -1 }, /* GetMapControlPointsNV */
+ { 9515, -1 }, /* EvalMapsNV */
+ { 15474, -1 }, /* GetMapAttribParameterfvNV */
+ { 15640, -1 }, /* MapParameterivNV */
+ { 22475, -1 }, /* GetMapParameterivNV */
+ { 22973, -1 }, /* GetMapParameterfvNV */
+ { 26567, -1 }, /* GetMapControlPointsNV */
{ -1, -1 }
};
#endif
@@ -5589,8 +5637,8 @@ static const struct gl_function_remap GL_NV_register_combiners_functions[] = {
#if defined(need_GL_NV_register_combiners2)
static const struct gl_function_remap GL_NV_register_combiners2_functions[] = {
- { 14183, -1 }, /* CombinerStageParameterfvNV */
- { 14498, -1 }, /* GetCombinerStageParameterfvNV */
+ { 14377, -1 }, /* CombinerStageParameterfvNV */
+ { 14692, -1 }, /* GetCombinerStageParameterfvNV */
{ -1, -1 }
};
#endif
@@ -5625,16 +5673,16 @@ static const struct gl_function_remap GL_PGI_misc_hints_functions[] = {
#if defined(need_GL_SGIS_detail_texture)
static const struct gl_function_remap GL_SGIS_detail_texture_functions[] = {
- { 14471, -1 }, /* GetDetailTexFuncSGIS */
- { 14791, -1 }, /* DetailTexFuncSGIS */
+ { 14665, -1 }, /* GetDetailTexFuncSGIS */
+ { 14985, -1 }, /* DetailTexFuncSGIS */
{ -1, -1 }
};
#endif
#if defined(need_GL_SGIS_fog_function)
static const struct gl_function_remap GL_SGIS_fog_function_functions[] = {
- { 24313, -1 }, /* FogFuncSGIS */
- { 24978, -1 }, /* GetFogFuncSGIS */
+ { 24647, -1 }, /* FogFuncSGIS */
+ { 25312, -1 }, /* GetFogFuncSGIS */
{ -1, -1 }
};
#endif
@@ -5663,7 +5711,7 @@ static const struct gl_function_remap GL_SGIS_point_parameters_functions[] = {
#if defined(need_GL_SGIS_sharpen_texture)
static const struct gl_function_remap GL_SGIS_sharpen_texture_functions[] = {
{ 5895, -1 }, /* GetSharpenTexFuncSGIS */
- { 19700, -1 }, /* SharpenTexFuncSGIS */
+ { 19974, -1 }, /* SharpenTexFuncSGIS */
{ -1, -1 }
};
#endif
@@ -5671,14 +5719,14 @@ static const struct gl_function_remap GL_SGIS_sharpen_texture_functions[] = {
#if defined(need_GL_SGIS_texture4D)
static const struct gl_function_remap GL_SGIS_texture4D_functions[] = {
{ 894, -1 }, /* TexImage4DSGIS */
- { 14099, -1 }, /* TexSubImage4DSGIS */
+ { 14293, -1 }, /* TexSubImage4DSGIS */
{ -1, -1 }
};
#endif
#if defined(need_GL_SGIS_texture_color_mask)
static const struct gl_function_remap GL_SGIS_texture_color_mask_functions[] = {
- { 13497, -1 }, /* TextureColorMaskSGIS */
+ { 13691, -1 }, /* TextureColorMaskSGIS */
{ -1, -1 }
};
#endif
@@ -5686,7 +5734,7 @@ static const struct gl_function_remap GL_SGIS_texture_color_mask_functions[] = {
#if defined(need_GL_SGIS_texture_filter4)
static const struct gl_function_remap GL_SGIS_texture_filter4_functions[] = {
{ 6072, -1 }, /* GetTexFilterFuncSGIS */
- { 14617, -1 }, /* TexFilterFuncSGIS */
+ { 14811, -1 }, /* TexFilterFuncSGIS */
{ -1, -1 }
};
#endif
@@ -5696,9 +5744,9 @@ static const struct gl_function_remap GL_SGIX_async_functions[] = {
{ 3014, -1 }, /* AsyncMarkerSGIX */
{ 3997, -1 }, /* FinishAsyncSGIX */
{ 4734, -1 }, /* PollAsyncSGIX */
- { 19847, -1 }, /* DeleteAsyncMarkersSGIX */
- { 19876, -1 }, /* IsAsyncMarkerSGIX */
- { 29206, -1 }, /* GenAsyncMarkersSGIX */
+ { 20121, -1 }, /* DeleteAsyncMarkersSGIX */
+ { 20176, -1 }, /* IsAsyncMarkerSGIX */
+ { 29566, -1 }, /* GenAsyncMarkersSGIX */
{ -1, -1 }
};
#endif
@@ -5719,31 +5767,31 @@ static const struct gl_function_remap GL_SGIX_fragment_lighting_functions[] = {
{ 7163, -1 }, /* FragmentMaterialfSGIX */
{ 7324, -1 }, /* GetFragmentLightivSGIX */
{ 8161, -1 }, /* FragmentLightModeliSGIX */
- { 9524, -1 }, /* FragmentLightivSGIX */
- { 9790, -1 }, /* GetFragmentMaterialivSGIX */
- { 17198, -1 }, /* FragmentLightModelfSGIX */
- { 17498, -1 }, /* FragmentColorMaterialSGIX */
- { 17898, -1 }, /* FragmentMaterialiSGIX */
- { 19119, -1 }, /* LightEnviSGIX */
- { 20530, -1 }, /* FragmentLightModelfvSGIX */
- { 20839, -1 }, /* FragmentLightfvSGIX */
- { 25454, -1 }, /* FragmentLightfSGIX */
- { 28122, -1 }, /* GetFragmentLightfvSGIX */
- { 29689, -1 }, /* FragmentMaterialivSGIX */
+ { 9578, -1 }, /* FragmentLightivSGIX */
+ { 9880, -1 }, /* GetFragmentMaterialivSGIX */
+ { 17433, -1 }, /* FragmentLightModelfSGIX */
+ { 17733, -1 }, /* FragmentColorMaterialSGIX */
+ { 18133, -1 }, /* FragmentMaterialiSGIX */
+ { 19393, -1 }, /* LightEnviSGIX */
+ { 20830, -1 }, /* FragmentLightModelfvSGIX */
+ { 21139, -1 }, /* FragmentLightfvSGIX */
+ { 25817, -1 }, /* FragmentLightfSGIX */
+ { 28482, -1 }, /* GetFragmentLightfvSGIX */
+ { 30049, -1 }, /* FragmentMaterialivSGIX */
{ -1, -1 }
};
#endif
#if defined(need_GL_SGIX_framezoom)
static const struct gl_function_remap GL_SGIX_framezoom_functions[] = {
- { 19899, -1 }, /* FrameZoomSGIX */
+ { 20199, -1 }, /* FrameZoomSGIX */
{ -1, -1 }
};
#endif
#if defined(need_GL_SGIX_igloo_interface)
static const struct gl_function_remap GL_SGIX_igloo_interface_functions[] = {
- { 25762, -1 }, /* IglooInterfaceSGIX */
+ { 26125, -1 }, /* IglooInterfaceSGIX */
{ -1, -1 }
};
#endif
@@ -5752,10 +5800,10 @@ static const struct gl_function_remap GL_SGIX_igloo_interface_functions[] = {
static const struct gl_function_remap GL_SGIX_instruments_functions[] = {
{ 2573, -1 }, /* ReadInstrumentsSGIX */
{ 5651, -1 }, /* PollInstrumentsSGIX */
- { 9422, -1 }, /* GetInstrumentsSGIX */
- { 11492, -1 }, /* StartInstrumentsSGIX */
- { 14217, -1 }, /* StopInstrumentsSGIX */
- { 15823, -1 }, /* InstrumentsBufferSGIX */
+ { 9476, -1 }, /* GetInstrumentsSGIX */
+ { 11667, -1 }, /* StartInstrumentsSGIX */
+ { 14411, -1 }, /* StopInstrumentsSGIX */
+ { 16017, -1 }, /* InstrumentsBufferSGIX */
{ -1, -1 }
};
#endif
@@ -5764,10 +5812,10 @@ static const struct gl_function_remap GL_SGIX_instruments_functions[] = {
static const struct gl_function_remap GL_SGIX_list_priority_functions[] = {
{ 1125, -1 }, /* ListParameterfSGIX */
{ 2763, -1 }, /* GetListParameterfvSGIX */
- { 15738, -1 }, /* ListParameteriSGIX */
- { 16492, -1 }, /* ListParameterfvSGIX */
- { 18525, -1 }, /* ListParameterivSGIX */
- { 29250, -1 }, /* GetListParameterivSGIX */
+ { 15932, -1 }, /* ListParameteriSGIX */
+ { 16686, -1 }, /* ListParameterfvSGIX */
+ { 18799, -1 }, /* ListParameterivSGIX */
+ { 29610, -1 }, /* GetListParameterivSGIX */
{ -1, -1 }
};
#endif
@@ -5782,33 +5830,33 @@ static const struct gl_function_remap GL_SGIX_pixel_texture_functions[] = {
#if defined(need_GL_SGIX_polynomial_ffd)
static const struct gl_function_remap GL_SGIX_polynomial_ffd_functions[] = {
{ 3251, -1 }, /* LoadIdentityDeformationMapSGIX */
- { 14317, -1 }, /* DeformSGIX */
- { 21724, -1 }, /* DeformationMap3fSGIX */
- { 28010, -1 }, /* DeformationMap3dSGIX */
+ { 10989, -1 }, /* DeformationMap3dSGIX */
+ { 14511, -1 }, /* DeformSGIX */
+ { 22024, -1 }, /* DeformationMap3fSGIX */
{ -1, -1 }
};
#endif
#if defined(need_GL_SGIX_reference_plane)
static const struct gl_function_remap GL_SGIX_reference_plane_functions[] = {
- { 13048, -1 }, /* ReferencePlaneSGIX */
+ { 13242, -1 }, /* ReferencePlaneSGIX */
{ -1, -1 }
};
#endif
#if defined(need_GL_SGIX_sprite)
static const struct gl_function_remap GL_SGIX_sprite_functions[] = {
- { 8577, -1 }, /* SpriteParameterfvSGIX */
- { 18353, -1 }, /* SpriteParameteriSGIX */
- { 23752, -1 }, /* SpriteParameterfSGIX */
- { 26326, -1 }, /* SpriteParameterivSGIX */
+ { 8631, -1 }, /* SpriteParameterfvSGIX */
+ { 18588, -1 }, /* SpriteParameteriSGIX */
+ { 24054, -1 }, /* SpriteParameterfSGIX */
+ { 26689, -1 }, /* SpriteParameterivSGIX */
{ -1, -1 }
};
#endif
#if defined(need_GL_SGIX_tag_sample_buffer)
static const struct gl_function_remap GL_SGIX_tag_sample_buffer_functions[] = {
- { 18412, -1 }, /* TagSampleBufferSGIX */
+ { 18647, -1 }, /* TagSampleBufferSGIX */
{ -1, -1 }
};
#endif
@@ -5817,18 +5865,18 @@ static const struct gl_function_remap GL_SGIX_tag_sample_buffer_functions[] = {
static const struct gl_function_remap GL_SGI_color_table_functions[] = {
{ 6733, _gloffset_ColorTableParameteriv },
{ 7445, _gloffset_ColorTable },
- { 13544, _gloffset_GetColorTable },
- { 13654, _gloffset_CopyColorTable },
- { 17142, _gloffset_ColorTableParameterfv },
- { 20438, _gloffset_GetColorTableParameterfv },
- { 22431, _gloffset_GetColorTableParameteriv },
+ { 13738, _gloffset_GetColorTable },
+ { 13848, _gloffset_CopyColorTable },
+ { 17377, _gloffset_ColorTableParameterfv },
+ { 20738, _gloffset_GetColorTableParameterfv },
+ { 22731, _gloffset_GetColorTableParameteriv },
{ -1, -1 }
};
#endif
#if defined(need_GL_SUNX_constant_data)
static const struct gl_function_remap GL_SUNX_constant_data_functions[] = {
- { 28100, -1 }, /* FinishTextureSUNX */
+ { 28460, -1 }, /* FinishTextureSUNX */
{ -1, -1 }
};
#endif
@@ -5838,18 +5886,18 @@ static const struct gl_function_remap GL_SUN_global_alpha_functions[] = {
{ 3035, -1 }, /* GlobalAlphaFactorubSUN */
{ 4224, -1 }, /* GlobalAlphaFactoriSUN */
{ 5676, -1 }, /* GlobalAlphaFactordSUN */
- { 8661, -1 }, /* GlobalAlphaFactoruiSUN */
- { 9013, -1 }, /* GlobalAlphaFactorbSUN */
- { 11807, -1 }, /* GlobalAlphaFactorfSUN */
- { 11926, -1 }, /* GlobalAlphaFactorusSUN */
- { 20138, -1 }, /* GlobalAlphaFactorsSUN */
+ { 8715, -1 }, /* GlobalAlphaFactoruiSUN */
+ { 9067, -1 }, /* GlobalAlphaFactorbSUN */
+ { 11982, -1 }, /* GlobalAlphaFactorfSUN */
+ { 12101, -1 }, /* GlobalAlphaFactorusSUN */
+ { 20438, -1 }, /* GlobalAlphaFactorsSUN */
{ -1, -1 }
};
#endif
#if defined(need_GL_SUN_mesh_array)
static const struct gl_function_remap GL_SUN_mesh_array_functions[] = {
- { 26138, -1 }, /* DrawMeshArraysSUN */
+ { 26501, -1 }, /* DrawMeshArraysSUN */
{ -1, -1 }
};
#endif
@@ -5858,11 +5906,11 @@ static const struct gl_function_remap GL_SUN_mesh_array_functions[] = {
static const struct gl_function_remap GL_SUN_triangle_list_functions[] = {
{ 3971, -1 }, /* ReplacementCodeubSUN */
{ 5515, -1 }, /* ReplacementCodeubvSUN */
- { 16863, -1 }, /* ReplacementCodeusvSUN */
- { 17051, -1 }, /* ReplacementCodePointerSUN */
- { 18436, -1 }, /* ReplacementCodeusSUN */
- { 19183, -1 }, /* ReplacementCodeuiSUN */
- { 26783, -1 }, /* ReplacementCodeuivSUN */
+ { 17098, -1 }, /* ReplacementCodeusvSUN */
+ { 17286, -1 }, /* ReplacementCodePointerSUN */
+ { 19457, -1 }, /* ReplacementCodeuiSUN */
+ { 20150, -1 }, /* ReplacementCodeusSUN */
+ { 27146, -1 }, /* ReplacementCodeuivSUN */
{ -1, -1 }
};
#endif
@@ -5884,31 +5932,31 @@ static const struct gl_function_remap GL_SUN_vertex_functions[] = {
{ 6480, -1 }, /* ReplacementCodeuiTexCoord2fVertex3fSUN */
{ 7192, -1 }, /* TexCoord2fNormal3fVertex3fSUN */
{ 7960, -1 }, /* Color3fVertex3fSUN */
- { 8972, -1 }, /* Color3fVertex3fvSUN */
- { 9387, -1 }, /* Color4fNormal3fVertex3fvSUN */
- { 10088, -1 }, /* ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN */
- { 11355, -1 }, /* ReplacementCodeuiColor4fNormal3fVertex3fvSUN */
- { 12779, -1 }, /* ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN */
- { 13190, -1 }, /* TexCoord2fColor3fVertex3fSUN */
- { 14242, -1 }, /* TexCoord4fColor4fNormal3fVertex4fSUN */
- { 14576, -1 }, /* Color4ubVertex2fvSUN */
- { 14816, -1 }, /* Normal3fVertex3fSUN */
- { 15764, -1 }, /* ReplacementCodeuiColor4fNormal3fVertex3fSUN */
- { 16025, -1 }, /* TexCoord2fColor4fNormal3fVertex3fvSUN */
- { 16692, -1 }, /* TexCoord2fVertex3fvSUN */
- { 17468, -1 }, /* Color4ubVertex2fSUN */
- { 17689, -1 }, /* ReplacementCodeuiColor4ubVertex3fSUN */
- { 19571, -1 }, /* TexCoord2fColor4ubVertex3fSUN */
- { 19918, -1 }, /* Normal3fVertex3fvSUN */
- { 20347, -1 }, /* Color4fNormal3fVertex3fSUN */
- { 21256, -1 }, /* ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN */
- { 21476, -1 }, /* ReplacementCodeuiColor4ubVertex3fvSUN */
- { 23206, -1 }, /* ReplacementCodeuiColor3fVertex3fSUN */
- { 24429, -1 }, /* TexCoord4fVertex4fSUN */
- { 24855, -1 }, /* TexCoord2fColor3fVertex3fvSUN */
- { 25181, -1 }, /* ReplacementCodeuiNormal3fVertex3fvSUN */
- { 25308, -1 }, /* TexCoord4fVertex4fvSUN */
- { 26010, -1 }, /* ReplacementCodeuiVertex3fSUN */
+ { 9026, -1 }, /* Color3fVertex3fvSUN */
+ { 9441, -1 }, /* Color4fNormal3fVertex3fvSUN */
+ { 10178, -1 }, /* ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN */
+ { 11530, -1 }, /* ReplacementCodeuiColor4fNormal3fVertex3fvSUN */
+ { 12973, -1 }, /* ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN */
+ { 13384, -1 }, /* TexCoord2fColor3fVertex3fSUN */
+ { 14436, -1 }, /* TexCoord4fColor4fNormal3fVertex4fSUN */
+ { 14770, -1 }, /* Color4ubVertex2fvSUN */
+ { 15010, -1 }, /* Normal3fVertex3fSUN */
+ { 15958, -1 }, /* ReplacementCodeuiColor4fNormal3fVertex3fSUN */
+ { 16219, -1 }, /* TexCoord2fColor4fNormal3fVertex3fvSUN */
+ { 16927, -1 }, /* TexCoord2fVertex3fvSUN */
+ { 17703, -1 }, /* Color4ubVertex2fSUN */
+ { 17924, -1 }, /* ReplacementCodeuiColor4ubVertex3fSUN */
+ { 19845, -1 }, /* TexCoord2fColor4ubVertex3fSUN */
+ { 20218, -1 }, /* Normal3fVertex3fvSUN */
+ { 20647, -1 }, /* Color4fNormal3fVertex3fSUN */
+ { 21556, -1 }, /* ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN */
+ { 21776, -1 }, /* ReplacementCodeuiColor4ubVertex3fvSUN */
+ { 23506, -1 }, /* ReplacementCodeuiColor3fVertex3fSUN */
+ { 24763, -1 }, /* TexCoord4fVertex4fSUN */
+ { 25189, -1 }, /* TexCoord2fColor3fVertex3fvSUN */
+ { 25544, -1 }, /* ReplacementCodeuiNormal3fVertex3fvSUN */
+ { 25671, -1 }, /* TexCoord4fVertex4fvSUN */
+ { 26373, -1 }, /* ReplacementCodeuiVertex3fSUN */
{ -1, -1 }
};
#endif
@@ -5923,33 +5971,33 @@ static const struct gl_function_remap GL_VERSION_1_3_functions[] = {
{ 5346, _gloffset_MultiTexCoord2iARB },
{ 5470, _gloffset_MultiTexCoord2svARB },
{ 7401, _gloffset_MultiTexCoord2fARB },
- { 9223, _gloffset_MultiTexCoord3fvARB },
- { 9744, _gloffset_MultiTexCoord4sARB },
- { 10378, _gloffset_MultiTexCoord2dvARB },
- { 10760, _gloffset_MultiTexCoord1svARB },
- { 11050, _gloffset_MultiTexCoord3svARB },
- { 11111, _gloffset_MultiTexCoord4iARB },
- { 11834, _gloffset_MultiTexCoord3iARB },
- { 12568, _gloffset_MultiTexCoord1dARB },
- { 12734, _gloffset_MultiTexCoord3dvARB },
- { 13898, _gloffset_MultiTexCoord3ivARB },
- { 13943, _gloffset_MultiTexCoord2sARB },
- { 15163, _gloffset_MultiTexCoord4ivARB },
- { 16792, _gloffset_ClientActiveTextureARB },
- { 19036, _gloffset_MultiTexCoord2dARB },
- { 19440, _gloffset_MultiTexCoord4dvARB },
- { 19726, _gloffset_MultiTexCoord4fvARB },
- { 20579, _gloffset_MultiTexCoord3fARB },
- { 22959, _gloffset_MultiTexCoord4dARB },
- { 23163, _gloffset_MultiTexCoord1sARB },
- { 23365, _gloffset_MultiTexCoord1dvARB },
- { 24175, _gloffset_MultiTexCoord1ivARB },
- { 24268, _gloffset_MultiTexCoord2ivARB },
- { 24607, _gloffset_MultiTexCoord1iARB },
- { 25878, _gloffset_MultiTexCoord4svARB },
- { 26396, _gloffset_MultiTexCoord1fARB },
- { 26659, _gloffset_MultiTexCoord4fARB },
- { 28927, _gloffset_MultiTexCoord2fvARB },
+ { 9277, _gloffset_MultiTexCoord3fvARB },
+ { 9834, _gloffset_MultiTexCoord4sARB },
+ { 10468, _gloffset_MultiTexCoord2dvARB },
+ { 10850, _gloffset_MultiTexCoord1svARB },
+ { 11225, _gloffset_MultiTexCoord3svARB },
+ { 11286, _gloffset_MultiTexCoord4iARB },
+ { 12009, _gloffset_MultiTexCoord3iARB },
+ { 12711, _gloffset_MultiTexCoord1dARB },
+ { 12928, _gloffset_MultiTexCoord3dvARB },
+ { 14092, _gloffset_MultiTexCoord3ivARB },
+ { 14137, _gloffset_MultiTexCoord2sARB },
+ { 15357, _gloffset_MultiTexCoord4ivARB },
+ { 17027, _gloffset_ClientActiveTextureARB },
+ { 19310, _gloffset_MultiTexCoord2dARB },
+ { 19714, _gloffset_MultiTexCoord4dvARB },
+ { 20000, _gloffset_MultiTexCoord4fvARB },
+ { 20879, _gloffset_MultiTexCoord3fARB },
+ { 23259, _gloffset_MultiTexCoord4dARB },
+ { 23463, _gloffset_MultiTexCoord1sARB },
+ { 23667, _gloffset_MultiTexCoord1dvARB },
+ { 24509, _gloffset_MultiTexCoord1ivARB },
+ { 24602, _gloffset_MultiTexCoord2ivARB },
+ { 24941, _gloffset_MultiTexCoord1iARB },
+ { 26241, _gloffset_MultiTexCoord4svARB },
+ { 26759, _gloffset_MultiTexCoord1fARB },
+ { 27022, _gloffset_MultiTexCoord4fARB },
+ { 29287, _gloffset_MultiTexCoord2fvARB },
{ -1, -1 }
};
#endif
@@ -5982,3 +6030,10 @@ static const struct gl_function_remap GL_VERSION_2_1_functions[] = {
};
#endif
+#if defined(need_GL_VERSION_3_0)
+/* functions defined in MESA_remap_table_functions are excluded */
+static const struct gl_function_remap GL_VERSION_3_0_functions[] = {
+ { -1, -1 }
+};
+#endif
+
diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c
index fcd28a4b4e..12c2e903eb 100644
--- a/src/mesa/main/texcompress_s3tc.c
+++ b/src/mesa/main/texcompress_s3tc.c
@@ -48,7 +48,7 @@
#if FEATURE_texture_s3tc
-#ifdef __MINGW32__
+#if defined(_WIN32) || defined(WIN32)
#define DXTN_LIBNAME "dxtn.dll"
#define RTLD_LAZY 0
#define RTLD_GLOBAL 0
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index 0fde89b507..ca03404f12 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -371,7 +371,7 @@ set_tex_parameteri(GLcontext *ctx,
}
return GL_FALSE;
-#ifdef FEATURE_OES_draw_texture
+#if FEATURE_OES_draw_texture
case GL_TEXTURE_CROP_RECT_OES:
texObj->CropRect[0] = params[0];
texObj->CropRect[1] = params[1];
@@ -604,7 +604,7 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
}
break;
-#ifdef FEATURE_OES_draw_texture
+#if FEATURE_OES_draw_texture
case GL_TEXTURE_CROP_RECT_OES:
{
/* convert float params to int */
@@ -940,6 +940,18 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
"glGetTexLevelParameter[if]v(pname)");
}
break;
+ case GL_TEXTURE_SHARED_SIZE:
+ if (ctx->VersionMajor >= 3) {
+ /* XXX return number of exponent bits for shared exponent texture
+ * formats, like GL_RGB9_E5.
+ */
+ *params = 0;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetTexLevelParameter[if]v(pname)");
+ }
+ break;
/* GL_ARB_texture_compression */
case GL_TEXTURE_COMPRESSED_IMAGE_SIZE:
@@ -1148,7 +1160,7 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
else
error = GL_TRUE;
break;
-#ifdef FEATURE_OES_draw_texture
+#if FEATURE_OES_draw_texture
case GL_TEXTURE_CROP_RECT_OES:
params[0] = obj->CropRect[0];
params[1] = obj->CropRect[1];
@@ -1318,7 +1330,7 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
error = GL_TRUE;
}
break;
-#ifdef FEATURE_OES_draw_texture
+#if FEATURE_OES_draw_texture
case GL_TEXTURE_CROP_RECT_OES:
params[0] = obj->CropRect[0];
params[1] = obj->CropRect[1];
diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c
new file mode 100644
index 0000000000..74519ba38a
--- /dev/null
+++ b/src/mesa/main/transformfeedback.c
@@ -0,0 +1,435 @@
+/*
+ * Mesa 3-D graphics library
+ *
+ * Copyright (C) 2010 VMware, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/*
+ * Vertex transform feedback support.
+ *
+ * Authors:
+ * Brian Paul
+ */
+
+
+#include "buffers.h"
+#include "bufferobj.h"
+#include "context.h"
+#include "transformfeedback.h"
+
+#include "shader/prog_parameter.h"
+#include "shader/shader_api.h"
+
+
+/**
+ * Check if the given primitive mode (as in glBegin(mode)) is compatible
+ * with the current transform feedback mode (if it's enabled).
+ * This is to be called from glBegin(), glDrawArrays(), glDrawElements(), etc.
+ *
+ * \return GL_TRUE if the mode is OK, GL_FALSE otherwise.
+ */
+GLboolean
+_mesa_validate_primitive_mode(GLcontext *ctx, GLenum mode)
+{
+ if (ctx->TransformFeedback.Active) {
+ switch (mode) {
+ case GL_POINTS:
+ return ctx->TransformFeedback.Mode == GL_POINTS;
+ case GL_LINES:
+ case GL_LINE_STRIP:
+ case GL_LINE_LOOP:
+ return ctx->TransformFeedback.Mode == GL_LINES;
+ default:
+ return ctx->TransformFeedback.Mode == GL_TRIANGLES;
+ }
+ }
+ return GL_TRUE;
+}
+
+
+/**
+ * Check that all the buffer objects currently bound for transform
+ * feedback actually exist. Raise a GL_INVALID_OPERATION error if
+ * any buffers are missing.
+ * \return GL_TRUE for success, GL_FALSE if error
+ */
+GLboolean
+_mesa_validate_transform_feedback_buffers(GLcontext *ctx)
+{
+
+ return GL_TRUE;
+}
+
+
+
+/**
+ * Per-context init for transform feedback.
+ */
+void
+_mesa_init_transform_feedback(GLcontext *ctx)
+{
+ _mesa_reference_buffer_object(ctx,
+ &ctx->TransformFeedback.CurrentBuffer,
+ ctx->Shared->NullBufferObj);
+}
+
+
+/**
+ * Per-context free/clean-up for transform feedback.
+ */
+void
+_mesa_free_transform_feedback(GLcontext *ctx)
+{
+ _mesa_reference_buffer_object(ctx,
+ &ctx->TransformFeedback.CurrentBuffer,
+ NULL);
+}
+
+
+void GLAPIENTRY
+_mesa_BeginTransformFeedback(GLenum mode)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ switch (mode) {
+ case GL_POINTS:
+ case GL_LINES:
+ case GL_TRIANGLES:
+ /* legal */
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glBeginTransformFeedback(mode)");
+ return;
+ }
+
+ if (ctx->TransformFeedback.Active) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBeginTransformFeedback(already active)");
+ return;
+ }
+
+ ctx->TransformFeedback.Active = GL_TRUE;
+ ctx->TransformFeedback.Mode = mode;
+}
+
+
+void GLAPIENTRY
+_mesa_EndTransformFeedback(void)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (!ctx->TransformFeedback.Active) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glEndTransformFeedback(not active)");
+ return;
+ }
+
+ ctx->TransformFeedback.Active = GL_FALSE;
+}
+
+
+/**
+ * Helper used by BindBufferRange() and BindBufferBase().
+ */
+static void
+bind_buffer_range(GLcontext *ctx, GLuint index,
+ struct gl_buffer_object *bufObj,
+ GLintptr offset, GLsizeiptr size)
+{
+ /* The general binding point */
+ _mesa_reference_buffer_object(ctx,
+ &ctx->TransformFeedback.CurrentBuffer,
+ bufObj);
+
+ /* The per-attribute binding point */
+ _mesa_reference_buffer_object(ctx,
+ &ctx->TransformFeedback.Buffers[index],
+ bufObj);
+
+ ctx->TransformFeedback.BufferNames[index] = bufObj->Name;
+
+ ctx->TransformFeedback.Offset[index] = offset;
+ ctx->TransformFeedback.Size[index] = size;
+}
+
+
+/**
+ * Specify a buffer object to receive vertex shader results. Plus,
+ * specify the starting offset to place the results, and max size.
+ */
+void GLAPIENTRY
+_mesa_BindBufferRange(GLenum target, GLuint index,
+ GLuint buffer, GLintptr offset, GLsizeiptr size)
+{
+ struct gl_buffer_object *bufObj;
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (target != GL_TRANSFORM_FEEDBACK_BUFFER) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glBindBufferRange(target)");
+ return;
+ }
+
+ if (ctx->TransformFeedback.Active) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBindBufferRange(transform feedback active)");
+ return;
+ }
+
+ if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(index=%d)", index);
+ return;
+ }
+
+ if ((size <= 0) || (size & 0x3)) {
+ /* must be positive and multiple of four */
+ _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(size%d)", size);
+ return;
+ }
+
+ if (offset & 0x3) {
+ /* must be multiple of four */
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glBindBufferRange(offset=%d)", offset);
+ return;
+ }
+
+ bufObj = _mesa_lookup_bufferobj(ctx, buffer);
+ if (!bufObj) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBindBufferRange(invalid buffer=%u)", buffer);
+ return;
+ }
+
+ if (offset + size >= bufObj->Size) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glBindBufferRange(offset + size > buffer size)", size);
+ return;
+ }
+
+ bind_buffer_range(ctx, index, bufObj, offset, size);
+}
+
+
+/**
+ * Specify a buffer object to receive vertex shader results.
+ * As above, but start at offset = 0.
+ */
+void GLAPIENTRY
+_mesa_BindBufferBase(GLenum target, GLuint index, GLuint buffer)
+{
+ struct gl_buffer_object *bufObj;
+ GET_CURRENT_CONTEXT(ctx);
+ GLsizeiptr size;
+
+ if (target != GL_TRANSFORM_FEEDBACK_BUFFER) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glBindBufferBase(target)");
+ return;
+ }
+
+ if (ctx->TransformFeedback.Active) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBindBufferRange(transform feedback active)");
+ return;
+ }
+
+ if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferBase(index=%d)", index);
+ return;
+ }
+
+ bufObj = _mesa_lookup_bufferobj(ctx, buffer);
+ if (!bufObj) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBindBufferBase(invalid buffer=%u)", buffer);
+ return;
+ }
+
+ /* default size is the buffer size rounded down to nearest
+ * multiple of four.
+ */
+ size = bufObj->Size & ~0x3;
+
+ bind_buffer_range(ctx, index, bufObj, 0, size);
+}
+
+
+/**
+ * Specify a buffer object to receive vertex shader results, plus the
+ * offset in the buffer to start placing results.
+ * This function is part of GL_EXT_transform_feedback, but not GL3.
+ */
+void GLAPIENTRY
+_mesa_BindBufferOffsetEXT(GLenum target, GLuint index, GLuint buffer,
+ GLintptr offset)
+{
+ struct gl_buffer_object *bufObj;
+ GET_CURRENT_CONTEXT(ctx);
+ GLsizeiptr size;
+
+ if (target != GL_TRANSFORM_FEEDBACK_BUFFER) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glBindBufferOffsetEXT(target)");
+ return;
+ }
+
+ if (ctx->TransformFeedback.Active) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBindBufferRange(transform feedback active)");
+ return;
+ }
+
+ if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glBindBufferOffsetEXT(index=%d)", index);
+ return;
+ }
+
+ bufObj = _mesa_lookup_bufferobj(ctx, buffer);
+ if (!bufObj) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBindBufferOffsetEXT(invalid buffer=%u)", buffer);
+ return;
+ }
+
+ /* default size is the buffer size rounded down to nearest
+ * multiple of four.
+ */
+ size = (bufObj->Size - offset) & ~0x3;
+
+ bind_buffer_range(ctx, index, bufObj, offset, size);
+}
+
+
+/**
+ * This function specifies the vertex shader outputs to be written
+ * to the feedback buffer(s), and in what order.
+ */
+void GLAPIENTRY
+_mesa_TransformFeedbackVaryings(GLuint program, GLsizei count,
+ const GLchar **varyings, GLenum bufferMode)
+{
+ struct gl_shader_program *shProg;
+ GLuint i;
+ GET_CURRENT_CONTEXT(ctx);
+
+ switch (bufferMode) {
+ case GL_INTERLEAVED_ATTRIBS:
+ break;
+ case GL_SEPARATE_ATTRIBS:
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTransformFeedbackVaryings(bufferMode)");
+ return;
+ }
+
+ if (count < 0 || count > ctx->Const.MaxTransformFeedbackSeparateAttribs) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glTransformFeedbackVaryings(count=%d)", count);
+ return;
+ }
+
+ shProg = _mesa_lookup_shader_program(ctx, program);
+ if (!shProg) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glTransformFeedbackVaryings(program=%u)", program);
+ return;
+ }
+
+ /* free existing varyings, if any */
+ for (i = 0; i < shProg->TransformFeedback.NumVarying; i++) {
+ free(shProg->TransformFeedback.VaryingNames[i]);
+ }
+ free(shProg->TransformFeedback.VaryingNames);
+
+ /* allocate new memory for varying names */
+ shProg->TransformFeedback.VaryingNames =
+ (GLchar **) malloc(count * sizeof(GLchar *));
+
+ if (!shProg->TransformFeedback.VaryingNames) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTransformFeedbackVaryings()");
+ return;
+ }
+
+ /* Save the new names and the count */
+ for (i = 0; i < (GLuint) count; i++) {
+ shProg->TransformFeedback.VaryingNames[i] = _mesa_strdup(varyings[i]);
+ }
+ shProg->TransformFeedback.NumVarying = count;
+
+ shProg->TransformFeedback.BufferMode = bufferMode;
+
+ /* The varyings won't be used until shader link time */
+}
+
+
+/**
+ * Get info about the vertex shader's outputs which are to be written
+ * to the feedback buffer(s).
+ */
+void GLAPIENTRY
+_mesa_GetTransformFeedbackVarying(GLuint program, GLuint index,
+ GLsizei bufSize, GLsizei *length,
+ GLsizei *size, GLenum *type, GLchar *name)
+{
+ const struct gl_shader_program *shProg;
+ const GLchar *varyingName;
+ GLint v;
+ GET_CURRENT_CONTEXT(ctx);
+
+ shProg = _mesa_lookup_shader_program(ctx, program);
+ if (!shProg) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glGetTransformFeedbackVaryings(program=%u)", program);
+ return;
+ }
+
+ if (index >= shProg->TransformFeedback.NumVarying) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glGetTransformFeedbackVaryings(index=%u)", index);
+ return;
+ }
+
+ varyingName = shProg->TransformFeedback.VaryingNames[index];
+
+ v = _mesa_lookup_parameter_index(shProg->Varying, -1, varyingName);
+ if (v >= 0) {
+ struct gl_program_parameter *param = &shProg->Varying->Parameters[v];
+
+ /* return the varying's name and length */
+ _mesa_copy_string(name, bufSize, length, varyingName);
+
+ /* return the datatype and value's size (in datatype units) */
+ if (type)
+ *type = param->DataType;
+ if (size)
+ *size = param->Size;
+ }
+ else {
+ name[0] = 0;
+ if (length)
+ *length = 0;
+ if (type)
+ *type = 0;
+ if (size)
+ *size = 0;
+ }
+}
+
diff --git a/src/mesa/main/transformfeedback.h b/src/mesa/main/transformfeedback.h
new file mode 100644
index 0000000000..e89cc41473
--- /dev/null
+++ b/src/mesa/main/transformfeedback.h
@@ -0,0 +1,71 @@
+/*
+ * Mesa 3-D graphics library
+ *
+ * Copyright (C) 2010 VMware, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef TRANSFORM_FEEDBACK_H
+#define TRANSFORM_FEEDBACK_H
+
+#include "glheader.h"
+
+
+extern GLboolean
+_mesa_validate_primitive_mode(GLcontext *ctx, GLenum mode);
+
+extern GLboolean
+_mesa_validate_transform_feedback_buffers(GLcontext *ctx);
+
+extern void
+_mesa_init_transform_feedback(GLcontext *ctx);
+
+extern void
+_mesa_free_transform_feedback(GLcontext *ctx);
+
+
+extern void GLAPIENTRY
+_mesa_BeginTransformFeedback(GLenum mode);
+
+extern void GLAPIENTRY
+_mesa_EndTransformFeedback(void);
+
+extern void GLAPIENTRY
+_mesa_BindBufferRange(GLenum target, GLuint index,
+ GLuint buffer, GLintptr offset, GLsizeiptr size);
+
+extern void GLAPIENTRY
+_mesa_BindBufferBase(GLenum target, GLuint index, GLuint buffer);
+
+extern void GLAPIENTRY
+_mesa_BindBufferOffsetEXT(GLenum target, GLuint index, GLuint buffer,
+ GLintptr offset);
+
+extern void GLAPIENTRY
+_mesa_TransformFeedbackVaryings(GLuint program, GLsizei count,
+ const GLchar **varyings, GLenum bufferMode);
+
+extern void GLAPIENTRY
+_mesa_GetTransformFeedbackVarying(GLuint program, GLuint index,
+ GLsizei bufSize, GLsizei *length,
+ GLsizei *size, GLenum *type, GLchar *name);
+
+
+#endif /* TRANSFORM_FEEDBACK_H */
diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h
index 2e1d70c461..59f62ebd6c 100644
--- a/src/mesa/main/version.h
+++ b/src/mesa/main/version.h
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 7.8
+ * Version: 7.9
*
* Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
* Copyright (C) 2009 VMware, Inc. All Rights Reserved.
@@ -33,9 +33,9 @@
/* Mesa version */
#define MESA_MAJOR 7
-#define MESA_MINOR 8
+#define MESA_MINOR 9
#define MESA_PATCH 0
-#define MESA_VERSION_STRING "7.8"
+#define MESA_VERSION_STRING "7.9-devel"
/* To make version comparison easy */
#define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
diff --git a/src/mesa/shader/prog_parameter.c b/src/mesa/shader/prog_parameter.c
index 25bb4f3d44..aac488c79a 100644
--- a/src/mesa/shader/prog_parameter.c
+++ b/src/mesa/shader/prog_parameter.c
@@ -376,7 +376,8 @@ _mesa_add_sampler(struct gl_program_parameter_list *paramList,
*/
GLint
_mesa_add_varying(struct gl_program_parameter_list *paramList,
- const char *name, GLuint size, GLbitfield flags)
+ const char *name, GLuint size, GLenum datatype,
+ GLbitfield flags)
{
GLint i = _mesa_lookup_parameter_index(paramList, -1, name);
if (i >= 0 && paramList->Parameters[i].Type == PROGRAM_VARYING) {
@@ -386,7 +387,7 @@ _mesa_add_varying(struct gl_program_parameter_list *paramList,
else {
/*assert(size == 4);*/
i = _mesa_add_parameter(paramList, PROGRAM_VARYING, name,
- size, GL_NONE, NULL, NULL, flags);
+ size, datatype, NULL, NULL, flags);
return i;
}
}
diff --git a/src/mesa/shader/prog_parameter.h b/src/mesa/shader/prog_parameter.h
index 1111c85976..cc3378ae20 100644
--- a/src/mesa/shader/prog_parameter.h
+++ b/src/mesa/shader/prog_parameter.h
@@ -146,7 +146,8 @@ _mesa_add_sampler(struct gl_program_parameter_list *paramList,
extern GLint
_mesa_add_varying(struct gl_program_parameter_list *paramList,
- const char *name, GLuint size, GLbitfield flags);
+ const char *name, GLuint size, GLenum datatype,
+ GLbitfield flags);
extern GLint
_mesa_add_attribute(struct gl_program_parameter_list *paramList,
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c
index 940fe2d03c..4ff032d4ec 100644
--- a/src/mesa/shader/shader_api.c
+++ b/src/mesa/shader/shader_api.c
@@ -123,6 +123,14 @@ _mesa_free_shader_program_data(GLcontext *ctx,
free(shProg->InfoLog);
shProg->InfoLog = NULL;
}
+
+ /* Transform feedback varying vars */
+ for (i = 0; i < shProg->TransformFeedback.NumVarying; i++) {
+ free(shProg->TransformFeedback.VaryingNames[i]);
+ }
+ free(shProg->TransformFeedback.VaryingNames);
+ shProg->TransformFeedback.VaryingNames = NULL;
+ shProg->TransformFeedback.NumVarying = 0;
}
@@ -397,6 +405,25 @@ get_shader_flags(void)
/**
+ * Find the length of the longest transform feedback varying name
+ * which was specified with glTransformFeedbackVaryings().
+ */
+static GLint
+longest_feedback_varying_name(const struct gl_shader_program *shProg)
+{
+ GLuint i;
+ GLint max = 0;
+ for (i = 0; i < shProg->TransformFeedback.NumVarying; i++) {
+ GLint len = strlen(shProg->TransformFeedback.VaryingNames[i]);
+ if (len > max)
+ max = len;
+ }
+ return max;
+}
+
+
+
+/**
* Initialize context's shader state.
*/
void
@@ -437,8 +464,9 @@ _mesa_free_shader_state(GLcontext *ctx)
* \param length returns number of chars copied
* \param dst the string destination
*/
-static void
-copy_string(GLchar *dst, GLsizei maxLength, GLsizei *length, const GLchar *src)
+void
+_mesa_copy_string(GLchar *dst, GLsizei maxLength,
+ GLsizei *length, const GLchar *src)
{
GLsizei len;
for (len = 0; len < maxLength - 1 && src && src[len]; len++)
@@ -754,8 +782,11 @@ _mesa_detach_shader(GLcontext *ctx, GLuint program, GLuint shader)
}
-static GLint
-sizeof_glsl_type(GLenum type)
+/**
+ * Return the size of the given GLSL datatype, in floats (components).
+ */
+GLint
+_mesa_sizeof_glsl_type(GLenum type)
{
switch (type) {
case GL_FLOAT:
@@ -800,7 +831,7 @@ sizeof_glsl_type(GLenum type)
case GL_FLOAT_MAT4x3:
return 16; /* four float[4] vectors */
default:
- _mesa_problem(NULL, "Invalid type in sizeof_glsl_type()");
+ _mesa_problem(NULL, "Invalid type in _mesa_sizeof_glsl_type()");
return 1;
}
}
@@ -879,11 +910,12 @@ _mesa_get_active_attrib(GLcontext *ctx, GLuint program, GLuint index,
return;
}
- copy_string(nameOut, maxLength, length, attribs->Parameters[index].Name);
+ _mesa_copy_string(nameOut, maxLength, length,
+ attribs->Parameters[index].Name);
if (size)
*size = attribs->Parameters[index].Size
- / sizeof_glsl_type(attribs->Parameters[index].DataType);
+ / _mesa_sizeof_glsl_type(attribs->Parameters[index].DataType);
if (type)
*type = attribs->Parameters[index].DataType;
@@ -954,11 +986,11 @@ _mesa_get_active_uniform(GLcontext *ctx, GLuint program, GLuint index,
param = &prog->Parameters->Parameters[progPos];
if (nameOut) {
- copy_string(nameOut, maxLength, length, param->Name);
+ _mesa_copy_string(nameOut, maxLength, length, param->Name);
}
if (size) {
- GLint typeSize = sizeof_glsl_type(param->DataType);
+ GLint typeSize = _mesa_sizeof_glsl_type(param->DataType);
if ((GLint) param->Size > typeSize) {
/* This is an array.
* Array elements are placed on vector[4] boundaries so they're
@@ -1063,6 +1095,17 @@ _mesa_get_programiv(GLcontext *ctx, GLuint program,
case GL_PROGRAM_BINARY_LENGTH_OES:
*params = 0;
break;
+#if FEATURE_EXT_transform_feedback
+ case GL_TRANSFORM_FEEDBACK_VARYINGS:
+ *params = shProg->TransformFeedback.NumVarying;
+ break;
+ case GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH:
+ *params = longest_feedback_varying_name(shProg) + 1;
+ break;
+ case GL_TRANSFORM_FEEDBACK_BUFFER_MODE:
+ *params = shProg->TransformFeedback.BufferMode;
+ break;
+#endif
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramiv(pname)");
return;
@@ -1112,7 +1155,7 @@ _mesa_get_program_info_log(GLcontext *ctx, GLuint program, GLsizei bufSize,
_mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramInfoLog(program)");
return;
}
- copy_string(infoLog, bufSize, length, shProg->InfoLog);
+ _mesa_copy_string(infoLog, bufSize, length, shProg->InfoLog);
}
@@ -1125,7 +1168,7 @@ _mesa_get_shader_info_log(GLcontext *ctx, GLuint shader, GLsizei bufSize,
_mesa_error(ctx, GL_INVALID_VALUE, "glGetShaderInfoLog(shader)");
return;
}
- copy_string(infoLog, bufSize, length, sh->InfoLog);
+ _mesa_copy_string(infoLog, bufSize, length, sh->InfoLog);
}
@@ -1141,7 +1184,7 @@ _mesa_get_shader_source(GLcontext *ctx, GLuint shader, GLsizei maxLength,
if (!sh) {
return;
}
- copy_string(sourceOut, maxLength, length, sh->Source);
+ _mesa_copy_string(sourceOut, maxLength, length, sh->Source);
}
@@ -1479,6 +1522,12 @@ _mesa_link_program(GLcontext *ctx, GLuint program)
if (!shProg)
return;
+ if (ctx->TransformFeedback.Active && shProg == ctx->Shader.CurrentProgram) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glLinkProgram(transform feedback active");
+ return;
+ }
+
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
_slang_link(ctx, program, shProg);
@@ -1543,6 +1592,12 @@ _mesa_use_program(GLcontext *ctx, GLuint program)
{
struct gl_shader_program *shProg;
+ if (ctx->TransformFeedback.Active) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glUseProgram(transform feedback active)");
+ return;
+ }
+
if (ctx->Shader.CurrentProgram &&
ctx->Shader.CurrentProgram->Name == program) {
/* no-op */
@@ -1731,7 +1786,7 @@ set_program_uniform(GLcontext *ctx, struct gl_program *program,
const GLboolean isUniformBool = is_boolean_type(param->DataType);
const GLboolean areIntValues = is_integer_type(type);
const GLint slots = (param->Size + 3) / 4;
- const GLint typeSize = sizeof_glsl_type(param->DataType);
+ const GLint typeSize = _mesa_sizeof_glsl_type(param->DataType);
GLsizei k, i;
if ((GLint) param->Size > typeSize) {
@@ -1920,7 +1975,7 @@ set_program_uniform_matrix(GLcontext *ctx, struct gl_program *program,
GLuint src = 0;
const struct gl_program_parameter * param = &program->Parameters->Parameters[index];
const GLuint slots = (param->Size + 3) / 4;
- const GLint typeSize = sizeof_glsl_type(param->DataType);
+ const GLint typeSize = _mesa_sizeof_glsl_type(param->DataType);
GLint nr, nc;
/* check that the number of rows, columns is correct */
diff --git a/src/mesa/shader/shader_api.h b/src/mesa/shader/shader_api.h
index d08d47373e..597f0b8e75 100644
--- a/src/mesa/shader/shader_api.h
+++ b/src/mesa/shader/shader_api.h
@@ -42,6 +42,15 @@ _mesa_init_shader_state(GLcontext * ctx);
extern void
_mesa_free_shader_state(GLcontext *ctx);
+
+extern void
+_mesa_copy_string(GLchar *dst, GLsizei maxLength,
+ GLsizei *length, const GLchar *src);
+
+extern GLint
+_mesa_sizeof_glsl_type(GLenum type);
+
+
/*
extern struct gl_shader_program *
_mesa_new_shader_program(GLcontext *ctx, GLuint name);
diff --git a/src/mesa/shader/slang/library/slang_common_builtin.gc b/src/mesa/shader/slang/library/slang_common_builtin.gc
index a25ca55bc4..d75354deff 100644
--- a/src/mesa/shader/slang/library/slang_common_builtin.gc
+++ b/src/mesa/shader/slang/library/slang_common_builtin.gc
@@ -605,7 +605,7 @@ float sqrt(const float x)
const float nx = -x;
float r;
__asm float_rsq r, x;
- __asm float_rcp r, r;
+ r = r * x;
__asm vec4_cmp __retVal, nx, r, 0.0;
}
@@ -615,8 +615,7 @@ vec2 sqrt(const vec2 x)
vec2 r;
__asm float_rsq r.x, x.x;
__asm float_rsq r.y, x.y;
- __asm float_rcp r.x, r.x;
- __asm float_rcp r.y, r.y;
+ r = r * x;
__asm vec4_cmp __retVal, nx, r, zero;
}
@@ -627,9 +626,7 @@ vec3 sqrt(const vec3 x)
__asm float_rsq r.x, x.x;
__asm float_rsq r.y, x.y;
__asm float_rsq r.z, x.z;
- __asm float_rcp r.x, r.x;
- __asm float_rcp r.y, r.y;
- __asm float_rcp r.z, r.z;
+ r = r * x;
__asm vec4_cmp __retVal, nx, r, zero;
}
@@ -641,10 +638,7 @@ vec4 sqrt(const vec4 x)
__asm float_rsq r.y, x.y;
__asm float_rsq r.z, x.z;
__asm float_rsq r.w, x.w;
- __asm float_rcp r.x, r.x;
- __asm float_rcp r.y, r.y;
- __asm float_rcp r.z, r.z;
- __asm float_rcp r.w, r.w;
+ r = r * x;
__asm vec4_cmp __retVal, nx, r, zero;
}
@@ -1166,7 +1160,7 @@ float length(const vec2 v)
float r;
const float p = dot(v, v); // p = v.x * v.x + v.y * v.y
__asm float_rsq r, p; // r = 1 / sqrt(p)
- __asm float_rcp __retVal.x, r; // retVal = 1 / r
+ __retVal = p * r; // p * r = sqrt(p);
}
float length(const vec3 v)
@@ -1174,7 +1168,7 @@ float length(const vec3 v)
float r;
const float p = dot(v, v); // p = v.x * v.x + v.y * v.y + v.z * v.z
__asm float_rsq r, p; // r = 1 / sqrt(p)
- __asm float_rcp __retVal, r; // retVal = 1 / r
+ __retVal = p * r; // p * r = sqrt(p);
}
float length(const vec4 v)
@@ -1182,7 +1176,7 @@ float length(const vec4 v)
float r;
const float p = dot(v, v); // p = v.x * v.x + v.y * v.y + ...
__asm float_rsq r, p; // r = 1 / sqrt(p)
- __asm float_rcp __retVal, r; // retVal = 1 / r
+ __retVal = p * r; // p * r = sqrt(p);
}
diff --git a/src/mesa/shader/slang/slang_builtin.c b/src/mesa/shader/slang/slang_builtin.c
index 791e751526..b7bf4e06dc 100644
--- a/src/mesa/shader/slang/slang_builtin.c
+++ b/src/mesa/shader/slang/slang_builtin.c
@@ -752,7 +752,6 @@ static const struct input_info fragInputs[] = {
{ "gl_Color", FRAG_ATTRIB_COL0, GL_FLOAT_VEC4, SWIZZLE_NOOP },
{ "gl_SecondaryColor", FRAG_ATTRIB_COL1, GL_FLOAT_VEC4, SWIZZLE_NOOP },
{ "gl_TexCoord", FRAG_ATTRIB_TEX0, GL_FLOAT_VEC4, SWIZZLE_NOOP },
- /* note: we're packing several quantities into the fogcoord vector */
{ "gl_FogFragCoord", FRAG_ATTRIB_FOGC, GL_FLOAT, SWIZZLE_XXXX },
{ "gl_FrontFacing", FRAG_ATTRIB_FACE, GL_FLOAT, SWIZZLE_XXXX },
{ "gl_PointCoord", FRAG_ATTRIB_PNTC, GL_FLOAT_VEC2, SWIZZLE_XYZW },
@@ -839,27 +838,28 @@ struct output_info
{
const char *Name;
GLuint Attrib;
+ GLenum Type;
};
/** Predefined vertex shader outputs */
static const struct output_info vertOutputs[] = {
- { "gl_Position", VERT_RESULT_HPOS },
- { "gl_FrontColor", VERT_RESULT_COL0 },
- { "gl_BackColor", VERT_RESULT_BFC0 },
- { "gl_FrontSecondaryColor", VERT_RESULT_COL1 },
- { "gl_BackSecondaryColor", VERT_RESULT_BFC1 },
- { "gl_TexCoord", VERT_RESULT_TEX0 },
- { "gl_FogFragCoord", VERT_RESULT_FOGC },
- { "gl_PointSize", VERT_RESULT_PSIZ },
- { NULL, 0 }
+ { "gl_Position", VERT_RESULT_HPOS, GL_FLOAT_VEC4 },
+ { "gl_FrontColor", VERT_RESULT_COL0, GL_FLOAT_VEC4 },
+ { "gl_BackColor", VERT_RESULT_BFC0, GL_FLOAT_VEC4 },
+ { "gl_FrontSecondaryColor", VERT_RESULT_COL1, GL_FLOAT_VEC4 },
+ { "gl_BackSecondaryColor", VERT_RESULT_BFC1, GL_FLOAT_VEC4 },
+ { "gl_TexCoord", VERT_RESULT_TEX0, GL_FLOAT_VEC4 },
+ { "gl_FogFragCoord", VERT_RESULT_FOGC, GL_FLOAT },
+ { "gl_PointSize", VERT_RESULT_PSIZ, GL_FLOAT },
+ { NULL, 0, GL_NONE }
};
/** Predefined fragment shader outputs */
static const struct output_info fragOutputs[] = {
- { "gl_FragColor", FRAG_RESULT_COLOR },
- { "gl_FragDepth", FRAG_RESULT_DEPTH },
- { "gl_FragData", FRAG_RESULT_DATA0 },
- { NULL, 0 }
+ { "gl_FragColor", FRAG_RESULT_COLOR, GL_FLOAT_VEC4 },
+ { "gl_FragDepth", FRAG_RESULT_DEPTH, GL_FLOAT },
+ { "gl_FragData", FRAG_RESULT_DATA0, GL_FLOAT_VEC4 },
+ { NULL, 0, GL_NONE }
};
@@ -895,3 +895,43 @@ _slang_output_index(const char *name, GLenum target)
}
return -1;
}
+
+
+/**
+ * Given a VERT_RESULT_x index, return the corresponding string name.
+ */
+const char *
+_slang_vertex_output_name(gl_vert_result index)
+{
+ if (index < Elements(vertOutputs))
+ return vertOutputs[index].Name;
+ else
+ return NULL;
+}
+
+
+/**
+ * Given a FRAG_RESULT_x index, return the corresponding string name.
+ */
+const char *
+_slang_fragment_output_name(gl_frag_result index)
+{
+ if (index < Elements(fragOutputs))
+ return fragOutputs[index].Name;
+ else
+ return NULL;
+}
+
+
+/**
+ * Given a VERT_RESULT_x index, return the corresponding varying
+ * var's datatype.
+ */
+GLenum
+_slang_vertex_output_type(gl_vert_result index)
+{
+ if (index < Elements(vertOutputs))
+ return vertOutputs[index].Type;
+ else
+ return GL_NONE;
+}
diff --git a/src/mesa/shader/slang/slang_builtin.h b/src/mesa/shader/slang/slang_builtin.h
index f814d11ac7..c3021ca33c 100644
--- a/src/mesa/shader/slang/slang_builtin.h
+++ b/src/mesa/shader/slang/slang_builtin.h
@@ -51,4 +51,14 @@ extern GLenum
_slang_vert_attrib_type(GLuint attrib);
+const char *
+_slang_vertex_output_name(gl_vert_result index);
+
+const char *
+_slang_fragment_output_name(gl_frag_result index);
+
+GLenum
+_slang_vertex_output_type(gl_vert_result index);
+
+
#endif /* SLANG_BUILTIN_H */
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index ecb2f6d5c1..fa79632c18 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -5130,7 +5130,7 @@ _slang_codegen_global_variable(slang_assemble_ctx *A, slang_variable *var,
flags |= PROG_PARAM_BIT_INVARIANT;
varyingLoc = _mesa_add_varying(prog->Varying, varName,
- totalSize, flags);
+ totalSize, GL_NONE, flags);
swizzle = _slang_var_swizzle(size, 0);
store = _slang_new_ir_storage_swz(PROGRAM_VARYING, varyingLoc,
totalSize, swizzle);
diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c
index 7c7bfbdbc5..f71fde1d72 100644
--- a/src/mesa/shader/slang/slang_link.c
+++ b/src/mesa/shader/slang/slang_link.c
@@ -87,6 +87,107 @@ bits_agree(GLbitfield flags1, GLbitfield flags2, GLbitfield bit)
/**
+ * Examine the outputs/varyings written by the vertex shader and
+ * append the names of those outputs onto the Varyings list.
+ * This will only capture the pre-defined/built-in varyings like
+ * gl_Position, not user-defined varyings.
+ */
+static void
+update_varying_var_list(GLcontext *ctx, struct gl_shader_program *shProg)
+{
+ if (shProg->VertexProgram) {
+ GLbitfield64 written = shProg->VertexProgram->Base.OutputsWritten;
+ GLuint i;
+ for (i = 0; written && i < VERT_RESULT_MAX; i++) {
+ if (written & BITFIELD64_BIT(i)) {
+ const char *name = _slang_vertex_output_name(i);
+ if (name)
+ _mesa_add_varying(shProg->Varying, name, 1, GL_FLOAT_VEC4, 0x0);
+ written &= ~BITFIELD64_BIT(i);
+ }
+ }
+ }
+}
+
+
+/**
+ * Do link error checking related to transform feedback.
+ */
+static GLboolean
+link_transform_feedback(GLcontext *ctx, struct gl_shader_program *shProg)
+{
+ GLbitfield varyingMask;
+ GLuint totalComps, maxComps, i;
+
+ if (shProg->TransformFeedback.NumVarying == 0) {
+ /* nothing to do */
+ return GL_TRUE;
+ }
+
+ /* Check that there's a vertex shader */
+ if (shProg->TransformFeedback.NumVarying > 0 &&
+ !shProg->VertexProgram) {
+ link_error(shProg, "Transform feedback without vertex shader");
+ return GL_FALSE;
+ }
+
+ /* Check that all named variables exist, and that none are duplicated.
+ * Also, build a count of the number of varying components to feedback.
+ */
+ totalComps = 0;
+ varyingMask = 0x0;
+ for (i = 0; i < shProg->TransformFeedback.NumVarying; i++) {
+ const GLchar *name = shProg->TransformFeedback.VaryingNames[i];
+ GLint v = _mesa_lookup_parameter_index(shProg->Varying, -1, name);
+ struct gl_program_parameter *p;
+
+ if (v < 0) {
+ char msg[100];
+ _mesa_snprintf(msg, sizeof(msg),
+ "vertex shader does not emit %s", name);
+ link_error(shProg, msg);
+ return GL_FALSE;
+ }
+
+ assert(v < MAX_VARYING);
+
+ /* already seen this varying name? */
+ if (varyingMask & (1 << v)) {
+ char msg[100];
+ _mesa_snprintf(msg, sizeof(msg),
+ "duplicated transform feedback varying name: %s",
+ name);
+ link_error(shProg, msg);
+ return GL_FALSE;
+ }
+
+ varyingMask |= (1 << v);
+
+ p = &shProg->Varying->Parameters[v];
+
+ totalComps += _mesa_sizeof_glsl_type(p->DataType);
+ }
+
+ if (shProg->TransformFeedback.BufferMode == GL_INTERLEAVED_ATTRIBS)
+ maxComps = ctx->Const.MaxTransformFeedbackInterleavedComponents;
+ else
+ maxComps = ctx->Const.MaxTransformFeedbackSeparateComponents;
+
+ /* check max varying components against the limit */
+ if (totalComps > maxComps) {
+ char msg[100];
+ _mesa_snprintf(msg, sizeof(msg),
+ "Too many feedback components: %u, max is %u",
+ totalComps, maxComps);
+ link_error(shProg, msg);
+ return GL_FALSE;
+ }
+
+ return GL_TRUE;
+}
+
+
+/**
* Linking varying vars involves rearranging varying vars so that the
* vertex program's output varyings matches the order of the fragment
* program's input varyings.
@@ -157,7 +258,7 @@ link_varying_vars(GLcontext *ctx,
else {
/* not already in linked list */
j = _mesa_add_varying(shProg->Varying, var->Name, var->Size,
- var->Flags);
+ var->DataType, var->Flags);
}
if (shProg->Varying->NumParameters > ctx->Const.MaxVarying) {
@@ -866,6 +967,12 @@ _slang_link(GLcontext *ctx,
}
}
+ update_varying_var_list(ctx, shProg);
+
+ /* checks related to transform feedback */
+ if (!link_transform_feedback(ctx, shProg)) {
+ return;
+ }
if (fragProg && shProg->FragmentProgram) {
/* Compute initial program's TexturesUsed info */
diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak
index 9f2e4e5157..f6d52b8e0f 100644
--- a/src/mesa/sources.mak
+++ b/src/mesa/sources.mak
@@ -80,6 +80,7 @@ MAIN_SOURCES = \
main/texrender.c \
main/texstate.c \
main/texstore.c \
+ main/transformfeedback.c \
main/varray.c \
main/version.c \
main/viewport.c \
@@ -88,6 +89,8 @@ MAIN_SOURCES = \
GLAPI_SOURCES = \
glapi/glapi.c \
glapi/glapi_dispatch.c \
+ glapi/glapi_entrypoint.c \
+ glapi/glapi_execmem.c \
glapi/glapi_getproc.c \
glapi/glapi_nop.c \
glapi/glthread.c
@@ -196,6 +199,7 @@ STATETRACKER_SOURCES = \
state_tracker/st_cb_condrender.c \
state_tracker/st_cb_flush.c \
state_tracker/st_cb_drawpixels.c \
+ state_tracker/st_cb_eglimage.c \
state_tracker/st_cb_fbo.c \
state_tracker/st_cb_feedback.c \
state_tracker/st_cb_program.c \
@@ -212,6 +216,7 @@ STATETRACKER_SOURCES = \
state_tracker/st_format.c \
state_tracker/st_framebuffer.c \
state_tracker/st_gen_mipmap.c \
+ state_tracker/st_manager.c \
state_tracker/st_mesa_to_tgsi.c \
state_tracker/st_program.c \
state_tracker/st_texture.c
diff --git a/src/mesa/sparc/glapi_sparc.S b/src/mesa/sparc/glapi_sparc.S
index 478adc6520..f256803894 100644
--- a/src/mesa/sparc/glapi_sparc.S
+++ b/src/mesa/sparc/glapi_sparc.S
@@ -1022,24 +1022,31 @@ gl_dispatch_functions_start:
GL_STUB(glIsEnabledIndexedEXT, _gloffset_IsEnabledIndexedEXT)
GL_STUB(glBeginConditionalRenderNV, _gloffset_BeginConditionalRenderNV)
GL_STUB(glEndConditionalRenderNV, _gloffset_EndConditionalRenderNV)
+ GL_STUB(glBeginTransformFeedbackEXT, _gloffset_BeginTransformFeedbackEXT)
+ GL_STUB(glBindBufferBaseEXT, _gloffset_BindBufferBaseEXT)
+ GL_STUB(glBindBufferOffsetEXT, _gloffset_BindBufferOffsetEXT)
+ GL_STUB(glBindBufferRangeEXT, _gloffset_BindBufferRangeEXT)
+ GL_STUB(glEndTransformFeedbackEXT, _gloffset_EndTransformFeedbackEXT)
+ GL_STUB(glGetTransformFeedbackVaryingEXT, _gloffset_GetTransformFeedbackVaryingEXT)
+ GL_STUB(glTransformFeedbackVaryingsEXT, _gloffset_TransformFeedbackVaryingsEXT)
GL_STUB(glProvokingVertexEXT, _gloffset_ProvokingVertexEXT)
- GL_STUB(gl_dispatch_stub_796, _gloffset_GetTexParameterPointervAPPLE)
- HIDDEN(gl_dispatch_stub_796)
- GL_STUB(gl_dispatch_stub_797, _gloffset_TextureRangeAPPLE)
- HIDDEN(gl_dispatch_stub_797)
+ GL_STUB(gl_dispatch_stub_803, _gloffset_GetTexParameterPointervAPPLE)
+ HIDDEN(gl_dispatch_stub_803)
+ GL_STUB(gl_dispatch_stub_804, _gloffset_TextureRangeAPPLE)
+ HIDDEN(gl_dispatch_stub_804)
GL_STUB(glGetObjectParameterivAPPLE, _gloffset_GetObjectParameterivAPPLE)
GL_STUB(glObjectPurgeableAPPLE, _gloffset_ObjectPurgeableAPPLE)
GL_STUB(glObjectUnpurgeableAPPLE, _gloffset_ObjectUnpurgeableAPPLE)
- GL_STUB(gl_dispatch_stub_801, _gloffset_StencilFuncSeparateATI)
- HIDDEN(gl_dispatch_stub_801)
- GL_STUB(gl_dispatch_stub_802, _gloffset_ProgramEnvParameters4fvEXT)
- HIDDEN(gl_dispatch_stub_802)
- GL_STUB(gl_dispatch_stub_803, _gloffset_ProgramLocalParameters4fvEXT)
- HIDDEN(gl_dispatch_stub_803)
- GL_STUB(gl_dispatch_stub_804, _gloffset_GetQueryObjecti64vEXT)
- HIDDEN(gl_dispatch_stub_804)
- GL_STUB(gl_dispatch_stub_805, _gloffset_GetQueryObjectui64vEXT)
- HIDDEN(gl_dispatch_stub_805)
+ GL_STUB(gl_dispatch_stub_808, _gloffset_StencilFuncSeparateATI)
+ HIDDEN(gl_dispatch_stub_808)
+ GL_STUB(gl_dispatch_stub_809, _gloffset_ProgramEnvParameters4fvEXT)
+ HIDDEN(gl_dispatch_stub_809)
+ GL_STUB(gl_dispatch_stub_810, _gloffset_ProgramLocalParameters4fvEXT)
+ HIDDEN(gl_dispatch_stub_810)
+ GL_STUB(gl_dispatch_stub_811, _gloffset_GetQueryObjecti64vEXT)
+ HIDDEN(gl_dispatch_stub_811)
+ GL_STUB(gl_dispatch_stub_812, _gloffset_GetQueryObjectui64vEXT)
+ HIDDEN(gl_dispatch_stub_812)
GL_STUB(glEGLImageTargetRenderbufferStorageOES, _gloffset_EGLImageTargetRenderbufferStorageOES)
GL_STUB(glEGLImageTargetTexture2DOES, _gloffset_EGLImageTargetTexture2DOES)
GL_STUB_ALIAS(glArrayElementEXT, glArrayElement)
@@ -1376,6 +1383,12 @@ gl_dispatch_functions_start:
GL_STUB_ALIAS(glIsRenderbuffer, glIsRenderbufferEXT)
GL_STUB_ALIAS(glRenderbufferStorage, glRenderbufferStorageEXT)
GL_STUB_ALIAS(glFramebufferTextureLayer, glFramebufferTextureLayerEXT)
+ GL_STUB_ALIAS(glBeginTransformFeedback, glBeginTransformFeedbackEXT)
+ GL_STUB_ALIAS(glBindBufferBase, glBindBufferBaseEXT)
+ GL_STUB_ALIAS(glBindBufferRange, glBindBufferRangeEXT)
+ GL_STUB_ALIAS(glEndTransformFeedback, glEndTransformFeedbackEXT)
+ GL_STUB_ALIAS(glGetTransformFeedbackVarying, glGetTransformFeedbackVaryingEXT)
+ GL_STUB_ALIAS(glTransformFeedbackVaryings, glTransformFeedbackVaryingsEXT)
GL_STUB_ALIAS(glProvokingVertex, glProvokingVertexEXT)
.globl gl_dispatch_functions_end
diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c
index 7806df4a53..cf391f1f91 100644
--- a/src/mesa/state_tracker/st_atom.c
+++ b/src/mesa/state_tracker/st_atom.c
@@ -34,8 +34,7 @@
#include "st_atom.h"
#include "st_cb_bitmap.h"
#include "st_program.h"
-
-#include "pipe/p_context.h"
+#include "st_manager.h"
/**
@@ -136,9 +135,7 @@ void st_validate_state( struct st_context *st )
check_program_state( st );
- if (st->pipe->screen->update_buffer)
- st->pipe->screen->update_buffer(st->pipe->screen,
- st->pipe->priv);
+ st_manager_validate_framebuffers(st);
if (state->st == 0)
return;
diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c
index fba7bfe2ce..79ad70909a 100644
--- a/src/mesa/state_tracker/st_atom_framebuffer.c
+++ b/src/mesa/state_tracker/st_atom_framebuffer.c
@@ -38,7 +38,6 @@
#include "st_texture.h"
#include "pipe/p_context.h"
#include "cso_cache/cso_context.h"
-#include "util/u_rect.h"
#include "util/u_math.h"
#include "util/u_inlines.h"
@@ -164,17 +163,10 @@ update_framebuffer_state( struct st_context *st )
(void) st_get_framebuffer_surface(stfb, ST_SURFACE_FRONT_LEFT, &surf_front);
(void) st_get_framebuffer_surface(stfb, ST_SURFACE_BACK_LEFT, &surf_back);
- if (st->pipe->surface_copy) {
- st->pipe->surface_copy(st->pipe,
- surf_front, 0, 0, /* dest */
- surf_back, 0, 0, /* src */
- fb->Width, fb->Height);
- } else {
- util_surface_copy(st->pipe, FALSE,
- surf_front, 0, 0,
- surf_back, 0, 0,
- fb->Width, fb->Height);
- }
+ st->pipe->surface_copy(st->pipe,
+ surf_front, 0, 0, /* dest */
+ surf_back, 0, 0, /* src */
+ fb->Width, fb->Height);
}
/* we're assuming we'll really draw to the front buffer */
st->frontbuffer_status = FRONT_STATUS_DIRTY;
diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c b/src/mesa/state_tracker/st_atom_pixeltransfer.c
index 0b2e3f5381..03e3336144 100644
--- a/src/mesa/state_tracker/st_atom_pixeltransfer.c
+++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c
@@ -138,7 +138,6 @@ static void
load_color_map_texture(GLcontext *ctx, struct pipe_texture *pt)
{
struct pipe_context *pipe = ctx->st->pipe;
- struct pipe_screen *screen = pipe->screen;
struct pipe_transfer *transfer;
const GLuint rSize = ctx->PixelMaps.RtoR.Size;
const GLuint gSize = ctx->PixelMaps.GtoG.Size;
@@ -151,7 +150,7 @@ load_color_map_texture(GLcontext *ctx, struct pipe_texture *pt)
transfer = st_cond_flush_get_tex_transfer(st_context(ctx),
pt, 0, 0, 0, PIPE_TRANSFER_WRITE,
0, 0, texSize, texSize);
- dest = (uint *) screen->transfer_map(screen, transfer);
+ dest = (uint *) pipe->transfer_map(pipe, transfer);
/* Pack four 1D maps into a 2D texture:
* R map is placed horizontally, indexed by S, in channel 0
@@ -172,8 +171,8 @@ load_color_map_texture(GLcontext *ctx, struct pipe_texture *pt)
}
}
- screen->transfer_unmap(screen, transfer);
- screen->tex_transfer_destroy(transfer);
+ pipe->transfer_unmap(pipe, transfer);
+ pipe->tex_transfer_destroy(pipe, transfer);
}
@@ -257,6 +256,8 @@ get_pixel_transfer_program(GLcontext *ctx, const struct state_key *key)
/* create the colormap/texture now if not already done */
if (!st->pixel_xfer.pixelmap_texture) {
st->pixel_xfer.pixelmap_texture = create_color_map_texture(ctx);
+ st->pixel_xfer.pixelmap_sampler_view = st_sampler_view_from_texture(ctx->st->pipe,
+ st->pixel_xfer.pixelmap_texture);
}
/* with a little effort, we can do four pixel map look-ups with
diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c
index 57b71c1e7b..241c001f94 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -56,7 +56,7 @@ update_textures(struct st_context *st)
/* loop over sampler units (aka tex image units) */
for (su = 0; su < st->ctx->Const.MaxTextureImageUnits; su++) {
- struct pipe_texture *pt = NULL;
+ struct pipe_sampler_view *sampler_view = NULL;
if (samplersUsed & (1 << su)) {
struct gl_texture_object *texObj;
@@ -84,7 +84,7 @@ update_textures(struct st_context *st)
st->state.num_textures = su + 1;
- pt = st_get_stobj_texture(stObj);
+ sampler_view = st_get_stobj_sampler_view(stObj);
}
/*
@@ -96,17 +96,17 @@ update_textures(struct st_context *st)
}
*/
- pipe_texture_reference(&st->state.sampler_texture[su], pt);
+ pipe_sampler_view_reference(&st->state.sampler_views[su], sampler_view);
}
- cso_set_sampler_textures(st->cso_context,
- st->state.num_textures,
- st->state.sampler_texture);
+ cso_set_fragment_sampler_views(st->cso_context,
+ st->state.num_textures,
+ st->state.sampler_views);
if (st->ctx->Const.MaxVertexTextureImageUnits > 0) {
- cso_set_vertex_sampler_textures(st->cso_context,
- MIN2(st->state.num_textures,
- st->ctx->Const.MaxVertexTextureImageUnits),
- st->state.sampler_texture);
+ cso_set_vertex_sampler_views(st->cso_context,
+ MIN2(st->state.num_textures,
+ st->ctx->Const.MaxVertexTextureImageUnits),
+ st->state.sampler_views);
}
}
diff --git a/src/mesa/state_tracker/st_cb_accum.c b/src/mesa/state_tracker/st_cb_accum.c
index 33e43ddcc4..01aba3e3dd 100644
--- a/src/mesa/state_tracker/st_cb_accum.c
+++ b/src/mesa/state_tracker/st_cb_accum.c
@@ -129,7 +129,6 @@ accum_accum(struct st_context *st, GLfloat value,
struct st_renderbuffer *color_strb)
{
struct pipe_context *pipe = st->pipe;
- struct pipe_screen *screen = pipe->screen;
struct pipe_transfer *color_trans;
size_t stride = acc_strb->stride;
GLubyte *data = acc_strb->data;
@@ -145,7 +144,7 @@ accum_accum(struct st_context *st, GLfloat value,
buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
- pipe_get_tile_rgba(color_trans, 0, 0, width, height, buf);
+ pipe_get_tile_rgba(pipe, color_trans, 0, 0, width, height, buf);
switch (acc_strb->format) {
case PIPE_FORMAT_R16G16B16A16_SNORM:
@@ -166,7 +165,7 @@ accum_accum(struct st_context *st, GLfloat value,
}
free(buf);
- screen->tex_transfer_destroy(color_trans);
+ pipe->tex_transfer_destroy(pipe, color_trans);
}
@@ -177,7 +176,6 @@ accum_load(struct st_context *st, GLfloat value,
struct st_renderbuffer *color_strb)
{
struct pipe_context *pipe = st->pipe;
- struct pipe_screen *screen = pipe->screen;
struct pipe_transfer *color_trans;
size_t stride = acc_strb->stride;
GLubyte *data = acc_strb->data;
@@ -194,7 +192,7 @@ accum_load(struct st_context *st, GLfloat value,
buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
- pipe_get_tile_rgba(color_trans, 0, 0, width, height, buf);
+ pipe_get_tile_rgba(pipe, color_trans, 0, 0, width, height, buf);
switch (acc_strb->format) {
case PIPE_FORMAT_R16G16B16A16_SNORM:
@@ -215,7 +213,7 @@ accum_load(struct st_context *st, GLfloat value,
}
free(buf);
- screen->tex_transfer_destroy(color_trans);
+ pipe->tex_transfer_destroy(pipe, color_trans);
}
@@ -226,7 +224,6 @@ accum_return(GLcontext *ctx, GLfloat value,
struct st_renderbuffer *color_strb)
{
struct pipe_context *pipe = ctx->st->pipe;
- struct pipe_screen *screen = pipe->screen;
const GLubyte *colormask = ctx->Color.ColorMask[0];
enum pipe_transfer_usage usage;
struct pipe_transfer *color_trans;
@@ -251,7 +248,7 @@ accum_return(GLcontext *ctx, GLfloat value,
width, height);
if (usage & PIPE_TRANSFER_READ)
- pipe_get_tile_rgba(color_trans, 0, 0, width, height, buf);
+ pipe_get_tile_rgba(pipe, color_trans, 0, 0, width, height, buf);
switch (acc_strb->format) {
case PIPE_FORMAT_R16G16B16A16_SNORM:
@@ -280,10 +277,10 @@ accum_return(GLcontext *ctx, GLfloat value,
_mesa_problem(NULL, "unexpected format in st_clear_accum_buffer()");
}
- pipe_put_tile_rgba(color_trans, 0, 0, width, height, buf);
+ pipe_put_tile_rgba(pipe, color_trans, 0, 0, width, height, buf);
free(buf);
- screen->tex_transfer_destroy(color_trans);
+ pipe->tex_transfer_destroy(pipe, color_trans);
}
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index 0332d4dbdf..9a0446bb71 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -259,7 +259,6 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
const GLubyte *bitmap)
{
struct pipe_context *pipe = ctx->st->pipe;
- struct pipe_screen *screen = pipe->screen;
struct pipe_transfer *transfer;
ubyte *dest;
struct pipe_texture *pt;
@@ -285,7 +284,7 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
PIPE_TRANSFER_WRITE,
0, 0, width, height);
- dest = screen->transfer_map(screen, transfer);
+ dest = pipe->transfer_map(pipe, transfer);
/* Put image into texture transfer */
memset(dest, 0xff, height * transfer->stride);
@@ -295,8 +294,8 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
_mesa_unmap_pbo_source(ctx, unpack);
/* Release transfer */
- screen->transfer_unmap(screen, transfer);
- screen->tex_transfer_destroy(transfer);
+ pipe->transfer_unmap(pipe, transfer);
+ pipe->tex_transfer_destroy(pipe, transfer);
return pt;
}
@@ -398,7 +397,7 @@ setup_bitmap_vertex_data(struct st_context *st,
static void
draw_bitmap_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
GLsizei width, GLsizei height,
- struct pipe_texture *pt,
+ struct pipe_sampler_view *sv,
const GLfloat *color)
{
struct st_context *st = ctx->st;
@@ -436,10 +435,11 @@ draw_bitmap_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
cso_save_rasterizer(cso);
cso_save_samplers(cso);
- cso_save_sampler_textures(cso);
+ cso_save_fragment_sampler_views(cso);
cso_save_viewport(cso);
cso_save_fragment_shader(cso);
cso_save_vertex_shader(cso);
+ cso_save_vertex_elements(cso);
/* rasterizer state: just scissor */
st->bitmap.rasterizer.scissor = ctx->Scissor.Enabled;
@@ -465,11 +465,11 @@ draw_bitmap_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
/* user textures, plus the bitmap texture */
{
- struct pipe_texture *textures[PIPE_MAX_SAMPLERS];
+ struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS];
uint num = MAX2(stfp->bitmap_sampler + 1, st->state.num_textures);
- memcpy(textures, st->state.sampler_texture, sizeof(textures));
- textures[stfp->bitmap_sampler] = pt;
- cso_set_sampler_textures(cso, num, textures);
+ memcpy(sampler_views, st->state.sampler_views, sizeof(sampler_views));
+ sampler_views[stfp->bitmap_sampler] = sv;
+ cso_set_fragment_sampler_views(cso, num, sampler_views);
}
/* viewport state: viewport matching window dims */
@@ -490,6 +490,8 @@ draw_bitmap_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
cso_set_viewport(cso, &vp);
}
+ cso_set_vertex_elements(cso, 3, st->velems_util_draw);
+
/* convert Z from [0,1] to [-1,-1] to match viewport Z scale/bias */
z = z * 2.0 - 1.0;
@@ -505,10 +507,11 @@ draw_bitmap_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
/* restore state */
cso_restore_rasterizer(cso);
cso_restore_samplers(cso);
- cso_restore_sampler_textures(cso);
+ cso_restore_fragment_sampler_views(cso);
cso_restore_viewport(cso);
cso_restore_fragment_shader(cso);
cso_restore_vertex_shader(cso);
+ cso_restore_vertex_elements(cso);
}
@@ -516,7 +519,6 @@ static void
reset_cache(struct st_context *st)
{
struct pipe_context *pipe = st->pipe;
- struct pipe_screen *screen = pipe->screen;
struct bitmap_cache *cache = st->bitmap.cache;
/*memset(cache->buffer, 0xff, sizeof(cache->buffer));*/
@@ -528,7 +530,7 @@ reset_cache(struct st_context *st)
cache->ymax = -1000000;
if (cache->trans) {
- screen->tex_transfer_destroy(cache->trans);
+ pipe->tex_transfer_destroy(pipe, cache->trans);
cache->trans = NULL;
}
@@ -566,7 +568,6 @@ static void
create_cache_trans(struct st_context *st)
{
struct pipe_context *pipe = st->pipe;
- struct pipe_screen *screen = pipe->screen;
struct bitmap_cache *cache = st->bitmap.cache;
if (cache->trans)
@@ -579,7 +580,7 @@ create_cache_trans(struct st_context *st)
PIPE_TRANSFER_WRITE, 0, 0,
BITMAP_CACHE_WIDTH,
BITMAP_CACHE_HEIGHT);
- cache->buffer = screen->transfer_map(screen, cache->trans);
+ cache->buffer = pipe->transfer_map(pipe, cache->trans);
/* init image to all 0xff */
memset(cache->buffer, 0xff, cache->trans->stride * BITMAP_CACHE_HEIGHT);
@@ -597,7 +598,7 @@ st_flush_bitmap_cache(struct st_context *st)
if (st->ctx->DrawBuffer) {
struct pipe_context *pipe = st->pipe;
- struct pipe_screen *screen = pipe->screen;
+ struct pipe_sampler_view *sv;
assert(cache->xmin <= cache->xmax);
@@ -613,20 +614,25 @@ st_flush_bitmap_cache(struct st_context *st)
if (cache->trans) {
if (0)
print_cache(cache);
- screen->transfer_unmap(screen, cache->trans);
+ pipe->transfer_unmap(pipe, cache->trans);
cache->buffer = NULL;
- screen->tex_transfer_destroy(cache->trans);
+ pipe->tex_transfer_destroy(pipe, cache->trans);
cache->trans = NULL;
}
- draw_bitmap_quad(st->ctx,
- cache->xpos,
- cache->ypos,
- cache->zpos,
- BITMAP_CACHE_WIDTH, BITMAP_CACHE_HEIGHT,
- cache->texture,
- cache->color);
+ sv = st_sampler_view_from_texture(st->pipe, cache->texture);
+ if (sv) {
+ draw_bitmap_quad(st->ctx,
+ cache->xpos,
+ cache->ypos,
+ cache->zpos,
+ BITMAP_CACHE_WIDTH, BITMAP_CACHE_HEIGHT,
+ sv,
+ cache->color);
+
+ pipe_sampler_view_reference(&sv, NULL);
+ }
}
/* release/free the texture */
@@ -749,10 +755,18 @@ st_Bitmap(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
pt = make_bitmap_texture(ctx, width, height, unpack, bitmap);
if (pt) {
+ struct pipe_sampler_view *sv = st_sampler_view_from_texture(st->pipe, pt);
+
assert(pt->target == PIPE_TEXTURE_2D);
- draw_bitmap_quad(ctx, x, y, ctx->Current.RasterPos[2],
- width, height, pt,
- st->ctx->Current.RasterColor);
+
+ if (sv) {
+ draw_bitmap_quad(ctx, x, y, ctx->Current.RasterPos[2],
+ width, height, sv,
+ st->ctx->Current.RasterColor);
+
+ pipe_sampler_view_reference(&sv, NULL);
+ }
+
/* release/free the texture */
pipe_texture_reference(&pt, NULL);
}
@@ -819,7 +833,6 @@ void
st_destroy_bitmap(struct st_context *st)
{
struct pipe_context *pipe = st->pipe;
- struct pipe_screen *screen = pipe->screen;
struct bitmap_cache *cache = st->bitmap.cache;
@@ -836,8 +849,8 @@ st_destroy_bitmap(struct st_context *st)
if (cache) {
if (cache->trans) {
- screen->transfer_unmap(screen, cache->trans);
- screen->tex_transfer_destroy(cache->trans);
+ pipe->transfer_unmap(pipe, cache->trans);
+ pipe->tex_transfer_destroy(pipe, cache->trans);
}
pipe_texture_reference(&st->bitmap.cache->texture, NULL);
free(st->bitmap.cache);
diff --git a/src/mesa/state_tracker/st_cb_blit.c b/src/mesa/state_tracker/st_cb_blit.c
index 36e03018d9..06b0a18fd2 100644
--- a/src/mesa/state_tracker/st_cb_blit.c
+++ b/src/mesa/state_tracker/st_cb_blit.c
@@ -69,6 +69,7 @@ st_BlitFramebuffer(GLcontext *ctx,
const GLbitfield depthStencil = (GL_DEPTH_BUFFER_BIT |
GL_STENCIL_BUFFER_BIT);
struct st_context *st = ctx->st;
+ struct pipe_context *pipe = st->pipe;
const uint pFilter = ((filter == GL_NEAREST)
? PIPE_TEX_MIPFILTER_NEAREST
: PIPE_TEX_MIPFILTER_LINEAR);
@@ -111,8 +112,8 @@ st_BlitFramebuffer(GLcontext *ctx,
&readFB->Attachment[readFB->_ColorReadBufferIndex];
if(srcAtt->Type == GL_TEXTURE) {
- struct pipe_screen *screen = ctx->st->pipe->screen;
- const struct st_texture_object *srcObj =
+ struct pipe_screen *screen = pipe->screen;
+ struct st_texture_object *srcObj =
st_texture_object(srcAtt->Texture);
struct st_renderbuffer *dstRb =
st_renderbuffer(drawFB->_ColorDrawBuffers[0]);
@@ -132,7 +133,8 @@ st_BlitFramebuffer(GLcontext *ctx,
return;
util_blit_pixels(st->blit,
- srcSurf, srcX0, srcY0, srcX1, srcY1,
+ srcSurf, st_get_stobj_sampler_view(srcObj),
+ srcX0, srcY0, srcX1, srcY1,
dstSurf, dstX0, dstY0, dstX1, dstY1,
0.0, pFilter);
@@ -144,10 +146,11 @@ st_BlitFramebuffer(GLcontext *ctx,
struct st_renderbuffer *dstRb =
st_renderbuffer(drawFB->_ColorDrawBuffers[0]);
struct pipe_surface *srcSurf = srcRb->surface;
+ struct pipe_sampler_view *srcView = st_renderbuffer_get_sampler_view(srcRb, pipe);
struct pipe_surface *dstSurf = dstRb->surface;
util_blit_pixels(st->blit,
- srcSurf, srcX0, srcY0, srcX1, srcY1,
+ srcSurf, srcView, srcX0, srcY0, srcX1, srcY1,
dstSurf, dstX0, dstY0, dstX1, dstY1,
0.0, pFilter);
}
@@ -179,11 +182,13 @@ st_BlitFramebuffer(GLcontext *ctx,
if ((mask & depthStencil) == depthStencil &&
srcDepthSurf == srcStencilSurf &&
dstDepthSurf == dstStencilSurf) {
+ struct pipe_sampler_view *srcView = st_renderbuffer_get_sampler_view(srcDepthRb, pipe);
+
/* Blitting depth and stencil values between combined
* depth/stencil buffers. This is the ideal case for such buffers.
*/
util_blit_pixels(st->blit,
- srcDepthSurf, srcX0, srcY0, srcX1, srcY1,
+ srcDepthSurf, srcView, srcX0, srcY0, srcX1, srcY1,
dstDepthSurf, dstX0, dstY0, dstX1, dstY1,
0.0, pFilter);
}
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c
index 9e66eed363..6007c76718 100644
--- a/src/mesa/state_tracker/st_cb_clear.c
+++ b/src/mesa/state_tracker/st_cb_clear.c
@@ -47,16 +47,19 @@
#include "st_inlines.h"
#include "pipe/p_context.h"
-#include "util/u_inlines.h"
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
#include "util/u_format.h"
+#include "util/u_inlines.h"
#include "util/u_simple_shaders.h"
#include "util/u_draw_quad.h"
#include "cso_cache/cso_context.h"
+/**
+ * Do per-context initialization for glClear.
+ */
void
st_init_clear(struct st_context *st)
{
@@ -67,8 +70,7 @@ st_init_clear(struct st_context *st)
st->clear.raster.gl_rasterization_rules = 1;
/* fragment shader state: color pass-through program */
- st->clear.fs =
- util_make_fragment_passthrough_shader(pipe);
+ st->clear.fs = util_make_fragment_passthrough_shader(pipe);
/* vertex shader state: color/position pass-through */
{
@@ -82,6 +84,9 @@ st_init_clear(struct st_context *st)
}
+/**
+ * Free per-context state for glClear.
+ */
void
st_destroy_clear(struct st_context *st)
{
@@ -131,7 +136,8 @@ draw_quad(GLcontext *ctx,
}
if (!st->clear.vbuf) {
- st->clear.vbuf = pipe_buffer_create(pipe->screen, 32, PIPE_BUFFER_USAGE_VERTEX,
+ st->clear.vbuf = pipe_buffer_create(pipe->screen, 32,
+ PIPE_BUFFER_USAGE_VERTEX,
max_slots * sizeof(st->clear.vertices));
}
@@ -160,7 +166,8 @@ draw_quad(GLcontext *ctx,
/* put vertex data into vbuf */
st_no_flush_pipe_buffer_write_nooverlap(st, st->clear.vbuf,
- st->clear.vbuf_slot * sizeof(st->clear.vertices),
+ st->clear.vbuf_slot
+ * sizeof(st->clear.vertices),
sizeof(st->clear.vertices),
st->clear.vertices);
@@ -213,6 +220,7 @@ clear_with_quad(GLcontext *ctx,
cso_save_clip(st->cso_context);
cso_save_fragment_shader(st->cso_context);
cso_save_vertex_shader(st->cso_context);
+ cso_save_vertex_elements(st->cso_context);
/* blend state: RGBA masking */
{
@@ -264,6 +272,8 @@ clear_with_quad(GLcontext *ctx,
cso_set_depth_stencil_alpha(st->cso_context, &depth_stencil);
}
+ cso_set_vertex_elements(st->cso_context, 2, st->velems_util_draw);
+
cso_set_rasterizer(st->cso_context, &st->clear.raster);
/* viewport state: viewport matching window dims */
@@ -286,7 +296,8 @@ clear_with_quad(GLcontext *ctx,
cso_set_vertex_shader_handle(st->cso_context, st->clear.vs);
/* draw quad matching scissor rect (XXX verify coord round-off) */
- draw_quad(ctx, x0, y0, x1, y1, (GLfloat) ctx->Depth.Clear, ctx->Color.ClearColor);
+ draw_quad(ctx, x0, y0, x1, y1,
+ (GLfloat) ctx->Depth.Clear, ctx->Color.ClearColor);
/* Restore pipe state */
cso_restore_blend(st->cso_context);
@@ -297,6 +308,7 @@ clear_with_quad(GLcontext *ctx,
cso_restore_clip(st->cso_context);
cso_restore_fragment_shader(st->cso_context);
cso_restore_vertex_shader(st->cso_context);
+ cso_restore_vertex_elements(st->cso_context);
}
@@ -311,18 +323,22 @@ check_clear_color_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
ctx->Scissor.Y != 0 ||
ctx->Scissor.Width < rb->Width ||
ctx->Scissor.Height < rb->Height))
- return TRUE;
+ return GL_TRUE;
if (!ctx->Color.ColorMask[0][0] ||
!ctx->Color.ColorMask[0][1] ||
!ctx->Color.ColorMask[0][2] ||
!ctx->Color.ColorMask[0][3])
- return TRUE;
+ return GL_TRUE;
- return FALSE;
+ return GL_FALSE;
}
+/**
+ * Determine if we need to clear the combiend depth/stencil buffer by
+ * drawing a quad.
+ */
static INLINE GLboolean
check_clear_depth_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
{
@@ -339,12 +355,12 @@ check_clear_depth_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
ctx->Scissor.Y != 0 ||
ctx->Scissor.Width < rb->Width ||
ctx->Scissor.Height < rb->Height))
- return TRUE;
+ return GL_TRUE;
if (maskStencil)
- return TRUE;
+ return GL_TRUE;
- return FALSE;
+ return GL_FALSE;
}
@@ -362,13 +378,12 @@ check_clear_depth_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
ctx->Scissor.Y != 0 ||
ctx->Scissor.Width < rb->Width ||
ctx->Scissor.Height < rb->Height))
- return TRUE;
+ return GL_TRUE;
- if (isDS &&
- ctx->DrawBuffer->Visual.stencilBits > 0)
- return TRUE;
+ if (isDS && ctx->DrawBuffer->Visual.stencilBits > 0)
+ return GL_TRUE;
- return FALSE;
+ return GL_FALSE;
}
@@ -389,30 +404,33 @@ check_clear_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
rb->Format == MESA_FORMAT_S8_Z24);
if (maskStencil)
- return TRUE;
+ return GL_TRUE;
if (ctx->Scissor.Enabled &&
(ctx->Scissor.X != 0 ||
ctx->Scissor.Y != 0 ||
ctx->Scissor.Width < rb->Width ||
ctx->Scissor.Height < rb->Height))
- return TRUE;
+ return GL_TRUE;
/* This is correct, but it is necessary to look at the depth clear
* value held in the surface when it comes time to issue the clear,
* rather than taking depth and stencil clear values from the
* current state.
*/
- if (isDS &&
- ctx->DrawBuffer->Visual.depthBits > 0)
- return TRUE;
+ if (isDS && ctx->DrawBuffer->Visual.depthBits > 0)
+ return GL_TRUE;
- return FALSE;
+ return GL_FALSE;
}
-void st_flush_clear( struct st_context *st )
+/**
+ * Called when we need to flush.
+ */
+void
+st_flush_clear(struct st_context *st)
{
/* Release vertex buffer to avoid synchronous rendering if we were
* to map it in the next frame.
@@ -425,10 +443,9 @@ void st_flush_clear( struct st_context *st )
/**
* Called via ctx->Driver.Clear()
- * XXX: doesn't pick up the differences between front/back/left/right
- * clears. Need to sort that out...
*/
-static void st_clear(GLcontext *ctx, GLbitfield mask)
+static void
+st_Clear(GLcontext *ctx, GLbitfield mask)
{
static const GLbitfield BUFFER_BITS_DS
= (BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL);
@@ -437,8 +454,8 @@ static void st_clear(GLcontext *ctx, GLbitfield mask)
= ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer;
struct gl_renderbuffer *stencilRb
= ctx->DrawBuffer->Attachment[BUFFER_STENCIL].Renderbuffer;
- GLbitfield quad_buffers = 0;
- GLbitfield clear_buffers = 0;
+ GLbitfield quad_buffers = 0x0;
+ GLbitfield clear_buffers = 0x0;
GLuint i;
/* This makes sure the pipe has the latest scissor, etc values */
@@ -523,7 +540,8 @@ static void st_clear(GLcontext *ctx, GLbitfield mask)
}
-void st_init_clear_functions(struct dd_function_table *functions)
+void
+st_init_clear_functions(struct dd_function_table *functions)
{
- functions->Clear = st_clear;
+ functions->Clear = st_Clear;
}
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index b937288f8c..85570541ef 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -59,7 +59,6 @@
#include "util/u_draw_quad.h"
#include "util/u_format.h"
#include "util/u_math.h"
-#include "util/u_rect.h"
#include "shader/prog_instruction.h"
#include "cso_cache/cso_context.h"
@@ -293,6 +292,51 @@ base_format(GLenum format)
/**
+ * Create a temporary texture to hold an image of the given size.
+ * If width, height are not POT and the driver only handles POT textures,
+ * allocate the next larger size of texture that is POT.
+ */
+static struct pipe_texture *
+alloc_texture(struct st_context *st, GLsizei width, GLsizei height,
+ enum pipe_format texFormat)
+{
+ struct pipe_context *pipe = st->pipe;
+ struct pipe_screen *screen = pipe->screen;
+ struct pipe_texture *pt;
+ int ptw, pth;
+
+ ptw = width;
+ pth = height;
+
+ /* Need to use POT texture? */
+ if (!screen->get_param(screen, PIPE_CAP_NPOT_TEXTURES)) {
+ int l2pt, maxSize;
+
+ l2pt = util_logbase2(width);
+ if (1 << l2pt != width) {
+ ptw = 1 << (l2pt + 1);
+ }
+
+ l2pt = util_logbase2(height);
+ if (1 << l2pt != height) {
+ pth = 1 << (l2pt + 1);
+ }
+
+ /* Check against maximum texture size */
+ maxSize = 1 << (pipe->screen->get_param(pipe->screen,
+ PIPE_CAP_MAX_TEXTURE_2D_LEVELS) - 1);
+ assert(ptw <= maxSize);
+ assert(pth <= maxSize);
+ }
+
+ pt = st_texture_create(st, PIPE_TEXTURE_2D, texFormat, 0,
+ ptw, pth, 1, PIPE_TEXTURE_USAGE_SAMPLER);
+
+ return pt;
+}
+
+
+/**
* Make texture containing an image for glDrawPixels image.
* If 'pixels' is NULL, leave the texture image data undefined.
*/
@@ -304,13 +348,11 @@ make_texture(struct st_context *st,
{
GLcontext *ctx = st->ctx;
struct pipe_context *pipe = st->pipe;
- struct pipe_screen *screen = pipe->screen;
gl_format mformat;
struct pipe_texture *pt;
enum pipe_format pipeFormat;
GLuint cpp;
GLenum baseFormat;
- int ptw, pth;
baseFormat = base_format(format);
@@ -325,29 +367,8 @@ make_texture(struct st_context *st,
if (!pixels)
return NULL;
- /* Need to use POT texture? */
- ptw = width;
- pth = height;
- if (!screen->get_param(screen, PIPE_CAP_NPOT_TEXTURES)) {
- int l2pt, maxSize;
-
- l2pt = util_logbase2(width);
- if (1<<l2pt != width) {
- ptw = 1<<(l2pt+1);
- }
- l2pt = util_logbase2(height);
- if (1<<l2pt != height) {
- pth = 1<<(l2pt+1);
- }
-
- /* Check against maximum texture size */
- maxSize = 1 << (pipe->screen->get_param(pipe->screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS) - 1);
- assert(ptw <= maxSize);
- assert(pth <= maxSize);
- }
-
- pt = st_texture_create(st, PIPE_TEXTURE_2D, pipeFormat, 0, ptw, pth, 1,
- PIPE_TEXTURE_USAGE_SAMPLER);
+ /* alloc temporary texture */
+ pt = alloc_texture(st, width, height, pipeFormat);
if (!pt) {
_mesa_unmap_pbo_source(ctx, unpack);
return NULL;
@@ -368,7 +389,7 @@ make_texture(struct st_context *st,
width, height);
/* map texture transfer */
- dest = screen->transfer_map(screen, transfer);
+ dest = pipe->transfer_map(pipe, transfer);
/* Put image into texture transfer.
@@ -388,8 +409,8 @@ make_texture(struct st_context *st,
unpack);
/* unmap */
- screen->transfer_unmap(screen, transfer);
- screen->tex_transfer_destroy(transfer);
+ pipe->transfer_unmap(pipe, transfer);
+ pipe->tex_transfer_destroy(pipe, transfer);
assert(success);
@@ -503,7 +524,7 @@ static void
draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
GLsizei width, GLsizei height,
GLfloat zoomX, GLfloat zoomY,
- struct pipe_texture *pt,
+ struct pipe_sampler_view *sv,
void *driver_vp,
void *driver_fp,
const GLfloat *color,
@@ -526,9 +547,10 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
cso_save_rasterizer(cso);
cso_save_viewport(cso);
cso_save_samplers(cso);
- cso_save_sampler_textures(cso);
+ cso_save_fragment_sampler_views(cso);
cso_save_fragment_shader(cso);
cso_save_vertex_shader(cso);
+ cso_save_vertex_elements(cso);
/* rasterizer state: just scissor */
{
@@ -581,15 +603,17 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
cso_set_viewport(cso, &vp);
}
+ cso_set_vertex_elements(cso, 3, st->velems_util_draw);
+
/* texture state: */
if (st->pixel_xfer.pixelmap_enabled) {
- struct pipe_texture *textures[2];
- textures[0] = pt;
- textures[1] = st->pixel_xfer.pixelmap_texture;
- pipe->set_fragment_sampler_textures(pipe, 2, textures);
+ struct pipe_sampler_view *sampler_views[2];
+ sampler_views[0] = sv;
+ sampler_views[1] = st->pixel_xfer.pixelmap_sampler_view;
+ cso_set_fragment_sampler_views(cso, 2, sampler_views);
}
else {
- pipe->set_fragment_sampler_textures(pipe, 1, &pt);
+ cso_set_fragment_sampler_views(cso, 1, &sv);
}
/* Compute Gallium window coords (y=0=top) with pixel zoom.
@@ -610,16 +634,17 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
z = z * 2.0 - 1.0;
draw_quad(ctx, x0, y0, z, x1, y1, color, invertTex,
- (GLfloat) width / pt->width0,
- (GLfloat) height / pt->height0);
+ (GLfloat) width / sv->texture->width0,
+ (GLfloat) height / sv->texture->height0);
/* restore state */
cso_restore_rasterizer(cso);
cso_restore_viewport(cso);
cso_restore_samplers(cso);
- cso_restore_sampler_textures(cso);
+ cso_restore_fragment_sampler_views(cso);
cso_restore_fragment_shader(cso);
cso_restore_vertex_shader(cso);
+ cso_restore_vertex_elements(cso);
}
@@ -631,7 +656,6 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
{
struct st_context *st = st_context(ctx);
struct pipe_context *pipe = st->pipe;
- struct pipe_screen *screen = pipe->screen;
struct st_renderbuffer *strb;
enum pipe_transfer_usage usage;
struct pipe_transfer *pt;
@@ -665,7 +689,7 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
usage, x, y,
width, height);
- stmap = screen->transfer_map(screen, pt);
+ stmap = pipe->transfer_map(pipe, pt);
pixels = _mesa_map_pbo_source(ctx, &clippedUnpack, pixels);
assert(pixels);
@@ -711,14 +735,14 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
/* now pack the stencil (and Z) values in the dest format */
switch (pt->texture->format) {
- case PIPE_FORMAT_S8_UNORM:
+ case PIPE_FORMAT_S8_USCALED:
{
ubyte *dest = stmap + spanY * pt->stride + spanX;
assert(usage == PIPE_TRANSFER_WRITE);
memcpy(dest, sValues, spanWidth);
}
break;
- case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
if (format == GL_DEPTH_STENCIL) {
uint *dest = (uint *) (stmap + spanY * pt->stride + spanX*4);
GLint k;
@@ -736,7 +760,7 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
}
}
break;
- case PIPE_FORMAT_S8Z24_UNORM:
+ case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
if (format == GL_DEPTH_STENCIL) {
uint *dest = (uint *) (stmap + spanY * pt->stride + spanX*4);
GLint k;
@@ -765,8 +789,8 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
_mesa_unmap_pbo_source(ctx, &clippedUnpack);
/* unmap the stencil buffer */
- screen->transfer_unmap(screen, pt);
- screen->tex_transfer_destroy(pt);
+ pipe->transfer_unmap(pipe, pt);
+ pipe->tex_transfer_destroy(pipe, pt);
}
@@ -810,12 +834,17 @@ st_DrawPixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
struct pipe_texture *pt
= make_texture(st, width, height, format, type, unpack, pixels);
if (pt) {
- draw_textured_quad(ctx, x, y, ctx->Current.RasterPos[2],
- width, height, ctx->Pixel.ZoomX, ctx->Pixel.ZoomY,
- pt,
- driver_vp,
- driver_fp,
- color, GL_FALSE);
+ struct pipe_sampler_view *sv = st_sampler_view_from_texture(st->pipe, pt);
+
+ if (sv) {
+ draw_textured_quad(ctx, x, y, ctx->Current.RasterPos[2],
+ width, height, ctx->Pixel.ZoomX, ctx->Pixel.ZoomY,
+ sv,
+ driver_vp,
+ driver_fp,
+ color, GL_FALSE);
+ pipe_sampler_view_reference(&sv, NULL);
+ }
pipe_texture_reference(&pt, NULL);
}
}
@@ -829,7 +858,7 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
GLint dstx, GLint dsty)
{
struct st_renderbuffer *rbDraw = st_renderbuffer(ctx->DrawBuffer->_StencilBuffer);
- struct pipe_screen *screen = ctx->st->pipe->screen;
+ struct pipe_context *pipe = ctx->st->pipe;
enum pipe_transfer_usage usage;
struct pipe_transfer *ptDraw;
ubyte *drawMap;
@@ -865,7 +894,7 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
assert(util_format_get_blockheight(ptDraw->texture->format) == 1);
/* map the stencil buffer */
- drawMap = screen->transfer_map(screen, ptDraw);
+ drawMap = pipe->transfer_map(pipe, ptDraw);
/* draw */
/* XXX PixelZoom not handled yet */
@@ -884,7 +913,7 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
src = buffer + i * width;
switch (ptDraw->texture->format) {
- case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
{
uint *dst4 = (uint *) dst;
int j;
@@ -895,7 +924,7 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
}
}
break;
- case PIPE_FORMAT_S8Z24_UNORM:
+ case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
{
uint *dst4 = (uint *) dst;
int j;
@@ -906,7 +935,7 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
}
}
break;
- case PIPE_FORMAT_S8_UNORM:
+ case PIPE_FORMAT_S8_USCALED:
assert(usage == PIPE_TRANSFER_WRITE);
memcpy(dst, src, width);
break;
@@ -918,8 +947,8 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
free(buffer);
/* unmap the stencil buffer */
- screen->transfer_unmap(screen, ptDraw);
- screen->tex_transfer_destroy(ptDraw);
+ pipe->transfer_unmap(pipe, ptDraw);
+ pipe->tex_transfer_destroy(pipe, ptDraw);
}
@@ -934,9 +963,9 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
struct st_renderbuffer *rbRead;
void *driver_vp, *driver_fp;
struct pipe_texture *pt;
+ struct pipe_sampler_view *sv;
GLfloat *color;
enum pipe_format srcFormat, texFormat;
- int ptw, pth;
GLboolean invertTex = GL_FALSE;
GLint readX, readY, readW, readH;
struct gl_pixelstore_attrib pack = ctx->DefaultPacking;
@@ -1007,33 +1036,17 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
readW = MAX2(0, readW);
readH = MAX2(0, readH);
- /* Need to use POT texture? */
- ptw = width;
- pth = height;
- if (!screen->get_param(screen, PIPE_CAP_NPOT_TEXTURES)) {
- int l2pt, maxSize;
-
- l2pt = util_logbase2(width);
- if (1<<l2pt != width) {
- ptw = 1<<(l2pt+1);
- }
- l2pt = util_logbase2(height);
- if (1<<l2pt != height) {
- pth = 1<<(l2pt+1);
- }
-
- /* Check against maximum texture size */
- maxSize = 1 << (pipe->screen->get_param(pipe->screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS) - 1);
- assert(ptw <= maxSize);
- assert(pth <= maxSize);
- }
-
- pt = st_texture_create(st, PIPE_TEXTURE_2D, texFormat, 0,
- ptw, pth, 1,
- PIPE_TEXTURE_USAGE_SAMPLER);
+ /* alloc temporary texture */
+ pt = alloc_texture(st, width, height, texFormat);
if (!pt)
return;
+ sv = st_sampler_view_from_texture(st->pipe, pt);
+ if (!sv) {
+ pipe_texture_reference(&pt, NULL);
+ return;
+ }
+
/* Make temporary texture which is a copy of the src region.
*/
if (srcFormat == texFormat) {
@@ -1043,24 +1056,17 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
PIPE_BUFFER_USAGE_GPU_READ);
struct pipe_surface *psTex = screen->get_tex_surface(screen, pt, 0, 0, 0,
PIPE_BUFFER_USAGE_GPU_WRITE );
- if (pipe->surface_copy) {
- pipe->surface_copy(pipe,
- psTex, /* dest surf */
- pack.SkipPixels, pack.SkipRows, /* dest pos */
- psRead, /* src surf */
- readX, readY, readW, readH); /* src region */
- } else {
- util_surface_copy(pipe, FALSE,
- psTex,
- pack.SkipPixels, pack.SkipRows,
- psRead,
- readX, readY, readW, readH);
- }
+
+ pipe->surface_copy(pipe,
+ psTex, /* dest surf */
+ pack.SkipPixels, pack.SkipRows, /* dest pos */
+ psRead, /* src surf */
+ readX, readY, readW, readH); /* src region */
if (0) {
/* debug */
- debug_dump_surface("copypixsrcsurf", psRead);
- debug_dump_surface("copypixtemptex", psTex);
+ debug_dump_surface(pipe, "copypixsrcsurf", psRead);
+ debug_dump_surface(pipe, "copypixtemptex", psTex);
}
pipe_surface_reference(&psRead, NULL);
@@ -1090,22 +1096,22 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
if (type == GL_COLOR) {
/* alternate path using get/put_tile() */
GLfloat *buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
- pipe_get_tile_rgba(ptRead, readX, readY, readW, readH, buf);
- pipe_put_tile_rgba(ptTex, pack.SkipPixels, pack.SkipRows,
+ pipe_get_tile_rgba(pipe, ptRead, readX, readY, readW, readH, buf);
+ pipe_put_tile_rgba(pipe, ptTex, pack.SkipPixels, pack.SkipRows,
readW, readH, buf);
free(buf);
}
else {
/* GL_DEPTH */
GLuint *buf = (GLuint *) malloc(width * height * sizeof(GLuint));
- pipe_get_tile_z(ptRead, readX, readY, readW, readH, buf);
- pipe_put_tile_z(ptTex, pack.SkipPixels, pack.SkipRows,
- readW, readH, buf);
+ pipe_get_tile_z(pipe, ptRead, readX, readY, readW, readH, buf);
+ pipe_put_tile_z(pipe, ptTex, pack.SkipPixels, pack.SkipRows,
+ readW, readH, buf);
free(buf);
}
- screen->tex_transfer_destroy(ptRead);
- screen->tex_transfer_destroy(ptTex);
+ pipe->tex_transfer_destroy(pipe, ptRead);
+ pipe->tex_transfer_destroy(pipe, ptTex);
}
/* OK, the texture 'pt' contains the src image/pixels. Now draw a
@@ -1113,12 +1119,13 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
*/
draw_textured_quad(ctx, dstx, dsty, ctx->Current.RasterPos[2],
width, height, ctx->Pixel.ZoomX, ctx->Pixel.ZoomY,
- pt,
+ sv,
driver_vp,
driver_fp,
color, invertTex);
pipe_texture_reference(&pt, NULL);
+ pipe_sampler_view_reference(&sv, NULL);
}
diff --git a/src/mesa/state_tracker/st_cb_eglimage.c b/src/mesa/state_tracker/st_cb_eglimage.c
new file mode 100644
index 0000000000..935b29a324
--- /dev/null
+++ b/src/mesa/state_tracker/st_cb_eglimage.c
@@ -0,0 +1,160 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.9
+ *
+ * Copyright (C) 2010 LunarG Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Chia-I Wu <olv@lunarg.com>
+ */
+
+#include "main/texobj.h"
+#include "main/texfetch.h"
+#include "main/teximage.h"
+#include "util/u_inlines.h"
+#include "util/u_format.h"
+#include "st_cb_eglimage.h"
+#include "st_cb_fbo.h"
+#include "st_texture.h"
+#include "st_format.h"
+#include "st_manager.h"
+
+#if FEATURE_OES_EGL_image
+
+/**
+ * Return the base format just like _mesa_base_fbo_format does.
+ */
+static GLenum
+st_pipe_format_to_base_format(enum pipe_format format)
+{
+ GLenum base_format;
+
+ if (util_format_is_depth_or_stencil(format)) {
+ if (util_format_is_depth_and_stencil(format)) {
+ base_format = GL_DEPTH_STENCIL;
+ }
+ else {
+ if (format == PIPE_FORMAT_S8_USCALED)
+ base_format = GL_STENCIL_INDEX;
+ else
+ base_format = GL_DEPTH_COMPONENT;
+ }
+ }
+ else {
+ /* is this enough? */
+ if (util_format_has_alpha(format))
+ base_format = GL_RGBA;
+ else
+ base_format = GL_RGB;
+ }
+
+ return base_format;
+}
+
+static void
+st_egl_image_target_renderbuffer_storage(GLcontext *ctx,
+ struct gl_renderbuffer *rb,
+ GLeglImageOES image_handle)
+{
+ struct st_context *st = ctx->st;
+ struct st_renderbuffer *strb = st_renderbuffer(rb);
+ struct pipe_surface *ps;
+ unsigned usage;
+
+ usage = PIPE_BUFFER_USAGE_GPU_READ | PIPE_BUFFER_USAGE_GPU_WRITE;
+ ps = st_manager_get_egl_image_surface(st, (void *) image_handle, usage);
+ if (ps) {
+ strb->Base.Width = ps->width;
+ strb->Base.Height = ps->height;
+ strb->Base.Format = st_pipe_format_to_mesa_format(ps->format);
+ strb->Base.DataType = st_format_datatype(ps->format);
+ strb->Base._BaseFormat = st_pipe_format_to_base_format(ps->format);
+ strb->Base.InternalFormat = strb->Base._BaseFormat;
+
+ pipe_surface_reference(&strb->surface, ps);
+ pipe_texture_reference(&strb->texture, ps->texture);
+
+ pipe_surface_reference(&ps, NULL);
+ }
+}
+
+static void
+st_bind_surface(GLcontext *ctx, GLenum target,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage,
+ struct pipe_surface *ps)
+{
+ struct st_texture_object *stObj;
+ struct st_texture_image *stImage;
+ GLenum internalFormat;
+
+ /* map pipe format to base format */
+ if (util_format_get_component_bits(ps->format, UTIL_FORMAT_COLORSPACE_RGB, 3) > 0)
+ internalFormat = GL_RGBA;
+ else
+ internalFormat = GL_RGB;
+
+ stObj = st_texture_object(texObj);
+ stImage = st_texture_image(texImage);
+
+ /* switch to surface based */
+ if (!stObj->surface_based) {
+ _mesa_clear_texture_object(ctx, texObj);
+ stObj->surface_based = GL_TRUE;
+ }
+
+ _mesa_init_teximage_fields(ctx, target, texImage,
+ ps->width, ps->height, 1, 0, internalFormat);
+ texImage->TexFormat = st_pipe_format_to_mesa_format(ps->format);
+ _mesa_set_fetch_functions(texImage, 2);
+
+ stObj->pipe = ctx->st->pipe;
+ /* FIXME create a non-default sampler view from the pipe_surface? */
+ pipe_texture_reference(&stImage->pt, ps->texture);
+
+ _mesa_dirty_texobj(ctx, texObj, GL_TRUE);
+}
+
+static void
+st_egl_image_target_texture_2d(GLcontext *ctx, GLenum target,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage,
+ GLeglImageOES image_handle)
+{
+ struct st_context *st = ctx->st;
+ struct pipe_surface *ps;
+ unsigned usage;
+
+ usage = PIPE_BUFFER_USAGE_GPU_READ | PIPE_BUFFER_USAGE_GPU_WRITE;
+ ps = st_manager_get_egl_image_surface(st, (void *) image_handle, usage);
+ if (ps) {
+ st_bind_surface(ctx, target, texObj, texImage, ps);
+ pipe_surface_reference(&ps, NULL);
+ }
+}
+
+void
+st_init_eglimage_functions(struct dd_function_table *functions)
+{
+ functions->EGLImageTargetTexture2D = st_egl_image_target_texture_2d;
+ functions->EGLImageTargetRenderbufferStorage = st_egl_image_target_renderbuffer_storage;
+}
+
+#endif /* FEATURE_OES_EGL_image */
diff --git a/src/mesa/state_tracker/st_cb_eglimage.h b/src/mesa/state_tracker/st_cb_eglimage.h
new file mode 100644
index 0000000000..77e668d919
--- /dev/null
+++ b/src/mesa/state_tracker/st_cb_eglimage.h
@@ -0,0 +1,48 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.9
+ *
+ * Copyright (C) 2010 LunarG Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Chia-I Wu <olv@lunarg.com>
+ */
+
+#ifndef ST_CB_EGLIMAGE_H
+#define ST_CB_EGLIMAGE_H
+
+#include "main/mtypes.h"
+#include "main/dd.h"
+
+#if FEATURE_OES_EGL_image
+
+extern void
+st_init_eglimage_functions(struct dd_function_table *functions);
+
+#else
+
+static INLINE void
+st_init_eglimage_functions(struct dd_function_table *functions)
+{
+}
+
+#endif
+
+#endif /* ST_CB_EGLIMAGE_H */
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index 00e9d1dccb..542ab38a50 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -48,9 +48,9 @@
#include "st_format.h"
#include "st_public.h"
#include "st_texture.h"
+#include "st_manager.h"
#include "util/u_format.h"
-#include "util/u_rect.h"
#include "util/u_inlines.h"
@@ -103,6 +103,7 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
*/
pipe_surface_reference( &strb->surface, NULL );
pipe_texture_reference( &strb->texture, NULL );
+ pipe_sampler_view_reference(&strb->sampler_view, NULL);
/* Setup new texture template.
*/
@@ -162,6 +163,7 @@ st_renderbuffer_delete(struct gl_renderbuffer *rb)
ASSERT(strb);
pipe_surface_reference(&strb->surface, NULL);
pipe_texture_reference(&strb->texture, NULL);
+ pipe_sampler_view_reference(&strb->sampler_view, NULL);
free(strb->data);
free(strb);
}
@@ -253,13 +255,13 @@ st_new_renderbuffer_fb(enum pipe_format format, int samples, boolean sw)
case PIPE_FORMAT_Z32_UNORM:
strb->Base.InternalFormat = GL_DEPTH_COMPONENT32;
break;
- case PIPE_FORMAT_Z24S8_UNORM:
- case PIPE_FORMAT_S8Z24_UNORM:
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
+ case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
case PIPE_FORMAT_Z24X8_UNORM:
case PIPE_FORMAT_X8Z24_UNORM:
strb->Base.InternalFormat = GL_DEPTH24_STENCIL8_EXT;
break;
- case PIPE_FORMAT_S8_UNORM:
+ case PIPE_FORMAT_S8_USCALED:
strb->Base.InternalFormat = GL_STENCIL_INDEX8_EXT;
break;
case PIPE_FORMAT_R16G16B16A16_SNORM:
@@ -368,6 +370,8 @@ st_render_texture(GLcontext *ctx,
pipe_surface_reference(&strb->surface, NULL);
+ pipe_sampler_view_reference(&strb->sampler_view, st_get_stobj_sampler_view(stObj));
+
assert(strb->rtt_level <= strb->texture->last_level);
/* new surface for rendering into the texture */
@@ -379,6 +383,8 @@ st_render_texture(GLcontext *ctx,
PIPE_BUFFER_USAGE_GPU_READ |
PIPE_BUFFER_USAGE_GPU_WRITE);
+ strb->format = pt->format;
+
strb->Base.Format = st_pipe_format_to_mesa_format(pt->format);
strb->Base.DataType = st_format_datatype(pt->format);
@@ -511,17 +517,10 @@ copy_back_to_front(struct st_context *st,
(void) st_get_framebuffer_surface(stfb, backIndex, &surf_back);
if (surf_front && surf_back) {
- if (st->pipe->surface_copy) {
- st->pipe->surface_copy(st->pipe,
- surf_front, 0, 0, /* dest */
- surf_back, 0, 0, /* src */
- fb->Width, fb->Height);
- } else {
- util_surface_copy(st->pipe, FALSE,
- surf_front, 0, 0,
- surf_back, 0, 0,
- fb->Width, fb->Height);
- }
+ st->pipe->surface_copy(st->pipe,
+ surf_front, 0, 0, /* dest */
+ surf_back, 0, 0, /* src */
+ fb->Width, fb->Height);
}
}
@@ -612,8 +611,18 @@ check_create_front_buffers(GLcontext *ctx, struct gl_framebuffer *fb)
static void
st_DrawBuffers(GLcontext *ctx, GLsizei count, const GLenum *buffers)
{
+ GLframebuffer *fb = ctx->DrawBuffer;
+ GLuint i;
+
(void) count;
(void) buffers;
+
+ /* add the renderbuffers on demand */
+ for (i = 0; i < fb->_NumColorDrawBuffers; i++) {
+ gl_buffer_index idx = fb->_ColorDrawBufferIndexes[i];
+ st_manager_add_color_renderbuffer(ctx->st, fb, idx);
+ }
+
check_create_front_buffers(ctx, ctx->DrawBuffer);
}
@@ -624,8 +633,13 @@ st_DrawBuffers(GLcontext *ctx, GLsizei count, const GLenum *buffers)
static void
st_ReadBuffer(GLcontext *ctx, GLenum buffer)
{
+ GLframebuffer *fb = ctx->ReadBuffer;
+
(void) buffer;
- check_create_front_buffers(ctx, ctx->ReadBuffer);
+
+ /* add the renderbuffer on demand */
+ st_manager_add_color_renderbuffer(ctx->st, fb, fb->_ColorReadBufferIndex);
+ check_create_front_buffers(ctx, fb);
}
@@ -645,3 +659,14 @@ void st_init_fbo_functions(struct dd_function_table *functions)
functions->DrawBuffers = st_DrawBuffers;
functions->ReadBuffer = st_ReadBuffer;
}
+
+struct pipe_sampler_view *
+st_renderbuffer_get_sampler_view(struct st_renderbuffer *rb,
+ struct pipe_context *pipe)
+{
+ if (!rb->sampler_view) {
+ rb->sampler_view = st_sampler_view_from_texture(pipe, rb->texture);
+ }
+
+ return rb->sampler_view;
+}
diff --git a/src/mesa/state_tracker/st_cb_fbo.h b/src/mesa/state_tracker/st_cb_fbo.h
index bea6eb89c3..7a45a608fe 100644
--- a/src/mesa/state_tracker/st_cb_fbo.h
+++ b/src/mesa/state_tracker/st_cb_fbo.h
@@ -39,6 +39,7 @@ struct st_renderbuffer
struct gl_renderbuffer Base;
struct pipe_texture *texture;
struct pipe_surface *surface; /* temporary view into texture */
+ struct pipe_sampler_view *sampler_view;
enum pipe_format format; /** preferred format, or PIPE_FORMAT_NONE */
GLboolean defined; /**< defined contents? */
@@ -55,6 +56,7 @@ struct st_renderbuffer
/** Render to texture state */
struct pipe_texture *texture_save;
struct pipe_surface *surface_save;
+ struct pipe_sampler_view *sampler_view_save;
};
@@ -71,5 +73,9 @@ st_new_renderbuffer_fb(enum pipe_format format, int samples, boolean sw);
extern void
st_init_fbo_functions(struct dd_function_table *functions);
+extern struct pipe_sampler_view *
+st_renderbuffer_get_sampler_view(struct st_renderbuffer *rb,
+ struct pipe_context *pipe);
+
#endif /* ST_CB_FBO_H */
diff --git a/src/mesa/state_tracker/st_cb_flush.c b/src/mesa/state_tracker/st_cb_flush.c
index 1329f807bc..30e7afcf2a 100644
--- a/src/mesa/state_tracker/st_cb_flush.c
+++ b/src/mesa/state_tracker/st_cb_flush.c
@@ -40,6 +40,7 @@
#include "st_cb_clear.h"
#include "st_cb_fbo.h"
#include "st_public.h"
+#include "st_manager.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_screen.h"
@@ -74,12 +75,9 @@ display_front_buffer(struct st_context *st)
= st_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer);
if (strb) {
- struct pipe_surface *front_surf = strb->surface;
-
/* Hook for copying "fake" frontbuffer if necessary:
*/
- st->pipe->screen->flush_frontbuffer( st->pipe->screen, front_surf,
- st->pipe->priv );
+ st_manager_flush_frontbuffer(st);
/*
st->frontbuffer_status = FRONT_STATUS_UNDEFINED;
diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c
index 952d9ce915..10795ee9e4 100644
--- a/src/mesa/state_tracker/st_cb_readpixels.c
+++ b/src/mesa/state_tracker/st_cb_readpixels.c
@@ -45,6 +45,7 @@
#include "st_debug.h"
#include "st_context.h"
+#include "st_atom.h"
#include "st_cb_readpixels.h"
#include "st_cb_fbo.h"
#include "st_public.h"
@@ -63,7 +64,7 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
GLvoid *pixels)
{
struct gl_framebuffer *fb = ctx->ReadBuffer;
- struct pipe_screen *screen = ctx->st->pipe->screen;
+ struct pipe_context *pipe = ctx->st->pipe;
struct st_renderbuffer *strb = st_renderbuffer(fb->_StencilBuffer);
struct pipe_transfer *pt;
ubyte *stmap;
@@ -81,7 +82,7 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
width, height);
/* map the stencil buffer */
- stmap = screen->transfer_map(screen, pt);
+ stmap = pipe->transfer_map(pipe, pt);
/* width should never be > MAX_WIDTH since we did clipping earlier */
ASSERT(width <= MAX_WIDTH);
@@ -102,13 +103,13 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
/* get stencil (and Z) values */
switch (pt->texture->format) {
- case PIPE_FORMAT_S8_UNORM:
+ case PIPE_FORMAT_S8_USCALED:
{
const ubyte *src = stmap + srcY * pt->stride;
memcpy(sValues, src, width);
}
break;
- case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
if (format == GL_DEPTH_STENCIL) {
const uint *src = (uint *) (stmap + srcY * pt->stride);
const GLfloat scale = 1.0f / (0xffffff);
@@ -126,7 +127,7 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
}
}
break;
- case PIPE_FORMAT_S8Z24_UNORM:
+ case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
if (format == GL_DEPTH_STENCIL) {
const uint *src = (uint *) (stmap + srcY * pt->stride);
const GLfloat scale = 1.0f / (0xffffff);
@@ -161,8 +162,8 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
}
/* unmap the stencil buffer */
- screen->transfer_unmap(screen, pt);
- screen->tex_transfer_destroy(pt);
+ pipe->transfer_unmap(pipe, pt);
+ pipe->tex_transfer_destroy(pipe, pt);
}
@@ -234,13 +235,13 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb,
{
struct pipe_context *pipe = ctx->st->pipe;
- struct pipe_screen *screen = pipe->screen;
struct pipe_transfer *trans;
const GLubyte *map;
GLubyte *dst;
GLint row, col, dy, dstStride;
if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
+ /* convert GL Y to Gallium Y */
y = strb->texture->height0 - y - height;
}
@@ -252,17 +253,22 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb,
return GL_FALSE;
}
- map = screen->transfer_map(screen, trans);
+ map = pipe->transfer_map(pipe, trans);
if (!map) {
- screen->tex_transfer_destroy(trans);
+ pipe->tex_transfer_destroy(pipe, trans);
return GL_FALSE;
}
+ /* We always write to the user/dest buffer from low addr to high addr
+ * but the read order depends on renderbuffer orientation
+ */
if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
+ /* read source rows from bottom to top */
y = height - 1;
dy = -1;
}
else {
+ /* read source rows from top to bottom */
y = 0;
dy = 1;
}
@@ -311,8 +317,8 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb,
; /* nothing */
}
- screen->transfer_unmap(screen, trans);
- screen->tex_transfer_destroy(trans);
+ pipe->transfer_unmap(pipe, trans);
+ pipe->tex_transfer_destroy(pipe, trans);
}
return GL_TRUE;
@@ -331,7 +337,6 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
GLvoid *dest)
{
struct pipe_context *pipe = ctx->st->pipe;
- struct pipe_screen *screen = pipe->screen;
GLfloat temp[MAX_WIDTH][4];
const GLbitfield transferOps = ctx->_ImageTransferState;
GLsizei i, j;
@@ -346,6 +351,8 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
/* XXX convolution not done yet */
assert((transferOps & IMAGE_CONVOLUTION_BIT) == 0);
+ st_validate_state(ctx->st);
+
/* Do all needed clipping here, so that we can forget about it later */
if (!_mesa_clip_readpixels(ctx, &x, &y, &width, &height, &clippedPacking)) {
/* The ReadPixels transfer is totally outside the window bounds */
@@ -396,6 +403,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
}
if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
+ /* convert GL Y to Gallium Y */
y = strb->Base.Height - y - height;
}
@@ -429,14 +437,14 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
const GLint dstStride = _mesa_image_row_stride(&clippedPacking, width,
format, type);
- if (trans->texture->format == PIPE_FORMAT_Z24S8_UNORM ||
+ if (trans->texture->format == PIPE_FORMAT_Z24_UNORM_S8_USCALED ||
trans->texture->format == PIPE_FORMAT_Z24X8_UNORM) {
if (format == GL_DEPTH_COMPONENT) {
for (i = 0; i < height; i++) {
GLuint ztemp[MAX_WIDTH];
GLfloat zfloat[MAX_WIDTH];
const double scale = 1.0 / ((1 << 24) - 1);
- pipe_get_tile_raw(trans, 0, y, width, 1, ztemp, 0);
+ pipe_get_tile_raw(pipe, trans, 0, y, width, 1, ztemp, 0);
y += yStep;
for (j = 0; j < width; j++) {
zfloat[j] = (float) (scale * (ztemp[j] & 0xffffff));
@@ -451,7 +459,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
assert(format == GL_DEPTH_STENCIL_EXT);
for (i = 0; i < height; i++) {
GLuint *zshort = (GLuint *)dst;
- pipe_get_tile_raw(trans, 0, y, width, 1, dst, 0);
+ pipe_get_tile_raw(pipe, trans, 0, y, width, 1, dst, 0);
y += yStep;
/* Reverse into 24/8 */
for (j = 0; j < width; j++) {
@@ -461,14 +469,14 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
}
}
}
- else if (trans->texture->format == PIPE_FORMAT_S8Z24_UNORM ||
+ else if (trans->texture->format == PIPE_FORMAT_S8_USCALED_Z24_UNORM ||
trans->texture->format == PIPE_FORMAT_X8Z24_UNORM) {
if (format == GL_DEPTH_COMPONENT) {
for (i = 0; i < height; i++) {
GLuint ztemp[MAX_WIDTH];
GLfloat zfloat[MAX_WIDTH];
const double scale = 1.0 / ((1 << 24) - 1);
- pipe_get_tile_raw(trans, 0, y, width, 1, ztemp, 0);
+ pipe_get_tile_raw(pipe, trans, 0, y, width, 1, ztemp, 0);
y += yStep;
for (j = 0; j < width; j++) {
zfloat[j] = (float) (scale * ((ztemp[j] >> 8) & 0xffffff));
@@ -482,7 +490,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
/* XXX: unreachable code -- should be before st_read_stencil_pixels */
assert(format == GL_DEPTH_STENCIL_EXT);
for (i = 0; i < height; i++) {
- pipe_get_tile_raw(trans, 0, y, width, 1, dst, 0);
+ pipe_get_tile_raw(pipe, trans, 0, y, width, 1, dst, 0);
y += yStep;
dst += dstStride;
}
@@ -493,7 +501,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
GLushort ztemp[MAX_WIDTH];
GLfloat zfloat[MAX_WIDTH];
const double scale = 1.0 / 0xffff;
- pipe_get_tile_raw(trans, 0, y, width, 1, ztemp, 0);
+ pipe_get_tile_raw(pipe, trans, 0, y, width, 1, ztemp, 0);
y += yStep;
for (j = 0; j < width; j++) {
zfloat[j] = (float) (scale * ztemp[j]);
@@ -508,7 +516,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
GLuint ztemp[MAX_WIDTH];
GLfloat zfloat[MAX_WIDTH];
const double scale = 1.0 / 0xffffffff;
- pipe_get_tile_raw(trans, 0, y, width, 1, ztemp, 0);
+ pipe_get_tile_raw(pipe, trans, 0, y, width, 1, ztemp, 0);
y += yStep;
for (j = 0; j < width; j++) {
zfloat[j] = (float) (scale * ztemp[j]);
@@ -522,7 +530,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
/* RGBA format */
/* Do a row at a time to flip image data vertically */
for (i = 0; i < height; i++) {
- pipe_get_tile_rgba(trans, 0, y, width, 1, df);
+ pipe_get_tile_rgba(pipe, trans, 0, y, width, 1, df);
y += yStep;
df += dfStride;
if (!dfStride) {
@@ -534,7 +542,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
}
}
- screen->tex_transfer_destroy(trans);
+ pipe->tex_transfer_destroy(pipe, trans);
_mesa_unmap_pbo_dest(ctx, &clippedPacking);
}
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 92eefca2e7..390ada5489 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -63,6 +63,7 @@
#include "util/u_blit.h"
#include "util/u_format.h"
#include "util/u_surface.h"
+#include "util/u_sampler.h"
#include "util/u_math.h"
@@ -123,7 +124,17 @@ st_DeleteTextureObject(GLcontext *ctx,
struct st_texture_object *stObj = st_texture_object(texObj);
if (stObj->pt)
pipe_texture_reference(&stObj->pt, NULL);
-
+ if (stObj->sampler_view) {
+ if (stObj->sampler_view->context != ctx->st->pipe) {
+ /* Take "ownership" of this texture sampler view by setting
+ * its context pointer to this context. This avoids potential
+ * crashes when the texture object is shared among contexts
+ * and the original/owner context has already been destroyed.
+ */
+ stObj->sampler_view->context = ctx->st->pipe;
+ }
+ pipe_sampler_view_reference(&stObj->sampler_view, NULL);
+ }
_mesa_delete_texture_object(ctx, texObj);
}
@@ -312,6 +323,8 @@ guess_and_alloc_texture(struct st_context *st,
depth,
usage);
+ stObj->pipe = st->pipe;
+
DBG("%s - success\n", __FUNCTION__);
}
@@ -371,10 +384,13 @@ compress_with_blit(GLcontext * ctx,
{
const GLuint dstImageOffsets[1] = {0};
struct st_texture_image *stImage = st_texture_image(texImage);
- struct pipe_screen *screen = ctx->st->pipe->screen;
+ struct pipe_context *pipe = ctx->st->pipe;
+ struct pipe_screen *screen = pipe->screen;
gl_format mesa_format;
struct pipe_texture templ;
struct pipe_texture *src_tex;
+ struct pipe_sampler_view view_templ;
+ struct pipe_sampler_view *src_view;
struct pipe_surface *dst_surface;
struct pipe_transfer *tex_xfer;
void *map;
@@ -421,7 +437,7 @@ compress_with_blit(GLcontext * ctx,
0, 0, 0, /* face, level are zero */
PIPE_TRANSFER_WRITE,
0, 0, width, height); /* x, y, w, h */
- map = screen->transfer_map(screen, tex_xfer);
+ map = pipe->transfer_map(pipe, tex_xfer);
_mesa_texstore(ctx, 2, GL_RGBA, mesa_format,
map, /* dest ptr */
@@ -433,12 +449,19 @@ compress_with_blit(GLcontext * ctx,
pixels, /* source data */
unpack); /* source data packing */
- screen->transfer_unmap(screen, tex_xfer);
- screen->tex_transfer_destroy(tex_xfer);
+ pipe->transfer_unmap(pipe, tex_xfer);
+ pipe->tex_transfer_destroy(pipe, tex_xfer);
+
+ /* Create temporary sampler view */
+ u_sampler_view_default_template(&view_templ,
+ src_tex,
+ src_tex->format);
+ src_view = pipe->create_sampler_view(pipe, src_tex, &view_templ);
+
/* copy / compress image */
util_blit_pixels_tex(ctx->st->blit,
- src_tex, /* pipe_texture (src) */
+ src_view, /* sampler view (src) */
0, 0, /* src x0, y0 */
width, height, /* src x1, y1 */
dst_surface, /* pipe_surface (dst) */
@@ -450,6 +473,7 @@ compress_with_blit(GLcontext * ctx,
pipe_surface_reference(&dst_surface, NULL);
pipe_texture_reference(&src_tex, NULL);
+ pipe_sampler_view_reference(&src_view, NULL);
return GL_TRUE;
}
@@ -555,6 +579,7 @@ st_TexImage(GLcontext * ctx,
DBG("release it\n");
pipe_texture_reference(&stObj->pt, NULL);
assert(!stObj->pt);
+ pipe_sampler_view_reference(&stObj->sampler_view, NULL);
stObj->teximage_realloc = FALSE;
}
}
@@ -809,8 +834,11 @@ decompress_with_blit(GLcontext * ctx, GLenum target, GLint level,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
{
- struct pipe_screen *screen = ctx->st->pipe->screen;
+ struct pipe_context *pipe = ctx->st->pipe;
+ struct pipe_screen *screen = pipe->screen;
struct st_texture_image *stImage = st_texture_image(texImage);
+ struct st_texture_object *stObj = st_texture_object(texObj);
+ struct pipe_sampler_view *src_view = st_get_stobj_sampler_view(stObj);
const GLuint width = texImage->Width;
const GLuint height = texImage->Height;
struct pipe_surface *dst_surface;
@@ -827,7 +855,7 @@ decompress_with_blit(GLcontext * ctx, GLenum target, GLint level,
/* blit/render/decompress */
util_blit_pixels_tex(ctx->st->blit,
- stImage->pt, /* pipe_texture (src) */
+ src_view, /* pipe_texture (src) */
0, 0, /* src x0, y0 */
width, height, /* src x1, y1 */
dst_surface, /* pipe_surface (dst) */
@@ -848,7 +876,7 @@ decompress_with_blit(GLcontext * ctx, GLenum target, GLint level,
if (st_equal_formats(stImage->pt->format, format, type)) {
/* memcpy */
const uint bytesPerRow = width * util_format_get_blocksize(stImage->pt->format);
- ubyte *map = screen->transfer_map(screen, tex_xfer);
+ ubyte *map = pipe->transfer_map(pipe, tex_xfer);
GLuint row;
for (row = 0; row < height; row++) {
GLvoid *dest = _mesa_image_address2d(&ctx->Pack, pixels, width,
@@ -856,7 +884,7 @@ decompress_with_blit(GLcontext * ctx, GLenum target, GLint level,
memcpy(dest, map, bytesPerRow);
map += tex_xfer->stride;
}
- screen->transfer_unmap(screen, tex_xfer);
+ pipe->transfer_unmap(pipe, tex_xfer);
}
else {
/* format translation via floats */
@@ -871,7 +899,7 @@ decompress_with_blit(GLcontext * ctx, GLenum target, GLint level,
debug_printf("%s: fallback format translation\n", __FUNCTION__);
/* get float[4] rgba row from surface */
- pipe_get_tile_rgba(tex_xfer, 0, row, width, 1, rgba);
+ pipe_get_tile_rgba(pipe, tex_xfer, 0, row, width, 1, rgba);
_mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba, format,
type, dest, &ctx->Pack, transferOps);
@@ -880,7 +908,7 @@ decompress_with_blit(GLcontext * ctx, GLenum target, GLint level,
_mesa_unmap_pbo_dest(ctx, &ctx->Pack);
- screen->tex_transfer_destroy(tex_xfer);
+ pipe->tex_transfer_destroy(pipe, tex_xfer);
/* destroy the temp / dest surface */
util_destroy_rgba_surface(dst_texture, dst_surface);
@@ -906,7 +934,7 @@ st_get_tex_image(GLcontext * ctx, GLenum target, GLint level,
GLubyte *dest;
if (stImage->pt &&
- util_format_is_compressed(stImage->pt->format) &&
+ util_format_is_s3tc(stImage->pt->format) &&
!compressed_dst) {
/* Need to decompress the texture.
* We'll do this by rendering a textured quad.
@@ -1258,7 +1286,6 @@ fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level,
GLsizei width, GLsizei height)
{
struct pipe_context *pipe = ctx->st->pipe;
- struct pipe_screen *screen = pipe->screen;
struct pipe_transfer *src_trans;
GLvoid *texDest;
enum pipe_transfer_usage transfer_usage;
@@ -1311,11 +1338,11 @@ fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level,
/* To avoid a large temp memory allocation, do copy row by row */
for (row = 0; row < height; row++, srcY += yStep) {
uint data[MAX_WIDTH];
- pipe_get_tile_z(src_trans, 0, srcY, width, 1, data);
+ pipe_get_tile_z(pipe, src_trans, 0, srcY, width, 1, data);
if (scaleOrBias) {
_mesa_scale_and_bias_depth_uint(ctx, width, data);
}
- pipe_put_tile_z(stImage->transfer, 0, row, width, 1, data);
+ pipe_put_tile_z(pipe, stImage->transfer, 0, row, width, 1, data);
}
}
else {
@@ -1337,7 +1364,7 @@ fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level,
/* XXX this usually involves a lot of int/float conversion.
* try to avoid that someday.
*/
- pipe_get_tile_rgba(src_trans, 0, 0, width, height, tempSrc);
+ pipe_get_tile_rgba(pipe, src_trans, 0, 0, width, height, tempSrc);
/* Store into texture memory.
* Note that this does some special things such as pixel transfer
@@ -1365,7 +1392,7 @@ fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level,
}
st_texture_image_unmap(ctx->st, stImage);
- screen->tex_transfer_destroy(src_trans);
+ pipe->tex_transfer_destroy(pipe, src_trans);
}
@@ -1541,8 +1568,7 @@ st_copy_texsubimage(GLcontext *ctx,
if (ctx->_ImageTransferState == 0x0) {
- if (pipe->surface_copy &&
- matching_base_formats &&
+ if (matching_base_formats &&
src_format == dest_format &&
!do_flip)
{
@@ -1594,6 +1620,7 @@ st_copy_texsubimage(GLcontext *ctx,
}
util_blit_pixels_writemask(ctx->st->blit,
strb->surface,
+ st_renderbuffer_get_sampler_view(strb, pipe),
srcX, srcY0,
srcX + width, srcY1,
dest_surface,
@@ -1790,6 +1817,7 @@ st_finalize_texture(GLcontext *ctx,
firstImage->pt != stObj->pt &&
firstImage->pt->last_level >= stObj->lastLevel) {
pipe_texture_reference(&stObj->pt, firstImage->pt);
+ pipe_sampler_view_reference(&stObj->sampler_view, NULL);
}
/* bytes per pixel block (blocks are usually 1x1) */
@@ -1809,6 +1837,7 @@ st_finalize_texture(GLcontext *ctx,
stObj->pt->depth0 != firstImage->base.Depth2)
{
pipe_texture_reference(&stObj->pt, NULL);
+ pipe_sampler_view_reference(&stObj->sampler_view, NULL);
ctx->st->dirty.st |= ST_NEW_FRAMEBUFFER;
}
}
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index de8beaf5e2..83580591fc 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -30,9 +30,9 @@
#include "vbo/vbo.h"
#include "shader/shader_api.h"
#include "glapi/glapi.h"
+#include "st_context.h"
#include "st_public.h"
#include "st_debug.h"
-#include "st_context.h"
#include "st_cb_accum.h"
#include "st_cb_bitmap.h"
#include "st_cb_blit.h"
@@ -46,6 +46,7 @@
#if FEATURE_OES_draw_texture
#include "st_cb_drawtex.h"
#endif
+#include "st_cb_eglimage.h"
#include "st_cb_fbo.h"
#if FEATURE_feedback
#include "st_cb_feedback.h"
@@ -63,6 +64,7 @@
#include "st_program.h"
#include "pipe/p_context.h"
#include "util/u_inlines.h"
+#include "util/u_rect.h"
#include "draw/draw_context.h"
#include "cso_cache/cso_context.h"
@@ -97,6 +99,19 @@ st_get_msaa(void)
}
+/** Default method for pipe_context::surface_copy() */
+static void
+st_surface_copy(struct pipe_context *pipe,
+ struct pipe_surface *dst,
+ unsigned dst_x, unsigned dst_y,
+ struct pipe_surface *src,
+ unsigned src_x, unsigned src_y,
+ unsigned w, unsigned h)
+{
+ util_surface_copy(pipe, FALSE, dst, dst_x, dst_y, src, src_x, src_y, w, h);
+}
+
+
static struct st_context *
st_create_context_priv( GLcontext *ctx, struct pipe_context *pipe )
{
@@ -141,6 +156,14 @@ st_create_context_priv( GLcontext *ctx, struct pipe_context *pipe )
for (i = 0; i < PIPE_MAX_SAMPLERS; i++)
st->state.sampler_list[i] = &st->state.samplers[i];
+ for (i = 0; i < 3; i++) {
+ memset(&st->velems_util_draw[i], 0, sizeof(struct pipe_vertex_element));
+ st->velems_util_draw[i].src_offset = i * 4 * sizeof(float);
+ st->velems_util_draw[i].instance_divisor = 0;
+ st->velems_util_draw[i].vertex_buffer_index = 0;
+ st->velems_util_draw[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+ }
+
/* we want all vertex data to be placed in buffer objects */
vbo_use_buffer_objects(ctx);
@@ -158,6 +181,10 @@ st_create_context_priv( GLcontext *ctx, struct pipe_context *pipe )
st_init_limits(st);
st_init_extensions(st);
+ /* plug in helper driver functions if needed */
+ if (!pipe->surface_copy)
+ pipe->surface_copy = st_surface_copy;
+
return st;
}
@@ -207,8 +234,8 @@ static void st_destroy_context_priv( struct st_context *st )
st_destroy_drawtex(st);
#endif
- for (i = 0; i < Elements(st->state.sampler_texture); i++) {
- pipe_texture_reference(&st->state.sampler_texture[i], NULL);
+ for (i = 0; i < Elements(st->state.sampler_views); i++) {
+ pipe_sampler_view_reference(&st->state.sampler_views[i], NULL);
}
for (i = 0; i < Elements(st->state.constants); i++) {
@@ -264,7 +291,8 @@ void st_destroy_context( struct st_context *st )
GLboolean
st_make_current(struct st_context *st,
struct st_framebuffer *draw,
- struct st_framebuffer *read)
+ struct st_framebuffer *read,
+ void *winsys_drawable_handle )
{
/* Call this periodically to detect when the user has begun using
* GL rendering from multiple threads.
@@ -272,10 +300,13 @@ st_make_current(struct st_context *st,
_glapi_check_multithread();
if (st) {
- if (!_mesa_make_current(st->ctx, &draw->Base, &read->Base))
+ if (!_mesa_make_current(st->ctx, &draw->Base, &read->Base)) {
+ st->pipe->priv = NULL;
return GL_FALSE;
+ }
_mesa_check_init_viewport(st->ctx, draw->InitWidth, draw->InitHeight);
+ st->winsys_drawable_handle = winsys_drawable_handle;
return GL_TRUE;
}
@@ -329,6 +360,8 @@ void st_init_driver_functions(struct dd_function_table *functions)
st_init_drawtex_functions(functions);
#endif
+ st_init_eglimage_functions(functions);
+
st_init_fbo_functions(functions);
#if FEATURE_feedback
st_init_feedback_functions(functions);
diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h
index 045c029c30..786beaec08 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -31,6 +31,7 @@
#include "main/mtypes.h"
#include "shader/prog_cache.h"
#include "pipe/p_state.h"
+#include "state_tracker/st_api.h"
struct st_context;
@@ -73,6 +74,8 @@ struct st_tracked_state {
struct st_context
{
+ struct st_context_iface iface;
+
GLcontext *ctx;
struct pipe_context *pipe;
@@ -94,7 +97,7 @@ struct st_context
struct pipe_clip_state clip;
struct pipe_buffer *constants[2];
struct pipe_framebuffer_state framebuffer;
- struct pipe_texture *sampler_texture[PIPE_MAX_SAMPLERS];
+ struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS];
struct pipe_scissor_state scissor;
struct pipe_viewport_state viewport;
@@ -141,6 +144,7 @@ struct st_context
struct st_fragment_program *combined_prog;
GLuint combined_prog_sn;
struct pipe_texture *pixelmap_texture;
+ struct pipe_sampler_view *pixelmap_sampler_view;
boolean pixelmap_enabled; /**< use the pixelmap texture? */
} pixel_xfer;
@@ -174,6 +178,9 @@ struct st_context
unsigned vbuf_slot;
} clear;
+ /** used for anything using util_draw_vertex_buffer */
+ struct pipe_vertex_element velems_util_draw[3];
+
void *passthrough_fs; /**< simple pass-through frag shader */
struct gen_mipmap_state *gen_mipmap;
@@ -182,6 +189,7 @@ struct st_context
struct cso_context *cso_context;
int force_msaa;
+ void *winsys_drawable_handle;
};
@@ -202,6 +210,11 @@ struct st_framebuffer
GLframebuffer Base;
void *Private;
GLuint InitWidth, InitHeight;
+
+ struct st_framebuffer_iface *iface;
+ enum st_attachment_type statts[ST_ATTACHMENT_COUNT];
+ unsigned num_statts;
+ int32_t revalidate;
};
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index 32b9a473cf..7f45e3f548 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -57,6 +57,7 @@
#include "pipe/p_defines.h"
#include "util/u_inlines.h"
#include "util/u_format.h"
+#include "cso_cache/cso_context.h"
static GLuint double_types[4] = {
@@ -183,7 +184,7 @@ st_pipe_vertex_format(GLenum type, GLuint size, GLenum format,
/* this is an odd-ball case */
assert(type == GL_UNSIGNED_BYTE);
assert(normalized);
- return PIPE_FORMAT_A8R8G8B8_UNORM;
+ return PIPE_FORMAT_B8G8R8A8_UNORM;
}
if (normalized) {
@@ -272,7 +273,8 @@ is_interleaved_arrays(const struct st_vertex_program *vp,
}
*userSpace = (num_client_arrays == vpv->num_inputs);
- /* printf("user space: %d (%d %d)\n", (int) *userSpace,num_client_arrays,vp->num_inputs); */
+ /* debug_printf("user space: %s (%d arrays, %d inputs)\n",
+ (int)*userSpace ? "Yes" : "No", num_client_arrays, vp->num_inputs); */
return GL_TRUE;
}
@@ -292,6 +294,8 @@ get_arrays_bounds(const struct st_vertex_program *vp,
const GLubyte *high_addr = NULL;
GLuint attr;
+ /* debug_printf("get_arrays_bounds: Handling %u attrs\n", vpv->num_inputs); */
+
for (attr = 0; attr < vpv->num_inputs; attr++) {
const GLuint mesaAttr = vp->index_to_input[attr];
const GLint stride = arrays[mesaAttr]->StrideB;
@@ -300,6 +304,9 @@ get_arrays_bounds(const struct st_vertex_program *vp,
_mesa_sizeof_type(arrays[mesaAttr]->Type));
const GLubyte *end = start + (max_index * stride) + sz;
+ /* debug_printf("attr %u: stride %d size %u start %p end %p\n",
+ attr, stride, sz, start, end); */
+
if (attr == 0) {
low_addr = start;
high_addr = end;
@@ -347,7 +354,8 @@ setup_interleaved_attribs(GLcontext *ctx,
const GLubyte *low, *high;
get_arrays_bounds(vp, vpv, arrays, max_index, &low, &high);
- /*printf("buffer range: %p %p %d\n", low, high, high-low);*/
+ /* debug_printf("buffer range: %p %p range %d max index %u\n",
+ low, high, high - low, max_index); */
offset0 = low;
if (userSpace) {
@@ -368,7 +376,6 @@ setup_interleaved_attribs(GLcontext *ctx,
(unsigned) (arrays[mesaAttr]->Ptr - offset0);
velements[attr].instance_divisor = 0;
velements[attr].vertex_buffer_index = 0;
- velements[attr].nr_components = arrays[mesaAttr]->Size;
velements[attr].src_format =
st_pipe_vertex_format(arrays[mesaAttr]->Type,
arrays[mesaAttr]->Size,
@@ -458,7 +465,6 @@ setup_non_interleaved_attribs(GLcontext *ctx,
vbuffer[attr].max_index = max_index;
velements[attr].instance_divisor = 0;
velements[attr].vertex_buffer_index = attr;
- velements[attr].nr_components = arrays[mesaAttr]->Size;
velements[attr].src_format
= st_pipe_vertex_format(arrays[mesaAttr]->Type,
arrays[mesaAttr]->Size,
@@ -564,6 +570,7 @@ st_draw_vbo(GLcontext *ctx,
(void) check_uniforms;
#endif
+ memset(velements, 0, sizeof(struct pipe_vertex_element) * vpv->num_inputs);
/*
* Setup the vbuffer[] and velements[] arrays.
*/
@@ -596,14 +603,13 @@ st_draw_vbo(GLcontext *ctx,
for (i = 0; i < num_velements; i++) {
printf("vlements[%d].vbuffer_index = %u\n", i, velements[i].vertex_buffer_index);
printf("vlements[%d].src_offset = %u\n", i, velements[i].src_offset);
- printf("vlements[%d].nr_comps = %u\n", i, velements[i].nr_components);
printf("vlements[%d].format = %s\n", i, util_format_name(velements[i].src_format));
}
}
#endif
pipe->set_vertex_buffers(pipe, num_vbuffers, vbuffer);
- pipe->set_vertex_elements(pipe, num_velements, velements);
+ cso_set_vertex_elements(ctx->st->cso_context, num_velements, velements);
if (num_vbuffers == 0 || num_velements == 0)
return;
diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c
index 087f2f22bb..26a5b3fcd6 100644
--- a/src/mesa/state_tracker/st_draw_feedback.c
+++ b/src/mesa/state_tracker/st_draw_feedback.c
@@ -178,7 +178,6 @@ st_feedback_draw_vbo(GLcontext *ctx,
vbuffers[attr].max_index = max_index;
velements[attr].instance_divisor = 0;
velements[attr].vertex_buffer_index = attr;
- velements[attr].nr_components = arrays[mesaAttr]->Size;
velements[attr].src_format =
st_pipe_vertex_format(arrays[mesaAttr]->Type,
arrays[mesaAttr]->Size,
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index 79be833768..0118c600f0 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -137,6 +137,9 @@ void st_init_limits(struct st_context *st)
/* XXX separate query for early function return? */
st->ctx->Shader.EmitContReturn =
screen->get_param(screen, PIPE_CAP_TGSI_CONT_SUPPORTED);
+
+ /* Quads always follow GL provoking rules. */
+ c->QuadsFollowProvokingVertexConvention = GL_FALSE;
}
@@ -169,6 +172,7 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.ARB_vertex_array_object = GL_TRUE;
ctx->Extensions.ARB_vertex_buffer_object = GL_TRUE;
ctx->Extensions.ARB_vertex_program = GL_TRUE;
+ ctx->Extensions.ARB_window_pos = GL_TRUE;
ctx->Extensions.EXT_blend_color = GL_TRUE;
ctx->Extensions.EXT_blend_func_separate = GL_TRUE;
@@ -193,9 +197,17 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.APPLE_vertex_array_object = GL_TRUE;
+ ctx->Extensions.MESA_pack_invert = GL_TRUE;
+
ctx->Extensions.NV_blend_square = GL_TRUE;
ctx->Extensions.NV_texgen_reflection = GL_TRUE;
ctx->Extensions.NV_texture_env_combine4 = GL_TRUE;
+ ctx->Extensions.NV_texture_rectangle = GL_TRUE;
+#if 0
+ /* possibly could support the following two */
+ ctx->Extensions.NV_vertex_program = GL_TRUE;
+ ctx->Extensions.NV_vertex_program1_1 = GL_TRUE;
+#endif
#if FEATURE_OES_draw_texture
ctx->Extensions.OES_draw_texture = GL_TRUE;
@@ -233,7 +245,6 @@ void st_init_extensions(struct st_context *st)
if (screen->get_param(screen, PIPE_CAP_NPOT_TEXTURES)) {
ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE;
- ctx->Extensions.NV_texture_rectangle = GL_TRUE;
}
if (screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS) > 1) {
@@ -270,18 +281,18 @@ void st_init_extensions(struct st_context *st)
/* GL_EXT_packed_depth_stencil requires both the ability to render to
* a depth/stencil buffer and texture from depth/stencil source.
*/
- if (screen->is_format_supported(screen, PIPE_FORMAT_S8Z24_UNORM,
+ if (screen->is_format_supported(screen, PIPE_FORMAT_S8_USCALED_Z24_UNORM,
PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0) &&
- screen->is_format_supported(screen, PIPE_FORMAT_S8Z24_UNORM,
+ screen->is_format_supported(screen, PIPE_FORMAT_S8_USCALED_Z24_UNORM,
PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_SAMPLER, 0)) {
ctx->Extensions.EXT_packed_depth_stencil = GL_TRUE;
}
- else if (screen->is_format_supported(screen, PIPE_FORMAT_Z24S8_UNORM,
+ else if (screen->is_format_supported(screen, PIPE_FORMAT_Z24_UNORM_S8_USCALED,
PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0) &&
- screen->is_format_supported(screen, PIPE_FORMAT_Z24S8_UNORM,
+ screen->is_format_supported(screen, PIPE_FORMAT_Z24_UNORM_S8_USCALED,
PIPE_TEXTURE_2D,
PIPE_TEXTURE_USAGE_SAMPLER, 0)) {
ctx->Extensions.EXT_packed_depth_stencil = GL_TRUE;
diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
index 9ae0c9f9ba..ecc08762bb 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -76,8 +76,8 @@ st_format_datatype(enum pipe_format format)
format == PIPE_FORMAT_B5G6R5_UNORM) {
return GL_UNSIGNED_SHORT;
}
- else if (format == PIPE_FORMAT_Z24S8_UNORM ||
- format == PIPE_FORMAT_S8Z24_UNORM) {
+ else if (format == PIPE_FORMAT_Z24_UNORM_S8_USCALED ||
+ format == PIPE_FORMAT_S8_USCALED_Z24_UNORM) {
return GL_UNSIGNED_INT_24_8;
}
else {
@@ -151,9 +151,9 @@ st_mesa_format_to_pipe_format(gl_format mesaFormat)
case MESA_FORMAT_Z32:
return PIPE_FORMAT_Z32_UNORM;
case MESA_FORMAT_Z24_S8:
- return PIPE_FORMAT_S8Z24_UNORM;
+ return PIPE_FORMAT_S8_USCALED_Z24_UNORM;
case MESA_FORMAT_S8_Z24:
- return PIPE_FORMAT_Z24S8_UNORM;
+ return PIPE_FORMAT_Z24_UNORM_S8_USCALED;
case MESA_FORMAT_YCBCR:
return PIPE_FORMAT_UYVY;
#if FEATURE_texture_s3tc
@@ -224,7 +224,7 @@ st_pipe_format_to_mesa_format(enum pipe_format format)
return MESA_FORMAT_L8;
case PIPE_FORMAT_I8_UNORM:
return MESA_FORMAT_I8;
- case PIPE_FORMAT_S8_UNORM:
+ case PIPE_FORMAT_S8_USCALED:
return MESA_FORMAT_S8;
case PIPE_FORMAT_R16G16B16A16_SNORM:
@@ -234,13 +234,13 @@ st_pipe_format_to_mesa_format(enum pipe_format format)
return MESA_FORMAT_Z16;
case PIPE_FORMAT_Z32_UNORM:
return MESA_FORMAT_Z32;
- case PIPE_FORMAT_S8Z24_UNORM:
+ case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
return MESA_FORMAT_Z24_S8;
case PIPE_FORMAT_X8Z24_UNORM:
return MESA_FORMAT_Z24_X8;
case PIPE_FORMAT_Z24X8_UNORM:
return MESA_FORMAT_X8_Z24;
- case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
return MESA_FORMAT_S8_Z24;
case PIPE_FORMAT_UYVY:
@@ -393,8 +393,8 @@ default_depth_format(struct pipe_screen *screen,
static const enum pipe_format zFormats[] = {
PIPE_FORMAT_Z16_UNORM,
PIPE_FORMAT_Z32_UNORM,
- PIPE_FORMAT_Z24S8_UNORM,
- PIPE_FORMAT_S8Z24_UNORM
+ PIPE_FORMAT_Z24_UNORM_S8_USCALED,
+ PIPE_FORMAT_S8_USCALED_Z24_UNORM
};
uint i;
for (i = 0; i < Elements(zFormats); i++) {
@@ -546,10 +546,10 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
return PIPE_FORMAT_Z16_UNORM;
/* fall-through */
case GL_DEPTH_COMPONENT24:
- if (screen->is_format_supported( screen, PIPE_FORMAT_Z24S8_UNORM, target, tex_usage, geom_flags ))
- return PIPE_FORMAT_Z24S8_UNORM;
- if (screen->is_format_supported( screen, PIPE_FORMAT_S8Z24_UNORM, target, tex_usage, geom_flags ))
- return PIPE_FORMAT_S8Z24_UNORM;
+ if (screen->is_format_supported( screen, PIPE_FORMAT_Z24_UNORM_S8_USCALED, target, tex_usage, geom_flags ))
+ return PIPE_FORMAT_Z24_UNORM_S8_USCALED;
+ if (screen->is_format_supported( screen, PIPE_FORMAT_S8_USCALED_Z24_UNORM, target, tex_usage, geom_flags ))
+ return PIPE_FORMAT_S8_USCALED_Z24_UNORM;
/* fall-through */
case GL_DEPTH_COMPONENT32:
if (screen->is_format_supported( screen, PIPE_FORMAT_Z32_UNORM, target, tex_usage, geom_flags ))
@@ -563,20 +563,20 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat,
case GL_STENCIL_INDEX4_EXT:
case GL_STENCIL_INDEX8_EXT:
case GL_STENCIL_INDEX16_EXT:
- if (screen->is_format_supported( screen, PIPE_FORMAT_S8_UNORM, target, tex_usage, geom_flags ))
- return PIPE_FORMAT_S8_UNORM;
- if (screen->is_format_supported( screen, PIPE_FORMAT_Z24S8_UNORM, target, tex_usage, geom_flags ))
- return PIPE_FORMAT_Z24S8_UNORM;
- if (screen->is_format_supported( screen, PIPE_FORMAT_S8Z24_UNORM, target, tex_usage, geom_flags ))
- return PIPE_FORMAT_S8Z24_UNORM;
+ if (screen->is_format_supported( screen, PIPE_FORMAT_S8_USCALED, target, tex_usage, geom_flags ))
+ return PIPE_FORMAT_S8_USCALED;
+ if (screen->is_format_supported( screen, PIPE_FORMAT_Z24_UNORM_S8_USCALED, target, tex_usage, geom_flags ))
+ return PIPE_FORMAT_Z24_UNORM_S8_USCALED;
+ if (screen->is_format_supported( screen, PIPE_FORMAT_S8_USCALED_Z24_UNORM, target, tex_usage, geom_flags ))
+ return PIPE_FORMAT_S8_USCALED_Z24_UNORM;
return PIPE_FORMAT_NONE;
case GL_DEPTH_STENCIL_EXT:
case GL_DEPTH24_STENCIL8_EXT:
- if (screen->is_format_supported( screen, PIPE_FORMAT_Z24S8_UNORM, target, tex_usage, geom_flags ))
- return PIPE_FORMAT_Z24S8_UNORM;
- if (screen->is_format_supported( screen, PIPE_FORMAT_S8Z24_UNORM, target, tex_usage, geom_flags ))
- return PIPE_FORMAT_S8Z24_UNORM;
+ if (screen->is_format_supported( screen, PIPE_FORMAT_Z24_UNORM_S8_USCALED, target, tex_usage, geom_flags ))
+ return PIPE_FORMAT_Z24_UNORM_S8_USCALED;
+ if (screen->is_format_supported( screen, PIPE_FORMAT_S8_USCALED_Z24_UNORM, target, tex_usage, geom_flags ))
+ return PIPE_FORMAT_S8_USCALED_Z24_UNORM;
return PIPE_FORMAT_NONE;
case GL_SRGB_EXT:
diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c
index 0a91183f89..d3c43bbc68 100644
--- a/src/mesa/state_tracker/st_framebuffer.c
+++ b/src/mesa/state_tracker/st_framebuffer.c
@@ -197,6 +197,7 @@ st_set_framebuffer_surface(struct st_framebuffer *stfb,
/* replace the renderbuffer's surface/texture pointers */
pipe_surface_reference( &strb->surface, surf );
pipe_texture_reference( &strb->texture, surf->texture );
+ pipe_sampler_view_reference(&strb->sampler_view, NULL);
if (ctx) {
/* If ctx isn't set, we've likely not made current yet.
diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c
index f67d7b4cb5..030b0a0f06 100644
--- a/src/mesa/state_tracker/st_gen_mipmap.c
+++ b/src/mesa/state_tracker/st_gen_mipmap.c
@@ -79,22 +79,23 @@ st_destroy_generate_mipmap(struct st_context *st)
static boolean
st_render_mipmap(struct st_context *st,
GLenum target,
- struct pipe_texture *pt,
+ struct st_texture_object *stObj,
uint baseLevel, uint lastLevel)
{
struct pipe_context *pipe = st->pipe;
struct pipe_screen *screen = pipe->screen;
+ struct pipe_sampler_view *psv = st_get_stobj_sampler_view(stObj);
const uint face = _mesa_tex_target_to_face(target);
assert(target != GL_TEXTURE_3D); /* not done yet */
/* check if we can render in the texture's format */
- if (!screen->is_format_supported(screen, pt->format, pt->target,
+ if (!screen->is_format_supported(screen, psv->format, psv->texture->target,
PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) {
return FALSE;
}
- util_gen_mipmap(st->gen_mipmap, pt, face, baseLevel, lastLevel,
+ util_gen_mipmap(st->gen_mipmap, psv, face, baseLevel, lastLevel,
PIPE_TEX_FILTER_LINEAR);
return TRUE;
@@ -106,7 +107,6 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target,
struct gl_texture_object *texObj)
{
struct pipe_context *pipe = ctx->st->pipe;
- struct pipe_screen *screen = pipe->screen;
struct pipe_texture *pt = st_get_texobj_texture(texObj);
const uint baseLevel = texObj->BaseLevel;
const uint lastLevel = pt->last_level;
@@ -142,8 +142,8 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target,
u_minify(pt->width0, dstLevel),
u_minify(pt->height0, dstLevel));
- srcData = (ubyte *) screen->transfer_map(screen, srcTrans);
- dstData = (ubyte *) screen->transfer_map(screen, dstTrans);
+ srcData = (ubyte *) pipe->transfer_map(pipe, srcTrans);
+ dstData = (ubyte *) pipe->transfer_map(pipe, dstTrans);
srcStride = srcTrans->stride / util_format_get_blocksize(srcTrans->texture->format);
dstStride = dstTrans->stride / util_format_get_blocksize(dstTrans->texture->format);
@@ -161,11 +161,11 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target,
dstData,
dstStride); /* stride in texels */
- screen->transfer_unmap(screen, srcTrans);
- screen->transfer_unmap(screen, dstTrans);
+ pipe->transfer_unmap(pipe, srcTrans);
+ pipe->transfer_unmap(pipe, dstTrans);
- screen->tex_transfer_destroy(srcTrans);
- screen->tex_transfer_destroy(dstTrans);
+ pipe->tex_transfer_destroy(pipe, srcTrans);
+ pipe->tex_transfer_destroy(pipe, dstTrans);
}
}
@@ -212,6 +212,7 @@ st_generate_mipmap(GLcontext *ctx, GLenum target,
struct gl_texture_object *texObj)
{
struct st_context *st = ctx->st;
+ struct st_texture_object *stObj = st_texture_object(texObj);
struct pipe_texture *pt = st_get_texobj_texture(texObj);
const uint baseLevel = texObj->BaseLevel;
uint lastLevel;
@@ -230,7 +231,6 @@ st_generate_mipmap(GLcontext *ctx, GLenum target,
/* The current gallium texture doesn't have space for all the
* mipmap levels we need to generate. So allocate a new texture.
*/
- struct st_texture_object *stObj = st_texture_object(texObj);
struct pipe_texture *oldTex = stObj->pt;
GLboolean needFlush;
@@ -256,6 +256,7 @@ st_generate_mipmap(GLcontext *ctx, GLenum target,
/* release the old tex (will likely be freed too) */
pipe_texture_reference(&oldTex, NULL);
+ pipe_sampler_view_reference(&stObj->sampler_view, NULL);
pt = stObj->pt;
}
@@ -265,7 +266,7 @@ st_generate_mipmap(GLcontext *ctx, GLenum target,
/* Recall that the Mesa BaseLevel image is stored in the gallium
* texture's level[0] position. So pass baseLevel=0 here.
*/
- if (!st_render_mipmap(st, target, pt, 0, lastLevel)) {
+ if (!st_render_mipmap(st, target, stObj, 0, lastLevel)) {
fallback_generate_mipmap(ctx, target, texObj);
}
diff --git a/src/mesa/state_tracker/st_inlines.h b/src/mesa/state_tracker/st_inlines.h
index e105870bc7..7fcde7b1a9 100644
--- a/src/mesa/state_tracker/st_inlines.h
+++ b/src/mesa/state_tracker/st_inlines.h
@@ -53,11 +53,11 @@ st_cond_flush_get_tex_transfer(struct st_context *st,
unsigned int x, unsigned int y,
unsigned int w, unsigned int h)
{
- struct pipe_screen *screen = st->pipe->screen;
+ struct pipe_context *context = st->pipe;
st_teximage_flush_before_map(st, pt, face, level, usage);
- return screen->get_tex_transfer(screen, pt, face, level, zslice, usage,
- x, y, w, h);
+ return context->get_tex_transfer(context, pt, face, level, zslice, usage,
+ x, y, w, h);
}
static INLINE struct pipe_transfer *
@@ -70,9 +70,9 @@ st_no_flush_get_tex_transfer(struct st_context *st,
unsigned int x, unsigned int y,
unsigned int w, unsigned int h)
{
- struct pipe_screen *screen = st->pipe->screen;
+ struct pipe_context *context = st->pipe;
- return screen->get_tex_transfer(screen, pt, face, level,
+ return context->get_tex_transfer(context, pt, face, level,
zslice, usage, x, y, w, h);
}
diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
new file mode 100644
index 0000000000..696d8aa792
--- /dev/null
+++ b/src/mesa/state_tracker/st_manager.c
@@ -0,0 +1,830 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.9
+ *
+ * Copyright (C) 2010 LunarG Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Chia-I Wu <olv@lunarg.com>
+ */
+
+#include "state_tracker/st_api.h"
+
+#include "pipe/p_context.h"
+#include "pipe/p_screen.h"
+#include "util/u_format.h"
+#include "util/u_pointer.h"
+#include "util/u_inlines.h"
+#include "util/u_atomic.h"
+
+#include "main/mtypes.h"
+#include "main/context.h"
+#include "main/texobj.h"
+#include "main/teximage.h"
+#include "main/texstate.h"
+#include "main/texfetch.h"
+#include "main/framebuffer.h"
+#include "main/renderbuffer.h"
+#include "st_texture.h"
+
+#include "st_context.h"
+#include "st_format.h"
+#include "st_cb_fbo.h"
+#include "st_manager.h"
+
+/* these functions are defined in st_context.c */
+struct st_context *
+st_create_context(struct pipe_context *pipe,
+ const __GLcontextModes *visual,
+ struct st_context *share);
+void st_destroy_context(struct st_context *st);
+void st_flush(struct st_context *st, uint pipeFlushFlags,
+ struct pipe_fence_handle **fence);
+
+/**
+ * Cast wrapper to convert a GLframebuffer to an st_framebuffer.
+ * Return NULL if the GLframebuffer is a user-created framebuffer.
+ * We'll only return non-null for window system framebuffers.
+ * Note that this function may fail.
+ */
+static INLINE struct st_framebuffer *
+st_ws_framebuffer(GLframebuffer *fb)
+{
+ /* FBO cannot be casted. See st_new_framebuffer */
+ return (struct st_framebuffer *) ((fb && !fb->Name) ? fb : NULL);
+}
+
+/**
+ * Map an attachment to a buffer index.
+ */
+static INLINE gl_buffer_index
+attachment_to_buffer_index(enum st_attachment_type statt)
+{
+ gl_buffer_index index;
+
+ switch (statt) {
+ case ST_ATTACHMENT_FRONT_LEFT:
+ index = BUFFER_FRONT_LEFT;
+ break;
+ case ST_ATTACHMENT_BACK_LEFT:
+ index = BUFFER_BACK_LEFT;
+ break;
+ case ST_ATTACHMENT_FRONT_RIGHT:
+ index = BUFFER_FRONT_RIGHT;
+ break;
+ case ST_ATTACHMENT_BACK_RIGHT:
+ index = BUFFER_BACK_RIGHT;
+ break;
+ case ST_ATTACHMENT_DEPTH_STENCIL:
+ index = BUFFER_DEPTH;
+ break;
+ case ST_ATTACHMENT_ACCUM:
+ index = BUFFER_ACCUM;
+ break;
+ case ST_ATTACHMENT_SAMPLE:
+ default:
+ index = BUFFER_COUNT;
+ break;
+ }
+
+ return index;
+}
+
+/**
+ * Map a buffer index to an attachment.
+ */
+static INLINE enum st_attachment_type
+buffer_index_to_attachment(gl_buffer_index index)
+{
+ enum st_attachment_type statt;
+
+ switch (index) {
+ case BUFFER_FRONT_LEFT:
+ statt = ST_ATTACHMENT_FRONT_LEFT;
+ break;
+ case BUFFER_BACK_LEFT:
+ statt = ST_ATTACHMENT_BACK_LEFT;
+ break;
+ case BUFFER_FRONT_RIGHT:
+ statt = ST_ATTACHMENT_FRONT_RIGHT;
+ break;
+ case BUFFER_BACK_RIGHT:
+ statt = ST_ATTACHMENT_BACK_RIGHT;
+ break;
+ case BUFFER_DEPTH:
+ statt = ST_ATTACHMENT_DEPTH_STENCIL;
+ break;
+ case BUFFER_ACCUM:
+ statt = ST_ATTACHMENT_ACCUM;
+ break;
+ default:
+ statt = ST_ATTACHMENT_INVALID;
+ break;
+ }
+
+ return statt;
+}
+
+/**
+ * Validate a framebuffer to make sure up-to-date pipe_textures are used.
+ */
+static void
+st_framebuffer_validate(struct st_framebuffer *stfb, struct st_context *st)
+{
+ struct pipe_screen *screen = st->pipe->screen;
+ struct pipe_texture *textures[ST_ATTACHMENT_COUNT];
+ uint width, height;
+ unsigned i;
+ boolean changed = FALSE;
+
+ if (!p_atomic_read(&stfb->revalidate))
+ return;
+
+ /* validate the fb */
+ if (!stfb->iface->validate(stfb->iface, stfb->statts, stfb->num_statts, textures))
+ return;
+
+ width = stfb->Base.Width;
+ height = stfb->Base.Height;
+
+ for (i = 0; i < stfb->num_statts; i++) {
+ struct st_renderbuffer *strb;
+ struct pipe_surface *ps;
+ gl_buffer_index idx;
+
+ if (!textures[i])
+ continue;
+
+ idx = attachment_to_buffer_index(stfb->statts[i]);
+ if (idx >= BUFFER_COUNT) {
+ pipe_texture_reference(&textures[i], NULL);
+ continue;
+ }
+
+ strb = st_renderbuffer(stfb->Base.Attachment[idx].Renderbuffer);
+ assert(strb);
+ if (strb->texture == textures[i]) {
+ pipe_texture_reference(&textures[i], NULL);
+ continue;
+ }
+
+ ps = screen->get_tex_surface(screen, textures[i], 0, 0, 0,
+ PIPE_BUFFER_USAGE_GPU_READ | PIPE_BUFFER_USAGE_GPU_WRITE);
+ if (ps) {
+ pipe_surface_reference(&strb->surface, ps);
+ pipe_texture_reference(&strb->texture, ps->texture);
+ /* ownership transfered */
+ pipe_surface_reference(&ps, NULL);
+
+ changed = TRUE;
+
+ strb->Base.Width = strb->surface->width;
+ strb->Base.Height = strb->surface->height;
+
+ width = strb->Base.Width;
+ height = strb->Base.Height;
+ }
+
+ pipe_texture_reference(&textures[i], NULL);
+ }
+
+ if (changed) {
+ st->dirty.st |= ST_NEW_FRAMEBUFFER;
+ _mesa_resize_framebuffer(st->ctx, &stfb->Base, width, height);
+
+ assert(stfb->Base.Width == width);
+ assert(stfb->Base.Height == height);
+ }
+
+ p_atomic_set(&stfb->revalidate, FALSE);
+}
+
+/**
+ * Update the attachments to validate by looping the existing renderbuffers.
+ */
+static void
+st_framebuffer_update_attachments(struct st_framebuffer *stfb)
+{
+ gl_buffer_index idx;
+
+ stfb->num_statts = 0;
+ for (idx = 0; idx < BUFFER_COUNT; idx++) {
+ struct st_renderbuffer *strb;
+ enum st_attachment_type statt;
+
+ strb = st_renderbuffer(stfb->Base.Attachment[idx].Renderbuffer);
+ if (!strb || strb->software)
+ continue;
+
+ statt = buffer_index_to_attachment(idx);
+ if (statt != ST_ATTACHMENT_INVALID &&
+ st_visual_have_buffers(stfb->iface->visual, 1 << statt))
+ stfb->statts[stfb->num_statts++] = statt;
+ }
+
+ p_atomic_set(&stfb->revalidate, TRUE);
+}
+
+/**
+ * Add a renderbuffer to the framebuffer.
+ */
+static boolean
+st_framebuffer_add_renderbuffer(struct st_framebuffer *stfb,
+ gl_buffer_index idx)
+{
+ struct gl_renderbuffer *rb;
+ enum pipe_format format;
+ int samples;
+ boolean sw;
+
+ /* do not distinguish depth/stencil buffers */
+ if (idx == BUFFER_STENCIL)
+ idx = BUFFER_DEPTH;
+
+ switch (idx) {
+ case BUFFER_DEPTH:
+ format = stfb->iface->visual->depth_stencil_format;
+ sw = FALSE;
+ break;
+ case BUFFER_ACCUM:
+ format = stfb->iface->visual->accum_format;
+ sw = TRUE;
+ break;
+ default:
+ format = stfb->iface->visual->color_format;
+ sw = FALSE;
+ break;
+ }
+
+ if (format == PIPE_FORMAT_NONE)
+ return FALSE;
+
+ samples = stfb->iface->visual->samples;
+ if (!samples)
+ samples = st_get_msaa();
+
+ rb = st_new_renderbuffer_fb(format, samples, sw);
+ if (!rb)
+ return FALSE;
+
+ if (idx != BUFFER_DEPTH) {
+ _mesa_add_renderbuffer(&stfb->Base, idx, rb);
+ }
+ else {
+ if (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_ZS, 0))
+ _mesa_add_renderbuffer(&stfb->Base, BUFFER_DEPTH, rb);
+ if (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_ZS, 1))
+ _mesa_add_renderbuffer(&stfb->Base, BUFFER_STENCIL, rb);
+ }
+
+ return TRUE;
+}
+
+/**
+ * Intialize a __GLcontextModes from a visual.
+ */
+static void
+st_visual_to_context_mode(const struct st_visual *visual,
+ __GLcontextModes *mode)
+{
+ memset(mode, 0, sizeof(*mode));
+
+ if (st_visual_have_buffers(visual, ST_ATTACHMENT_BACK_LEFT_MASK))
+ mode->doubleBufferMode = GL_TRUE;
+ if (st_visual_have_buffers(visual,
+ ST_ATTACHMENT_FRONT_RIGHT_MASK | ST_ATTACHMENT_BACK_RIGHT_MASK))
+ mode->stereoMode = GL_TRUE;
+
+ if (visual->color_format != PIPE_FORMAT_NONE) {
+ mode->rgbMode = GL_TRUE;
+
+ mode->redBits =
+ util_format_get_component_bits(visual->color_format,
+ UTIL_FORMAT_COLORSPACE_RGB, 0);
+ mode->greenBits =
+ util_format_get_component_bits(visual->color_format,
+ UTIL_FORMAT_COLORSPACE_RGB, 1);
+ mode->blueBits =
+ util_format_get_component_bits(visual->color_format,
+ UTIL_FORMAT_COLORSPACE_RGB, 2);
+ mode->alphaBits =
+ util_format_get_component_bits(visual->color_format,
+ UTIL_FORMAT_COLORSPACE_RGB, 3);
+
+ mode->rgbBits = mode->redBits +
+ mode->greenBits + mode->blueBits + mode->alphaBits;
+ }
+
+ if (visual->depth_stencil_format != PIPE_FORMAT_NONE) {
+ mode->depthBits =
+ util_format_get_component_bits(visual->depth_stencil_format,
+ UTIL_FORMAT_COLORSPACE_ZS, 0);
+ mode->stencilBits =
+ util_format_get_component_bits(visual->depth_stencil_format,
+ UTIL_FORMAT_COLORSPACE_ZS, 1);
+
+ mode->haveDepthBuffer = mode->depthBits > 0;
+ mode->haveStencilBuffer = mode->stencilBits > 0;
+ }
+
+ if (visual->accum_format != PIPE_FORMAT_NONE) {
+ mode->haveAccumBuffer = GL_TRUE;
+
+ mode->accumRedBits =
+ util_format_get_component_bits(visual->accum_format,
+ UTIL_FORMAT_COLORSPACE_RGB, 0);
+ mode->accumGreenBits =
+ util_format_get_component_bits(visual->accum_format,
+ UTIL_FORMAT_COLORSPACE_RGB, 1);
+ mode->accumBlueBits =
+ util_format_get_component_bits(visual->accum_format,
+ UTIL_FORMAT_COLORSPACE_RGB, 2);
+ mode->accumAlphaBits =
+ util_format_get_component_bits(visual->accum_format,
+ UTIL_FORMAT_COLORSPACE_RGB, 3);
+ }
+
+ if (visual->samples) {
+ mode->sampleBuffers = 1;
+ mode->samples = visual->samples;
+ }
+}
+
+/**
+ * Determine the default draw or read buffer from a visual.
+ */
+static void
+st_visual_to_default_buffer(const struct st_visual *visual,
+ GLenum *buffer, GLint *index)
+{
+ enum st_attachment_type statt;
+ GLenum buf;
+ gl_buffer_index idx;
+
+ statt = visual->render_buffer;
+ /* do nothing if an invalid render buffer is specified */
+ if (statt == ST_ATTACHMENT_INVALID ||
+ !st_visual_have_buffers(visual, 1 << statt))
+ return;
+
+ switch (statt) {
+ case ST_ATTACHMENT_FRONT_LEFT:
+ buf = GL_FRONT_LEFT;
+ idx = BUFFER_FRONT_LEFT;
+ break;
+ case ST_ATTACHMENT_BACK_LEFT:
+ buf = GL_BACK_LEFT;
+ idx = BUFFER_BACK_LEFT;
+ break;
+ case ST_ATTACHMENT_FRONT_RIGHT:
+ buf = GL_FRONT_RIGHT;
+ idx = BUFFER_FRONT_RIGHT;
+ break;
+ case ST_ATTACHMENT_BACK_RIGHT:
+ buf = GL_BACK_RIGHT;
+ idx = BUFFER_BACK_RIGHT;
+ break;
+ default:
+ buf = GL_NONE;
+ idx = BUFFER_COUNT;
+ break;
+ }
+
+ if (buf != GL_NONE) {
+ if (buffer)
+ *buffer = buf;
+ if (index)
+ *index = idx;
+ }
+}
+
+/**
+ * Create a framebuffer from a manager interface.
+ */
+static struct st_framebuffer *
+st_framebuffer_create(struct st_framebuffer_iface *stfbi)
+{
+ struct st_framebuffer *stfb;
+ __GLcontextModes mode;
+ gl_buffer_index idx;
+
+ stfb = CALLOC_STRUCT(st_framebuffer);
+ if (!stfb)
+ return NULL;
+
+ st_visual_to_context_mode(stfbi->visual, &mode);
+ _mesa_initialize_window_framebuffer(&stfb->Base, &mode);
+
+ /* modify the draw/read buffers of the fb */
+ st_visual_to_default_buffer(stfbi->visual, &stfb->Base.ColorDrawBuffer[0],
+ &stfb->Base._ColorDrawBufferIndexes[0]);
+ st_visual_to_default_buffer(stfbi->visual, &stfb->Base.ColorReadBuffer,
+ &stfb->Base._ColorReadBufferIndex);
+
+ stfb->iface = stfbi;
+
+ /* add the color buffer */
+ idx = stfb->Base._ColorDrawBufferIndexes[0];
+ if (!st_framebuffer_add_renderbuffer(stfb, idx)) {
+ FREE(stfb);
+ return NULL;
+ }
+
+ st_framebuffer_add_renderbuffer(stfb, BUFFER_DEPTH);
+ st_framebuffer_add_renderbuffer(stfb, BUFFER_ACCUM);
+
+ st_framebuffer_update_attachments(stfb);
+
+ stfb->Base.Initialized = GL_TRUE;
+
+ return stfb;
+}
+
+/**
+ * Reference a framebuffer.
+ */
+static void
+st_framebuffer_reference(struct st_framebuffer **ptr,
+ struct st_framebuffer *stfb)
+{
+ GLframebuffer *fb = &stfb->Base;
+ _mesa_reference_framebuffer((GLframebuffer **) ptr, fb);
+}
+
+static void
+st_context_notify_invalid_framebuffer(struct st_context_iface *stctxi,
+ struct st_framebuffer_iface *stfbi)
+{
+ struct st_context *st = (struct st_context *) stctxi;
+ struct st_framebuffer *stfb;
+
+ /* either draw or read winsys fb */
+ stfb = st_ws_framebuffer(st->ctx->WinSysDrawBuffer);
+ if (!stfb || stfb->iface != stfbi)
+ stfb = st_ws_framebuffer(st->ctx->WinSysReadBuffer);
+ assert(stfb && stfb->iface == stfbi);
+
+ p_atomic_set(&stfb->revalidate, TRUE);
+}
+
+static void
+st_context_flush(struct st_context_iface *stctxi, unsigned flags,
+ struct pipe_fence_handle **fence)
+{
+ struct st_context *st = (struct st_context *) stctxi;
+ st_flush(st, flags, fence);
+ if (flags & PIPE_FLUSH_RENDER_CACHE)
+ st_manager_flush_frontbuffer(st);
+}
+
+static boolean
+st_context_teximage(struct st_context_iface *stctxi, enum st_texture_type target,
+ int level, enum pipe_format internal_format,
+ struct pipe_texture *tex, boolean mipmap)
+{
+ struct st_context *st = (struct st_context *) stctxi;
+ GLcontext *ctx = st->ctx;
+ struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx);
+ struct gl_texture_object *texObj;
+ struct gl_texture_image *texImage;
+ struct st_texture_object *stObj;
+ struct st_texture_image *stImage;
+ GLenum internalFormat;
+
+ switch (target) {
+ case ST_TEXTURE_1D:
+ target = GL_TEXTURE_1D;
+ break;
+ case ST_TEXTURE_2D:
+ target = GL_TEXTURE_2D;
+ break;
+ case ST_TEXTURE_3D:
+ target = GL_TEXTURE_3D;
+ break;
+ case ST_TEXTURE_RECT:
+ target = GL_TEXTURE_RECTANGLE_ARB;
+ break;
+ default:
+ return FALSE;
+ break;
+ }
+
+ if (util_format_get_component_bits(internal_format,
+ UTIL_FORMAT_COLORSPACE_RGB, 3) > 0)
+ internalFormat = GL_RGBA;
+ else
+ internalFormat = GL_RGB;
+
+ texObj = _mesa_select_tex_object(ctx, texUnit, target);
+ _mesa_lock_texture(ctx, texObj);
+
+ stObj = st_texture_object(texObj);
+ /* switch to surface based */
+ if (!stObj->surface_based) {
+ _mesa_clear_texture_object(ctx, texObj);
+ stObj->surface_based = GL_TRUE;
+ }
+
+ texImage = _mesa_get_tex_image(ctx, texObj, target, level);
+ stImage = st_texture_image(texImage);
+ if (tex) {
+ _mesa_init_teximage_fields(ctx, target, texImage,
+ tex->width0, tex->height0, 1, 0, internalFormat);
+ texImage->TexFormat = st_ChooseTextureFormat(ctx, internalFormat,
+ GL_RGBA, GL_UNSIGNED_BYTE);
+ _mesa_set_fetch_functions(texImage, 2);
+ }
+ else {
+ _mesa_clear_texture_image(ctx, texImage);
+ }
+
+ stObj->pipe = st->pipe;
+ pipe_texture_reference(&stImage->pt, tex);
+
+ _mesa_dirty_texobj(ctx, texObj, GL_TRUE);
+ _mesa_unlock_texture(ctx, texObj);
+
+ return TRUE;
+}
+
+static void
+st_context_destroy(struct st_context_iface *stctxi)
+{
+ struct st_context *st = (struct st_context *) stctxi;
+ st_destroy_context(st);
+}
+
+static struct st_context_iface *
+st_api_create_context(struct st_api *stapi, struct st_manager *smapi,
+ const struct st_visual *visual,
+ struct st_context_iface *shared_stctxi)
+{
+ struct st_context *shared_ctx = (struct st_context *) shared_stctxi;
+ struct st_context *st;
+ struct pipe_context *pipe;
+ __GLcontextModes mode;
+
+ pipe = smapi->screen->context_create(smapi->screen, NULL);
+ if (!pipe)
+ return NULL;
+
+ st_visual_to_context_mode(visual, &mode);
+ st = st_create_context(pipe, &mode, shared_ctx);
+ if (!st) {
+ pipe->destroy(pipe);
+ return NULL;
+ }
+
+ st->iface.destroy = st_context_destroy;
+
+ st->iface.notify_invalid_framebuffer =
+ st_context_notify_invalid_framebuffer;
+ st->iface.flush = st_context_flush;
+
+ st->iface.teximage = st_context_teximage;
+ st->iface.copy = NULL;
+
+ st->iface.st_context_private = (void *) smapi;
+
+ return &st->iface;
+}
+
+static boolean
+st_api_make_current(struct st_api *stapi, struct st_context_iface *stctxi,
+ struct st_framebuffer_iface *stdrawi,
+ struct st_framebuffer_iface *streadi)
+{
+ struct st_context *st = (struct st_context *) stctxi;
+ struct st_framebuffer *stdraw, *stread, *stfb;
+ boolean ret;
+
+ _glapi_check_multithread();
+
+ if (st) {
+ /* reuse/create the draw fb */
+ stfb = st_ws_framebuffer(st->ctx->WinSysDrawBuffer);
+ if (stfb && stfb->iface == stdrawi) {
+ stdraw = NULL;
+ st_framebuffer_reference(&stdraw, stfb);
+ }
+ else {
+ stdraw = st_framebuffer_create(stdrawi);
+ }
+
+ /* reuse/create the read fb */
+ stfb = st_ws_framebuffer(st->ctx->WinSysReadBuffer);
+ if (!stfb || stfb->iface != streadi)
+ stfb = stdraw;
+ if (stfb && stfb->iface == streadi) {
+ stread = NULL;
+ st_framebuffer_reference(&stread, stfb);
+ }
+ else {
+ stread = st_framebuffer_create(streadi);
+ }
+
+ if (stdraw && stread) {
+ st_framebuffer_validate(stdraw, st);
+ if (stread != stdraw)
+ st_framebuffer_validate(stread, st);
+
+ /* modify the draw/read buffers of the context */
+ st_visual_to_default_buffer(stdraw->iface->visual,
+ &st->ctx->Color.DrawBuffer[0], NULL);
+ st_visual_to_default_buffer(stread->iface->visual,
+ &st->ctx->Pixel.ReadBuffer, NULL);
+
+ ret = _mesa_make_current(st->ctx, &stdraw->Base, &stread->Base);
+ }
+ else {
+ ret = FALSE;
+ }
+
+ st_framebuffer_reference(&stdraw, NULL);
+ st_framebuffer_reference(&stread, NULL);
+ }
+ else {
+ ret = _mesa_make_current(NULL, NULL, NULL);
+ }
+
+ return ret;
+}
+
+static struct st_context_iface *
+st_api_get_current(struct st_api *stapi)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct st_context *st = (ctx) ? ctx->st : NULL;
+
+ return (st) ? &st->iface : NULL;
+}
+
+static boolean
+st_api_is_visual_supported(struct st_api *stapi,
+ const struct st_visual *visual)
+{
+ return TRUE;
+}
+
+static st_proc_t
+st_api_get_proc_address(struct st_api *stapi, const char *procname)
+{
+ return (st_proc_t) _glapi_get_proc_address(procname);
+}
+
+static void
+st_api_destroy(struct st_api *stapi)
+{
+ FREE(stapi);
+}
+
+/**
+ * Flush the front buffer if the current context renders to the front buffer.
+ */
+void
+st_manager_flush_frontbuffer(struct st_context *st)
+{
+ struct st_framebuffer *stfb = st_ws_framebuffer(st->ctx->DrawBuffer);
+ struct st_renderbuffer *strb = NULL;
+
+ if (stfb)
+ strb = st_renderbuffer(stfb->Base.Attachment[BUFFER_FRONT_LEFT].Renderbuffer);
+ if (!strb)
+ return;
+
+ /* st_public.h */
+ if (!stfb->iface) {
+ struct pipe_surface *front_surf = strb->surface;
+ st->pipe->screen->flush_frontbuffer(st->pipe->screen,
+ front_surf, st->winsys_drawable_handle);
+ return;
+ }
+
+ stfb->iface->flush_front(stfb->iface, ST_ATTACHMENT_FRONT_LEFT);
+}
+
+/**
+ * Return the surface of an EGLImage.
+ */
+struct pipe_surface *
+st_manager_get_egl_image_surface(struct st_context *st,
+ void *eglimg, unsigned usage)
+{
+ struct st_manager *smapi =
+ (struct st_manager *) st->iface.st_context_private;
+ struct st_egl_image stimg;
+ struct pipe_surface *ps;
+
+ if (!smapi || !smapi->get_egl_image)
+ return NULL;
+
+ memset(&stimg, 0, sizeof(stimg));
+ stimg.stctxi = &st->iface;
+ stimg.egl_image = eglimg;
+ if (!smapi->get_egl_image(smapi, &stimg))
+ return NULL;
+
+ ps = smapi->screen->get_tex_surface(smapi->screen,
+ stimg.texture, stimg.face, stimg.level, stimg.zslice, usage);
+ pipe_texture_reference(&stimg.texture, NULL);
+
+ return ps;
+}
+
+/**
+ * Re-validate the framebuffers.
+ */
+void
+st_manager_validate_framebuffers(struct st_context *st)
+{
+ struct st_framebuffer *stdraw = st_ws_framebuffer(st->ctx->DrawBuffer);
+ struct st_framebuffer *stread = st_ws_framebuffer(st->ctx->ReadBuffer);
+
+ /* st_public.h */
+ if ((stdraw && !stdraw->iface) || (stread && !stread->iface)) {
+ struct pipe_screen *screen = st->pipe->screen;
+ if (screen->update_buffer)
+ screen->update_buffer(screen, st->pipe->priv);
+ return;
+ }
+
+ if (stdraw)
+ st_framebuffer_validate(stdraw, st);
+ if (stread && stread != stdraw)
+ st_framebuffer_validate(stread, st);
+}
+
+/**
+ * Add a color renderbuffer on demand.
+ */
+boolean
+st_manager_add_color_renderbuffer(struct st_context *st, GLframebuffer *fb,
+ gl_buffer_index idx)
+{
+ struct st_framebuffer *stfb = st_ws_framebuffer(fb);
+
+ /* FBO or st_public.h */
+ if (!stfb || !stfb->iface)
+ return FALSE;
+
+ if (stfb->Base.Attachment[idx].Renderbuffer)
+ return TRUE;
+
+ switch (idx) {
+ case BUFFER_FRONT_LEFT:
+ case BUFFER_BACK_LEFT:
+ case BUFFER_FRONT_RIGHT:
+ case BUFFER_BACK_RIGHT:
+ break;
+ default:
+ return FALSE;
+ break;
+ }
+
+ if (!st_framebuffer_add_renderbuffer(stfb, idx))
+ return FALSE;
+
+ st_framebuffer_update_attachments(stfb);
+ st_invalidate_state(st->ctx, _NEW_BUFFERS);
+
+ return TRUE;
+}
+
+/**
+ * Create an st_api to manage the state tracker.
+ */
+struct st_api *
+st_manager_create_api(void)
+{
+ struct st_api *stapi;
+
+ stapi = CALLOC_STRUCT(st_api);
+ if (stapi) {
+ stapi->destroy = st_api_destroy;
+ stapi->get_proc_address = st_api_get_proc_address;
+ stapi->is_visual_supported = st_api_is_visual_supported;
+
+ stapi->create_context = st_api_create_context;
+ stapi->make_current = st_api_make_current;
+ stapi->get_current = st_api_get_current;
+ }
+
+ return stapi;
+}
diff --git a/src/mesa/state_tracker/st_manager.h b/src/mesa/state_tracker/st_manager.h
new file mode 100644
index 0000000000..0d3f8f7de4
--- /dev/null
+++ b/src/mesa/state_tracker/st_manager.h
@@ -0,0 +1,51 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.9
+ *
+ * Copyright (C) 2010 LunarG Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Chia-I Wu <olv@lunarg.com>
+ */
+
+#ifndef ST_MANAGER_H
+#define ST_MANAGER_H
+
+#include "state_tracker/st_api.h"
+#include "st_context.h"
+
+struct pipe_surface *
+st_manager_get_egl_image_surface(struct st_context *st,
+ void *eglimg, unsigned usage);
+
+void
+st_manager_flush_frontbuffer(struct st_context *st);
+
+void
+st_manager_validate_framebuffers(struct st_context *st);
+
+boolean
+st_manager_add_color_renderbuffer(struct st_context *st, GLframebuffer *fb,
+ gl_buffer_index idx);
+
+struct st_api *
+st_manager_create_api(void);
+
+#endif /* ST_MANAGER_H */
diff --git a/src/mesa/state_tracker/st_public.h b/src/mesa/state_tracker/st_public.h
index 0824356cec..4b40d6d044 100644
--- a/src/mesa/state_tracker/st_public.h
+++ b/src/mesa/state_tracker/st_public.h
@@ -105,7 +105,8 @@ void st_unreference_framebuffer( struct st_framebuffer *stfb );
PUBLIC
GLboolean st_make_current(struct st_context *st,
struct st_framebuffer *draw,
- struct st_framebuffer *read);
+ struct st_framebuffer *read,
+ void *winsys_drawable_handle);
PUBLIC
struct st_context *st_get_current(void);
diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c
index 5a45c4358a..5809927852 100644
--- a/src/mesa/state_tracker/st_texture.c
+++ b/src/mesa/state_tracker/st_texture.c
@@ -192,7 +192,6 @@ st_texture_image_map(struct st_context *st, struct st_texture_image *stImage,
GLuint x, GLuint y, GLuint w, GLuint h)
{
struct pipe_context *pipe = st->pipe;
- struct pipe_screen *screen = pipe->screen;
struct pipe_texture *pt = stImage->pt;
DBG("%s \n", __FUNCTION__);
@@ -202,7 +201,7 @@ st_texture_image_map(struct st_context *st, struct st_texture_image *stImage,
usage, x, y, w, h);
if (stImage->transfer)
- return screen->transfer_map(screen, stImage->transfer);
+ return pipe->transfer_map(pipe, stImage->transfer);
else
return NULL;
}
@@ -212,13 +211,13 @@ void
st_texture_image_unmap(struct st_context *st,
struct st_texture_image *stImage)
{
- struct pipe_screen *screen = st->pipe->screen;
+ struct pipe_context *pipe = st->pipe;
DBG("%s\n", __FUNCTION__);
- screen->transfer_unmap(screen, stImage->transfer);
+ pipe->transfer_unmap(pipe, stImage->transfer);
- screen->tex_transfer_destroy(stImage->transfer);
+ pipe->tex_transfer_destroy(pipe, stImage->transfer);
}
@@ -238,8 +237,7 @@ st_surface_data(struct pipe_context *pipe,
const void *src, unsigned src_stride,
unsigned srcx, unsigned srcy, unsigned width, unsigned height)
{
- struct pipe_screen *screen = pipe->screen;
- void *map = screen->transfer_map(screen, dst);
+ void *map = pipe->transfer_map(pipe, dst);
assert(dst->texture);
util_copy_rect(map,
@@ -250,7 +248,7 @@ st_surface_data(struct pipe_context *pipe,
src, src_stride,
srcx, srcy);
- screen->transfer_unmap(screen, dst);
+ pipe->transfer_unmap(pipe, dst);
}
@@ -265,7 +263,6 @@ st_texture_image_data(struct st_context *st,
GLuint src_row_stride, GLuint src_image_stride)
{
struct pipe_context *pipe = st->pipe;
- struct pipe_screen *screen = pipe->screen;
GLuint depth = u_minify(dst->depth0, level);
GLuint i;
const GLubyte *srcUB = src;
@@ -287,7 +284,7 @@ st_texture_image_data(struct st_context *st,
u_minify(dst->width0, level),
u_minify(dst->height0, level)); /* width, height */
- screen->tex_transfer_destroy(dst_transfer);
+ pipe->tex_transfer_destroy(pipe, dst_transfer);
srcUB += src_image_stride;
}
@@ -345,21 +342,12 @@ st_texture_image_copy(struct pipe_context *pipe,
src_surface = screen->get_tex_surface(screen, src, face, srcLevel, i,
PIPE_BUFFER_USAGE_GPU_READ);
- if (pipe->surface_copy) {
- pipe->surface_copy(pipe,
- dst_surface,
- 0, 0, /* destX, Y */
- src_surface,
- 0, 0, /* srcX, Y */
- width, height);
- } else {
- util_surface_copy(pipe, FALSE,
- dst_surface,
- 0, 0, /* destX, Y */
- src_surface,
- 0, 0, /* srcX, Y */
- width, height);
- }
+ pipe->surface_copy(pipe,
+ dst_surface,
+ 0, 0, /* destX, Y */
+ src_surface,
+ 0, 0, /* srcX, Y */
+ width, height);
pipe_surface_reference(&src_surface, NULL);
pipe_surface_reference(&dst_surface, NULL);
@@ -531,14 +519,21 @@ st_bind_teximage(struct st_framebuffer *stfb, uint surfIndex,
/* save the renderbuffer's surface/texture info */
pipe_texture_reference(&strb->texture_save, strb->texture);
pipe_surface_reference(&strb->surface_save, strb->surface);
+ pipe_sampler_view_reference(&strb->sampler_view_save, strb->sampler_view);
/* plug in new surface/texture info */
pipe_texture_reference(&strb->texture, stImage->pt);
+
+ /* XXX: Shouldn't we release reference to old surface here?
+ */
+
strb->surface = screen->get_tex_surface(screen, strb->texture,
face, level, slice,
(PIPE_BUFFER_USAGE_GPU_READ |
PIPE_BUFFER_USAGE_GPU_WRITE));
+ pipe_sampler_view_reference(&strb->sampler_view, NULL);
+
st->dirty.st |= ST_NEW_FRAMEBUFFER;
return 1;
@@ -568,9 +563,11 @@ st_release_teximage(struct st_framebuffer *stfb, uint surfIndex,
/* free tex surface, restore original */
pipe_surface_reference(&strb->surface, strb->surface_save);
pipe_texture_reference(&strb->texture, strb->texture_save);
+ pipe_sampler_view_reference(&strb->sampler_view, strb->sampler_view_save);
pipe_surface_reference(&strb->surface_save, NULL);
pipe_texture_reference(&strb->texture_save, NULL);
+ pipe_sampler_view_reference(&strb->sampler_view, NULL);
st->dirty.st |= ST_NEW_FRAMEBUFFER;
diff --git a/src/mesa/state_tracker/st_texture.h b/src/mesa/state_tracker/st_texture.h
index 60868ce067..c62f7f2cc0 100644
--- a/src/mesa/state_tracker/st_texture.h
+++ b/src/mesa/state_tracker/st_texture.h
@@ -29,6 +29,9 @@
#define ST_TEXTURE_H
+#include "pipe/p_context.h"
+#include "util/u_sampler.h"
+
#include "main/mtypes.h"
struct pipe_context;
@@ -68,6 +71,13 @@ struct st_texture_object
*/
struct pipe_texture *pt;
+ /* Default sampler view attached to this texture object. Created lazily
+ * on first binding.
+ */
+ struct pipe_sampler_view *sampler_view;
+
+ struct pipe_context *pipe;
+
GLboolean teximage_realloc;
/* True if there is/was a surface bound to this texture object. It helps
@@ -105,6 +115,35 @@ st_get_stobj_texture(struct st_texture_object *stObj)
}
+static INLINE struct pipe_sampler_view *
+st_sampler_view_from_texture(struct pipe_context *pipe,
+ struct pipe_texture *texture)
+{
+ struct pipe_sampler_view templ;
+
+ u_sampler_view_default_template(&templ,
+ texture,
+ texture->format);
+
+ return pipe->create_sampler_view(pipe, texture, &templ);
+}
+
+
+static INLINE struct pipe_sampler_view *
+st_get_stobj_sampler_view(struct st_texture_object *stObj)
+{
+ if (!stObj || !stObj->pt) {
+ return NULL;
+ }
+
+ if (!stObj->sampler_view) {
+ stObj->sampler_view = st_sampler_view_from_texture(stObj->pipe, stObj->pt);
+ }
+
+ return stObj->sampler_view;
+}
+
+
extern struct pipe_texture *
st_texture_create(struct st_context *st,
enum pipe_texture_target target,
diff --git a/src/mesa/swrast/s_clear.c b/src/mesa/swrast/s_clear.c
index 7b0a63391f..efe500ae2b 100644
--- a/src/mesa/swrast/s_clear.c
+++ b/src/mesa/swrast/s_clear.c
@@ -25,7 +25,6 @@
#include "main/glheader.h"
#include "main/colormac.h"
#include "main/condrender.h"
-#include "main/formats.h"
#include "main/macros.h"
#include "main/imports.h"
#include "main/mtypes.h"
diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c
index 997c2f4bb7..3fc554c5a2 100644
--- a/src/mesa/swrast/s_texfilter.c
+++ b/src/mesa/swrast/s_texfilter.c
@@ -488,14 +488,15 @@ tex_array_slice(GLfloat coord, GLsizei size)
/**
* Compute nearest integer texcoords for given texobj and coordinate.
+ * NOTE: only used for depth texture sampling.
*/
static INLINE void
nearest_texcoord(const struct gl_texture_object *texObj,
+ GLuint level,
const GLfloat texcoord[4],
GLint *i, GLint *j, GLint *k)
{
- const GLint baseLevel = texObj->BaseLevel;
- const struct gl_texture_image *img = texObj->Image[0][baseLevel];
+ const struct gl_texture_image *img = texObj->Image[0][level];
const GLint width = img->Width;
const GLint height = img->Height;
const GLint depth = img->Depth;
@@ -534,15 +535,16 @@ nearest_texcoord(const struct gl_texture_object *texObj,
/**
* Compute linear integer texcoords for given texobj and coordinate.
+ * NOTE: only used for depth texture sampling.
*/
static INLINE void
linear_texcoord(const struct gl_texture_object *texObj,
+ GLuint level,
const GLfloat texcoord[4],
GLint *i0, GLint *i1, GLint *j0, GLint *j1, GLint *slice,
GLfloat *wi, GLfloat *wj)
{
- const GLint baseLevel = texObj->BaseLevel;
- const struct gl_texture_image *img = texObj->Image[0][baseLevel];
+ const struct gl_texture_image *img = texObj->Image[0][level];
const GLint width = img->Width;
const GLint height = img->Height;
const GLint depth = img->Depth;
@@ -2963,7 +2965,26 @@ shadow_compare4(GLenum function, GLfloat coord,
/**
- * Sample a shadow/depth texture.
+ * Choose the mipmap level to use when sampling from a depth texture.
+ */
+static int
+choose_depth_texture_level(const struct gl_texture_object *tObj, GLfloat lambda)
+{
+ GLint level;
+
+ lambda = CLAMP(lambda, tObj->MinLod, tObj->MaxLod);
+
+ level = (GLint) lambda;
+
+ level = CLAMP(level, tObj->BaseLevel, tObj->_MaxLevel);
+
+ return level;
+}
+
+
+/**
+ * Sample a shadow/depth texture. This function is incomplete. It doesn't
+ * check for minification vs. magnification, etc.
*/
static void
sample_depth_texture( GLcontext *ctx,
@@ -2971,8 +2992,8 @@ sample_depth_texture( GLcontext *ctx,
const GLfloat texcoords[][4], const GLfloat lambda[],
GLfloat texel[][4] )
{
- const GLint baseLevel = tObj->BaseLevel;
- const struct gl_texture_image *img = tObj->Image[0][baseLevel];
+ const GLint level = choose_depth_texture_level(tObj, lambda[0]);
+ const struct gl_texture_image *img = tObj->Image[0][level];
const GLint width = img->Width;
const GLint height = img->Height;
const GLint depth = img->Depth;
@@ -2982,8 +3003,6 @@ sample_depth_texture( GLcontext *ctx,
GLenum function;
GLfloat result;
- (void) lambda;
-
ASSERT(img->_BaseFormat == GL_DEPTH_COMPONENT ||
img->_BaseFormat == GL_DEPTH_STENCIL_EXT);
@@ -3006,7 +3025,7 @@ sample_depth_texture( GLcontext *ctx,
GLfloat depthSample;
GLint col, row, slice;
- nearest_texcoord(tObj, texcoords[i], &col, &row, &slice);
+ nearest_texcoord(tObj, level, texcoords[i], &col, &row, &slice);
if (col >= 0 && row >= 0 && col < width && row < height &&
slice >= 0 && slice < depth) {
@@ -3044,7 +3063,7 @@ sample_depth_texture( GLcontext *ctx,
GLfloat wi, wj;
GLuint useBorderTexel;
- linear_texcoord(tObj, texcoords[i], &i0, &i1, &j0, &j1, &slice,
+ linear_texcoord(tObj, level, texcoords[i], &i0, &i1, &j0, &j1, &slice,
&wi, &wj);
useBorderTexel = 0;
diff --git a/src/mesa/x86-64/glapi_x86-64.S b/src/mesa/x86-64/glapi_x86-64.S
index a76cbb07d5..3124606757 100644
--- a/src/mesa/x86-64/glapi_x86-64.S
+++ b/src/mesa/x86-64/glapi_x86-64.S
@@ -30096,9 +30096,9 @@ GL_PREFIX(EndConditionalRenderNV):
.size GL_PREFIX(EndConditionalRenderNV), .-GL_PREFIX(EndConditionalRenderNV)
.p2align 4,,15
- .globl GL_PREFIX(ProvokingVertexEXT)
- .type GL_PREFIX(ProvokingVertexEXT), @function
-GL_PREFIX(ProvokingVertexEXT):
+ .globl GL_PREFIX(BeginTransformFeedbackEXT)
+ .type GL_PREFIX(BeginTransformFeedbackEXT), @function
+GL_PREFIX(BeginTransformFeedbackEXT):
#if defined(GLX_USE_TLS)
call _x86_64_get_dispatch@PLT
movq 6360(%rax), %r11
@@ -30122,13 +30122,12 @@ GL_PREFIX(ProvokingVertexEXT):
movq 6360(%rax), %r11
jmp *%r11
#endif /* defined(GLX_USE_TLS) */
- .size GL_PREFIX(ProvokingVertexEXT), .-GL_PREFIX(ProvokingVertexEXT)
+ .size GL_PREFIX(BeginTransformFeedbackEXT), .-GL_PREFIX(BeginTransformFeedbackEXT)
.p2align 4,,15
- .globl GL_PREFIX(_dispatch_stub_796)
- .type GL_PREFIX(_dispatch_stub_796), @function
- HIDDEN(GL_PREFIX(_dispatch_stub_796))
-GL_PREFIX(_dispatch_stub_796):
+ .globl GL_PREFIX(BindBufferBaseEXT)
+ .type GL_PREFIX(BindBufferBaseEXT), @function
+GL_PREFIX(BindBufferBaseEXT):
#if defined(GLX_USE_TLS)
call _x86_64_get_dispatch@PLT
movq 6368(%rax), %r11
@@ -30160,13 +30159,12 @@ GL_PREFIX(_dispatch_stub_796):
movq 6368(%rax), %r11
jmp *%r11
#endif /* defined(GLX_USE_TLS) */
- .size GL_PREFIX(_dispatch_stub_796), .-GL_PREFIX(_dispatch_stub_796)
+ .size GL_PREFIX(BindBufferBaseEXT), .-GL_PREFIX(BindBufferBaseEXT)
.p2align 4,,15
- .globl GL_PREFIX(_dispatch_stub_797)
- .type GL_PREFIX(_dispatch_stub_797), @function
- HIDDEN(GL_PREFIX(_dispatch_stub_797))
-GL_PREFIX(_dispatch_stub_797):
+ .globl GL_PREFIX(BindBufferOffsetEXT)
+ .type GL_PREFIX(BindBufferOffsetEXT), @function
+GL_PREFIX(BindBufferOffsetEXT):
#if defined(GLX_USE_TLS)
call _x86_64_get_dispatch@PLT
movq 6376(%rax), %r11
@@ -30175,7 +30173,11 @@ GL_PREFIX(_dispatch_stub_797):
pushq %rdi
pushq %rsi
pushq %rdx
+ pushq %rcx
+ pushq %rbp
call _x86_64_get_dispatch@PLT
+ popq %rbp
+ popq %rcx
popq %rdx
popq %rsi
popq %rdi
@@ -30191,14 +30193,295 @@ GL_PREFIX(_dispatch_stub_797):
pushq %rdi
pushq %rsi
pushq %rdx
+ pushq %rcx
+ pushq %rbp
call _glapi_get_dispatch
+ popq %rbp
+ popq %rcx
popq %rdx
popq %rsi
popq %rdi
movq 6376(%rax), %r11
jmp *%r11
#endif /* defined(GLX_USE_TLS) */
- .size GL_PREFIX(_dispatch_stub_797), .-GL_PREFIX(_dispatch_stub_797)
+ .size GL_PREFIX(BindBufferOffsetEXT), .-GL_PREFIX(BindBufferOffsetEXT)
+
+ .p2align 4,,15
+ .globl GL_PREFIX(BindBufferRangeEXT)
+ .type GL_PREFIX(BindBufferRangeEXT), @function
+GL_PREFIX(BindBufferRangeEXT):
+#if defined(GLX_USE_TLS)
+ call _x86_64_get_dispatch@PLT
+ movq 6384(%rax), %r11
+ jmp *%r11
+#elif defined(PTHREADS)
+ pushq %rdi
+ pushq %rsi
+ pushq %rdx
+ pushq %rcx
+ pushq %r8
+ call _x86_64_get_dispatch@PLT
+ popq %r8
+ popq %rcx
+ popq %rdx
+ popq %rsi
+ popq %rdi
+ movq 6384(%rax), %r11
+ jmp *%r11
+#else
+ movq _glapi_Dispatch(%rip), %rax
+ testq %rax, %rax
+ je 1f
+ movq 6384(%rax), %r11
+ jmp *%r11
+1:
+ pushq %rdi
+ pushq %rsi
+ pushq %rdx
+ pushq %rcx
+ pushq %r8
+ call _glapi_get_dispatch
+ popq %r8
+ popq %rcx
+ popq %rdx
+ popq %rsi
+ popq %rdi
+ movq 6384(%rax), %r11
+ jmp *%r11
+#endif /* defined(GLX_USE_TLS) */
+ .size GL_PREFIX(BindBufferRangeEXT), .-GL_PREFIX(BindBufferRangeEXT)
+
+ .p2align 4,,15
+ .globl GL_PREFIX(EndTransformFeedbackEXT)
+ .type GL_PREFIX(EndTransformFeedbackEXT), @function
+GL_PREFIX(EndTransformFeedbackEXT):
+#if defined(GLX_USE_TLS)
+ call _x86_64_get_dispatch@PLT
+ movq 6392(%rax), %r11
+ jmp *%r11
+#elif defined(PTHREADS)
+ pushq %rbp
+ call _x86_64_get_dispatch@PLT
+ popq %rbp
+ movq 6392(%rax), %r11
+ jmp *%r11
+#else
+ movq _glapi_Dispatch(%rip), %rax
+ testq %rax, %rax
+ je 1f
+ movq 6392(%rax), %r11
+ jmp *%r11
+1:
+ pushq %rbp
+ call _glapi_get_dispatch
+ popq %rbp
+ movq 6392(%rax), %r11
+ jmp *%r11
+#endif /* defined(GLX_USE_TLS) */
+ .size GL_PREFIX(EndTransformFeedbackEXT), .-GL_PREFIX(EndTransformFeedbackEXT)
+
+ .p2align 4,,15
+ .globl GL_PREFIX(GetTransformFeedbackVaryingEXT)
+ .type GL_PREFIX(GetTransformFeedbackVaryingEXT), @function
+GL_PREFIX(GetTransformFeedbackVaryingEXT):
+#if defined(GLX_USE_TLS)
+ call _x86_64_get_dispatch@PLT
+ movq 6400(%rax), %r11
+ jmp *%r11
+#elif defined(PTHREADS)
+ pushq %rdi
+ pushq %rsi
+ pushq %rdx
+ pushq %rcx
+ pushq %r8
+ pushq %r9
+ pushq %rbp
+ call _x86_64_get_dispatch@PLT
+ popq %rbp
+ popq %r9
+ popq %r8
+ popq %rcx
+ popq %rdx
+ popq %rsi
+ popq %rdi
+ movq 6400(%rax), %r11
+ jmp *%r11
+#else
+ movq _glapi_Dispatch(%rip), %rax
+ testq %rax, %rax
+ je 1f
+ movq 6400(%rax), %r11
+ jmp *%r11
+1:
+ pushq %rdi
+ pushq %rsi
+ pushq %rdx
+ pushq %rcx
+ pushq %r8
+ pushq %r9
+ pushq %rbp
+ call _glapi_get_dispatch
+ popq %rbp
+ popq %r9
+ popq %r8
+ popq %rcx
+ popq %rdx
+ popq %rsi
+ popq %rdi
+ movq 6400(%rax), %r11
+ jmp *%r11
+#endif /* defined(GLX_USE_TLS) */
+ .size GL_PREFIX(GetTransformFeedbackVaryingEXT), .-GL_PREFIX(GetTransformFeedbackVaryingEXT)
+
+ .p2align 4,,15
+ .globl GL_PREFIX(TransformFeedbackVaryingsEXT)
+ .type GL_PREFIX(TransformFeedbackVaryingsEXT), @function
+GL_PREFIX(TransformFeedbackVaryingsEXT):
+#if defined(GLX_USE_TLS)
+ call _x86_64_get_dispatch@PLT
+ movq 6408(%rax), %r11
+ jmp *%r11
+#elif defined(PTHREADS)
+ pushq %rdi
+ pushq %rsi
+ pushq %rdx
+ pushq %rcx
+ pushq %rbp
+ call _x86_64_get_dispatch@PLT
+ popq %rbp
+ popq %rcx
+ popq %rdx
+ popq %rsi
+ popq %rdi
+ movq 6408(%rax), %r11
+ jmp *%r11
+#else
+ movq _glapi_Dispatch(%rip), %rax
+ testq %rax, %rax
+ je 1f
+ movq 6408(%rax), %r11
+ jmp *%r11
+1:
+ pushq %rdi
+ pushq %rsi
+ pushq %rdx
+ pushq %rcx
+ pushq %rbp
+ call _glapi_get_dispatch
+ popq %rbp
+ popq %rcx
+ popq %rdx
+ popq %rsi
+ popq %rdi
+ movq 6408(%rax), %r11
+ jmp *%r11
+#endif /* defined(GLX_USE_TLS) */
+ .size GL_PREFIX(TransformFeedbackVaryingsEXT), .-GL_PREFIX(TransformFeedbackVaryingsEXT)
+
+ .p2align 4,,15
+ .globl GL_PREFIX(ProvokingVertexEXT)
+ .type GL_PREFIX(ProvokingVertexEXT), @function
+GL_PREFIX(ProvokingVertexEXT):
+#if defined(GLX_USE_TLS)
+ call _x86_64_get_dispatch@PLT
+ movq 6416(%rax), %r11
+ jmp *%r11
+#elif defined(PTHREADS)
+ pushq %rdi
+ call _x86_64_get_dispatch@PLT
+ popq %rdi
+ movq 6416(%rax), %r11
+ jmp *%r11
+#else
+ movq _glapi_Dispatch(%rip), %rax
+ testq %rax, %rax
+ je 1f
+ movq 6416(%rax), %r11
+ jmp *%r11
+1:
+ pushq %rdi
+ call _glapi_get_dispatch
+ popq %rdi
+ movq 6416(%rax), %r11
+ jmp *%r11
+#endif /* defined(GLX_USE_TLS) */
+ .size GL_PREFIX(ProvokingVertexEXT), .-GL_PREFIX(ProvokingVertexEXT)
+
+ .p2align 4,,15
+ .globl GL_PREFIX(_dispatch_stub_803)
+ .type GL_PREFIX(_dispatch_stub_803), @function
+ HIDDEN(GL_PREFIX(_dispatch_stub_803))
+GL_PREFIX(_dispatch_stub_803):
+#if defined(GLX_USE_TLS)
+ call _x86_64_get_dispatch@PLT
+ movq 6424(%rax), %r11
+ jmp *%r11
+#elif defined(PTHREADS)
+ pushq %rdi
+ pushq %rsi
+ pushq %rdx
+ call _x86_64_get_dispatch@PLT
+ popq %rdx
+ popq %rsi
+ popq %rdi
+ movq 6424(%rax), %r11
+ jmp *%r11
+#else
+ movq _glapi_Dispatch(%rip), %rax
+ testq %rax, %rax
+ je 1f
+ movq 6424(%rax), %r11
+ jmp *%r11
+1:
+ pushq %rdi
+ pushq %rsi
+ pushq %rdx
+ call _glapi_get_dispatch
+ popq %rdx
+ popq %rsi
+ popq %rdi
+ movq 6424(%rax), %r11
+ jmp *%r11
+#endif /* defined(GLX_USE_TLS) */
+ .size GL_PREFIX(_dispatch_stub_803), .-GL_PREFIX(_dispatch_stub_803)
+
+ .p2align 4,,15
+ .globl GL_PREFIX(_dispatch_stub_804)
+ .type GL_PREFIX(_dispatch_stub_804), @function
+ HIDDEN(GL_PREFIX(_dispatch_stub_804))
+GL_PREFIX(_dispatch_stub_804):
+#if defined(GLX_USE_TLS)
+ call _x86_64_get_dispatch@PLT
+ movq 6432(%rax), %r11
+ jmp *%r11
+#elif defined(PTHREADS)
+ pushq %rdi
+ pushq %rsi
+ pushq %rdx
+ call _x86_64_get_dispatch@PLT
+ popq %rdx
+ popq %rsi
+ popq %rdi
+ movq 6432(%rax), %r11
+ jmp *%r11
+#else
+ movq _glapi_Dispatch(%rip), %rax
+ testq %rax, %rax
+ je 1f
+ movq 6432(%rax), %r11
+ jmp *%r11
+1:
+ pushq %rdi
+ pushq %rsi
+ pushq %rdx
+ call _glapi_get_dispatch
+ popq %rdx
+ popq %rsi
+ popq %rdi
+ movq 6432(%rax), %r11
+ jmp *%r11
+#endif /* defined(GLX_USE_TLS) */
+ .size GL_PREFIX(_dispatch_stub_804), .-GL_PREFIX(_dispatch_stub_804)
.p2align 4,,15
.globl GL_PREFIX(GetObjectParameterivAPPLE)
@@ -30206,7 +30489,7 @@ GL_PREFIX(_dispatch_stub_797):
GL_PREFIX(GetObjectParameterivAPPLE):
#if defined(GLX_USE_TLS)
call _x86_64_get_dispatch@PLT
- movq 6384(%rax), %r11
+ movq 6440(%rax), %r11
jmp *%r11
#elif defined(PTHREADS)
pushq %rdi
@@ -30220,13 +30503,13 @@ GL_PREFIX(GetObjectParameterivAPPLE):
popq %rdx
popq %rsi
popq %rdi
- movq 6384(%rax), %r11
+ movq 6440(%rax), %r11
jmp *%r11
#else
movq _glapi_Dispatch(%rip), %rax
testq %rax, %rax
je 1f
- movq 6384(%rax), %r11
+ movq 6440(%rax), %r11
jmp *%r11
1:
pushq %rdi
@@ -30240,7 +30523,7 @@ GL_PREFIX(GetObjectParameterivAPPLE):
popq %rdx
popq %rsi
popq %rdi
- movq 6384(%rax), %r11
+ movq 6440(%rax), %r11
jmp *%r11
#endif /* defined(GLX_USE_TLS) */
.size GL_PREFIX(GetObjectParameterivAPPLE), .-GL_PREFIX(GetObjectParameterivAPPLE)
@@ -30251,7 +30534,7 @@ GL_PREFIX(GetObjectParameterivAPPLE):
GL_PREFIX(ObjectPurgeableAPPLE):
#if defined(GLX_USE_TLS)
call _x86_64_get_dispatch@PLT
- movq 6392(%rax), %r11
+ movq 6448(%rax), %r11
jmp *%r11
#elif defined(PTHREADS)
pushq %rdi
@@ -30261,13 +30544,13 @@ GL_PREFIX(ObjectPurgeableAPPLE):
popq %rdx
popq %rsi
popq %rdi
- movq 6392(%rax), %r11
+ movq 6448(%rax), %r11
jmp *%r11
#else
movq _glapi_Dispatch(%rip), %rax
testq %rax, %rax
je 1f
- movq 6392(%rax), %r11
+ movq 6448(%rax), %r11
jmp *%r11
1:
pushq %rdi
@@ -30277,7 +30560,7 @@ GL_PREFIX(ObjectPurgeableAPPLE):
popq %rdx
popq %rsi
popq %rdi
- movq 6392(%rax), %r11
+ movq 6448(%rax), %r11
jmp *%r11
#endif /* defined(GLX_USE_TLS) */
.size GL_PREFIX(ObjectPurgeableAPPLE), .-GL_PREFIX(ObjectPurgeableAPPLE)
@@ -30288,7 +30571,7 @@ GL_PREFIX(ObjectPurgeableAPPLE):
GL_PREFIX(ObjectUnpurgeableAPPLE):
#if defined(GLX_USE_TLS)
call _x86_64_get_dispatch@PLT
- movq 6400(%rax), %r11
+ movq 6456(%rax), %r11
jmp *%r11
#elif defined(PTHREADS)
pushq %rdi
@@ -30298,13 +30581,13 @@ GL_PREFIX(ObjectUnpurgeableAPPLE):
popq %rdx
popq %rsi
popq %rdi
- movq 6400(%rax), %r11
+ movq 6456(%rax), %r11
jmp *%r11
#else
movq _glapi_Dispatch(%rip), %rax
testq %rax, %rax
je 1f
- movq 6400(%rax), %r11
+ movq 6456(%rax), %r11
jmp *%r11
1:
pushq %rdi
@@ -30314,19 +30597,19 @@ GL_PREFIX(ObjectUnpurgeableAPPLE):
popq %rdx
popq %rsi
popq %rdi
- movq 6400(%rax), %r11
+ movq 6456(%rax), %r11
jmp *%r11
#endif /* defined(GLX_USE_TLS) */
.size GL_PREFIX(ObjectUnpurgeableAPPLE), .-GL_PREFIX(ObjectUnpurgeableAPPLE)
.p2align 4,,15
- .globl GL_PREFIX(_dispatch_stub_801)
- .type GL_PREFIX(_dispatch_stub_801), @function
- HIDDEN(GL_PREFIX(_dispatch_stub_801))
-GL_PREFIX(_dispatch_stub_801):
+ .globl GL_PREFIX(_dispatch_stub_808)
+ .type GL_PREFIX(_dispatch_stub_808), @function
+ HIDDEN(GL_PREFIX(_dispatch_stub_808))
+GL_PREFIX(_dispatch_stub_808):
#if defined(GLX_USE_TLS)
call _x86_64_get_dispatch@PLT
- movq 6408(%rax), %r11
+ movq 6464(%rax), %r11
jmp *%r11
#elif defined(PTHREADS)
pushq %rdi
@@ -30340,13 +30623,13 @@ GL_PREFIX(_dispatch_stub_801):
popq %rdx
popq %rsi
popq %rdi
- movq 6408(%rax), %r11
+ movq 6464(%rax), %r11
jmp *%r11
#else
movq _glapi_Dispatch(%rip), %rax
testq %rax, %rax
je 1f
- movq 6408(%rax), %r11
+ movq 6464(%rax), %r11
jmp *%r11
1:
pushq %rdi
@@ -30360,19 +30643,19 @@ GL_PREFIX(_dispatch_stub_801):
popq %rdx
popq %rsi
popq %rdi
- movq 6408(%rax), %r11
+ movq 6464(%rax), %r11
jmp *%r11
#endif /* defined(GLX_USE_TLS) */
- .size GL_PREFIX(_dispatch_stub_801), .-GL_PREFIX(_dispatch_stub_801)
+ .size GL_PREFIX(_dispatch_stub_808), .-GL_PREFIX(_dispatch_stub_808)
.p2align 4,,15
- .globl GL_PREFIX(_dispatch_stub_802)
- .type GL_PREFIX(_dispatch_stub_802), @function
- HIDDEN(GL_PREFIX(_dispatch_stub_802))
-GL_PREFIX(_dispatch_stub_802):
+ .globl GL_PREFIX(_dispatch_stub_809)
+ .type GL_PREFIX(_dispatch_stub_809), @function
+ HIDDEN(GL_PREFIX(_dispatch_stub_809))
+GL_PREFIX(_dispatch_stub_809):
#if defined(GLX_USE_TLS)
call _x86_64_get_dispatch@PLT
- movq 6416(%rax), %r11
+ movq 6472(%rax), %r11
jmp *%r11
#elif defined(PTHREADS)
pushq %rdi
@@ -30386,13 +30669,13 @@ GL_PREFIX(_dispatch_stub_802):
popq %rdx
popq %rsi
popq %rdi
- movq 6416(%rax), %r11
+ movq 6472(%rax), %r11
jmp *%r11
#else
movq _glapi_Dispatch(%rip), %rax
testq %rax, %rax
je 1f
- movq 6416(%rax), %r11
+ movq 6472(%rax), %r11
jmp *%r11
1:
pushq %rdi
@@ -30406,19 +30689,19 @@ GL_PREFIX(_dispatch_stub_802):
popq %rdx
popq %rsi
popq %rdi
- movq 6416(%rax), %r11
+ movq 6472(%rax), %r11
jmp *%r11
#endif /* defined(GLX_USE_TLS) */
- .size GL_PREFIX(_dispatch_stub_802), .-GL_PREFIX(_dispatch_stub_802)
+ .size GL_PREFIX(_dispatch_stub_809), .-GL_PREFIX(_dispatch_stub_809)
.p2align 4,,15
- .globl GL_PREFIX(_dispatch_stub_803)
- .type GL_PREFIX(_dispatch_stub_803), @function
- HIDDEN(GL_PREFIX(_dispatch_stub_803))
-GL_PREFIX(_dispatch_stub_803):
+ .globl GL_PREFIX(_dispatch_stub_810)
+ .type GL_PREFIX(_dispatch_stub_810), @function
+ HIDDEN(GL_PREFIX(_dispatch_stub_810))
+GL_PREFIX(_dispatch_stub_810):
#if defined(GLX_USE_TLS)
call _x86_64_get_dispatch@PLT
- movq 6424(%rax), %r11
+ movq 6480(%rax), %r11
jmp *%r11
#elif defined(PTHREADS)
pushq %rdi
@@ -30432,13 +30715,13 @@ GL_PREFIX(_dispatch_stub_803):
popq %rdx
popq %rsi
popq %rdi
- movq 6424(%rax), %r11
+ movq 6480(%rax), %r11
jmp *%r11
#else
movq _glapi_Dispatch(%rip), %rax
testq %rax, %rax
je 1f
- movq 6424(%rax), %r11
+ movq 6480(%rax), %r11
jmp *%r11
1:
pushq %rdi
@@ -30452,19 +30735,19 @@ GL_PREFIX(_dispatch_stub_803):
popq %rdx
popq %rsi
popq %rdi
- movq 6424(%rax), %r11
+ movq 6480(%rax), %r11
jmp *%r11
#endif /* defined(GLX_USE_TLS) */
- .size GL_PREFIX(_dispatch_stub_803), .-GL_PREFIX(_dispatch_stub_803)
+ .size GL_PREFIX(_dispatch_stub_810), .-GL_PREFIX(_dispatch_stub_810)
.p2align 4,,15
- .globl GL_PREFIX(_dispatch_stub_804)
- .type GL_PREFIX(_dispatch_stub_804), @function
- HIDDEN(GL_PREFIX(_dispatch_stub_804))
-GL_PREFIX(_dispatch_stub_804):
+ .globl GL_PREFIX(_dispatch_stub_811)
+ .type GL_PREFIX(_dispatch_stub_811), @function
+ HIDDEN(GL_PREFIX(_dispatch_stub_811))
+GL_PREFIX(_dispatch_stub_811):
#if defined(GLX_USE_TLS)
call _x86_64_get_dispatch@PLT
- movq 6432(%rax), %r11
+ movq 6488(%rax), %r11
jmp *%r11
#elif defined(PTHREADS)
pushq %rdi
@@ -30474,13 +30757,13 @@ GL_PREFIX(_dispatch_stub_804):
popq %rdx
popq %rsi
popq %rdi
- movq 6432(%rax), %r11
+ movq 6488(%rax), %r11
jmp *%r11
#else
movq _glapi_Dispatch(%rip), %rax
testq %rax, %rax
je 1f
- movq 6432(%rax), %r11
+ movq 6488(%rax), %r11
jmp *%r11
1:
pushq %rdi
@@ -30490,19 +30773,19 @@ GL_PREFIX(_dispatch_stub_804):
popq %rdx
popq %rsi
popq %rdi
- movq 6432(%rax), %r11
+ movq 6488(%rax), %r11
jmp *%r11
#endif /* defined(GLX_USE_TLS) */
- .size GL_PREFIX(_dispatch_stub_804), .-GL_PREFIX(_dispatch_stub_804)
+ .size GL_PREFIX(_dispatch_stub_811), .-GL_PREFIX(_dispatch_stub_811)
.p2align 4,,15
- .globl GL_PREFIX(_dispatch_stub_805)
- .type GL_PREFIX(_dispatch_stub_805), @function
- HIDDEN(GL_PREFIX(_dispatch_stub_805))
-GL_PREFIX(_dispatch_stub_805):
+ .globl GL_PREFIX(_dispatch_stub_812)
+ .type GL_PREFIX(_dispatch_stub_812), @function
+ HIDDEN(GL_PREFIX(_dispatch_stub_812))
+GL_PREFIX(_dispatch_stub_812):
#if defined(GLX_USE_TLS)
call _x86_64_get_dispatch@PLT
- movq 6440(%rax), %r11
+ movq 6496(%rax), %r11
jmp *%r11
#elif defined(PTHREADS)
pushq %rdi
@@ -30512,13 +30795,13 @@ GL_PREFIX(_dispatch_stub_805):
popq %rdx
popq %rsi
popq %rdi
- movq 6440(%rax), %r11
+ movq 6496(%rax), %r11
jmp *%r11
#else
movq _glapi_Dispatch(%rip), %rax
testq %rax, %rax
je 1f
- movq 6440(%rax), %r11
+ movq 6496(%rax), %r11
jmp *%r11
1:
pushq %rdi
@@ -30528,10 +30811,10 @@ GL_PREFIX(_dispatch_stub_805):
popq %rdx
popq %rsi
popq %rdi
- movq 6440(%rax), %r11
+ movq 6496(%rax), %r11
jmp *%r11
#endif /* defined(GLX_USE_TLS) */
- .size GL_PREFIX(_dispatch_stub_805), .-GL_PREFIX(_dispatch_stub_805)
+ .size GL_PREFIX(_dispatch_stub_812), .-GL_PREFIX(_dispatch_stub_812)
.p2align 4,,15
.globl GL_PREFIX(EGLImageTargetRenderbufferStorageOES)
@@ -30539,7 +30822,7 @@ GL_PREFIX(_dispatch_stub_805):
GL_PREFIX(EGLImageTargetRenderbufferStorageOES):
#if defined(GLX_USE_TLS)
call _x86_64_get_dispatch@PLT
- movq 6448(%rax), %r11
+ movq 6504(%rax), %r11
jmp *%r11
#elif defined(PTHREADS)
pushq %rdi
@@ -30549,13 +30832,13 @@ GL_PREFIX(EGLImageTargetRenderbufferStorageOES):
popq %rbp
popq %rsi
popq %rdi
- movq 6448(%rax), %r11
+ movq 6504(%rax), %r11
jmp *%r11
#else
movq _glapi_Dispatch(%rip), %rax
testq %rax, %rax
je 1f
- movq 6448(%rax), %r11
+ movq 6504(%rax), %r11
jmp *%r11
1:
pushq %rdi
@@ -30565,7 +30848,7 @@ GL_PREFIX(EGLImageTargetRenderbufferStorageOES):
popq %rbp
popq %rsi
popq %rdi
- movq 6448(%rax), %r11
+ movq 6504(%rax), %r11
jmp *%r11
#endif /* defined(GLX_USE_TLS) */
.size GL_PREFIX(EGLImageTargetRenderbufferStorageOES), .-GL_PREFIX(EGLImageTargetRenderbufferStorageOES)
@@ -30576,7 +30859,7 @@ GL_PREFIX(EGLImageTargetRenderbufferStorageOES):
GL_PREFIX(EGLImageTargetTexture2DOES):
#if defined(GLX_USE_TLS)
call _x86_64_get_dispatch@PLT
- movq 6456(%rax), %r11
+ movq 6512(%rax), %r11
jmp *%r11
#elif defined(PTHREADS)
pushq %rdi
@@ -30586,13 +30869,13 @@ GL_PREFIX(EGLImageTargetTexture2DOES):
popq %rbp
popq %rsi
popq %rdi
- movq 6456(%rax), %r11
+ movq 6512(%rax), %r11
jmp *%r11
#else
movq _glapi_Dispatch(%rip), %rax
testq %rax, %rax
je 1f
- movq 6456(%rax), %r11
+ movq 6512(%rax), %r11
jmp *%r11
1:
pushq %rdi
@@ -30602,7 +30885,7 @@ GL_PREFIX(EGLImageTargetTexture2DOES):
popq %rbp
popq %rsi
popq %rdi
- movq 6456(%rax), %r11
+ movq 6512(%rax), %r11
jmp *%r11
#endif /* defined(GLX_USE_TLS) */
.size GL_PREFIX(EGLImageTargetTexture2DOES), .-GL_PREFIX(EGLImageTargetTexture2DOES)
@@ -30883,6 +31166,12 @@ GL_PREFIX(EGLImageTargetTexture2DOES):
.globl GL_PREFIX(RenderbufferStorage) ; .set GL_PREFIX(RenderbufferStorage), GL_PREFIX(RenderbufferStorageEXT)
.globl GL_PREFIX(BlitFramebuffer) ; .set GL_PREFIX(BlitFramebuffer), GL_PREFIX(_dispatch_stub_783)
.globl GL_PREFIX(FramebufferTextureLayer) ; .set GL_PREFIX(FramebufferTextureLayer), GL_PREFIX(FramebufferTextureLayerEXT)
+ .globl GL_PREFIX(BeginTransformFeedback) ; .set GL_PREFIX(BeginTransformFeedback), GL_PREFIX(BeginTransformFeedbackEXT)
+ .globl GL_PREFIX(BindBufferBase) ; .set GL_PREFIX(BindBufferBase), GL_PREFIX(BindBufferBaseEXT)
+ .globl GL_PREFIX(BindBufferRange) ; .set GL_PREFIX(BindBufferRange), GL_PREFIX(BindBufferRangeEXT)
+ .globl GL_PREFIX(EndTransformFeedback) ; .set GL_PREFIX(EndTransformFeedback), GL_PREFIX(EndTransformFeedbackEXT)
+ .globl GL_PREFIX(GetTransformFeedbackVarying) ; .set GL_PREFIX(GetTransformFeedbackVarying), GL_PREFIX(GetTransformFeedbackVaryingEXT)
+ .globl GL_PREFIX(TransformFeedbackVaryings) ; .set GL_PREFIX(TransformFeedbackVaryings), GL_PREFIX(TransformFeedbackVaryingsEXT)
.globl GL_PREFIX(ProvokingVertex) ; .set GL_PREFIX(ProvokingVertex), GL_PREFIX(ProvokingVertexEXT)
#if defined(GLX_USE_TLS) && defined(__linux__)
diff --git a/src/mesa/x86/glapi_x86.S b/src/mesa/x86/glapi_x86.S
index b1730d25a0..6dd387c399 100644
--- a/src/mesa/x86/glapi_x86.S
+++ b/src/mesa/x86/glapi_x86.S
@@ -976,24 +976,31 @@ GLNAME(gl_dispatch_functions_start):
GL_STUB(IsEnabledIndexedEXT, _gloffset_IsEnabledIndexedEXT, IsEnabledIndexedEXT@8)
GL_STUB(BeginConditionalRenderNV, _gloffset_BeginConditionalRenderNV, BeginConditionalRenderNV@8)
GL_STUB(EndConditionalRenderNV, _gloffset_EndConditionalRenderNV, EndConditionalRenderNV@0)
+ GL_STUB(BeginTransformFeedbackEXT, _gloffset_BeginTransformFeedbackEXT, BeginTransformFeedbackEXT@4)
+ GL_STUB(BindBufferBaseEXT, _gloffset_BindBufferBaseEXT, BindBufferBaseEXT@12)
+ GL_STUB(BindBufferOffsetEXT, _gloffset_BindBufferOffsetEXT, BindBufferOffsetEXT@16)
+ GL_STUB(BindBufferRangeEXT, _gloffset_BindBufferRangeEXT, BindBufferRangeEXT@20)
+ GL_STUB(EndTransformFeedbackEXT, _gloffset_EndTransformFeedbackEXT, EndTransformFeedbackEXT@0)
+ GL_STUB(GetTransformFeedbackVaryingEXT, _gloffset_GetTransformFeedbackVaryingEXT, GetTransformFeedbackVaryingEXT@28)
+ GL_STUB(TransformFeedbackVaryingsEXT, _gloffset_TransformFeedbackVaryingsEXT, TransformFeedbackVaryingsEXT@16)
GL_STUB(ProvokingVertexEXT, _gloffset_ProvokingVertexEXT, ProvokingVertexEXT@4)
- GL_STUB(_dispatch_stub_796, _gloffset_GetTexParameterPointervAPPLE, _dispatch_stub_796@12)
- HIDDEN(GL_PREFIX(_dispatch_stub_796, _dispatch_stub_796@12))
- GL_STUB(_dispatch_stub_797, _gloffset_TextureRangeAPPLE, _dispatch_stub_797@12)
- HIDDEN(GL_PREFIX(_dispatch_stub_797, _dispatch_stub_797@12))
+ GL_STUB(_dispatch_stub_803, _gloffset_GetTexParameterPointervAPPLE, _dispatch_stub_803@12)
+ HIDDEN(GL_PREFIX(_dispatch_stub_803, _dispatch_stub_803@12))
+ GL_STUB(_dispatch_stub_804, _gloffset_TextureRangeAPPLE, _dispatch_stub_804@12)
+ HIDDEN(GL_PREFIX(_dispatch_stub_804, _dispatch_stub_804@12))
GL_STUB(GetObjectParameterivAPPLE, _gloffset_GetObjectParameterivAPPLE, GetObjectParameterivAPPLE@16)
GL_STUB(ObjectPurgeableAPPLE, _gloffset_ObjectPurgeableAPPLE, ObjectPurgeableAPPLE@12)
GL_STUB(ObjectUnpurgeableAPPLE, _gloffset_ObjectUnpurgeableAPPLE, ObjectUnpurgeableAPPLE@12)
- GL_STUB(_dispatch_stub_801, _gloffset_StencilFuncSeparateATI, _dispatch_stub_801@16)
- HIDDEN(GL_PREFIX(_dispatch_stub_801, _dispatch_stub_801@16))
- GL_STUB(_dispatch_stub_802, _gloffset_ProgramEnvParameters4fvEXT, _dispatch_stub_802@16)
- HIDDEN(GL_PREFIX(_dispatch_stub_802, _dispatch_stub_802@16))
- GL_STUB(_dispatch_stub_803, _gloffset_ProgramLocalParameters4fvEXT, _dispatch_stub_803@16)
- HIDDEN(GL_PREFIX(_dispatch_stub_803, _dispatch_stub_803@16))
- GL_STUB(_dispatch_stub_804, _gloffset_GetQueryObjecti64vEXT, _dispatch_stub_804@12)
- HIDDEN(GL_PREFIX(_dispatch_stub_804, _dispatch_stub_804@12))
- GL_STUB(_dispatch_stub_805, _gloffset_GetQueryObjectui64vEXT, _dispatch_stub_805@12)
- HIDDEN(GL_PREFIX(_dispatch_stub_805, _dispatch_stub_805@12))
+ GL_STUB(_dispatch_stub_808, _gloffset_StencilFuncSeparateATI, _dispatch_stub_808@16)
+ HIDDEN(GL_PREFIX(_dispatch_stub_808, _dispatch_stub_808@16))
+ GL_STUB(_dispatch_stub_809, _gloffset_ProgramEnvParameters4fvEXT, _dispatch_stub_809@16)
+ HIDDEN(GL_PREFIX(_dispatch_stub_809, _dispatch_stub_809@16))
+ GL_STUB(_dispatch_stub_810, _gloffset_ProgramLocalParameters4fvEXT, _dispatch_stub_810@16)
+ HIDDEN(GL_PREFIX(_dispatch_stub_810, _dispatch_stub_810@16))
+ GL_STUB(_dispatch_stub_811, _gloffset_GetQueryObjecti64vEXT, _dispatch_stub_811@12)
+ HIDDEN(GL_PREFIX(_dispatch_stub_811, _dispatch_stub_811@12))
+ GL_STUB(_dispatch_stub_812, _gloffset_GetQueryObjectui64vEXT, _dispatch_stub_812@12)
+ HIDDEN(GL_PREFIX(_dispatch_stub_812, _dispatch_stub_812@12))
GL_STUB(EGLImageTargetRenderbufferStorageOES, _gloffset_EGLImageTargetRenderbufferStorageOES, EGLImageTargetRenderbufferStorageOES@8)
GL_STUB(EGLImageTargetTexture2DOES, _gloffset_EGLImageTargetTexture2DOES, EGLImageTargetTexture2DOES@8)
GL_STUB_ALIAS(ArrayElementEXT, _gloffset_ArrayElement, ArrayElementEXT@4, ArrayElement, ArrayElement@4)
@@ -1272,6 +1279,12 @@ GLNAME(gl_dispatch_functions_start):
GL_STUB_ALIAS(RenderbufferStorage, _gloffset_RenderbufferStorageEXT, RenderbufferStorage@16, RenderbufferStorageEXT, RenderbufferStorageEXT@16)
GL_STUB_ALIAS(BlitFramebuffer, _gloffset_BlitFramebufferEXT, BlitFramebuffer@40, _dispatch_stub_783, _dispatch_stub_783@40)
GL_STUB_ALIAS(FramebufferTextureLayer, _gloffset_FramebufferTextureLayerEXT, FramebufferTextureLayer@20, FramebufferTextureLayerEXT, FramebufferTextureLayerEXT@20)
+ GL_STUB_ALIAS(BeginTransformFeedback, _gloffset_BeginTransformFeedbackEXT, BeginTransformFeedback@4, BeginTransformFeedbackEXT, BeginTransformFeedbackEXT@4)
+ GL_STUB_ALIAS(BindBufferBase, _gloffset_BindBufferBaseEXT, BindBufferBase@12, BindBufferBaseEXT, BindBufferBaseEXT@12)
+ GL_STUB_ALIAS(BindBufferRange, _gloffset_BindBufferRangeEXT, BindBufferRange@20, BindBufferRangeEXT, BindBufferRangeEXT@20)
+ GL_STUB_ALIAS(EndTransformFeedback, _gloffset_EndTransformFeedbackEXT, EndTransformFeedback@0, EndTransformFeedbackEXT, EndTransformFeedbackEXT@0)
+ GL_STUB_ALIAS(GetTransformFeedbackVarying, _gloffset_GetTransformFeedbackVaryingEXT, GetTransformFeedbackVarying@28, GetTransformFeedbackVaryingEXT, GetTransformFeedbackVaryingEXT@28)
+ GL_STUB_ALIAS(TransformFeedbackVaryings, _gloffset_TransformFeedbackVaryingsEXT, TransformFeedbackVaryings@16, TransformFeedbackVaryingsEXT, TransformFeedbackVaryingsEXT@16)
GL_STUB_ALIAS(ProvokingVertex, _gloffset_ProvokingVertexEXT, ProvokingVertex@4, ProvokingVertexEXT, ProvokingVertexEXT@4)
GLOBL GLNAME(gl_dispatch_functions_end)
diff --git a/windows/VC8/mesa/mesa/mesa.vcproj b/windows/VC8/mesa/mesa/mesa.vcproj
index f7c3c73446..5a5b93a779 100644
--- a/windows/VC8/mesa/mesa/mesa.vcproj
+++ b/windows/VC8/mesa/mesa/mesa.vcproj
@@ -495,6 +495,10 @@
>
</File>
<File
+ RelativePath="..\..\..\..\src\mesa\glapi\glapi_entrypoint.c"
+ >
+ </File>
+ <File
RelativePath="..\..\..\..\src\mesa\glapi\glapi_getproc.c"
>
</File>