summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/SConscript5
-rw-r--r--src/egl/drivers/Makefile.template51
-rw-r--r--src/egl/drivers/demo/Makefile32
-rw-r--r--src/egl/drivers/demo/demo.c289
-rw-r--r--src/egl/drivers/glx/Makefile75
-rw-r--r--src/egl/drivers/glx/egl_glx.c107
-rw-r--r--src/egl/drivers/xdri/Makefile82
-rw-r--r--src/egl/drivers/xdri/driinit.c34
-rw-r--r--src/egl/drivers/xdri/egl_xdri.c121
-rw-r--r--src/egl/drivers/xdri/glxinit.c100
-rw-r--r--src/egl/drivers/xdri/glxinit.h3
-rw-r--r--src/egl/main/Makefile14
-rw-r--r--src/egl/main/eglapi.c146
-rw-r--r--src/egl/main/eglapi.h20
-rw-r--r--src/egl/main/eglcompiler.h18
-rw-r--r--src/egl/main/eglconfig.c5
-rw-r--r--src/egl/main/eglconfigutil.c207
-rw-r--r--src/egl/main/eglconfigutil.h10
-rw-r--r--src/egl/main/eglcontext.c233
-rw-r--r--src/egl/main/eglcontext.h70
-rw-r--r--src/egl/main/eglcurrent.c42
-rw-r--r--src/egl/main/eglcurrent.h10
-rw-r--r--src/egl/main/egldisplay.c201
-rw-r--r--src/egl/main/egldisplay.h159
-rw-r--r--src/egl/main/egldriver.c157
-rw-r--r--src/egl/main/egldriver.h10
-rw-r--r--src/egl/main/eglimage.c51
-rw-r--r--src/egl/main/eglimage.h94
-rw-r--r--src/egl/main/eglmisc.c8
-rw-r--r--src/egl/main/eglsurface.c6
-rw-r--r--src/egl/main/eglsurface.h72
-rw-r--r--src/egl/main/egltypedefs.h6
-rw-r--r--src/gallium/SConscript7
-rw-r--r--src/gallium/auxiliary/Makefile3
-rw-r--r--src/gallium/auxiliary/SConscript1
-rw-r--r--src/gallium/auxiliary/draw/draw_context.c14
-rw-r--r--src/gallium/auxiliary/draw/draw_context.h10
-rw-r--r--src/gallium/auxiliary/draw/draw_gs.c14
-rw-r--r--src/gallium/auxiliary/draw/draw_gs.h2
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe.c44
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_cull.c11
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_validate.c16
-rw-r--r--src/gallium/auxiliary/draw/draw_private.h28
-rw-r--r--src/gallium/auxiliary/draw/draw_pt.c1
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch.c1
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c1
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c13
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_post_vs.c1
-rw-r--r--src/gallium/auxiliary/draw/draw_vs.c40
-rw-r--r--src/gallium/auxiliary/draw/draw_vs.h8
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_aos.c10
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_aos.h2
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_aos_machine.c14
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_exec.c6
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_llvm.c5
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_ppc.c4
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_sse.c4
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_varient.c5
-rw-r--r--src/gallium/auxiliary/pipebuffer/Makefile18
-rw-r--r--src/gallium/auxiliary/pipebuffer/SConscript18
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c1067
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.h37
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr.h4
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c3
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_fenced.c152
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_validate.c1
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_build.c46
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_build.h9
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_dump.c50
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_exec.c267
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_exec.h2
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_parse.c4
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_parse.h1
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_sanity.c6
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_scan.c10
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_text.c34
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_ureg.c208
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_ureg.h40
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_util.c1
-rw-r--r--src/gallium/auxiliary/util/u_blit.c4
-rw-r--r--src/gallium/auxiliary/util/u_gen_mipmap.c4
-rw-r--r--src/gallium/auxiliary/util/u_surface.c1
-rw-r--r--src/gallium/auxiliary/util/u_tile.c2
-rw-r--r--src/gallium/auxiliary/util/u_upload_mgr.c4
-rw-r--r--src/gallium/docs/source/context.rst41
-rw-r--r--src/gallium/docs/source/screen.rst110
-rw-r--r--src/gallium/docs/source/tgsi.rst111
-rw-r--r--src/gallium/drivers/cell/ppu/cell_draw_arrays.c2
-rw-r--r--src/gallium/drivers/cell/spu/spu_main.h25
-rw-r--r--src/gallium/drivers/i915/i915_clear.c1
-rw-r--r--src/gallium/drivers/i915/i915_context.c5
-rw-r--r--src/gallium/drivers/i915/i915_debug.c1
-rw-r--r--src/gallium/drivers/i915/i915_debug_fp.c1
-rw-r--r--src/gallium/drivers/i915/i915_state.c2
-rw-r--r--src/gallium/drivers/i915/i915_state_derived.c1
-rw-r--r--src/gallium/drivers/i915/i915_state_sampler.c1
-rw-r--r--src/gallium/drivers/i915/i915_surface.c6
-rw-r--r--src/gallium/drivers/i915/i915_texture.c2
-rw-r--r--src/gallium/drivers/i965/brw_batchbuffer.c2
-rw-r--r--src/gallium/drivers/i965/brw_batchbuffer.h4
-rw-r--r--src/gallium/drivers/i965/brw_cc.c1
-rw-r--r--src/gallium/drivers/i965/brw_clip.c1
-rw-r--r--src/gallium/drivers/i965/brw_clip_line.c1
-rw-r--r--src/gallium/drivers/i965/brw_clip_point.c1
-rw-r--r--src/gallium/drivers/i965/brw_clip_tri.c1
-rw-r--r--src/gallium/drivers/i965/brw_clip_util.c1
-rw-r--r--src/gallium/drivers/i965/brw_context.c1
-rw-r--r--src/gallium/drivers/i965/brw_curbe.c2
-rw-r--r--src/gallium/drivers/i965/brw_draw.c1
-rw-r--r--src/gallium/drivers/i965/brw_gs.c1
-rw-r--r--src/gallium/drivers/i965/brw_gs_emit.c1
-rw-r--r--src/gallium/drivers/i965/brw_pipe_fb.c1
-rw-r--r--src/gallium/drivers/i965/brw_pipe_sampler.c1
-rw-r--r--src/gallium/drivers/i965/brw_screen.c3
-rw-r--r--src/gallium/drivers/i965/brw_sf.c1
-rw-r--r--src/gallium/drivers/i965/brw_sf_emit.c1
-rw-r--r--src/gallium/drivers/i965/brw_state_cache.c1
-rw-r--r--src/gallium/drivers/i965/brw_util.c2
-rw-r--r--src/gallium/drivers/i965/brw_vs.c2
-rw-r--r--src/gallium/drivers/i965/brw_vs_surface_state.c1
-rw-r--r--src/gallium/drivers/i965/brw_wm_fp.c1
-rw-r--r--src/gallium/drivers/i965/brw_wm_surface_state.c1
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_alpha.c1
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_arit.c1
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_blend_soa.c1
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_conv.c2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_format_aos.c1
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_draw_arrays.c2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_flush.c2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_jit.c1
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.c1
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_derived.c1
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_fs.c4
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_surface.c1
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_vertex.c1
-rw-r--r--src/gallium/drivers/llvmpipe/lp_test_blend.c1
-rw-r--r--src/gallium/drivers/llvmpipe/lp_tex_cache.c1
-rw-r--r--src/gallium/drivers/llvmpipe/lp_tex_sample_llvm.c1
-rw-r--r--src/gallium/drivers/llvmpipe/lp_texture.c2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_tile_cache.c2
-rw-r--r--src/gallium/drivers/nouveau/nouveau_screen.c2
-rw-r--r--src/gallium/drivers/nv04/nv04_vbo.c2
-rw-r--r--src/gallium/drivers/nv10/nv10_vbo.c1
-rw-r--r--src/gallium/drivers/nv20/nv20_vbo.c2
-rw-r--r--src/gallium/drivers/nv40/nv40_draw.c2
-rw-r--r--src/gallium/drivers/nv50/nv50_context.c9
-rw-r--r--src/gallium/drivers/nv50/nv50_program.c25
-rw-r--r--src/gallium/drivers/nv50/nv50_query.c40
-rw-r--r--src/gallium/drivers/nv50/nv50_tex.c3
-rw-r--r--src/gallium/drivers/r300/r300_blit.c14
-rw-r--r--src/gallium/drivers/r300/r300_context.c31
-rw-r--r--src/gallium/drivers/r300/r300_context.h14
-rw-r--r--src/gallium/drivers/r300/r300_debug.c2
-rw-r--r--src/gallium/drivers/r300/r300_emit.c166
-rw-r--r--src/gallium/drivers/r300/r300_emit.h10
-rw-r--r--src/gallium/drivers/r300/r300_flush.c1
-rw-r--r--src/gallium/drivers/r300/r300_render.c122
-rw-r--r--src/gallium/drivers/r300/r300_screen.c1
-rw-r--r--src/gallium/drivers/r300/r300_state.c51
-rw-r--r--src/gallium/drivers/r300/r300_state_derived.c113
-rw-r--r--src/gallium/drivers/r300/r300_texture.c7
-rw-r--r--src/gallium/drivers/r300/r300_texture.h1
-rw-r--r--src/gallium/drivers/softpipe/sp_context.c11
-rw-r--r--src/gallium/drivers/softpipe/sp_context.h4
-rw-r--r--src/gallium/drivers/softpipe/sp_draw_arrays.c71
-rw-r--r--src/gallium/drivers/softpipe/sp_flush.c2
-rw-r--r--src/gallium/drivers/softpipe/sp_fs_sse.c2
-rw-r--r--src/gallium/drivers/softpipe/sp_prim_vbuf.c3
-rw-r--r--src/gallium/drivers/softpipe/sp_quad_blend.c1
-rw-r--r--src/gallium/drivers/softpipe/sp_quad_depth_test.c21
-rw-r--r--src/gallium/drivers/softpipe/sp_quad_fs.c9
-rw-r--r--src/gallium/drivers/softpipe/sp_screen.c4
-rw-r--r--src/gallium/drivers/softpipe/sp_setup.c1
-rw-r--r--src/gallium/drivers/softpipe/sp_state_fs.c4
-rw-r--r--src/gallium/drivers/softpipe/sp_state_surface.c1
-rw-r--r--src/gallium/drivers/softpipe/sp_state_vertex.c1
-rw-r--r--src/gallium/drivers/softpipe/sp_tex_sample.c3
-rw-r--r--src/gallium/drivers/softpipe/sp_tex_tile_cache.c1
-rw-r--r--src/gallium/drivers/softpipe/sp_texture.c5
-rw-r--r--src/gallium/drivers/softpipe/sp_winsys.c1
-rw-r--r--src/gallium/drivers/svga/svga_draw_arrays.c1
-rw-r--r--src/gallium/drivers/svga/svga_draw_elements.c1
-rw-r--r--src/gallium/drivers/svga/svga_pipe_blend.c1
-rw-r--r--src/gallium/drivers/svga/svga_pipe_constants.c3
-rw-r--r--src/gallium/drivers/svga/svga_pipe_depthstencil.c1
-rw-r--r--src/gallium/drivers/svga/svga_pipe_draw.c1
-rw-r--r--src/gallium/drivers/svga/svga_pipe_flush.c5
-rw-r--r--src/gallium/drivers/svga/svga_pipe_fs.c2
-rw-r--r--src/gallium/drivers/svga/svga_pipe_misc.c6
-rw-r--r--src/gallium/drivers/svga/svga_pipe_query.c1
-rw-r--r--src/gallium/drivers/svga/svga_pipe_rasterizer.c1
-rw-r--r--src/gallium/drivers/svga/svga_pipe_sampler.c3
-rw-r--r--src/gallium/drivers/svga/svga_pipe_vertex.c4
-rw-r--r--src/gallium/drivers/svga/svga_pipe_vs.c1
-rw-r--r--src/gallium/drivers/svga/svga_screen.c4
-rw-r--r--src/gallium/drivers/svga/svga_screen.h6
-rw-r--r--src/gallium/drivers/svga/svga_screen_buffer.c104
-rw-r--r--src/gallium/drivers/svga/svga_screen_buffer.h8
-rw-r--r--src/gallium/drivers/svga/svga_screen_texture.c68
-rw-r--r--src/gallium/drivers/svga/svga_state_framebuffer.c2
-rw-r--r--src/gallium/drivers/svga/svga_state_rss.c3
-rw-r--r--src/gallium/drivers/svga/svga_state_tss.c2
-rw-r--r--src/gallium/drivers/svga/svga_swtnl_backend.c15
-rw-r--r--src/gallium/drivers/svga/svga_swtnl_draw.c3
-rw-r--r--src/gallium/drivers/svga/svga_swtnl_state.c1
-rw-r--r--src/gallium/drivers/svga/svga_tgsi_decl_sm20.c3
-rw-r--r--src/gallium/drivers/svga/svga_tgsi_decl_sm30.c1
-rw-r--r--src/gallium/drivers/svga/svga_winsys.h6
-rw-r--r--src/gallium/drivers/trace/tr_drm.c1
-rw-r--r--src/gallium/include/pipe/p_compiler.h2
-rw-r--r--src/gallium/include/pipe/p_context.h32
-rw-r--r--src/gallium/include/pipe/p_defines.h6
-rw-r--r--src/gallium/include/pipe/p_inlines.h41
-rw-r--r--src/gallium/include/pipe/p_shader_tokens.h9
-rw-r--r--src/gallium/include/pipe/p_state.h2
-rw-r--r--src/gallium/include/state_tracker/drm_api.h5
-rw-r--r--src/gallium/state_trackers/dri/dri_context.c6
-rw-r--r--src/gallium/state_trackers/dri/dri_drawable.c14
-rw-r--r--src/gallium/state_trackers/dri/dri_screen.c19
-rw-r--r--src/gallium/state_trackers/dri/dri_screen.h1
-rw-r--r--src/gallium/state_trackers/egl/Makefile72
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d.c (renamed from src/gallium/state_trackers/egl_g3d/common/egl_g3d.c)72
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d.h (renamed from src/gallium/state_trackers/egl_g3d/common/egl_g3d.h)0
-rw-r--r--src/gallium/state_trackers/egl/common/egl_st.c (renamed from src/gallium/state_trackers/egl_g3d/common/egl_st.c)0
-rw-r--r--src/gallium/state_trackers/egl/common/egl_st.h (renamed from src/gallium/state_trackers/egl_g3d/common/egl_st.h)0
-rw-r--r--src/gallium/state_trackers/egl/common/native.h (renamed from src/gallium/state_trackers/egl_g3d/common/native.h)0
-rw-r--r--src/gallium/state_trackers/egl/common/st_public_tmp.h (renamed from src/gallium/state_trackers/egl_g3d/common/st_public_tmp.h)0
-rw-r--r--src/gallium/state_trackers/egl/egl_context.c105
-rw-r--r--src/gallium/state_trackers/egl/egl_surface.c443
-rw-r--r--src/gallium/state_trackers/egl/egl_tracker.c272
-rw-r--r--src/gallium/state_trackers/egl/egl_tracker.h195
-rw-r--r--src/gallium/state_trackers/egl/egl_visual.c85
-rw-r--r--src/gallium/state_trackers/egl/kms/native_kms.c (renamed from src/gallium/state_trackers/egl_g3d/kms/native_kms.c)0
-rw-r--r--src/gallium/state_trackers/egl/kms/native_kms.h (renamed from src/gallium/state_trackers/egl_g3d/kms/native_kms.h)0
-rw-r--r--src/gallium/state_trackers/egl/x11/native_dri2.c (renamed from src/gallium/state_trackers/egl_g3d/x11/native_dri2.c)0
-rw-r--r--src/gallium/state_trackers/egl/x11/native_x11.c (renamed from src/gallium/state_trackers/egl_g3d/x11/native_x11.c)3
-rw-r--r--src/gallium/state_trackers/egl/x11/native_x11.h (renamed from src/gallium/state_trackers/egl_g3d/x11/native_x11.h)0
-rw-r--r--src/gallium/state_trackers/egl/x11/native_ximage.c (renamed from src/gallium/state_trackers/egl_g3d/x11/native_ximage.c)0
-rw-r--r--src/gallium/state_trackers/egl/x11/sw_winsys.c (renamed from src/gallium/state_trackers/egl_g3d/x11/sw_winsys.c)0
-rw-r--r--src/gallium/state_trackers/egl/x11/sw_winsys.h (renamed from src/gallium/state_trackers/egl_g3d/x11/sw_winsys.h)0
-rw-r--r--src/gallium/state_trackers/egl/x11/x11_screen.c (renamed from src/gallium/state_trackers/egl_g3d/x11/x11_screen.c)8
-rw-r--r--src/gallium/state_trackers/egl/x11/x11_screen.h (renamed from src/gallium/state_trackers/egl_g3d/x11/x11_screen.h)0
-rw-r--r--src/gallium/state_trackers/egl_g3d/Makefile72
-rw-r--r--src/gallium/state_trackers/egl_g3d/x11/glxinit.c573
-rw-r--r--src/gallium/state_trackers/egl_g3d/x11/glxinit.h14
-rw-r--r--src/gallium/state_trackers/es/Makefile4
-rw-r--r--src/gallium/state_trackers/python/SConscript1
-rw-r--r--src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-cb-1d.sh13
-rw-r--r--src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-cb-2d.sh9
-rw-r--r--src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-slt.sh2
-rw-r--r--src/gallium/state_trackers/python/tests/regress/fragment-shader/fragment-shader.py39
-rw-r--r--src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-cb-1d.sh16
-rw-r--r--src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-cb-2d.sh12
-rw-r--r--src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py40
-rw-r--r--src/gallium/state_trackers/vega/Makefile80
-rw-r--r--src/gallium/state_trackers/vega/shader.c4
-rw-r--r--src/gallium/state_trackers/wgl/stw_pixelformat.c5
-rw-r--r--src/gallium/state_trackers/xorg/xorg_composite.c3
-rw-r--r--src/gallium/state_trackers/xorg/xorg_crtc.c1
-rw-r--r--src/gallium/state_trackers/xorg/xorg_dri2.c50
-rw-r--r--src/gallium/state_trackers/xorg/xorg_driver.c96
-rw-r--r--src/gallium/state_trackers/xorg/xorg_exa.c2
-rw-r--r--src/gallium/state_trackers/xorg/xorg_exa_tgsi.c2
-rw-r--r--src/gallium/state_trackers/xorg/xorg_output.c2
-rw-r--r--src/gallium/state_trackers/xorg/xorg_renderer.c1
-rw-r--r--src/gallium/state_trackers/xorg/xorg_tracker.h1
-rw-r--r--src/gallium/state_trackers/xorg/xorg_winsys.h1
-rw-r--r--src/gallium/state_trackers/xorg/xorg_xv.c3
-rw-r--r--src/gallium/winsys/drm/Makefile.egl (renamed from src/gallium/winsys/drm/Makefile.egl_g3d)24
-rw-r--r--src/gallium/winsys/drm/Makefile.template9
-rw-r--r--src/gallium/winsys/drm/i965/egl/Makefile27
-rw-r--r--src/gallium/winsys/drm/i965/egl/dummy.c (renamed from src/gallium/winsys/drm/i965/egl_g3d/dummy.c)0
-rw-r--r--src/gallium/winsys/drm/i965/egl_g3d/Makefile14
-rw-r--r--src/gallium/winsys/drm/intel/egl/Makefile36
-rw-r--r--src/gallium/winsys/drm/intel/egl/dummy.c2
-rw-r--r--src/gallium/winsys/drm/intel/egl_g3d/Makefile14
-rw-r--r--src/gallium/winsys/drm/intel/gem/intel_drm_api.c1
-rw-r--r--src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c12
-rw-r--r--src/gallium/winsys/drm/nouveau/egl/Makefile (renamed from src/gallium/winsys/drm/nouveau/egl_g3d/Makefile)2
-rw-r--r--src/gallium/winsys/drm/nouveau/egl/dummy.c (renamed from src/gallium/winsys/drm/intel/egl_g3d/dummy.c)0
-rw-r--r--src/gallium/winsys/drm/radeon/core/radeon_buffer.c56
-rw-r--r--src/gallium/winsys/drm/radeon/core/radeon_drm.c1
-rw-r--r--src/gallium/winsys/drm/radeon/core/radeon_drm.h2
-rw-r--r--src/gallium/winsys/drm/radeon/core/radeon_r300.c13
-rw-r--r--src/gallium/winsys/drm/radeon/core/radeon_winsys.h6
-rw-r--r--src/gallium/winsys/drm/radeon/egl/Makefile36
-rw-r--r--src/gallium/winsys/drm/radeon/egl/dummy.c2
-rw-r--r--src/gallium/winsys/drm/radeon/egl_g3d/Makefile14
-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/core/swrast_drm_api.c13
-rw-r--r--src/gallium/winsys/drm/swrast/egl/Makefile12
-rw-r--r--src/gallium/winsys/drm/swrast/egl/dummy.c (renamed from src/gallium/winsys/drm/nouveau/egl_g3d/dummy.c)0
-rw-r--r--src/gallium/winsys/drm/vmware/core/vmw_context.c114
-rw-r--r--src/gallium/winsys/drm/vmware/core/vmw_screen.h4
-rw-r--r--src/gallium/winsys/drm/vmware/core/vmw_screen_dri.c86
-rw-r--r--src/gallium/winsys/drm/vmware/core/vmw_screen_pools.c22
-rw-r--r--src/gallium/winsys/drm/vmware/egl/Makefile16
-rw-r--r--src/gallium/winsys/drm/vmware/egl/dummy.c (renamed from src/gallium/winsys/drm/radeon/egl_g3d/dummy.c)0
-rw-r--r--src/gallium/winsys/drm/vmware/egl_g3d/Makefile14
-rw-r--r--src/gallium/winsys/drm/vmware/egl_g3d/dummy.c1
-rw-r--r--src/gallium/winsys/drm/vmware/xorg/vmw_video.c3
-rw-r--r--src/gallium/winsys/drm/vmware/xorg/vmw_xorg.c10
-rw-r--r--src/gallium/winsys/egl_xlib/Makefile84
-rw-r--r--src/gallium/winsys/egl_xlib/egl_xlib.c853
-rw-r--r--src/gallium/winsys/egl_xlib/sw_winsys.c231
-rw-r--r--src/gallium/winsys/egl_xlib/sw_winsys.h40
-rw-r--r--src/gallium/winsys/xlib/xlib.c3
-rw-r--r--src/gallium/winsys/xlib/xlib_softpipe.c40
-rw-r--r--src/glew/SConscript3
-rw-r--r--src/glsl/pp/sl_pp_purify.c2
-rw-r--r--src/glx/x11/Makefile21
-rw-r--r--src/glx/x11/dri2.c20
-rw-r--r--src/glx/x11/glxclient.h5
-rw-r--r--src/glx/x11/glxcurrent.c1
-rw-r--r--src/glx/x11/glxext.c7
-rw-r--r--src/glx/x11/indirect.c3
-rw-r--r--src/glx/x11/indirect_size.c1
-rw-r--r--src/glx/x11/single2.c3
-rw-r--r--src/glx/x11/singlepix.c3
-rw-r--r--src/mesa/SConscript1
-rw-r--r--src/mesa/drivers/dri/common/spantmp2.h2
-rw-r--r--src/mesa/drivers/dri/common/utils.c1
-rw-r--r--src/mesa/drivers/dri/fb/Makefile3
-rw-r--r--src/mesa/drivers/dri/fb/fb_egl.c881
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_bitmap.c1
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_clear.c3
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_dd.c4
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_depth.c1
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_lines.c4
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_points.c2
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_span.c2
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_state.c5
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_stencil.c2
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_vb.c2
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_xmesa.c2
-rw-r--r--src/mesa/drivers/dri/i810/i810context.c3
-rw-r--r--src/mesa/drivers/dri/i810/i810render.c1
-rw-r--r--src/mesa/drivers/dri/i810/i810screen.c4
-rw-r--r--src/mesa/drivers/dri/i810/i810state.c2
-rw-r--r--src/mesa/drivers/dri/i810/i810tex.c2
-rw-r--r--src/mesa/drivers/dri/i810/i810texmem.c1
-rw-r--r--src/mesa/drivers/dri/i810/i810vb.c1
-rw-r--r--src/mesa/drivers/dri/i915/i830_context.c3
-rw-r--r--src/mesa/drivers/dri/i915/i830_vtbl.c2
-rw-r--r--src/mesa/drivers/dri/i915/i915_context.c5
-rw-r--r--src/mesa/drivers/dri/i915/i915_debug_fp.c3
-rw-r--r--src/mesa/drivers/dri/i915/i915_vtbl.c3
-rw-r--r--src/mesa/drivers/dri/i915/intel_tris.c1
-rw-r--r--src/mesa/drivers/dri/i965/brw_cc.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_clip_line.c1
-rw-r--r--src/mesa/drivers/dri/i965/brw_clip_point.c1
-rw-r--r--src/mesa/drivers/dri/i965/brw_clip_state.c1
-rw-r--r--src/mesa/drivers/dri/i965/brw_clip_tri.c1
-rw-r--r--src/mesa/drivers/dri/i965/brw_clip_unfilled.c1
-rw-r--r--src/mesa/drivers/dri/i965/brw_clip_util.c1
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c8
-rw-r--r--src/mesa/drivers/dri/i965/brw_draw.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_draw_upload.c15
-rw-r--r--src/mesa/drivers/dri/i965/brw_fallback.c3
-rw-r--r--src/mesa/drivers/dri/i965/brw_gs_emit.c1
-rw-r--r--src/mesa/drivers/dri/i965/brw_gs_state.c1
-rw-r--r--src/mesa/drivers/dri/i965/brw_misc_state.c6
-rw-r--r--src/mesa/drivers/dri/i965/brw_program.c1
-rw-r--r--src/mesa/drivers/dri/i965/brw_sf_state.c7
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs_surface_state.c5
-rw-r--r--src/mesa/drivers/dri/i965/brw_vtbl.c1
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm.c7
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm.h1
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_emit.c44
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_surface_state.c4
-rw-r--r--src/mesa/drivers/dri/intel/intel_batchbuffer.c41
-rw-r--r--src/mesa/drivers/dri/intel/intel_blit.c300
-rw-r--r--src/mesa/drivers/dri/intel/intel_buffers.c55
-rw-r--r--src/mesa/drivers/dri/intel/intel_buffers.h6
-rw-r--r--src/mesa/drivers/dri/intel/intel_clear.c3
-rw-r--r--src/mesa/drivers/dri/intel/intel_context.c22
-rw-r--r--src/mesa/drivers/dri/intel/intel_context.h5
-rw-r--r--src/mesa/drivers/dri/intel/intel_extensions.c3
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel.c7
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel_bitmap.c140
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel_copy.c137
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel_draw.c3
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel_read.c78
-rw-r--r--src/mesa/drivers/dri/intel/intel_regions.c1
-rw-r--r--src/mesa/drivers/dri/intel/intel_screen.c23
-rw-r--r--src/mesa/drivers/dri/intel/intel_span.c41
-rw-r--r--src/mesa/drivers/dri/intel/intel_state.c2
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_copy.c6
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_image.c1
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_validate.c2
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_context.c2
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_dd.c3
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_lock.c1
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_screen.c2
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_span.c1
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_state.c3
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_tex.c5
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_texmem.c3
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_texstate.c2
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_vb.c1
-rw-r--r--src/mesa/drivers/dri/mga/mga_xmesa.c2
-rw-r--r--src/mesa/drivers/dri/mga/mgadd.c5
-rw-r--r--src/mesa/drivers/dri/mga/mgaioctl.c3
-rw-r--r--src/mesa/drivers/dri/mga/mgarender.c1
-rw-r--r--src/mesa/drivers/dri/mga/mgatex.c3
-rw-r--r--src/mesa/drivers/dri/mga/mgatris.c1
-rw-r--r--src/mesa/drivers/dri/mga/mgavb.c1
-rw-r--r--src/mesa/drivers/dri/r200/Makefile4
-rw-r--r--src/mesa/drivers/dri/r200/r200_blit.c4
-rw-r--r--src/mesa/drivers/dri/r200/r200_context.c4
-rw-r--r--src/mesa/drivers/dri/r200/r200_state_init.c3
-rw-r--r--src/mesa/drivers/dri/r200/r200_vertprog.c2
l---------src/mesa/drivers/dri/r200/server/radeon_egl.c1
-rw-r--r--src/mesa/drivers/dri/r300/Makefile4
-rw-r--r--src/mesa/drivers/dri/r300/r300_cmdbuf.c2
-rw-r--r--src/mesa/drivers/dri/r300/r300_context.c7
-rw-r--r--src/mesa/drivers/dri/r300/r300_draw.c17
-rw-r--r--src/mesa/drivers/dri/r300/r300_emit.c4
-rw-r--r--src/mesa/drivers/dri/r300/r300_fragprog_common.c2
-rw-r--r--src/mesa/drivers/dri/r300/r300_reg.h3
-rw-r--r--src/mesa/drivers/dri/r300/r300_render.c5
-rw-r--r--src/mesa/drivers/dri/r300/r300_state.c3
-rw-r--r--src/mesa/drivers/dri/r300/r300_tex.c4
-rw-r--r--src/mesa/drivers/dri/r300/r300_texstate.c1
-rw-r--r--src/mesa/drivers/dri/r300/r300_vertprog.c1
l---------src/mesa/drivers/dri/r300/server/radeon_egl.c1
-rw-r--r--src/mesa/drivers/dri/r600/Makefile4
-rw-r--r--src/mesa/drivers/dri/r600/r600_context.c16
-rw-r--r--src/mesa/drivers/dri/r600/r600_tex.h2
-rw-r--r--src/mesa/drivers/dri/r600/r600_texstate.c72
-rw-r--r--src/mesa/drivers/dri/r600/r700_assembler.c15
-rw-r--r--src/mesa/drivers/dri/r600/r700_chip.c3
-rw-r--r--src/mesa/drivers/dri/r600/r700_state.c10
l---------src/mesa/drivers/dri/r600/server/radeon_egl.c1
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_common.c3
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_cs_legacy.c1
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_fbo.c7
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_ioctl.c1
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_lighting.c681
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c27
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h2
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_queryobj.c2
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_texture.c7
-rw-r--r--src/mesa/drivers/dri/radeon/server/radeon_egl.c1088
-rw-r--r--src/mesa/drivers/dri/savage/savagedd.c4
-rw-r--r--src/mesa/drivers/dri/savage/savageioctl.c2
-rw-r--r--src/mesa/drivers/dri/savage/savagerender.c1
-rw-r--r--src/mesa/drivers/dri/savage/savagespan.c1
-rw-r--r--src/mesa/drivers/dri/savage/savagetex.c2
-rw-r--r--src/mesa/drivers/dri/savage/savagetris.c1
-rw-r--r--src/mesa/drivers/dri/sis/sis6326_state.c2
-rw-r--r--src/mesa/drivers/dri/sis/sis_context.c3
-rw-r--r--src/mesa/drivers/dri/sis/sis_dd.c2
-rw-r--r--src/mesa/drivers/dri/sis/sis_fog.c1
-rw-r--r--src/mesa/drivers/dri/sis/sis_screen.c1
-rw-r--r--src/mesa/drivers/dri/sis/sis_state.c4
-rw-r--r--src/mesa/drivers/dri/sis/sis_tex.c1
-rw-r--r--src/mesa/drivers/dri/sis/sis_texstate.c1
-rw-r--r--src/mesa/drivers/dri/sis/sis_tris.c1
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_dd.c7
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_lock.c1
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_pixels.c1
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_screen.c2
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_state.c4
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_texman.c1
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_texstate.c1
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_vb.c5
-rw-r--r--src/mesa/drivers/dri/unichrome/via_context.c3
-rw-r--r--src/mesa/drivers/dri/unichrome/via_ioctl.c1
-rw-r--r--src/mesa/drivers/dri/unichrome/via_render.c1
-rw-r--r--src/mesa/drivers/dri/unichrome/via_screen.c4
-rw-r--r--src/mesa/drivers/dri/unichrome/via_state.c3
-rw-r--r--src/mesa/drivers/dri/unichrome/via_tex.c2
-rw-r--r--src/mesa/drivers/dri/unichrome/via_texcombine.c1
-rw-r--r--src/mesa/drivers/x11/glxapi.c3
-rw-r--r--src/mesa/es/Makefile32
-rw-r--r--src/mesa/es/glapi/Makefile6
-rw-r--r--src/mesa/glapi/Makefile2
-rw-r--r--src/mesa/glapi/gl_API.xml3
-rw-r--r--src/mesa/glapi/gl_apitemp.py4
-rw-r--r--src/mesa/glapi/gl_x86_asm.py2
-rw-r--r--src/mesa/glapi/glapi.c81
-rw-r--r--src/mesa/glapi/glapi.h8
-rw-r--r--src/mesa/glapi/glapi_nop.c91
-rw-r--r--src/mesa/glapi/glapitemp.h4
-rw-r--r--src/mesa/main/attrib.c1
-rw-r--r--src/mesa/main/blend.c1
-rw-r--r--src/mesa/main/buffers.c2
-rw-r--r--src/mesa/main/compiler.h15
-rw-r--r--src/mesa/main/context.c8
-rw-r--r--src/mesa/main/convolve.c1
-rw-r--r--src/mesa/main/debug.c4
-rw-r--r--src/mesa/main/depthstencil.c1
-rw-r--r--src/mesa/main/dlist.c27
-rw-r--r--src/mesa/main/drawpix.c1
-rw-r--r--src/mesa/main/enable.c1
-rw-r--r--src/mesa/main/enums.c4459
-rw-r--r--src/mesa/main/extensions.c3
-rw-r--r--src/mesa/main/fbobject.c32
-rw-r--r--src/mesa/main/formats.c1
-rw-r--r--src/mesa/main/image.c1
-rw-r--r--src/mesa/main/lines.c2
-rw-r--r--src/mesa/main/mipmap.c1
-rw-r--r--src/mesa/main/mtypes.h4
-rw-r--r--src/mesa/main/pixel.c1
-rw-r--r--src/mesa/main/pixelstore.c3
-rw-r--r--src/mesa/main/points.c1
-rw-r--r--src/mesa/main/polygon.c1
-rw-r--r--src/mesa/main/scissor.c6
-rw-r--r--src/mesa/main/state.c7
-rw-r--r--src/mesa/main/texcompress.c3
-rw-r--r--src/mesa/main/texformat.c2
-rw-r--r--src/mesa/main/texgetimage.c2
-rw-r--r--src/mesa/main/teximage.c13
-rw-r--r--src/mesa/main/texobj.c1
-rw-r--r--src/mesa/main/texparam.c1
-rw-r--r--src/mesa/main/texstate.c5
-rw-r--r--src/mesa/main/texstore.c4
-rw-r--r--src/mesa/main/varray.c21
-rw-r--r--src/mesa/main/vtxfmt.c2
-rw-r--r--src/mesa/shader/arbprogparse.c4
-rw-r--r--src/mesa/shader/arbprogram.c68
-rw-r--r--src/mesa/shader/lex.yy.c10
-rw-r--r--src/mesa/shader/nvprogram.c4
-rw-r--r--src/mesa/shader/nvvertparse.c1
-rw-r--r--src/mesa/shader/prog_execute.c77
-rw-r--r--src/mesa/shader/prog_optimize.c8
-rw-r--r--src/mesa/shader/prog_statevars.c1
-rw-r--r--src/mesa/shader/program.c2
-rw-r--r--src/mesa/shader/program_lexer.l10
-rw-r--r--src/mesa/shader/program_parse.tab.c16
-rw-r--r--src/mesa/shader/program_parse.y16
-rw-r--r--src/mesa/shader/program_parse_extra.c12
-rw-r--r--src/mesa/shader/program_parser.h2
-rw-r--r--src/mesa/shader/shader_api.c10
-rw-r--r--src/mesa/shader/slang/slang_builtin.c1
-rw-r--r--src/mesa/shader/slang/slang_codegen.c2
-rw-r--r--src/mesa/shader/slang/slang_compile.c3
-rw-r--r--src/mesa/shader/slang/slang_emit.c1
-rw-r--r--src/mesa/shader/slang/slang_link.c1
-rw-r--r--src/mesa/shader/slang/slang_log.c1
-rw-r--r--src/mesa/sources.mak1
-rw-r--r--src/mesa/state_tracker/st_atom_framebuffer.c1
-rw-r--r--src/mesa/state_tracker/st_atom_pixeltransfer.c1
-rw-r--r--src/mesa/state_tracker/st_atom_sampler.c1
-rw-r--r--src/mesa/state_tracker/st_atom_scissor.c17
-rw-r--r--src/mesa/state_tracker/st_atom_shader.c3
-rw-r--r--src/mesa/state_tracker/st_cb_accum.c2
-rw-r--r--src/mesa/state_tracker/st_cb_bitmap.c15
-rw-r--r--src/mesa/state_tracker/st_cb_blit.c4
-rw-r--r--src/mesa/state_tracker/st_cb_clear.c11
-rw-r--r--src/mesa/state_tracker/st_cb_condrender.c1
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c12
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.c1
-rw-r--r--src/mesa/state_tracker/st_cb_feedback.c3
-rw-r--r--src/mesa/state_tracker/st_cb_program.c1
-rw-r--r--src/mesa/state_tracker/st_cb_queryobj.c1
-rw-r--r--src/mesa/state_tracker/st_cb_rasterpos.c1
-rw-r--r--src/mesa/state_tracker/st_cb_readpixels.c2
-rw-r--r--src/mesa/state_tracker/st_cb_strings.c1
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c64
-rw-r--r--src/mesa/state_tracker/st_cb_viewport.c3
-rw-r--r--src/mesa/state_tracker/st_context.c6
-rw-r--r--src/mesa/state_tracker/st_context.h2
-rw-r--r--src/mesa/state_tracker/st_draw_feedback.c3
-rw-r--r--src/mesa/state_tracker/st_extensions.c1
-rw-r--r--src/mesa/state_tracker/st_format.c3
-rw-r--r--src/mesa/state_tracker/st_framebuffer.c4
-rw-r--r--src/mesa/state_tracker/st_gen_mipmap.c2
-rw-r--r--src/mesa/state_tracker/st_inlines.h10
-rw-r--r--src/mesa/swrast/s_aatritemp.h8
-rw-r--r--src/mesa/swrast/s_accum.c2
-rw-r--r--src/mesa/swrast/s_alpha.c4
-rw-r--r--src/mesa/swrast/s_atifragshader.c27
-rw-r--r--src/mesa/swrast/s_context.c10
-rw-r--r--src/mesa/swrast/s_depth.c41
-rw-r--r--src/mesa/swrast/s_fog.c12
-rw-r--r--src/mesa/swrast/s_fragprog.c12
-rw-r--r--src/mesa/swrast/s_points.c12
-rw-r--r--src/mesa/swrast/s_span.c9
-rw-r--r--src/mesa/swrast/s_texcombine.c20
-rw-r--r--src/mesa/swrast/s_texfilter.c2
-rw-r--r--src/mesa/tnl/t_draw.c21
-rw-r--r--src/mesa/tnl/t_vb_points.c2
-rw-r--r--src/mesa/tnl/t_vertex.c2
-rw-r--r--src/mesa/vbo/vbo_exec_array.c24
-rw-r--r--src/mesa/vbo/vbo_split.c4
-rw-r--r--src/mesa/x86/assyntax.h4
-rw-r--r--src/mesa/x86/glapi_x86.S2
-rw-r--r--src/mesa/x86/read_rgba_span_x86.S4
592 files changed, 7519 insertions, 12492 deletions
diff --git a/src/SConscript b/src/SConscript
index 6083fcbec98..cd4896ada40 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -8,5 +8,6 @@ if 'mesa' in env['statetrackers']:
SConscript('gallium/winsys/SConscript')
-SConscript('glut/glx/SConscript')
-SConscript('glew/SConscript')
+if platform != 'embedded':
+ SConscript('glut/glx/SConscript')
+ SConscript('glew/SConscript')
diff --git a/src/egl/drivers/Makefile.template b/src/egl/drivers/Makefile.template
new file mode 100644
index 00000000000..e9a614ce62d
--- /dev/null
+++ b/src/egl/drivers/Makefile.template
@@ -0,0 +1,51 @@
+# src/egl/drivers/Makefile.template
+#
+# Drivers should define
+#
+# EGL_DRIVER, the driver name
+# EGL_SOURCES, the driver sources
+# EGL_INCLUDES, the include pathes
+# EGL_CFLAGS, additional CFLAGS
+# EGL_LIBS, additional LIBS
+#
+# before including this template.
+#
+
+
+EGL_DRIVER_PATH = $(TOP)/$(LIB_DIR)/$(EGL_DRIVER)
+EGL_OBJECTS = $(EGL_SOURCES:.c=.o)
+
+
+default: depend $(EGL_DRIVER_PATH)
+
+$(EGL_DRIVER_PATH): $(EGL_DRIVER)
+ $(INSTALL) $< $(TOP)/$(LIB_DIR)
+
+$(EGL_DRIVER): $(EGL_OBJECTS) Makefile $(TOP)/src/egl/drivers/Makefile.template
+ @$(MKLIB) -o $(EGL_DRIVER) -noprefix \
+ -linker '$(CC)' -ldflags '$(LDFLAGS)' \
+ -L$(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \
+ $(EGL_OBJECTS) $(EGL_LIBS)
+
+.c.o:
+ $(CC) -c $(EGL_INCLUDES) $(CFLAGS) $(EGL_CFLAGS) $< -o $@
+
+
+install: $(EGL_DRIVER_PATH)
+ $(INSTALL) -d $(DESTDIR)$(EGL_DRIVER_INSTALL_DIR)
+ $(MINSTALL) $(EGL_DRIVER_PATH) $(DESTDIR)$(EGL_DRIVER_INSTALL_DIR)
+
+clean:
+ rm -f $(EGL_DRIVER)
+ rm -f $(EGL_OBJECTS)
+ rm -f depend depend.bak
+
+depend: $(EGL_SOURCES)
+ @ echo "running $(MKDEP)"
+ @ rm -f depend
+ @ touch depend
+ $(MKDEP) $(MKDEP_OPTIONS) $(EGL_INCLUDES) $(EGL_SOURCES) \
+ >/dev/null 2>/dev/null
+
+sinclude depend
+# DO NOT DELETE
diff --git a/src/egl/drivers/demo/Makefile b/src/egl/drivers/demo/Makefile
deleted file mode 100644
index 444dfb35bde..00000000000
--- a/src/egl/drivers/demo/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-# src/egl/drivers/demo/Makefile
-
-TOP = ../../../..
-include $(TOP)/configs/current
-
-
-INCLUDE_DIRS = -I$(TOP)/include -I$(TOP)/src/egl/main $(X11_INCLUDES)
-
-
-SOURCES = demo.c
-
-OBJECTS = $(SOURCES:.c=.o)
-
-
-.c.o:
- $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
-
-
-
-default: $(TOP)/$(LIB_DIR)/demodriver.so
-
-
-$(TOP)/$(LIB_DIR)/demodriver.so: $(OBJECTS)
- $(MKLIB) -o demodriver.so -noprefix -linker '$(CC)' \
- -ldflags '$(LDFLAGS)' -install $(TOP)/$(LIB_DIR) \
- $(OBJECTS)
-
-install:
-
-clean:
- -rm -f *.o
- -rm -f *.so
diff --git a/src/egl/drivers/demo/demo.c b/src/egl/drivers/demo/demo.c
deleted file mode 100644
index 0933c0bdaa5..00000000000
--- a/src/egl/drivers/demo/demo.c
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * Sample driver: Demo
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "eglconfig.h"
-#include "eglcontext.h"
-#include "egldisplay.h"
-#include "egldriver.h"
-#include "eglglobals.h"
-#include "eglmode.h"
-#include "eglscreen.h"
-#include "eglsurface.h"
-
-
-/**
- * Demo driver-specific driver class derived from _EGLDriver
- */
-typedef struct demo_driver
-{
- _EGLDriver Base; /* base class/object */
- unsigned DemoStuff;
-} DemoDriver;
-
-#define DEMO_DRIVER(D) ((DemoDriver *) (D))
-
-
-/**
- * Demo driver-specific surface class derived from _EGLSurface
- */
-typedef struct demo_surface
-{
- _EGLSurface Base; /* base class/object */
- unsigned DemoStuff;
-} DemoSurface;
-
-
-/**
- * Demo driver-specific context class derived from _EGLContext
- */
-typedef struct demo_context
-{
- _EGLContext Base; /* base class/object */
- unsigned DemoStuff;
-} DemoContext;
-
-
-
-static EGLBoolean
-demoInitialize(_EGLDriver *drv, _EGLDisplay *disp, EGLint *major, EGLint *minor)
-{
- _EGLScreen *scrn;
- EGLint i;
-
- /* Create a screen */
- scrn = calloc(1, sizeof(*scrn));
- _eglAddScreen(disp, scrn);
-
- /* Create the screen's modes - silly example */
- _eglAddNewMode(scrn, 1600, 1200, 72 * 1000, "1600x1200-72");
- _eglAddNewMode(scrn, 1280, 1024, 72 * 1000, "1280x1024-70");
- _eglAddNewMode(scrn, 1280, 1024, 70 * 1000, "1280x1024-70");
- _eglAddNewMode(scrn, 1024, 768, 72 * 1000, "1024x768-72");
-
- /* Create the display's visual configs - silly example */
- for (i = 0; i < 4; i++) {
- _EGLConfig *config = calloc(1, sizeof(_EGLConfig));
- _eglInitConfig(config, i + 1);
- _eglSetConfigAttrib(config, EGL_RED_SIZE, 8);
- _eglSetConfigAttrib(config, EGL_GREEN_SIZE, 8);
- _eglSetConfigAttrib(config, EGL_BLUE_SIZE, 8);
- _eglSetConfigAttrib(config, EGL_ALPHA_SIZE, 8);
- _eglSetConfigAttrib(config, EGL_BUFFER_SIZE, 32);
- if (i & 1) {
- _eglSetConfigAttrib(config, EGL_DEPTH_SIZE, 32);
- }
- if (i & 2) {
- _eglSetConfigAttrib(config, EGL_STENCIL_SIZE, 8);
- }
- _eglSetConfigAttrib(config, EGL_SURFACE_TYPE,
- (EGL_WINDOW_BIT | EGL_PIXMAP_BIT | EGL_PBUFFER_BIT));
- _eglAddConfig(disp, config);
- }
-
- /* enable supported extensions */
- disp->Extensions.MESA_screen_surface = EGL_TRUE;
- disp->Extensions.MESA_copy_context = EGL_TRUE;
-
- *major = 1;
- *minor = 0;
-
- return EGL_TRUE;
-}
-
-
-static EGLBoolean
-demoTerminate(_EGLDriver *drv, _EGLDisplay *dpy)
-{
- /*DemoDriver *demo = DEMO_DRIVER(dpy);*/
- return EGL_TRUE;
-}
-
-
-static DemoContext *
-LookupDemoContext(_EGLContext *c)
-{
- return (DemoContext *) c;
-}
-
-
-static DemoSurface *
-LookupDemoSurface(_EGLSurface *s)
-{
- return (DemoSurface *) s;
-}
-
-
-static _EGLContext *
-demoCreateContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, _EGLContext *share_list, const EGLint *attrib_list)
-{
- DemoContext *c;
- int i;
-
- for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
- switch (attrib_list[i]) {
- /* no attribs defined for now */
- default:
- _eglError(EGL_BAD_ATTRIBUTE, "eglCreateContext");
- return NULL;
- }
- }
-
- c = (DemoContext *) calloc(1, sizeof(DemoContext));
- if (!c)
- return NULL;
-
- _eglInitContext(drv, &c->Base, conf, attrib_list);
- c->DemoStuff = 1;
- printf("demoCreateContext\n");
-
- return &c->Base;
-}
-
-
-static _EGLSurface *
-demoCreateWindowSurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, NativeWindowType window, const EGLint *attrib_list)
-{
- int i;
- for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
- switch (attrib_list[i]) {
- /* no attribs at this time */
- default:
- _eglError(EGL_BAD_ATTRIBUTE, "eglCreateWindowSurface");
- return NULL;
- }
- }
- printf("eglCreateWindowSurface()\n");
- /* XXX unfinished */
-
- return NULL;
-}
-
-
-static _EGLSurface *
-demoCreatePixmapSurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, NativePixmapType pixmap, const EGLint *attrib_list)
-{
- EGLint i;
-
- for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
- switch (attrib_list[i]) {
- /* no attribs at this time */
- default:
- _eglError(EGL_BAD_ATTRIBUTE, "eglCreatePixmapSurface");
- return NULL;
- }
- }
-
- if (GET_CONFIG_ATTRIB(conf, EGL_SURFACE_TYPE) == 0) {
- _eglError(EGL_BAD_MATCH, "eglCreatePixmapSurface");
- return NULL;
- }
-
- printf("eglCreatePixmapSurface()\n");
- return NULL;
-}
-
-
-static _EGLSurface *
-demoCreatePbufferSurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
- const EGLint *attrib_list)
-{
- DemoSurface *surf = (DemoSurface *) calloc(1, sizeof(DemoSurface));
-
- if (!surf)
- return NULL;
-
- if (!_eglInitSurface(drv, &surf->Base, EGL_PBUFFER_BIT,
- conf, attrib_list)) {
- free(surf);
- return NULL;
- }
-
- /* a real driver would allocate the pbuffer memory here */
-
- return &surf->Base;
-}
-
-
-static EGLBoolean
-demoDestroySurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface)
-{
- DemoSurface *fs = LookupDemoSurface(surface);
- if (!_eglIsSurfaceBound(&fs->Base))
- free(fs);
- return EGL_TRUE;
-}
-
-
-static EGLBoolean
-demoDestroyContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *context)
-{
- DemoContext *fc = LookupDemoContext(context);
- if (!_eglIsContextBound(&fc->Base))
- free(fc);
- return EGL_TRUE;
-}
-
-
-static EGLBoolean
-demoMakeCurrent(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *drawSurf, _EGLSurface *readSurf, _EGLContext *ctx)
-{
- /*DemoDriver *demo = DEMO_DRIVER(dpy);*/
- EGLBoolean b;
-
- b = _eglMakeCurrent(drv, dpy, drawSurf, readSurf, ctx);
- if (!b)
- return EGL_FALSE;
-
- /* XXX this is where we'd do the hardware context switch */
- (void) drawSurf;
- (void) readSurf;
- (void) ctx;
-
- printf("eglMakeCurrent()\n");
- return EGL_TRUE;
-}
-
-
-static void
-demoUnload(_EGLDriver *drv)
-{
- free(drv);
-}
-
-
-/**
- * The bootstrap function. Return a new DemoDriver object and
- * plug in API functions.
- */
-_EGLDriver *
-_eglMain(const char *args)
-{
- DemoDriver *demo;
-
- demo = (DemoDriver *) calloc(1, sizeof(DemoDriver));
- if (!demo) {
- return NULL;
- }
-
- /* First fill in the dispatch table with defaults */
- _eglInitDriverFallbacks(&demo->Base);
- /* then plug in our Demo-specific functions */
- demo->Base.API.Initialize = demoInitialize;
- demo->Base.API.Terminate = demoTerminate;
- demo->Base.API.CreateContext = demoCreateContext;
- demo->Base.API.MakeCurrent = demoMakeCurrent;
- demo->Base.API.CreateWindowSurface = demoCreateWindowSurface;
- demo->Base.API.CreatePixmapSurface = demoCreatePixmapSurface;
- demo->Base.API.CreatePbufferSurface = demoCreatePbufferSurface;
- demo->Base.API.DestroySurface = demoDestroySurface;
- demo->Base.API.DestroyContext = demoDestroyContext;
-
- demo->Base.Name = "egl/demo";
- demo->Base.Unload = demoUnload;
-
- return &demo->Base;
-}
diff --git a/src/egl/drivers/glx/Makefile b/src/egl/drivers/glx/Makefile
index 20ef0352ad9..634638f5387 100644
--- a/src/egl/drivers/glx/Makefile
+++ b/src/egl/drivers/glx/Makefile
@@ -1,77 +1,16 @@
# src/egl/drivers/glx/Makefile
-# Build XEGL DRI driver loader library: egl_glx.so
-
-
TOP = ../../../..
include $(TOP)/configs/current
+EGL_DRIVER = egl_glx.so
+EGL_SOURCES = egl_glx.c
-EXTRA_DEFINES = -DDEFAULT_DRIVER_DIR=\"$(DRI_DRIVER_SEARCH_DIR)\"
-
-DRIVER_NAME = egl_glx.so
-
-
-INCLUDE_DIRS = \
- -I. \
- -I/usr/include \
- $(shell pkg-config --cflags-only-I libdrm) \
+EGL_INCLUDES = \
-I$(TOP)/include \
- -I$(TOP)/include/GL/internal \
- -I$(TOP)/src/mesa/glapi \
- -I$(TOP)/src/mesa/drivers/dri/common \
- -I$(TOP)/src/mesa/main \
- -I$(TOP)/src/mesa \
- -I$(TOP)/src/egl/main \
- -I$(TOP)/src/glx/x11
-
-SOURCES = egl_glx.c
-
-OBJECTS = $(SOURCES:.c=.o)
-
-DRM_LIB = `pkg-config --libs libdrm`
-
-MISC_LIBS = -ldl -lXext -lGL
-
-
-.c.o:
- $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $(EXTRA_DEFINES) $< -o $@
-
-
-.PHONY: library
-
-
-default: depend library Makefile
-
-
-library: $(TOP)/$(LIB_DIR)/$(DRIVER_NAME)
-
-
-# Make the egl_glx.so library
-$(TOP)/$(LIB_DIR)/$(DRIVER_NAME): $(OBJECTS)
- $(TOP)/bin/mklib -o $(DRIVER_NAME) \
- -noprefix \
- -major 1 -minor 0 \
- -L$(TOP)/$(LIB_DIR) \
- -install $(TOP)/$(LIB_DIR) \
- $(OBJECTS) $(DRM_LIB) $(MISC_LIBS)
-
-install:
- $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
- $(MINSTALL) $(TOP)/$(LIB_DIR)/$(DRIVER_NAME) $(DESTDIR)$(INSTALL_LIB_DIR)
-
-clean:
- rm -f *.o
- rm -f *.so
- rm -f depend depend.bak
-
+ -I$(TOP)/src/egl/main
-depend: $(SOURCES) $(HEADERS)
- @ echo "running $(MKDEP)"
- @ rm -f depend
- @ touch depend
- $(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) \
- $(SOURCES) $(HEADERS) >/dev/null 2>/dev/null
+EGL_CFLAGS =
+EGL_LIBS = -lX11 -lGL
-include depend
-# DO NOT DELETE
+include ../Makefile.template
diff --git a/src/egl/drivers/glx/egl_glx.c b/src/egl/drivers/glx/egl_glx.c
index 7c6e8637a1c..1c38db64915 100644
--- a/src/egl/drivers/glx/egl_glx.c
+++ b/src/egl/drivers/glx/egl_glx.c
@@ -54,13 +54,6 @@
#error "GL/glx.h must be equal to or greater than GLX 1.4"
#endif
-/*
- * report OpenGL ES bits because apps usually forget to specify
- * EGL_RENDERABLE_TYPE when choosing configs
- */
-#define GLX_EGL_APIS (EGL_OPENGL_BIT | EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT)
-
-
/** subclass of _EGLDriver */
struct GLX_egl_driver
{
@@ -110,6 +103,8 @@ struct GLX_egl_surface
Drawable drawable;
GLXDrawable glx_drawable;
+
+ void (*destroy)(Display *, GLXDrawable);
};
@@ -244,7 +239,7 @@ convert_fbconfig(Display *dpy, GLXFBConfig fbconfig,
GLX_conf->double_buffered = (mode.doubleBufferMode != 0);
return _eglConfigFromContextModesRec(&GLX_conf->Base, &mode,
- GLX_EGL_APIS, GLX_EGL_APIS);
+ EGL_OPENGL_BIT, EGL_OPENGL_BIT);
}
@@ -364,7 +359,7 @@ convert_visual(Display *dpy, XVisualInfo *vinfo,
GLX_conf->double_buffered = (mode.doubleBufferMode != 0);
return _eglConfigFromContextModesRec(&GLX_conf->Base, &mode,
- GLX_EGL_APIS, GLX_EGL_APIS);
+ EGL_OPENGL_BIT, EGL_OPENGL_BIT);
}
@@ -559,7 +554,7 @@ GLX_eglInitialize(_EGLDriver *drv, _EGLDisplay *disp,
}
disp->DriverData = (void *) GLX_dpy;
- disp->ClientAPIsMask = GLX_EGL_APIS;
+ disp->ClientAPIsMask = EGL_OPENGL_BIT;
/* we're supporting EGL 1.4 */
*major = 1;
@@ -638,6 +633,21 @@ GLX_eglCreateContext(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
/**
+ * Destroy a surface. The display is allowed to be uninitialized.
+ */
+static void
+destroy_surface(_EGLDisplay *disp, _EGLSurface *surf)
+{
+ struct GLX_egl_surface *GLX_surf = GLX_egl_surface(surf);
+
+ if (GLX_surf->destroy)
+ GLX_surf->destroy(disp->NativeDisplay, GLX_surf->glx_drawable);
+
+ free(GLX_surf);
+}
+
+
+/**
* Called via eglMakeCurrent(), drv->API.MakeCurrent().
*/
static EGLBoolean
@@ -650,8 +660,10 @@ GLX_eglMakeCurrent(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *dsurf,
struct GLX_egl_context *GLX_ctx = GLX_egl_context(ctx);
GLXDrawable ddraw, rdraw;
GLXContext cctx;
+ EGLBoolean ret = EGL_FALSE;
- if (!_eglMakeCurrent(drv, disp, dsurf, rsurf, ctx))
+ /* bind the new context and return the "orphaned" one */
+ if (!_eglBindContext(&ctx, &dsurf, &rsurf))
return EGL_FALSE;
ddraw = (GLX_dsurf) ? GLX_dsurf->glx_drawable : None;
@@ -659,11 +671,21 @@ GLX_eglMakeCurrent(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *dsurf,
cctx = (GLX_ctx) ? GLX_ctx->context : NULL;
if (GLX_dpy->have_make_current_read)
- return glXMakeContextCurrent(GLX_dpy->dpy, ddraw, rdraw, cctx);
+ ret = glXMakeContextCurrent(GLX_dpy->dpy, ddraw, rdraw, cctx);
else if (ddraw == rdraw)
- return glXMakeCurrent(GLX_dpy->dpy, ddraw, cctx);
+ ret = glXMakeCurrent(GLX_dpy->dpy, ddraw, cctx);
- return EGL_FALSE;
+ if (ret) {
+ if (dsurf && !_eglIsSurfaceLinked(dsurf))
+ destroy_surface(disp, dsurf);
+ if (rsurf && rsurf != dsurf && !_eglIsSurfaceLinked(rsurf))
+ destroy_surface(disp, rsurf);
+ }
+ else {
+ _eglBindContext(&ctx, &dsurf, &rsurf);
+ }
+
+ return ret;
}
/** Get size of given window */
@@ -684,8 +706,9 @@ get_drawable_size(Display *dpy, Drawable d, uint *width, uint *height)
* Called via eglCreateWindowSurface(), drv->API.CreateWindowSurface().
*/
static _EGLSurface *
-GLX_eglCreateWindowSurface(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
- NativeWindowType window, const EGLint *attrib_list)
+GLX_eglCreateWindowSurface(_EGLDriver *drv, _EGLDisplay *disp,
+ _EGLConfig *conf, EGLNativeWindowType window,
+ const EGLint *attrib_list)
{
struct GLX_egl_display *GLX_dpy = GLX_egl_display(disp);
struct GLX_egl_surface *GLX_surf;
@@ -718,6 +741,9 @@ GLX_eglCreateWindowSurface(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
return NULL;
}
+ if (GLX_dpy->have_1_3 && !GLX_dpy->glx_window_quirk)
+ GLX_surf->destroy = glXDestroyWindow;
+
get_drawable_size(GLX_dpy->dpy, window, &width, &height);
GLX_surf->Base.Width = width;
GLX_surf->Base.Height = height;
@@ -726,8 +752,9 @@ GLX_eglCreateWindowSurface(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
}
static _EGLSurface *
-GLX_eglCreatePixmapSurface(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
- NativePixmapType pixmap, const EGLint *attrib_list)
+GLX_eglCreatePixmapSurface(_EGLDriver *drv, _EGLDisplay *disp,
+ _EGLConfig *conf, EGLNativePixmapType pixmap,
+ const EGLint *attrib_list)
{
struct GLX_egl_display *GLX_dpy = GLX_egl_display(disp);
struct GLX_egl_surface *GLX_surf;
@@ -774,6 +801,9 @@ GLX_eglCreatePixmapSurface(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
return NULL;
}
+ GLX_surf->destroy = (GLX_dpy->have_1_3) ?
+ glXDestroyPixmap : glXDestroyGLXPixmap;
+
get_drawable_size(GLX_dpy->dpy, pixmap, &width, &height);
GLX_surf->Base.Width = width;
GLX_surf->Base.Height = height;
@@ -838,47 +868,18 @@ GLX_eglCreatePbufferSurface(_EGLDriver *drv, _EGLDisplay *disp,
return NULL;
}
+ GLX_surf->destroy = (GLX_dpy->have_1_3) ?
+ glXDestroyPbuffer : GLX_dpy->glXDestroyGLXPbufferSGIX;
+
return &GLX_surf->Base;
}
+
static EGLBoolean
GLX_eglDestroySurface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
{
- struct GLX_egl_display *GLX_dpy = GLX_egl_display(disp);
- if (!_eglIsSurfaceBound(surf)) {
- struct GLX_egl_surface *GLX_surf = GLX_egl_surface(surf);
-
- if (GLX_dpy->have_1_3) {
- switch (surf->Type) {
- case EGL_WINDOW_BIT:
- if (!GLX_dpy->glx_window_quirk)
- glXDestroyWindow(GLX_dpy->dpy, GLX_surf->glx_drawable);
- break;
- case EGL_PBUFFER_BIT:
- glXDestroyPbuffer(GLX_dpy->dpy, GLX_surf->glx_drawable);
- break;
- case EGL_PIXMAP_BIT:
- glXDestroyPixmap(GLX_dpy->dpy, GLX_surf->glx_drawable);
- break;
- default:
- break;
- }
- }
- else {
- switch (surf->Type) {
- case EGL_PBUFFER_BIT:
- GLX_dpy->glXDestroyGLXPbufferSGIX(GLX_dpy->dpy,
- GLX_surf->glx_drawable);
- break;
- case EGL_PIXMAP_BIT:
- glXDestroyGLXPixmap(GLX_dpy->dpy, GLX_surf->glx_drawable);
- break;
- default:
- break;
- }
- }
- free(surf);
- }
+ if (!_eglIsSurfaceBound(surf))
+ destroy_surface(disp, surf);
return EGL_TRUE;
}
diff --git a/src/egl/drivers/xdri/Makefile b/src/egl/drivers/xdri/Makefile
index 4c1fc9071c5..9120620dc52 100644
--- a/src/egl/drivers/xdri/Makefile
+++ b/src/egl/drivers/xdri/Makefile
@@ -1,78 +1,28 @@
# src/egl/drivers/xdri/Makefile
-# Build XEGL DRI driver loader library: egl_xdri.so
-
-
TOP = ../../../..
include $(TOP)/configs/current
+EGL_DRIVER = egl_xdri.so
-DRIVER_NAME = egl_xdri.so
-
-
-INCLUDE_DIRS = \
- -I. \
- -I/usr/include \
+# steal sources from GLX
+GLX_SOURCES = dri_common.c XF86dri.c dri2.c dri2_glx.c dri_glx.c drisw_glx.c
+GLX_SOURCES := $(addprefix ../../../glx/x11/,$(GLX_SOURCES))
+GLX_INCLUDES = \
$(shell pkg-config --cflags-only-I libdrm) \
- -I$(TOP)/include \
-I$(TOP)/include/GL/internal \
- -I$(TOP)/src/mesa \
+ -I$(TOP)/src/glx/x11 \
-I$(TOP)/src/mesa/glapi \
- -I$(TOP)/src/egl/main \
- -I$(TOP)/src/glx/x11
-
-HEADERS = glxinit.h driinit.h
-SOURCES = egl_xdri.c glxinit.c driinit.c
-
-DRI_SOURCES = dri_common.c XF86dri.c dri2.c dri2_glx.c dri_glx.c
-DRI_SOURCES := $(addprefix ../../../glx/x11/,$(DRI_SOURCES))
-
-SOURCES += $(DRI_SOURCES)
-
-OBJECTS = $(SOURCES:.c=.o)
-
-DRM_LIB = `pkg-config --libs libdrm`
-
-CFLAGS += -DGLX_DIRECT_RENDERING
-
-.c.o:
- $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
-
-
-.PHONY: library
-
-
-default: depend library Makefile
-
-
-library: $(TOP)/$(LIB_DIR)/$(DRIVER_NAME)
-
-
-# Make the egl_xdri.so library
-$(TOP)/$(LIB_DIR)/$(DRIVER_NAME): $(OBJECTS)
- $(TOP)/bin/mklib -o $(DRIVER_NAME) \
- -noprefix \
- -major 1 -minor 0 \
- -L$(TOP)/$(LIB_DIR) \
- -install $(TOP)/$(LIB_DIR) \
- $(OBJECTS) $(DRM_LIB) $(GL_LIB_DEPS)
-
-install:
- $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
- $(MINSTALL) $(TOP)/$(LIB_DIR)/$(DRIVER_NAME) $(DESTDIR)$(INSTALL_LIB_DIR)
-
-clean:
- rm -f *.o
- rm -f *.so
- rm -f depend depend.bak
+ -I$(TOP)/src/mesa
+GLX_CFLAGS = -DGLX_DIRECT_RENDERING
+EGL_SOURCES = egl_xdri.c glxinit.c driinit.c $(GLX_SOURCES)
+EGL_INCLUDES = \
+ -I$(TOP)/include \
+ -I$(TOP)/src/egl/main \
+ $(GLX_INCLUDES)
-depend: $(SOURCES) $(HEADERS)
- @ echo "running $(MKDEP)"
- @ rm -f depend
- @ touch depend
- $(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) \
- $(SOURCES) $(HEADERS) >/dev/null 2>/dev/null
+EGL_CFLAGS = $(GLX_CFLAGS)
+EGL_LIBS = -lX11 -lGL
-include depend
-# DO NOT DELETE
+include ../Makefile.template
diff --git a/src/egl/drivers/xdri/driinit.c b/src/egl/drivers/xdri/driinit.c
index 12da1bcd248..3e54f0bd4d8 100644
--- a/src/egl/drivers/xdri/driinit.c
+++ b/src/egl/drivers/xdri/driinit.c
@@ -2,6 +2,7 @@
* DRI initialization. The DRI loaders are defined in src/glx/x11/.
*/
+#include <stdlib.h>
#include <sys/time.h>
#include "glxclient.h"
@@ -42,18 +43,26 @@ __glXEnableDirectExtension(__GLXscreenConfigs * psc, const char *name)
_X_HIDDEN __GLXDRIdisplay *
__driCreateDisplay(__GLXdisplayPrivate *dpyPriv, int *version)
{
- __GLXDRIdisplay *driDisplay;
+ __GLXDRIdisplay *driDisplay = NULL;
int ver = 0;
+ char *env;
+ int force_sw;
+
+ env = getenv("EGL_SOFTWARE");
+ force_sw = (env && *env != '0');
/* try DRI2 first */
- driDisplay = dri2CreateDisplay(dpyPriv->dpy);
- if (driDisplay) {
- /* fill in the required field */
- dpyPriv->dri2Display = driDisplay;
- ver = 2;
+ if (!force_sw) {
+ driDisplay = dri2CreateDisplay(dpyPriv->dpy);
+ if (driDisplay) {
+ /* fill in the required field */
+ dpyPriv->dri2Display = driDisplay;
+ ver = 2;
+ }
}
- else {
- /* try DRI */
+
+ /* and then DRI */
+ if (!force_sw && !driDisplay) {
driDisplay = driCreateDisplay(dpyPriv->dpy);
if (driDisplay) {
dpyPriv->driDisplay = driDisplay;
@@ -61,6 +70,15 @@ __driCreateDisplay(__GLXdisplayPrivate *dpyPriv, int *version)
}
}
+ /* and then DRISW */
+ if (!driDisplay) {
+ driDisplay = driswCreateDisplay(dpyPriv->dpy);
+ if (driDisplay) {
+ dpyPriv->driDisplay = driDisplay;
+ ver = 0;
+ }
+ }
+
if (version)
*version = ver;
return driDisplay;
diff --git a/src/egl/drivers/xdri/egl_xdri.c b/src/egl/drivers/xdri/egl_xdri.c
index 8425b3d11ef..2ca9ea8a5b0 100644
--- a/src/egl/drivers/xdri/egl_xdri.c
+++ b/src/egl/drivers/xdri/egl_xdri.c
@@ -62,6 +62,7 @@
struct xdri_egl_driver
{
_EGLDriver Base; /**< base class */
+ void (*FlushCurrentContext)(void);
};
@@ -71,6 +72,7 @@ struct xdri_egl_display
Display *dpy;
__GLXdisplayPrivate *dpyPriv;
__GLXDRIdisplay *driDisplay;
+ int driVersion;
__GLXscreenConfigs *psc;
EGLint scr;
@@ -167,14 +169,10 @@ get_drawable_size(Display *dpy, Drawable d, uint *width, uint *height)
static EGLBoolean
convert_config(_EGLConfig *conf, EGLint id, const __GLcontextModes *m)
{
- static const EGLint all_apis = (EGL_OPENGL_ES_BIT |
- EGL_OPENGL_ES2_BIT |
- EGL_OPENVG_BIT |
- EGL_OPENGL_BIT);
EGLint val;
_eglInitConfig(conf, id);
- if (!_eglConfigFromContextModesRec(conf, m, all_apis, all_apis))
+ if (!_eglConfigFromContextModesRec(conf, m, EGL_OPENGL_BIT, EGL_OPENGL_BIT))
return EGL_FALSE;
if (m->doubleBufferMode) {
@@ -215,6 +213,7 @@ convert_config(_EGLConfig *conf, EGLint id, const __GLcontextModes *m)
static EGLint
create_configs(_EGLDisplay *disp, const __GLcontextModes *m, EGLint first_id)
{
+ struct xdri_egl_display *xdri_dpy = lookup_display(disp);
int id = first_id;
for (; m; m = m->next) {
@@ -224,8 +223,15 @@ create_configs(_EGLDisplay *disp, const __GLcontextModes *m, EGLint first_id)
if (!convert_config(&conf, id, m))
continue;
-
- rb = (m->doubleBufferMode) ? EGL_BACK_BUFFER : EGL_SINGLE_BUFFER;
+ if (m->doubleBufferMode) {
+ rb = EGL_BACK_BUFFER;
+ }
+ else {
+ /* ignore single-buffered mode for DRISW */
+ if (xdri_dpy->driVersion == 0)
+ continue;
+ rb = EGL_SINGLE_BUFFER;
+ }
xdri_conf = CALLOC_STRUCT(xdri_egl_config);
if (xdri_conf) {
@@ -275,7 +281,7 @@ xdri_eglInitialize(_EGLDriver *drv, _EGLDisplay *dpy,
return _eglError(EGL_NOT_INITIALIZED, "eglInitialize");
}
- driDisplay = __driCreateDisplay(dpyPriv, NULL);
+ driDisplay = __driCreateDisplay(dpyPriv, &xdri_dpy->driVersion);
if (!driDisplay) {
_eglLog(_EGL_WARNING, "failed to create DRI display");
free(xdri_dpy);
@@ -297,16 +303,13 @@ xdri_eglInitialize(_EGLDriver *drv, _EGLDisplay *dpy,
return _eglError(EGL_NOT_INITIALIZED, "eglInitialize");
}
+ dpy->DriverData = xdri_dpy;
+ dpy->ClientAPIsMask = EGL_OPENGL_BIT;
+
/* add visuals and fbconfigs */
first_id = create_configs(dpy, psc->visuals, first_id);
create_configs(dpy, psc->configs, first_id);
- dpy->DriverData = xdri_dpy;
- dpy->ClientAPIsMask = (EGL_OPENGL_BIT |
- EGL_OPENGL_ES_BIT |
- EGL_OPENGL_ES2_BIT |
- EGL_OPENVG_BIT);
-
/* we're supporting EGL 1.4 */
*minor = 1;
*major = 4;
@@ -342,7 +345,6 @@ xdri_eglTerminate(_EGLDriver *drv, _EGLDisplay *dpy)
}
xdri_dpy->driDisplay->destroyDisplay(xdri_dpy->driDisplay);
- __glXRelease(xdri_dpy->dpyPriv);
free(xdri_dpy);
dpy->DriverData = NULL;
@@ -417,19 +419,47 @@ xdri_eglCreateContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
}
-static EGLBoolean
-xdri_eglDestroyContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx)
+/**
+ * Destroy a context.
+ */
+static void
+destroy_context(_EGLDisplay *dpy, _EGLContext *ctx)
{
struct xdri_egl_display *xdri_dpy = lookup_display(dpy);
struct xdri_egl_context *xdri_ctx = lookup_context(ctx);
- if (!_eglIsContextBound(ctx)) {
- xdri_ctx->driContext->destroyContext(xdri_ctx->driContext,
- xdri_dpy->psc, xdri_dpy->dpy);
- free(xdri_ctx->dummy_gc);
- free(xdri_ctx);
- }
+ /* FIXME a context might live longer than its display */
+ if (!dpy->Initialized)
+ _eglLog(_EGL_FATAL, "destroy a context with an unitialized display");
+ xdri_ctx->driContext->destroyContext(xdri_ctx->driContext,
+ xdri_dpy->psc, xdri_dpy->dpy);
+ free(xdri_ctx->dummy_gc);
+ free(xdri_ctx);
+}
+
+
+/**
+ * Destroy a surface.
+ */
+static void
+destroy_surface(_EGLDisplay *dpy, _EGLSurface *surf)
+{
+ struct xdri_egl_surface *xdri_surf = lookup_surface(surf);
+
+ if (!dpy->Initialized)
+ _eglLog(_EGL_FATAL, "destroy a surface with an unitialized display");
+
+ xdri_surf->driDrawable->destroyDrawable(xdri_surf->driDrawable);
+ free(xdri_surf);
+}
+
+
+static EGLBoolean
+xdri_eglDestroyContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx)
+{
+ if (!_eglIsContextBound(ctx))
+ destroy_context(dpy, ctx);
return EGL_TRUE;
}
@@ -441,13 +471,19 @@ static EGLBoolean
xdri_eglMakeCurrent(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *d,
_EGLSurface *r, _EGLContext *context)
{
+ struct xdri_egl_driver *xdri_driver = xdri_egl_driver(drv);
struct xdri_egl_context *xdri_ctx = lookup_context(context);
struct xdri_egl_surface *draw = lookup_surface(d);
struct xdri_egl_surface *read = lookup_surface(r);
- if (!_eglMakeCurrent(drv, dpy, d, r, context))
+ /* bind the new context and return the "orphaned" one */
+ if (!_eglBindContext(&context, &d, &r))
return EGL_FALSE;
+ /* flush before context switch */
+ if (context && xdri_driver->FlushCurrentContext)
+ xdri_driver->FlushCurrentContext();
+
/* the symbol is defined in libGL.so */
_glapi_check_multithread();
@@ -458,14 +494,18 @@ xdri_eglMakeCurrent(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *d,
return EGL_FALSE;
}
}
- else {
- _EGLContext *old = _eglGetCurrentContext();
- if (old) {
- xdri_ctx = lookup_context(old);
- xdri_ctx->driContext->unbindContext(xdri_ctx->driContext);
- }
+ else if (context) {
+ xdri_ctx = lookup_context(context);
+ xdri_ctx->driContext->unbindContext(xdri_ctx->driContext);
}
+ if (context && !_eglIsContextLinked(context))
+ destroy_context(dpy, context);
+ if (d && !_eglIsSurfaceLinked(d))
+ destroy_surface(dpy, d);
+ if (r && r != d && !_eglIsSurfaceLinked(r))
+ destroy_surface(dpy, r);
+
return EGL_TRUE;
}
@@ -475,7 +515,8 @@ xdri_eglMakeCurrent(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *d,
*/
static _EGLSurface *
xdri_eglCreateWindowSurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
- NativeWindowType window, const EGLint *attrib_list)
+ EGLNativeWindowType window,
+ const EGLint *attrib_list)
{
struct xdri_egl_display *xdri_dpy = lookup_display(dpy);
struct xdri_egl_config *xdri_config = lookup_config(conf);
@@ -529,13 +570,8 @@ xdri_eglCreatePbufferSurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf
static EGLBoolean
xdri_eglDestroySurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface)
{
- struct xdri_egl_surface *xdri_surf = lookup_surface(surface);
-
- if (!_eglIsSurfaceBound(&xdri_surf->Base)) {
- xdri_surf->driDrawable->destroyDrawable(xdri_surf->driDrawable);
- free(xdri_surf);
- }
-
+ if (!_eglIsSurfaceBound(surface))
+ destroy_surface(dpy, surface);
return EGL_TRUE;
}
@@ -559,9 +595,14 @@ xdri_eglReleaseTexImage(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
static EGLBoolean
xdri_eglSwapBuffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw)
{
+ struct xdri_egl_driver *xdri_driver = xdri_egl_driver(drv);
struct xdri_egl_display *xdri_dpy = lookup_display(dpy);
struct xdri_egl_surface *xdri_surf = lookup_surface(draw);
+ /* swapBuffers does not flush commands */
+ if (draw->Binding && xdri_driver->FlushCurrentContext)
+ xdri_driver->FlushCurrentContext();
+
xdri_dpy->psc->driScreen->swapBuffers(xdri_surf->driDrawable, 0, 0, 0);
return EGL_TRUE;
@@ -606,5 +647,9 @@ _eglMain(const char *args)
xdri_drv->Base.Name = "X/DRI";
xdri_drv->Base.Unload = xdri_Unload;
+ /* we need a way to flush commands */
+ xdri_drv->FlushCurrentContext =
+ (void (*)(void)) xdri_eglGetProcAddress(&xdri_drv->Base, "glFlush");
+
return &xdri_drv->Base;
}
diff --git a/src/egl/drivers/xdri/glxinit.c b/src/egl/drivers/xdri/glxinit.c
index 77750093944..ba6132788a7 100644
--- a/src/egl/drivers/xdri/glxinit.c
+++ b/src/egl/drivers/xdri/glxinit.c
@@ -1,8 +1,10 @@
/**
* GLX initialization. Code based on glxext.c, glx_query.c, and
- * glcontextmodes.c under src/glx/x11/. The major difference is that no DRI
- * related code here.
+ * glcontextmodes.c under src/glx/x11/. The major difference is that DRI
+ * related code is stripped out.
*
+ * If the maintenance of this file takes too much time, we should consider
+ * refactoring glxext.c.
*/
#include <assert.h>
@@ -31,8 +33,26 @@ typedef struct GLXGenericGetString
static char *__glXExtensionName = GLX_EXTENSION_NAME;
static XExtensionInfo *__glXExtensionInfo = NULL;
-static /* const */ XExtensionHooks __glXExtensionHooks = { NULL };
-static
+static int
+__glXCloseDisplay(Display * dpy, XExtCodes * codes)
+{
+ return XextRemoveDisplay(__glXExtensionInfo, dpy);
+}
+
+static /* const */ XExtensionHooks __glXExtensionHooks = {
+ NULL, /* create_gc */
+ NULL, /* copy_gc */
+ NULL, /* flush_gc */
+ NULL, /* free_gc */
+ NULL, /* create_font */
+ NULL, /* free_font */
+ __glXCloseDisplay, /* close_display */
+ NULL, /* wire_to_event */
+ NULL, /* event_to_wire */
+ NULL, /* error */
+ NULL, /* error_string */
+};
+
XEXT_GENERATE_FIND_DISPLAY(__glXFindDisplay, __glXExtensionInfo,
__glXExtensionName, &__glXExtensionHooks,
__GLX_NUMBER_EVENTS, NULL)
@@ -180,6 +200,30 @@ FreeScreenConfigs(__GLXdisplayPrivate * priv)
priv->screenConfigs = NULL;
}
+/*
+** Release the private memory referred to in a display private
+** structure. The caller will free the extension structure.
+*/
+static int
+__glXFreeDisplayPrivate(XExtData * extension)
+{
+ __GLXdisplayPrivate *priv;
+
+ priv = (__GLXdisplayPrivate *) extension->private_data;
+ FreeScreenConfigs(priv);
+ if (priv->serverGLXvendor) {
+ Xfree((char *) priv->serverGLXvendor);
+ priv->serverGLXvendor = 0x0; /* to protect against double free's */
+ }
+ if (priv->serverGLXversion) {
+ Xfree((char *) priv->serverGLXversion);
+ priv->serverGLXversion = 0x0; /* to protect against double free's */
+ }
+
+ Xfree((char *) priv);
+ return 0;
+}
+
/************************************************************************/
/*
@@ -570,40 +614,40 @@ AllocAndFetchScreenConfigs(Display * dpy, __GLXdisplayPrivate * priv)
return GL_TRUE;
}
-_X_HIDDEN void
-__glXRelease(__GLXdisplayPrivate *dpyPriv)
-{
- FreeScreenConfigs(dpyPriv);
-
- if (dpyPriv->serverGLXvendor) {
- Xfree((char *) dpyPriv->serverGLXvendor);
- dpyPriv->serverGLXvendor = NULL;
- }
- if (dpyPriv->serverGLXversion) {
- Xfree((char *) dpyPriv->serverGLXversion);
- dpyPriv->serverGLXversion = NULL;
- }
-
- Xfree(dpyPriv);
-}
-
_X_HIDDEN __GLXdisplayPrivate *
__glXInitialize(Display * dpy)
{
XExtDisplayInfo *info = __glXFindDisplay(dpy);
+ XExtData **privList, *private, *found;
__GLXdisplayPrivate *dpyPriv;
+ XEDataObject dataObj;
int major, minor;
if (!XextHasExtension(info))
return NULL;
+ /* See if a display private already exists. If so, return it */
+ dataObj.display = dpy;
+ privList = XEHeadOfExtensionList(dataObj);
+ found = XFindOnExtensionList(privList, info->codes->extension);
+ if (found)
+ return (__GLXdisplayPrivate *) found->private_data;
+
/* See if the versions are compatible */
if (!QueryVersion(dpy, info->codes->major_opcode, &major, &minor))
return NULL;
+ /*
+ ** Allocate memory for all the pieces needed for this buffer.
+ */
+ private = (XExtData *) Xmalloc(sizeof(XExtData));
+ if (!private)
+ return NULL;
dpyPriv = (__GLXdisplayPrivate *) Xcalloc(1, sizeof(__GLXdisplayPrivate));
- if (!dpyPriv)
+ if (!dpyPriv) {
+ Xfree(private);
return NULL;
+ }
/*
** Init the display private and then read in the screen config
@@ -619,8 +663,20 @@ __glXInitialize(Display * dpy)
if (!AllocAndFetchScreenConfigs(dpy, dpyPriv)) {
Xfree(dpyPriv);
+ Xfree(private);
return NULL;
}
+ /*
+ ** Fill in the private structure. This is the actual structure that
+ ** hangs off of the Display structure. Our private structure is
+ ** referred to by this structure. Got that?
+ */
+ private->number = info->codes->extension;
+ private->next = 0;
+ private->free_private = __glXFreeDisplayPrivate;
+ private->private_data = (char *) dpyPriv;
+ XAddToExtensionList(privList, private);
+
return dpyPriv;
}
diff --git a/src/egl/drivers/xdri/glxinit.h b/src/egl/drivers/xdri/glxinit.h
index 57206e627b2..1cc7c460fe2 100644
--- a/src/egl/drivers/xdri/glxinit.h
+++ b/src/egl/drivers/xdri/glxinit.h
@@ -8,7 +8,4 @@
extern void
_gl_context_modes_destroy(__GLcontextModes * modes);
-extern void
-__glXRelease(__GLXdisplayPrivate *dpyPriv);
-
#endif /* GLXINIT_INCLUDED */
diff --git a/src/egl/main/Makefile b/src/egl/main/Makefile
index 66f8f01b8e2..31f214cf6f2 100644
--- a/src/egl/main/Makefile
+++ b/src/egl/main/Makefile
@@ -19,6 +19,7 @@ HEADERS = \
egldisplay.h \
egldriver.h \
eglglobals.h \
+ eglimage.h \
egllog.h \
eglmisc.h \
eglmode.h \
@@ -36,6 +37,7 @@ SOURCES = \
egldisplay.c \
egldriver.c \
eglglobals.c \
+ eglimage.c \
egllog.c \
eglmisc.c \
eglmode.c \
@@ -53,7 +55,7 @@ EGL_DEFAULT_DISPLAY = $(word 1, $(EGL_DISPLAYS))
LOCAL_CFLAGS += \
-D_EGL_DEFAULT_DISPLAY=\"$(EGL_DEFAULT_DISPLAY)\" \
- -D_EGL_DRIVER_SEARCH_DIR=\"$(DRI_DRIVER_SEARCH_DIR)\"
+ -D_EGL_DRIVER_SEARCH_DIR=\"$(EGL_DRIVER_INSTALL_DIR)\"
.c.o:
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $(LOCAL_CFLAGS) $< -o $@
@@ -72,7 +74,15 @@ $(TOP)/$(LIB_DIR)/$(EGL_LIB_NAME): $(OBJECTS)
-install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \
$(EGL_LIB_DEPS) $(OBJECTS)
-install: default
+install-headers:
+ $(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/KHR
+ $(INSTALL) -m 644 $(TOP)/include/KHR/*.h \
+ $(DESTDIR)$(INSTALL_INC_DIR)/KHR
+ $(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/EGL
+ $(INSTALL) -m 644 $(TOP)/include/EGL/*.h \
+ $(DESTDIR)$(INSTALL_INC_DIR)/EGL
+
+install: default install-headers
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
$(MINSTALL) $(TOP)/$(LIB_DIR)/$(EGL_LIB_GLOB) \
$(DESTDIR)$(INSTALL_LIB_DIR)
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 6e8f444d7fa..7e77ef1f038 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -65,6 +65,7 @@
#include "eglconfig.h"
#include "eglscreen.h"
#include "eglmode.h"
+#include "eglimage.h"
/**
@@ -72,7 +73,7 @@
* We initialize our global vars and create a private _EGLDisplay object.
*/
EGLDisplay EGLAPIENTRY
-eglGetDisplay(NativeDisplayType nativeDisplay)
+eglGetDisplay(EGLNativeDisplayType nativeDisplay)
{
_EGLDisplay *dpy;
dpy = _eglFindDisplay(nativeDisplay);
@@ -93,25 +94,24 @@ EGLBoolean EGLAPIENTRY
eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
{
_EGLDisplay *disp = _eglLookupDisplay(dpy);
- _EGLDriver *drv;
EGLint major_int, minor_int;
if (!disp)
return _eglError(EGL_BAD_DISPLAY, __FUNCTION__);
- drv = disp->Driver;
- if (!drv) {
- _eglPreloadDrivers();
+ if (!disp->Initialized) {
+ _EGLDriver *drv = disp->Driver;
- drv = _eglOpenDriver(disp);
- if (!drv)
- return _eglError(EGL_NOT_INITIALIZED, __FUNCTION__);
+ if (!drv) {
+ _eglPreloadDrivers();
+ drv = _eglMatchDriver(disp);
+ if (!drv)
+ return _eglError(EGL_NOT_INITIALIZED, __FUNCTION__);
+ }
/* Initialize the particular display now */
- if (!drv->API.Initialize(drv, disp, &major_int, &minor_int)) {
- _eglCloseDriver(drv, disp);
+ if (!drv->API.Initialize(drv, disp, &major_int, &minor_int))
return _eglError(EGL_NOT_INITIALIZED, __FUNCTION__);
- }
disp->APImajor = major_int;
disp->APIminor = minor_int;
@@ -122,6 +122,7 @@ eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
disp->ClientAPIsMask &= _EGL_API_ALL_BITS;
disp->Driver = drv;
+ disp->Initialized = EGL_TRUE;
} else {
major_int = disp->APImajor;
minor_int = disp->APIminor;
@@ -141,16 +142,16 @@ EGLBoolean EGLAPIENTRY
eglTerminate(EGLDisplay dpy)
{
_EGLDisplay *disp = _eglLookupDisplay(dpy);
- _EGLDriver *drv;
if (!disp)
return _eglError(EGL_BAD_DISPLAY, __FUNCTION__);
- drv = disp->Driver;
- if (drv) {
+ if (disp->Initialized) {
+ _EGLDriver *drv = disp->Driver;
+
drv->API.Terminate(drv, disp);
- _eglCloseDriver(drv, disp);
- disp->Driver = NULL;
+ /* do not reset disp->Driver */
+ disp->Initialized = EGL_FALSE;
}
return EGL_TRUE;
@@ -167,7 +168,7 @@ _eglCheckDisplay(_EGLDisplay *disp, const char *msg)
_eglError(EGL_BAD_DISPLAY, msg);
return NULL;
}
- if (!disp->Driver) {
+ if (!disp->Initialized) {
_eglError(EGL_NOT_INITIALIZED, msg);
return NULL;
}
@@ -393,9 +394,19 @@ eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read,
_EGLSurface *read_surf = _eglLookupSurface(read, disp);
_EGLDriver *drv;
- drv = _eglCheckDisplay(disp, __FUNCTION__);
+ if (!disp)
+ return _eglError(EGL_BAD_DISPLAY, __FUNCTION__);
+ drv = disp->Driver;
+
+ /* display is allowed to be uninitialized under certain condition */
+ if (!disp->Initialized) {
+ if (draw != EGL_NO_SURFACE || read != EGL_NO_SURFACE ||
+ ctx != EGL_NO_CONTEXT)
+ return _eglError(EGL_BAD_DISPLAY, __FUNCTION__);
+ }
if (!drv)
- return EGL_FALSE;
+ return EGL_TRUE;
+
if (!context && ctx != EGL_NO_CONTEXT)
return _eglError(EGL_BAD_CONTEXT, __FUNCTION__);
if ((!draw_surf && draw != EGL_NO_SURFACE) ||
@@ -417,7 +428,7 @@ eglQueryContext(EGLDisplay dpy, EGLContext ctx,
EGLSurface EGLAPIENTRY
eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config,
- NativeWindowType window, const EGLint *attrib_list)
+ EGLNativeWindowType window, const EGLint *attrib_list)
{
_EGLDisplay *disp = _eglLookupDisplay(dpy);
_EGLConfig *conf = _eglLookupConfig(config, disp);
@@ -438,7 +449,7 @@ eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config,
EGLSurface EGLAPIENTRY
eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config,
- NativePixmapType pixmap, const EGLint *attrib_list)
+ EGLNativePixmapType pixmap, const EGLint *attrib_list)
{
_EGLDisplay *disp = _eglLookupDisplay(dpy);
_EGLConfig *conf = _eglLookupConfig(config, disp);
@@ -526,7 +537,7 @@ eglSwapInterval(EGLDisplay dpy, EGLint interval)
_EGLSurface *surf;
_EGL_DECLARE_DD(dpy);
- if (!ctx || !_eglIsContextLinked(ctx) || ctx->Display != disp)
+ if (!ctx || !_eglIsContextLinked(ctx) || ctx->Resource.Display != disp)
return _eglError(EGL_BAD_CONTEXT, __FUNCTION__);
surf = ctx->DrawSurface;
@@ -552,7 +563,7 @@ eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
EGLBoolean EGLAPIENTRY
-eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, NativePixmapType target)
+eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target)
{
_EGL_DECLARE_DD_AND_SURFACE(dpy, surface);
return drv->API.CopyBuffers(drv, disp, surf, target);
@@ -573,9 +584,9 @@ eglWaitClient(void)
return _eglError(EGL_BAD_CURRENT_SURFACE, __FUNCTION__);
/* a valid current context implies an initialized current display */
- disp = ctx->Display;
+ disp = ctx->Resource.Display;
+ assert(disp->Initialized);
drv = disp->Driver;
- assert(drv);
return drv->API.WaitClient(drv, disp, ctx);
}
@@ -617,9 +628,9 @@ eglWaitNative(EGLint engine)
return _eglError(EGL_BAD_CURRENT_SURFACE, __FUNCTION__);
/* a valid current context implies an initialized current display */
- disp = ctx->Display;
+ disp = ctx->Resource.Display;
+ assert(disp->Initialized);
drv = disp->Driver;
- assert(drv);
return drv->API.WaitNative(drv, disp, engine);
}
@@ -628,8 +639,8 @@ eglWaitNative(EGLint engine)
EGLDisplay EGLAPIENTRY
eglGetCurrentDisplay(void)
{
- _EGLDisplay *dpy = _eglGetCurrentDisplay();
- return _eglGetDisplayHandle(dpy);
+ _EGLContext *ctx = _eglGetCurrentContext();
+ return (ctx) ? _eglGetDisplayHandle(ctx->Resource.Display) : EGL_NO_DISPLAY;
}
@@ -678,7 +689,8 @@ eglGetError(void)
}
-void (* EGLAPIENTRY eglGetProcAddress(const char *procname))()
+__eglMustCastToProperFunctionPointerType EGLAPIENTRY
+eglGetProcAddress(const char *procname)
{
static const struct {
const char *name;
@@ -699,6 +711,10 @@ void (* EGLAPIENTRY eglGetProcAddress(const char *procname))()
{ "eglQueryScreenModeMESA", (_EGLProc) eglQueryScreenModeMESA },
{ "eglQueryModeStringMESA", (_EGLProc) eglQueryModeStringMESA },
#endif /* EGL_MESA_screen_surface */
+#ifdef EGL_KHR_image_base
+ { "eglCreateImageKHR", (_EGLProc) eglCreateImageKHR },
+ { "eglDestroyImageKHR", (_EGLProc) eglDestroyImageKHR },
+#endif /* EGL_KHR_image_base */
{ NULL, NULL }
};
EGLint i;
@@ -978,14 +994,23 @@ eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype,
EGLBoolean
eglReleaseThread(void)
{
- /* unbind current context */
+ /* unbind current contexts */
if (!_eglIsCurrentThreadDummy()) {
- _EGLDisplay *disp = _eglGetCurrentDisplay();
- _EGLDriver *drv;
- if (disp) {
- drv = disp->Driver;
- (void) drv->API.MakeCurrent(drv, disp, NULL, NULL, NULL);
+ _EGLThreadInfo *t = _eglGetCurrentThread();
+ EGLint api_index = t->CurrentAPIIndex;
+ EGLint i;
+
+ for (i = 0; i < _EGL_API_NUM_APIS; i++) {
+ _EGLContext *ctx = t->CurrentContexts[i];
+ if (ctx) {
+ _EGLDisplay *disp = ctx->Resource.Display;
+ _EGLDriver *drv = disp->Driver;
+ t->CurrentAPIIndex = i;
+ (void) drv->API.MakeCurrent(drv, disp, NULL, NULL, NULL);
+ }
}
+
+ t->CurrentAPIIndex = api_index;
}
_eglDestroyCurrentThread();
@@ -994,3 +1019,52 @@ eglReleaseThread(void)
#endif /* EGL_VERSION_1_2 */
+
+
+#ifdef EGL_KHR_image_base
+
+
+EGLImageKHR
+eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target,
+ EGLClientBuffer buffer, const EGLint *attr_list)
+{
+ _EGLDisplay *disp = _eglLookupDisplay(dpy);
+ _EGLContext *context = _eglLookupContext(ctx, disp);
+ _EGLDriver *drv;
+ _EGLImage *img;
+
+ drv = _eglCheckDisplay(disp, __FUNCTION__);
+ if (!drv)
+ return EGL_NO_IMAGE_KHR;
+ if (!context && ctx != EGL_NO_CONTEXT) {
+ _eglError(EGL_BAD_CONTEXT, __FUNCTION__);
+ return EGL_NO_IMAGE_KHR;
+ }
+
+ img = drv->API.CreateImageKHR(drv,
+ disp, context, target, buffer, attr_list);
+ if (img)
+ return _eglLinkImage(img, disp);
+ else
+ return EGL_NO_IMAGE_KHR;
+}
+
+
+EGLBoolean eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR image)
+{
+ _EGLDisplay *disp = _eglLookupDisplay(dpy);
+ _EGLImage *img = _eglLookupImage(image, disp);
+ _EGLDriver *drv;
+
+ drv = _eglCheckDisplay(disp, __FUNCTION__);
+ if (!drv)
+ return EGL_FALSE;
+ if (!img)
+ return _eglError(EGL_BAD_PARAMETER, __FUNCTION__);
+
+ _eglUnlinkImage(img);
+ return drv->API.DestroyImageKHR(drv, disp, img);
+}
+
+
+#endif /* EGL_KHR_image_base */
diff --git a/src/egl/main/eglapi.h b/src/egl/main/eglapi.h
index 080f2155e3a..a7600820f3f 100644
--- a/src/egl/main/eglapi.h
+++ b/src/egl/main/eglapi.h
@@ -23,12 +23,13 @@ typedef EGLBoolean (*GetConfigAttrib_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLC
/* context funcs */
typedef _EGLContext *(*CreateContext_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *config, _EGLContext *share_list, const EGLint *attrib_list);
typedef EGLBoolean (*DestroyContext_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx);
+/* this is the only function (other than Initialize) that may be called with an uninitialized display */
typedef EGLBoolean (*MakeCurrent_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw, _EGLSurface *read, _EGLContext *ctx);
typedef EGLBoolean (*QueryContext_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx, EGLint attribute, EGLint *value);
/* surface funcs */
-typedef _EGLSurface *(*CreateWindowSurface_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *config, NativeWindowType window, const EGLint *attrib_list);
-typedef _EGLSurface *(*CreatePixmapSurface_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *config, NativePixmapType pixmap, const EGLint *attrib_list);
+typedef _EGLSurface *(*CreateWindowSurface_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *config, EGLNativeWindowType window, const EGLint *attrib_list);
+typedef _EGLSurface *(*CreatePixmapSurface_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *config, EGLNativePixmapType pixmap, const EGLint *attrib_list);
typedef _EGLSurface *(*CreatePbufferSurface_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *config, const EGLint *attrib_list);
typedef EGLBoolean (*DestroySurface_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface);
typedef EGLBoolean (*QuerySurface_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, EGLint attribute, EGLint *value);
@@ -37,7 +38,7 @@ typedef EGLBoolean (*BindTexImage_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurf
typedef EGLBoolean (*ReleaseTexImage_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, EGLint buffer);
typedef EGLBoolean (*SwapInterval_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint interval);
typedef EGLBoolean (*SwapBuffers_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw);
-typedef EGLBoolean (*CopyBuffers_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, NativePixmapType target);
+typedef EGLBoolean (*CopyBuffers_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, EGLNativePixmapType target);
/* misc funcs */
typedef const char *(*QueryString_t)(_EGLDriver *drv, _EGLDisplay *dpy, EGLint name);
@@ -69,6 +70,11 @@ typedef _EGLSurface *(*CreatePbufferFromClientBuffer_t)(_EGLDriver *drv, _EGLDis
#endif /* EGL_VERSION_1_2 */
+#ifdef EGL_KHR_image_base
+typedef _EGLImage *(*CreateImageKHR_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attr_list);
+typedef EGLBoolean (*DestroyImageKHR_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLImage *image);
+#endif /* EGL_KHR_image_base */
+
/**
* The API dispatcher jumps through these functions
@@ -104,7 +110,7 @@ struct _egl_api
WaitNative_t WaitNative;
GetProcAddress_t GetProcAddress;
- /* EGL_MESA_screen extension */
+#ifdef EGL_MESA_screen_surface
ChooseModeMESA_t ChooseModeMESA;
GetModesMESA_t GetModesMESA;
GetModeAttribMESA_t GetModeAttribMESA;
@@ -117,10 +123,16 @@ struct _egl_api
QueryScreenSurfaceMESA_t QueryScreenSurfaceMESA;
QueryScreenModeMESA_t QueryScreenModeMESA;
QueryModeStringMESA_t QueryModeStringMESA;
+#endif /* EGL_MESA_screen_surface */
#ifdef EGL_VERSION_1_2
CreatePbufferFromClientBuffer_t CreatePbufferFromClientBuffer;
#endif
+
+#ifdef EGL_KHR_image_base
+ CreateImageKHR_t CreateImageKHR;
+ DestroyImageKHR_t DestroyImageKHR;
+#endif /* EGL_KHR_image_base */
};
#endif /* EGLAPI_INCLUDED */
diff --git a/src/egl/main/eglcompiler.h b/src/egl/main/eglcompiler.h
index 5a3fb49ac22..d844fbb0efb 100644
--- a/src/egl/main/eglcompiler.h
+++ b/src/egl/main/eglcompiler.h
@@ -71,5 +71,23 @@
# define PUBLIC
#endif
+/**
+ * The __FUNCTION__ gcc variable is generally only used for debugging.
+ * If we're not using gcc, define __FUNCTION__ as a cpp symbol here.
+ * Don't define it if using a newer Windows compiler.
+ */
+#ifndef __FUNCTION__
+# if defined(__VMS)
+# define __FUNCTION__ "VMS$NL:"
+# elif ((!defined __GNUC__) || (__GNUC__ < 2)) && (!defined __xlC__) && \
+ (!defined(_MSC_VER) || _MSC_VER < 1300)
+# if (__STDC_VERSION__ >= 199901L) /* C99 */ || \
+ (defined(__SUNPRO_C) && defined(__C99FEATURES__))
+# define __FUNCTION__ __func__
+# else
+# define __FUNCTION__ "<unknown>"
+# endif
+# endif
+#endif
#endif /* EGLCOMPILER_INCLUDED */
diff --git a/src/egl/main/eglconfig.c b/src/egl/main/eglconfig.c
index 4d149603ae5..a57aa333529 100644
--- a/src/egl/main/eglconfig.c
+++ b/src/egl/main/eglconfig.c
@@ -224,7 +224,8 @@ static const struct {
{ EGL_MATCH_NATIVE_PIXMAP, ATTRIB_TYPE_PSEUDO,
ATTRIB_CRITERION_SPECIAL,
EGL_NONE },
- { EGL_PRESERVED_RESOURCES, ATTRIB_TYPE_PSEUDO,
+ /* there is a gap before EGL_SAMPLES */
+ { 0x3030, ATTRIB_TYPE_PSEUDO,
ATTRIB_CRITERION_IGNORE,
0 },
{ EGL_NONE, ATTRIB_TYPE_PSEUDO,
@@ -773,7 +774,7 @@ _eglIsConfigAttribValid(_EGLConfig *conf, EGLint attr)
/* there are some holes in the range */
switch (attr) {
- case EGL_PRESERVED_RESOURCES:
+ case 0x3030 /* a gap before EGL_SAMPLES */:
case EGL_NONE:
#ifdef EGL_VERSION_1_4
case EGL_MATCH_NATIVE_PIXMAP:
diff --git a/src/egl/main/eglconfigutil.c b/src/egl/main/eglconfigutil.c
index 36e94f0d2de..9cf94b3c4ab 100644
--- a/src/egl/main/eglconfigutil.c
+++ b/src/egl/main/eglconfigutil.c
@@ -128,210 +128,3 @@ _eglConfigFromContextModesRec(_EGLConfig *conf, const __GLcontextModes *m,
return EGL_TRUE;
}
-
-
-/**
- * Creates a set of \c _EGLConfigs that a driver will expose.
- *
- * A set of \c __GLcontextModes will be created based on the supplied
- * parameters. The number of modes processed will be 2 *
- * \c num_depth_stencil_bits * \c num_db_modes.
- *
- * For the most part, data is just copied from \c depth_bits, \c stencil_bits,
- * \c db_modes, and \c visType into each \c __GLcontextModes element.
- * However, the meanings of \c fb_format and \c fb_type require further
- * explanation. The \c fb_format specifies which color components are in
- * each pixel and what the default order is. For example, \c GL_RGB specifies
- * that red, green, blue are available and red is in the "most significant"
- * position and blue is in the "least significant". The \c fb_type specifies
- * the bit sizes of each component and the actual ordering. For example, if
- * \c GL_UNSIGNED_SHORT_5_6_5_REV is specified with \c GL_RGB, bits [15:11]
- * are the blue value, bits [10:5] are the green value, and bits [4:0] are
- * the red value.
- *
- * One sublte issue is the combination of \c GL_RGB or \c GL_BGR and either
- * of the \c GL_UNSIGNED_INT_8_8_8_8 modes. The resulting mask values in the
- * \c __GLcontextModes structure is \b identical to the \c GL_RGBA or
- * \c GL_BGRA case, except the \c alphaMask is zero. This means that, as
- * far as this routine is concerned, \c GL_RGB with \c GL_UNSIGNED_INT_8_8_8_8
- * still uses 32-bits.
- *
- * If in doubt, look at the tables used in the function.
- *
- * \param configs the array of configs generated
- * \param fb_format Format of the framebuffer. Currently only \c GL_RGB,
- * \c GL_RGBA, \c GL_BGR, and \c GL_BGRA are supported.
- * \param fb_type Type of the pixels in the framebuffer. Currently only
- * \c GL_UNSIGNED_SHORT_5_6_5,
- * \c GL_UNSIGNED_SHORT_5_6_5_REV,
- * \c GL_UNSIGNED_INT_8_8_8_8, and
- * \c GL_UNSIGNED_INT_8_8_8_8_REV are supported.
- * \param depth_bits Array of depth buffer sizes to be exposed.
- * \param stencil_bits Array of stencil buffer sizes to be exposed.
- * \param num_depth_stencil_bits Number of entries in both \c depth_bits and
- * \c stencil_bits.
- * \param db_modes Array of buffer swap modes. If an element has a
- * value of \c GLX_NONE, then it represents a
- * single-buffered mode. Other valid values are
- * \c GLX_SWAP_EXCHANGE_OML, \c GLX_SWAP_COPY_OML, and
- * \c GLX_SWAP_UNDEFINED_OML. See the
- * GLX_OML_swap_method extension spec for more details.
- * \param num_db_modes Number of entries in \c db_modes.
- * \param visType GLX visual type. Usually either \c GLX_TRUE_COLOR or
- * \c GLX_DIRECT_COLOR.
- *
- * \returns
- * \c GL_TRUE on success or \c GL_FALSE on failure. Currently the only
- * cause of failure is a bad parameter (i.e., unsupported \c fb_format or
- * \c fb_type).
- *
- * \todo
- * There is currently no way to support packed RGB modes (i.e., modes with
- * exactly 3 bytes per pixel) or floating-point modes. This could probably
- * be done by creating some new, private enums with clever names likes
- * \c GL_UNSIGNED_3BYTE_8_8_8, \c GL_4FLOAT_32_32_32_32,
- * \c GL_4HALF_16_16_16_16, etc. We can cross that bridge when we come to it.
- */
-EGLBoolean
-_eglFillInConfigs(_EGLConfig * configs,
- GLenum fb_format, GLenum fb_type,
- const uint8_t * depth_bits, const uint8_t * stencil_bits,
- unsigned num_depth_stencil_bits,
- const GLenum * db_modes, unsigned num_db_modes,
- int visType)
-{
- static const uint8_t bits_table[3][4] = {
- /* R G B A */
- { 5, 6, 5, 0 }, /* Any GL_UNSIGNED_SHORT_5_6_5 */
- { 8, 8, 8, 0 }, /* Any RGB with any GL_UNSIGNED_INT_8_8_8_8 */
- { 8, 8, 8, 8 } /* Any RGBA with any GL_UNSIGNED_INT_8_8_8_8 */
- };
-
- /* The following arrays are all indexed by the fb_type masked with 0x07.
- * Given the four supported fb_type values, this results in valid array
- * indices of 3, 4, 5, and 7.
- */
- static const uint32_t masks_table_rgb[8][4] = {
- {0x00000000, 0x00000000, 0x00000000, 0x00000000},
- {0x00000000, 0x00000000, 0x00000000, 0x00000000},
- {0x00000000, 0x00000000, 0x00000000, 0x00000000},
- {0x0000F800, 0x000007E0, 0x0000001F, 0x00000000}, /* 5_6_5 */
- {0x0000001F, 0x000007E0, 0x0000F800, 0x00000000}, /* 5_6_5_REV */
- {0xFF000000, 0x00FF0000, 0x0000FF00, 0x00000000}, /* 8_8_8_8 */
- {0x00000000, 0x00000000, 0x00000000, 0x00000000},
- {0x000000FF, 0x0000FF00, 0x00FF0000, 0x00000000} /* 8_8_8_8_REV */
- };
-
- static const uint32_t masks_table_rgba[8][4] = {
- {0x00000000, 0x00000000, 0x00000000, 0x00000000},
- {0x00000000, 0x00000000, 0x00000000, 0x00000000},
- {0x00000000, 0x00000000, 0x00000000, 0x00000000},
- {0x0000F800, 0x000007E0, 0x0000001F, 0x00000000}, /* 5_6_5 */
- {0x0000001F, 0x000007E0, 0x0000F800, 0x00000000}, /* 5_6_5_REV */
- {0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF}, /* 8_8_8_8 */
- {0x00000000, 0x00000000, 0x00000000, 0x00000000},
- {0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000}, /* 8_8_8_8_REV */
- };
-
-#if 0
- static const uint32_t masks_table_bgr[8][4] = {
- {0x00000000, 0x00000000, 0x00000000, 0x00000000},
- {0x00000000, 0x00000000, 0x00000000, 0x00000000},
- {0x00000000, 0x00000000, 0x00000000, 0x00000000},
- {0x0000001F, 0x000007E0, 0x0000F800, 0x00000000}, /* 5_6_5 */
- {0x0000F800, 0x000007E0, 0x0000001F, 0x00000000}, /* 5_6_5_REV */
- {0x0000FF00, 0x00FF0000, 0xFF000000, 0x00000000}, /* 8_8_8_8 */
- {0x00000000, 0x00000000, 0x00000000, 0x00000000},
- {0x00FF0000, 0x0000FF00, 0x000000FF, 0x00000000}, /* 8_8_8_8_REV */
- };
-
- static const uint32_t masks_table_bgra[8][4] = {
- {0x00000000, 0x00000000, 0x00000000, 0x00000000},
- {0x00000000, 0x00000000, 0x00000000, 0x00000000},
- {0x00000000, 0x00000000, 0x00000000, 0x00000000},
- {0x0000001F, 0x000007E0, 0x0000F800, 0x00000000}, /* 5_6_5 */
- {0x0000F800, 0x000007E0, 0x0000001F, 0x00000000}, /* 5_6_5_REV */
- {0x0000FF00, 0x00FF0000, 0xFF000000, 0x000000FF}, /* 8_8_8_8 */
- {0x00000000, 0x00000000, 0x00000000, 0x00000000},
- {0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000}, /* 8_8_8_8_REV */
- };
-#endif
-
- static const uint8_t bytes_per_pixel[8] = {
- 0, 0, 0, 2, 2, 4, 0, 4
- };
-
- const uint8_t * bits;
- const uint32_t * masks;
- const int index = fb_type & 0x07;
- _EGLConfig *config;
- unsigned i;
- unsigned j;
- unsigned k;
-
- if ( bytes_per_pixel[index] == 0 ) {
- _eglLog(_EGL_INFO,
- "[_eglFillInConfigs:%u] Framebuffer type 0x%04x has 0 bytes per pixel.",
- __LINE__, fb_type);
- return GL_FALSE;
- }
-
- /* Valid types are GL_UNSIGNED_SHORT_5_6_5 and GL_UNSIGNED_INT_8_8_8_8 and
- * the _REV versions.
- *
- * Valid formats are GL_RGBA, GL_RGB, and GL_BGRA.
- */
- switch ( fb_format ) {
- case GL_RGB:
- bits = (bytes_per_pixel[index] == 2) ? bits_table[0] : bits_table[1];
- masks = masks_table_rgb[index];
- break;
-
- case GL_RGBA:
- bits = (bytes_per_pixel[index] == 2) ? bits_table[0] : bits_table[2];
- masks = masks_table_rgba[index];
- break;
-
-#if 0
- case GL_BGR:
- bits = (bytes_per_pixel[index] == 2) ? bits_table[0] : bits_table[1];
- masks = masks_table_bgr[index];
- break;
-
- case GL_BGRA:
- bits = (bytes_per_pixel[index] == 2) ? bits_table[0] : bits_table[2];
- masks = masks_table_bgra[index];
- break;
-#endif
-
- default:
- _eglLog(_EGL_WARNING,
- "[_eglFillInConfigs:%u] Framebuffer format 0x%04x is not GL_RGB, GL_RGBA, GL_BGR, or GL_BGRA.",
- __LINE__, fb_format);
- return GL_FALSE;
- }
-
- config = configs;
- for (k = 0; k < num_depth_stencil_bits; k++) {
- for (i = 0; i < num_db_modes; i++) {
- for (j = 0; j < 2; j++) {
- _eglSetConfigAttrib(config, EGL_RED_SIZE, bits[0]);
- _eglSetConfigAttrib(config, EGL_GREEN_SIZE, bits[1]);
- _eglSetConfigAttrib(config, EGL_BLUE_SIZE, bits[2]);
- _eglSetConfigAttrib(config, EGL_ALPHA_SIZE, bits[3]);
- _eglSetConfigAttrib(config, EGL_BUFFER_SIZE,
- bits[0] + bits[1] + bits[2] + bits[3]);
-
- _eglSetConfigAttrib(config, EGL_STENCIL_SIZE, stencil_bits[k]);
- _eglSetConfigAttrib(config, EGL_DEPTH_SIZE, depth_bits[i]);
-
- _eglSetConfigAttrib(config, EGL_SURFACE_TYPE, EGL_SCREEN_BIT_MESA |
- EGL_PBUFFER_BIT | EGL_PIXMAP_BIT | EGL_WINDOW_BIT);
-
- config++;
- }
- }
- }
- return GL_TRUE;
-}
-
diff --git a/src/egl/main/eglconfigutil.h b/src/egl/main/eglconfigutil.h
index 9f8906dedb6..c6f48199605 100644
--- a/src/egl/main/eglconfigutil.h
+++ b/src/egl/main/eglconfigutil.h
@@ -16,14 +16,4 @@ _eglConfigFromContextModesRec(_EGLConfig *conf, const __GLcontextModes *m,
EGLint conformant, EGLint renderable_type);
-PUBLIC EGLBoolean
-_eglFillInConfigs( _EGLConfig *configs,
- EGLenum fb_format, EGLenum fb_type,
- const uint8_t * depth_bits, const uint8_t * stencil_bits,
- unsigned num_depth_stencil_bits,
- const EGLenum * db_modes, unsigned num_db_modes,
- int visType );
-
-
-
#endif /* EGLCONFIGUTIL_INCLUDED */
diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c
index ee4b1b59f5b..4496f76eceb 100644
--- a/src/egl/main/eglcontext.c
+++ b/src/egl/main/eglcontext.c
@@ -140,99 +140,169 @@ _eglQueryContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *c,
/**
- * Drivers will typically call this to do the error checking and
- * update the various flags.
- * Then, the driver will do its device-dependent Make-Current stuff.
+ * Bind the context to the surfaces. Return the surfaces that are "orphaned".
+ * That is, when the context is not NULL, return the surfaces it previously
+ * bound to; when the context is NULL, the same surfaces are returned.
*/
-EGLBoolean
-_eglMakeCurrent(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw,
- _EGLSurface *read, _EGLContext *ctx)
+static void
+_eglBindContextToSurfaces(_EGLContext *ctx,
+ _EGLSurface **draw, _EGLSurface **read)
+{
+ _EGLSurface *newDraw = *draw, *newRead = *read;
+
+ if (newDraw->Binding)
+ newDraw->Binding->DrawSurface = NULL;
+ newDraw->Binding = ctx;
+
+ if (newRead->Binding)
+ newRead->Binding->ReadSurface = NULL;
+ newRead->Binding = ctx;
+
+ if (ctx) {
+ *draw = ctx->DrawSurface;
+ ctx->DrawSurface = newDraw;
+
+ *read = ctx->ReadSurface;
+ ctx->ReadSurface = newRead;
+ }
+}
+
+
+/**
+ * Bind the context to the thread and return the previous context.
+ *
+ * Note that the context may be NULL.
+ */
+static _EGLContext *
+_eglBindContextToThread(_EGLContext *ctx, _EGLThreadInfo *t)
{
- _EGLThreadInfo *t = _eglGetCurrentThread();
- _EGLContext *oldContext = NULL;
- _EGLSurface *oldDrawSurface = NULL;
- _EGLSurface *oldReadSurface = NULL;
EGLint apiIndex;
+ _EGLContext *oldCtx;
+
+ apiIndex = (ctx) ?
+ _eglConvertApiToIndex(ctx->ClientAPI) : t->CurrentAPIIndex;
+
+ oldCtx = t->CurrentContexts[apiIndex];
+ if (ctx == oldCtx)
+ return NULL;
+
+ if (oldCtx)
+ oldCtx->Binding = NULL;
+ if (ctx)
+ ctx->Binding = t;
+
+ t->CurrentContexts[apiIndex] = ctx;
+
+ return oldCtx;
+}
+
+
+/**
+ * Return true if the given context and surfaces can be made current.
+ */
+static EGLBoolean
+_eglCheckMakeCurrent(_EGLContext *ctx, _EGLSurface *draw, _EGLSurface *read)
+{
+ _EGLThreadInfo *t = _eglGetCurrentThread();
+ EGLint conflict_api;
if (_eglIsCurrentThreadDummy())
return _eglError(EGL_BAD_ALLOC, "eglMakeCurrent");
- if (ctx) {
- /* error checking */
- if (ctx->Binding && ctx->Binding != t)
- return _eglError(EGL_BAD_ACCESS, "eglMakeCurrent");
- if (draw == NULL || read == NULL)
- return _eglError(EGL_BAD_MATCH, "eglMakeCurrent");
- if (draw->Config != ctx->Config || read->Config != ctx->Config)
+ /* this is easy */
+ if (!ctx) {
+ if (draw || read)
return _eglError(EGL_BAD_MATCH, "eglMakeCurrent");
- if ((draw->Binding && draw->Binding->Binding != t) ||
- (read->Binding && read->Binding->Binding != t))
- return _eglError(EGL_BAD_ACCESS, "eglMakeCurrent");
+ return EGL_TRUE;
+ }
+
+ /* ctx/draw/read must be all given */
+ if (draw == NULL || read == NULL)
+ return _eglError(EGL_BAD_MATCH, "eglMakeCurrent");
+
+ /* context stealing from another thread is not allowed */
+ if (ctx->Binding && ctx->Binding != t)
+ return _eglError(EGL_BAD_ACCESS, "eglMakeCurrent");
+
+ /*
+ * The spec says
+ *
+ * "If ctx is current to some other thread, or if either draw or read are
+ * bound to contexts in another thread, an EGL_BAD_ACCESS error is
+ * generated."
+ *
+ * But it also says
+ *
+ * "at most one context may be bound to a particular surface at a given
+ * time"
+ *
+ * The latter is more restrictive so we can check only the latter case.
+ */
+ if ((draw->Binding && draw->Binding != ctx) ||
+ (read->Binding && read->Binding != ctx))
+ return _eglError(EGL_BAD_ACCESS, "eglMakeCurrent");
+ /* simply require the configs to be equal */
+ if (draw->Config != ctx->Config || read->Config != ctx->Config)
+ return _eglError(EGL_BAD_MATCH, "eglMakeCurrent");
+
+ switch (ctx->ClientAPI) {
#ifdef EGL_VERSION_1_4
- /* OpenGL and OpenGL ES are conflicting */
- switch (ctx->ClientAPI) {
- case EGL_OPENGL_ES_API:
- if (t->CurrentContexts[_eglConvertApiToIndex(EGL_OPENGL_API)])
- return _eglError(EGL_BAD_ACCESS, "eglMakeCurrent");
- break;
- case EGL_OPENGL_API:
- if (t->CurrentContexts[_eglConvertApiToIndex(EGL_OPENGL_ES_API)])
- return _eglError(EGL_BAD_ACCESS, "eglMakeCurrent");
- break;
- default:
- break;
- }
+ /* OpenGL and OpenGL ES are conflicting */
+ case EGL_OPENGL_ES_API:
+ conflict_api = EGL_OPENGL_API;
+ break;
+ case EGL_OPENGL_API:
+ conflict_api = EGL_OPENGL_ES_API;
+ break;
#endif
- apiIndex = _eglConvertApiToIndex(ctx->ClientAPI);
- }
- else {
- if (draw != NULL || read != NULL)
- return _eglError(EGL_BAD_MATCH, "eglMakeCurrent");
- apiIndex = t->CurrentAPIIndex;
+ default:
+ conflict_api = -1;
+ break;
}
- oldContext = t->CurrentContexts[apiIndex];
- if (oldContext) {
- oldDrawSurface = oldContext->DrawSurface;
- oldReadSurface = oldContext->ReadSurface;
- assert(oldDrawSurface);
- assert(oldReadSurface);
-
- /* break old bindings */
- t->CurrentContexts[apiIndex] = NULL;
- oldContext->Binding = NULL;
- oldContext->DrawSurface = NULL;
- oldContext->ReadSurface = NULL;
- oldDrawSurface->Binding = NULL;
- oldReadSurface->Binding = NULL;
+ if (conflict_api >= 0 && _eglGetAPIContext(conflict_api))
+ return _eglError(EGL_BAD_ACCESS, "eglMakeCurrent");
+
+ return EGL_TRUE;
+}
+
+
+/**
+ * Bind the context to the current thread and given surfaces. Return the
+ * previously bound context and the surfaces it bound to. Each argument is
+ * both input and output.
+ */
+EGLBoolean
+_eglBindContext(_EGLContext **ctx, _EGLSurface **draw, _EGLSurface **read)
+{
+ _EGLThreadInfo *t = _eglGetCurrentThread();
+ _EGLContext *newCtx = *ctx, *oldCtx;
+
+ if (!_eglCheckMakeCurrent(newCtx, *draw, *read))
+ return EGL_FALSE;
+
+ /* bind the new context */
+ oldCtx = _eglBindContextToThread(newCtx, t);
+ *ctx = oldCtx;
+ if (newCtx)
+ _eglBindContextToSurfaces(newCtx, draw, read);
+ /* unbind the old context from its binding surfaces */
+ if (oldCtx) {
/*
- * check if the old context or surfaces need to be deleted
+ * 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
+ * surface.
*/
- if (!_eglIsSurfaceLinked(oldDrawSurface)) {
- assert(draw != oldDrawSurface && read != oldDrawSurface);
- drv->API.DestroySurface(drv, dpy, oldDrawSurface);
- }
- if (oldReadSurface != oldDrawSurface &&
- !_eglIsSurfaceLinked(oldReadSurface)) {
- assert(draw != oldReadSurface && read != oldReadSurface);
- drv->API.DestroySurface(drv, dpy, oldReadSurface);
- }
- if (!_eglIsContextLinked(oldContext)) {
- assert(ctx != oldContext);
- drv->API.DestroyContext(drv, dpy, oldContext);
- }
- }
+ if (newCtx)
+ assert(!*draw && !*read);
- /* build new bindings */
- if (ctx) {
- t->CurrentContexts[apiIndex] = ctx;
- ctx->Binding = t;
- ctx->DrawSurface = draw;
- ctx->ReadSurface = read;
- draw->Binding = ctx;
- read->Binding = ctx;
+ *draw = oldCtx->DrawSurface;
+ *read = oldCtx->ReadSurface;
+ assert(*draw && *read);
+
+ _eglBindContextToSurfaces(NULL, draw, read);
}
return EGL_TRUE;
@@ -240,6 +310,17 @@ _eglMakeCurrent(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw,
/**
+ * Just a placeholder/demo function. Drivers should override this.
+ */
+EGLBoolean
+_eglMakeCurrent(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw,
+ _EGLSurface *read, _EGLContext *ctx)
+{
+ return EGL_FALSE;
+}
+
+
+/**
* This is defined by the EGL_MESA_copy_context extension.
*/
EGLBoolean
diff --git a/src/egl/main/eglcontext.h b/src/egl/main/eglcontext.h
index cb9e3f4a892..4811e3bb7ad 100644
--- a/src/egl/main/eglcontext.h
+++ b/src/egl/main/eglcontext.h
@@ -4,6 +4,7 @@
#include "egltypedefs.h"
+#include "egldisplay.h"
/**
@@ -11,9 +12,8 @@
*/
struct _egl_context
{
- /* Managed by EGLDisplay for linking */
- _EGLDisplay *Display;
- _EGLContext *Next;
+ /* A context is a display resource */
+ _EGLResource Resource;
/* The bound status of the context */
_EGLThreadInfo *Binding;
@@ -48,6 +48,10 @@ _eglQueryContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx, EGLint att
PUBLIC EGLBoolean
+_eglBindContext(_EGLContext **ctx, _EGLSurface **draw, _EGLSurface **read);
+
+
+extern EGLBoolean
_eglMakeCurrent(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw, _EGLSurface *read, _EGLContext *ctx);
@@ -65,4 +69,64 @@ _eglIsContextBound(_EGLContext *ctx)
}
+/**
+ * Link a context to a display and return the handle of the link.
+ * The handle can be passed to client directly.
+ */
+static INLINE EGLContext
+_eglLinkContext(_EGLContext *ctx, _EGLDisplay *dpy)
+{
+ _eglLinkResource(&ctx->Resource, _EGL_RESOURCE_CONTEXT, dpy);
+ return (EGLContext) ctx;
+}
+
+
+/**
+ * Unlink a linked context from its display.
+ * Accessing an unlinked context should generate EGL_BAD_CONTEXT error.
+ */
+static INLINE void
+_eglUnlinkContext(_EGLContext *ctx)
+{
+ _eglUnlinkResource(&ctx->Resource, _EGL_RESOURCE_CONTEXT);
+}
+
+
+/**
+ * Lookup a handle to find the linked context.
+ * Return NULL if the handle has no corresponding linked context.
+ */
+static INLINE _EGLContext *
+_eglLookupContext(EGLContext context, _EGLDisplay *dpy)
+{
+ _EGLContext *ctx = (_EGLContext *) context;
+ if (!dpy || !_eglCheckResource((void *) ctx, _EGL_RESOURCE_CONTEXT, dpy))
+ ctx = NULL;
+ return ctx;
+}
+
+
+/**
+ * Return the handle of a linked context, or EGL_NO_CONTEXT.
+ */
+static INLINE EGLContext
+_eglGetContextHandle(_EGLContext *ctx)
+{
+ _EGLResource *res = (_EGLResource *) ctx;
+ return (res && _eglIsResourceLinked(res)) ?
+ (EGLContext) ctx : EGL_NO_CONTEXT;
+}
+
+
+/**
+ * Return true if the context is linked to a display.
+ */
+static INLINE EGLBoolean
+_eglIsContextLinked(_EGLContext *ctx)
+{
+ _EGLResource *res = (_EGLResource *) ctx;
+ return (res && _eglIsResourceLinked(res));
+}
+
+
#endif /* EGLCONTEXT_INCLUDED */
diff --git a/src/egl/main/eglcurrent.c b/src/egl/main/eglcurrent.c
index df506151b58..696d04e8ba9 100644
--- a/src/egl/main/eglcurrent.c
+++ b/src/egl/main/eglcurrent.c
@@ -227,50 +227,24 @@ _eglIsCurrentThreadDummy(void)
/**
- * Return the currently bound context, or NULL.
+ * Return the currently bound context of the given API, or NULL.
*/
-_EGLContext *
-_eglGetCurrentContext(void)
-{
- _EGLThreadInfo *t = _eglGetCurrentThread();
- return t->CurrentContexts[t->CurrentAPIIndex];
-}
-
-
-/**
- * Return the display of the currently bound context, or NULL.
- */
-_EGLDisplay *
-_eglGetCurrentDisplay(void)
+PUBLIC _EGLContext *
+_eglGetAPIContext(EGLenum api)
{
_EGLThreadInfo *t = _eglGetCurrentThread();
- _EGLContext *ctx = t->CurrentContexts[t->CurrentAPIIndex];
- if (ctx)
- return ctx->Display;
- else
- return NULL;
+ return t->CurrentContexts[_eglConvertApiToIndex(api)];
}
/**
- * Return the read or write surface of the currently bound context, or NULL.
+ * Return the currently bound context of the current API, or NULL.
*/
-_EGLSurface *
-_eglGetCurrentSurface(EGLint readdraw)
+_EGLContext *
+_eglGetCurrentContext(void)
{
_EGLThreadInfo *t = _eglGetCurrentThread();
- _EGLContext *ctx = t->CurrentContexts[t->CurrentAPIIndex];
- if (ctx) {
- switch (readdraw) {
- case EGL_DRAW:
- return ctx->DrawSurface;
- case EGL_READ:
- return ctx->ReadSurface;
- default:
- return NULL;
- }
- }
- return NULL;
+ return t->CurrentContexts[t->CurrentAPIIndex];
}
diff --git a/src/egl/main/eglcurrent.h b/src/egl/main/eglcurrent.h
index c4478b38914..c169c93e945 100644
--- a/src/egl/main/eglcurrent.h
+++ b/src/egl/main/eglcurrent.h
@@ -73,15 +73,11 @@ _eglIsCurrentThreadDummy(void);
PUBLIC _EGLContext *
-_eglGetCurrentContext(void);
-
-
-PUBLIC _EGLDisplay *
-_eglGetCurrentDisplay(void);
+_eglGetAPIContext(EGLenum api);
-PUBLIC _EGLSurface *
-_eglGetCurrentSurface(EGLint readdraw);
+PUBLIC _EGLContext *
+_eglGetCurrentContext(void);
PUBLIC EGLBoolean
diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
index eb82af48842..b53cc597132 100644
--- a/src/egl/main/egldisplay.c
+++ b/src/egl/main/egldisplay.c
@@ -26,12 +26,18 @@ _eglFiniDisplay(void)
/* atexit function is called with global mutex locked */
dpyList = _eglGlobal.DisplayList;
while (dpyList) {
+ EGLint i;
+
/* pop list head */
dpy = dpyList;
dpyList = dpyList->Next;
- if (dpy->ContextList || dpy->SurfaceList)
- _eglLog(_EGL_DEBUG, "Display %p is destroyed with resources", dpy);
+ for (i = 0; i < _EGL_NUM_RESOURCES; i++) {
+ if (dpy->ResourceLists[i]) {
+ _eglLog(_EGL_DEBUG, "Display %p is destroyed with resources", dpy);
+ break;
+ }
+ }
free(dpy);
}
@@ -46,7 +52,7 @@ _eglFiniDisplay(void)
* Note that nativeDisplay may be an X Display ptr, or a string.
*/
_EGLDisplay *
-_eglNewDisplay(NativeDisplayType nativeDisplay)
+_eglNewDisplay(EGLNativeDisplayType nativeDisplay)
{
_EGLDisplay *dpy = (_EGLDisplay *) calloc(1, sizeof(_EGLDisplay));
if (dpy) {
@@ -108,7 +114,7 @@ _eglUnlinkDisplay(_EGLDisplay *dpy)
* linked displays.
*/
_EGLDisplay *
-_eglFindDisplay(NativeDisplayType nativeDisplay)
+_eglFindDisplay(EGLNativeDisplayType nativeDisplay)
{
_EGLDisplay *dpy;
@@ -135,29 +141,27 @@ _eglFindDisplay(NativeDisplayType nativeDisplay)
void
_eglReleaseDisplayResources(_EGLDriver *drv, _EGLDisplay *display)
{
- _EGLContext *contexts;
- _EGLSurface *surfaces;
+ _EGLResource *list;
- contexts = display->ContextList;
- surfaces = display->SurfaceList;
-
- while (contexts) {
- _EGLContext *ctx = contexts;
- contexts = contexts->Next;
+ list = display->ResourceLists[_EGL_RESOURCE_CONTEXT];
+ while (list) {
+ _EGLContext *ctx = (_EGLContext *) list;
+ list = list->Next;
_eglUnlinkContext(ctx);
drv->API.DestroyContext(drv, display, ctx);
}
- assert(!display->ContextList);
+ assert(!display->ResourceLists[_EGL_RESOURCE_CONTEXT]);
- while (surfaces) {
- _EGLSurface *surf = surfaces;
- surfaces = surfaces->Next;
+ list = display->ResourceLists[_EGL_RESOURCE_SURFACE];
+ while (list) {
+ _EGLSurface *surf = (_EGLSurface *) list;
+ list = list->Next;
_eglUnlinkSurface(surf);
drv->API.DestroySurface(drv, display, surf);
}
- assert(!display->SurfaceList);
+ assert(!display->ResourceLists[_EGL_RESOURCE_SURFACE]);
}
@@ -176,97 +180,13 @@ _eglCleanupDisplay(_EGLDisplay *disp)
free(disp->Configs);
disp->Configs = NULL;
disp->NumConfigs = 0;
+ disp->MaxConfigs = 0;
}
/* XXX incomplete */
}
-/**
- * Link a context to a display and return the handle of the link.
- * The handle can be passed to client directly.
- */
-EGLContext
-_eglLinkContext(_EGLContext *ctx, _EGLDisplay *dpy)
-{
- ctx->Display = dpy;
- ctx->Next = dpy->ContextList;
- dpy->ContextList = ctx;
- return (EGLContext) ctx;
-}
-
-
-/**
- * Unlink a linked context from its display.
- * Accessing an unlinked context should generate EGL_BAD_CONTEXT error.
- */
-void
-_eglUnlinkContext(_EGLContext *ctx)
-{
- _EGLContext *prev;
-
- prev = ctx->Display->ContextList;
- if (prev != ctx) {
- while (prev) {
- if (prev->Next == ctx)
- break;
- prev = prev->Next;
- }
- assert(prev);
- prev->Next = ctx->Next;
- }
- else {
- ctx->Display->ContextList = ctx->Next;
- }
-
- ctx->Next = NULL;
- ctx->Display = NULL;
-}
-
-
-/**
- * Link a surface to a display and return the handle of the link.
- * The handle can be passed to client directly.
- */
-EGLSurface
-_eglLinkSurface(_EGLSurface *surf, _EGLDisplay *dpy)
-{
- surf->Display = dpy;
- surf->Next = dpy->SurfaceList;
- dpy->SurfaceList = surf;
- return (EGLSurface) surf;
-}
-
-
-/**
- * Unlink a linked surface from its display.
- * Accessing an unlinked surface should generate EGL_BAD_SURFACE error.
- */
-void
-_eglUnlinkSurface(_EGLSurface *surf)
-{
- _EGLSurface *prev;
-
- prev = surf->Display->SurfaceList;
- if (prev != surf) {
- while (prev) {
- if (prev->Next == surf)
- break;
- prev = prev->Next;
- }
- assert(prev);
- prev->Next = surf->Next;
- }
- else {
- prev = NULL;
- surf->Display->SurfaceList = surf->Next;
- }
-
- surf->Next = NULL;
- surf->Display = NULL;
-}
-
-
#ifndef _EGL_SKIP_HANDLE_CHECK
@@ -291,45 +211,70 @@ _eglCheckDisplayHandle(EGLDisplay dpy)
/**
- * Return EGL_TRUE if the given handle is a valid handle to a context.
+ * Return EGL_TRUE if the given resource is valid. That is, the display does
+ * own the resource.
*/
EGLBoolean
-_eglCheckContextHandle(EGLContext ctx, _EGLDisplay *dpy)
+_eglCheckResource(void *res, _EGLResourceType type, _EGLDisplay *dpy)
{
- _EGLContext *cur = NULL;
-
- if (dpy)
- cur = dpy->ContextList;
- while (cur) {
- if (cur == (_EGLContext *) ctx) {
- assert(cur->Display == dpy);
+ _EGLResource *list = dpy->ResourceLists[type];
+
+ if (!res)
+ return EGL_FALSE;
+
+ while (list) {
+ if (res == (void *) list) {
+ assert(list->Display == dpy);
break;
}
- cur = cur->Next;
+ list = list->Next;
}
- return (cur != NULL);
+
+ return (list != NULL);
}
+#endif /* !_EGL_SKIP_HANDLE_CHECK */
+
+
/**
- * Return EGL_TRUE if the given handle is a valid handle to a surface.
+ * Link a resource to a display.
*/
-EGLBoolean
-_eglCheckSurfaceHandle(EGLSurface surf, _EGLDisplay *dpy)
+void
+_eglLinkResource(_EGLResource *res, _EGLResourceType type, _EGLDisplay *dpy)
{
- _EGLSurface *cur = NULL;
+ assert(!res->Display || res->Display == dpy);
- if (dpy)
- cur = dpy->SurfaceList;
- while (cur) {
- if (cur == (_EGLSurface *) surf) {
- assert(cur->Display == dpy);
- break;
- }
- cur = cur->Next;
- }
- return (cur != NULL);
+ res->Display = dpy;
+ res->IsLinked = EGL_TRUE;
+ res->Next = dpy->ResourceLists[type];
+ dpy->ResourceLists[type] = res;
}
-#endif /* !_EGL_SKIP_HANDLE_CHECK */
+/**
+ * Unlink a linked resource from its display.
+ */
+void
+_eglUnlinkResource(_EGLResource *res, _EGLResourceType type)
+{
+ _EGLResource *prev;
+
+ prev = res->Display->ResourceLists[type];
+ if (prev != res) {
+ while (prev) {
+ if (prev->Next == res)
+ break;
+ prev = prev->Next;
+ }
+ assert(prev);
+ prev->Next = res->Next;
+ }
+ else {
+ res->Display->ResourceLists[type] = res->Next;
+ }
+
+ res->Next = NULL;
+ /* do not reset res->Display */
+ res->IsLinked = EGL_FALSE;
+}
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index a69813196f8..4aea10c3eb3 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -3,8 +3,29 @@
#include "egltypedefs.h"
#include "egldefines.h"
-#include "eglcontext.h"
-#include "eglsurface.h"
+
+
+enum _egl_resource_type {
+ _EGL_RESOURCE_CONTEXT,
+ _EGL_RESOURCE_SURFACE,
+ _EGL_RESOURCE_IMAGE,
+
+ _EGL_NUM_RESOURCES
+};
+
+
+/**
+ * A resource of a display.
+ */
+struct _egl_resource
+{
+ /* which display the resource belongs to */
+ _EGLDisplay *Display;
+ EGLBoolean IsLinked;
+
+ /* used to link resources of the same type */
+ _EGLResource *Next;
+};
/**
@@ -14,6 +35,8 @@ struct _egl_extensions
{
EGLBoolean MESA_screen_surface;
EGLBoolean MESA_copy_context;
+ EGLBoolean KHR_image_base;
+ EGLBoolean KHR_image_pixmap;
char String[_EGL_MAX_EXTENSIONS_LEN];
};
@@ -26,6 +49,7 @@ struct _egl_display
EGLNativeDisplayType NativeDisplay;
+ EGLBoolean Initialized; /**< True if the display is initialized */
_EGLDriver *Driver;
void *DriverData; /* private to driver */
@@ -47,9 +71,8 @@ struct _egl_display
EGLint NumConfigs;
_EGLConfig **Configs; /* array [NumConfigs] of ptr to _EGLConfig */
- /* lists of linked contexts and surface */
- _EGLContext *ContextList;
- _EGLSurface *SurfaceList;
+ /* lists of resources */
+ _EGLResource *ResourceLists[_EGL_NUM_RESOURCES];
};
@@ -58,7 +81,7 @@ _eglFiniDisplay(void);
extern _EGLDisplay *
-_eglNewDisplay(NativeDisplayType displayName);
+_eglNewDisplay(EGLNativeDisplayType displayName);
extern EGLDisplay
@@ -70,7 +93,7 @@ _eglUnlinkDisplay(_EGLDisplay *dpy);
extern _EGLDisplay *
-_eglFindDisplay(NativeDisplayType nativeDisplay);
+_eglFindDisplay(EGLNativeDisplayType nativeDisplay);
PUBLIC void
@@ -81,22 +104,6 @@ PUBLIC void
_eglCleanupDisplay(_EGLDisplay *disp);
-extern EGLContext
-_eglLinkContext(_EGLContext *ctx, _EGLDisplay *dpy);
-
-
-extern void
-_eglUnlinkContext(_EGLContext *ctx);
-
-
-extern EGLSurface
-_eglLinkSurface(_EGLSurface *surf, _EGLDisplay *dpy);
-
-
-extern void
-_eglUnlinkSurface(_EGLSurface *surf);
-
-
#ifndef _EGL_SKIP_HANDLE_CHECK
@@ -104,12 +111,8 @@ extern EGLBoolean
_eglCheckDisplayHandle(EGLDisplay dpy);
-extern EGLBoolean
-_eglCheckContextHandle(EGLContext ctx, _EGLDisplay *dpy);
-
-
-extern EGLBoolean
-_eglCheckSurfaceHandle(EGLSurface surf, _EGLDisplay *dpy);
+PUBLIC EGLBoolean
+_eglCheckResource(void *res, _EGLResourceType type, _EGLDisplay *dpy);
#else /* !_EGL_SKIP_HANDLE_CHECK */
@@ -124,18 +127,9 @@ _eglCheckDisplayHandle(EGLDisplay dpy)
static INLINE EGLBoolean
-_eglCheckContextHandle(EGLContext ctx, _EGLDisplay *dpy)
-{
- _EGLContext *c = (_EGLContext *) ctx;
- return (dpy && c && c->Display == dpy);
-}
-
-
-static INLINE EGLBoolean
-_eglCheckSurfaceHandle(EGLSurface surf, _EGLDisplay *dpy)
+_eglCheckResource(void *res, _EGLResourceType type, _EGLDisplay *dpy);
{
- _EGLSurface *s = (_EGLSurface *) surf;
- return (dpy && s && s->Display == dpy);
+ return (((_EGLResource *) res)->Display == dpy);
}
@@ -176,92 +170,21 @@ _eglIsDisplayLinked(_EGLDisplay *dpy)
}
-/**
- * Lookup a handle to find the linked context.
- * Return NULL if the handle has no corresponding linked context.
- */
-static INLINE _EGLContext *
-_eglLookupContext(EGLContext context, _EGLDisplay *dpy)
-{
- _EGLContext *ctx = (_EGLContext *) context;
- if (!_eglCheckContextHandle(context, dpy))
- ctx = NULL;
- return ctx;
-}
-
-
-/**
- * Return the handle of a linked context, or EGL_NO_CONTEXT.
- */
-static INLINE EGLContext
-_eglGetContextHandle(_EGLContext *ctx)
-{
- return (EGLContext) ((ctx && ctx->Display) ? ctx : EGL_NO_CONTEXT);
-}
-
-
-/**
- * Return true if the context is linked to a display.
- */
-static INLINE EGLBoolean
-_eglIsContextLinked(_EGLContext *ctx)
-{
- return (EGLBoolean) (_eglGetContextHandle(ctx) != EGL_NO_CONTEXT);
-}
-
-
-/**
- * Lookup a handle to find the linked surface.
- * Return NULL if the handle has no corresponding linked surface.
- */
-static INLINE _EGLSurface *
-_eglLookupSurface(EGLSurface surface, _EGLDisplay *dpy)
-{
- _EGLSurface *surf = (_EGLSurface *) surface;
- if (!_eglCheckSurfaceHandle(surf, dpy))
- surf = NULL;
- return surf;
-}
+extern void
+_eglLinkResource(_EGLResource *res, _EGLResourceType type, _EGLDisplay *dpy);
-/**
- * Return the handle of a linked surface, or EGL_NO_SURFACE.
- */
-static INLINE EGLSurface
-_eglGetSurfaceHandle(_EGLSurface *surf)
-{
- return (EGLSurface) ((surf && surf->Display) ? surf : EGL_NO_SURFACE);
-}
+extern void
+_eglUnlinkResource(_EGLResource *res, _EGLResourceType type);
/**
- * Return true if the surface is linked to a display.
+ * Return true if the resource is linked.
*/
static INLINE EGLBoolean
-_eglIsSurfaceLinked(_EGLSurface *surf)
-{
- return (EGLBoolean) (_eglGetSurfaceHandle(surf) != EGL_NO_SURFACE);
-}
-
-
-/**
- * Cast an unsigned int to a pointer.
- */
-static INLINE void *
-_eglUIntToPointer(unsigned int v)
-{
- return (void *) ((uintptr_t) v);
-}
-
-
-/**
- * Cast a pointer to an unsigned int. The pointer must be one that is
- * returned by _eglUIntToPointer.
- */
-static INLINE unsigned int
-_eglPointerToUInt(const void *p)
+_eglIsResourceLinked(_EGLResource *res)
{
- return (unsigned int) ((uintptr_t) p);
+ return res->IsLinked;
}
diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c
index 0574f83f450..1dadbf783b6 100644
--- a/src/egl/main/egldriver.c
+++ b/src/egl/main/egldriver.c
@@ -19,6 +19,7 @@
#include "eglscreen.h"
#include "eglstring.h"
#include "eglsurface.h"
+#include "eglimage.h"
#if defined(_EGL_PLATFORM_POSIX)
#include <dlfcn.h>
@@ -58,10 +59,24 @@ library_suffix(void)
}
+static EGLBoolean
+make_library_path(char *buf, unsigned int size, const char *name)
+{
+ EGLBoolean need_suffix;
+ const char *suffix = ".dll";
+ int ret;
+
+ need_suffix = (strchr(name, '.') == NULL);
+ ret = snprintf(buf, size, "%s%s", name, (need_suffix) ? suffix : "");
+
+ return ((unsigned int) ret < size);
+}
+
+
#elif defined(_EGL_PLATFORM_POSIX)
-static const char DefaultDriverName[] = "egl_softpipe";
+static const char DefaultDriverName[] = "egl_glx";
typedef void * lib_handle;
@@ -85,6 +100,24 @@ library_suffix(void)
}
+static EGLBoolean
+make_library_path(char *buf, unsigned int size, const char *name)
+{
+ EGLBoolean need_dir, need_suffix;
+ const char *suffix = ".so";
+ int ret;
+
+ need_dir = (strchr(name, '/') == NULL);
+ need_suffix = (strchr(name, '.') == NULL);
+
+ ret = snprintf(buf, size, "%s%s%s",
+ (need_dir) ? _EGL_DRIVER_SEARCH_DIR"/" : "", name,
+ (need_suffix) ? suffix : "");
+
+ return ((unsigned int) ret < size);
+}
+
+
#else /* _EGL_PLATFORM_NO_OS */
static const char DefaultDriverName[] = "builtin";
@@ -110,6 +143,14 @@ library_suffix(void)
}
+static EGLBoolean
+make_library_path(char *buf, unsigned int size, const char *name)
+{
+ int ret = snprintf(buf, size, name);
+ return ((unsigned int) ret < size);
+}
+
+
#endif
@@ -228,7 +269,7 @@ _eglLoadDriver(const char *path, const char *args)
*
* The matching is done by finding the driver with the highest score.
*/
-static _EGLDriver *
+_EGLDriver *
_eglMatchDriver(_EGLDisplay *dpy)
{
_EGLDriver *best_drv = NULL;
@@ -258,27 +299,6 @@ _eglMatchDriver(_EGLDisplay *dpy)
/**
- * Open a preloaded driver.
- */
-_EGLDriver *
-_eglOpenDriver(_EGLDisplay *dpy)
-{
- _EGLDriver *drv = _eglMatchDriver(dpy);
- return drv;
-}
-
-
-/**
- * Close a preloaded driver.
- */
-EGLBoolean
-_eglCloseDriver(_EGLDriver *drv, _EGLDisplay *dpy)
-{
- return EGL_TRUE;
-}
-
-
-/**
* Preload a user driver.
*
* A user driver can be specified by EGL_DRIVER.
@@ -288,36 +308,21 @@ _eglPreloadUserDriver(void)
{
#if defined(_EGL_PLATFORM_POSIX) || defined(_EGL_PLATFORM_WINDOWS)
_EGLDriver *drv;
- char *env, *path;
- const char *suffix, *p;
+ char path[1024];
+ char *env;
env = getenv("EGL_DRIVER");
if (!env)
return EGL_FALSE;
- path = env;
- suffix = library_suffix();
-
- /* append suffix if there isn't */
- p = strrchr(path, '.');
- if (!p && suffix) {
- size_t len = strlen(path);
- char *tmp = malloc(len + strlen(suffix) + 2);
- if (tmp) {
- memcpy(tmp, path, len);
- tmp[len++] = '.';
- tmp[len] = '\0';
- strcat(tmp + len, suffix);
-
- path = tmp;
- }
- }
+ if (!make_library_path(path, sizeof(path), env))
+ return EGL_FALSE;
drv = _eglLoadDriver(path, NULL);
- if (path != env)
- free(path);
- if (!drv)
+ if (!drv) {
+ _eglLog(_EGL_WARNING, "EGL_DRIVER is set to an invalid driver");
return EGL_FALSE;
+ }
_eglGlobal.Drivers[_eglGlobal.NumDrivers++] = drv;
@@ -399,12 +404,9 @@ _eglPreloadDefaultDriver(void)
{
_EGLDriver *drv;
char path[1024];
- const char *suffix = library_suffix();
- if (suffix)
- snprintf(path, sizeof(path), "%s.%s", DefaultDriverName, suffix);
- else
- snprintf(path, sizeof(path), DefaultDriverName);
+ if (!make_library_path(path, sizeof(path), DefaultDriverName))
+ return EGL_FALSE;
drv = _eglLoadDriver(path, NULL);
if (!drv)
@@ -523,58 +525,11 @@ _eglInitDriverFallbacks(_EGLDriver *drv)
#ifdef EGL_VERSION_1_2
drv->API.CreatePbufferFromClientBuffer = _eglCreatePbufferFromClientBuffer;
#endif /* EGL_VERSION_1_2 */
-}
-
-
-
-/**
- * Try to determine which EGL APIs (OpenGL, OpenGL ES, OpenVG, etc)
- * are supported on the system by looking for standard library names.
- */
-EGLint
-_eglFindAPIs(void)
-{
- EGLint mask = 0x0;
- lib_handle lib;
-#if defined(_EGL_PLATFORM_WINDOWS)
- /* XXX not sure about these names */
- const char *es1_libname = "libGLESv1_CM.dll";
- const char *es2_libname = "libGLESv2.dll";
- const char *gl_libname = "OpenGL32.dll";
- const char *vg_libname = "libOpenVG.dll";
-#elif defined(_EGL_PLATFORM_POSIX)
- const char *es1_libname = "libGLESv1_CM.so";
- const char *es2_libname = "libGLESv2.so";
- const char *gl_libname = "libGL.so";
- const char *vg_libname = "libOpenVG.so";
-#else /* _EGL_PLATFORM_NO_OS */
- const char *es1_libname = NULL;
- const char *es2_libname = NULL;
- const char *gl_libname = NULL;
- const char *vg_libname = NULL;
-#endif
-
- if ((lib = open_library(es1_libname))) {
- close_library(lib);
- mask |= EGL_OPENGL_ES_BIT;
- }
-
- if ((lib = open_library(es2_libname))) {
- close_library(lib);
- mask |= EGL_OPENGL_ES2_BIT;
- }
-
- if ((lib = open_library(gl_libname))) {
- close_library(lib);
- mask |= EGL_OPENGL_BIT;
- }
-
- if ((lib = open_library(vg_libname))) {
- close_library(lib);
- mask |= EGL_OPENVG_BIT;
- }
- return mask;
+#ifdef EGL_KHR_image_base
+ drv->API.CreateImageKHR = _eglCreateImageKHR;
+ drv->API.DestroyImageKHR = _eglDestroyImageKHR;
+#endif /* EGL_KHR_image_base */
}
diff --git a/src/egl/main/egldriver.h b/src/egl/main/egldriver.h
index d9d61297c18..6ebb60a8f10 100644
--- a/src/egl/main/egldriver.h
+++ b/src/egl/main/egldriver.h
@@ -43,11 +43,7 @@ _eglMain(const char *args);
extern _EGLDriver *
-_eglOpenDriver(_EGLDisplay *dpy);
-
-
-extern EGLBoolean
-_eglCloseDriver(_EGLDriver *drv, _EGLDisplay *dpy);
+_eglMatchDriver(_EGLDisplay *dpy);
extern EGLBoolean
@@ -62,10 +58,6 @@ PUBLIC void
_eglInitDriverFallbacks(_EGLDriver *drv);
-PUBLIC EGLint
-_eglFindAPIs(void);
-
-
PUBLIC void
_eglSetProbeCache(EGLint key, const void *val);
diff --git a/src/egl/main/eglimage.c b/src/egl/main/eglimage.c
new file mode 100644
index 00000000000..5044112fa8c
--- /dev/null
+++ b/src/egl/main/eglimage.c
@@ -0,0 +1,51 @@
+#include <assert.h>
+
+#include "eglimage.h"
+#include "egldisplay.h"
+
+
+#ifdef EGL_KHR_image_base
+
+
+EGLBoolean
+_eglInitImage(_EGLDriver *drv, _EGLImage *img, const EGLint *attrib_list)
+{
+ EGLint i;
+
+ img->Preserved = EGL_FALSE;
+
+ for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
+ switch (attrib_list[i]) {
+ case EGL_IMAGE_PRESERVED_KHR:
+ i++;
+ img->Preserved = attrib_list[i];
+ break;
+ default:
+ /* not an error */
+ break;
+ }
+ }
+
+ return EGL_TRUE;
+}
+
+
+_EGLImage *
+_eglCreateImageKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx,
+ EGLenum target, EGLClientBuffer buffer,
+ const EGLint *attr_list)
+{
+ /* driver should override this function */
+ return NULL;
+}
+
+
+EGLBoolean
+_eglDestroyImageKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLImage *image)
+{
+ /* driver should override this function */
+ return EGL_FALSE;
+}
+
+
+#endif /* EGL_KHR_image_base */
diff --git a/src/egl/main/eglimage.h b/src/egl/main/eglimage.h
new file mode 100644
index 00000000000..43107c23e9f
--- /dev/null
+++ b/src/egl/main/eglimage.h
@@ -0,0 +1,94 @@
+#ifndef EGLIMAGE_INCLUDED
+#define EGLIMAGE_INCLUDED
+
+
+#include "egltypedefs.h"
+#include "egldisplay.h"
+
+
+/**
+ * "Base" class for device driver images.
+ */
+struct _egl_image
+{
+ /* An image is a display resource */
+ _EGLResource Resource;
+
+ EGLBoolean Preserved;
+};
+
+
+PUBLIC EGLBoolean
+_eglInitImage(_EGLDriver *drv, _EGLImage *img, const EGLint *attrib_list);
+
+
+extern _EGLImage *
+_eglCreateImageKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx,
+ EGLenum target, EGLClientBuffer buffer, const EGLint *attr_list);
+
+
+extern EGLBoolean
+_eglDestroyImageKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLImage *image);
+
+
+/**
+ * Link an image to a display and return the handle of the link.
+ * The handle can be passed to client directly.
+ */
+static INLINE EGLImageKHR
+_eglLinkImage(_EGLImage *img, _EGLDisplay *dpy)
+{
+ _eglLinkResource(&img->Resource, _EGL_RESOURCE_IMAGE, dpy);
+ return (EGLImageKHR) img;
+}
+
+
+/**
+ * Unlink a linked image from its display.
+ * Accessing an unlinked image should generate EGL_BAD_PARAMETER error.
+ */
+static INLINE void
+_eglUnlinkImage(_EGLImage *img)
+{
+ _eglUnlinkResource(&img->Resource, _EGL_RESOURCE_IMAGE);
+}
+
+
+/**
+ * Lookup a handle to find the linked image.
+ * Return NULL if the handle has no corresponding linked image.
+ */
+static INLINE _EGLImage *
+_eglLookupImage(EGLImageKHR image, _EGLDisplay *dpy)
+{
+ _EGLImage *img = (_EGLImage *) image;
+ if (!dpy || !_eglCheckResource((void *) img, _EGL_RESOURCE_IMAGE, dpy))
+ img = NULL;
+ return img;
+}
+
+
+/**
+ * Return the handle of a linked image, or EGL_NO_IMAGE_KHR.
+ */
+static INLINE EGLImageKHR
+_eglGetImageHandle(_EGLImage *img)
+{
+ _EGLResource *res = (_EGLResource *) img;
+ return (res && _eglIsResourceLinked(res)) ?
+ (EGLImageKHR) img : EGL_NO_IMAGE_KHR;
+}
+
+
+/**
+ * Return true if the image is linked to a display.
+ */
+static INLINE EGLBoolean
+_eglIsImageLinked(_EGLImage *img)
+{
+ _EGLResource *res = (_EGLResource *) img;
+ return (res && _eglIsResourceLinked(res));
+}
+
+
+#endif /* EGLIMAGE_INCLUDED */
diff --git a/src/egl/main/eglmisc.c b/src/egl/main/eglmisc.c
index e66913320b2..5726f5bca8e 100644
--- a/src/egl/main/eglmisc.c
+++ b/src/egl/main/eglmisc.c
@@ -54,6 +54,14 @@ _eglUpdateExtensionsString(_EGLDisplay *dpy)
strcat(exts, "EGL_MESA_screen_surface ");
if (dpy->Extensions.MESA_copy_context)
strcat(exts, "EGL_MESA_copy_context ");
+
+ if (dpy->Extensions.KHR_image_base)
+ strcat(exts, "EGL_KHR_image_base ");
+ if (dpy->Extensions.KHR_image_pixmap)
+ strcat(exts, "EGL_KHR_image_pixmap ");
+ if (dpy->Extensions.KHR_image_base && dpy->Extensions.KHR_image_pixmap)
+ strcat(exts, "EGL_KHR_image ");
+
assert(strlen(exts) < _EGL_MAX_EXTENSIONS_LEN);
}
diff --git a/src/egl/main/eglsurface.c b/src/egl/main/eglsurface.c
index 940a1b760cf..89eb93d808f 100644
--- a/src/egl/main/eglsurface.c
+++ b/src/egl/main/eglsurface.c
@@ -237,7 +237,7 @@ _eglSwapBuffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf)
EGLBoolean
_eglCopyBuffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
- NativePixmapType target)
+ EGLNativePixmapType target)
{
/* copy surface to native pixmap */
/* All implementation burdon for this is in the device driver */
@@ -319,7 +319,7 @@ _eglQuerySurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface,
*/
_EGLSurface *
_eglCreateWindowSurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
- NativeWindowType window, const EGLint *attrib_list)
+ EGLNativeWindowType window, const EGLint *attrib_list)
{
#if 0 /* THIS IS JUST EXAMPLE CODE */
_EGLSurface *surf;
@@ -344,7 +344,7 @@ _eglCreateWindowSurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
*/
_EGLSurface *
_eglCreatePixmapSurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
- NativePixmapType pixmap, const EGLint *attrib_list)
+ EGLNativePixmapType pixmap, const EGLint *attrib_list)
{
#if 0 /* THIS IS JUST EXAMPLE CODE */
_EGLSurface *surf;
diff --git a/src/egl/main/eglsurface.h b/src/egl/main/eglsurface.h
index dacdf7e63ce..4062b990fa4 100644
--- a/src/egl/main/eglsurface.h
+++ b/src/egl/main/eglsurface.h
@@ -3,6 +3,7 @@
#include "egltypedefs.h"
+#include "egldisplay.h"
/**
@@ -10,9 +11,8 @@
*/
struct _egl_surface
{
- /* Managed by EGLDisplay for linking */
- _EGLDisplay *Display;
- _EGLSurface *Next;
+ /* A surface is a display resource */
+ _EGLResource Resource;
/* The bound status of the surface */
_EGLContext *Binding;
@@ -50,7 +50,7 @@ _eglSwapBuffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf);
extern EGLBoolean
-_eglCopyBuffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, NativePixmapType target);
+_eglCopyBuffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLNativePixmapType target);
extern EGLBoolean
@@ -58,11 +58,11 @@ _eglQuerySurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint at
extern _EGLSurface *
-_eglCreateWindowSurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, NativeWindowType window, const EGLint *attrib_list);
+_eglCreateWindowSurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, EGLNativeWindowType window, const EGLint *attrib_list);
extern _EGLSurface *
-_eglCreatePixmapSurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, NativePixmapType pixmap, const EGLint *attrib_list);
+_eglCreatePixmapSurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, EGLNativePixmapType pixmap, const EGLint *attrib_list);
extern _EGLSurface *
@@ -111,4 +111,64 @@ _eglIsSurfaceBound(_EGLSurface *surf)
}
+/**
+ * Link a surface to a display and return the handle of the link.
+ * The handle can be passed to client directly.
+ */
+static INLINE EGLSurface
+_eglLinkSurface(_EGLSurface *surf, _EGLDisplay *dpy)
+{
+ _eglLinkResource(&surf->Resource, _EGL_RESOURCE_SURFACE, dpy);
+ return (EGLSurface) surf;
+}
+
+
+/**
+ * Unlink a linked surface from its display.
+ * Accessing an unlinked surface should generate EGL_BAD_SURFACE error.
+ */
+static INLINE void
+_eglUnlinkSurface(_EGLSurface *surf)
+{
+ _eglUnlinkResource(&surf->Resource, _EGL_RESOURCE_SURFACE);
+}
+
+
+/**
+ * Lookup a handle to find the linked surface.
+ * Return NULL if the handle has no corresponding linked surface.
+ */
+static INLINE _EGLSurface *
+_eglLookupSurface(EGLSurface surface, _EGLDisplay *dpy)
+{
+ _EGLSurface *surf = (_EGLSurface *) surface;
+ if (!dpy || !_eglCheckResource((void *) surf, _EGL_RESOURCE_SURFACE, dpy))
+ surf = NULL;
+ return surf;
+}
+
+
+/**
+ * Return the handle of a linked surface, or EGL_NO_SURFACE.
+ */
+static INLINE EGLSurface
+_eglGetSurfaceHandle(_EGLSurface *surf)
+{
+ _EGLResource *res = (_EGLResource *) surf;
+ return (res && _eglIsResourceLinked(res)) ?
+ (EGLSurface) surf : EGL_NO_SURFACE;
+}
+
+
+/**
+ * Return true if the surface is linked to a display.
+ */
+static INLINE EGLBoolean
+_eglIsSurfaceLinked(_EGLSurface *surf)
+{
+ _EGLResource *res = (_EGLResource *) surf;
+ return (res && _eglIsResourceLinked(res));
+}
+
+
#endif /* EGLSURFACE_INCLUDED */
diff --git a/src/egl/main/egltypedefs.h b/src/egl/main/egltypedefs.h
index 4461440b9b7..e6b19b35d01 100644
--- a/src/egl/main/egltypedefs.h
+++ b/src/egl/main/egltypedefs.h
@@ -8,6 +8,8 @@
#include "eglcompiler.h"
+typedef enum _egl_resource_type _EGLResourceType;
+
typedef struct _egl_api _EGLAPI;
typedef struct _egl_config _EGLConfig;
@@ -20,8 +22,12 @@ typedef struct _egl_driver _EGLDriver;
typedef struct _egl_extensions _EGLExtensions;
+typedef struct _egl_image _EGLImage;
+
typedef struct _egl_mode _EGLMode;
+typedef struct _egl_resource _EGLResource;
+
typedef struct _egl_screen _EGLScreen;
typedef struct _egl_surface _EGLSurface;
diff --git a/src/gallium/SConscript b/src/gallium/SConscript
index eea32b1314b..d56c5c84617 100644
--- a/src/gallium/SConscript
+++ b/src/gallium/SConscript
@@ -8,9 +8,10 @@ for driver in env['drivers']:
SConscript(os.path.join('drivers', driver, 'SConscript'))
SConscript('state_trackers/python/SConscript')
-SConscript('state_trackers/glx/xlib/SConscript')
-SConscript('state_trackers/dri/SConscript')
-SConscript('state_trackers/xorg/SConscript')
+if platform != 'embedded':
+ SConscript('state_trackers/glx/xlib/SConscript')
+ SConscript('state_trackers/dri/SConscript')
+ SConscript('state_trackers/xorg/SConscript')
if platform == 'windows':
SConscript('state_trackers/wgl/SConscript')
diff --git a/src/gallium/auxiliary/Makefile b/src/gallium/auxiliary/Makefile
index 8f937e3b4e9..da1fb6b299f 100644
--- a/src/gallium/auxiliary/Makefile
+++ b/src/gallium/auxiliary/Makefile
@@ -48,12 +48,10 @@ C_SOURCES = \
draw/draw_vs_sse.c \
indices/u_indices_gen.c \
indices/u_unfilled_gen.c \
- pipebuffer/pb_buffer_fenced.c \
pipebuffer/pb_buffer_malloc.c \
pipebuffer/pb_bufmgr_alt.c \
pipebuffer/pb_bufmgr_cache.c \
pipebuffer/pb_bufmgr_debug.c \
- pipebuffer/pb_bufmgr_fenced.c \
pipebuffer/pb_bufmgr_mm.c \
pipebuffer/pb_bufmgr_ondemand.c \
pipebuffer/pb_bufmgr_pool.c \
@@ -92,6 +90,7 @@ C_SOURCES = \
util/u_debug_dump.c \
util/u_debug_symbol.c \
util/u_debug_stack.c \
+ util/u_bitmask.c \
util/u_blit.c \
util/u_blitter.c \
util/u_cache.c \
diff --git a/src/gallium/auxiliary/SConscript b/src/gallium/auxiliary/SConscript
index f957090b5fb..3aa782f81e6 100644
--- a/src/gallium/auxiliary/SConscript
+++ b/src/gallium/auxiliary/SConscript
@@ -87,7 +87,6 @@ source = [
'pipebuffer/pb_bufmgr_alt.c',
'pipebuffer/pb_bufmgr_cache.c',
'pipebuffer/pb_bufmgr_debug.c',
- 'pipebuffer/pb_bufmgr_fenced.c',
'pipebuffer/pb_bufmgr_mm.c',
'pipebuffer/pb_bufmgr_ondemand.c',
'pipebuffer/pb_bufmgr_pool.c',
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index e90dfc5aec4..d3084fd4283 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -34,11 +34,8 @@
#include "util/u_memory.h"
#include "util/u_math.h"
#include "draw_context.h"
-#include "draw_vbuf.h"
#include "draw_vs.h"
#include "draw_gs.h"
-#include "draw_pt.h"
-#include "draw_pipe.h"
struct draw_context *draw_create( void )
@@ -237,17 +234,20 @@ draw_set_mapped_vertex_buffer(struct draw_context *draw,
void
draw_set_mapped_constant_buffer(struct draw_context *draw,
unsigned shader_type,
+ unsigned slot,
const void *buffer,
unsigned size )
{
debug_assert(shader_type == PIPE_SHADER_VERTEX ||
shader_type == PIPE_SHADER_GEOMETRY);
+ debug_assert(slot < PIPE_MAX_CONSTANT_BUFFERS);
+
if (shader_type == PIPE_SHADER_VERTEX) {
- draw->pt.user.vs_constants = buffer;
- draw_vs_set_constants( draw, (const float (*)[4])buffer, size );
+ draw->pt.user.vs_constants[slot] = buffer;
+ draw_vs_set_constants(draw, slot, buffer, size);
} else if (shader_type == PIPE_SHADER_GEOMETRY) {
- draw->pt.user.gs_constants = buffer;
- draw_gs_set_constants( draw, (const float (*)[4])buffer, size );
+ draw->pt.user.gs_constants[slot] = buffer;
+ draw_gs_set_constants(draw, slot, buffer, size);
}
}
diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h
index 8a64c06efcd..acd81b9712d 100644
--- a/src/gallium/auxiliary/draw/draw_context.h
+++ b/src/gallium/auxiliary/draw/draw_context.h
@@ -151,10 +151,12 @@ void draw_set_mapped_element_buffer( struct draw_context *draw,
void draw_set_mapped_vertex_buffer(struct draw_context *draw,
unsigned attr, const void *buffer);
-void draw_set_mapped_constant_buffer(struct draw_context *draw,
- unsigned shader_type,
- const void *buffer,
- unsigned size );
+void
+draw_set_mapped_constant_buffer(struct draw_context *draw,
+ unsigned shader_type,
+ unsigned slot,
+ const void *buffer,
+ unsigned size);
/***********************************************************************
diff --git a/src/gallium/auxiliary/draw/draw_gs.c b/src/gallium/auxiliary/draw/draw_gs.c
index daf8d071f12..7069aa6b181 100644
--- a/src/gallium/auxiliary/draw/draw_gs.c
+++ b/src/gallium/auxiliary/draw/draw_gs.c
@@ -69,9 +69,11 @@ void draw_gs_destroy( struct draw_context *draw )
tgsi_exec_machine_destroy(draw->gs.machine);
}
-void draw_gs_set_constants( struct draw_context *draw,
- const float (*constants)[4],
- unsigned size )
+void
+draw_gs_set_constants(struct draw_context *draw,
+ unsigned slot,
+ const void *constants,
+ unsigned size)
{
}
@@ -291,7 +293,7 @@ draw_geometry_fetch_outputs(struct draw_geometry_shader *shader,
void draw_geometry_shader_run(struct draw_geometry_shader *shader,
const float (*input)[4],
float (*output)[4],
- const float (*constants)[4],
+ const void *constants[PIPE_MAX_CONSTANT_BUFFERS],
unsigned count,
unsigned input_stride,
unsigned vertex_size)
@@ -302,7 +304,9 @@ void draw_geometry_shader_run(struct draw_geometry_shader *shader,
unsigned num_primitives = count/num_vertices;
unsigned inputs_from_vs = 0;
- machine->Consts = constants;
+ for (i = 0; i < PIPE_MAX_CONSTANT_BUFFERS; i++) {
+ machine->Consts[i] = constants[i];
+ }
for (i = 0; i < shader->info.num_inputs; ++i) {
if (shader->info.input_semantic_name[i] != TGSI_SEMANTIC_PRIMID)
diff --git a/src/gallium/auxiliary/draw/draw_gs.h b/src/gallium/auxiliary/draw/draw_gs.h
index d6a97d9c4ef..d8eb2103433 100644
--- a/src/gallium/auxiliary/draw/draw_gs.h
+++ b/src/gallium/auxiliary/draw/draw_gs.h
@@ -62,7 +62,7 @@ struct draw_geometry_shader {
void draw_geometry_shader_run(struct draw_geometry_shader *shader,
const float (*input)[4],
float (*output)[4],
- const float (*constants)[4],
+ const void *constants[PIPE_MAX_CONSTANT_BUFFERS],
unsigned count,
unsigned input_stride,
unsigned output_stride);
diff --git a/src/gallium/auxiliary/draw/draw_pipe.c b/src/gallium/auxiliary/draw/draw_pipe.c
index 1c6d657297c..11d6485dcf0 100644
--- a/src/gallium/auxiliary/draw/draw_pipe.c
+++ b/src/gallium/auxiliary/draw/draw_pipe.c
@@ -106,10 +106,9 @@ void draw_pipeline_destroy( struct draw_context *draw )
-
-
-
-
+/**
+ * Build primitive to render a point with vertex at v0.
+ */
static void do_point( struct draw_context *draw,
const char *v0 )
{
@@ -123,6 +122,10 @@ static void do_point( struct draw_context *draw,
}
+/**
+ * Build primitive to render a line with vertices at v0, v1.
+ * \param flags bitmask of DRAW_PIPE_EDGE_x, DRAW_PIPE_RESET_STIPPLE
+ */
static void do_line( struct draw_context *draw,
ushort flags,
const char *v0,
@@ -139,6 +142,10 @@ static void do_line( struct draw_context *draw,
}
+/**
+ * Build primitive to render a triangle with vertices at v0, v1, v2.
+ * \param flags bitmask of DRAW_PIPE_EDGE_x, DRAW_PIPE_RESET_STIPPLE
+ */
static void do_triangle( struct draw_context *draw,
ushort flags,
char *v0,
@@ -157,7 +164,10 @@ static void do_triangle( struct draw_context *draw,
}
-
+/*
+ * Set up macros for draw_pt_decompose.h template code.
+ * This code uses vertex indexes / elements.
+ */
#define QUAD(i0,i1,i2,i3) \
do_triangle( draw, \
( DRAW_PIPE_RESET_STIPPLE | \
@@ -175,16 +185,16 @@ static void do_triangle( struct draw_context *draw,
#define TRIANGLE(flags,i0,i1,i2) \
do_triangle( draw, \
- elts[i0], /* flags */ \
+ elts[i0], /* flags */ \
verts + stride * (elts[i0] & ~DRAW_PIPE_FLAG_MASK), \
- verts + stride * elts[i1], \
- verts + stride * elts[i2])
+ verts + stride * (elts[i1] & ~DRAW_PIPE_FLAG_MASK), \
+ verts + stride * (elts[i2] & ~DRAW_PIPE_FLAG_MASK) );
#define LINE(flags,i0,i1) \
do_line( draw, \
- elts[i0], \
+ elts[i0], \
verts + stride * (elts[i0] & ~DRAW_PIPE_FLAG_MASK), \
- verts + stride * elts[i1])
+ verts + stride * (elts[i1] & ~DRAW_PIPE_FLAG_MASK) );
#define POINT(i0) \
do_point( draw, \
@@ -213,7 +223,9 @@ static void do_triangle( struct draw_context *draw,
-/* Code to run the pipeline on a fairly arbitary collection of vertices.
+/**
+ * Code to run the pipeline on a fairly arbitary collection of vertices.
+ * For drawing indexed primitives.
*
* Vertex headers must be pre-initialized with the
* UNDEFINED_VERTEX_ID, this code will cause that id to become
@@ -243,6 +255,12 @@ void draw_pipeline_run( struct draw_context *draw,
draw->pipeline.vertex_count = 0;
}
+
+
+/*
+ * Set up macros for draw_pt_decompose.h template code.
+ * This code is for non-indexed rendering (no elts).
+ */
#define QUAD(i0,i1,i2,i3) \
do_triangle( draw, \
( DRAW_PIPE_RESET_STIPPLE | \
@@ -293,6 +311,10 @@ void draw_pipeline_run( struct draw_context *draw,
#include "draw_pt_decompose.h"
+
+/*
+ * For drawing non-indexed primitives.
+ */
void draw_pipeline_run_linear( struct draw_context *draw,
unsigned prim,
struct vertex_header *vertices,
diff --git a/src/gallium/auxiliary/draw/draw_pipe_cull.c b/src/gallium/auxiliary/draw/draw_pipe_cull.c
index 11b39db5990..dc66c65a56c 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_cull.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_cull.c
@@ -50,8 +50,6 @@ static INLINE struct cull_stage *cull_stage( struct draw_stage *stage )
}
-
-
static void cull_tri( struct draw_stage *stage,
struct prim_header *header )
{
@@ -62,7 +60,7 @@ static void cull_tri( struct draw_stage *stage,
const float *v1 = header->v[1]->data[pos];
const float *v2 = header->v[2]->data[pos];
- /* edge vectors e = v0 - v2, f = v1 - v2 */
+ /* edge vectors: e = v0 - v2, f = v1 - v2 */
const float ex = v0[0] - v2[0];
const float ey = v0[1] - v2[1];
const float fx = v1[0] - v2[0];
@@ -72,7 +70,7 @@ static void cull_tri( struct draw_stage *stage,
header->det = ex * fy - ey * fx;
if (header->det != 0) {
- /* if (det < 0 then Z points toward camera and triangle is
+ /* if det < 0 then Z points toward the camera and the triangle is
* counter-clockwise winding.
*/
unsigned winding = (header->det < 0) ? PIPE_WINDING_CCW : PIPE_WINDING_CW;
@@ -84,6 +82,7 @@ static void cull_tri( struct draw_stage *stage,
}
}
+
static void cull_first_tri( struct draw_stage *stage,
struct prim_header *header )
{
@@ -96,13 +95,13 @@ static void cull_first_tri( struct draw_stage *stage,
}
-
static void cull_flush( struct draw_stage *stage, unsigned flags )
{
stage->tri = cull_first_tri;
stage->next->flush( stage->next, flags );
}
+
static void cull_reset_stipple_counter( struct draw_stage *stage )
{
stage->next->reset_stipple_counter( stage->next );
@@ -140,7 +139,7 @@ struct draw_stage *draw_cull_stage( struct draw_context *draw )
return &cull->stage;
- fail:
+fail:
if (cull)
cull->stage.destroy( &cull->stage );
diff --git a/src/gallium/auxiliary/draw/draw_pipe_validate.c b/src/gallium/auxiliary/draw/draw_pipe_validate.c
index bea90e50d30..a69e2633bec 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_validate.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_validate.c
@@ -151,8 +151,8 @@ static struct draw_stage *validate_pipeline( struct draw_stage *stage )
{
struct draw_context *draw = stage->draw;
struct draw_stage *next = draw->pipeline.rasterize;
- int need_det = 0;
- int precalc_flat = 0;
+ boolean need_det = FALSE;
+ boolean precalc_flat = FALSE;
boolean wide_lines, wide_points;
/* Set the validate's next stage to the rasterize stage, so that it
@@ -194,7 +194,7 @@ static struct draw_stage *validate_pipeline( struct draw_stage *stage )
if (wide_lines) {
draw->pipeline.wide_line->next = next;
next = draw->pipeline.wide_line;
- precalc_flat = 1;
+ precalc_flat = TRUE;
}
if (wide_points || draw->rasterizer->point_sprite) {
@@ -205,7 +205,7 @@ static struct draw_stage *validate_pipeline( struct draw_stage *stage )
if (draw->rasterizer->line_stipple_enable && draw->pipeline.line_stipple) {
draw->pipeline.stipple->next = next;
next = draw->pipeline.stipple;
- precalc_flat = 1; /* only needed for lines really */
+ precalc_flat = TRUE; /* only needed for lines really */
}
if (draw->rasterizer->poly_stipple_enable
@@ -218,8 +218,8 @@ static struct draw_stage *validate_pipeline( struct draw_stage *stage )
draw->rasterizer->fill_ccw != PIPE_POLYGON_MODE_FILL) {
draw->pipeline.unfilled->next = next;
next = draw->pipeline.unfilled;
- precalc_flat = 1; /* only needed for triangles really */
- need_det = 1;
+ precalc_flat = TRUE; /* only needed for triangles really */
+ need_det = TRUE;
}
if (draw->rasterizer->flatshade && precalc_flat) {
@@ -231,13 +231,13 @@ static struct draw_stage *validate_pipeline( struct draw_stage *stage )
draw->rasterizer->offset_ccw) {
draw->pipeline.offset->next = next;
next = draw->pipeline.offset;
- need_det = 1;
+ need_det = TRUE;
}
if (draw->rasterizer->light_twoside) {
draw->pipeline.twoside->next = next;
next = draw->pipeline.twoside;
- need_det = 1;
+ need_det = TRUE;
}
/* Always run the cull stage as we calculate determinant there
diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h
index ef49e575366..6a7190e9750 100644
--- a/src/gallium/auxiliary/draw/draw_private.h
+++ b/src/gallium/auxiliary/draw/draw_private.h
@@ -153,8 +153,8 @@ struct draw_context
const void *vbuffer[PIPE_MAX_ATTRIBS];
/** constant buffer (for vertex/geometry shader) */
- const void *vs_constants;
- const void *gs_constants;
+ const void *vs_constants[PIPE_MAX_CONSTANT_BUFFERS];
+ const void *gs_constants[PIPE_MAX_CONSTANT_BUFFERS];
} user;
boolean test_fse; /* enable FSE even though its not correct (eg for softpipe) */
@@ -202,10 +202,10 @@ struct draw_context
struct aos_machine *aos_machine;
- const float (*aligned_constants)[4];
+ const void *aligned_constants[PIPE_MAX_CONSTANT_BUFFERS];
- const float (*aligned_constant_storage)[4];
- unsigned const_storage_size;
+ const void *aligned_constant_storage[PIPE_MAX_CONSTANT_BUFFERS];
+ unsigned const_storage_size[PIPE_MAX_CONSTANT_BUFFERS];
struct translate *fetch;
@@ -256,9 +256,11 @@ void draw_vs_destroy( struct draw_context *draw );
void draw_vs_set_viewport( struct draw_context *,
const struct pipe_viewport_state * );
-void draw_vs_set_constants( struct draw_context *,
- const float (*constants)[4],
- unsigned size );
+void
+draw_vs_set_constants(struct draw_context *,
+ unsigned slot,
+ const void *constants,
+ unsigned size);
@@ -266,9 +268,13 @@ void draw_vs_set_constants( struct draw_context *,
* Geometry shading code:
*/
boolean draw_gs_init( struct draw_context *draw );
-void draw_gs_set_constants( struct draw_context *,
- const float (*constants)[4],
- unsigned size );
+
+void
+draw_gs_set_constants(struct draw_context *,
+ unsigned slot,
+ const void *constants,
+ unsigned size);
+
void draw_gs_destroy( struct draw_context *draw );
/*******************************************************************************
diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c
index a5ddec52863..f5ed32d0b05 100644
--- a/src/gallium/auxiliary/draw/draw_pt.c
+++ b/src/gallium/auxiliary/draw/draw_pt.c
@@ -33,7 +33,6 @@
#include "draw/draw_context.h"
#include "draw/draw_private.h"
#include "draw/draw_pt.h"
-#include "draw/draw_vs.h"
#include "tgsi/tgsi_dump.h"
#include "util/u_math.h"
#include "util/u_prim.h"
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch.c b/src/gallium/auxiliary/draw/draw_pt_fetch.c
index 55e7a7b81ad..252be5053e4 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch.c
@@ -30,7 +30,6 @@
#include "draw/draw_context.h"
#include "draw/draw_private.h"
#include "draw/draw_vbuf.h"
-#include "draw/draw_vertex.h"
#include "draw/draw_pt.h"
#include "translate/translate.h"
#include "translate/translate_cache.h"
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 734c05f0688..c5dfbcfa3cb 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
@@ -40,7 +40,6 @@
#include "draw/draw_pt.h"
#include "draw/draw_vs.h"
-#include "translate/translate.h"
struct fetch_shade_emit;
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
index 23da556f797..56b69354b21 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
@@ -33,7 +33,6 @@
#include "draw/draw_pt.h"
#include "draw/draw_vs.h"
#include "draw/draw_gs.h"
-#include "translate/translate.h"
struct fetch_pipeline_middle_end {
@@ -164,7 +163,7 @@ static void fetch_pipeline_run( struct draw_pt_middle_end *middle,
vshader->run_linear(vshader,
(const float (*)[4])pipeline_verts->data,
( float (*)[4])pipeline_verts->data,
- (const float (*)[4])draw->pt.user.vs_constants,
+ draw->pt.user.vs_constants,
fetch_count,
fpme->vertex_size,
fpme->vertex_size);
@@ -172,7 +171,7 @@ static void fetch_pipeline_run( struct draw_pt_middle_end *middle,
draw_geometry_shader_run(gshader,
(const float (*)[4])pipeline_verts->data,
( float (*)[4])pipeline_verts->data,
- (const float (*)[4])draw->pt.user.gs_constants,
+ draw->pt.user.gs_constants,
fetch_count,
fpme->vertex_size,
fpme->vertex_size);
@@ -249,7 +248,7 @@ static void fetch_pipeline_linear_run( struct draw_pt_middle_end *middle,
shader->run_linear(shader,
(const float (*)[4])pipeline_verts->data,
( float (*)[4])pipeline_verts->data,
- (const float (*)[4])draw->pt.user.vs_constants,
+ draw->pt.user.vs_constants,
count,
fpme->vertex_size,
fpme->vertex_size);
@@ -258,7 +257,7 @@ static void fetch_pipeline_linear_run( struct draw_pt_middle_end *middle,
draw_geometry_shader_run(geometry_shader,
(const float (*)[4])pipeline_verts->data,
( float (*)[4])pipeline_verts->data,
- (const float (*)[4])draw->pt.user.gs_constants,
+ draw->pt.user.gs_constants,
count,
fpme->vertex_size,
fpme->vertex_size);
@@ -329,7 +328,7 @@ static boolean fetch_pipeline_linear_run_elts( struct draw_pt_middle_end *middle
shader->run_linear(shader,
(const float (*)[4])pipeline_verts->data,
( float (*)[4])pipeline_verts->data,
- (const float (*)[4])draw->pt.user.vs_constants,
+ draw->pt.user.vs_constants,
count,
fpme->vertex_size,
fpme->vertex_size);
@@ -338,7 +337,7 @@ static boolean fetch_pipeline_linear_run_elts( struct draw_pt_middle_end *middle
draw_geometry_shader_run(geometry_shader,
(const float (*)[4])pipeline_verts->data,
( float (*)[4])pipeline_verts->data,
- (const float (*)[4])draw->pt.user.gs_constants,
+ draw->pt.user.gs_constants,
count,
fpme->vertex_size,
fpme->vertex_size);
diff --git a/src/gallium/auxiliary/draw/draw_pt_post_vs.c b/src/gallium/auxiliary/draw/draw_pt_post_vs.c
index 55151823a14..9728d5c2bdf 100644
--- a/src/gallium/auxiliary/draw/draw_pt_post_vs.c
+++ b/src/gallium/auxiliary/draw/draw_pt_post_vs.c
@@ -30,7 +30,6 @@
#include "draw/draw_context.h"
#include "draw/draw_private.h"
#include "draw/draw_vbuf.h"
-#include "draw/draw_vertex.h"
#include "draw/draw_pt.h"
struct pt_post_vs {
diff --git a/src/gallium/auxiliary/draw/draw_vs.c b/src/gallium/auxiliary/draw/draw_vs.c
index e03ac8c2291..6bdd612e6f4 100644
--- a/src/gallium/auxiliary/draw/draw_vs.c
+++ b/src/gallium/auxiliary/draw/draw_vs.c
@@ -48,24 +48,27 @@
-void draw_vs_set_constants( struct draw_context *draw,
- const float (*constants)[4],
- unsigned size )
+void
+draw_vs_set_constants(struct draw_context *draw,
+ unsigned slot,
+ const void *constants,
+ unsigned size)
{
if (((uintptr_t)constants) & 0xf) {
- if (size > draw->vs.const_storage_size) {
- if (draw->vs.aligned_constant_storage)
- align_free((void *)draw->vs.aligned_constant_storage);
- draw->vs.aligned_constant_storage = align_malloc( size, 16 );
+ if (size > draw->vs.const_storage_size[slot]) {
+ if (draw->vs.aligned_constant_storage[slot]) {
+ align_free((void *)draw->vs.aligned_constant_storage[slot]);
+ }
+ draw->vs.aligned_constant_storage[slot] = align_malloc(size, 16);
}
- memcpy( (void*)draw->vs.aligned_constant_storage,
- constants,
- size );
- constants = draw->vs.aligned_constant_storage;
+ memcpy((void *)draw->vs.aligned_constant_storage[slot],
+ constants,
+ size);
+ constants = draw->vs.aligned_constant_storage[slot];
}
-
- draw->vs.aligned_constants = constants;
- draw_vs_aos_machine_constants( draw->vs.aos_machine, constants );
+
+ draw->vs.aligned_constants[slot] = constants;
+ draw_vs_aos_machine_constants(draw->vs.aos_machine, slot, constants);
}
@@ -182,6 +185,8 @@ draw_vs_init( struct draw_context *draw )
void
draw_vs_destroy( struct draw_context *draw )
{
+ uint i;
+
if (draw->vs.fetch_cache)
translate_cache_destroy(draw->vs.fetch_cache);
@@ -191,8 +196,11 @@ draw_vs_destroy( struct draw_context *draw )
if (draw->vs.aos_machine)
draw_vs_aos_machine_destroy(draw->vs.aos_machine);
- if (draw->vs.aligned_constant_storage)
- align_free((void*)draw->vs.aligned_constant_storage);
+ for (i = 0; i < PIPE_MAX_CONSTANT_BUFFERS; i++) {
+ if (draw->vs.aligned_constant_storage[i]) {
+ align_free((void *)draw->vs.aligned_constant_storage[i]);
+ }
+ }
tgsi_exec_machine_destroy(draw->vs.machine);
}
diff --git a/src/gallium/auxiliary/draw/draw_vs.h b/src/gallium/auxiliary/draw/draw_vs.h
index 00036cfe68b..d095c9bad1d 100644
--- a/src/gallium/auxiliary/draw/draw_vs.h
+++ b/src/gallium/auxiliary/draw/draw_vs.h
@@ -132,7 +132,7 @@ struct draw_vertex_shader {
void (*run_linear)( struct draw_vertex_shader *shader,
const float (*input)[4],
float (*output)[4],
- const float (*constants)[4],
+ const void *constants[PIPE_MAX_CONSTANT_BUFFERS],
unsigned count,
unsigned input_stride,
unsigned output_stride );
@@ -212,8 +212,10 @@ static INLINE int draw_vs_varient_key_compare( const struct draw_vs_varient_key
struct aos_machine *draw_vs_aos_machine( void );
void draw_vs_aos_machine_destroy( struct aos_machine *machine );
-void draw_vs_aos_machine_constants( struct aos_machine *machine,
- const float (*constants)[4] );
+void
+draw_vs_aos_machine_constants(struct aos_machine *machine,
+ unsigned slot,
+ const void *constants);
void draw_vs_aos_machine_viewport( struct aos_machine *machine,
const struct pipe_viewport_state *viewport );
diff --git a/src/gallium/auxiliary/draw/draw_vs_aos.c b/src/gallium/auxiliary/draw/draw_vs_aos.c
index 1aaae4ab7a4..e7121f36541 100644
--- a/src/gallium/auxiliary/draw/draw_vs_aos.c
+++ b/src/gallium/auxiliary/draw/draw_vs_aos.c
@@ -2114,11 +2114,14 @@ static void PIPE_CDECL vaos_run_elts( struct draw_vs_varient *varient,
{
struct draw_vs_varient_aos_sse *vaos = (struct draw_vs_varient_aos_sse *)varient;
struct aos_machine *machine = vaos->draw->vs.aos_machine;
+ unsigned i;
if (0) debug_printf("%s %d\n", __FUNCTION__, count);
machine->internal[IMM_PSIZE][0] = vaos->draw->rasterizer->point_size;
- machine->constants = vaos->draw->vs.aligned_constants;
+ for (i = 0; i < PIPE_MAX_CONSTANT_BUFFERS; i++) {
+ machine->constants[i] = vaos->draw->vs.aligned_constants[i];
+ }
machine->immediates = vaos->base.vs->immediates;
machine->buffer = vaos->buffer;
@@ -2135,12 +2138,15 @@ static void PIPE_CDECL vaos_run_linear( struct draw_vs_varient *varient,
{
struct draw_vs_varient_aos_sse *vaos = (struct draw_vs_varient_aos_sse *)varient;
struct aos_machine *machine = vaos->draw->vs.aos_machine;
+ unsigned i;
if (0) debug_printf("%s %d %d const: %x\n", __FUNCTION__, start, count,
vaos->base.key.const_vbuffers);
machine->internal[IMM_PSIZE][0] = vaos->draw->rasterizer->point_size;
- machine->constants = vaos->draw->vs.aligned_constants;
+ for (i = 0; i < PIPE_MAX_CONSTANT_BUFFERS; i++) {
+ machine->constants[i] = vaos->draw->vs.aligned_constants[i];
+ }
machine->immediates = vaos->base.vs->immediates;
machine->buffer = vaos->buffer;
diff --git a/src/gallium/auxiliary/draw/draw_vs_aos.h b/src/gallium/auxiliary/draw/draw_vs_aos.h
index 2cf72ddf7b1..1911242f825 100644
--- a/src/gallium/auxiliary/draw/draw_vs_aos.h
+++ b/src/gallium/auxiliary/draw/draw_vs_aos.h
@@ -122,7 +122,7 @@ struct aos_machine {
ushort fpucntl; /* one of FPU_* above */
const float (*immediates)[4]; /* points to shader data */
- const float (*constants)[4]; /* points to draw data */
+ const void *constants[PIPE_MAX_CONSTANT_BUFFERS]; /* points to draw data */
const struct aos_buffer *buffer; /* points to ? */
};
diff --git a/src/gallium/auxiliary/draw/draw_vs_aos_machine.c b/src/gallium/auxiliary/draw/draw_vs_aos_machine.c
index 3240e3745dd..0eda414ee6a 100644
--- a/src/gallium/auxiliary/draw/draw_vs_aos_machine.c
+++ b/src/gallium/auxiliary/draw/draw_vs_aos_machine.c
@@ -219,10 +219,12 @@ static void PIPE_CDECL populate_lut( struct aos_machine *machine,
}
-void draw_vs_aos_machine_constants( struct aos_machine *machine,
- const float (*constants)[4] )
+void
+draw_vs_aos_machine_constants(struct aos_machine *machine,
+ unsigned slot,
+ const void *constants)
{
- machine->constants = constants;
+ machine->constants[slot] = constants;
{
unsigned i;
@@ -307,8 +309,10 @@ void draw_vs_aos_machine_viewport( struct aos_machine *machine,
{
}
-void draw_vs_aos_machine_constants( struct aos_machine *machine,
- const float (*constants)[4] )
+void
+draw_vs_aos_machine_constants(struct aos_machine *machine,
+ unsigned slot,
+ const void *constants)
{
}
diff --git a/src/gallium/auxiliary/draw/draw_vs_exec.c b/src/gallium/auxiliary/draw/draw_vs_exec.c
index 41cc8026131..7deca2b69d9 100644
--- a/src/gallium/auxiliary/draw/draw_vs_exec.c
+++ b/src/gallium/auxiliary/draw/draw_vs_exec.c
@@ -85,7 +85,7 @@ static void
vs_exec_run_linear( struct draw_vertex_shader *shader,
const float (*input)[4],
float (*output)[4],
- const float (*constants)[4],
+ const void *constants[PIPE_MAX_CONSTANT_BUFFERS],
unsigned count,
unsigned input_stride,
unsigned output_stride )
@@ -95,7 +95,9 @@ vs_exec_run_linear( struct draw_vertex_shader *shader,
unsigned int i, j;
unsigned slot;
- machine->Consts = constants;
+ for (i = 0; i < PIPE_MAX_CONSTANT_BUFFERS; i++) {
+ machine->Consts[i] = constants[i];
+ }
for (i = 0; i < count; i += MAX_TGSI_VERTICES) {
unsigned int max_vertices = MIN2(MAX_TGSI_VERTICES, count - i);
diff --git a/src/gallium/auxiliary/draw/draw_vs_llvm.c b/src/gallium/auxiliary/draw/draw_vs_llvm.c
index b3535c0e48e..fd9166fda58 100644
--- a/src/gallium/auxiliary/draw/draw_vs_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_vs_llvm.c
@@ -64,7 +64,7 @@ static void
vs_llvm_run_linear( struct draw_vertex_shader *base,
const float (*input)[4],
float (*output)[4],
- const float (*constants)[4],
+ const void *constants[PIPE_MAX_CONSTANT_BUFFERS],
unsigned count,
unsigned input_stride,
unsigned output_stride )
@@ -74,7 +74,8 @@ vs_llvm_run_linear( struct draw_vertex_shader *base,
gallivm_cpu_vs_exec(shader->llvm_prog, shader->machine,
input, base->info.num_inputs, output, base->info.num_outputs,
- constants, count, input_stride, output_stride);
+ (const float (*)[4])constants[0],
+ count, input_stride, output_stride);
}
diff --git a/src/gallium/auxiliary/draw/draw_vs_ppc.c b/src/gallium/auxiliary/draw/draw_vs_ppc.c
index da9f3e3d35c..d869eecec5e 100644
--- a/src/gallium/auxiliary/draw/draw_vs_ppc.c
+++ b/src/gallium/auxiliary/draw/draw_vs_ppc.c
@@ -85,7 +85,7 @@ static void
vs_ppc_run_linear( struct draw_vertex_shader *base,
const float (*input)[4],
float (*output)[4],
- const float (*constants)[4],
+ const void *constants[PIPE_MAX_CONSTANT_BUFFERS],
unsigned count,
unsigned input_stride,
unsigned output_stride )
@@ -125,7 +125,7 @@ vs_ppc_run_linear( struct draw_vertex_shader *base,
*/
shader->func(inputs_soa, outputs_soa, temps_soa,
(float (*)[4]) shader->base.immediates,
- (float (*)[4]) constants,
+ (const float (*)[4])constants[0],
ppc_builtin_constants);
/* convert (up to) four output verts from SoA back to AoS format */
diff --git a/src/gallium/auxiliary/draw/draw_vs_sse.c b/src/gallium/auxiliary/draw/draw_vs_sse.c
index 702051387ac..54e6423388f 100644
--- a/src/gallium/auxiliary/draw/draw_vs_sse.c
+++ b/src/gallium/auxiliary/draw/draw_vs_sse.c
@@ -83,7 +83,7 @@ static void
vs_sse_run_linear( struct draw_vertex_shader *base,
const float (*input)[4],
float (*output)[4],
- const float (*constants)[4],
+ const void *constants[PIPE_MAX_CONSTANT_BUFFERS],
unsigned count,
unsigned input_stride,
unsigned output_stride )
@@ -112,7 +112,7 @@ vs_sse_run_linear( struct draw_vertex_shader *base,
/* run compiled shader
*/
shader->func(machine,
- constants,
+ (const float (*)[4])constants[0],
shader->base.immediates,
input,
base->info.num_inputs,
diff --git a/src/gallium/auxiliary/draw/draw_vs_varient.c b/src/gallium/auxiliary/draw/draw_vs_varient.c
index 9f40030f39f..5ed706cb4ff 100644
--- a/src/gallium/auxiliary/draw/draw_vs_varient.c
+++ b/src/gallium/auxiliary/draw/draw_vs_varient.c
@@ -38,7 +38,6 @@
#include "draw/draw_vertex.h"
#include "draw/draw_vs.h"
#include "translate/translate.h"
-#include "translate/translate_cache.h"
/* A first pass at incorporating vertex fetch/emit functionality into
*/
@@ -148,7 +147,7 @@ static void PIPE_CDECL vsvg_run_elts( struct draw_vs_varient *varient,
vsvg->base.vs->run_linear( vsvg->base.vs,
temp_buffer,
temp_buffer,
- (const float (*)[4])vsvg->base.vs->draw->pt.user.vs_constants,
+ vsvg->base.vs->draw->pt.user.vs_constants,
count,
temp_vertex_stride,
temp_vertex_stride);
@@ -211,7 +210,7 @@ static void PIPE_CDECL vsvg_run_linear( struct draw_vs_varient *varient,
vsvg->base.vs->run_linear( vsvg->base.vs,
temp_buffer,
temp_buffer,
- (const float (*)[4])vsvg->base.vs->draw->pt.user.vs_constants,
+ vsvg->base.vs->draw->pt.user.vs_constants,
count,
temp_vertex_stride,
temp_vertex_stride);
diff --git a/src/gallium/auxiliary/pipebuffer/Makefile b/src/gallium/auxiliary/pipebuffer/Makefile
new file mode 100644
index 00000000000..21d25d24748
--- /dev/null
+++ b/src/gallium/auxiliary/pipebuffer/Makefile
@@ -0,0 +1,18 @@
+TOP = ../../../..
+include $(TOP)/configs/current
+
+LIBNAME = pipebuffer
+
+C_SOURCES = \
+ pb_buffer_fenced.c \
+ pb_buffer_malloc.c \
+ pb_bufmgr_alt.c \
+ pb_bufmgr_cache.c \
+ pb_bufmgr_debug.c \
+ pb_bufmgr_mm.c \
+ pb_bufmgr_ondemand.c \
+ pb_bufmgr_pool.c \
+ pb_bufmgr_slab.c \
+ pb_validate.c
+
+include ../../Makefile.template
diff --git a/src/gallium/auxiliary/pipebuffer/SConscript b/src/gallium/auxiliary/pipebuffer/SConscript
new file mode 100644
index 00000000000..a074a554717
--- /dev/null
+++ b/src/gallium/auxiliary/pipebuffer/SConscript
@@ -0,0 +1,18 @@
+Import('*')
+
+pipebuffer = env.ConvenienceLibrary(
+ target = 'pipebuffer',
+ source = [
+ 'pb_buffer_fenced.c',
+ 'pb_buffer_malloc.c',
+ 'pb_bufmgr_alt.c',
+ 'pb_bufmgr_cache.c',
+ 'pb_bufmgr_debug.c',
+ 'pb_bufmgr_mm.c',
+ 'pb_bufmgr_ondemand.c',
+ 'pb_bufmgr_pool.c',
+ 'pb_bufmgr_slab.c',
+ 'pb_validate.c',
+ ])
+
+auxiliaries.insert(0, pipebuffer)
diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
index a4b78f14943..ba087ac0f34 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
@@ -1,6 +1,6 @@
/**************************************************************************
*
- * Copyright 2007-2009 VMware, Inc.
+ * Copyright 2007-2010 VMware, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -28,9 +28,9 @@
/**
* \file
* Implementation of fenced buffers.
- *
- * \author Jose Fonseca <jrfonseca-at-tungstengraphics-dot-com>
- * \author Thomas Hellström <thomas-at-tungstengraphics-dot-com>
+ *
+ * \author Jose Fonseca <jfonseca-at-vmware-dot-com>
+ * \author Thomas Hellström <thellstrom-at-vmware-dot-com>
*/
@@ -50,6 +50,7 @@
#include "pb_buffer.h"
#include "pb_buffer_fenced.h"
+#include "pb_bufmgr.h"
@@ -59,32 +60,79 @@
#define SUPER(__derived) (&(__derived)->base)
-struct fenced_buffer_list
+struct fenced_manager
{
- pipe_mutex mutex;
-
+ struct pb_manager base;
+ struct pb_manager *provider;
struct pb_fence_ops *ops;
-
- pb_size numDelayed;
- struct list_head delayed;
-
-#ifdef DEBUG
- pb_size numUnfenced;
+
+ /**
+ * Maximum buffer size that can be safely allocated.
+ */
+ pb_size max_buffer_size;
+
+ /**
+ * Maximum cpu memory we can allocate before we start waiting for the
+ * GPU to idle.
+ */
+ pb_size max_cpu_total_size;
+
+ /**
+ * Following members are mutable and protected by this mutex.
+ */
+ pipe_mutex mutex;
+
+ /**
+ * Fenced buffer list.
+ *
+ * All fenced buffers are placed in this listed, ordered from the oldest
+ * fence to the newest fence.
+ */
+ struct list_head fenced;
+ pb_size num_fenced;
+
struct list_head unfenced;
-#endif
+ pb_size num_unfenced;
+
+ /**
+ * How much temporary CPU memory is being used to hold unvalidated buffers.
+ */
+ pb_size cpu_total_size;
};
/**
+ * Fenced buffer.
+ *
* Wrapper around a pipe buffer which adds fencing and reference counting.
*/
struct fenced_buffer
{
+ /*
+ * Immutable members.
+ */
+
struct pb_buffer base;
-
+ struct fenced_manager *mgr;
+
+ /*
+ * Following members are mutable and protected by fenced_manager::mutex.
+ */
+
+ struct list_head head;
+
+ /**
+ * Buffer with storage.
+ */
struct pb_buffer *buffer;
+ pb_size size;
+ struct pb_desc desc;
- /* FIXME: protect access with mutex */
+ /**
+ * Temporary CPU storage data. Used when there isn't enough GPU memory to
+ * store the buffer.
+ */
+ void *data;
/**
* A bitmask of PIPE_BUFFER_USAGE_CPU/GPU_READ/WRITE describing the current
@@ -93,15 +141,22 @@ struct fenced_buffer
unsigned flags;
unsigned mapcount;
+
struct pb_validate *vl;
unsigned validation_flags;
- struct pipe_fence_handle *fence;
- struct list_head head;
- struct fenced_buffer_list *list;
+ struct pipe_fence_handle *fence;
};
+static INLINE struct fenced_manager *
+fenced_manager(struct pb_manager *mgr)
+{
+ assert(mgr);
+ return (struct fenced_manager *)mgr;
+}
+
+
static INLINE struct fenced_buffer *
fenced_buffer(struct pb_buffer *buf)
{
@@ -110,221 +165,568 @@ fenced_buffer(struct pb_buffer *buf)
}
-static INLINE void
-_fenced_buffer_add(struct fenced_buffer *fenced_buf)
-{
- struct fenced_buffer_list *fenced_list = fenced_buf->list;
+static void
+fenced_buffer_destroy_cpu_storage_locked(struct fenced_buffer *fenced_buf);
- assert(pipe_is_referenced(&fenced_buf->base.base.reference));
- assert(fenced_buf->flags & PIPE_BUFFER_USAGE_GPU_READ_WRITE);
- assert(fenced_buf->fence);
+static enum pipe_error
+fenced_buffer_create_cpu_storage_locked(struct fenced_manager *fenced_mgr,
+ struct fenced_buffer *fenced_buf);
+static void
+fenced_buffer_destroy_gpu_storage_locked(struct fenced_buffer *fenced_buf);
+
+static enum pipe_error
+fenced_buffer_create_gpu_storage_locked(struct fenced_manager *fenced_mgr,
+ struct fenced_buffer *fenced_buf,
+ boolean wait);
+
+static enum pipe_error
+fenced_buffer_copy_storage_to_gpu_locked(struct fenced_buffer *fenced_buf);
+
+static enum pipe_error
+fenced_buffer_copy_storage_to_cpu_locked(struct fenced_buffer *fenced_buf);
+
+
+/**
+ * Dump the fenced buffer list.
+ *
+ * Useful to understand failures to allocate buffers.
+ */
+static void
+fenced_manager_dump_locked(struct fenced_manager *fenced_mgr)
+{
#ifdef DEBUG
- LIST_DEL(&fenced_buf->head);
- assert(fenced_list->numUnfenced);
- --fenced_list->numUnfenced;
+ struct pb_fence_ops *ops = fenced_mgr->ops;
+ struct list_head *curr, *next;
+ struct fenced_buffer *fenced_buf;
+
+ debug_printf("%10s %7s %8s %7s %10s %s\n",
+ "buffer", "size", "refcount", "storage", "fence", "signalled");
+
+ curr = fenced_mgr->unfenced.next;
+ next = curr->next;
+ while(curr != &fenced_mgr->unfenced) {
+ fenced_buf = LIST_ENTRY(struct fenced_buffer, curr, head);
+ assert(!fenced_buf->fence);
+ debug_printf("%10p %7u %8u %7s\n",
+ (void *) fenced_buf,
+ fenced_buf->base.base.size,
+ p_atomic_read(&fenced_buf->base.base.reference.count),
+ fenced_buf->buffer ? "gpu" : (fenced_buf->data ? "cpu" : "none"));
+ curr = next;
+ next = curr->next;
+ }
+
+ curr = fenced_mgr->fenced.next;
+ next = curr->next;
+ while(curr != &fenced_mgr->fenced) {
+ int signaled;
+ fenced_buf = LIST_ENTRY(struct fenced_buffer, curr, head);
+ assert(fenced_buf->buffer);
+ signaled = ops->fence_signalled(ops, fenced_buf->fence, 0);
+ debug_printf("%10p %7u %8u %7s %10p %s\n",
+ (void *) fenced_buf,
+ fenced_buf->base.base.size,
+ p_atomic_read(&fenced_buf->base.base.reference.count),
+ "gpu",
+ (void *) fenced_buf->fence,
+ signaled == 0 ? "y" : "n");
+ curr = next;
+ next = curr->next;
+ }
+#else
+ (void)fenced_mgr;
#endif
- LIST_ADDTAIL(&fenced_buf->head, &fenced_list->delayed);
- ++fenced_list->numDelayed;
}
-/**
- * Actually destroy the buffer.
- */
static INLINE void
-_fenced_buffer_destroy(struct fenced_buffer *fenced_buf)
+fenced_buffer_destroy_locked(struct fenced_manager *fenced_mgr,
+ struct fenced_buffer *fenced_buf)
{
- struct fenced_buffer_list *fenced_list = fenced_buf->list;
-
assert(!pipe_is_referenced(&fenced_buf->base.base.reference));
+
assert(!fenced_buf->fence);
-#ifdef DEBUG
assert(fenced_buf->head.prev);
assert(fenced_buf->head.next);
LIST_DEL(&fenced_buf->head);
- assert(fenced_list->numUnfenced);
- --fenced_list->numUnfenced;
-#else
- (void)fenced_list;
-#endif
- pb_reference(&fenced_buf->buffer, NULL);
+ assert(fenced_mgr->num_unfenced);
+ --fenced_mgr->num_unfenced;
+
+ fenced_buffer_destroy_gpu_storage_locked(fenced_buf);
+ fenced_buffer_destroy_cpu_storage_locked(fenced_buf);
+
FREE(fenced_buf);
}
+/**
+ * Add the buffer to the fenced list.
+ *
+ * Reference count should be incremented before calling this function.
+ */
static INLINE void
-_fenced_buffer_remove(struct fenced_buffer_list *fenced_list,
- struct fenced_buffer *fenced_buf)
+fenced_buffer_add_locked(struct fenced_manager *fenced_mgr,
+ struct fenced_buffer *fenced_buf)
+{
+ assert(pipe_is_referenced(&fenced_buf->base.base.reference));
+ assert(fenced_buf->flags & PIPE_BUFFER_USAGE_GPU_READ_WRITE);
+ assert(fenced_buf->fence);
+
+ p_atomic_inc(&fenced_buf->base.base.reference.count);
+
+ LIST_DEL(&fenced_buf->head);
+ assert(fenced_mgr->num_unfenced);
+ --fenced_mgr->num_unfenced;
+ LIST_ADDTAIL(&fenced_buf->head, &fenced_mgr->fenced);
+ ++fenced_mgr->num_fenced;
+}
+
+
+/**
+ * Remove the buffer from the fenced list, and potentially destroy the buffer
+ * if the reference count reaches zero.
+ *
+ * Returns TRUE if the buffer was detroyed.
+ */
+static INLINE boolean
+fenced_buffer_remove_locked(struct fenced_manager *fenced_mgr,
+ struct fenced_buffer *fenced_buf)
{
- struct pb_fence_ops *ops = fenced_list->ops;
+ struct pb_fence_ops *ops = fenced_mgr->ops;
assert(fenced_buf->fence);
- assert(fenced_buf->list == fenced_list);
-
+ assert(fenced_buf->mgr == fenced_mgr);
+
ops->fence_reference(ops, &fenced_buf->fence, NULL);
fenced_buf->flags &= ~PIPE_BUFFER_USAGE_GPU_READ_WRITE;
-
+
assert(fenced_buf->head.prev);
assert(fenced_buf->head.next);
-
+
LIST_DEL(&fenced_buf->head);
- assert(fenced_list->numDelayed);
- --fenced_list->numDelayed;
-
-#ifdef DEBUG
- LIST_ADDTAIL(&fenced_buf->head, &fenced_list->unfenced);
- ++fenced_list->numUnfenced;
-#endif
-
- /**
- * FIXME!!!
- */
+ assert(fenced_mgr->num_fenced);
+ --fenced_mgr->num_fenced;
+
+ LIST_ADDTAIL(&fenced_buf->head, &fenced_mgr->unfenced);
+ ++fenced_mgr->num_unfenced;
+
+ if (p_atomic_dec_zero(&fenced_buf->base.base.reference.count)) {
+ fenced_buffer_destroy_locked(fenced_mgr, fenced_buf);
+ return TRUE;
+ }
- if(!pipe_is_referenced(&fenced_buf->base.base.reference))
- _fenced_buffer_destroy(fenced_buf);
+ return FALSE;
}
+/**
+ * Wait for the fence to expire, and remove it from the fenced list.
+ *
+ * This function will release and re-aquire the mutex, so any copy of mutable
+ * state must be discarded after calling it.
+ */
static INLINE enum pipe_error
-_fenced_buffer_finish(struct fenced_buffer *fenced_buf)
+fenced_buffer_finish_locked(struct fenced_manager *fenced_mgr,
+ struct fenced_buffer *fenced_buf)
{
- struct fenced_buffer_list *fenced_list = fenced_buf->list;
- struct pb_fence_ops *ops = fenced_list->ops;
+ struct pb_fence_ops *ops = fenced_mgr->ops;
+ enum pipe_error ret = PIPE_ERROR;
#if 0
debug_warning("waiting for GPU");
#endif
+ assert(pipe_is_referenced(&fenced_buf->base.base.reference));
assert(fenced_buf->fence);
+
if(fenced_buf->fence) {
- if(ops->fence_finish(ops, fenced_buf->fence, 0) != 0) {
- return PIPE_ERROR;
+ struct pipe_fence_handle *fence = NULL;
+ int finished;
+ boolean proceed;
+
+ ops->fence_reference(ops, &fence, fenced_buf->fence);
+
+ pipe_mutex_unlock(fenced_mgr->mutex);
+
+ finished = ops->fence_finish(ops, fenced_buf->fence, 0);
+
+ pipe_mutex_lock(fenced_mgr->mutex);
+
+ assert(pipe_is_referenced(&fenced_buf->base.base.reference));
+
+ /*
+ * Only proceed if the fence object didn't change in the meanwhile.
+ * Otherwise assume the work has been already carried out by another
+ * thread that re-aquired the lock before us.
+ */
+ proceed = fence == fenced_buf->fence ? TRUE : FALSE;
+
+ ops->fence_reference(ops, &fence, NULL);
+
+ if(proceed && finished == 0) {
+ /*
+ * Remove from the fenced list
+ */
+
+ boolean destroyed;
+
+ destroyed = fenced_buffer_remove_locked(fenced_mgr, fenced_buf);
+
+ /* TODO: remove consequents buffers with the same fence? */
+
+ assert(!destroyed);
+
+ fenced_buf->flags &= ~PIPE_BUFFER_USAGE_GPU_READ_WRITE;
+
+ ret = PIPE_OK;
}
- /* Remove from the fenced list */
- /* TODO: remove consequents */
- _fenced_buffer_remove(fenced_list, fenced_buf);
}
- fenced_buf->flags &= ~PIPE_BUFFER_USAGE_GPU_READ_WRITE;
- return PIPE_OK;
+ return ret;
}
/**
- * Free as many fenced buffers from the list head as possible.
+ * Remove as many fenced buffers from the fenced list as possible.
+ *
+ * Returns TRUE if at least one buffer was removed.
*/
-static void
-_fenced_buffer_list_check_free(struct fenced_buffer_list *fenced_list,
- int wait)
+static boolean
+fenced_manager_check_signalled_locked(struct fenced_manager *fenced_mgr,
+ boolean wait)
{
- struct pb_fence_ops *ops = fenced_list->ops;
+ struct pb_fence_ops *ops = fenced_mgr->ops;
struct list_head *curr, *next;
struct fenced_buffer *fenced_buf;
- struct pb_buffer *pb_buf;
struct pipe_fence_handle *prev_fence = NULL;
+ boolean ret = FALSE;
- curr = fenced_list->delayed.next;
+ curr = fenced_mgr->fenced.next;
next = curr->next;
- while(curr != &fenced_list->delayed) {
+ while(curr != &fenced_mgr->fenced) {
fenced_buf = LIST_ENTRY(struct fenced_buffer, curr, head);
if(fenced_buf->fence != prev_fence) {
int signaled;
- if (wait)
+
+ if (wait) {
signaled = ops->fence_finish(ops, fenced_buf->fence, 0);
- else
+
+ /*
+ * Don't return just now. Instead preemptively check if the
+ * following buffers' fences already expired, without further waits.
+ */
+ wait = FALSE;
+ }
+ else {
signaled = ops->fence_signalled(ops, fenced_buf->fence, 0);
- if (signaled != 0)
- break;
+ }
+
+ if (signaled != 0) {
+ return ret;
+ }
+
prev_fence = fenced_buf->fence;
}
else {
+ /* This buffer's fence object is identical to the previous buffer's
+ * fence object, so no need to check the fence again.
+ */
assert(ops->fence_signalled(ops, fenced_buf->fence, 0) == 0);
}
- _fenced_buffer_remove(fenced_list, fenced_buf);
+ fenced_buffer_remove_locked(fenced_mgr, fenced_buf);
+
+ ret = TRUE;
+
+ curr = next;
+ next = curr->next;
+ }
+
+ return ret;
+}
+
+
+/**
+ * Try to free some GPU memory by backing it up into CPU memory.
+ *
+ * Returns TRUE if at least one buffer was freed.
+ */
+static boolean
+fenced_manager_free_gpu_storage_locked(struct fenced_manager *fenced_mgr)
+{
+ struct list_head *curr, *next;
+ struct fenced_buffer *fenced_buf;
- curr = next;
+ curr = fenced_mgr->unfenced.next;
+ next = curr->next;
+ while(curr != &fenced_mgr->unfenced) {
+ fenced_buf = LIST_ENTRY(struct fenced_buffer, curr, head);
+
+ /*
+ * We can only move storage if the buffer is not mapped and not
+ * validated.
+ */
+ if(fenced_buf->buffer &&
+ !fenced_buf->mapcount &&
+ !fenced_buf->vl) {
+ enum pipe_error ret;
+
+ ret = fenced_buffer_create_cpu_storage_locked(fenced_mgr, fenced_buf);
+ if(ret == PIPE_OK) {
+ ret = fenced_buffer_copy_storage_to_cpu_locked(fenced_buf);
+ if(ret == PIPE_OK) {
+ fenced_buffer_destroy_gpu_storage_locked(fenced_buf);
+ return TRUE;
+ }
+ fenced_buffer_destroy_cpu_storage_locked(fenced_buf);
+ }
+ }
+
+ curr = next;
next = curr->next;
}
+
+ return FALSE;
}
+/**
+ * Destroy CPU storage for this buffer.
+ */
static void
-fenced_buffer_destroy(struct pb_buffer *buf)
+fenced_buffer_destroy_cpu_storage_locked(struct fenced_buffer *fenced_buf)
{
- struct fenced_buffer *fenced_buf = fenced_buffer(buf);
- struct fenced_buffer_list *fenced_list = fenced_buf->list;
+ if(fenced_buf->data) {
+ align_free(fenced_buf->data);
+ fenced_buf->data = NULL;
+ assert(fenced_buf->mgr->cpu_total_size >= fenced_buf->size);
+ fenced_buf->mgr->cpu_total_size -= fenced_buf->size;
+ }
+}
- pipe_mutex_lock(fenced_list->mutex);
- assert(!pipe_is_referenced(&fenced_buf->base.base.reference));
- if (fenced_buf->fence) {
- struct pb_fence_ops *ops = fenced_list->ops;
- if(ops->fence_signalled(ops, fenced_buf->fence, 0) == 0) {
- struct list_head *curr, *prev;
- curr = &fenced_buf->head;
- prev = curr->prev;
- do {
- fenced_buf = LIST_ENTRY(struct fenced_buffer, curr, head);
- assert(ops->fence_signalled(ops, fenced_buf->fence, 0) == 0);
- _fenced_buffer_remove(fenced_list, fenced_buf);
- curr = prev;
- prev = curr->prev;
- } while (curr != &fenced_list->delayed);
- }
- else {
- /* delay destruction */
+
+/**
+ * Create CPU storage for this buffer.
+ */
+static enum pipe_error
+fenced_buffer_create_cpu_storage_locked(struct fenced_manager *fenced_mgr,
+ struct fenced_buffer *fenced_buf)
+{
+ assert(!fenced_buf->data);
+ if(fenced_buf->data)
+ return PIPE_OK;
+
+ if (fenced_mgr->cpu_total_size + fenced_buf->size > fenced_mgr->max_cpu_total_size)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+
+ fenced_buf->data = align_malloc(fenced_buf->size, fenced_buf->desc.alignment);
+ if(!fenced_buf->data)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+
+ fenced_mgr->cpu_total_size += fenced_buf->size;
+
+ return PIPE_OK;
+}
+
+
+/**
+ * Destroy the GPU storage.
+ */
+static void
+fenced_buffer_destroy_gpu_storage_locked(struct fenced_buffer *fenced_buf)
+{
+ if(fenced_buf->buffer) {
+ pb_reference(&fenced_buf->buffer, NULL);
+ }
+}
+
+
+/**
+ * Try to create GPU storage for this buffer.
+ *
+ * This function is a shorthand around pb_manager::create_buffer for
+ * fenced_buffer_create_gpu_storage_locked()'s benefit.
+ */
+static INLINE boolean
+fenced_buffer_try_create_gpu_storage_locked(struct fenced_manager *fenced_mgr,
+ struct fenced_buffer *fenced_buf)
+{
+ struct pb_manager *provider = fenced_mgr->provider;
+
+ assert(!fenced_buf->buffer);
+
+ fenced_buf->buffer = provider->create_buffer(fenced_mgr->provider,
+ fenced_buf->size,
+ &fenced_buf->desc);
+ return fenced_buf->buffer ? TRUE : FALSE;
+}
+
+
+/**
+ * Create GPU storage for this buffer.
+ */
+static enum pipe_error
+fenced_buffer_create_gpu_storage_locked(struct fenced_manager *fenced_mgr,
+ struct fenced_buffer *fenced_buf,
+ boolean wait)
+{
+ assert(!fenced_buf->buffer);
+
+ /*
+ * Check for signaled buffers before trying to allocate.
+ */
+ fenced_manager_check_signalled_locked(fenced_mgr, FALSE);
+
+ fenced_buffer_try_create_gpu_storage_locked(fenced_mgr, fenced_buf);
+
+ /*
+ * Keep trying while there is some sort of progress:
+ * - fences are expiring,
+ * - or buffers are being being swapped out from GPU memory into CPU memory.
+ */
+ while(!fenced_buf->buffer &&
+ (fenced_manager_check_signalled_locked(fenced_mgr, FALSE) ||
+ fenced_manager_free_gpu_storage_locked(fenced_mgr))) {
+ fenced_buffer_try_create_gpu_storage_locked(fenced_mgr, fenced_buf);
+ }
+
+ if(!fenced_buf->buffer && wait) {
+ /*
+ * Same as before, but this time around, wait to free buffers if
+ * necessary.
+ */
+ while(!fenced_buf->buffer &&
+ (fenced_manager_check_signalled_locked(fenced_mgr, TRUE) ||
+ fenced_manager_free_gpu_storage_locked(fenced_mgr))) {
+ fenced_buffer_try_create_gpu_storage_locked(fenced_mgr, fenced_buf);
}
}
- else {
- _fenced_buffer_destroy(fenced_buf);
+
+ if(!fenced_buf->buffer) {
+ if(0)
+ fenced_manager_dump_locked(fenced_mgr);
+
+ /* give up */
+ return PIPE_ERROR_OUT_OF_MEMORY;
}
- pipe_mutex_unlock(fenced_list->mutex);
+
+ return PIPE_OK;
+}
+
+
+static enum pipe_error
+fenced_buffer_copy_storage_to_gpu_locked(struct fenced_buffer *fenced_buf)
+{
+ uint8_t *map;
+
+ assert(fenced_buf->data);
+ assert(fenced_buf->buffer);
+
+ map = pb_map(fenced_buf->buffer, PIPE_BUFFER_USAGE_CPU_WRITE);
+ if(!map)
+ return PIPE_ERROR;
+
+ memcpy(map, fenced_buf->data, fenced_buf->size);
+
+ pb_unmap(fenced_buf->buffer);
+
+ return PIPE_OK;
+}
+
+
+static enum pipe_error
+fenced_buffer_copy_storage_to_cpu_locked(struct fenced_buffer *fenced_buf)
+{
+ const uint8_t *map;
+
+ assert(fenced_buf->data);
+ assert(fenced_buf->buffer);
+
+ map = pb_map(fenced_buf->buffer, PIPE_BUFFER_USAGE_CPU_READ);
+ if(!map)
+ return PIPE_ERROR;
+
+ memcpy(fenced_buf->data, map, fenced_buf->size);
+
+ pb_unmap(fenced_buf->buffer);
+
+ return PIPE_OK;
+}
+
+
+static void
+fenced_buffer_destroy(struct pb_buffer *buf)
+{
+ struct fenced_buffer *fenced_buf = fenced_buffer(buf);
+ struct fenced_manager *fenced_mgr = fenced_buf->mgr;
+
+ assert(!pipe_is_referenced(&fenced_buf->base.base.reference));
+
+ pipe_mutex_lock(fenced_mgr->mutex);
+
+ fenced_buffer_destroy_locked(fenced_mgr, fenced_buf);
+
+ pipe_mutex_unlock(fenced_mgr->mutex);
}
static void *
-fenced_buffer_map(struct pb_buffer *buf,
+fenced_buffer_map(struct pb_buffer *buf,
unsigned flags)
{
struct fenced_buffer *fenced_buf = fenced_buffer(buf);
- struct fenced_buffer_list *fenced_list = fenced_buf->list;
- struct pb_fence_ops *ops = fenced_list->ops;
- void *map;
+ struct fenced_manager *fenced_mgr = fenced_buf->mgr;
+ struct pb_fence_ops *ops = fenced_mgr->ops;
+ void *map = NULL;
+
+ pipe_mutex_lock(fenced_mgr->mutex);
assert(!(flags & PIPE_BUFFER_USAGE_GPU_READ_WRITE));
-
- /* Serialize writes */
- if((fenced_buf->flags & PIPE_BUFFER_USAGE_GPU_WRITE) ||
- ((fenced_buf->flags & PIPE_BUFFER_USAGE_GPU_READ) && (flags & PIPE_BUFFER_USAGE_CPU_WRITE))) {
- if(flags & PIPE_BUFFER_USAGE_DONTBLOCK) {
- /* Don't wait for the GPU to finish writing */
- if(ops->fence_signalled(ops, fenced_buf->fence, 0) == 0)
- _fenced_buffer_remove(fenced_list, fenced_buf);
- else
- return NULL;
+
+ /*
+ * Serialize writes.
+ */
+ while((fenced_buf->flags & PIPE_BUFFER_USAGE_GPU_WRITE) ||
+ ((fenced_buf->flags & PIPE_BUFFER_USAGE_GPU_READ) &&
+ (flags & PIPE_BUFFER_USAGE_CPU_WRITE))) {
+
+ /*
+ * Don't wait for the GPU to finish accessing it, if blocking is forbidden.
+ */
+ if((flags & PIPE_BUFFER_USAGE_DONTBLOCK) &&
+ ops->fence_signalled(ops, fenced_buf->fence, 0) == 0) {
+ goto done;
}
- else {
- /* Wait for the GPU to finish writing */
- _fenced_buffer_finish(fenced_buf);
+
+ if (flags & PIPE_BUFFER_USAGE_UNSYNCHRONIZED) {
+ break;
}
+
+ /*
+ * Wait for the GPU to finish accessing. This will release and re-acquire
+ * the mutex, so all copies of mutable state must be discarded.
+ */
+ fenced_buffer_finish_locked(fenced_mgr, fenced_buf);
}
-#if 0
- /* Check for CPU write access (read is OK) */
- if(fenced_buf->flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE) {
- /* this is legal -- just for debugging */
- debug_warning("concurrent CPU writes");
+ if(fenced_buf->buffer) {
+ map = pb_map(fenced_buf->buffer, flags);
}
-#endif
-
- map = pb_map(fenced_buf->buffer, flags);
+ else {
+ assert(fenced_buf->data);
+ map = fenced_buf->data;
+ }
+
if(map) {
++fenced_buf->mapcount;
fenced_buf->flags |= flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE;
}
+done:
+ pipe_mutex_unlock(fenced_mgr->mutex);
+
return map;
}
@@ -333,13 +735,20 @@ static void
fenced_buffer_unmap(struct pb_buffer *buf)
{
struct fenced_buffer *fenced_buf = fenced_buffer(buf);
+ struct fenced_manager *fenced_mgr = fenced_buf->mgr;
+
+ pipe_mutex_lock(fenced_mgr->mutex);
+
assert(fenced_buf->mapcount);
if(fenced_buf->mapcount) {
- pb_unmap(fenced_buf->buffer);
+ if (fenced_buf->buffer)
+ pb_unmap(fenced_buf->buffer);
--fenced_buf->mapcount;
if(!fenced_buf->mapcount)
fenced_buf->flags &= ~PIPE_BUFFER_USAGE_CPU_READ_WRITE;
}
+
+ pipe_mutex_unlock(fenced_mgr->mutex);
}
@@ -349,48 +758,72 @@ fenced_buffer_validate(struct pb_buffer *buf,
unsigned flags)
{
struct fenced_buffer *fenced_buf = fenced_buffer(buf);
+ struct fenced_manager *fenced_mgr = fenced_buf->mgr;
enum pipe_error ret;
-
+
+ pipe_mutex_lock(fenced_mgr->mutex);
+
if(!vl) {
/* invalidate */
fenced_buf->vl = NULL;
fenced_buf->validation_flags = 0;
- return PIPE_OK;
+ ret = PIPE_OK;
+ goto done;
}
-
+
assert(flags & PIPE_BUFFER_USAGE_GPU_READ_WRITE);
assert(!(flags & ~PIPE_BUFFER_USAGE_GPU_READ_WRITE));
flags &= PIPE_BUFFER_USAGE_GPU_READ_WRITE;
- /* Buffer cannot be validated in two different lists */
- if(fenced_buf->vl && fenced_buf->vl != vl)
- return PIPE_ERROR_RETRY;
-
-#if 0
- /* Do not validate if buffer is still mapped */
- if(fenced_buf->flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE) {
- /* TODO: wait for the thread that mapped the buffer to unmap it */
- return PIPE_ERROR_RETRY;
+ /* Buffer cannot be validated in two different lists */
+ if(fenced_buf->vl && fenced_buf->vl != vl) {
+ ret = PIPE_ERROR_RETRY;
+ goto done;
}
- /* Final sanity checking */
- assert(!(fenced_buf->flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE));
- assert(!fenced_buf->mapcount);
-#endif
if(fenced_buf->vl == vl &&
(fenced_buf->validation_flags & flags) == flags) {
/* Nothing to do -- buffer already validated */
- return PIPE_OK;
+ ret = PIPE_OK;
+ goto done;
+ }
+
+ /*
+ * Create and update GPU storage.
+ */
+ if(!fenced_buf->buffer) {
+ assert(!fenced_buf->mapcount);
+
+ ret = fenced_buffer_create_gpu_storage_locked(fenced_mgr, fenced_buf, TRUE);
+ if(ret != PIPE_OK) {
+ goto done;
+ }
+
+ ret = fenced_buffer_copy_storage_to_gpu_locked(fenced_buf);
+ if(ret != PIPE_OK) {
+ fenced_buffer_destroy_gpu_storage_locked(fenced_buf);
+ goto done;
+ }
+
+ if(fenced_buf->mapcount) {
+ debug_printf("warning: validating a buffer while it is still mapped\n");
+ }
+ else {
+ fenced_buffer_destroy_cpu_storage_locked(fenced_buf);
+ }
}
-
+
ret = pb_validate(fenced_buf->buffer, vl, flags);
if (ret != PIPE_OK)
- return ret;
-
+ goto done;
+
fenced_buf->vl = vl;
fenced_buf->validation_flags |= flags;
-
- return PIPE_OK;
+
+done:
+ pipe_mutex_unlock(fenced_mgr->mutex);
+
+ return ret;
}
@@ -398,36 +831,37 @@ static void
fenced_buffer_fence(struct pb_buffer *buf,
struct pipe_fence_handle *fence)
{
- struct fenced_buffer *fenced_buf;
- struct fenced_buffer_list *fenced_list;
- struct pb_fence_ops *ops;
+ struct fenced_buffer *fenced_buf = fenced_buffer(buf);
+ struct fenced_manager *fenced_mgr = fenced_buf->mgr;
+ struct pb_fence_ops *ops = fenced_mgr->ops;
- fenced_buf = fenced_buffer(buf);
- fenced_list = fenced_buf->list;
- ops = fenced_list->ops;
-
- if(fence == fenced_buf->fence) {
- /* Nothing to do */
- return;
- }
+ pipe_mutex_lock(fenced_mgr->mutex);
- assert(fenced_buf->vl);
- assert(fenced_buf->validation_flags);
-
- pipe_mutex_lock(fenced_list->mutex);
- if (fenced_buf->fence)
- _fenced_buffer_remove(fenced_list, fenced_buf);
- if (fence) {
- ops->fence_reference(ops, &fenced_buf->fence, fence);
- fenced_buf->flags |= fenced_buf->validation_flags;
- _fenced_buffer_add(fenced_buf);
+ assert(pipe_is_referenced(&fenced_buf->base.base.reference));
+ assert(fenced_buf->buffer);
+
+ if(fence != fenced_buf->fence) {
+ assert(fenced_buf->vl);
+ assert(fenced_buf->validation_flags);
+
+ if (fenced_buf->fence) {
+ boolean destroyed;
+ destroyed = fenced_buffer_remove_locked(fenced_mgr, fenced_buf);
+ assert(!destroyed);
+ }
+ if (fence) {
+ ops->fence_reference(ops, &fenced_buf->fence, fence);
+ fenced_buf->flags |= fenced_buf->validation_flags;
+ fenced_buffer_add_locked(fenced_mgr, fenced_buf);
+ }
+
+ pb_fence(fenced_buf->buffer, fence);
+
+ fenced_buf->vl = NULL;
+ fenced_buf->validation_flags = 0;
}
- pipe_mutex_unlock(fenced_list->mutex);
-
- pb_fence(fenced_buf->buffer, fence);
- fenced_buf->vl = NULL;
- fenced_buf->validation_flags = 0;
+ pipe_mutex_unlock(fenced_mgr->mutex);
}
@@ -437,11 +871,29 @@ fenced_buffer_get_base_buffer(struct pb_buffer *buf,
pb_size *offset)
{
struct fenced_buffer *fenced_buf = fenced_buffer(buf);
- pb_get_base_buffer(fenced_buf->buffer, base_buf, offset);
+ struct fenced_manager *fenced_mgr = fenced_buf->mgr;
+
+ pipe_mutex_lock(fenced_mgr->mutex);
+
+ /*
+ * This should only be called when the buffer is validated. Typically
+ * when processing relocations.
+ */
+ assert(fenced_buf->vl);
+ assert(fenced_buf->buffer);
+
+ if(fenced_buf->buffer)
+ pb_get_base_buffer(fenced_buf->buffer, base_buf, offset);
+ else {
+ *base_buf = buf;
+ *offset = 0;
+ }
+
+ pipe_mutex_unlock(fenced_mgr->mutex);
}
-static const struct pb_vtbl
+static const struct pb_vtbl
fenced_buffer_vtbl = {
fenced_buffer_destroy,
fenced_buffer_map,
@@ -452,147 +904,166 @@ fenced_buffer_vtbl = {
};
-struct pb_buffer *
-fenced_buffer_create(struct fenced_buffer_list *fenced_list,
- struct pb_buffer *buffer)
+/**
+ * Wrap a buffer in a fenced buffer.
+ */
+static struct pb_buffer *
+fenced_bufmgr_create_buffer(struct pb_manager *mgr,
+ pb_size size,
+ const struct pb_desc *desc)
{
- struct fenced_buffer *buf;
-
- if(!buffer)
- return NULL;
-
- buf = CALLOC_STRUCT(fenced_buffer);
- if(!buf) {
- pb_reference(&buffer, NULL);
- return NULL;
+ struct fenced_manager *fenced_mgr = fenced_manager(mgr);
+ struct fenced_buffer *fenced_buf;
+ enum pipe_error ret;
+
+ /*
+ * Don't stall the GPU, waste time evicting buffers, or waste memory
+ * trying to create a buffer that will most likely never fit into the
+ * graphics aperture.
+ */
+ if(size > fenced_mgr->max_buffer_size) {
+ goto no_buffer;
}
-
- pipe_reference_init(&buf->base.base.reference, 1);
- buf->base.base.alignment = buffer->base.alignment;
- buf->base.base.usage = buffer->base.usage;
- buf->base.base.size = buffer->base.size;
-
- buf->base.vtbl = &fenced_buffer_vtbl;
- buf->buffer = buffer;
- buf->list = fenced_list;
-
-#ifdef DEBUG
- pipe_mutex_lock(fenced_list->mutex);
- LIST_ADDTAIL(&buf->head, &fenced_list->unfenced);
- ++fenced_list->numUnfenced;
- pipe_mutex_unlock(fenced_list->mutex);
-#endif
- return &buf->base;
-}
+ fenced_buf = CALLOC_STRUCT(fenced_buffer);
+ if(!fenced_buf)
+ goto no_buffer;
+ pipe_reference_init(&fenced_buf->base.base.reference, 1);
+ fenced_buf->base.base.alignment = desc->alignment;
+ fenced_buf->base.base.usage = desc->usage;
+ fenced_buf->base.base.size = size;
+ fenced_buf->size = size;
+ fenced_buf->desc = *desc;
-struct fenced_buffer_list *
-fenced_buffer_list_create(struct pb_fence_ops *ops)
-{
- struct fenced_buffer_list *fenced_list;
+ fenced_buf->base.vtbl = &fenced_buffer_vtbl;
+ fenced_buf->mgr = fenced_mgr;
- fenced_list = CALLOC_STRUCT(fenced_buffer_list);
- if (!fenced_list)
- return NULL;
+ pipe_mutex_lock(fenced_mgr->mutex);
+
+ /*
+ * Try to create GPU storage without stalling,
+ */
+ ret = fenced_buffer_create_gpu_storage_locked(fenced_mgr, fenced_buf, FALSE);
- fenced_list->ops = ops;
+ /*
+ * Attempt to use CPU memory to avoid stalling the GPU.
+ */
+ if(ret != PIPE_OK) {
+ ret = fenced_buffer_create_cpu_storage_locked(fenced_mgr, fenced_buf);
+ }
- LIST_INITHEAD(&fenced_list->delayed);
- fenced_list->numDelayed = 0;
-
-#ifdef DEBUG
- LIST_INITHEAD(&fenced_list->unfenced);
- fenced_list->numUnfenced = 0;
-#endif
+ /*
+ * Create GPU storage, waiting for some to be available.
+ */
+ if(ret != PIPE_OK) {
+ ret = fenced_buffer_create_gpu_storage_locked(fenced_mgr, fenced_buf, TRUE);
+ }
+
+ /*
+ * Give up.
+ */
+ if(ret != PIPE_OK) {
+ goto no_storage;
+ }
- pipe_mutex_init(fenced_list->mutex);
+ assert(fenced_buf->buffer || fenced_buf->data);
- return fenced_list;
-}
+ LIST_ADDTAIL(&fenced_buf->head, &fenced_mgr->unfenced);
+ ++fenced_mgr->num_unfenced;
+ pipe_mutex_unlock(fenced_mgr->mutex);
+ return &fenced_buf->base;
-void
-fenced_buffer_list_check_free(struct fenced_buffer_list *fenced_list,
- int wait)
-{
- pipe_mutex_lock(fenced_list->mutex);
- _fenced_buffer_list_check_free(fenced_list, wait);
- pipe_mutex_unlock(fenced_list->mutex);
+no_storage:
+ pipe_mutex_unlock(fenced_mgr->mutex);
+ FREE(fenced_buf);
+no_buffer:
+ return NULL;
}
-#ifdef DEBUG
-void
-fenced_buffer_list_dump(struct fenced_buffer_list *fenced_list)
+static void
+fenced_bufmgr_flush(struct pb_manager *mgr)
{
- struct pb_fence_ops *ops = fenced_list->ops;
- struct list_head *curr, *next;
- struct fenced_buffer *fenced_buf;
+ struct fenced_manager *fenced_mgr = fenced_manager(mgr);
- pipe_mutex_lock(fenced_list->mutex);
+ pipe_mutex_lock(fenced_mgr->mutex);
+ while(fenced_manager_check_signalled_locked(fenced_mgr, TRUE))
+ ;
+ pipe_mutex_unlock(fenced_mgr->mutex);
- debug_printf("%10s %7s %7s %10s %s\n",
- "buffer", "size", "refcount", "fence", "signalled");
-
- curr = fenced_list->unfenced.next;
- next = curr->next;
- while(curr != &fenced_list->unfenced) {
- fenced_buf = LIST_ENTRY(struct fenced_buffer, curr, head);
- assert(!fenced_buf->fence);
- debug_printf("%10p %7u %7u\n",
- (void *) fenced_buf,
- fenced_buf->base.base.size,
- p_atomic_read(&fenced_buf->base.base.reference.count));
- curr = next;
- next = curr->next;
- }
-
- curr = fenced_list->delayed.next;
- next = curr->next;
- while(curr != &fenced_list->delayed) {
- int signaled;
- fenced_buf = LIST_ENTRY(struct fenced_buffer, curr, head);
- signaled = ops->fence_signalled(ops, fenced_buf->fence, 0);
- debug_printf("%10p %7u %7u %10p %s\n",
- (void *) fenced_buf,
- fenced_buf->base.base.size,
- p_atomic_read(&fenced_buf->base.base.reference.count),
- (void *) fenced_buf->fence,
- signaled == 0 ? "y" : "n");
- curr = next;
- next = curr->next;
- }
-
- pipe_mutex_unlock(fenced_list->mutex);
+ assert(fenced_mgr->provider->flush);
+ if(fenced_mgr->provider->flush)
+ fenced_mgr->provider->flush(fenced_mgr->provider);
}
-#endif
-void
-fenced_buffer_list_destroy(struct fenced_buffer_list *fenced_list)
+static void
+fenced_bufmgr_destroy(struct pb_manager *mgr)
{
- pipe_mutex_lock(fenced_list->mutex);
+ struct fenced_manager *fenced_mgr = fenced_manager(mgr);
+
+ pipe_mutex_lock(fenced_mgr->mutex);
/* Wait on outstanding fences */
- while (fenced_list->numDelayed) {
- pipe_mutex_unlock(fenced_list->mutex);
+ while (fenced_mgr->num_fenced) {
+ pipe_mutex_unlock(fenced_mgr->mutex);
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
sched_yield();
#endif
- _fenced_buffer_list_check_free(fenced_list, 1);
- pipe_mutex_lock(fenced_list->mutex);
+ pipe_mutex_lock(fenced_mgr->mutex);
+ while(fenced_manager_check_signalled_locked(fenced_mgr, TRUE))
+ ;
}
#ifdef DEBUG
- /*assert(!fenced_list->numUnfenced);*/
+ /*assert(!fenced_mgr->num_unfenced);*/
#endif
-
- pipe_mutex_unlock(fenced_list->mutex);
-
- fenced_list->ops->destroy(fenced_list->ops);
-
- FREE(fenced_list);
+
+ pipe_mutex_unlock(fenced_mgr->mutex);
+ pipe_mutex_destroy(fenced_mgr->mutex);
+
+ if(fenced_mgr->provider)
+ fenced_mgr->provider->destroy(fenced_mgr->provider);
+
+ fenced_mgr->ops->destroy(fenced_mgr->ops);
+
+ FREE(fenced_mgr);
}
+struct pb_manager *
+fenced_bufmgr_create(struct pb_manager *provider,
+ struct pb_fence_ops *ops,
+ pb_size max_buffer_size,
+ pb_size max_cpu_total_size)
+{
+ struct fenced_manager *fenced_mgr;
+
+ if(!provider)
+ return NULL;
+
+ fenced_mgr = CALLOC_STRUCT(fenced_manager);
+ if (!fenced_mgr)
+ return NULL;
+
+ fenced_mgr->base.destroy = fenced_bufmgr_destroy;
+ fenced_mgr->base.create_buffer = fenced_bufmgr_create_buffer;
+ fenced_mgr->base.flush = fenced_bufmgr_flush;
+
+ fenced_mgr->provider = provider;
+ fenced_mgr->ops = ops;
+ fenced_mgr->max_buffer_size = max_buffer_size;
+ fenced_mgr->max_cpu_total_size = max_cpu_total_size;
+
+ LIST_INITHEAD(&fenced_mgr->fenced);
+ fenced_mgr->num_fenced = 0;
+
+ LIST_INITHEAD(&fenced_mgr->unfenced);
+ fenced_mgr->num_unfenced = 0;
+
+ pipe_mutex_init(fenced_mgr->mutex);
+
+ return &fenced_mgr->base;
+}
diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.h b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.h
index 034ca1e024a..0372f81d0a1 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.h
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.h
@@ -98,43 +98,6 @@ struct pb_fence_ops
};
-/**
- * Create a fenced buffer list.
- *
- * See also fenced_bufmgr_create for a more convenient way to use this.
- */
-struct fenced_buffer_list *
-fenced_buffer_list_create(struct pb_fence_ops *ops);
-
-
-/**
- * Walk the fenced buffer list to check and free signalled buffers.
- */
-void
-fenced_buffer_list_check_free(struct fenced_buffer_list *fenced_list,
- int wait);
-
-
-#ifdef DEBUG
-void
-fenced_buffer_list_dump(struct fenced_buffer_list *fenced_list);
-#endif
-
-
-void
-fenced_buffer_list_destroy(struct fenced_buffer_list *fenced_list);
-
-
-/**
- * Wrap a buffer in a fenced buffer.
- *
- * NOTE: this will not increase the buffer reference count.
- */
-struct pb_buffer *
-fenced_buffer_create(struct fenced_buffer_list *fenced,
- struct pb_buffer *buffer);
-
-
#ifdef __cplusplus
}
#endif
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h b/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h
index 8c8d7130781..06669917ff6 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h
@@ -175,7 +175,9 @@ struct pb_fence_ops;
*/
struct pb_manager *
fenced_bufmgr_create(struct pb_manager *provider,
- struct pb_fence_ops *ops);
+ struct pb_fence_ops *ops,
+ pb_size max_buffer_size,
+ pb_size max_cpu_total_size);
struct pb_manager *
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
index 6e3214ca9c9..8f74180a111 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
@@ -371,6 +371,9 @@ pb_debug_manager_create_buffer(struct pb_manager *_mgr,
struct pb_desc real_desc;
pb_size real_size;
+ assert(size);
+ assert(desc->alignment);
+
buf = CALLOC_STRUCT(pb_debug_buffer);
if(!buf)
return NULL;
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_fenced.c
deleted file mode 100644
index 97dd1427fda..00000000000
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_fenced.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2006 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
- * A buffer manager that wraps buffers in fenced buffers.
- *
- * \author Jose Fonseca <[email protected]>
- */
-
-
-#include "util/u_debug.h"
-#include "util/u_memory.h"
-
-#include "pb_buffer.h"
-#include "pb_buffer_fenced.h"
-#include "pb_bufmgr.h"
-
-
-struct fenced_pb_manager
-{
- struct pb_manager base;
-
- struct pb_manager *provider;
-
- struct fenced_buffer_list *fenced_list;
-};
-
-
-static INLINE struct fenced_pb_manager *
-fenced_pb_manager(struct pb_manager *mgr)
-{
- assert(mgr);
- return (struct fenced_pb_manager *)mgr;
-}
-
-
-static struct pb_buffer *
-fenced_bufmgr_create_buffer(struct pb_manager *mgr,
- pb_size size,
- const struct pb_desc *desc)
-{
- struct fenced_pb_manager *fenced_mgr = fenced_pb_manager(mgr);
- struct pb_buffer *buf;
- struct pb_buffer *fenced_buf;
-
- /* check for free buffers before allocating new ones */
- fenced_buffer_list_check_free(fenced_mgr->fenced_list, 0);
-
- buf = fenced_mgr->provider->create_buffer(fenced_mgr->provider, size, desc);
- if(!buf) {
- /* try harder to get a buffer */
- fenced_buffer_list_check_free(fenced_mgr->fenced_list, 1);
-
- buf = fenced_mgr->provider->create_buffer(fenced_mgr->provider, size, desc);
- if(!buf) {
-#if 0
- fenced_buffer_list_dump(fenced_mgr->fenced_list);
-#endif
-
- /* give up */
- return NULL;
- }
- }
-
- fenced_buf = fenced_buffer_create(fenced_mgr->fenced_list, buf);
- if(!fenced_buf) {
- pb_reference(&buf, NULL);
- }
-
- return fenced_buf;
-}
-
-
-static void
-fenced_bufmgr_flush(struct pb_manager *mgr)
-{
- struct fenced_pb_manager *fenced_mgr = fenced_pb_manager(mgr);
-
- fenced_buffer_list_check_free(fenced_mgr->fenced_list, TRUE);
-
- assert(fenced_mgr->provider->flush);
- if(fenced_mgr->provider->flush)
- fenced_mgr->provider->flush(fenced_mgr->provider);
-}
-
-
-static void
-fenced_bufmgr_destroy(struct pb_manager *mgr)
-{
- struct fenced_pb_manager *fenced_mgr = fenced_pb_manager(mgr);
-
- fenced_buffer_list_destroy(fenced_mgr->fenced_list);
-
- if(fenced_mgr->provider)
- fenced_mgr->provider->destroy(fenced_mgr->provider);
-
- FREE(fenced_mgr);
-}
-
-
-struct pb_manager *
-fenced_bufmgr_create(struct pb_manager *provider,
- struct pb_fence_ops *ops)
-{
- struct fenced_pb_manager *fenced_mgr;
-
- if(!provider)
- return NULL;
-
- fenced_mgr = CALLOC_STRUCT(fenced_pb_manager);
- if (!fenced_mgr)
- return NULL;
-
- fenced_mgr->base.destroy = fenced_bufmgr_destroy;
- fenced_mgr->base.create_buffer = fenced_bufmgr_create_buffer;
- fenced_mgr->base.flush = fenced_bufmgr_flush;
-
- fenced_mgr->provider = provider;
- fenced_mgr->fenced_list = fenced_buffer_list_create(ops);
- if(!fenced_mgr->fenced_list) {
- FREE(fenced_mgr);
- return NULL;
- }
-
- return &fenced_mgr->base;
-}
diff --git a/src/gallium/auxiliary/pipebuffer/pb_validate.c b/src/gallium/auxiliary/pipebuffer/pb_validate.c
index ce40c0cf0e6..903afc749d3 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_validate.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_validate.c
@@ -39,7 +39,6 @@
#include "util/u_debug.h"
#include "pb_buffer.h"
-#include "pb_buffer_fenced.h"
#include "pb_validate.h"
diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c b/src/gallium/auxiliary/tgsi/tgsi_build.c
index de9cbc86305..e38b0be7ab5 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_build.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_build.c
@@ -103,6 +103,7 @@ tgsi_default_declaration( void )
declaration.File = TGSI_FILE_NULL;
declaration.UsageMask = TGSI_WRITEMASK_XYZW;
declaration.Interpolate = TGSI_INTERPOLATE_CONSTANT;
+ declaration.Dimension = 0;
declaration.Semantic = 0;
declaration.Centroid = 0;
declaration.Invariant = 0;
@@ -116,6 +117,7 @@ tgsi_build_declaration(
unsigned file,
unsigned usage_mask,
unsigned interpolate,
+ unsigned dimension,
unsigned semantic,
unsigned centroid,
unsigned invariant,
@@ -130,6 +132,7 @@ tgsi_build_declaration(
declaration.File = file;
declaration.UsageMask = usage_mask;
declaration.Interpolate = interpolate;
+ declaration.Dimension = dimension;
declaration.Semantic = semantic;
declaration.Centroid = centroid;
declaration.Invariant = invariant;
@@ -183,6 +186,7 @@ tgsi_build_full_declaration(
full_decl->Declaration.File,
full_decl->Declaration.UsageMask,
full_decl->Declaration.Interpolate,
+ full_decl->Declaration.Dimension,
full_decl->Declaration.Semantic,
full_decl->Declaration.Centroid,
full_decl->Declaration.Invariant,
@@ -199,6 +203,20 @@ tgsi_build_full_declaration(
declaration,
header );
+ if (full_decl->Declaration.Dimension) {
+ struct tgsi_declaration_dimension *dd;
+
+ if (maxsize <= size) {
+ return 0;
+ }
+ dd = (struct tgsi_declaration_dimension *)&tokens[size];
+ size++;
+
+ *dd = tgsi_build_declaration_dimension(full_decl->Dim.Index2D,
+ declaration,
+ header);
+ }
+
if( full_decl->Declaration.Semantic ) {
struct tgsi_declaration_semantic *ds;
@@ -249,6 +267,34 @@ tgsi_build_declaration_range(
return declaration_range;
}
+struct tgsi_declaration_dimension
+tgsi_default_declaration_dimension(void)
+{
+ struct tgsi_declaration_dimension dd;
+
+ dd.Index2D = 0;
+ dd.Padding = 0;
+
+ return dd;
+}
+
+struct tgsi_declaration_dimension
+tgsi_build_declaration_dimension(unsigned index_2d,
+ struct tgsi_declaration *declaration,
+ struct tgsi_header *header)
+{
+ struct tgsi_declaration_dimension dd;
+
+ assert(index_2d <= 0xFFFF);
+
+ dd = tgsi_default_declaration_dimension();
+ dd.Index2D = index_2d;
+
+ declaration_grow(declaration, header);
+
+ return dd;
+}
+
struct tgsi_declaration_semantic
tgsi_default_declaration_semantic( void )
{
diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.h b/src/gallium/auxiliary/tgsi/tgsi_build.h
index 9de2757fe40..ebee4ce5f6a 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_build.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_build.h
@@ -64,6 +64,7 @@ tgsi_build_declaration(
unsigned file,
unsigned usage_mask,
unsigned interpolate,
+ unsigned dimension,
unsigned semantic,
unsigned centroid,
unsigned invariant,
@@ -89,6 +90,14 @@ tgsi_build_declaration_range(
struct tgsi_declaration *declaration,
struct tgsi_header *header );
+struct tgsi_declaration_dimension
+tgsi_default_declaration_dimension(void);
+
+struct tgsi_declaration_dimension
+tgsi_build_declaration_dimension(unsigned index_2d,
+ struct tgsi_declaration *declaration,
+ struct tgsi_header *header);
+
struct tgsi_declaration_semantic
tgsi_default_declaration_semantic( void );
diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c
index c254a7274f1..5472466eb69 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_dump.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c
@@ -178,29 +178,6 @@ static const char *primitive_names[] =
static void
-_dump_register_decl(
- struct dump_ctx *ctx,
- uint file,
- int first,
- int last )
-{
- ENM( file, file_names );
-
- /* all geometry shader inputs are two dimensional */
- if (file == TGSI_FILE_INPUT &&
- ctx->iter.processor.Processor == TGSI_PROCESSOR_GEOMETRY)
- TXT("[]");
-
- CHR( '[' );
- SID( first );
- if (first != last) {
- TXT( ".." );
- SID( last );
- }
- CHR( ']' );
-}
-
-static void
_dump_register_dst(
struct dump_ctx *ctx,
uint file,
@@ -299,11 +276,28 @@ iter_declaration(
TXT( "DCL " );
- _dump_register_decl(
- ctx,
- decl->Declaration.File,
- decl->Range.First,
- decl->Range.Last );
+ ENM(decl->Declaration.File, file_names);
+
+ /* all geometry shader inputs are two dimensional */
+ if (decl->Declaration.File == TGSI_FILE_INPUT &&
+ iter->processor.Processor == TGSI_PROCESSOR_GEOMETRY) {
+ TXT("[]");
+ }
+
+ if (decl->Declaration.Dimension) {
+ CHR('[');
+ SID(decl->Dim.Index2D);
+ CHR(']');
+ }
+
+ CHR('[');
+ SID(decl->Range.First);
+ if (decl->Range.First != decl->Range.Last) {
+ TXT("..");
+ SID(decl->Range.Last);
+ }
+ CHR(']');
+
_dump_writemask(
ctx,
decl->Declaration.UsageMask );
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index 83646b73c1e..fbb9aa0e63a 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -953,107 +953,90 @@ micro_sub(
}
static void
-fetch_src_file_channel(
- const struct tgsi_exec_machine *mach,
- const uint file,
- const uint swizzle,
- const union tgsi_exec_channel *index,
- union tgsi_exec_channel *chan )
-{
- switch( swizzle ) {
- case TGSI_SWIZZLE_X:
- case TGSI_SWIZZLE_Y:
- case TGSI_SWIZZLE_Z:
- case TGSI_SWIZZLE_W:
- switch( file ) {
- case TGSI_FILE_CONSTANT:
- assert(mach->Consts);
- if (index->i[0] < 0)
- chan->f[0] = 0.0f;
- else
- chan->f[0] = mach->Consts[index->i[0]][swizzle];
- if (index->i[1] < 0)
- chan->f[1] = 0.0f;
- else
- chan->f[1] = mach->Consts[index->i[1]][swizzle];
- if (index->i[2] < 0)
- chan->f[2] = 0.0f;
- else
- chan->f[2] = mach->Consts[index->i[2]][swizzle];
- if (index->i[3] < 0)
- chan->f[3] = 0.0f;
- else
- chan->f[3] = mach->Consts[index->i[3]][swizzle];
- break;
+fetch_src_file_channel(const struct tgsi_exec_machine *mach,
+ const uint file,
+ const uint swizzle,
+ const union tgsi_exec_channel *index,
+ const union tgsi_exec_channel *index2D,
+ union tgsi_exec_channel *chan)
+{
+ uint i;
- case TGSI_FILE_INPUT:
- case TGSI_FILE_SYSTEM_VALUE:
- chan->u[0] = mach->Inputs[index->i[0]].xyzw[swizzle].u[0];
- chan->u[1] = mach->Inputs[index->i[1]].xyzw[swizzle].u[1];
- chan->u[2] = mach->Inputs[index->i[2]].xyzw[swizzle].u[2];
- chan->u[3] = mach->Inputs[index->i[3]].xyzw[swizzle].u[3];
- break;
+ switch (file) {
+ case TGSI_FILE_CONSTANT:
+ for (i = 0; i < QUAD_SIZE; i++) {
+ assert(index2D->i[i] >= 0 && index2D->i[i] < PIPE_MAX_CONSTANT_BUFFERS);
+ assert(mach->Consts[index2D->i[i]]);
- case TGSI_FILE_TEMPORARY:
- assert(index->i[0] < TGSI_EXEC_NUM_TEMPS);
- chan->u[0] = mach->Temps[index->i[0]].xyzw[swizzle].u[0];
- chan->u[1] = mach->Temps[index->i[1]].xyzw[swizzle].u[1];
- chan->u[2] = mach->Temps[index->i[2]].xyzw[swizzle].u[2];
- chan->u[3] = mach->Temps[index->i[3]].xyzw[swizzle].u[3];
- break;
+ if (index->i[i] < 0) {
+ chan->u[i] = 0;
+ } else {
+ const uint *p = (const uint *)mach->Consts[index2D->i[i]];
- case TGSI_FILE_IMMEDIATE:
- assert( index->i[0] < (int) mach->ImmLimit );
- chan->f[0] = mach->Imms[index->i[0]][swizzle];
- assert( index->i[1] < (int) mach->ImmLimit );
- chan->f[1] = mach->Imms[index->i[1]][swizzle];
- assert( index->i[2] < (int) mach->ImmLimit );
- chan->f[2] = mach->Imms[index->i[2]][swizzle];
- assert( index->i[3] < (int) mach->ImmLimit );
- chan->f[3] = mach->Imms[index->i[3]][swizzle];
- break;
+ chan->u[i] = p[index->i[i] * 4 + swizzle];
+ }
+ }
+ break;
- case TGSI_FILE_ADDRESS:
- chan->u[0] = mach->Addrs[index->i[0]].xyzw[swizzle].u[0];
- chan->u[1] = mach->Addrs[index->i[1]].xyzw[swizzle].u[1];
- chan->u[2] = mach->Addrs[index->i[2]].xyzw[swizzle].u[2];
- chan->u[3] = mach->Addrs[index->i[3]].xyzw[swizzle].u[3];
- break;
+ case TGSI_FILE_INPUT:
+ case TGSI_FILE_SYSTEM_VALUE:
+ for (i = 0; i < QUAD_SIZE; i++) {
+ /* XXX: 2D indexing */
+ chan->u[i] = mach->Inputs[index2D->i[i] * TGSI_EXEC_MAX_INPUT_ATTRIBS + index->i[i]].xyzw[swizzle].u[i];
+ }
+ break;
- case TGSI_FILE_PREDICATE:
- assert(index->i[0] < TGSI_EXEC_NUM_PREDS);
- assert(index->i[1] < TGSI_EXEC_NUM_PREDS);
- assert(index->i[2] < TGSI_EXEC_NUM_PREDS);
- assert(index->i[3] < TGSI_EXEC_NUM_PREDS);
- chan->u[0] = mach->Predicates[0].xyzw[swizzle].u[0];
- chan->u[1] = mach->Predicates[0].xyzw[swizzle].u[1];
- chan->u[2] = mach->Predicates[0].xyzw[swizzle].u[2];
- chan->u[3] = mach->Predicates[0].xyzw[swizzle].u[3];
- break;
+ case TGSI_FILE_TEMPORARY:
+ for (i = 0; i < QUAD_SIZE; i++) {
+ assert(index->i[i] < TGSI_EXEC_NUM_TEMPS);
+ assert(index2D->i[i] == 0);
- case TGSI_FILE_OUTPUT:
- /* vertex/fragment output vars can be read too */
- chan->u[0] = mach->Outputs[index->i[0]].xyzw[swizzle].u[0];
- chan->u[1] = mach->Outputs[index->i[1]].xyzw[swizzle].u[1];
- chan->u[2] = mach->Outputs[index->i[2]].xyzw[swizzle].u[2];
- chan->u[3] = mach->Outputs[index->i[3]].xyzw[swizzle].u[3];
- break;
+ chan->u[i] = mach->Temps[index->i[i]].xyzw[swizzle].u[i];
+ }
+ break;
- default:
- assert( 0 );
- chan->u[0] = 0;
- chan->u[1] = 0;
- chan->u[2] = 0;
- chan->u[3] = 0;
+ case TGSI_FILE_IMMEDIATE:
+ for (i = 0; i < QUAD_SIZE; i++) {
+ assert(index->i[i] >= 0 && index->i[i] < (int)mach->ImmLimit);
+ assert(index2D->i[i] == 0);
+
+ chan->f[i] = mach->Imms[index->i[i]][swizzle];
+ }
+ break;
+
+ case TGSI_FILE_ADDRESS:
+ for (i = 0; i < QUAD_SIZE; i++) {
+ assert(index->i[i] >= 0);
+ assert(index2D->i[i] == 0);
+
+ chan->u[i] = mach->Addrs[index->i[i]].xyzw[swizzle].u[i];
+ }
+ break;
+
+ case TGSI_FILE_PREDICATE:
+ for (i = 0; i < QUAD_SIZE; i++) {
+ assert(index->i[i] >= 0 && index->i[i] < TGSI_EXEC_NUM_PREDS);
+ assert(index2D->i[i] == 0);
+
+ chan->u[i] = mach->Predicates[0].xyzw[swizzle].u[i];
+ }
+ break;
+
+ case TGSI_FILE_OUTPUT:
+ /* vertex/fragment output vars can be read too */
+ for (i = 0; i < QUAD_SIZE; i++) {
+ assert(index->i[i] >= 0);
+ assert(index2D->i[i] == 0);
+
+ chan->u[i] = mach->Outputs[index->i[i]].xyzw[swizzle].u[i];
}
break;
default:
- assert( 0 );
- chan->u[0] = 0;
- chan->u[1] = 0;
- chan->u[2] = 0;
- chan->u[3] = 0;
+ assert(0);
+ for (i = 0; i < QUAD_SIZE; i++) {
+ chan->u[i] = 0;
+ }
}
}
@@ -1065,6 +1048,7 @@ fetch_source(const struct tgsi_exec_machine *mach,
enum tgsi_exec_datatype src_datatype)
{
union tgsi_exec_channel index;
+ union tgsi_exec_channel index2D;
uint swizzle;
/* We start with a direct index into a register file.
@@ -1103,12 +1087,12 @@ fetch_source(const struct tgsi_exec_machine *mach,
/* get current value of address register[swizzle] */
swizzle = tgsi_util_get_src_register_swizzle( &reg->Indirect, CHAN_X );
- fetch_src_file_channel(
- mach,
- reg->Indirect.File,
- swizzle,
- &index2,
- &indir_index );
+ fetch_src_file_channel(mach,
+ reg->Indirect.File,
+ swizzle,
+ &index2,
+ &ZeroVec,
+ &indir_index);
/* add value of address register to the offset */
index.i[0] += indir_index.i[0];
@@ -1129,35 +1113,15 @@ fetch_source(const struct tgsi_exec_machine *mach,
* subscript to a register file. Effectively it means that
* the register file is actually a 2D array of registers.
*
- * file[3][1] == file[3*sizeof(file[1])+1],
+ * file[3][1],
* where:
* [3] = Dimension.Index
*/
if (reg->Register.Dimension) {
- int array_size;
- union tgsi_exec_channel dim_index;
-
- /* The size of the first-order array depends on the register file type.
- * We need to multiply the index to the first array to get an effective,
- * "flat" index that points to the beginning of the second-order array.
- */
- switch (reg->Register.File) {
- case TGSI_FILE_INPUT:
- case TGSI_FILE_SYSTEM_VALUE:
- array_size = TGSI_EXEC_MAX_INPUT_ATTRIBS;
- break;
- case TGSI_FILE_CONSTANT:
- array_size = TGSI_EXEC_MAX_CONST_BUFFER;
- break;
- default:
- assert( 0 );
- array_size = 0;
- }
-
- dim_index.i[0] =
- dim_index.i[1] =
- dim_index.i[2] =
- dim_index.i[3] = reg->Dimension.Index;
+ index2D.i[0] =
+ index2D.i[1] =
+ index2D.i[2] =
+ index2D.i[3] = reg->Dimension.Index;
/* Again, the second subscript index can be addressed indirectly
* identically to the first one.
@@ -1182,45 +1146,46 @@ fetch_source(const struct tgsi_exec_machine *mach,
index2.i[3] = reg->DimIndirect.Index;
swizzle = tgsi_util_get_src_register_swizzle( &reg->DimIndirect, CHAN_X );
- fetch_src_file_channel(
- mach,
- reg->DimIndirect.File,
- swizzle,
- &index2,
- &indir_index );
-
- dim_index.i[0] += indir_index.i[0];
- dim_index.i[1] += indir_index.i[1];
- dim_index.i[2] += indir_index.i[2];
- dim_index.i[3] += indir_index.i[3];
+ fetch_src_file_channel(mach,
+ reg->DimIndirect.File,
+ swizzle,
+ &index2,
+ &ZeroVec,
+ &indir_index);
+
+ index2D.i[0] += indir_index.i[0];
+ index2D.i[1] += indir_index.i[1];
+ index2D.i[2] += indir_index.i[2];
+ index2D.i[3] += indir_index.i[3];
/* for disabled execution channels, zero-out the index to
* avoid using a potential garbage value.
*/
for (i = 0; i < QUAD_SIZE; i++) {
- if ((execmask & (1 << i)) == 0)
- dim_index.i[i] = 0;
+ if ((execmask & (1 << i)) == 0) {
+ index2D.i[i] = 0;
+ }
}
}
- index.i[0] += dim_index.i[0] * array_size;
- index.i[1] += dim_index.i[1] * array_size;
- index.i[2] += dim_index.i[2] * array_size;
- index.i[3] += dim_index.i[3] * array_size;
-
/* If by any chance there was a need for a 3D array of register
* files, we would have to check whether Dimension is followed
* by a dimension register and continue the saga.
*/
+ } else {
+ index2D.i[0] =
+ index2D.i[1] =
+ index2D.i[2] =
+ index2D.i[3] = 0;
}
swizzle = tgsi_util_get_full_src_register_swizzle( reg, chan_index );
- fetch_src_file_channel(
- mach,
- reg->Register.File,
- swizzle,
- &index,
- chan );
+ fetch_src_file_channel(mach,
+ reg->Register.File,
+ swizzle,
+ &index,
+ &index2D,
+ chan);
if (reg->Register.Absolute) {
if (src_datatype == TGSI_EXEC_DATA_FLOAT) {
@@ -1283,12 +1248,12 @@ store_dest(struct tgsi_exec_machine *mach,
swizzle = tgsi_util_get_src_register_swizzle( &reg->Indirect, CHAN_X );
/* fetch values from the address/indirection register */
- fetch_src_file_channel(
- mach,
- reg->Indirect.File,
- swizzle,
- &index,
- &indir_index );
+ fetch_src_file_channel(mach,
+ reg->Indirect.File,
+ swizzle,
+ &index,
+ &ZeroVec,
+ &indir_index);
/* save indirection offset */
offset = indir_index.i[0];
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h b/src/gallium/auxiliary/tgsi/tgsi_exec.h
index 59e3b445cc3..a22873e4c2b 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h
@@ -260,7 +260,7 @@ struct tgsi_exec_machine
struct tgsi_sampler **Samplers;
unsigned ImmLimit;
- const float (*Consts)[4];
+ const void *Consts[PIPE_MAX_CONSTANT_BUFFERS];
const struct tgsi_token *Tokens; /**< Declarations, instructions */
unsigned Processor; /**< TGSI_PROCESSOR_x */
diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.c b/src/gallium/auxiliary/tgsi/tgsi_parse.c
index 8c7062d850c..fd37fc3079b 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_parse.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_parse.c
@@ -109,6 +109,10 @@ tgsi_parse_token(
next_token( ctx, &decl->Range );
+ if (decl->Declaration.Dimension) {
+ next_token(ctx, &decl->Dim);
+ }
+
if( decl->Declaration.Semantic ) {
next_token( ctx, &decl->Semantic );
}
diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.h b/src/gallium/auxiliary/tgsi/tgsi_parse.h
index 439a57269b7..8150e3cd29d 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_parse.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_parse.h
@@ -58,6 +58,7 @@ struct tgsi_full_declaration
{
struct tgsi_declaration Declaration;
struct tgsi_declaration_range Range;
+ struct tgsi_declaration_dimension Dim;
struct tgsi_declaration_semantic Semantic;
};
diff --git a/src/gallium/auxiliary/tgsi/tgsi_sanity.c b/src/gallium/auxiliary/tgsi/tgsi_sanity.c
index 431c3ffb142..91e1b27da12 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_sanity.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_sanity.c
@@ -413,7 +413,11 @@ iter_declaration(
}
} else {
scan_register *reg = MALLOC(sizeof(scan_register));
- fill_scan_register1d(reg, file, i);
+ if (decl->Declaration.Dimension) {
+ fill_scan_register2d(reg, file, i, decl->Dim.Index2D);
+ } else {
+ fill_scan_register1d(reg, file, i);
+ }
check_and_declare(ctx, reg);
}
}
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index a6cc773003a..b9be8dc0a31 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -101,12 +101,10 @@ tgsi_scan_shader(const struct tgsi_token *tokens,
src->Register.File == TGSI_FILE_SYSTEM_VALUE) {
const int ind = src->Register.Index;
if (info->input_semantic_name[ind] == TGSI_SEMANTIC_FOG) {
- if (src->Register.SwizzleX == TGSI_SWIZZLE_X) {
- info->uses_fogcoord = TRUE;
- }
- else if (src->Register.SwizzleX == TGSI_SWIZZLE_Y) {
- info->uses_frontfacing = TRUE;
- }
+ info->uses_fogcoord = TRUE;
+ }
+ else if (info->input_semantic_name[ind] == TGSI_SEMANTIC_FACE) {
+ info->uses_frontfacing = TRUE;
}
}
}
diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c
index 7fe5dad5ffb..f74b56bfb5f 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_text.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
@@ -553,7 +553,7 @@ parse_register_dcl_bracket(
report_error( ctx, "Expected literal unsigned integer" );
return FALSE;
}
- bracket->first = (int) uindex;
+ bracket->first = uindex;
eat_opt_white( &ctx->cur );
@@ -617,10 +617,12 @@ parse_register_dcl(
* input primitive. so we want to declare just
* the index relevant to the semantics which is in
* the second bracket */
- if (ctx->processor == TGSI_PROCESSOR_GEOMETRY) {
+ if (ctx->processor == TGSI_PROCESSOR_GEOMETRY && *file == TGSI_FILE_INPUT) {
brackets[0] = brackets[1];
+ *num_brackets = 1;
+ } else {
+ *num_brackets = 2;
}
- *num_brackets = 2;
}
return TRUE;
@@ -738,6 +740,13 @@ parse_src_operand(
return FALSE;
src->Register.File = file;
+ if (parsed_opt_brackets) {
+ src->Register.Dimension = 1;
+ src->Dimension.Indirect = 0;
+ src->Dimension.Dimension = 0;
+ src->Dimension.Index = bracket[0].index;
+ bracket[0] = bracket[1];
+ }
src->Register.Index = bracket[0].index;
if (bracket[0].ind_file != TGSI_FILE_NULL) {
src->Register.Indirect = 1;
@@ -748,12 +757,6 @@ parse_src_operand(
src->Indirect.SwizzleZ = bracket[0].ind_comp;
src->Indirect.SwizzleW = bracket[0].ind_comp;
}
- if (parsed_opt_brackets) {
- src->Register.Dimension = 1;
- src->Dimension.Indirect = 0;
- src->Dimension.Dimension = 0;
- src->Dimension.Index = bracket[1].index;
- }
/* Parse optional swizzle.
*/
@@ -969,8 +972,17 @@ static boolean parse_declaration( struct translate_ctx *ctx )
decl = tgsi_default_full_declaration();
decl.Declaration.File = file;
decl.Declaration.UsageMask = writemask;
- decl.Range.First = brackets[0].first;
- decl.Range.Last = brackets[0].last;
+
+ if (num_brackets == 1) {
+ decl.Range.First = brackets[0].first;
+ decl.Range.Last = brackets[0].last;
+ } else {
+ decl.Range.First = brackets[1].first;
+ decl.Range.Last = brackets[1].last;
+
+ decl.Declaration.Dimension = 1;
+ decl.Dim.Index2D = brackets[0].first;
+ }
cur = ctx->cur;
eat_opt_white( &cur );
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
index ab557a23f94..f2610d07644 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -44,6 +44,7 @@ union tgsi_any_token {
struct tgsi_property_data prop_data;
struct tgsi_declaration decl;
struct tgsi_declaration_range decl_range;
+ struct tgsi_declaration_dimension decl_dim;
struct tgsi_declaration_semantic decl_semantic;
struct tgsi_immediate imm;
union tgsi_immediate_data imm_data;
@@ -75,6 +76,14 @@ struct ureg_tokens {
#define UREG_MAX_LOOP 1
#define UREG_MAX_PRED 1
+struct const_decl {
+ struct {
+ unsigned first;
+ unsigned last;
+ } constant_range[UREG_MAX_CONSTANT_RANGE];
+ unsigned nr_constant_ranges;
+};
+
#define DOMAIN_DECL 0
#define DOMAIN_INSN 1
@@ -127,13 +136,12 @@ struct ureg_program
unsigned temps_active[UREG_MAX_TEMP / 32];
unsigned nr_temps;
- struct {
- unsigned first;
- unsigned last;
- } constant_range[UREG_MAX_CONSTANT_RANGE];
- unsigned nr_constant_ranges;
+ struct const_decl const_decls;
+ struct const_decl const_decls2D[PIPE_MAX_CONSTANT_BUFFERS];
unsigned property_gs_input_prim;
+ unsigned property_gs_output_prim;
+ unsigned property_gs_max_vertices;
unsigned nr_addrs;
unsigned nr_preds;
@@ -235,37 +243,26 @@ ureg_dst_register( unsigned file,
return dst;
}
-static INLINE struct ureg_src
-ureg_src_register( unsigned file,
- unsigned index )
+
+void
+ureg_property_gs_input_prim(struct ureg_program *ureg,
+ unsigned input_prim)
{
- struct ureg_src src;
-
- src.File = file;
- src.SwizzleX = TGSI_SWIZZLE_X;
- src.SwizzleY = TGSI_SWIZZLE_Y;
- src.SwizzleZ = TGSI_SWIZZLE_Z;
- src.SwizzleW = TGSI_SWIZZLE_W;
- src.Indirect = 0;
- src.IndirectFile = TGSI_FILE_NULL;
- src.IndirectIndex = 0;
- src.IndirectSwizzle = 0;
- src.Absolute = 0;
- src.Index = index;
- src.Negate = 0;
- src.Dimension = 0;
- src.DimensionIndex = 0;
-
- return src;
+ ureg->property_gs_input_prim = input_prim;
}
-
+void
+ureg_property_gs_output_prim(struct ureg_program *ureg,
+ unsigned output_prim)
+{
+ ureg->property_gs_output_prim = output_prim;
+}
void
-ureg_property_gs_input_prim(struct ureg_program *ureg,
- unsigned gs_input_prim)
+ureg_property_gs_max_vertices(struct ureg_program *ureg,
+ unsigned max_vertices)
{
- ureg->property_gs_input_prim = gs_input_prim;
+ ureg->property_gs_max_vertices = max_vertices;
}
@@ -375,62 +372,92 @@ out:
/* Returns a new constant register. Keep track of which have been
* referred to so that we can emit decls later.
*
+ * Constant operands declared with this function must be addressed
+ * with a two-dimensional index.
+ *
* There is nothing in this code to bind this constant to any tracked
* value or manage any constant_buffer contents -- that's the
* resposibility of the calling code.
*/
-struct ureg_src ureg_DECL_constant(struct ureg_program *ureg,
- unsigned index )
+void
+ureg_DECL_constant2D(struct ureg_program *ureg,
+ unsigned first,
+ unsigned last,
+ unsigned index2D)
+{
+ struct const_decl *decl = &ureg->const_decls2D[index2D];
+
+ assert(index2D < PIPE_MAX_CONSTANT_BUFFERS);
+
+ if (decl->nr_constant_ranges < UREG_MAX_CONSTANT_RANGE) {
+ uint i = decl->nr_constant_ranges++;
+
+ decl->constant_range[i].first = first;
+ decl->constant_range[i].last = last;
+ }
+}
+
+
+/* A one-dimensional, depricated version of ureg_DECL_constant2D().
+ *
+ * Constant operands declared with this function must be addressed
+ * with a one-dimensional index.
+ */
+struct ureg_src
+ureg_DECL_constant(struct ureg_program *ureg,
+ unsigned index)
{
+ struct const_decl *decl = &ureg->const_decls;
unsigned minconst = index, maxconst = index;
unsigned i;
/* Inside existing range?
*/
- for (i = 0; i < ureg->nr_constant_ranges; i++) {
- if (ureg->constant_range[i].first <= index &&
- ureg->constant_range[i].last >= index)
+ for (i = 0; i < decl->nr_constant_ranges; i++) {
+ if (decl->constant_range[i].first <= index &&
+ decl->constant_range[i].last >= index) {
goto out;
+ }
}
/* Extend existing range?
*/
- for (i = 0; i < ureg->nr_constant_ranges; i++) {
- if (ureg->constant_range[i].last == index - 1) {
- ureg->constant_range[i].last = index;
+ for (i = 0; i < decl->nr_constant_ranges; i++) {
+ if (decl->constant_range[i].last == index - 1) {
+ decl->constant_range[i].last = index;
goto out;
}
- if (ureg->constant_range[i].first == index + 1) {
- ureg->constant_range[i].first = index;
+ if (decl->constant_range[i].first == index + 1) {
+ decl->constant_range[i].first = index;
goto out;
}
- minconst = MIN2(minconst, ureg->constant_range[i].first);
- maxconst = MAX2(maxconst, ureg->constant_range[i].last);
+ minconst = MIN2(minconst, decl->constant_range[i].first);
+ maxconst = MAX2(maxconst, decl->constant_range[i].last);
}
/* Create new range?
*/
- if (ureg->nr_constant_ranges < UREG_MAX_CONSTANT_RANGE) {
- i = ureg->nr_constant_ranges++;
- ureg->constant_range[i].first = index;
- ureg->constant_range[i].last = index;
+ if (decl->nr_constant_ranges < UREG_MAX_CONSTANT_RANGE) {
+ i = decl->nr_constant_ranges++;
+ decl->constant_range[i].first = index;
+ decl->constant_range[i].last = index;
goto out;
}
/* Collapse all ranges down to one:
*/
i = 0;
- ureg->constant_range[0].first = minconst;
- ureg->constant_range[0].last = maxconst;
- ureg->nr_constant_ranges = 1;
+ decl->constant_range[0].first = minconst;
+ decl->constant_range[0].last = maxconst;
+ decl->nr_constant_ranges = 1;
out:
- assert(i < ureg->nr_constant_ranges);
- assert(ureg->constant_range[i].first <= index);
- assert(ureg->constant_range[i].last >= index);
- return ureg_src_register( TGSI_FILE_CONSTANT, index );
+ assert(i < decl->nr_constant_ranges);
+ assert(decl->constant_range[i].first <= index);
+ assert(decl->constant_range[i].last >= index);
+ return ureg_src_register(TGSI_FILE_CONSTANT, index);
}
@@ -579,7 +606,7 @@ decl_immediate( struct ureg_program *ureg,
unsigned type )
{
unsigned i, j;
- unsigned swizzle;
+ unsigned swizzle = 0;
/* Could do a first pass where we examine all existing immediates
* without expanding.
@@ -1088,6 +1115,31 @@ static void emit_decl_range( struct ureg_program *ureg,
}
static void
+emit_decl_range2D(struct ureg_program *ureg,
+ unsigned file,
+ unsigned first,
+ unsigned last,
+ unsigned index2D)
+{
+ union tgsi_any_token *out = get_tokens(ureg, DOMAIN_DECL, 3);
+
+ out[0].value = 0;
+ out[0].decl.Type = TGSI_TOKEN_TYPE_DECLARATION;
+ out[0].decl.NrTokens = 3;
+ out[0].decl.File = file;
+ out[0].decl.UsageMask = 0xf;
+ out[0].decl.Interpolate = TGSI_INTERPOLATE_CONSTANT;
+ out[0].decl.Dimension = 1;
+
+ out[1].value = 0;
+ out[1].decl_range.First = first;
+ out[1].decl_range.Last = last;
+
+ out[2].value = 0;
+ out[2].decl_dim.Index2D = index2D;
+}
+
+static void
emit_immediate( struct ureg_program *ureg,
const unsigned *v,
unsigned type )
@@ -1134,6 +1186,22 @@ static void emit_decls( struct ureg_program *ureg )
ureg->property_gs_input_prim);
}
+ if (ureg->property_gs_output_prim != ~0) {
+ assert(ureg->processor == TGSI_PROCESSOR_GEOMETRY);
+
+ emit_property(ureg,
+ TGSI_PROPERTY_GS_OUTPUT_PRIM,
+ ureg->property_gs_output_prim);
+ }
+
+ if (ureg->property_gs_max_vertices != ~0) {
+ assert(ureg->processor == TGSI_PROCESSOR_GEOMETRY);
+
+ emit_property(ureg,
+ TGSI_PROPERTY_GS_MAX_VERTICES,
+ ureg->property_gs_max_vertices);
+ }
+
if (ureg->processor == TGSI_PROCESSOR_VERTEX) {
for (i = 0; i < UREG_MAX_INPUT; i++) {
if (ureg->vs_inputs[i/32] & (1 << (i%32))) {
@@ -1182,13 +1250,29 @@ static void emit_decls( struct ureg_program *ureg )
ureg->sampler[i].Index, 1 );
}
- if (ureg->nr_constant_ranges) {
- for (i = 0; i < ureg->nr_constant_ranges; i++)
- emit_decl_range( ureg,
- TGSI_FILE_CONSTANT,
- ureg->constant_range[i].first,
- (ureg->constant_range[i].last + 1 -
- ureg->constant_range[i].first) );
+ if (ureg->const_decls.nr_constant_ranges) {
+ for (i = 0; i < ureg->const_decls.nr_constant_ranges; i++) {
+ emit_decl_range(ureg,
+ TGSI_FILE_CONSTANT,
+ ureg->const_decls.constant_range[i].first,
+ ureg->const_decls.constant_range[i].last - ureg->const_decls.constant_range[i].first + 1);
+ }
+ }
+
+ for (i = 0; i < PIPE_MAX_CONSTANT_BUFFERS; i++) {
+ struct const_decl *decl = &ureg->const_decls2D[i];
+
+ if (decl->nr_constant_ranges) {
+ uint j;
+
+ for (j = 0; j < decl->nr_constant_ranges; j++) {
+ emit_decl_range2D(ureg,
+ TGSI_FILE_CONSTANT,
+ decl->constant_range[j].first,
+ decl->constant_range[j].last,
+ i);
+ }
+ }
}
if (ureg->nr_temps) {
@@ -1344,6 +1428,8 @@ struct ureg_program *ureg_create( unsigned processor )
ureg->processor = processor;
ureg->property_gs_input_prim = ~0;
+ ureg->property_gs_output_prim = ~0;
+ ureg->property_gs_max_vertices = ~0;
return ureg;
}
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
index 8c8a6bbce66..2ac00deca17 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
@@ -126,7 +126,15 @@ ureg_create_shader_and_destroy( struct ureg_program *p,
void
ureg_property_gs_input_prim(struct ureg_program *ureg,
- unsigned gs_input_prim);
+ unsigned input_prim);
+
+void
+ureg_property_gs_output_prim(struct ureg_program *ureg,
+ unsigned output_prim);
+
+void
+ureg_property_gs_max_vertices(struct ureg_program *ureg,
+ unsigned max_vertices);
/***********************************************************************
@@ -178,6 +186,12 @@ ureg_DECL_immediate_int( struct ureg_program *,
const int *v,
unsigned nr );
+void
+ureg_DECL_constant2D(struct ureg_program *ureg,
+ unsigned first,
+ unsigned last,
+ unsigned index2D);
+
struct ureg_src
ureg_DECL_constant( struct ureg_program *,
unsigned index );
@@ -816,6 +830,30 @@ ureg_dst( struct ureg_src src )
}
static INLINE struct ureg_src
+ureg_src_register(unsigned file,
+ unsigned index)
+{
+ struct ureg_src src;
+
+ src.File = file;
+ src.SwizzleX = TGSI_SWIZZLE_X;
+ src.SwizzleY = TGSI_SWIZZLE_Y;
+ src.SwizzleZ = TGSI_SWIZZLE_Z;
+ src.SwizzleW = TGSI_SWIZZLE_W;
+ src.Indirect = 0;
+ src.IndirectFile = TGSI_FILE_NULL;
+ src.IndirectIndex = 0;
+ src.IndirectSwizzle = 0;
+ src.Absolute = 0;
+ src.Index = index;
+ src.Negate = 0;
+ src.Dimension = 0;
+ src.DimensionIndex = 0;
+
+ return src;
+}
+
+static INLINE struct ureg_src
ureg_src( struct ureg_dst dst )
{
struct ureg_src src;
diff --git a/src/gallium/auxiliary/tgsi/tgsi_util.c b/src/gallium/auxiliary/tgsi/tgsi_util.c
index f4ca9e21ed9..0a7e4105a80 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_util.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_util.c
@@ -28,7 +28,6 @@
#include "util/u_debug.h"
#include "pipe/p_shader_tokens.h"
#include "tgsi_parse.h"
-#include "tgsi_build.h"
#include "tgsi_util.h"
union pointer_hack
diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c
index ebc9d3415fc..eb63bec7b50 100644
--- a/src/gallium/auxiliary/util/u_blit.c
+++ b/src/gallium/auxiliary/util/u_blit.c
@@ -226,8 +226,8 @@ setup_vertex_data_tex(struct blit_state *ctx,
offset = get_next_slot( ctx );
- pipe_buffer_write(ctx->pipe->screen, ctx->vbuf,
- offset, sizeof(ctx->vertices), ctx->vertices);
+ pipe_buffer_write_nooverlap(ctx->pipe->screen, ctx->vbuf,
+ offset, sizeof(ctx->vertices), ctx->vertices);
return offset;
}
diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c
index 67027ec1a52..8611231ed70 100644
--- a/src/gallium/auxiliary/util/u_gen_mipmap.c
+++ b/src/gallium/auxiliary/util/u_gen_mipmap.c
@@ -1411,8 +1411,8 @@ set_vertex_data(struct gen_mipmap_state *ctx,
offset = get_next_slot( ctx );
- pipe_buffer_write(ctx->pipe->screen, ctx->vbuf,
- offset, sizeof(ctx->vertices), ctx->vertices);
+ pipe_buffer_write_nooverlap(ctx->pipe->screen, ctx->vbuf,
+ offset, sizeof(ctx->vertices), ctx->vertices);
return offset;
}
diff --git a/src/gallium/auxiliary/util/u_surface.c b/src/gallium/auxiliary/util/u_surface.c
index 35c49782043..f828908f0be 100644
--- a/src/gallium/auxiliary/util/u_surface.c
+++ b/src/gallium/auxiliary/util/u_surface.c
@@ -36,7 +36,6 @@
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
-#include "util/u_format.h"
#include "util/u_surface.h"
diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c
index f9936eb1cb2..c25e1e52e9d 100644
--- a/src/gallium/auxiliary/util/u_tile.c
+++ b/src/gallium/auxiliary/util/u_tile.c
@@ -390,7 +390,7 @@ a4r4g4b4_put_tile_rgba(ushort *dst,
g >>= 4;
b >>= 4;
a >>= 4;
- *dst++ = (a << 12) | (r << 16) | (g << 4) | b;
+ *dst++ = (a << 12) | (r << 8) | (g << 4) | b;
}
p += src_stride;
}
diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c b/src/gallium/auxiliary/util/u_upload_mgr.c
index 975ee89c455..55a65375c81 100644
--- a/src/gallium/auxiliary/util/u_upload_mgr.c
+++ b/src/gallium/auxiliary/util/u_upload_mgr.c
@@ -85,7 +85,9 @@ my_buffer_write(struct pipe_screen *screen,
map = pipe_buffer_map_range(screen, buf, offset, size,
PIPE_BUFFER_USAGE_CPU_WRITE |
- PIPE_BUFFER_USAGE_FLUSH_EXPLICIT);
+ PIPE_BUFFER_USAGE_FLUSH_EXPLICIT |
+ PIPE_BUFFER_USAGE_DISCARD |
+ PIPE_BUFFER_USAGE_UNSYNCHRONIZED);
if (map == NULL)
return PIPE_ERROR_OUT_OF_MEMORY;
diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst
index d394f5b4f1b..78b01cc9cbe 100644
--- a/src/gallium/docs/source/context.rst
+++ b/src/gallium/docs/source/context.rst
@@ -54,7 +54,10 @@ objects. They all follow simple, one-method binding calls, e.g.
* ``set_blend_color``
* ``set_clip_state``
* ``set_polygon_stipple``
-* ``set_scissor_state``
+* ``set_scissor_state`` sets the bounds for the scissor test, which culls
+ pixels before blending to render targets. If the :ref:`Rasterizer` does
+ 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``
@@ -149,6 +152,42 @@ Queries can be created with ``create_query`` and deleted with
use ``end_query`` to stop the query. Finally, ``get_query_result`` is used
to retrieve the results.
+A common type of query is the occlusion query which counts the number of
+fragments/pixels which are written to the framebuffer (and not culled by
+Z/stencil/alpha testing or shader KILL instructions).
+
+
+Conditional Rendering
+^^^^^^^^^^^^^^^^^^^^^
+
+A drawing command can be skipped depending on the outcome of a query
+(typically an occlusion query). The ``render_condition`` function specifies
+the query which should be checked prior to rendering anything.
+
+If ``render_condition`` is called with ``query`` = NULL, conditional
+rendering is disabled and drawing takes place normally.
+
+If ``render_condition`` is called with a non-null ``query`` subsequent
+drawing commands will be predicated on the outcome of the query. If
+the query result is zero subsequent drawing commands will be skipped.
+
+If ``mode`` is PIPE_RENDER_COND_WAIT the driver will wait for the
+query to complete before deciding whether to render.
+
+If ``mode`` is PIPE_RENDER_COND_NO_WAIT and the query has not yet
+completed, the drawing command will be executed normally. If the query
+has completed, drawing will be predicated on the outcome of the query.
+
+If ``mode`` is PIPE_RENDER_COND_BY_REGION_WAIT or
+PIPE_RENDER_COND_BY_REGION_NO_WAIT rendering will be predicated as above
+for the non-REGION modes but in the case that an occulusion query returns
+a non-zero result, regions which were occluded may be ommitted by subsequent
+drawing commands. This can result in better performance with some GPUs.
+Normally, if the occlusion query returned a non-zero result subsequent
+drawing happens normally so fragments may be generated, shaded and
+processed even where they're known to be obscured.
+
+
Flushing
^^^^^^^^
diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
index 72bb75a55dc..905ff24db99 100644
--- a/src/gallium/docs/source/screen.rst
+++ b/src/gallium/docs/source/screen.rst
@@ -6,6 +6,41 @@ A screen is an object representing the context-independent part of a device.
Useful Flags
------------
+.. _pipe_buffer_usage:
+
+PIPE_BUFFER_USAGE
+^^^^^^^^^^^^^^^^^
+
+These flags control buffer creation. Buffers may only have one role, so
+care should be taken to not allocate a buffer with the wrong usage.
+
+* ``PIXEL``: This is the flag to use for all textures.
+* ``VERTEX``: A vertex buffer.
+* ``INDEX``: An element buffer.
+* ``CONSTANT``: A buffer of shader constants.
+
+Buffers are inevitably abstracting the pipe's underlying memory management,
+so many of their usage flags can be used to direct the way the buffer is
+handled.
+
+* ``CPU_READ``, ``CPU_WRITE``: Whether the user will map and, in the case of
+ the latter, write to, the buffer. The convenience flag ``CPU_READ_WRITE`` is
+ available to signify a read/write buffer.
+* ``GPU_READ``, ``GPU_WRITE``: Whether the driver will internally need to
+ read from or write to the buffer. The latter will only happen if the buffer
+ is made into a render target.
+* ``DISCARD``: When set on a map, the contents of the map will be discarded
+ beforehand. Cannot be used with ``CPU_READ``.
+* ``DONTBLOCK``: When set on a map, the map will fail if the buffer cannot be
+ mapped immediately.
+* ``UNSYNCHRONIZED``: When set on a map, any outstanding operations on the
+ buffer will be ignored. The interaction of any writes to the map and any
+ operations pending with the buffer are undefined. Cannot be used with
+ ``CPU_READ``.
+* ``FLUSH_EXPLICIT``: When set on a map, written ranges of the map require
+ explicit flushes using :ref:`buffer_flush_mapped_range`. Requires
+ ``CPU_WRITE``.
+
.. _pipe_texture_usage:
PIPE_TEXTURE_USAGE
@@ -43,7 +78,29 @@ Returns the screen vendor.
get_param
^^^^^^^^^
-Get an integer/boolean screen parameter.
+Get an integer/boolean screen parameter. Valid parameter names include.
+
+* ``PIPE_CAP_MAX_CONST_BUFFERS``: Maximum number of constant buffers that
+ can be bound to any shader stage using ``set_constant_buffer``.
+
+ If 0 is returned, the driver is not aware of multiple constant buffers,
+ supports binding of only one constant buffer, and does not support
+ two-dimensional CONST register file access in TGSI shaders.
+
+ If a value greater than 0 is returned, the driver can have multiple
+ constant buffers bound to shader stages. The CONST register file can
+ be accessed with two-dimensional indices, like in the example below.
+
+ DCL CONST[0][0..7] # declare first 8 vectors of constbuf 0
+ DCL CONST[3][0] # declare first vector of constbuf 3
+ MOV OUT[0], CONST[0][3] # copy vector 3 of constbuf 0
+
+ For backwards compatibility, one-dimensional access to CONST register
+ file is still supported. In that case, the constbuf index is assumed
+ to be 0.
+
+* ``PIPE_CAP_MAX_CONST_BUFFER_SIZE``: Maximum byte size of a single constant
+ buffer.
get_paramf
^^^^^^^^^^
@@ -63,7 +120,56 @@ Returns TRUE if all usages can be satisfied.
``PIPE_TEXTURE_USAGE_DYNAMIC`` is not a valid usage.
+.. _texture_create:
+
texture_create
^^^^^^^^^^^^^^
-Given a template of texture setup, create a BO-backed texture.
+Given a template of texture setup, create a buffer and texture.
+
+texture_blanket
+^^^^^^^^^^^^^^^
+
+Like :ref:`texture_create`, but use a supplied buffer instead of creating a
+new one.
+
+texture_destroy
+^^^^^^^^^^^^^^^
+
+Destroy a texture. The buffer backing the texture is destroyed if it has no
+more references.
+
+buffer_map
+^^^^^^^^^^
+
+Map a buffer into memory.
+
+**usage** is a bitmask of :ref:`PIPE_TEXTURE_USAGE` flags.
+
+Returns a pointer to the map, or NULL if the mapping failed.
+
+buffer_map_range
+^^^^^^^^^^^^^^^^
+
+Map a range of a buffer into memory.
+
+The returned map is always relative to the beginning of the buffer, not the
+beginning of the mapped range.
+
+.. _buffer_flush_mapped_range:
+
+buffer_flush_mapped_range
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Flush a range of mapped memory into a buffer.
+
+The buffer must have been mapped with ``PIPE_BUFFER_USAGE_FLUSH_EXPLICIT``.
+
+**usage** is a bitmask of :ref:`PIPE_TEXTURE_USAGE` flags.
+
+buffer_unmap
+^^^^^^^^^^^^
+
+Unmap a buffer from memory.
+
+Any pointers into the map should be considered invalid and discarded.
diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst
index 65a669d8cfa..2c34a6bae5e 100644
--- a/src/gallium/docs/source/tgsi.rst
+++ b/src/gallium/docs/source/tgsi.rst
@@ -1111,6 +1111,117 @@ BREAKC - Break Conditional
TBD
+Double Opcodes
+^^^^^^^^^^^^^^^
+
+DADD - Add Double
+
+.. math::
+
+ dst.xy = src0.xy + src1.xy
+
+ dst.zw = src0.zw + src1.zw
+
+
+DDIV - Divide Double
+
+.. math::
+
+ dst.xy = src0.xy / src1.xy
+
+ dst.zw = src0.zw / src1.zw
+
+DSEQ - Set Double on Equal
+
+.. math::
+
+ dst.xy = src0.xy == src1.xy ? 1.0F : 0.0F
+
+ dst.zw = src0.zw == src1.zw ? 1.0F : 0.0F
+
+DSLT - Set Double on Less than
+
+.. math::
+
+ dst.xy = src0.xy < src1.xy ? 1.0F : 0.0F
+
+ dst.zw = src0.zw < src1.zw ? 1.0F : 0.0F
+
+DFRAC - Double Fraction
+
+.. math::
+
+ dst.xy = src.xy - \lfloor src.xy\rfloor
+
+ dst.zw = src.zw - \lfloor src.zw\rfloor
+
+
+DFRACEXP - Convert Double Number to Fractional and Integral Components
+
+.. math::
+
+ dst0.xy = frexp(src.xy, dst1.xy)
+
+ dst0.zw = frexp(src.zw, dst1.zw)
+
+DLDEXP - Multiple Double Number by Integral Power of 2
+
+.. math::
+
+ dst.xy = ldexp(src0.xy, src1.xy)
+
+ dst.zw = ldexp(src0.zw, src1.zw)
+
+DMIN - Minimum Double
+
+.. math::
+
+ dst.xy = min(src0.xy, src1.xy)
+
+ dst.zw = min(src0.zw, src1.zw)
+
+DMAX - Maximum Double
+
+.. math::
+
+ dst.xy = max(src0.xy, src1.xy)
+
+ dst.zw = max(src0.zw, src1.zw)
+
+DMUL - Multiply Double
+
+.. math::
+
+ dst.xy = src0.xy \times src1.xy
+
+ dst.zw = src0.zw \times src1.zw
+
+
+DMAD - Multiply And Add Doubles
+
+.. math::
+
+ dst.xy = src0.xy \times src1.xy + src2.xy
+
+ dst.zw = src0.zw \times src1.zw + src2.zw
+
+
+DRCP - Reciprocal Double
+
+.. math::
+
+ dst.xy = \frac{1}{src.xy}
+
+ dst.zw = \frac{1}{src.zw}
+
+DSQRT - Square root double
+
+.. math::
+
+ dst.xy = \sqrt{src.xy}
+
+ dst.zw = \sqrt{src.zw}
+
Explanation of symbols used
------------------------------
diff --git a/src/gallium/drivers/cell/ppu/cell_draw_arrays.c b/src/gallium/drivers/cell/ppu/cell_draw_arrays.c
index 0a4da8ecc85..c674d0be633 100644
--- a/src/gallium/drivers/cell/ppu/cell_draw_arrays.c
+++ b/src/gallium/drivers/cell/ppu/cell_draw_arrays.c
@@ -59,7 +59,7 @@ cell_map_constant_buffers(struct cell_context *sp)
}
}
- draw_set_mapped_constant_buffer(sp->draw, PIPE_SHADER_VERTEX,
+ draw_set_mapped_constant_buffer(sp->draw, PIPE_SHADER_VERTEX, 0,
sp->mapped_constants[PIPE_SHADER_VERTEX],
sp->constants[PIPE_SHADER_VERTEX]->size);
}
diff --git a/src/gallium/drivers/cell/spu/spu_main.h b/src/gallium/drivers/cell/spu/spu_main.h
index b18f4c22ef1..a9d72f84d56 100644
--- a/src/gallium/drivers/cell/spu/spu_main.h
+++ b/src/gallium/drivers/cell/spu/spu_main.h
@@ -100,8 +100,10 @@ struct spu_framebuffer
void *depth_start; /**< addr of depth surface in main memory */
enum pipe_format color_format;
enum pipe_format depth_format;
- uint width, height; /**< size in pixels */
- uint width_tiles, height_tiles; /**< width and height in tiles */
+ uint width; /**< width in pixels */
+ uint height; /**< height in pixels */
+ uint width_tiles; /**< width in tiles */
+ uint height_tiles; /**< width in tiles */
uint color_clear_value;
uint depth_clear_value;
@@ -116,15 +118,23 @@ PIPE_ALIGN_TYPE(16,
struct spu_texture_level
{
void *start;
- ushort width, height, depth;
+ ushort width;
+ ushort height;
+ ushort depth;
ushort tiles_per_row;
uint bytes_per_image;
/** texcoord scale factors */
- vector float scale_s, scale_t, scale_r;
+ vector float scale_s;
+ vector float scale_t;
+ vector float scale_r;
/** texcoord masks (if REPEAT then size-1, else ~0) */
- vector signed int mask_s, mask_t, mask_r;
+ vector signed int mask_s;
+ vector signed int mask_t;
+ vector signed int mask_r;
/** texcoord clamp limits */
- vector signed int max_s, max_t, max_r;
+ vector signed int max_s;
+ vector signed int max_t;
+ vector signed int max_r;
});
@@ -166,7 +176,8 @@ struct spu_global
boolean read_depth_stencil;
/** Current tiles' status */
- ubyte cur_ctile_status, cur_ztile_status;
+ ubyte cur_ctile_status;
+ ubyte cur_ztile_status;
/** Status of all tiles in framebuffer */
PIPE_ALIGN_VAR(16) ubyte ctile_status[CELL_MAX_HEIGHT/TILE_SIZE][CELL_MAX_WIDTH/TILE_SIZE];
diff --git a/src/gallium/drivers/i915/i915_clear.c b/src/gallium/drivers/i915/i915_clear.c
index 90530f2826f..0d0859f8f33 100644
--- a/src/gallium/drivers/i915/i915_clear.c
+++ b/src/gallium/drivers/i915/i915_clear.c
@@ -32,7 +32,6 @@
#include "util/u_clear.h"
#include "i915_context.h"
-#include "i915_state.h"
/**
diff --git a/src/gallium/drivers/i915/i915_context.c b/src/gallium/drivers/i915/i915_context.c
index 89feeade756..a0c80d02286 100644
--- a/src/gallium/drivers/i915/i915_context.c
+++ b/src/gallium/drivers/i915/i915_context.c
@@ -29,12 +29,9 @@
#include "i915_state.h"
#include "i915_screen.h"
#include "i915_batch.h"
-#include "i915_texture.h"
-#include "i915_reg.h"
#include "draw/draw_context.h"
#include "pipe/p_defines.h"
-#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_inlines.h"
#include "util/u_memory.h"
#include "pipe/p_screen.h"
@@ -84,7 +81,7 @@ i915_draw_range_elements(struct pipe_context *pipe,
}
- draw_set_mapped_constant_buffer(draw, PIPE_SHADER_VERTEX,
+ draw_set_mapped_constant_buffer(draw, PIPE_SHADER_VERTEX, 0,
i915->current.constants[PIPE_SHADER_VERTEX],
(i915->current.num_user_constants[PIPE_SHADER_VERTEX] *
4 * sizeof(float)));
diff --git a/src/gallium/drivers/i915/i915_debug.c b/src/gallium/drivers/i915/i915_debug.c
index c6e6d6fd313..237654d26b2 100644
--- a/src/gallium/drivers/i915/i915_debug.c
+++ b/src/gallium/drivers/i915/i915_debug.c
@@ -29,7 +29,6 @@
#include "i915_context.h"
#include "i915_debug.h"
#include "i915_batch.h"
-#include "pipe/internal/p_winsys_screen.h"
#include "util/u_debug.h"
diff --git a/src/gallium/drivers/i915/i915_debug_fp.c b/src/gallium/drivers/i915/i915_debug_fp.c
index 9c5b117b6dd..f9c40d8a110 100644
--- a/src/gallium/drivers/i915/i915_debug_fp.c
+++ b/src/gallium/drivers/i915/i915_debug_fp.c
@@ -29,7 +29,6 @@
#include "i915_reg.h"
#include "i915_debug.h"
#include "pipe/internal/p_winsys_screen.h"
-#include "util/u_memory.h"
static void
diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c
index db98256d2a1..23e4d6b9938 100644
--- a/src/gallium/drivers/i915/i915_state.c
+++ b/src/gallium/drivers/i915/i915_state.c
@@ -30,7 +30,6 @@
#include "draw/draw_context.h"
-#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_inlines.h"
#include "util/u_math.h"
#include "util/u_memory.h"
@@ -38,7 +37,6 @@
#include "i915_context.h"
#include "i915_reg.h"
-#include "i915_state.h"
#include "i915_state_inlines.h"
#include "i915_fpc.h"
diff --git a/src/gallium/drivers/i915/i915_state_derived.c b/src/gallium/drivers/i915/i915_state_derived.c
index 03dd5091a61..f5b0e9f011e 100644
--- a/src/gallium/drivers/i915/i915_state_derived.c
+++ b/src/gallium/drivers/i915/i915_state_derived.c
@@ -33,7 +33,6 @@
#include "i915_context.h"
#include "i915_state.h"
#include "i915_reg.h"
-#include "i915_fpc.h"
diff --git a/src/gallium/drivers/i915/i915_state_sampler.c b/src/gallium/drivers/i915/i915_state_sampler.c
index cbac4175c8f..e5c6d87215b 100644
--- a/src/gallium/drivers/i915/i915_state_sampler.c
+++ b/src/gallium/drivers/i915/i915_state_sampler.c
@@ -27,7 +27,6 @@
#include "pipe/p_context.h"
#include "pipe/p_state.h"
-#include "util/u_memory.h"
#include "i915_state_inlines.h"
#include "i915_context.h"
diff --git a/src/gallium/drivers/i915/i915_surface.c b/src/gallium/drivers/i915/i915_surface.c
index c693eb30e87..1ff6b9f4c63 100644
--- a/src/gallium/drivers/i915/i915_surface.c
+++ b/src/gallium/drivers/i915/i915_surface.c
@@ -27,14 +27,8 @@
#include "i915_context.h"
#include "i915_blit.h"
-#include "i915_state.h"
#include "pipe/p_defines.h"
-#include "pipe/p_inlines.h"
-#include "pipe/p_inlines.h"
-#include "pipe/internal/p_winsys_screen.h"
#include "util/u_format.h"
-#include "util/u_tile.h"
-#include "util/u_rect.h"
/* Assumes all values are within bounds -- no checking at this level -
diff --git a/src/gallium/drivers/i915/i915_texture.c b/src/gallium/drivers/i915/i915_texture.c
index 50a9e19094b..612e5c1cdd5 100644
--- a/src/gallium/drivers/i915/i915_texture.c
+++ b/src/gallium/drivers/i915/i915_texture.c
@@ -34,14 +34,12 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
-#include "pipe/internal/p_winsys_screen.h"
#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
#include "i915_context.h"
#include "i915_texture.h"
-#include "i915_debug.h"
#include "i915_screen.h"
#include "intel_winsys.h"
diff --git a/src/gallium/drivers/i965/brw_batchbuffer.c b/src/gallium/drivers/i965/brw_batchbuffer.c
index 22607dc6083..003b1fd5bf0 100644
--- a/src/gallium/drivers/i965/brw_batchbuffer.c
+++ b/src/gallium/drivers/i965/brw_batchbuffer.c
@@ -155,7 +155,7 @@ _brw_batchbuffer_flush(struct brw_batchbuffer *batch,
enum pipe_error
brw_batchbuffer_emit_reloc(struct brw_batchbuffer *batch,
struct brw_winsys_buffer *buffer,
- uint32_t usage,
+ enum brw_buffer_usage usage,
uint32_t delta)
{
int ret;
diff --git a/src/gallium/drivers/i965/brw_batchbuffer.h b/src/gallium/drivers/i965/brw_batchbuffer.h
index 7473f5bea4d..6ca9f617f5e 100644
--- a/src/gallium/drivers/i965/brw_batchbuffer.h
+++ b/src/gallium/drivers/i965/brw_batchbuffer.h
@@ -64,12 +64,12 @@ brw_batchbuffer_reset(struct brw_batchbuffer *batch);
* Consider it a convenience function wrapping multple
* intel_buffer_dword() calls.
*/
-int brw_batchbuffer_data(struct brw_batchbuffer *batch,
+enum pipe_error brw_batchbuffer_data(struct brw_batchbuffer *batch,
const void *data, GLuint bytes,
enum cliprect_mode cliprect_mode);
-int brw_batchbuffer_emit_reloc(struct brw_batchbuffer *batch,
+enum pipe_error brw_batchbuffer_emit_reloc(struct brw_batchbuffer *batch,
struct brw_winsys_buffer *buffer,
enum brw_buffer_usage usage,
uint32_t offset);
diff --git a/src/gallium/drivers/i965/brw_cc.c b/src/gallium/drivers/i965/brw_cc.c
index 3e070f5591a..4a543276f54 100644
--- a/src/gallium/drivers/i965/brw_cc.c
+++ b/src/gallium/drivers/i965/brw_cc.c
@@ -32,7 +32,6 @@
#include "brw_context.h"
#include "brw_state.h"
-#include "brw_defines.h"
static enum pipe_error prepare_cc_vp( struct brw_context *brw )
diff --git a/src/gallium/drivers/i965/brw_clip.c b/src/gallium/drivers/i965/brw_clip.c
index d67a1a62633..ccba205e8c7 100644
--- a/src/gallium/drivers/i965/brw_clip.c
+++ b/src/gallium/drivers/i965/brw_clip.c
@@ -38,7 +38,6 @@
#include "brw_defines.h"
#include "brw_context.h"
#include "brw_eu.h"
-#include "brw_util.h"
#include "brw_state.h"
#include "brw_pipe_rast.h"
#include "brw_clip.h"
diff --git a/src/gallium/drivers/i965/brw_clip_line.c b/src/gallium/drivers/i965/brw_clip_line.c
index 54282d975ed..66caadc4d53 100644
--- a/src/gallium/drivers/i965/brw_clip_line.c
+++ b/src/gallium/drivers/i965/brw_clip_line.c
@@ -33,7 +33,6 @@
#include "brw_defines.h"
#include "brw_eu.h"
-#include "brw_util.h"
#include "brw_clip.h"
diff --git a/src/gallium/drivers/i965/brw_clip_point.c b/src/gallium/drivers/i965/brw_clip_point.c
index e0a5330556d..124156c1b50 100644
--- a/src/gallium/drivers/i965/brw_clip_point.c
+++ b/src/gallium/drivers/i965/brw_clip_point.c
@@ -31,7 +31,6 @@
#include "brw_defines.h"
#include "brw_eu.h"
-#include "brw_util.h"
#include "brw_clip.h"
diff --git a/src/gallium/drivers/i965/brw_clip_tri.c b/src/gallium/drivers/i965/brw_clip_tri.c
index 4cde7294ea0..069524bc14f 100644
--- a/src/gallium/drivers/i965/brw_clip_tri.c
+++ b/src/gallium/drivers/i965/brw_clip_tri.c
@@ -31,7 +31,6 @@
#include "brw_defines.h"
#include "brw_eu.h"
-#include "brw_util.h"
#include "brw_clip.h"
static void release_tmps( struct brw_clip_compile *c )
diff --git a/src/gallium/drivers/i965/brw_clip_util.c b/src/gallium/drivers/i965/brw_clip_util.c
index 97a57103105..23e51ee9bcd 100644
--- a/src/gallium/drivers/i965/brw_clip_util.c
+++ b/src/gallium/drivers/i965/brw_clip_util.c
@@ -32,7 +32,6 @@
#include "brw_defines.h"
#include "brw_eu.h"
-#include "brw_util.h"
#include "brw_clip.h"
diff --git a/src/gallium/drivers/i965/brw_context.c b/src/gallium/drivers/i965/brw_context.c
index e67551882dc..d60b7b99b6e 100644
--- a/src/gallium/drivers/i965/brw_context.c
+++ b/src/gallium/drivers/i965/brw_context.c
@@ -34,7 +34,6 @@
#include "util/u_simple_list.h"
#include "brw_context.h"
-#include "brw_defines.h"
#include "brw_draw.h"
#include "brw_state.h"
#include "brw_batchbuffer.h"
diff --git a/src/gallium/drivers/i965/brw_curbe.c b/src/gallium/drivers/i965/brw_curbe.c
index 3f031577d5a..4b215a001c4 100644
--- a/src/gallium/drivers/i965/brw_curbe.c
+++ b/src/gallium/drivers/i965/brw_curbe.c
@@ -36,9 +36,7 @@
#include "brw_context.h"
#include "brw_defines.h"
#include "brw_state.h"
-#include "brw_util.h"
#include "brw_debug.h"
-#include "brw_screen.h"
/**
diff --git a/src/gallium/drivers/i965/brw_draw.c b/src/gallium/drivers/i965/brw_draw.c
index ea8d39adaf0..1b5cd23995b 100644
--- a/src/gallium/drivers/i965/brw_draw.c
+++ b/src/gallium/drivers/i965/brw_draw.c
@@ -34,7 +34,6 @@
#include "brw_context.h"
#include "brw_state.h"
#include "brw_debug.h"
-#include "brw_screen.h"
#include "brw_batchbuffer.h"
diff --git a/src/gallium/drivers/i965/brw_gs.c b/src/gallium/drivers/i965/brw_gs.c
index 921b201bae2..06826635a8a 100644
--- a/src/gallium/drivers/i965/brw_gs.c
+++ b/src/gallium/drivers/i965/brw_gs.c
@@ -34,7 +34,6 @@
#include "brw_defines.h"
#include "brw_context.h"
#include "brw_eu.h"
-#include "brw_util.h"
#include "brw_state.h"
#include "brw_gs.h"
diff --git a/src/gallium/drivers/i965/brw_gs_emit.c b/src/gallium/drivers/i965/brw_gs_emit.c
index fd8e2accedd..9b58773b3bd 100644
--- a/src/gallium/drivers/i965/brw_gs_emit.c
+++ b/src/gallium/drivers/i965/brw_gs_emit.c
@@ -35,7 +35,6 @@
#include "brw_defines.h"
#include "brw_context.h"
#include "brw_eu.h"
-#include "brw_util.h"
#include "brw_gs.h"
static void brw_gs_alloc_regs( struct brw_gs_compile *c,
diff --git a/src/gallium/drivers/i965/brw_pipe_fb.c b/src/gallium/drivers/i965/brw_pipe_fb.c
index 5d4e5025f97..c1f049272ac 100644
--- a/src/gallium/drivers/i965/brw_pipe_fb.c
+++ b/src/gallium/drivers/i965/brw_pipe_fb.c
@@ -3,7 +3,6 @@
#include "pipe/p_state.h"
#include "brw_context.h"
-#include "brw_debug.h"
/**
* called from intelDrawBuffer()
diff --git a/src/gallium/drivers/i965/brw_pipe_sampler.c b/src/gallium/drivers/i965/brw_pipe_sampler.c
index 81712798a5d..ef6c1bb3155 100644
--- a/src/gallium/drivers/i965/brw_pipe_sampler.c
+++ b/src/gallium/drivers/i965/brw_pipe_sampler.c
@@ -7,7 +7,6 @@
#include "brw_context.h"
#include "brw_defines.h"
-#include "brw_debug.h"
diff --git a/src/gallium/drivers/i965/brw_screen.c b/src/gallium/drivers/i965/brw_screen.c
index 0ecacac9a3a..a3728fb16e0 100644
--- a/src/gallium/drivers/i965/brw_screen.c
+++ b/src/gallium/drivers/i965/brw_screen.c
@@ -138,6 +138,9 @@ brw_get_name(struct pipe_screen *screen)
case PCI_CHIP_ILM_G:
chipset = "ILM_G";
break;
+ default:
+ chipset = "unknown";
+ break;
}
util_snprintf(buffer, sizeof(buffer), "i965 (chipset: %s)", chipset);
diff --git a/src/gallium/drivers/i965/brw_sf.c b/src/gallium/drivers/i965/brw_sf.c
index e1986a9dbbd..6e99eaa09d8 100644
--- a/src/gallium/drivers/i965/brw_sf.c
+++ b/src/gallium/drivers/i965/brw_sf.c
@@ -36,7 +36,6 @@
#include "brw_context.h"
#include "brw_pipe_rast.h"
#include "brw_eu.h"
-#include "brw_util.h"
#include "brw_sf.h"
#include "brw_state.h"
diff --git a/src/gallium/drivers/i965/brw_sf_emit.c b/src/gallium/drivers/i965/brw_sf_emit.c
index 3b85725e368..497634ec9ed 100644
--- a/src/gallium/drivers/i965/brw_sf_emit.c
+++ b/src/gallium/drivers/i965/brw_sf_emit.c
@@ -35,7 +35,6 @@
#include "brw_defines.h"
#include "brw_context.h"
#include "brw_eu.h"
-#include "brw_util.h"
#include "brw_sf.h"
diff --git a/src/gallium/drivers/i965/brw_state_cache.c b/src/gallium/drivers/i965/brw_state_cache.c
index 16b643ceb28..85c20076fb8 100644
--- a/src/gallium/drivers/i965/brw_state_cache.c
+++ b/src/gallium/drivers/i965/brw_state_cache.c
@@ -59,7 +59,6 @@
#include "brw_debug.h"
#include "brw_state.h"
-#include "brw_batchbuffer.h"
/* XXX: Fixme - have to include these to get the sizes of the prog_key
* structs:
diff --git a/src/gallium/drivers/i965/brw_util.c b/src/gallium/drivers/i965/brw_util.c
index 458058d668d..1fd2e297137 100644
--- a/src/gallium/drivers/i965/brw_util.c
+++ b/src/gallium/drivers/i965/brw_util.c
@@ -30,8 +30,6 @@
*/
-#include "brw_util.h"
-#include "brw_defines.h"
diff --git a/src/gallium/drivers/i965/brw_vs.c b/src/gallium/drivers/i965/brw_vs.c
index e3ea5a3a135..ca8ee79550d 100644
--- a/src/gallium/drivers/i965/brw_vs.c
+++ b/src/gallium/drivers/i965/brw_vs.c
@@ -33,9 +33,7 @@
#include "brw_context.h"
#include "brw_vs.h"
-#include "brw_util.h"
#include "brw_state.h"
-#include "brw_pipe_rast.h"
diff --git a/src/gallium/drivers/i965/brw_vs_surface_state.c b/src/gallium/drivers/i965/brw_vs_surface_state.c
index 177a5170d23..004e3cb4e6f 100644
--- a/src/gallium/drivers/i965/brw_vs_surface_state.c
+++ b/src/gallium/drivers/i965/brw_vs_surface_state.c
@@ -31,7 +31,6 @@
#include "brw_context.h"
#include "brw_state.h"
-#include "brw_defines.h"
#include "brw_winsys.h"
/* XXX: disabled true constant buffer functionality
diff --git a/src/gallium/drivers/i965/brw_wm_fp.c b/src/gallium/drivers/i965/brw_wm_fp.c
index 9c5b527f897..9c67759ad0b 100644
--- a/src/gallium/drivers/i965/brw_wm_fp.c
+++ b/src/gallium/drivers/i965/brw_wm_fp.c
@@ -41,7 +41,6 @@
#include "tgsi/tgsi_util.h"
#include "brw_wm.h"
-#include "brw_util.h"
#include "brw_debug.h"
diff --git a/src/gallium/drivers/i965/brw_wm_surface_state.c b/src/gallium/drivers/i965/brw_wm_surface_state.c
index f92b8198ed3..b01a7f194b7 100644
--- a/src/gallium/drivers/i965/brw_wm_surface_state.c
+++ b/src/gallium/drivers/i965/brw_wm_surface_state.c
@@ -34,7 +34,6 @@
#include "brw_batchbuffer.h"
#include "brw_context.h"
#include "brw_state.h"
-#include "brw_defines.h"
#include "brw_screen.h"
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_alpha.c b/src/gallium/drivers/llvmpipe/lp_bld_alpha.c
index 2b4bc5c819d..7245730350c 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_alpha.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_alpha.c
@@ -35,7 +35,6 @@
#include "lp_bld_type.h"
#include "lp_bld_const.h"
-#include "lp_bld_arit.h"
#include "lp_bld_logic.h"
#include "lp_bld_flow.h"
#include "lp_bld_debug.h"
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_arit.c b/src/gallium/drivers/llvmpipe/lp_bld_arit.c
index eea6b5d6a5c..1aee9b35f31 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_arit.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_arit.c
@@ -56,7 +56,6 @@
#include "lp_bld_intr.h"
#include "lp_bld_logic.h"
#include "lp_bld_pack.h"
-#include "lp_bld_debug.h"
#include "lp_bld_arit.h"
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_blend_soa.c b/src/gallium/drivers/llvmpipe/lp_bld_blend_soa.c
index 284977b7c3b..a73d1158e79 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_blend_soa.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_blend_soa.c
@@ -71,7 +71,6 @@
#include "pipe/p_state.h"
#include "lp_bld_type.h"
-#include "lp_bld_const.h"
#include "lp_bld_arit.h"
#include "lp_bld_blend.h"
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_conv.c b/src/gallium/drivers/llvmpipe/lp_bld_conv.c
index 99352094379..ebf554cd045 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_conv.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_conv.c
@@ -63,11 +63,9 @@
#include "util/u_debug.h"
#include "util/u_math.h"
-#include "util/u_cpu_detect.h"
#include "lp_bld_type.h"
#include "lp_bld_const.h"
-#include "lp_bld_intr.h"
#include "lp_bld_arit.h"
#include "lp_bld_pack.h"
#include "lp_bld_conv.h"
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_format_aos.c b/src/gallium/drivers/llvmpipe/lp_bld_format_aos.c
index 10e82f120bb..dfa080b8533 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_format_aos.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_format_aos.c
@@ -38,7 +38,6 @@
#include "lp_bld_type.h"
#include "lp_bld_const.h"
-#include "lp_bld_logic.h"
#include "lp_bld_swizzle.h"
#include "lp_bld_format.h"
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c b/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c
index fb1eda4423b..85e3b1bdd42 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c
@@ -47,13 +47,11 @@
#include "tgsi/tgsi_exec.h"
#include "lp_bld_type.h"
#include "lp_bld_const.h"
-#include "lp_bld_intr.h"
#include "lp_bld_arit.h"
#include "lp_bld_logic.h"
#include "lp_bld_swizzle.h"
#include "lp_bld_flow.h"
#include "lp_bld_tgsi.h"
-#include "lp_bld_debug.h"
#define LP_MAX_TEMPS 256
diff --git a/src/gallium/drivers/llvmpipe/lp_draw_arrays.c b/src/gallium/drivers/llvmpipe/lp_draw_arrays.c
index c152b4413fc..a0316194c6a 100644
--- a/src/gallium/drivers/llvmpipe/lp_draw_arrays.c
+++ b/src/gallium/drivers/llvmpipe/lp_draw_arrays.c
@@ -33,8 +33,6 @@
#include "pipe/p_defines.h"
#include "pipe/p_context.h"
-#include "pipe/internal/p_winsys_screen.h"
-#include "pipe/p_inlines.h"
#include "util/u_prim.h"
#include "lp_buffer.h"
diff --git a/src/gallium/drivers/llvmpipe/lp_flush.c b/src/gallium/drivers/llvmpipe/lp_flush.c
index cd8381fe308..6c81012e84b 100644
--- a/src/gallium/drivers/llvmpipe/lp_flush.c
+++ b/src/gallium/drivers/llvmpipe/lp_flush.c
@@ -37,8 +37,6 @@
#include "lp_surface.h"
#include "lp_state.h"
#include "lp_tile_cache.h"
-#include "lp_tex_cache.h"
-#include "lp_winsys.h"
void
diff --git a/src/gallium/drivers/llvmpipe/lp_jit.c b/src/gallium/drivers/llvmpipe/lp_jit.c
index 4ef0783f3e2..9e0118c55b6 100644
--- a/src/gallium/drivers/llvmpipe/lp_jit.c
+++ b/src/gallium/drivers/llvmpipe/lp_jit.c
@@ -39,7 +39,6 @@
#include "util/u_cpu_detect.h"
#include "lp_screen.h"
#include "lp_bld_intr.h"
-#include "lp_bld_misc.h"
#include "lp_jit.h"
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index 0b2d3a28014..50b07308c7e 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -40,7 +40,6 @@
#include "draw/draw_private.h"
#include "draw/draw_vertex.h"
#include "pipe/p_shader_tokens.h"
-#include "pipe/p_thread.h"
#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
diff --git a/src/gallium/drivers/llvmpipe/lp_state_derived.c b/src/gallium/drivers/llvmpipe/lp_state_derived.c
index 6c1ef6bc42d..0155b9be501 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_derived.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_derived.c
@@ -33,7 +33,6 @@
#include "draw/draw_private.h"
#include "lp_context.h"
#include "lp_screen.h"
-#include "lp_tex_cache.h"
#include "lp_state.h"
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index c6d97bb3e95..ddd0740f1b4 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -62,7 +62,6 @@
#include "util/u_memory.h"
#include "util/u_format.h"
#include "util/u_debug_dump.h"
-#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_shader_tokens.h"
#include "draw/draw_context.h"
#include "tgsi/tgsi_dump.h"
@@ -85,7 +84,6 @@
#include "lp_context.h"
#include "lp_buffer.h"
#include "lp_state.h"
-#include "lp_quad.h"
#include "lp_tex_sample.h"
#include "lp_debug.h"
@@ -733,7 +731,7 @@ llvmpipe_set_constant_buffer(struct pipe_context *pipe,
}
if(shader == PIPE_SHADER_VERTEX) {
- draw_set_mapped_constant_buffer(llvmpipe->draw, PIPE_SHADER_VERTEX,
+ draw_set_mapped_constant_buffer(llvmpipe->draw, PIPE_SHADER_VERTEX, 0,
data, size);
}
diff --git a/src/gallium/drivers/llvmpipe/lp_state_surface.c b/src/gallium/drivers/llvmpipe/lp_state_surface.c
index e37ff04f3df..3b08b0d1d70 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_surface.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_surface.c
@@ -30,7 +30,6 @@
#include "lp_context.h"
#include "lp_state.h"
-#include "lp_surface.h"
#include "lp_tile_cache.h"
#include "draw/draw_context.h"
diff --git a/src/gallium/drivers/llvmpipe/lp_state_vertex.c b/src/gallium/drivers/llvmpipe/lp_state_vertex.c
index 1a17631a4c6..57ac25ea0cb 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_vertex.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_vertex.c
@@ -31,7 +31,6 @@
#include "lp_context.h"
#include "lp_state.h"
-#include "lp_surface.h"
#include "draw/draw_context.h"
diff --git a/src/gallium/drivers/llvmpipe/lp_test_blend.c b/src/gallium/drivers/llvmpipe/lp_test_blend.c
index 07f636f8e72..ee72f6ce4fc 100644
--- a/src/gallium/drivers/llvmpipe/lp_test_blend.c
+++ b/src/gallium/drivers/llvmpipe/lp_test_blend.c
@@ -38,7 +38,6 @@
#include "lp_bld_type.h"
-#include "lp_bld_arit.h"
#include "lp_bld_blend.h"
#include "lp_bld_debug.h"
#include "lp_test.h"
diff --git a/src/gallium/drivers/llvmpipe/lp_tex_cache.c b/src/gallium/drivers/llvmpipe/lp_tex_cache.c
index a6d9a2c1acf..8094625d74d 100644
--- a/src/gallium/drivers/llvmpipe/lp_tex_cache.c
+++ b/src/gallium/drivers/llvmpipe/lp_tex_cache.c
@@ -38,7 +38,6 @@
#include "util/u_format.h"
#include "util/u_math.h"
#include "lp_context.h"
-#include "lp_surface.h"
#include "lp_texture.h"
#include "lp_tex_cache.h"
diff --git a/src/gallium/drivers/llvmpipe/lp_tex_sample_llvm.c b/src/gallium/drivers/llvmpipe/lp_tex_sample_llvm.c
index d2a6ae21f57..5138ccf7c93 100644
--- a/src/gallium/drivers/llvmpipe/lp_tex_sample_llvm.c
+++ b/src/gallium/drivers/llvmpipe/lp_tex_sample_llvm.c
@@ -44,7 +44,6 @@
#include "pipe/p_shader_tokens.h"
#include "lp_bld_debug.h"
#include "lp_bld_type.h"
-#include "lp_bld_intr.h"
#include "lp_bld_sample.h"
#include "lp_bld_tgsi.h"
#include "lp_state.h"
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index 2c135029ea2..3701219dcf9 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.c
+++ b/src/gallium/drivers/llvmpipe/lp_texture.c
@@ -33,7 +33,6 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
-#include "pipe/internal/p_winsys_screen.h"
#include "util/u_format.h"
#include "util/u_math.h"
@@ -42,7 +41,6 @@
#include "lp_context.h"
#include "lp_state.h"
#include "lp_texture.h"
-#include "lp_tex_cache.h"
#include "lp_screen.h"
#include "lp_winsys.h"
diff --git a/src/gallium/drivers/llvmpipe/lp_tile_cache.c b/src/gallium/drivers/llvmpipe/lp_tile_cache.c
index 7a1ecf5107b..971d9333331 100644
--- a/src/gallium/drivers/llvmpipe/lp_tile_cache.c
+++ b/src/gallium/drivers/llvmpipe/lp_tile_cache.c
@@ -38,8 +38,6 @@
#include "util/u_tile.h"
#include "util/u_rect.h"
#include "lp_context.h"
-#include "lp_surface.h"
-#include "lp_texture.h"
#include "lp_tile_soa.h"
#include "lp_tile_cache.h"
diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c
index 7ebc94ed6c7..1ad539d2858 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.c
+++ b/src/gallium/drivers/nouveau/nouveau_screen.c
@@ -260,6 +260,8 @@ nouveau_screen_init(struct nouveau_screen *screen, struct nouveau_device *dev)
void
nouveau_screen_fini(struct nouveau_screen *screen)
{
+ struct pipe_winsys *ws = screen->base.winsys;
nouveau_channel_free(&screen->channel);
+ ws->destroy(ws);
}
diff --git a/src/gallium/drivers/nv04/nv04_vbo.c b/src/gallium/drivers/nv04/nv04_vbo.c
index 34847718145..2db61d89412 100644
--- a/src/gallium/drivers/nv04/nv04_vbo.c
+++ b/src/gallium/drivers/nv04/nv04_vbo.c
@@ -45,7 +45,7 @@ void nv04_draw_elements( struct pipe_context *pipe,
draw_set_mapped_element_buffer(draw, 0, NULL);
}
- draw_set_mapped_constant_buffer(draw, PIPE_SHADER_VERTEX,
+ draw_set_mapped_constant_buffer(draw, PIPE_SHADER_VERTEX, 0,
nv04->constbuf[PIPE_SHADER_VERTEX],
nv04->constbuf_nr[PIPE_SHADER_VERTEX]);
diff --git a/src/gallium/drivers/nv10/nv10_vbo.c b/src/gallium/drivers/nv10/nv10_vbo.c
index 9180c72c9b0..da5c93f0814 100644
--- a/src/gallium/drivers/nv10/nv10_vbo.c
+++ b/src/gallium/drivers/nv10/nv10_vbo.c
@@ -46,6 +46,7 @@ void nv10_draw_elements( struct pipe_context *pipe,
draw_set_mapped_constant_buffer(draw,
PIPE_SHADER_VERTEX,
+ 0,
nv10->constbuf[PIPE_SHADER_VERTEX],
nv10->constbuf_nr[PIPE_SHADER_VERTEX]);
diff --git a/src/gallium/drivers/nv20/nv20_vbo.c b/src/gallium/drivers/nv20/nv20_vbo.c
index 52991a0d856..6dc95389013 100644
--- a/src/gallium/drivers/nv20/nv20_vbo.c
+++ b/src/gallium/drivers/nv20/nv20_vbo.c
@@ -45,7 +45,7 @@ void nv20_draw_elements( struct pipe_context *pipe,
draw_set_mapped_element_buffer(draw, 0, NULL);
}
- draw_set_mapped_constant_buffer(draw, PIPE_SHADER_VERTEX,
+ draw_set_mapped_constant_buffer(draw, PIPE_SHADER_VERTEX, 0,
nv20->constbuf[PIPE_SHADER_VERTEX],
nv20->constbuf_nr[PIPE_SHADER_VERTEX]);
diff --git a/src/gallium/drivers/nv40/nv40_draw.c b/src/gallium/drivers/nv40/nv40_draw.c
index d826f8c2f5f..a2fd5f6c02f 100644
--- a/src/gallium/drivers/nv40/nv40_draw.c
+++ b/src/gallium/drivers/nv40/nv40_draw.c
@@ -271,7 +271,7 @@ nv40_draw_elements_swtnl(struct pipe_context *pipe,
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,
+ draw_set_mapped_constant_buffer(nv40->draw, PIPE_SHADER_VERTEX, 0,
map, nr);
}
diff --git a/src/gallium/drivers/nv50/nv50_context.c b/src/gallium/drivers/nv50/nv50_context.c
index 1e697463221..5c705ccc8f1 100644
--- a/src/gallium/drivers/nv50/nv50_context.c
+++ b/src/gallium/drivers/nv50/nv50_context.c
@@ -34,6 +34,11 @@ nv50_flush(struct pipe_context *pipe, unsigned flags,
struct nv50_context *nv50 = nv50_context(pipe);
struct nouveau_channel *chan = nv50->screen->base.channel;
+ if (flags & PIPE_FLUSH_TEXTURE_CACHE) {
+ BEGIN_RING(chan, nv50->screen->tesla, 0x1338, 1);
+ OUT_RING (chan, 0x20);
+ }
+
if (flags & PIPE_FLUSH_FRAME)
FIRE_RING(chan);
}
@@ -81,6 +86,10 @@ nv50_destroy(struct pipe_context *pipe)
so_ref(NULL, &nv50->state.vtxattr);
draw_destroy(nv50->draw);
+
+ if (nv50->screen->cur_ctx == nv50)
+ nv50->screen->cur_ctx = NULL;
+
FREE(nv50);
}
diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c
index 20db51070ff..e74a526c626 100644
--- a/src/gallium/drivers/nv50/nv50_program.c
+++ b/src/gallium/drivers/nv50/nv50_program.c
@@ -3283,7 +3283,7 @@ prep_inspect_insn(struct nv50_pc *pc, const struct tgsi_full_instruction *insn)
static unsigned
nv50_revdep_reorder(unsigned m[4], unsigned rdep[4])
{
- unsigned i, c, x, unsafe;
+ unsigned i, c, x, unsafe = 0;
for (c = 0; c < 4; c++)
m[c] = c;
@@ -3728,13 +3728,21 @@ nv50_program_tx_prep(struct nv50_pc *pc)
copy_semantic_info(p);
} else
if (p->type == PIPE_SHADER_FRAGMENT) {
- int rid, aid, base;
+ int rid, aid;
unsigned n = 0, m = pc->attr_nr - flat_nr;
pc->allow32 = TRUE;
- base = (TGSI_SEMANTIC_POSITION ==
- p->info.input_semantic_name[0]) ? 0 : 1;
+ /* do we read FragCoord ? */
+ if (pc->attr_nr &&
+ p->info.input_semantic_name[0] == TGSI_SEMANTIC_POSITION) {
+ /* select FCRD components we want accessible */
+ for (c = 0; c < 4; ++c)
+ if (pc->attr[c].acc)
+ p->cfg.regs[1] |= 1 << (24 + c);
+ aid = 0;
+ } else /* offset by 1 if FCRD.w is needed for pinterp */
+ aid = popcnt4(p->cfg.regs[1] >> 24);
/* non-flat interpolants have to be mapped to
* the lower hardware IDs, so sort them:
@@ -3750,12 +3758,6 @@ nv50_program_tx_prep(struct nv50_pc *pc)
}
copy_semantic_info(p);
- if (!base) /* set w-coordinate mask from perspective interp */
- p->cfg.in[0].mask |= p->cfg.regs[1] >> 24;
-
- aid = popcnt4( /* if fcrd isn't contained in cfg.io */
- base ? (p->cfg.regs[1] >> 24) : p->cfg.in[0].mask);
-
for (n = 0; n < pc->attr_nr; ++n) {
p->cfg.in[n].hw = rid = aid;
i = p->cfg.in[n].id;
@@ -3777,9 +3779,6 @@ nv50_program_tx_prep(struct nv50_pc *pc)
aid += popcnt4(p->cfg.in[n].mask);
}
- if (!base)
- p->cfg.regs[1] |= p->cfg.in[0].mask << 24;
-
m = popcnt4(p->cfg.regs[1] >> 24);
/* set count of non-position inputs and of non-flat
diff --git a/src/gallium/drivers/nv50/nv50_query.c b/src/gallium/drivers/nv50/nv50_query.c
index 5a4ab3508b8..9eba4c96115 100644
--- a/src/gallium/drivers/nv50/nv50_query.c
+++ b/src/gallium/drivers/nv50/nv50_query.c
@@ -48,7 +48,7 @@ nv50_query_create(struct pipe_context *pipe, unsigned type)
assert (q->type == PIPE_QUERY_OCCLUSION_COUNTER);
q->type = type;
- ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM | NOUVEAU_BO_MAP, 256,
+ ret = nouveau_bo_new(dev, NOUVEAU_BO_GART | NOUVEAU_BO_MAP, 256,
16, &q->bo);
if (ret) {
FREE(q);
@@ -95,11 +95,13 @@ nv50_query_end(struct pipe_context *pipe, struct pipe_query *pq)
MARK_RING (chan, 5, 2); /* flush on lack of space or relocs */
BEGIN_RING(chan, tesla, NV50TCL_QUERY_ADDRESS_HIGH, 4);
- OUT_RELOCh(chan, q->bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
- OUT_RELOCl(chan, q->bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+ OUT_RELOCh(chan, q->bo, 0, NOUVEAU_BO_GART | NOUVEAU_BO_WR);
+ OUT_RELOCl(chan, q->bo, 0, NOUVEAU_BO_GART | NOUVEAU_BO_WR);
OUT_RING (chan, 0x00000000);
OUT_RING (chan, 0x0100f002);
- FIRE_RING (chan);
+
+ BEGIN_RING(chan, tesla, NV50TCL_SAMPLECNT_ENABLE, 1);
+ OUT_RING (chan, 0);
}
static boolean
@@ -123,6 +125,35 @@ nv50_query_result(struct pipe_context *pipe, struct pipe_query *pq,
return q->ready;
}
+static void
+nv50_render_condition(struct pipe_context *pipe,
+ struct pipe_query *pq, uint mode)
+{
+ struct nv50_context *nv50 = nv50_context(pipe);
+ struct nouveau_channel *chan = nv50->screen->base.channel;
+ struct nouveau_grobj *tesla = nv50->screen->tesla;
+ struct nv50_query *q;
+
+ if (!pq) {
+ BEGIN_RING(chan, tesla, NV50TCL_COND_MODE, 1);
+ OUT_RING (chan, NV50TCL_COND_MODE_ALWAYS);
+ return;
+ }
+ q = nv50_query(pq);
+
+ if (mode == PIPE_RENDER_COND_WAIT ||
+ mode == PIPE_RENDER_COND_BY_REGION_WAIT) {
+ /* XXX: big fence, FIFO semaphore might be better */
+ BEGIN_RING(chan, tesla, 0x0110, 1);
+ OUT_RING (chan, 0);
+ }
+
+ BEGIN_RING(chan, tesla, NV50TCL_COND_ADDRESS_HIGH, 3);
+ OUT_RELOCh(chan, q->bo, 0, NOUVEAU_BO_GART | NOUVEAU_BO_RD);
+ OUT_RELOCl(chan, q->bo, 0, NOUVEAU_BO_GART | NOUVEAU_BO_RD);
+ OUT_RING (chan, NV50TCL_COND_MODE_RES);
+}
+
void
nv50_init_query_functions(struct nv50_context *nv50)
{
@@ -131,4 +162,5 @@ nv50_init_query_functions(struct nv50_context *nv50)
nv50->pipe.begin_query = nv50_query_begin;
nv50->pipe.end_query = nv50_query_end;
nv50->pipe.get_query_result = nv50_query_result;
+ nv50->pipe.render_condition = nv50_render_condition;
}
diff --git a/src/gallium/drivers/nv50/nv50_tex.c b/src/gallium/drivers/nv50/nv50_tex.c
index 871536dca9b..9f1a1713032 100644
--- a/src/gallium/drivers/nv50/nv50_tex.c
+++ b/src/gallium/drivers/nv50/nv50_tex.c
@@ -220,11 +220,8 @@ nv50_tex_validate(struct nv50_context *nv50)
return;
}
- /* not sure if the following really do what I think: */
so_method(so, tesla, 0x1330, 1); /* flush TIC */
so_data (so, 0);
- so_method(so, tesla, 0x1338, 1); /* flush texture caches */
- so_data (so, 0x20);
so_ref(so, &nv50->state.tic_upload);
so_ref(NULL, &so);
diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c
index c14414fff6b..cdedb302209 100644
--- a/src/gallium/drivers/r300/r300_blit.c
+++ b/src/gallium/drivers/r300/r300_blit.c
@@ -23,8 +23,6 @@
#include "r300_blit.h"
#include "r300_context.h"
-#include "util/u_rect.h"
-
static void r300_blitter_save_states(struct r300_context* r300)
{
util_blitter_save_blend(r300->blitter, r300->blend_state.state);
@@ -75,13 +73,15 @@ void r300_clear(struct pipe_context* pipe,
*/
struct r300_context* r300 = r300_context(pipe);
+ struct pipe_framebuffer_state* fb =
+ (struct pipe_framebuffer_state*)r300->fb_state.state;
r300_blitter_save_states(r300);
util_blitter_clear(r300->blitter,
- r300->framebuffer_state.width,
- r300->framebuffer_state.height,
- r300->framebuffer_state.nr_cbufs,
+ fb->width,
+ fb->height,
+ fb->nr_cbufs,
buffers, rgba, depth, stencil);
}
@@ -99,7 +99,7 @@ void r300_surface_copy(struct pipe_context* pipe,
* is really transparent. The states will be restored by the blitter once
* copying is done. */
r300_blitter_save_states(r300);
- util_blitter_save_framebuffer(r300->blitter, &r300->framebuffer_state);
+ util_blitter_save_framebuffer(r300->blitter, r300->fb_state.state);
util_blitter_save_fragment_sampler_states(
r300->blitter, r300->sampler_count, (void**)r300->sampler_states);
@@ -123,7 +123,7 @@ void r300_surface_fill(struct pipe_context* pipe,
struct r300_context* r300 = r300_context(pipe);
r300_blitter_save_states(r300);
- util_blitter_save_framebuffer(r300->blitter, &r300->framebuffer_state);
+ util_blitter_save_framebuffer(r300->blitter, r300->fb_state.state);
util_blitter_fill(r300->blitter,
dst, dstx, dsty, width, height, value);
diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index 3bf9c8b18dc..9837530a7ac 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -22,9 +22,6 @@
#include "draw/draw_context.h"
-#include "tgsi/tgsi_scan.h"
-
-#include "util/u_hash_table.h"
#include "util/u_memory.h"
#include "util/u_simple_list.h"
@@ -35,30 +32,16 @@
#include "r300_query.h"
#include "r300_render.h"
#include "r300_screen.h"
-#include "r300_state_derived.h"
#include "r300_state_invariant.h"
#include "r300_texture.h"
#include "r300_winsys.h"
-static enum pipe_error r300_clear_hash_table(void* key, void* value,
- void* data)
-{
- FREE(key);
- FREE(value);
- return PIPE_OK;
-}
-
static void r300_destroy_context(struct pipe_context* context)
{
struct r300_context* r300 = r300_context(context);
struct r300_query* query, * temp;
util_blitter_destroy(r300->blitter);
-
- util_hash_table_foreach(r300->shader_hash_table, r300_clear_hash_table,
- NULL);
- util_hash_table_destroy(r300->shader_hash_table);
-
draw_destroy(r300->draw);
/* Free the OQ BO. */
@@ -72,9 +55,9 @@ static void r300_destroy_context(struct pipe_context* context)
FREE(r300->blend_color_state.state);
FREE(r300->clip_state.state);
- FREE(r300->rs_block);
+ FREE(r300->rs_block_state.state);
FREE(r300->scissor_state.state);
- FREE(r300->vertex_info);
+ FREE(r300->vertex_format_state.state);
FREE(r300->viewport_state.state);
FREE(r300->ztop_state.state);
FREE(r300);
@@ -135,9 +118,12 @@ static void r300_setup_atoms(struct r300_context* r300)
R300_INIT_ATOM(blend_color, 3);
R300_INIT_ATOM(clip, 29);
R300_INIT_ATOM(dsa, 8);
+ R300_INIT_ATOM(fb, 56);
R300_INIT_ATOM(rs, 25);
R300_INIT_ATOM(scissor, 3);
R300_INIT_ATOM(viewport, 9);
+ R300_INIT_ATOM(rs_block, 21);
+ R300_INIT_ATOM(vertex_format, 26);
}
struct pipe_context* r300_create_context(struct pipe_screen* screen,
@@ -183,16 +169,13 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
r300->context.is_texture_referenced = r300_is_texture_referenced;
r300->context.is_buffer_referenced = r300_is_buffer_referenced;
- r300->shader_hash_table = util_hash_table_create(r300_shader_key_hash,
- r300_shader_key_compare);
-
r300_setup_atoms(r300);
r300->blend_color_state.state = CALLOC_STRUCT(r300_blend_color_state);
r300->clip_state.state = CALLOC_STRUCT(pipe_clip_state);
- r300->rs_block = CALLOC_STRUCT(r300_rs_block);
+ r300->rs_block_state.state = CALLOC_STRUCT(r300_rs_block);
r300->scissor_state.state = CALLOC_STRUCT(pipe_scissor_state);
- r300->vertex_info = CALLOC_STRUCT(r300_vertex_info);
+ r300->vertex_format_state.state = CALLOC_STRUCT(r300_vertex_info);
r300->viewport_state.state = CALLOC_STRUCT(r300_viewport_state);
r300->ztop_state.state = CALLOC_STRUCT(r300_ztop_state);
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index 48c86fdad7a..3f461640a03 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -139,15 +139,12 @@ struct r300_ztop_state {
uint32_t z_buffer_top; /* R300_ZB_ZTOP: 0x4f14 */
};
-#define R300_NEW_FRAMEBUFFERS 0x00000010
#define R300_NEW_FRAGMENT_SHADER 0x00000020
#define R300_NEW_FRAGMENT_SHADER_CONSTANTS 0x00000040
-#define R300_NEW_RS_BLOCK 0x00000100
#define R300_NEW_SAMPLER 0x00000200
#define R300_ANY_NEW_SAMPLERS 0x0001fe00
#define R300_NEW_TEXTURE 0x00040000
#define R300_ANY_NEW_TEXTURES 0x03fc0000
-#define R300_NEW_VERTEX_FORMAT 0x04000000
#define R300_NEW_VERTEX_SHADER 0x08000000
#define R300_NEW_VERTEX_SHADER_CONSTANTS 0x10000000
#define R300_NEW_QUERY 0x40000000
@@ -272,11 +269,8 @@ struct r300_context {
struct r300_query *query_current;
struct r300_query query_list;
- /* Shader hash table. Used to store vertex formatting information, which
- * depends on the combination of both currently loaded shaders. */
- struct util_hash_table* shader_hash_table;
/* Vertex formatting information. */
- struct r300_vertex_info* vertex_info;
+ struct r300_atom vertex_format_state;
/* Various CSO state objects. */
/* Beginning of atom list. */
@@ -293,12 +287,12 @@ struct r300_context {
struct r300_atom dsa_state;
/* Fragment shader. */
struct r300_fragment_shader* fs;
- /* Framebuffer state. We currently don't need our own version of this. */
- struct pipe_framebuffer_state framebuffer_state;
+ /* Framebuffer state. */
+ struct r300_atom fb_state;
/* Rasterizer state. */
struct r300_atom rs_state;
/* RS block state. */
- struct r300_rs_block* rs_block;
+ struct r300_atom rs_block_state;
/* Sampler states. */
struct r300_sampler_state* sampler_states[8];
int sampler_count;
diff --git a/src/gallium/drivers/r300/r300_debug.c b/src/gallium/drivers/r300/r300_debug.c
index 00d4f31c2b6..b881730848a 100644
--- a/src/gallium/drivers/r300/r300_debug.c
+++ b/src/gallium/drivers/r300/r300_debug.c
@@ -22,8 +22,6 @@
#include "r300_context.h"
-#include <ctype.h>
-
struct debug_option {
const char * name;
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 921170aef11..f1d32764fdb 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -32,20 +32,20 @@
#include "r300_emit.h"
#include "r300_fs.h"
#include "r300_screen.h"
-#include "r300_state_derived.h"
#include "r300_state_inlines.h"
-#include "r300_texture.h"
#include "r300_vs.h"
void r300_emit_blend_state(struct r300_context* r300, void* state)
{
struct r300_blend_state* blend = (struct r300_blend_state*)state;
+ struct pipe_framebuffer_state* fb =
+ (struct pipe_framebuffer_state*)r300->fb_state.state;
CS_LOCALS(r300);
BEGIN_CS(8);
OUT_CS_REG(R300_RB3D_ROPCNTL, blend->rop);
OUT_CS_REG_SEQ(R300_RB3D_CBLEND, 3);
- if (r300->framebuffer_state.nr_cbufs) {
+ if (fb->nr_cbufs) {
OUT_CS(blend->blend_control);
OUT_CS(blend->alpha_blend_control);
OUT_CS(blend->color_channel_mask);
@@ -112,6 +112,8 @@ void r300_emit_dsa_state(struct r300_context* r300, void* state)
{
struct r300_dsa_state* dsa = (struct r300_dsa_state*)state;
struct r300_screen* r300screen = r300_screen(r300->context.screen);
+ struct pipe_framebuffer_state* fb =
+ (struct pipe_framebuffer_state*)r300->fb_state.state;
CS_LOCALS(r300);
BEGIN_CS(r300screen->caps->is_r500 ? 8 : 6);
@@ -124,7 +126,7 @@ void r300_emit_dsa_state(struct r300_context* r300, void* state)
OUT_CS_REG_SEQ(R300_ZB_CNTL, 3);
- if (r300->framebuffer_state.zsbuf) {
+ if (fb->zsbuf) {
OUT_CS(dsa->z_buffer_control);
OUT_CS(dsa->z_stencil_control);
} else {
@@ -384,17 +386,14 @@ void r500_emit_fs_constant_buffer(struct r300_context* r300,
END_CS;
}
-void r300_emit_fb_state(struct r300_context* r300,
- struct pipe_framebuffer_state* fb)
+void r300_emit_fb_state(struct r300_context* r300, void* state)
{
+ struct pipe_framebuffer_state* fb = (struct pipe_framebuffer_state*)state;
struct r300_texture* tex;
struct pipe_surface* surf;
int i;
CS_LOCALS(r300);
- /* Shouldn't fail unless there is a bug in the state tracker. */
- assert(fb->nr_cbufs <= 4);
-
BEGIN_CS((10 * fb->nr_cbufs) + (2 * (4 - fb->nr_cbufs)) +
(fb->zsbuf ? 10 : 0) + 6);
@@ -627,10 +626,10 @@ void r300_emit_rs_state(struct r300_context* r300, void* state)
END_CS;
}
-void r300_emit_rs_block_state(struct r300_context* r300,
- struct r300_rs_block* rs)
+void r300_emit_rs_block_state(struct r300_context* r300, void* state)
{
- int i;
+ struct r300_rs_block* rs = (struct r300_rs_block*)state;
+ unsigned i;
struct r300_screen* r300screen = r300_screen(r300->context.screen);
CS_LOCALS(r300);
@@ -673,11 +672,13 @@ void r300_emit_scissor_state(struct r300_context* r300, void* state)
uint32_t top_left, bottom_right;
struct r300_screen* r300screen = r300_screen(r300->context.screen);
struct pipe_scissor_state* scissor = (struct pipe_scissor_state*)state;
+ struct pipe_framebuffer_state* fb =
+ (struct pipe_framebuffer_state*)r300->fb_state.state;
CS_LOCALS(r300);
minx = miny = 0;
- maxx = r300->framebuffer_state.width;
- maxy = r300->framebuffer_state.height;
+ maxx = fb->width;
+ maxy = fb->height;
if (((struct r300_rs_state*)r300->rs_state.state)->rs.scissor) {
minx = MAX2(minx, scissor->minx);
@@ -686,6 +687,22 @@ void r300_emit_scissor_state(struct r300_context* r300, void* state)
maxy = MIN2(maxy, scissor->maxy);
}
+ /* Special case for zero-area scissor.
+ *
+ * We can't allow the variables maxx and maxy to be zero because they are
+ * subtracted from later in the code, which would cause emitting ~0 and
+ * making the kernel checker angry.
+ *
+ * Let's consider we change maxx and maxy to 1, which is effectively
+ * a one-pixel area. We must then change minx and miny to a number which is
+ * greater than 1 to get the zero area back. */
+ if (!maxx || !maxy) {
+ minx = 2;
+ miny = 2;
+ maxx = 1;
+ maxy = 1;
+ }
+
if (r300screen->caps->is_r500) {
top_left =
(minx << R300_SCISSORS_X_SHIFT) |
@@ -756,22 +773,6 @@ void r300_emit_texture(struct r300_context* r300,
END_CS;
}
-static boolean r300_validate_aos(struct r300_context *r300)
-{
- 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;
- }
- }
- return TRUE;
-}
-
void r300_emit_aos(struct r300_context* r300, unsigned offset)
{
struct pipe_vertex_buffer *vb1, *vb2, *vbuf = r300->vertex_buffer;
@@ -781,12 +782,6 @@ void r300_emit_aos(struct r300_context* r300, unsigned offset)
unsigned packet_size = (aos_count * 3 + 1) / 2;
CS_LOCALS(r300);
- /* XXX Move this checking to a more approriate place. */
- if (!r300_validate_aos(r300)) {
- /* XXX We should fallback using Draw. */
- assert(0);
- }
-
BEGIN_CS(2 + packet_size + aos_count * 2);
OUT_CS_PKT3(R300_PACKET3_3D_LOAD_VBPNTR, packet_size);
OUT_CS(aos_count);
@@ -818,38 +813,39 @@ void r300_emit_aos(struct r300_context* r300, unsigned offset)
END_CS;
}
-void r300_emit_vertex_format_state(struct r300_context* r300)
+void r300_emit_vertex_format_state(struct r300_context* r300, void* state)
{
- int i;
+ struct r300_vertex_info* vertex_info = (struct r300_vertex_info*)state;
+ unsigned i;
CS_LOCALS(r300);
DBG(r300, DBG_DRAW, "r300: VAP/PSC emit:\n");
BEGIN_CS(26);
- OUT_CS_REG(R300_VAP_VTX_SIZE, r300->vertex_info->vinfo.size);
+ OUT_CS_REG(R300_VAP_VTX_SIZE, vertex_info->vinfo.size);
OUT_CS_REG_SEQ(R300_VAP_VTX_STATE_CNTL, 2);
- OUT_CS(r300->vertex_info->vinfo.hwfmt[0]);
- OUT_CS(r300->vertex_info->vinfo.hwfmt[1]);
+ OUT_CS(vertex_info->vinfo.hwfmt[0]);
+ OUT_CS(vertex_info->vinfo.hwfmt[1]);
OUT_CS_REG_SEQ(R300_VAP_OUTPUT_VTX_FMT_0, 2);
- OUT_CS(r300->vertex_info->vinfo.hwfmt[2]);
- OUT_CS(r300->vertex_info->vinfo.hwfmt[3]);
+ OUT_CS(vertex_info->vinfo.hwfmt[2]);
+ OUT_CS(vertex_info->vinfo.hwfmt[3]);
for (i = 0; i < 4; i++) {
DBG(r300, DBG_DRAW, " : hwfmt%d: 0x%08x\n", i,
- r300->vertex_info->vinfo.hwfmt[i]);
+ vertex_info->vinfo.hwfmt[i]);
}
OUT_CS_REG_SEQ(R300_VAP_PROG_STREAM_CNTL_0, 8);
for (i = 0; i < 8; i++) {
- OUT_CS(r300->vertex_info->vap_prog_stream_cntl[i]);
+ OUT_CS(vertex_info->vap_prog_stream_cntl[i]);
DBG(r300, DBG_DRAW, " : prog_stream_cntl%d: 0x%08x\n", i,
- r300->vertex_info->vap_prog_stream_cntl[i]);
+ vertex_info->vap_prog_stream_cntl[i]);
}
OUT_CS_REG_SEQ(R300_VAP_PROG_STREAM_CNTL_EXT_0, 8);
for (i = 0; i < 8; i++) {
- OUT_CS(r300->vertex_info->vap_prog_stream_cntl_ext[i]);
+ OUT_CS(vertex_info->vap_prog_stream_cntl_ext[i]);
DBG(r300, DBG_DRAW, " : prog_stream_cntl_ext%d: 0x%08x\n", i,
- r300->vertex_info->vap_prog_stream_cntl_ext[i]);
+ vertex_info->vap_prog_stream_cntl_ext[i]);
}
END_CS;
}
@@ -1014,39 +1010,21 @@ static void r300_flush_pvs(struct r300_context* r300)
END_CS;
}
-/* Emit all dirty state. */
-void r300_emit_dirty_state(struct r300_context* r300)
+void r300_emit_buffer_validate(struct r300_context *r300)
{
- struct r300_screen* r300screen = r300_screen(r300->context.screen);
+ struct pipe_framebuffer_state* fb =
+ (struct pipe_framebuffer_state*)r300->fb_state.state;
struct r300_texture* tex;
- struct r300_atom* atom;
- unsigned i, dwords = 1024;
- int dirty_tex = 0;
+ unsigned i;
boolean invalid = FALSE;
- /* Check the required number of dwords against the space remaining in the
- * current CS object. If we need more, then flush. */
-
- foreach(atom, &r300->atom_list) {
- if (atom->dirty || atom->always_dirty) {
- dwords += atom->size;
- }
- }
-
- /* Make sure we have at least 2*1024 spare dwords. */
- /* XXX It would be nice to know the number of dwords we really need to
- * XXX emit. */
- if (!r300->winsys->check_cs(r300->winsys, dwords)) {
- r300->context.flush(&r300->context, 0, NULL);
- }
-
/* Clean out BOs. */
r300->winsys->reset_bos(r300->winsys);
validate:
/* Color buffers... */
- for (i = 0; i < r300->framebuffer_state.nr_cbufs; i++) {
- tex = (struct r300_texture*)r300->framebuffer_state.cbufs[i]->texture;
+ 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)) {
@@ -1055,8 +1033,8 @@ validate:
}
}
/* ...depth buffer... */
- if (r300->framebuffer_state.zsbuf) {
- tex = (struct r300_texture*)r300->framebuffer_state.zsbuf->texture;
+ 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)) {
@@ -1103,6 +1081,31 @@ validate:
invalid = TRUE;
goto validate;
}
+}
+
+/* Emit all dirty state. */
+void r300_emit_dirty_state(struct r300_context* r300)
+{
+ struct r300_screen* r300screen = r300_screen(r300->context.screen);
+ struct r300_atom* atom;
+ unsigned i, dwords = 1024;
+ int dirty_tex = 0;
+
+ /* Check the required number of dwords against the space remaining in the
+ * current CS object. If we need more, then flush. */
+
+ foreach(atom, &r300->atom_list) {
+ if (atom->dirty || atom->always_dirty) {
+ dwords += atom->size;
+ }
+ }
+
+ /* Make sure we have at least 2*1024 spare dwords. */
+ /* XXX It would be nice to know the number of dwords we really need to
+ * XXX emit. */
+ while (!r300->winsys->check_cs(r300->winsys, dwords)) {
+ r300->context.flush(&r300->context, 0, NULL);
+ }
if (r300->dirty_state & R300_NEW_QUERY) {
r300_emit_query_start(r300);
@@ -1137,16 +1140,6 @@ validate:
r300->dirty_state &= ~R300_NEW_FRAGMENT_SHADER_CONSTANTS;
}
- if (r300->dirty_state & R300_NEW_FRAMEBUFFERS) {
- r300_emit_fb_state(r300, &r300->framebuffer_state);
- r300->dirty_state &= ~R300_NEW_FRAMEBUFFERS;
- }
-
- if (r300->dirty_state & R300_NEW_RS_BLOCK) {
- r300_emit_rs_block_state(r300, r300->rs_block);
- r300->dirty_state &= ~R300_NEW_RS_BLOCK;
- }
-
/* Samplers and textures are tracked separately but emitted together. */
if (r300->dirty_state &
(R300_ANY_NEW_SAMPLERS | R300_ANY_NEW_TEXTURES)) {
@@ -1172,11 +1165,6 @@ validate:
r300_flush_textures(r300);
}
- if (r300->dirty_state & R300_NEW_VERTEX_FORMAT) {
- r300_emit_vertex_format_state(r300);
- r300->dirty_state &= ~R300_NEW_VERTEX_FORMAT;
- }
-
if (r300->dirty_state & (R300_NEW_VERTEX_SHADER | R300_NEW_VERTEX_SHADER_CONSTANTS)) {
r300_flush_pvs(r300);
}
diff --git a/src/gallium/drivers/r300/r300_emit.h b/src/gallium/drivers/r300/r300_emit.h
index 05a6bfeae86..6b96d9b57c0 100644
--- a/src/gallium/drivers/r300/r300_emit.h
+++ b/src/gallium/drivers/r300/r300_emit.h
@@ -51,8 +51,7 @@ void r500_emit_fragment_program_code(struct r300_context* r300,
void r500_emit_fs_constant_buffer(struct r300_context* r300,
struct rc_constant_list* constants);
-void r300_emit_fb_state(struct r300_context* r300,
- struct pipe_framebuffer_state* fb);
+void r300_emit_fb_state(struct r300_context* r300, void* state);
void r300_emit_query_begin(struct r300_context* r300,
struct r300_query* query);
@@ -61,8 +60,7 @@ void r300_emit_query_end(struct r300_context* r300);
void r300_emit_rs_state(struct r300_context* r300, void* state);
-void r300_emit_rs_block_state(struct r300_context* r300,
- struct r300_rs_block* rs);
+void r300_emit_rs_block_state(struct r300_context* r300, void* state);
void r300_emit_scissor_state(struct r300_context* r300, void* state);
@@ -73,7 +71,7 @@ void r300_emit_texture(struct r300_context* r300,
void r300_emit_vertex_buffer(struct r300_context* r300);
-void r300_emit_vertex_format_state(struct r300_context* r300);
+void r300_emit_vertex_format_state(struct r300_context* r300, void* state);
void r300_emit_vertex_program_code(struct r300_context* r300,
struct r300_vertex_program_code* code);
@@ -95,4 +93,6 @@ void r300_flush_textures(struct r300_context* r300);
/* Emit all dirty state. */
void r300_emit_dirty_state(struct r300_context* r300);
+void r300_emit_buffer_validate(struct r300_context *r300);
+
#endif /* R300_EMIT_H */
diff --git a/src/gallium/drivers/r300/r300_flush.c b/src/gallium/drivers/r300/r300_flush.c
index 15e612d8a6b..e37d3092703 100644
--- a/src/gallium/drivers/r300/r300_flush.c
+++ b/src/gallium/drivers/r300/r300_flush.c
@@ -29,7 +29,6 @@
#include "r300_cs.h"
#include "r300_emit.h"
#include "r300_flush.h"
-#include "r300_state_invariant.h"
static void r300_flush(struct pipe_context* pipe,
unsigned flags,
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
index 90de062bcda..95b7cb5fa49 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -28,6 +28,7 @@
#include "pipe/p_inlines.h"
+#include "util/u_format.h"
#include "util/u_memory.h"
#include "util/u_prim.h"
@@ -114,20 +115,60 @@ static uint32_t r300_provoking_vertex_fixes(struct r300_context *r300,
return color_control;
}
-static void r300_emit_draw_immediate(struct r300_context *r300,
- unsigned mode,
- unsigned start,
- unsigned count)
+static boolean immd_is_good_idea(struct r300_context *r300,
+ unsigned count)
{
- struct pipe_buffer* vbo = r300->vertex_buffer[0].buffer;
- unsigned vertex_size = r300->vertex_buffer[0].stride / sizeof(float);
- unsigned i;
- uint32_t* map;
+ return count <= 4;
+}
+
+static void r300_emit_draw_arrays_immediate(struct r300_context *r300,
+ unsigned mode,
+ unsigned start,
+ unsigned count)
+{
+ struct pipe_vertex_element* velem;
+ struct pipe_vertex_buffer* vbuf;
+ unsigned vertex_element_count = r300->vertex_element_count;
+ unsigned i, v, vbi, dw, elem_offset;
+
+ /* Size of the vertex, in dwords. */
+ unsigned vertex_size = 0;
+
+ /* Offsets of the attribute, in dwords, from the start of the vertex. */
+ unsigned offset[PIPE_MAX_ATTRIBS];
+
+ /* Size of the vertex element, in dwords. */
+ unsigned size[PIPE_MAX_ATTRIBS];
+
+ /* Stride to the same attrib in the next vertex in the vertex buffer,
+ * in dwords. */
+ unsigned stride[PIPE_MAX_ATTRIBS];
+
+ /* Mapped vertex buffers. */
+ uint32_t* map[PIPE_MAX_ATTRIBS] = {0};
+
CS_LOCALS(r300);
- map = (uint32_t*)pipe_buffer_map_range(r300->context.screen, vbo,
- start * vertex_size, count * vertex_size,
- PIPE_BUFFER_USAGE_CPU_READ);
+ /* Calculate the vertex size, offsets, strides etc. and map the buffers. */
+ for (i = 0; i < vertex_element_count; i++) {
+ velem = &r300->vertex_element[i];
+ offset[i] = velem->src_offset / 4;
+ size[i] = util_format_get_blocksize(velem->src_format) / 4;
+ vertex_size += size[i];
+ vbi = velem->vertex_buffer_index;
+
+ /* Map the buffer. */
+ if (!map[vbi]) {
+ vbuf = &r300->vertex_buffer[vbi];
+ map[vbi] = (uint32_t*)pipe_buffer_map(r300->context.screen,
+ vbuf->buffer,
+ PIPE_BUFFER_USAGE_CPU_READ);
+ map[vbi] += vbuf->buffer_offset / 4;
+ stride[vbi] = vbuf->stride / 4;
+ }
+ }
+
+ r300_emit_dirty_state(r300);
BEGIN_CS(10 + count * vertex_size);
OUT_CS_REG(R300_GA_COLOR_CONTROL,
@@ -138,18 +179,31 @@ static void r300_emit_draw_immediate(struct r300_context *r300,
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));
- //debug_printf("r300: Immd %d verts, %d attrs\n", count, vertex_size);
- for (i = 0; i < count * vertex_size; i++) {
- if (i % vertex_size == 0) {
- //debug_printf("r300: -- vert --\n");
+
+ /* Emit vertices. */
+ for (v = 0; v < count; v++) {
+ for (i = 0; i < vertex_element_count; i++) {
+ velem = &r300->vertex_element[i];
+ vbi = velem->vertex_buffer_index;
+ elem_offset = offset[i] + stride[vbi] * (v + start);
+
+ for (dw = 0; dw < size[i]; dw++) {
+ OUT_CS(map[vbi][elem_offset + dw]);
+ }
}
- //debug_printf("r300: 0x%08x\n", *map);
- OUT_CS(*map);
- map++;
}
END_CS;
- pipe_buffer_unmap(r300->context.screen, vbo);
+ /* Unmap buffers. */
+ for (i = 0; i < vertex_element_count; i++) {
+ vbi = r300->vertex_element[i].vertex_buffer_index;
+
+ if (map[vbi]) {
+ vbuf = &r300->vertex_buffer[vbi];
+ pipe_buffer_unmap(r300->context.screen, vbuf->buffer);
+ map[vbi] = NULL;
+ }
+ }
}
static void r300_emit_draw_arrays(struct r300_context *r300,
@@ -221,17 +275,18 @@ static void r300_emit_draw_elements(struct r300_context *r300,
END_CS;
}
-
static boolean r300_setup_vertex_buffers(struct r300_context *r300)
{
struct pipe_vertex_buffer *vbuf = r300->vertex_buffer;
struct pipe_vertex_element *velem = r300->vertex_element;
+ struct pipe_buffer *pbuf;
validate:
for (int i = 0; i < r300->vertex_element_count; i++) {
- if (!r300->winsys->add_buffer(r300->winsys,
- vbuf[velem[i].vertex_buffer_index].buffer,
- RADEON_GEM_DOMAIN_GTT, 0)) {
+ 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);
goto validate;
}
@@ -302,6 +357,8 @@ void r300_draw_range_elements(struct pipe_context* pipe,
r300_update_derived_state(r300);
+ r300_emit_buffer_validate(r300);
+
if (!r300_setup_vertex_buffers(r300)) {
return;
}
@@ -361,15 +418,16 @@ void r300_draw_arrays(struct pipe_context* pipe, unsigned mode,
r300_update_derived_state(r300);
- if (!r300_setup_vertex_buffers(r300)) {
- return;
- }
+ r300_emit_buffer_validate(r300);
- r300_emit_dirty_state(r300);
-
- if (FALSE && count <= 4 && r300->vertex_buffer_count == 1) {
- r300_emit_draw_immediate(r300, mode, start, count);
+ if (immd_is_good_idea(r300, count)) {
+ r300_emit_draw_arrays_immediate(r300, mode, start, count);
} else {
+ if (!r300_setup_vertex_buffers(r300)) {
+ return;
+ }
+
+ r300_emit_dirty_state(r300);
r300_emit_aos(r300, start);
r300_emit_draw_arrays(r300, mode, count);
}
@@ -404,6 +462,7 @@ void r300_swtcl_draw_arrays(struct pipe_context* pipe,
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));
@@ -448,6 +507,7 @@ void r300_swtcl_draw_range_elements(struct pipe_context* pipe,
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));
@@ -499,7 +559,7 @@ r300_render_get_vertex_info(struct vbuf_render* render)
r300_update_derived_state(r300);
- return &r300->vertex_info->vinfo;
+ return (struct vertex_info*)r300->vertex_format_state.state;
}
static boolean r300_render_allocate_vertices(struct vbuf_render* render,
diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
index ebe87934867..b8fbf03d3a9 100644
--- a/src/gallium/drivers/r300/r300_screen.c
+++ b/src/gallium/drivers/r300/r300_screen.c
@@ -222,6 +222,7 @@ static boolean r300_is_format_supported(struct pipe_screen* screen,
case PIPE_FORMAT_DXT5_RGBA:
case PIPE_FORMAT_YCBCR:
case PIPE_FORMAT_L8_UNORM:
+ case PIPE_FORMAT_A8_UNORM:
case PIPE_FORMAT_A8L8_UNORM:
retval = usage & PIPE_TEXTURE_USAGE_SAMPLER;
break;
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index c5e313ce437..3cdcf94274c 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -30,7 +30,6 @@
#include "tgsi/tgsi_parse.h"
#include "pipe/p_config.h"
-#include "pipe/internal/p_winsys_screen.h"
#include "r300_context.h"
#include "r300_reg.h"
@@ -488,20 +487,30 @@ static void
struct r300_context* r300 = r300_context(pipe);
uint32_t zbuffer_bpp = 0;
+ r300->fb_state.size = (10 * state->nr_cbufs) +
+ (2 * (4 - state->nr_cbufs)) +
+ (state->zsbuf ? 10 : 0) + 6;
+
+ if (state->nr_cbufs > 4) {
+ debug_printf("r300: Implementation error: Too many MRTs in %s, "
+ "refusing to bind framebuffer state!\n", __FUNCTION__);
+ return;
+ }
+
if (r300->draw) {
draw_flush(r300->draw);
}
- r300->framebuffer_state = *state;
+ r300->fb_state.state = state;
/* Don't rely on the order of states being set for the first time. */
- r300->dirty_state |= R300_NEW_FRAMEBUFFERS;
-
+ /* XXX wait what */
r300->blend_state.dirty = TRUE;
r300->dsa_state.dirty = TRUE;
+ r300->fb_state.dirty = TRUE;
r300->scissor_state.dirty = TRUE;
- /* Polyfon offset depends on the zbuffer bit depth. */
+ /* Polygon offset depends on the zbuffer bit depth. */
if (state->zsbuf && r300->polygon_offset_enabled) {
switch (util_format_get_blocksize(state->zsbuf->texture->format)) {
case 2:
@@ -552,7 +561,7 @@ static void r300_bind_fs_state(struct pipe_context* pipe, void* shader)
r300_pick_fragment_shader(r300);
if (r300->vs && r300_vertex_shader_setup_wpos(r300)) {
- r300->dirty_state |= R300_NEW_VERTEX_FORMAT;
+ r300->vertex_format_state.dirty = TRUE;
}
r300->dirty_state |= R300_NEW_FRAGMENT_SHADER | R300_NEW_FRAGMENT_SHADER_CONSTANTS;
@@ -720,7 +729,6 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state)
r300->viewport_state.dirty = TRUE;
/* XXX Clean these up when we move to atom emits */
- r300->dirty_state |= R300_NEW_RS_BLOCK;
if (r300->fs && r300->fs->inputs.wpos != ATTR_UNUSED) {
r300->dirty_state |= R300_NEW_FRAGMENT_SHADER_CONSTANTS;
}
@@ -921,7 +929,23 @@ static void r300_set_vertex_buffers(struct pipe_context* pipe,
draw_set_vertex_buffers(r300->draw, count, buffers);
}
- r300->dirty_state |= R300_NEW_VERTEX_FORMAT;
+ r300->vertex_format_state.dirty = TRUE;
+}
+
+static boolean r300_validate_aos(struct r300_context *r300)
+{
+ 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;
+ }
+ }
+ return TRUE;
}
static void r300_set_vertex_elements(struct pipe_context* pipe,
@@ -939,6 +963,12 @@ static void r300_set_vertex_elements(struct pipe_context* pipe,
draw_flush(r300->draw);
draw_set_vertex_elements(r300->draw, count, elements);
}
+
+ if (!r300_validate_aos(r300)) {
+ /* XXX We should fallback using draw. */
+ assert(0);
+ abort();
+ }
}
static void* r300_create_vs_state(struct pipe_context* pipe,
@@ -979,9 +1009,10 @@ static void r300_bind_vs_state(struct pipe_context* pipe, void* shader)
r300_vertex_shader_setup_wpos(r300);
}
+ r300->vertex_format_state.dirty = TRUE;
+
r300->dirty_state |=
- R300_NEW_VERTEX_SHADER | R300_NEW_VERTEX_SHADER_CONSTANTS |
- R300_NEW_VERTEX_FORMAT;
+ R300_NEW_VERTEX_SHADER | R300_NEW_VERTEX_SHADER_CONSTANTS;
} else {
draw_flush(r300->draw);
draw_bind_vertex_shader(r300->draw,
diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c
index 99c2720897f..bad9e76067c 100644
--- a/src/gallium/drivers/r300/r300_state_derived.c
+++ b/src/gallium/drivers/r300/r300_state_derived.c
@@ -37,32 +37,6 @@
/* r300_state_derived: Various bits of state which are dependent upon
* currently bound CSO data. */
-struct r300_shader_key {
- struct r300_vertex_shader* vs;
- struct r300_fragment_shader* fs;
-};
-
-struct r300_shader_derived_value {
- struct r300_vertex_format* vformat;
- struct r300_rs_block* rs_block;
-};
-
-unsigned r300_shader_key_hash(void* key) {
- struct r300_shader_key* shader_key = (struct r300_shader_key*)key;
- unsigned vs = (intptr_t)shader_key->vs;
- unsigned fs = (intptr_t)shader_key->fs;
-
- return (vs << 16) | (fs & 0xffff);
-}
-
-int r300_shader_key_compare(void* key1, void* key2) {
- struct r300_shader_key* shader_key1 = (struct r300_shader_key*)key1;
- struct r300_shader_key* shader_key2 = (struct r300_shader_key*)key2;
-
- return (shader_key1->vs == shader_key2->vs) &&
- (shader_key1->fs == shader_key2->fs);
-}
-
static void r300_draw_emit_attrib(struct r300_context* r300,
enum attrib_emit emit,
enum interp_mode interp,
@@ -74,7 +48,9 @@ static void r300_draw_emit_attrib(struct r300_context* r300,
output = draw_find_shader_output(r300->draw,
info->output_semantic_name[index],
info->output_semantic_index[index]);
- draw_emit_vertex_attr(&r300->vertex_info->vinfo, emit, interp, output);
+ draw_emit_vertex_attr(
+ (struct vertex_info*)r300->vertex_format_state.state,
+ emit, interp, output);
}
static void r300_draw_emit_all_attribs(struct r300_context* r300)
@@ -130,7 +106,8 @@ static void r300_draw_emit_all_attribs(struct r300_context* r300)
/* Update the PSC tables. */
static void r300_vertex_psc(struct r300_context* r300)
{
- struct r300_vertex_info *vformat = r300->vertex_info;
+ struct r300_vertex_info *vformat =
+ (struct r300_vertex_info*)r300->vertex_format_state.state;
uint16_t type, swizzle;
enum pipe_format format;
unsigned i;
@@ -182,7 +159,8 @@ static void r300_vertex_psc(struct r300_context* r300)
/* Update the PSC tables for SW TCL, using Draw. */
static void r300_swtcl_vertex_psc(struct r300_context* r300)
{
- struct r300_vertex_info *vformat = r300->vertex_info;
+ struct r300_vertex_info *vformat =
+ (struct r300_vertex_info*)r300->vertex_format_state.state;
struct vertex_info* vinfo = &vformat->vinfo;
uint16_t type, swizzle;
enum pipe_format format;
@@ -327,7 +305,7 @@ static void r300_update_rs_block(struct r300_context* r300,
struct r300_shader_semantics* vs_outputs,
struct r300_shader_semantics* fs_inputs)
{
- struct r300_rs_block* rs = r300->rs_block;
+ struct r300_rs_block rs = { { 0 } };
int i, col_count = 0, tex_count = 0, fp_offset = 0;
void (*rX00_rs_col)(struct r300_rs_block*, int, int, boolean);
void (*rX00_rs_col_write)(struct r300_rs_block*, int, int);
@@ -354,11 +332,11 @@ static void r300_update_rs_block(struct r300_context* r300,
vs_outputs->color[1] != ATTR_UNUSED) {
/* Always rasterize if it's written by the VS,
* otherwise it locks up. */
- rX00_rs_col(rs, col_count, i, FALSE);
+ rX00_rs_col(&rs, col_count, i, FALSE);
/* Write it to the FS input register if it's used by the FS. */
if (fs_inputs->color[i] != ATTR_UNUSED) {
- rX00_rs_col_write(rs, col_count, fp_offset);
+ rX00_rs_col_write(&rs, col_count, fp_offset);
fp_offset++;
}
col_count++;
@@ -376,11 +354,11 @@ static void r300_update_rs_block(struct r300_context* r300,
if (vs_outputs->generic[i] != ATTR_UNUSED) {
/* Always rasterize if it's written by the VS,
* otherwise it locks up. */
- rX00_rs_tex(rs, tex_count, tex_count, FALSE);
+ rX00_rs_tex(&rs, tex_count, tex_count, FALSE);
/* Write it to the FS input register if it's used by the FS. */
if (fs_inputs->generic[i] != ATTR_UNUSED) {
- rX00_rs_tex_write(rs, tex_count, fp_offset);
+ rX00_rs_tex_write(&rs, tex_count, fp_offset);
fp_offset++;
}
tex_count++;
@@ -397,11 +375,11 @@ static void r300_update_rs_block(struct r300_context* r300,
if (vs_outputs->fog != ATTR_UNUSED) {
/* Always rasterize if it's written by the VS,
* otherwise it locks up. */
- rX00_rs_tex(rs, tex_count, tex_count, TRUE);
+ rX00_rs_tex(&rs, tex_count, tex_count, TRUE);
/* Write it to the FS input register if it's used by the FS. */
if (fs_inputs->fog != ATTR_UNUSED) {
- rX00_rs_tex_write(rs, tex_count, fp_offset);
+ rX00_rs_tex_write(&rs, tex_count, fp_offset);
fp_offset++;
}
tex_count++;
@@ -416,8 +394,8 @@ static void r300_update_rs_block(struct r300_context* r300,
/* Rasterize WPOS. */
/* If the FS doesn't need it, it's not written by the VS. */
if (fs_inputs->wpos != ATTR_UNUSED) {
- rX00_rs_tex(rs, tex_count, tex_count, FALSE);
- rX00_rs_tex_write(rs, tex_count, fp_offset);
+ rX00_rs_tex(&rs, tex_count, tex_count, FALSE);
+ rX00_rs_tex_write(&rs, tex_count, fp_offset);
fp_offset++;
tex_count++;
@@ -425,51 +403,33 @@ static void r300_update_rs_block(struct r300_context* r300,
/* Rasterize at least one color, or bad things happen. */
if (col_count == 0 && tex_count == 0) {
- rX00_rs_col(rs, 0, 0, TRUE);
+ rX00_rs_col(&rs, 0, 0, TRUE);
col_count++;
}
- rs->count = (tex_count*4) | (col_count << R300_IC_COUNT_SHIFT) |
+ rs.count = (tex_count*4) | (col_count << R300_IC_COUNT_SHIFT) |
R300_HIRES_EN;
- rs->inst_count = MAX3(col_count - 1, tex_count - 1, 0);
+ rs.inst_count = MAX3(col_count - 1, tex_count - 1, 0);
+
+ /* Now, after all that, see if we actually need to update the state. */
+ if (memcmp(r300->rs_block_state.state, &rs, sizeof(struct r300_rs_block))) {
+ memcpy(r300->rs_block_state.state, &rs, sizeof(struct r300_rs_block));
+ r300->rs_block_state.dirty = TRUE;
+ }
}
-/* Update the vertex format. */
+/* Update the shader-dependant states. */
static void r300_update_derived_shader_state(struct r300_context* r300)
{
struct r300_screen* r300screen = r300_screen(r300->context.screen);
+ struct r300_vertex_info *vformat =
+ (struct r300_vertex_info*)r300->vertex_format_state.state;
+ struct vertex_info* vinfo = &vformat->vinfo;
- /*
- struct r300_shader_key* key;
- struct r300_shader_derived_value* value;
- key = CALLOC_STRUCT(r300_shader_key);
- key->vs = r300->vs;
- key->fs = r300->fs;
-
- value = (struct r300_shader_derived_value*)
- util_hash_table_get(r300->shader_hash_table, (void*)key);
- if (value) {
- //vformat = value->vformat;
- rs_block = value->rs_block;
-
- FREE(key);
- } else {
- rs_block = CALLOC_STRUCT(r300_rs_block);
- value = CALLOC_STRUCT(r300_shader_derived_value);
-
- r300_update_rs_block(r300, rs_block);
-
- //value->vformat = vformat;
- value->rs_block = rs_block;
- util_hash_table_set(r300->shader_hash_table,
- (void*)key, (void*)value);
- } */
-
- /* Reset structures */
- memset(r300->rs_block, 0, sizeof(struct r300_rs_block));
- memset(r300->vertex_info, 0, sizeof(struct r300_vertex_info));
- memcpy(r300->vertex_info->vinfo.hwfmt, r300->vs->hwfmt, sizeof(uint)*4);
+ /* Mmm, delicious hax */
+ memset(r300->vertex_format_state.state, 0, sizeof(struct r300_vertex_info));
+ memcpy(vinfo->hwfmt, r300->vs->hwfmt, sizeof(uint)*4);
r300_update_rs_block(r300, &r300->vs->outputs, &r300->fs->inputs);
@@ -477,11 +437,10 @@ static void r300_update_derived_shader_state(struct r300_context* r300)
r300_vertex_psc(r300);
} else {
r300_draw_emit_all_attribs(r300);
- draw_compute_vertex_size(&r300->vertex_info->vinfo);
+ draw_compute_vertex_size(
+ (struct vertex_info*)r300->vertex_format_state.state);
r300_swtcl_vertex_psc(r300);
}
-
- r300->dirty_state |= R300_NEW_RS_BLOCK;
}
static boolean r300_dsa_writes_depth_stencil(struct r300_dsa_state* dsa)
@@ -559,8 +518,8 @@ void r300_update_derived_state(struct r300_context* r300)
{
/* XXX */
if (r300->dirty_state &
- (R300_NEW_FRAGMENT_SHADER | R300_NEW_VERTEX_SHADER |
- R300_NEW_VERTEX_FORMAT) || r300->rs_state.dirty) {
+ (R300_NEW_FRAGMENT_SHADER | R300_NEW_VERTEX_SHADER) ||
+ r300->vertex_format_state.dirty || r300->rs_state.dirty) {
r300_update_derived_shader_state(r300);
}
diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c
index 1f73f74c268..67bf8ce13fd 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -30,6 +30,8 @@
#include "r300_texture.h"
#include "r300_screen.h"
+#include "radeon_winsys.h"
+
#define TILE_WIDTH 0
#define TILE_HEIGHT 1
@@ -209,6 +211,7 @@ static struct pipe_texture*
{
struct r300_texture* tex = CALLOC_STRUCT(r300_texture);
struct r300_screen* rscreen = r300_screen(screen);
+ struct radeon_winsys* winsys = (struct radeon_winsys*)screen->winsys;
if (!tex) {
return NULL;
@@ -225,6 +228,10 @@ static struct pipe_texture*
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);
if (!tex->buffer) {
FREE(tex);
diff --git a/src/gallium/drivers/r300/r300_texture.h b/src/gallium/drivers/r300/r300_texture.h
index 1be1e6843c2..453fb1accc2 100644
--- a/src/gallium/drivers/r300/r300_texture.h
+++ b/src/gallium/drivers/r300/r300_texture.h
@@ -42,6 +42,7 @@ static INLINE uint32_t r300_translate_texformat(enum pipe_format format)
{
switch (format) {
/* X8 */
+ case PIPE_FORMAT_A8_UNORM:
case PIPE_FORMAT_I8_UNORM:
return R300_EASY_TX_FORMAT(X, X, X, X, X8);
case PIPE_FORMAT_L8_UNORM:
diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c
index 8e017939402..53133d28888 100644
--- a/src/gallium/drivers/softpipe/sp_context.c
+++ b/src/gallium/drivers/softpipe/sp_context.c
@@ -43,7 +43,6 @@
#include "sp_surface.h"
#include "sp_tile_cache.h"
#include "sp_tex_tile_cache.h"
-#include "sp_texture.h"
#include "sp_winsys.h"
#include "sp_query.h"
@@ -112,9 +111,13 @@ softpipe_destroy( struct pipe_context *pipe )
pipe_texture_reference(&softpipe->vertex_textures[i], NULL);
}
- for (i = 0; i < Elements(softpipe->constants); i++) {
- if (softpipe->constants[i]) {
- pipe_buffer_reference(&softpipe->constants[i], NULL);
+ for (i = 0; i < PIPE_SHADER_TYPES; i++) {
+ uint j;
+
+ for (j = 0; j < PIPE_MAX_CONSTANT_BUFFERS; j++) {
+ if (softpipe->constants[i][j]) {
+ pipe_buffer_reference(&softpipe->constants[i][j], NULL);
+ }
}
}
diff --git a/src/gallium/drivers/softpipe/sp_context.h b/src/gallium/drivers/softpipe/sp_context.h
index da673c57ada..be4613b6228 100644
--- a/src/gallium/drivers/softpipe/sp_context.h
+++ b/src/gallium/drivers/softpipe/sp_context.h
@@ -63,7 +63,7 @@ struct softpipe_context {
/** Other rendering state */
struct pipe_blend_color blend_color;
struct pipe_clip_state clip;
- struct pipe_buffer *constants[PIPE_SHADER_TYPES];
+ struct pipe_buffer *constants[PIPE_SHADER_TYPES][PIPE_MAX_CONSTANT_BUFFERS];
struct pipe_framebuffer_state framebuffer;
struct pipe_poly_stipple poly_stipple;
struct pipe_scissor_state scissor;
@@ -92,7 +92,7 @@ struct softpipe_context {
ubyte *mapped_vbuffer[PIPE_MAX_ATTRIBS];
/** Mapped constant buffers */
- void *mapped_constants[PIPE_SHADER_TYPES];
+ 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 03b58d2fb72..2b82427d546 100644
--- a/src/gallium/drivers/softpipe/sp_draw_arrays.c
+++ b/src/gallium/drivers/softpipe/sp_draw_arrays.c
@@ -49,30 +49,36 @@ static void
softpipe_map_constant_buffers(struct softpipe_context *sp)
{
struct pipe_winsys *ws = sp->pipe.winsys;
- uint i, vssize, gssize;
+ uint i;
for (i = 0; i < PIPE_SHADER_TYPES; 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);
+ 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);
+ }
+ }
}
- if (sp->constants[PIPE_SHADER_VERTEX])
- vssize = sp->constants[PIPE_SHADER_VERTEX]->size;
- else
- vssize = 0;
-
- if (sp->constants[PIPE_SHADER_GEOMETRY])
- gssize = sp->constants[PIPE_SHADER_GEOMETRY]->size;
- else
- gssize = 0;
-
- draw_set_mapped_constant_buffer(sp->draw, PIPE_SHADER_VERTEX,
- sp->mapped_constants[PIPE_SHADER_VERTEX],
- vssize);
- draw_set_mapped_constant_buffer(sp->draw, PIPE_SHADER_GEOMETRY,
- sp->mapped_constants[PIPE_SHADER_GEOMETRY],
- gssize);
+ 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);
+ }
+ }
}
@@ -87,13 +93,28 @@ softpipe_unmap_constant_buffers(struct softpipe_context *sp)
*/
draw_flush(sp->draw);
- draw_set_mapped_constant_buffer(sp->draw, PIPE_SHADER_VERTEX, NULL, 0);
- draw_set_mapped_constant_buffer(sp->draw, PIPE_SHADER_GEOMETRY, NULL, 0);
+ 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++) {
- if (sp->constants[i] && sp->constants[i]->size)
- ws->buffer_unmap(ws, sp->constants[i]);
- sp->mapped_constants[i] = NULL;
+ 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;
+ }
}
}
diff --git a/src/gallium/drivers/softpipe/sp_flush.c b/src/gallium/drivers/softpipe/sp_flush.c
index 75dac810a12..e8952bf4fb8 100644
--- a/src/gallium/drivers/softpipe/sp_flush.c
+++ b/src/gallium/drivers/softpipe/sp_flush.c
@@ -34,11 +34,9 @@
#include "draw/draw_context.h"
#include "sp_flush.h"
#include "sp_context.h"
-#include "sp_surface.h"
#include "sp_state.h"
#include "sp_tile_cache.h"
#include "sp_tex_tile_cache.h"
-#include "sp_winsys.h"
void
diff --git a/src/gallium/drivers/softpipe/sp_fs_sse.c b/src/gallium/drivers/softpipe/sp_fs_sse.c
index f9129506585..acee2136706 100644
--- a/src/gallium/drivers/softpipe/sp_fs_sse.c
+++ b/src/gallium/drivers/softpipe/sp_fs_sse.c
@@ -135,7 +135,7 @@ fs_sse_run( const struct sp_fragment_shader *base,
tgsi_set_exec_mask(machine, 1, 1, 1, 1);
shader->func( machine,
- machine->Consts,
+ (const float (*)[4])machine->Consts[0],
(const float (*)[4])shader->immediates,
machine->InterpCoefs
/*, &machine->QuadPos*/
diff --git a/src/gallium/drivers/softpipe/sp_prim_vbuf.c b/src/gallium/drivers/softpipe/sp_prim_vbuf.c
index 5812d1eefeb..98c08eaffaf 100644
--- a/src/gallium/drivers/softpipe/sp_prim_vbuf.c
+++ b/src/gallium/drivers/softpipe/sp_prim_vbuf.c
@@ -526,7 +526,8 @@ static void
sp_vbuf_destroy(struct vbuf_render *vbr)
{
struct softpipe_vbuf_render *cvbr = softpipe_vbuf_render(vbr);
- align_free(cvbr->vertex_buffer);
+ if(cvbr->vertex_buffer)
+ align_free(cvbr->vertex_buffer);
sp_setup_destroy_context(cvbr->setup);
FREE(cvbr);
}
diff --git a/src/gallium/drivers/softpipe/sp_quad_blend.c b/src/gallium/drivers/softpipe/sp_quad_blend.c
index a1fe5192b03..d65307b7f60 100644
--- a/src/gallium/drivers/softpipe/sp_quad_blend.c
+++ b/src/gallium/drivers/softpipe/sp_quad_blend.c
@@ -35,7 +35,6 @@
#include "util/u_memory.h"
#include "sp_context.h"
#include "sp_quad.h"
-#include "sp_surface.h"
#include "sp_tile_cache.h"
#include "sp_quad_pipe.h"
diff --git a/src/gallium/drivers/softpipe/sp_quad_depth_test.c b/src/gallium/drivers/softpipe/sp_quad_depth_test.c
index 0ca86c4e1cb..a981775cbd3 100644
--- a/src/gallium/drivers/softpipe/sp_quad_depth_test.c
+++ b/src/gallium/drivers/softpipe/sp_quad_depth_test.c
@@ -30,11 +30,11 @@
*/
#include "pipe/p_defines.h"
+#include "util/u_format.h"
#include "util/u_memory.h"
#include "tgsi/tgsi_scan.h"
#include "sp_context.h"
#include "sp_quad.h"
-#include "sp_surface.h"
#include "sp_quad_pipe.h"
#include "sp_tile_cache.h"
#include "sp_state.h" /* for sp_fragment_shader */
@@ -651,6 +651,20 @@ static unsigned mask_count[16] =
+/** helper to get number of Z buffer bits */
+static unsigned
+get_depth_bits(struct quad_stage *qs)
+{
+ struct pipe_surface *zsurf = qs->softpipe->framebuffer.zsbuf;
+ if (zsurf)
+ return util_format_get_component_bits(zsurf->format,
+ UTIL_FORMAT_COLORSPACE_ZS, 0);
+ else
+ return 0;
+}
+
+
+
static void
depth_test_quads_fallback(struct quad_stage *qs,
struct quad_header *quads[],
@@ -666,7 +680,7 @@ depth_test_quads_fallback(struct quad_stage *qs,
nr = alpha_test_quads(qs, quads, nr);
}
- if (qs->softpipe->framebuffer.zsbuf &&
+ if (get_depth_bits(qs) > 0 &&
(qs->softpipe->depth_stencil->depth.enabled ||
qs->softpipe->depth_stencil->stencil[0].enabled)) {
@@ -884,7 +898,7 @@ choose_depth_test(struct quad_stage *qs,
boolean alpha = qs->softpipe->depth_stencil->alpha.enabled;
- boolean depth = (qs->softpipe->framebuffer.zsbuf &&
+ boolean depth = (get_depth_bits(qs) > 0 &&
qs->softpipe->depth_stencil->depth.enabled);
unsigned depthfunc = qs->softpipe->depth_stencil->depth.func;
@@ -895,7 +909,6 @@ choose_depth_test(struct quad_stage *qs,
boolean occlusion = qs->softpipe->active_query_count;
-
if (!alpha &&
!depth &&
!stencil) {
diff --git a/src/gallium/drivers/softpipe/sp_quad_fs.c b/src/gallium/drivers/softpipe/sp_quad_fs.c
index 1e7533d0f9e..ad04dc2afc3 100644
--- a/src/gallium/drivers/softpipe/sp_quad_fs.c
+++ b/src/gallium/drivers/softpipe/sp_quad_fs.c
@@ -45,8 +45,6 @@
#include "sp_state.h"
#include "sp_quad.h"
#include "sp_quad_pipe.h"
-#include "sp_texture.h"
-#include "sp_tex_sample.h"
struct quad_shade_stage
@@ -109,10 +107,11 @@ shade_quads(struct quad_stage *qs,
struct quad_shade_stage *qss = quad_shade_stage( qs );
struct softpipe_context *softpipe = qs->softpipe;
struct tgsi_exec_machine *machine = qss->machine;
-
unsigned i, pass = 0;
-
- machine->Consts = softpipe->mapped_constants[PIPE_SHADER_FRAGMENT];
+
+ for (i = 0; i < PIPE_MAX_CONSTANT_BUFFERS; i++) {
+ machine->Consts[i] = softpipe->mapped_constants[PIPE_SHADER_FRAGMENT][i];
+ }
machine->InterpCoefs = quads[0]->coef;
for (i = 0; i < nr; i++) {
diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
index e36f9ec5dab..b2841f41031 100644
--- a/src/gallium/drivers/softpipe/sp_screen.c
+++ b/src/gallium/drivers/softpipe/sp_screen.c
@@ -91,6 +91,10 @@ softpipe_get_param(struct pipe_screen *screen, int param)
return 1;
case PIPE_CAP_BLEND_EQUATION_SEPARATE:
return 1;
+ case PIPE_CAP_MAX_CONST_BUFFERS:
+ return PIPE_MAX_CONSTANT_BUFFERS;
+ case PIPE_CAP_MAX_CONST_BUFFER_SIZE:
+ return 4096 * 4 * sizeof(float);
case PIPE_CAP_INDEP_BLEND_ENABLE:
return 1;
case PIPE_CAP_INDEP_BLEND_FUNC:
diff --git a/src/gallium/drivers/softpipe/sp_setup.c b/src/gallium/drivers/softpipe/sp_setup.c
index 3da75364c5d..f6c3a2b38b9 100644
--- a/src/gallium/drivers/softpipe/sp_setup.c
+++ b/src/gallium/drivers/softpipe/sp_setup.c
@@ -41,7 +41,6 @@
#include "draw/draw_private.h"
#include "draw/draw_vertex.h"
#include "pipe/p_shader_tokens.h"
-#include "pipe/p_thread.h"
#include "util/u_math.h"
#include "util/u_memory.h"
diff --git a/src/gallium/drivers/softpipe/sp_state_fs.c b/src/gallium/drivers/softpipe/sp_state_fs.c
index b7ed4441b43..04bdcaacc25 100644
--- a/src/gallium/drivers/softpipe/sp_state_fs.c
+++ b/src/gallium/drivers/softpipe/sp_state_fs.c
@@ -164,12 +164,12 @@ softpipe_set_constant_buffer(struct pipe_context *pipe,
struct softpipe_context *softpipe = softpipe_context(pipe);
assert(shader < PIPE_SHADER_TYPES);
- assert(index == 0);
+ assert(index < PIPE_MAX_CONSTANT_BUFFERS);
draw_flush(softpipe->draw);
/* note: reference counting */
- pipe_buffer_reference(&softpipe->constants[shader], buf);
+ pipe_buffer_reference(&softpipe->constants[shader][index], buf);
softpipe->dirty |= SP_NEW_CONSTANTS;
}
diff --git a/src/gallium/drivers/softpipe/sp_state_surface.c b/src/gallium/drivers/softpipe/sp_state_surface.c
index f6154109ea8..39466782195 100644
--- a/src/gallium/drivers/softpipe/sp_state_surface.c
+++ b/src/gallium/drivers/softpipe/sp_state_surface.c
@@ -30,7 +30,6 @@
#include "sp_context.h"
#include "sp_state.h"
-#include "sp_surface.h"
#include "sp_tile_cache.h"
#include "draw/draw_context.h"
diff --git a/src/gallium/drivers/softpipe/sp_state_vertex.c b/src/gallium/drivers/softpipe/sp_state_vertex.c
index 46b6991195d..b491d92ed15 100644
--- a/src/gallium/drivers/softpipe/sp_state_vertex.c
+++ b/src/gallium/drivers/softpipe/sp_state_vertex.c
@@ -31,7 +31,6 @@
#include "sp_context.h"
#include "sp_state.h"
-#include "sp_surface.h"
#include "draw/draw_context.h"
diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c
index 1ae8fecacf7..473ec3e150a 100644
--- a/src/gallium/drivers/softpipe/sp_tex_sample.c
+++ b/src/gallium/drivers/softpipe/sp_tex_sample.c
@@ -517,7 +517,6 @@ compute_lambda_1d(const struct sp_sampler_varient *samp,
const float p[QUAD_SIZE])
{
const struct pipe_texture *texture = samp->texture;
- const struct pipe_sampler_state *sampler = samp->sampler;
float dsdx = fabsf(s[QUAD_BOTTOM_RIGHT] - s[QUAD_BOTTOM_LEFT]);
float dsdy = fabsf(s[QUAD_TOP_LEFT] - s[QUAD_BOTTOM_LEFT]);
float rho = MAX2(dsdx, dsdy) * texture->width0;
@@ -533,7 +532,6 @@ compute_lambda_2d(const struct sp_sampler_varient *samp,
const float p[QUAD_SIZE])
{
const struct pipe_texture *texture = samp->texture;
- const struct pipe_sampler_state *sampler = samp->sampler;
float dsdx = fabsf(s[QUAD_BOTTOM_RIGHT] - s[QUAD_BOTTOM_LEFT]);
float dsdy = fabsf(s[QUAD_TOP_LEFT] - s[QUAD_BOTTOM_LEFT]);
float dtdx = fabsf(t[QUAD_BOTTOM_RIGHT] - t[QUAD_BOTTOM_LEFT]);
@@ -553,7 +551,6 @@ compute_lambda_3d(const struct sp_sampler_varient *samp,
const float p[QUAD_SIZE])
{
const struct pipe_texture *texture = samp->texture;
- const struct pipe_sampler_state *sampler = samp->sampler;
float dsdx = fabsf(s[QUAD_BOTTOM_RIGHT] - s[QUAD_BOTTOM_LEFT]);
float dsdy = fabsf(s[QUAD_TOP_LEFT] - s[QUAD_BOTTOM_LEFT]);
float dtdx = fabsf(t[QUAD_BOTTOM_RIGHT] - t[QUAD_BOTTOM_LEFT]);
diff --git a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c
index e50a76a73bc..50242d5bd69 100644
--- a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c
+++ b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c
@@ -37,7 +37,6 @@
#include "util/u_tile.h"
#include "util/u_math.h"
#include "sp_context.h"
-#include "sp_surface.h"
#include "sp_texture.h"
#include "sp_tex_tile_cache.h"
diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c
index fae72c81aa1..a5fff915077 100644
--- a/src/gallium/drivers/softpipe/sp_texture.c
+++ b/src/gallium/drivers/softpipe/sp_texture.c
@@ -38,7 +38,6 @@
#include "util/u_memory.h"
#include "sp_context.h"
-#include "sp_state.h"
#include "sp_texture.h"
#include "sp_screen.h"
#include "sp_winsys.h"
@@ -291,6 +290,10 @@ softpipe_get_tex_transfer(struct pipe_screen *screen,
assert(texture);
assert(level <= texture->last_level);
+ /* make sure the requested region is in the image bounds */
+ assert(x + w <= u_minify(texture->width0, level));
+ assert(y + h <= u_minify(texture->height0, level));
+
spt = CALLOC_STRUCT(softpipe_transfer);
if (spt) {
struct pipe_transfer *pt = &spt->base;
diff --git a/src/gallium/drivers/softpipe/sp_winsys.c b/src/gallium/drivers/softpipe/sp_winsys.c
index 8169071dc9f..38bcd64c6a5 100644
--- a/src/gallium/drivers/softpipe/sp_winsys.c
+++ b/src/gallium/drivers/softpipe/sp_winsys.c
@@ -39,7 +39,6 @@
#include "pipe/internal/p_winsys_screen.h"/* port to just p_screen */
#include "pipe/p_format.h"
#include "pipe/p_context.h"
-#include "pipe/p_inlines.h"
#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
diff --git a/src/gallium/drivers/svga/svga_draw_arrays.c b/src/gallium/drivers/svga/svga_draw_arrays.c
index 75492dffca2..6b6ebc9b585 100644
--- a/src/gallium/drivers/svga/svga_draw_arrays.c
+++ b/src/gallium/drivers/svga/svga_draw_arrays.c
@@ -26,7 +26,6 @@
#include "svga_cmd.h"
#include "pipe/p_inlines.h"
-#include "util/u_prim.h"
#include "indices/u_indices.h"
#include "svga_hw_reg.h"
diff --git a/src/gallium/drivers/svga/svga_draw_elements.c b/src/gallium/drivers/svga/svga_draw_elements.c
index 167d8178315..022b444eb91 100644
--- a/src/gallium/drivers/svga/svga_draw_elements.c
+++ b/src/gallium/drivers/svga/svga_draw_elements.c
@@ -24,7 +24,6 @@
**********************************************************/
#include "pipe/p_inlines.h"
-#include "util/u_prim.h"
#include "util/u_upload_mgr.h"
#include "indices/u_indices.h"
diff --git a/src/gallium/drivers/svga/svga_pipe_blend.c b/src/gallium/drivers/svga/svga_pipe_blend.c
index 40292993115..9df5485f462 100644
--- a/src/gallium/drivers/svga/svga_pipe_blend.c
+++ b/src/gallium/drivers/svga/svga_pipe_blend.c
@@ -29,7 +29,6 @@
#include "util/u_memory.h"
#include "svga_context.h"
-#include "svga_state.h"
#include "svga_hw_reg.h"
diff --git a/src/gallium/drivers/svga/svga_pipe_constants.c b/src/gallium/drivers/svga/svga_pipe_constants.c
index ca2c7c49d72..93022f3cc51 100644
--- a/src/gallium/drivers/svga/svga_pipe_constants.c
+++ b/src/gallium/drivers/svga/svga_pipe_constants.c
@@ -30,9 +30,6 @@
#include "tgsi/tgsi_parse.h"
#include "svga_context.h"
-#include "svga_state.h"
-#include "svga_hw_reg.h"
-#include "svga_cmd.h"
/***********************************************************************
* Constant buffers
diff --git a/src/gallium/drivers/svga/svga_pipe_depthstencil.c b/src/gallium/drivers/svga/svga_pipe_depthstencil.c
index df636c08a05..34e60cb341a 100644
--- a/src/gallium/drivers/svga/svga_pipe_depthstencil.c
+++ b/src/gallium/drivers/svga/svga_pipe_depthstencil.c
@@ -29,7 +29,6 @@
#include "util/u_memory.h"
#include "svga_context.h"
-#include "svga_state.h"
#include "svga_hw_reg.h"
diff --git a/src/gallium/drivers/svga/svga_pipe_draw.c b/src/gallium/drivers/svga/svga_pipe_draw.c
index 0f24ef4ee8d..4e0c499dc3e 100644
--- a/src/gallium/drivers/svga/svga_pipe_draw.c
+++ b/src/gallium/drivers/svga/svga_pipe_draw.c
@@ -33,7 +33,6 @@
#include "svga_hw_reg.h"
#include "svga_context.h"
#include "svga_screen.h"
-#include "svga_winsys.h"
#include "svga_draw.h"
#include "svga_state.h"
#include "svga_swtnl.h"
diff --git a/src/gallium/drivers/svga/svga_pipe_flush.c b/src/gallium/drivers/svga/svga_pipe_flush.c
index 0becb0765ac..3eb10336c4e 100644
--- a/src/gallium/drivers/svga/svga_pipe_flush.c
+++ b/src/gallium/drivers/svga/svga_pipe_flush.c
@@ -28,13 +28,8 @@
#include "svga_screen_texture.h"
#include "svga_context.h"
#include "svga_winsys.h"
-#include "svga_draw.h"
#include "svga_debug.h"
-#include "svga_hw_reg.h"
-
-
-
static void svga_flush( struct pipe_context *pipe,
unsigned flags,
diff --git a/src/gallium/drivers/svga/svga_pipe_fs.c b/src/gallium/drivers/svga/svga_pipe_fs.c
index 5f1213e46a3..32f07fb2616 100644
--- a/src/gallium/drivers/svga/svga_pipe_fs.c
+++ b/src/gallium/drivers/svga/svga_pipe_fs.c
@@ -32,11 +32,9 @@
#include "svga_screen.h"
#include "svga_context.h"
-#include "svga_state.h"
#include "svga_tgsi.h"
#include "svga_hw_reg.h"
#include "svga_cmd.h"
-#include "svga_draw.h"
#include "svga_debug.h"
diff --git a/src/gallium/drivers/svga/svga_pipe_misc.c b/src/gallium/drivers/svga/svga_pipe_misc.c
index 58cb1e6e230..8cf1f2e083a 100644
--- a/src/gallium/drivers/svga/svga_pipe_misc.c
+++ b/src/gallium/drivers/svga/svga_pipe_misc.c
@@ -27,12 +27,6 @@
#include "svga_context.h"
#include "svga_screen_texture.h"
-#include "svga_state.h"
-#include "svga_winsys.h"
-
-#include "svga_hw_reg.h"
-
-
static void svga_set_scissor_state( struct pipe_context *pipe,
diff --git a/src/gallium/drivers/svga/svga_pipe_query.c b/src/gallium/drivers/svga/svga_pipe_query.c
index 01336b0a2c3..08283e37317 100644
--- a/src/gallium/drivers/svga/svga_pipe_query.c
+++ b/src/gallium/drivers/svga/svga_pipe_query.c
@@ -32,7 +32,6 @@
#include "svga_screen.h"
#include "svga_screen_buffer.h"
#include "svga_winsys.h"
-#include "svga_draw.h"
#include "svga_debug.h"
diff --git a/src/gallium/drivers/svga/svga_pipe_rasterizer.c b/src/gallium/drivers/svga/svga_pipe_rasterizer.c
index b03f8eb9cf3..9ea11aad9a9 100644
--- a/src/gallium/drivers/svga/svga_pipe_rasterizer.c
+++ b/src/gallium/drivers/svga/svga_pipe_rasterizer.c
@@ -30,7 +30,6 @@
#include "util/u_memory.h"
#include "svga_context.h"
-#include "svga_state.h"
#include "svga_hw_reg.h"
diff --git a/src/gallium/drivers/svga/svga_pipe_sampler.c b/src/gallium/drivers/svga/svga_pipe_sampler.c
index 460a101f8c0..161c66dd4ff 100644
--- a/src/gallium/drivers/svga/svga_pipe_sampler.c
+++ b/src/gallium/drivers/svga/svga_pipe_sampler.c
@@ -32,9 +32,6 @@
#include "svga_context.h"
#include "svga_screen_texture.h"
-#include "svga_state.h"
-
-#include "svga_hw_reg.h"
#include "svga_debug.h"
diff --git a/src/gallium/drivers/svga/svga_pipe_vertex.c b/src/gallium/drivers/svga/svga_pipe_vertex.c
index 42f290d162a..0bf43fa9008 100644
--- a/src/gallium/drivers/svga/svga_pipe_vertex.c
+++ b/src/gallium/drivers/svga/svga_pipe_vertex.c
@@ -32,10 +32,6 @@
#include "svga_screen.h"
#include "svga_screen_buffer.h"
#include "svga_context.h"
-#include "svga_state.h"
-#include "svga_winsys.h"
-
-#include "svga_hw_reg.h"
static void svga_set_vertex_buffers(struct pipe_context *pipe,
diff --git a/src/gallium/drivers/svga/svga_pipe_vs.c b/src/gallium/drivers/svga/svga_pipe_vs.c
index 7e6ab576add..c4ac5304ac6 100644
--- a/src/gallium/drivers/svga/svga_pipe_vs.c
+++ b/src/gallium/drivers/svga/svga_pipe_vs.c
@@ -33,7 +33,6 @@
#include "svga_screen.h"
#include "svga_context.h"
-#include "svga_state.h"
#include "svga_tgsi.h"
#include "svga_hw_reg.h"
#include "svga_cmd.h"
diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
index fc1b3c980ef..cd1ed7bac8b 100644
--- a/src/gallium/drivers/svga/svga_screen.c
+++ b/src/gallium/drivers/svga/svga_screen.c
@@ -33,10 +33,8 @@
#include "svga_screen.h"
#include "svga_screen_texture.h"
#include "svga_screen_buffer.h"
-#include "svga_cmd.h"
#include "svga_debug.h"
-#include "svga_hw_reg.h"
#include "svga3d_shaderdefs.h"
@@ -393,8 +391,6 @@ svga_screen_create(struct svga_winsys_screen *sws)
pipe_mutex_init(svgascreen->tex_mutex);
pipe_mutex_init(svgascreen->swc_mutex);
- LIST_INITHEAD(&svgascreen->cached_buffers);
-
svga_screen_cache_init(svgascreen);
return screen;
diff --git a/src/gallium/drivers/svga/svga_screen.h b/src/gallium/drivers/svga/svga_screen.h
index b94ca7fc1ca..a009b607200 100644
--- a/src/gallium/drivers/svga/svga_screen.h
+++ b/src/gallium/drivers/svga/svga_screen.h
@@ -68,12 +68,6 @@ struct svga_screen
pipe_mutex tex_mutex;
pipe_mutex swc_mutex; /* Protects the use of swc and dirty_buffers */
- /**
- * List of buffers with cached GMR. Ordered from the most recently used to
- * the least recently used
- */
- struct list_head cached_buffers;
-
struct svga_host_surface_cache cache;
};
diff --git a/src/gallium/drivers/svga/svga_screen_buffer.c b/src/gallium/drivers/svga/svga_screen_buffer.c
index 58a1aba464b..430a6970fde 100644
--- a/src/gallium/drivers/svga/svga_screen_buffer.c
+++ b/src/gallium/drivers/svga/svga_screen_buffer.c
@@ -113,68 +113,9 @@ svga_buffer_destroy_hw_storage(struct svga_screen *ss, struct svga_buffer *sbuf)
if(sbuf->hw.buf) {
sws->buffer_destroy(sws, sbuf->hw.buf);
sbuf->hw.buf = NULL;
- assert(sbuf->head.prev && sbuf->head.next);
- LIST_DEL(&sbuf->head);
-#ifdef DEBUG
- sbuf->head.next = sbuf->head.prev = NULL;
-#endif
}
}
-static INLINE enum pipe_error
-svga_buffer_backup(struct svga_screen *ss, struct svga_buffer *sbuf)
-{
- if (sbuf->hw.buf && sbuf->hw.num_ranges) {
- void *src;
-
- if (!sbuf->swbuf)
- sbuf->swbuf = align_malloc(sbuf->base.size, sbuf->base.alignment);
- if (!sbuf->swbuf)
- return PIPE_ERROR_OUT_OF_MEMORY;
-
- src = ss->sws->buffer_map(ss->sws, sbuf->hw.buf,
- PIPE_BUFFER_USAGE_CPU_READ);
- if (!src)
- return PIPE_ERROR;
-
- memcpy(sbuf->swbuf, src, sbuf->base.size);
- ss->sws->buffer_unmap(ss->sws, sbuf->hw.buf);
- }
-
- return PIPE_OK;
-}
-
-/**
- * Try to make GMR space available by freeing the hardware storage of
- * unmapped
- */
-boolean
-svga_buffer_free_cached_hw_storage(struct svga_screen *ss)
-{
- struct list_head *curr;
- struct svga_buffer *sbuf;
- enum pipe_error ret = PIPE_OK;
-
- curr = ss->cached_buffers.prev;
-
- /* free the least recently used buffer's hw storage which is not mapped */
- do {
- if(curr == &ss->cached_buffers)
- return FALSE;
-
- sbuf = LIST_ENTRY(struct svga_buffer, curr, head);
-
- curr = curr->prev;
- if (sbuf->map.count == 0)
- ret = svga_buffer_backup(ss, sbuf);
-
- } while(sbuf->map.count != 0 || ret != PIPE_OK);
-
- svga_buffer_destroy_hw_storage(ss, sbuf);
-
- return TRUE;
-}
-
struct svga_winsys_buffer *
svga_winsys_buffer_create( struct svga_screen *ss,
unsigned alignment,
@@ -195,12 +136,6 @@ svga_winsys_buffer_create( struct svga_screen *ss,
svga_screen_flush(ss, NULL);
buf = sws->buffer_create(sws, alignment, usage, size);
- SVGA_DBG(DEBUG_DMA|DEBUG_PERF, "evicting buffers to find %d bytes GMR\n",
- size);
-
- /* Try evicing all buffer storage */
- while(!buf && svga_buffer_free_cached_hw_storage(ss))
- buf = sws->buffer_create(sws, alignment, usage, size);
}
return buf;
@@ -226,8 +161,6 @@ svga_buffer_create_hw_storage(struct svga_screen *ss,
return PIPE_ERROR_OUT_OF_MEMORY;
assert(!sbuf->needs_flush);
- assert(!sbuf->head.prev && !sbuf->head.next);
- LIST_ADD(&sbuf->head, &ss->cached_buffers);
}
return PIPE_OK;
@@ -311,7 +244,6 @@ static void
svga_buffer_upload_flush(struct svga_context *svga,
struct svga_buffer *sbuf)
{
- struct svga_screen *ss = svga_screen(svga->pipe.screen);
SVGA3dCopyBox *boxes;
unsigned i;
@@ -348,13 +280,16 @@ svga_buffer_upload_flush(struct svga_context *svga,
assert(sbuf->head.prev && sbuf->head.next);
LIST_DEL(&sbuf->head);
+#ifdef DEBUG
+ sbuf->head.next = sbuf->head.prev = NULL;
+#endif
sbuf->needs_flush = FALSE;
- /* XXX: do we care about cached_buffers any more ?*/
- LIST_ADD(&sbuf->head, &ss->cached_buffers);
sbuf->hw.svga = NULL;
sbuf->hw.boxes = NULL;
+ sbuf->host_written = TRUE;
+
/* Decrement reference count */
pipe_reference(&(sbuf->base.reference), NULL);
sbuf = NULL;
@@ -437,17 +372,17 @@ svga_buffer_map_range( struct pipe_screen *screen,
}
else {
if(!sbuf->hw.buf) {
- struct svga_winsys_surface *handle = sbuf->handle;
-
if(svga_buffer_create_hw_storage(ss, sbuf) != PIPE_OK)
return NULL;
/* Populate the hardware storage if the host surface pre-existed */
- if((usage & PIPE_BUFFER_USAGE_CPU_READ) && handle) {
+ if(sbuf->host_written) {
SVGA3dSurfaceDMAFlags flags;
enum pipe_error ret;
struct pipe_fence_handle *fence = NULL;
+ assert(sbuf->handle);
+
SVGA_DBG(DEBUG_DMA|DEBUG_PERF, "dma from sid %p (buffer), bytes %u - %u\n",
sbuf->handle, 0, sbuf->base.size);
@@ -478,17 +413,6 @@ svga_buffer_map_range( struct pipe_screen *screen,
sws->fence_reference(sws, &fence, NULL);
}
}
- else {
- if((usage & PIPE_BUFFER_USAGE_CPU_READ) && !sbuf->needs_flush) {
- /* We already had the hardware storage but we would have to issue
- * a download if we hadn't, so move the buffer to the begginning
- * of the LRU list.
- */
- assert(sbuf->head.prev && sbuf->head.next);
- LIST_DEL(&sbuf->head);
- LIST_ADD(&sbuf->head, &ss->cached_buffers);
- }
- }
map = sws->buffer_map(sws, sbuf->hw.buf, usage);
}
@@ -572,10 +496,8 @@ svga_buffer_destroy( struct pipe_buffer *buf )
assert(!sbuf->needs_flush);
- if(sbuf->handle) {
- SVGA_DBG(DEBUG_DMA, "release sid %p sz %d\n", sbuf->handle, sbuf->base.size);
- svga_screen_surface_destroy(ss, &sbuf->key, &sbuf->handle);
- }
+ if(sbuf->handle)
+ svga_buffer_destroy_host_surface(ss, sbuf);
if(sbuf->hw.buf)
svga_buffer_destroy_hw_storage(ss, sbuf);
@@ -595,6 +517,9 @@ svga_buffer_create(struct pipe_screen *screen,
struct svga_screen *ss = svga_screen(screen);
struct svga_buffer *sbuf;
+ assert(size);
+ assert(alignment);
+
sbuf = CALLOC_STRUCT(svga_buffer);
if(!sbuf)
goto error1;
@@ -755,8 +680,7 @@ svga_buffer_handle(struct svga_context *svga,
assert(sbuf->hw.svga == svga);
sbuf->needs_flush = TRUE;
- assert(sbuf->head.prev && sbuf->head.next);
- LIST_DEL(&sbuf->head);
+ assert(!sbuf->head.prev && !sbuf->head.next);
LIST_ADDTAIL(&sbuf->head, &svga->dirty_buffers);
}
diff --git a/src/gallium/drivers/svga/svga_screen_buffer.h b/src/gallium/drivers/svga/svga_screen_buffer.h
index 5d7af5a7c50..448ac107c7f 100644
--- a/src/gallium/drivers/svga/svga_screen_buffer.h
+++ b/src/gallium/drivers/svga/svga_screen_buffer.h
@@ -135,6 +135,11 @@ struct svga_buffer
*/
struct svga_winsys_surface *handle;
+ /**
+ * Whether the host has been ever written.
+ */
+ boolean host_written;
+
struct {
unsigned count;
boolean writing;
@@ -178,9 +183,6 @@ svga_buffer_handle(struct svga_context *svga,
void
svga_context_flush_buffers(struct svga_context *svga);
-boolean
-svga_buffer_free_cached_hw_storage(struct svga_screen *ss);
-
struct svga_winsys_buffer *
svga_winsys_buffer_create(struct svga_screen *ss,
unsigned alignment,
diff --git a/src/gallium/drivers/svga/svga_screen_texture.c b/src/gallium/drivers/svga/svga_screen_texture.c
index 2224c2d3945..0d69007fd87 100644
--- a/src/gallium/drivers/svga/svga_screen_texture.c
+++ b/src/gallium/drivers/svga/svga_screen_texture.c
@@ -306,11 +306,19 @@ svga_texture_create(struct pipe_screen *screen,
tex->key.numFaces = 1;
}
+ tex->key.cachable = 1;
+
if(templat->tex_usage & PIPE_TEXTURE_USAGE_SAMPLER)
tex->key.flags |= SVGA3D_SURFACE_HINT_TEXTURE;
- if(templat->tex_usage & PIPE_TEXTURE_USAGE_PRIMARY)
+ if(templat->tex_usage & PIPE_TEXTURE_USAGE_DISPLAY_TARGET) {
+ tex->key.cachable = 0;
+ }
+
+ if(templat->tex_usage & PIPE_TEXTURE_USAGE_PRIMARY) {
tex->key.flags |= SVGA3D_SURFACE_HINT_SCANOUT;
+ tex->key.cachable = 0;
+ }
/*
* XXX: Never pass the SVGA3D_SURFACE_HINT_RENDERTARGET hint. Mesa cannot
@@ -333,8 +341,6 @@ svga_texture_create(struct pipe_screen *screen,
if(tex->key.format == SVGA3D_FORMAT_INVALID)
goto error2;
- tex->key.cachable = 1;
-
SVGA_DBG(DEBUG_DMA, "surface_create for texture\n", tex->handle);
tex->handle = svga_screen_surface_create(svgascreen, &tex->key);
if (tex->handle)
@@ -416,6 +422,62 @@ svga_texture_blanket(struct pipe_screen * screen,
}
+struct pipe_texture *
+svga_screen_texture_wrap_surface(struct pipe_screen *screen,
+ struct pipe_texture *base,
+ enum SVGA3dSurfaceFormat format,
+ struct svga_winsys_surface *srf)
+{
+ struct svga_texture *tex;
+ assert(screen);
+
+ /* Only supports one type */
+ if (base->target != PIPE_TEXTURE_2D ||
+ base->last_level != 0 ||
+ base->depth0 != 1) {
+ return NULL;
+ }
+
+ if (!srf)
+ return NULL;
+
+ if (svga_translate_format(base->format) != format) {
+ unsigned f1 = svga_translate_format(base->format);
+ unsigned f2 = 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 (format == 1)
+ tex->base.format = PIPE_FORMAT_X8R8G8B8_UNORM;
+ else if (format == 2)
+ tex->base.format = PIPE_FORMAT_A8R8G8B8_UNORM;
+
+ pipe_reference_init(&tex->base.reference, 1);
+ tex->base.screen = screen;
+
+ SVGA_DBG(DEBUG_DMA, "wrap surface sid %p\n", srf);
+
+ tex->key.cachable = 0;
+ tex->handle = srf;
+
+ return &tex->base;
+}
+
+
static void
svga_texture_destroy(struct pipe_texture *pt)
{
diff --git a/src/gallium/drivers/svga/svga_state_framebuffer.c b/src/gallium/drivers/svga/svga_state_framebuffer.c
index cfdcae4ee4a..eda1aefd67a 100644
--- a/src/gallium/drivers/svga/svga_state_framebuffer.c
+++ b/src/gallium/drivers/svga/svga_state_framebuffer.c
@@ -32,8 +32,6 @@
#include "svga_cmd.h"
#include "svga_debug.h"
-#include "svga_hw_reg.h"
-
/***********************************************************************
* Hardware state update
diff --git a/src/gallium/drivers/svga/svga_state_rss.c b/src/gallium/drivers/svga/svga_state_rss.c
index 8b6803a285a..2f9adaeb561 100644
--- a/src/gallium/drivers/svga/svga_state_rss.c
+++ b/src/gallium/drivers/svga/svga_state_rss.c
@@ -31,9 +31,6 @@
#include "svga_state.h"
#include "svga_cmd.h"
-#include "svga_hw_reg.h"
-
-
struct rs_queue {
unsigned rs_count;
diff --git a/src/gallium/drivers/svga/svga_state_tss.c b/src/gallium/drivers/svga/svga_state_tss.c
index b3137945202..b3c9687b1a4 100644
--- a/src/gallium/drivers/svga/svga_state_tss.c
+++ b/src/gallium/drivers/svga/svga_state_tss.c
@@ -33,8 +33,6 @@
#include "svga_state.h"
#include "svga_cmd.h"
-#include "svga_hw_reg.h"
-
void svga_cleanup_tss_binding(struct svga_context *svga)
{
diff --git a/src/gallium/drivers/svga/svga_swtnl_backend.c b/src/gallium/drivers/svga/svga_swtnl_backend.c
index b4f757a47a9..aafb3e26b0b 100644
--- a/src/gallium/drivers/svga/svga_swtnl_backend.c
+++ b/src/gallium/drivers/svga/svga_swtnl_backend.c
@@ -31,7 +31,6 @@
#include "pipe/p_inlines.h"
#include "util/u_math.h"
#include "util/u_memory.h"
-#include "util/u_simple_shaders.h"
#include "svga_context.h"
#include "svga_state.h"
@@ -87,13 +86,13 @@ svga_vbuf_render_allocate_vertices( struct vbuf_render *render,
if (!svga_render->vbuf) {
svga_render->vbuf_size = MAX2(size, svga_render->vbuf_alloc_size);
svga_render->vbuf = pipe_buffer_create(screen,
- 0,
+ 16,
PIPE_BUFFER_USAGE_VERTEX,
svga_render->vbuf_size);
if(!svga_render->vbuf) {
svga_context_flush(svga, NULL);
svga_render->vbuf = pipe_buffer_create(screen,
- 0,
+ 16,
PIPE_BUFFER_USAGE_VERTEX,
svga_render->vbuf_size);
assert(svga_render->vbuf);
@@ -123,7 +122,9 @@ svga_vbuf_render_map_vertices( struct vbuf_render *render )
char *ptr = (char*)pipe_buffer_map(screen,
svga_render->vbuf,
PIPE_BUFFER_USAGE_CPU_WRITE |
- PIPE_BUFFER_USAGE_FLUSH_EXPLICIT);
+ PIPE_BUFFER_USAGE_FLUSH_EXPLICIT |
+ PIPE_BUFFER_USAGE_DISCARD |
+ PIPE_BUFFER_USAGE_UNSYNCHRONIZED);
return ptr + svga_render->vbuf_offset;
}
@@ -259,14 +260,14 @@ svga_vbuf_render_draw( struct vbuf_render *render,
if (!svga_render->ibuf) {
svga_render->ibuf_size = MAX2(size, svga_render->ibuf_alloc_size);
svga_render->ibuf = pipe_buffer_create(screen,
- 0,
+ 2,
PIPE_BUFFER_USAGE_VERTEX,
svga_render->ibuf_size);
svga_render->ibuf_offset = 0;
}
- pipe_buffer_write(screen, svga_render->ibuf,
- svga_render->ibuf_offset, 2 * nr_indices, indices);
+ pipe_buffer_write_nooverlap(screen, svga_render->ibuf,
+ svga_render->ibuf_offset, 2 * nr_indices, indices);
/* off to hardware */
diff --git a/src/gallium/drivers/svga/svga_swtnl_draw.c b/src/gallium/drivers/svga/svga_swtnl_draw.c
index 7655121bec1..5e6e30c7dfb 100644
--- a/src/gallium/drivers/svga/svga_swtnl_draw.c
+++ b/src/gallium/drivers/svga/svga_swtnl_draw.c
@@ -27,7 +27,6 @@
#include "draw/draw_vbuf.h"
#include "pipe/p_inlines.h"
#include "pipe/p_state.h"
-#include "util/u_memory.h"
#include "svga_context.h"
#include "svga_swtnl.h"
@@ -90,7 +89,7 @@ svga_swtnl_draw_range_elements(struct svga_context *svga,
PIPE_BUFFER_USAGE_CPU_READ);
assert(map);
draw_set_mapped_constant_buffer(
- draw, PIPE_SHADER_VERTEX,
+ draw, PIPE_SHADER_VERTEX, 0,
map,
svga->curr.cb[PIPE_SHADER_VERTEX]->size);
}
diff --git a/src/gallium/drivers/svga/svga_swtnl_state.c b/src/gallium/drivers/svga/svga_swtnl_state.c
index 94b6ccc62dd..fe03e207fff 100644
--- a/src/gallium/drivers/svga/svga_swtnl_state.c
+++ b/src/gallium/drivers/svga/svga_swtnl_state.c
@@ -27,7 +27,6 @@
#include "draw/draw_vbuf.h"
#include "pipe/p_inlines.h"
#include "pipe/p_state.h"
-#include "util/u_memory.h"
#include "svga_context.h"
#include "svga_swtnl.h"
diff --git a/src/gallium/drivers/svga/svga_tgsi_decl_sm20.c b/src/gallium/drivers/svga/svga_tgsi_decl_sm20.c
index 23b3ace7f30..1ae99067610 100644
--- a/src/gallium/drivers/svga/svga_tgsi_decl_sm20.c
+++ b/src/gallium/drivers/svga/svga_tgsi_decl_sm20.c
@@ -29,9 +29,6 @@
#include "util/u_memory.h"
#include "svga_tgsi_emit.h"
-#include "svga_context.h"
-
-
static boolean ps20_input( struct svga_shader_emitter *emit,
diff --git a/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c b/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c
index d1c7336dec4..43fc0d32359 100644
--- a/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c
+++ b/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c
@@ -29,7 +29,6 @@
#include "util/u_memory.h"
#include "svga_tgsi_emit.h"
-#include "svga_context.h"
static boolean translate_vs_ps_semantic( struct tgsi_declaration_semantic semantic,
unsigned *usage,
diff --git a/src/gallium/drivers/svga/svga_winsys.h b/src/gallium/drivers/svga/svga_winsys.h
index 59f299c1858..27b99fe4c10 100644
--- a/src/gallium/drivers/svga/svga_winsys.h
+++ b/src/gallium/drivers/svga/svga_winsys.h
@@ -296,4 +296,10 @@ 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/trace/tr_drm.c b/src/gallium/drivers/trace/tr_drm.c
index 48d1c4051cc..e7ca3a86ead 100644
--- a/src/gallium/drivers/trace/tr_drm.c
+++ b/src/gallium/drivers/trace/tr_drm.c
@@ -173,6 +173,7 @@ trace_drm_create(struct drm_api *api)
if (!tr_api)
goto error;
+ tr_api->base.driver_name = api->driver_name;
tr_api->base.create_screen = trace_drm_create_screen;
tr_api->base.create_context = trace_drm_create_context;
tr_api->base.texture_from_shared_handle = trace_drm_texture_from_shared_handle;
diff --git a/src/gallium/include/pipe/p_compiler.h b/src/gallium/include/pipe/p_compiler.h
index 272d0308cc1..6a9018aa3a0 100644
--- a/src/gallium/include/pipe/p_compiler.h
+++ b/src/gallium/include/pipe/p_compiler.h
@@ -63,7 +63,7 @@
#include <stdbool.h>
-#ifndef __HAIKU__
+#if !defined(__HAIKU__) && !defined(__USE_MISC)
typedef unsigned int uint;
typedef unsigned short ushort;
#endif
diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h
index 0b8f6da2f4a..f3ee0954481 100644
--- a/src/gallium/include/pipe/p_context.h
+++ b/src/gallium/include/pipe/p_context.h
@@ -103,7 +103,7 @@ struct pipe_context {
/**
* Predicate subsequent rendering on occlusion query result
* \param query the query predicate, or NULL if no predicate
- * \param mode one of PIPE_COND_RENDER_x
+ * \param mode one of PIPE_RENDER_COND_x
*/
void (*render_condition)( struct pipe_context *pipe,
struct pipe_query *query,
@@ -271,30 +271,30 @@ struct pipe_context {
/**
* Check whether a texture is referenced by an unflushed hw command.
- * The state-tracker uses this function to optimize away unnecessary
- * flushes. It is safe (but wasteful) to always return.
+ * The state-tracker uses this function to avoid unnecessary flushes.
+ * It is safe (but wasteful) to always return
* PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE.
- * \param pipe The pipe context whose unflushed hw commands will be
- * checked.
- * \param level mipmap level.
+ * \param pipe context whose unflushed hw commands will be checked.
* \param texture texture to check.
* \param face cubemap face. Use 0 for non-cubemap texture.
+ * \param level mipmap level.
+ * \return mask of PIPE_REFERENCED_FOR_READ/WRITE or PIPE_UNREFERENCED
*/
- unsigned int (*is_texture_referenced) (struct pipe_context *pipe,
- struct pipe_texture *texture,
- unsigned face, unsigned level);
+ unsigned int (*is_texture_referenced)(struct pipe_context *pipe,
+ struct pipe_texture *texture,
+ unsigned face, unsigned level);
/**
* Check whether a buffer is referenced by an unflushed hw command.
- * The state-tracker uses this function to optimize away unnecessary
- * flushes. It is safe (but wasteful) to always return
+ * The state-tracker uses this function to avoid unnecessary flushes.
+ * It is safe (but wasteful) to always return
* PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE.
- * \param pipe The pipe context whose unflushed hw commands will be
- * checked.
- * \param buf Buffer to check.
+ * \param pipe context whose unflushed hw commands will be checked.
+ * \param buf buffer to check.
+ * \return mask of PIPE_REFERENCED_FOR_READ/WRITE or PIPE_UNREFERENCED
*/
- unsigned int (*is_buffer_referenced) (struct pipe_context *pipe,
- struct pipe_buffer *buf);
+ unsigned int (*is_buffer_referenced)(struct pipe_context *pipe,
+ struct pipe_buffer *buf);
};
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 41a4f209019..b28441dca9c 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -405,8 +405,10 @@ enum pipe_transfer_usage {
#define PIPE_CAP_MAX_PREDICATE_REGISTERS 30
#define PIPE_CAP_MAX_COMBINED_SAMPLERS 31 /*< Maximum texture image units accessible from vertex
and fragment shaders combined */
-#define PIPE_CAP_INDEP_BLEND_ENABLE 32 /*< blend enables and write masks per rendertarget */
-#define PIPE_CAP_INDEP_BLEND_FUNC 33 /*< different blend funcs per rendertarget */
+#define PIPE_CAP_MAX_CONST_BUFFERS 32
+#define PIPE_CAP_MAX_CONST_BUFFER_SIZE 33 /*< In bytes */
+#define PIPE_CAP_INDEP_BLEND_ENABLE 34 /*< blend enables and write masks per rendertarget */
+#define PIPE_CAP_INDEP_BLEND_FUNC 35 /*< different blend funcs per rendertarget */
/**
diff --git a/src/gallium/include/pipe/p_inlines.h b/src/gallium/include/pipe/p_inlines.h
index 5fbd62a03d2..72f5c1dc2a2 100644
--- a/src/gallium/include/pipe/p_inlines.h
+++ b/src/gallium/include/pipe/p_inlines.h
@@ -63,13 +63,6 @@ pipe_buffer_map(struct pipe_screen *screen,
if(screen->buffer_map_range) {
unsigned offset = 0;
unsigned length = buf->size;
-
- /* XXX: Actually we should be using/detecting DISCARD
- * instead of assuming that WRITE implies discard */
- if((usage & PIPE_BUFFER_USAGE_CPU_WRITE) &&
- !(usage & PIPE_BUFFER_USAGE_DISCARD))
- usage |= PIPE_BUFFER_USAGE_CPU_READ;
-
return screen->buffer_map_range(screen, buf, offset, length, usage);
}
else
@@ -126,7 +119,39 @@ pipe_buffer_write(struct pipe_screen *screen,
map = pipe_buffer_map_range(screen, buf, offset, size,
PIPE_BUFFER_USAGE_CPU_WRITE |
- PIPE_BUFFER_USAGE_FLUSH_EXPLICIT);
+ PIPE_BUFFER_USAGE_FLUSH_EXPLICIT |
+ PIPE_BUFFER_USAGE_DISCARD);
+ assert(map);
+ if(map) {
+ memcpy((uint8_t *)map + offset, data, size);
+ pipe_buffer_flush_mapped_range(screen, buf, offset, size);
+ pipe_buffer_unmap(screen, buf);
+ }
+}
+
+/**
+ * Special case for writing non-overlapping ranges.
+ *
+ * We can avoid GPU/CPU synchronization when writing range that has never
+ * been written before.
+ */
+static INLINE void
+pipe_buffer_write_nooverlap(struct pipe_screen *screen,
+ struct pipe_buffer *buf,
+ unsigned offset, unsigned size,
+ const void *data)
+{
+ void *map;
+
+ assert(offset < buf->size);
+ assert(offset + size <= buf->size);
+ assert(size);
+
+ map = pipe_buffer_map_range(screen, buf, offset, size,
+ PIPE_BUFFER_USAGE_CPU_WRITE |
+ PIPE_BUFFER_USAGE_FLUSH_EXPLICIT |
+ PIPE_BUFFER_USAGE_DISCARD |
+ PIPE_BUFFER_USAGE_UNSYNCHRONIZED);
assert(map);
if(map) {
memcpy((uint8_t *)map + offset, data, size);
diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h
index b489b044667..b47f4971f15 100644
--- a/src/gallium/include/pipe/p_shader_tokens.h
+++ b/src/gallium/include/pipe/p_shader_tokens.h
@@ -109,10 +109,11 @@ struct tgsi_declaration
unsigned File : 4; /**< one of TGSI_FILE_x */
unsigned UsageMask : 4; /**< bitmask of TGSI_WRITEMASK_x flags */
unsigned Interpolate : 4; /**< one of TGSI_INTERPOLATE_x */
+ unsigned Dimension : 1; /**< any extra dimension info? */
unsigned Semantic : 1; /**< BOOL, any semantic info? */
unsigned Centroid : 1; /**< centroid sampling? */
unsigned Invariant : 1; /**< invariant optimization? */
- unsigned Padding : 5;
+ unsigned Padding : 4;
};
struct tgsi_declaration_range
@@ -121,6 +122,12 @@ struct tgsi_declaration_range
unsigned Last : 16; /**< UINT */
};
+struct tgsi_declaration_dimension
+{
+ unsigned Index2D:16; /**< UINT */
+ unsigned Padding:16;
+};
+
#define TGSI_SEMANTIC_POSITION 0
#define TGSI_SEMANTIC_COLOR 1
#define TGSI_SEMANTIC_BCOLOR 2 /**< back-face color */
diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index b9ac2db5915..03cd74efed3 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -58,7 +58,7 @@ extern "C" {
#define PIPE_MAX_ATTRIBS 32
#define PIPE_MAX_CLIP_PLANES 6
#define PIPE_MAX_COLOR_BUFS 8
-#define PIPE_MAX_CONSTANT 32
+#define PIPE_MAX_CONSTANT_BUFFERS 32
#define PIPE_MAX_SAMPLERS 16
#define PIPE_MAX_VERTEX_SAMPLERS 16
#define PIPE_MAX_SHADER_INPUTS 16
diff --git a/src/gallium/include/state_tracker/drm_api.h b/src/gallium/include/state_tracker/drm_api.h
index bb928928c90..b248a818808 100644
--- a/src/gallium/include/state_tracker/drm_api.h
+++ b/src/gallium/include/state_tracker/drm_api.h
@@ -31,6 +31,11 @@ struct drm_api
const char *name;
/**
+ * Kernel driver name, as accepted by drmOpenByName.
+ */
+ const char *driver_name;
+
+ /**
* Special buffer functions
*/
/*@{*/
diff --git a/src/gallium/state_trackers/dri/dri_context.c b/src/gallium/state_trackers/dri/dri_context.c
index f2e5f3fb23c..07f0554cc0d 100644
--- a/src/gallium/state_trackers/dri/dri_context.c
+++ b/src/gallium/state_trackers/dri/dri_context.c
@@ -101,6 +101,12 @@ dri_destroy_context(__DRIcontext * cPriv)
{
struct dri_context *ctx = dri_context(cPriv);
+ /* note: we are freeing values and nothing more because
+ * driParseConfigFiles allocated values only - the rest
+ * is owned by screen optionCache.
+ */
+ FREE(ctx->optionCache.values);
+
/* No particular reason to wait for command completion before
* destroying a context, but it is probably worthwhile flushing it
* to avoid having to add code elsewhere to cope with flushing a
diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c
index 0fdfa96b35a..1f456cb8297 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/dri_drawable.c
@@ -35,7 +35,6 @@
#include "pipe/p_context.h"
#include "pipe/p_screen.h"
-#include "pipe/p_inlines.h"
#include "main/mtypes.h"
#include "main/renderbuffer.h"
#include "state_tracker/drm_api.h"
@@ -123,11 +122,12 @@ dri_get_buffers(__DRIdrawable * dPriv)
struct dri_drawable *drawable = dri_drawable(dPriv);
struct pipe_surface *surface = NULL;
- struct pipe_screen *screen = dri_screen(drawable->sPriv)->pipe_screen;
+ 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 = ((struct dri_screen*)(dri_screen->private))->api;
+ struct drm_api *api = st_screen->api;
boolean have_depth = FALSE;
int i, count;
@@ -180,7 +180,9 @@ dri_get_buffers(__DRIdrawable * dPriv)
switch (buffers[i].attachment) {
case __DRI_BUFFER_FRONT_LEFT:
- continue;
+ if (!st_screen->auto_fake_front)
+ continue;
+ /* fallthrough */
case __DRI_BUFFER_FAKE_FRONT_LEFT:
index = ST_SURFACE_FRONT_LEFT;
format = drawable->color_format;
@@ -373,8 +375,8 @@ dri_create_buffer(__DRIscreen * sPriv,
/* TODO incase of double buffer visual, delay fake creation */
i = 0;
drawable->attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
- drawable->attachments[i++] = __DRI_BUFFER_FAKE_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)
diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c
index d8c054313b3..a412b81256e 100644
--- a/src/gallium/state_trackers/dri/dri_screen.c
+++ b/src/gallium/state_trackers/dri/dri_screen.c
@@ -37,14 +37,10 @@
#include "dri_context.h"
#include "dri_drawable.h"
-#include "pipe/p_context.h"
#include "pipe/p_screen.h"
-#include "pipe/p_inlines.h"
#include "pipe/p_format.h"
#include "state_tracker/drm_api.h"
#include "state_tracker/dri1_api.h"
-#include "state_tracker/st_public.h"
-#include "state_tracker/st_cb_fbo.h"
PUBLIC const char __driConfigOptions[] =
DRI_CONF_BEGIN DRI_CONF_SECTION_PERFORMANCE
@@ -292,6 +288,8 @@ dri_init_screen2(__DRIscreen * sPriv)
{
struct dri_screen *screen;
struct drm_create_screen_arg arg;
+ const __DRIdri2LoaderExtension *dri2_ext =
+ sPriv->dri2.loader;
screen = CALLOC_STRUCT(dri_screen);
if (!screen)
@@ -317,6 +315,9 @@ dri_init_screen2(__DRIscreen * sPriv)
driParseOptionInfo(&screen->optionCache,
__driConfigOptions, __driNConfigOptions);
+ screen->auto_fake_front = dri2_ext->base.version >= 3 &&
+ dri2_ext->getBuffersWithFormat != NULL;
+
return dri_fill_in_modes(screen, 32);
fail:
return NULL;
@@ -326,8 +327,18 @@ 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);
+
FREE(screen);
sPriv->private = NULL;
}
diff --git a/src/gallium/state_trackers/dri/dri_screen.h b/src/gallium/state_trackers/dri/dri_screen.h
index 03387a0e813..75a0ee4250e 100644
--- a/src/gallium/state_trackers/dri/dri_screen.h
+++ b/src/gallium/state_trackers/dri/dri_screen.h
@@ -59,6 +59,7 @@ struct dri_screen
struct pipe_screen *pipe_screen;
boolean d_depth_bits_last;
boolean sd_depth_bits_last;
+ boolean auto_fake_front;
};
/** cast wrapper */
diff --git a/src/gallium/state_trackers/egl/Makefile b/src/gallium/state_trackers/egl/Makefile
index e825aa718b6..b696f2fae93 100644
--- a/src/gallium/state_trackers/egl/Makefile
+++ b/src/gallium/state_trackers/egl/Makefile
@@ -1,19 +1,75 @@
TOP = ../../../..
include $(TOP)/configs/current
-LIBNAME = egldrm
-
-LIBRARY_INCLUDES = \
+common_INCLUDES = \
+ -I. \
-I$(TOP)/src/gallium/include \
-I$(TOP)/src/gallium/auxiliary \
- -I$(TOP)/src/mesa/drivers/dri/common \
- -I$(TOP)/src/mesa \
- -I$(TOP)/include \
-I$(TOP)/src/egl/main \
+ -I$(TOP)/include
+
+common_SOURCES = $(wildcard common/*.c)
+common_OBJECTS = $(common_SOURCES:.c=.o)
+
+
+x11_INCLUDES = \
+ -I$(TOP)/src/gallium/drivers \
+ -I$(TOP)/src/glx/x11 \
+ -I$(TOP)/src/egl/drivers/xdri \
+ -I$(TOP)/src/mesa \
$(shell pkg-config --cflags-only-I libdrm)
+x11_SOURCES = $(wildcard x11/*.c) \
+ $(TOP)/src/glx/x11/dri2.c \
+ $(TOP)/src/egl/drivers/xdri/glxinit.c
+x11_OBJECTS = $(x11_SOURCES:.c=.o)
+
+
+kms_INCLUDES = $(shell pkg-config --cflags-only-I libdrm)
+kms_SOURCES = $(wildcard kms/*.c)
+kms_OBJECTS = $(kms_SOURCES:.c=.o)
+
+
+ALL_INCLUDES = $(common_INCLUDES) $(x11_INCLUDES) $(kms_INCLUDES)
+ALL_SOURCES = $(common_SOURCES) $(x11_SOURCES) $(kms_SOURCES)
+ALL_OBJECTS = $(common_OBJECTS) $(x11_OBJECTS) $(kms_OBJECTS)
+
+##### TARGETS #####
+
+EGL_DISPLAYS_MODS = $(foreach dpy, $(EGL_DISPLAYS), libegl$(dpy).a)
+
+default: depend $(EGL_DISPLAYS_MODS)
+
+
+libeglx11.a: $(x11_OBJECTS) $(common_OBJECTS) Makefile
+ $(MKLIB) -o eglx11 -static $(x11_OBJECTS) $(common_OBJECTS)
+
+libeglkms.a: $(kms_OBJECTS) $(common_OBJECTS) Makefile
+ $(MKLIB) -o eglkms -static $(kms_OBJECTS) $(common_OBJECTS)
+
+depend:
+ rm -f depend
+ touch depend
+ $(MKDEP) $(MKDEP_OPTIONS) $(ALL_INCLUDES) $(ALL_SOURCES) 2> /dev/null
+
+clean:
+ rm -f $(ALL_OBJECTS)
+ rm -f $(EGL_DISPLAYS_MODS)
+ rm -f depend depend.bak
+
+# Dummy target
+install:
+ @echo -n ""
+
+##### RULES #####
+
+$(common_OBJECTS): %.o: %.c
+ $(CC) -c $(common_INCLUDES) $(DEFINES) $(CFLAGS) $< -o $@
-C_SOURCES = $(wildcard ./*.c)
+$(x11_OBJECTS): %.o: %.c
+ $(CC) -c $(common_INCLUDES) $(x11_INCLUDES) $(DEFINES) $(CFLAGS) $< -o $@
+$(kms_OBJECTS): %.o: %.c
+ $(CC) -c $(common_INCLUDES) $(kms_INCLUDES) $(DEFINES) $(CFLAGS) $< -o $@
-include ../../Makefile.template
+sinclude depend
diff --git a/src/gallium/state_trackers/egl_g3d/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c
index 2ac6215646c..f8334217c47 100644
--- a/src/gallium/state_trackers/egl_g3d/common/egl_g3d.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d.c
@@ -543,7 +543,7 @@ egl_g3d_update_buffer(struct pipe_screen *screen, void *context_private)
* Set force_validate to skip an unnecessary check.
*/
gctx->force_validate = EGL_TRUE;
- egl_g3d_validate_context(gctx->base.Display, &gctx->base);
+ egl_g3d_validate_context(gctx->base.Resource.Display, &gctx->base);
}
static EGLBoolean
@@ -672,21 +672,30 @@ egl_g3d_create_context(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
return &gctx->base;
}
-static EGLBoolean
-egl_g3d_destroy_context(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx)
+/**
+ * Destroy a context.
+ */
+static void
+destroy_context(_EGLDisplay *dpy, _EGLContext *ctx)
{
struct egl_g3d_context *gctx = egl_g3d_context(ctx);
- if (_eglIsContextBound(&gctx->base))
- return EGL_TRUE;
+ /* FIXME a context might live longer than its display */
+ if (!dpy->Initialized)
+ _eglLog(_EGL_FATAL, "destroy a context with an unitialized display");
egl_g3d_realloc_context(dpy, &gctx->base);
-
- /* it will destroy pipe context */
+ /* it will destroy the associated pipe context */
gctx->stapi->st_destroy_context(gctx->st_ctx);
free(gctx);
+}
+static EGLBoolean
+egl_g3d_destroy_context(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx)
+{
+ if (!_eglIsContextBound(ctx))
+ destroy_context(dpy, ctx);
return EGL_TRUE;
}
@@ -817,17 +826,28 @@ egl_g3d_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *dpy,
return &gsurf->base;
}
-static EGLBoolean
-egl_g3d_destroy_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf)
+/**
+ * Destroy a surface.
+ */
+static void
+destroy_surface(_EGLDisplay *dpy, _EGLSurface *surf)
{
struct egl_g3d_surface *gsurf = egl_g3d_surface(surf);
- if (_eglIsSurfaceBound(&gsurf->base))
- return EGL_TRUE;
+ /* FIXME a surface might live longer than its display */
+ if (!dpy->Initialized)
+ _eglLog(_EGL_FATAL, "destroy a surface with an unitialized display");
pipe_surface_reference(&gsurf->render_surface, NULL);
gsurf->native->destroy(gsurf->native);
free(gsurf);
+}
+
+static EGLBoolean
+egl_g3d_destroy_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf)
+{
+ if (!_eglIsSurfaceBound(surf))
+ destroy_surface(dpy, surf);
return EGL_TRUE;
}
@@ -836,18 +856,14 @@ egl_g3d_make_current(_EGLDriver *drv, _EGLDisplay *dpy,
_EGLSurface *draw, _EGLSurface *read, _EGLContext *ctx)
{
struct egl_g3d_context *gctx = egl_g3d_context(ctx);
+ struct egl_g3d_surface *gdraw = egl_g3d_surface(draw);
struct egl_g3d_context *old_gctx;
- EGLint api;
EGLBoolean ok = EGL_TRUE;
- /* find the old context */
- api = (gctx) ? gctx->base.ClientAPI : eglQueryAPI();
- old_gctx = egl_g3d_get_current_context(api);
- if (old_gctx && !_eglIsContextLinked(&old_gctx->base))
- old_gctx = NULL;
-
- if (!_eglMakeCurrent(drv, dpy, draw, read, ctx))
+ /* bind the new context and return the "orphaned" one */
+ if (!_eglBindContext(&ctx, &draw, &read))
return EGL_FALSE;
+ old_gctx = egl_g3d_context(ctx);
if (old_gctx) {
/* flush old context */
@@ -863,8 +879,6 @@ egl_g3d_make_current(_EGLDriver *drv, _EGLDisplay *dpy,
}
if (gctx) {
- struct egl_g3d_surface *gdraw = egl_g3d_surface(draw);
-
ok = egl_g3d_realloc_context(dpy, &gctx->base);
if (ok) {
ok = gctx->stapi->st_make_current(gctx->st_ctx,
@@ -884,6 +898,13 @@ egl_g3d_make_current(_EGLDriver *drv, _EGLDisplay *dpy,
old_gctx->base.WindowRenderBuffer = EGL_NONE;
}
+ if (ctx && !_eglIsContextLinked(ctx))
+ destroy_context(dpy, ctx);
+ if (draw && !_eglIsSurfaceLinked(draw))
+ destroy_surface(dpy, draw);
+ if (read && read != draw && !_eglIsSurfaceLinked(read))
+ destroy_surface(dpy, read);
+
return ok;
}
@@ -974,7 +995,7 @@ get_pipe_surface(struct native_display *ndpy, struct native_surface *nsurf,
static EGLBoolean
egl_g3d_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
- NativePixmapType target)
+ EGLNativePixmapType target)
{
struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
struct egl_g3d_surface *gsurf = egl_g3d_surface(surf);
@@ -1037,14 +1058,15 @@ egl_g3d_wait_client(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx)
static EGLBoolean
egl_g3d_wait_native(_EGLDriver *drv, _EGLDisplay *dpy, EGLint engine)
{
- _EGLSurface *surf = _eglGetCurrentSurface(EGL_DRAW);
- struct egl_g3d_surface *gsurf = egl_g3d_surface(surf);
+ _EGLContext *ctx = _eglGetCurrentContext();
if (engine != EGL_CORE_NATIVE_ENGINE)
return _eglError(EGL_BAD_PARAMETER, "eglWaitNative");
- if (gsurf)
+ if (ctx && ctx->DrawSurface) {
+ struct egl_g3d_surface *gsurf = egl_g3d_surface(ctx->DrawSurface);
gsurf->native->wait(gsurf->native);
+ }
return EGL_TRUE;
}
diff --git a/src/gallium/state_trackers/egl_g3d/common/egl_g3d.h b/src/gallium/state_trackers/egl/common/egl_g3d.h
index 3dae8c40529..3dae8c40529 100644
--- a/src/gallium/state_trackers/egl_g3d/common/egl_g3d.h
+++ b/src/gallium/state_trackers/egl/common/egl_g3d.h
diff --git a/src/gallium/state_trackers/egl_g3d/common/egl_st.c b/src/gallium/state_trackers/egl/common/egl_st.c
index a88ff911cd5..a88ff911cd5 100644
--- a/src/gallium/state_trackers/egl_g3d/common/egl_st.c
+++ b/src/gallium/state_trackers/egl/common/egl_st.c
diff --git a/src/gallium/state_trackers/egl_g3d/common/egl_st.h b/src/gallium/state_trackers/egl/common/egl_st.h
index 8fb464bd3d7..8fb464bd3d7 100644
--- a/src/gallium/state_trackers/egl_g3d/common/egl_st.h
+++ b/src/gallium/state_trackers/egl/common/egl_st.h
diff --git a/src/gallium/state_trackers/egl_g3d/common/native.h b/src/gallium/state_trackers/egl/common/native.h
index 72a9cec7ef1..72a9cec7ef1 100644
--- a/src/gallium/state_trackers/egl_g3d/common/native.h
+++ b/src/gallium/state_trackers/egl/common/native.h
diff --git a/src/gallium/state_trackers/egl_g3d/common/st_public_tmp.h b/src/gallium/state_trackers/egl/common/st_public_tmp.h
index 507a0ec4027..507a0ec4027 100644
--- a/src/gallium/state_trackers/egl_g3d/common/st_public_tmp.h
+++ b/src/gallium/state_trackers/egl/common/st_public_tmp.h
diff --git a/src/gallium/state_trackers/egl/egl_context.c b/src/gallium/state_trackers/egl/egl_context.c
deleted file mode 100644
index fee186c6010..00000000000
--- a/src/gallium/state_trackers/egl/egl_context.c
+++ /dev/null
@@ -1,105 +0,0 @@
-
-#include "utils.h"
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include "egl_tracker.h"
-
-#include "egllog.h"
-
-
-#include "pipe/p_context.h"
-#include "pipe/p_screen.h"
-
-#include "state_tracker/st_public.h"
-#include "state_tracker/drm_api.h"
-
-#include "GL/internal/glcore.h"
-
-_EGLContext *
-drm_create_context(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, _EGLContext *share_list, const EGLint *attrib_list)
-{
- struct drm_device *dev = lookup_drm_device(dpy);
- struct drm_context *ctx;
- struct drm_context *share = NULL;
- struct st_context *st_share = NULL;
- int i;
- __GLcontextModes *visual;
-
- for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
- switch (attrib_list[i]) {
- /* no attribs defined for now */
- default:
- _eglError(EGL_BAD_ATTRIBUTE, "eglCreateContext");
- return EGL_NO_CONTEXT;
- }
- }
-
- ctx = (struct drm_context *) calloc(1, sizeof(struct drm_context));
- if (!ctx)
- goto err_c;
-
- _eglInitContext(drv, &ctx->base, conf, attrib_list);
-
- ctx->pipe = dev->api->create_context(dev->api, dev->screen);
- if (!ctx->pipe)
- goto err_pipe;
-
- if (share)
- st_share = share->st;
-
- visual = drm_visual_from_config(conf);
- ctx->st = st_create_context(ctx->pipe, visual, st_share);
- drm_visual_modes_destroy(visual);
-
- if (!ctx->st)
- goto err_gl;
-
- return &ctx->base;
-
-err_gl:
- ctx->pipe->destroy(ctx->pipe);
-err_pipe:
- free(ctx);
-err_c:
- return NULL;
-}
-
-EGLBoolean
-drm_destroy_context(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *context)
-{
- struct drm_context *c = lookup_drm_context(context);
- if (!_eglIsContextBound(&c->base)) {
- st_destroy_context(c->st);
- free(c);
- }
- return EGL_TRUE;
-}
-
-EGLBoolean
-drm_make_current(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw, _EGLSurface *read, _EGLContext *context)
-{
- struct drm_surface *readSurf = lookup_drm_surface(read);
- struct drm_surface *drawSurf = lookup_drm_surface(draw);
- struct drm_context *ctx = lookup_drm_context(context);
- EGLBoolean b;
-
- b = _eglMakeCurrent(drv, dpy, draw, read, context);
- if (!b)
- return EGL_FALSE;
-
- if (ctx) {
- if (!drawSurf || !readSurf)
- return EGL_FALSE;
-
- st_make_current(ctx->st, drawSurf->stfb, readSurf->stfb);
-
- /* st_resize_framebuffer needs a bound context to work */
- st_resize_framebuffer(drawSurf->stfb, drawSurf->w, drawSurf->h);
- st_resize_framebuffer(readSurf->stfb, readSurf->w, readSurf->h);
- } else {
- st_make_current(NULL, NULL, NULL);
- }
-
- return EGL_TRUE;
-}
diff --git a/src/gallium/state_trackers/egl/egl_surface.c b/src/gallium/state_trackers/egl/egl_surface.c
deleted file mode 100644
index d55aa51b82d..00000000000
--- a/src/gallium/state_trackers/egl/egl_surface.c
+++ /dev/null
@@ -1,443 +0,0 @@
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include "egl_tracker.h"
-
-#include "egllog.h"
-
-#include "pipe/p_inlines.h"
-#include "pipe/p_screen.h"
-#include "pipe/p_context.h"
-
-#include "state_tracker/drm_api.h"
-
-#include "util/u_format.h"
-#include "util/u_rect.h"
-
-/*
- * Util functions
- */
-
-static drmModeModeInfoPtr
-drm_find_mode(drmModeConnectorPtr connector, _EGLMode *mode)
-{
- int i;
- drmModeModeInfoPtr m = NULL;
-
- for (i = 0; i < connector->count_modes; i++) {
- m = &connector->modes[i];
- if (m->hdisplay == mode->Width && m->vdisplay == mode->Height && m->vrefresh == mode->RefreshRate)
- break;
- m = &connector->modes[0]; /* if we can't find one, return first */
- }
-
- return m;
-}
-
-static struct st_framebuffer *
-drm_create_framebuffer(struct pipe_screen *screen,
- const __GLcontextModes *visual,
- unsigned width,
- unsigned height,
- void *priv)
-{
- enum pipe_format color_format, depth_stencil_format;
- boolean d_depth_bits_last;
- boolean ds_depth_bits_last;
-
- d_depth_bits_last =
- screen->is_format_supported(screen, PIPE_FORMAT_X8Z24_UNORM,
- PIPE_TEXTURE_2D,
- PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0);
- ds_depth_bits_last =
- screen->is_format_supported(screen, PIPE_FORMAT_S8Z24_UNORM,
- PIPE_TEXTURE_2D,
- PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0);
-
- if (visual->redBits == 8) {
- if (visual->alphaBits == 8)
- color_format = PIPE_FORMAT_A8R8G8B8_UNORM;
- else
- color_format = PIPE_FORMAT_X8R8G8B8_UNORM;
- } else {
- color_format = PIPE_FORMAT_R5G6B5_UNORM;
- }
-
- switch(visual->depthBits) {
- default:
- case 0:
- depth_stencil_format = PIPE_FORMAT_NONE;
- break;
- case 16:
- depth_stencil_format = PIPE_FORMAT_Z16_UNORM;
- break;
- case 24:
- if (visual->stencilBits == 0) {
- depth_stencil_format = (d_depth_bits_last) ?
- PIPE_FORMAT_X8Z24_UNORM:
- PIPE_FORMAT_Z24X8_UNORM;
- } else {
- depth_stencil_format = (ds_depth_bits_last) ?
- PIPE_FORMAT_S8Z24_UNORM:
- PIPE_FORMAT_Z24S8_UNORM;
- }
- break;
- case 32:
- depth_stencil_format = PIPE_FORMAT_Z32_UNORM;
- break;
- }
-
- return st_create_framebuffer(visual,
- color_format,
- depth_stencil_format,
- depth_stencil_format,
- width,
- height,
- priv);
-}
-
-static void
-drm_create_texture(_EGLDisplay *dpy,
- struct drm_screen *scrn,
- unsigned w, unsigned h)
-{
- struct drm_device *dev = lookup_drm_device(dpy);
- struct pipe_screen *screen = dev->screen;
- struct pipe_surface *surface;
- struct pipe_texture *texture;
- struct pipe_texture templat;
- struct pipe_buffer *buf = NULL;
- unsigned pitch = 0;
-
- memset(&templat, 0, sizeof(templat));
- templat.tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET;
- templat.tex_usage |= PIPE_TEXTURE_USAGE_PRIMARY;
- templat.target = PIPE_TEXTURE_2D;
- templat.last_level = 0;
- templat.depth0 = 1;
- templat.format = PIPE_FORMAT_A8R8G8B8_UNORM;
- templat.width0 = w;
- templat.height0 = h;
-
- texture = screen->texture_create(dev->screen,
- &templat);
-
- if (!texture)
- goto err_tex;
-
- surface = screen->get_tex_surface(screen,
- texture,
- 0,
- 0,
- 0,
- PIPE_BUFFER_USAGE_GPU_WRITE);
-
- if (!surface)
- goto err_surf;
-
- scrn->tex = texture;
- scrn->surface = surface;
- scrn->front.width = w;
- scrn->front.height = h;
- scrn->front.pitch = pitch;
- dev->api->local_handle_from_texture(dev->api, screen, texture,
- &scrn->front.pitch, &scrn->front.handle);
- if (0)
- goto err_handle;
-
- return;
-
-err_handle:
- pipe_surface_reference(&surface, NULL);
-err_surf:
- pipe_texture_reference(&texture, NULL);
-err_tex:
- pipe_buffer_reference(&buf, NULL);
- return;
-}
-
-/*
- * Exported functions
- */
-
-void
-drm_takedown_shown_screen(_EGLDisplay *dpy, struct drm_screen *screen)
-{
- struct drm_device *dev = lookup_drm_device(dpy);
-
- screen->surf = NULL;
-
- drmModeSetCrtc(
- dev->drmFD,
- screen->crtcID,
- 0, /* FD */
- 0, 0,
- NULL, 0, /* List of output ids */
- NULL);
-
- drmModeRmFB(dev->drmFD, screen->fbID);
- drmModeFreeFB(screen->fb);
- screen->fb = NULL;
-
- pipe_surface_reference(&screen->surface, NULL);
- pipe_texture_reference(&screen->tex, NULL);
-
- screen->shown = 0;
-}
-
-/**
- * Called by libEGL's eglCreateWindowSurface().
- */
-_EGLSurface *
-drm_create_window_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, NativeWindowType window, const EGLint *attrib_list)
-{
- return NULL;
-}
-
-
-/**
- * Called by libEGL's eglCreatePixmapSurface().
- */
-_EGLSurface *
-drm_create_pixmap_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, NativePixmapType pixmap, const EGLint *attrib_list)
-{
- return NULL;
-}
-
-
-/**
- * Called by libEGL's eglCreatePbufferSurface().
- */
-_EGLSurface *
-drm_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
- const EGLint *attrib_list)
-{
- struct drm_device *dev = lookup_drm_device(dpy);
- int i;
- int width = -1;
- int height = -1;
- struct drm_surface *surf = NULL;
- __GLcontextModes *visual;
-
- for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
- switch (attrib_list[i]) {
- case EGL_WIDTH:
- width = attrib_list[++i];
- break;
- case EGL_HEIGHT:
- height = attrib_list[++i];
- break;
- default:
- _eglError(EGL_BAD_ATTRIBUTE, "eglCreatePbufferSurface");
- return EGL_NO_SURFACE;
- }
- }
-
- if (width < 1 || height < 1) {
- _eglError(EGL_BAD_ATTRIBUTE, "eglCreatePbufferSurface");
- return NULL;
- }
-
- surf = (struct drm_surface *) calloc(1, sizeof(struct drm_surface));
- if (!surf)
- goto err;
-
- if (!_eglInitSurface(drv, &surf->base, EGL_PBUFFER_BIT, conf, attrib_list))
- goto err_surf;
-
- surf->w = width;
- surf->h = height;
-
- visual = drm_visual_from_config(conf);
- surf->stfb = drm_create_framebuffer(dev->screen, visual,
- width, height,
- (void*)surf);
- drm_visual_modes_destroy(visual);
-
- return &surf->base;
-
-err_surf:
- free(surf);
-err:
- return NULL;
-}
-
-/**
- * Called by libEGL's eglCreateScreenSurfaceMESA().
- */
-_EGLSurface *
-drm_create_screen_surface_mesa(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *cfg,
- const EGLint *attrib_list)
-{
- EGLSurface surf = drm_create_pbuffer_surface(drv, dpy, cfg, attrib_list);
-
- return surf;
-}
-
-/**
- * Called by libEGL's eglShowScreenSurfaceMESA().
- */
-EGLBoolean
-drm_show_screen_surface_mesa(_EGLDriver *drv, _EGLDisplay *dpy,
- _EGLScreen *screen,
- _EGLSurface *surface, _EGLMode *mode)
-{
- struct drm_device *dev = lookup_drm_device(dpy);
- struct drm_surface *surf = lookup_drm_surface(surface);
- struct drm_screen *scrn = lookup_drm_screen(screen);
- int ret;
- unsigned int i, k;
-
- if (scrn->shown)
- drm_takedown_shown_screen(dpy, scrn);
-
-
- drm_create_texture(dpy, scrn, mode->Width, mode->Height);
- if (!scrn->tex)
- goto err_tex;
-
- ret = drmModeAddFB(dev->drmFD,
- scrn->front.width, scrn->front.height,
- 32, 32, scrn->front.pitch,
- scrn->front.handle,
- &scrn->fbID);
-
- if (ret)
- goto err_bo;
-
- scrn->fb = drmModeGetFB(dev->drmFD, scrn->fbID);
- if (!scrn->fb)
- goto err_bo;
-
- /* find a fitting crtc */
- {
- drmModeConnector *con = scrn->connector;
-
- scrn->mode = drm_find_mode(con, mode);
- if (!scrn->mode)
- goto err_fb;
-
- for (k = 0; k < con->count_encoders; k++) {
- drmModeEncoder *enc = drmModeGetEncoder(dev->drmFD, con->encoders[k]);
- for (i = 0; i < dev->res->count_crtcs; i++) {
- if (enc->possible_crtcs & (1<<i)) {
- /* save the ID */
- scrn->crtcID = dev->res->crtcs[i];
-
- /* skip the rest */
- i = dev->res->count_crtcs;
- k = dev->res->count_encoders;
- }
- }
- drmModeFreeEncoder(enc);
- }
- }
-
- ret = drmModeSetCrtc(dev->drmFD,
- scrn->crtcID,
- scrn->fbID,
- 0, 0,
- &scrn->connectorID, 1,
- scrn->mode);
-
- if (ret)
- goto err_crtc;
-
-
- if (scrn->dpms)
- drmModeConnectorSetProperty(dev->drmFD,
- scrn->connectorID,
- scrn->dpms->prop_id,
- DRM_MODE_DPMS_ON);
-
- surf->screen = scrn;
-
- scrn->surf = surf;
- scrn->shown = 1;
-
- return EGL_TRUE;
-
-err_crtc:
- scrn->crtcID = 0;
-
-err_fb:
- drmModeRmFB(dev->drmFD, scrn->fbID);
- drmModeFreeFB(scrn->fb);
- scrn->fb = NULL;
-
-err_bo:
- pipe_surface_reference(&scrn->surface, NULL);
- pipe_texture_reference(&scrn->tex, NULL);
-
-err_tex:
- return EGL_FALSE;
-}
-
-/**
- * Called by libEGL's eglDestroySurface().
- */
-EGLBoolean
-drm_destroy_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface)
-{
- struct drm_surface *surf = lookup_drm_surface(surface);
- if (!_eglIsSurfaceBound(&surf->base)) {
- if (surf->screen)
- drm_takedown_shown_screen(dpy, surf->screen);
- st_unreference_framebuffer(surf->stfb);
- free(surf);
- }
- return EGL_TRUE;
-}
-
-/**
- * Called by libEGL's eglSwapBuffers().
- */
-EGLBoolean
-drm_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw)
-{
- struct drm_device *dev = lookup_drm_device(dpy);
- struct drm_surface *surf = lookup_drm_surface(draw);
- struct pipe_surface *back_surf;
-
- if (!surf)
- return EGL_FALSE;
-
- st_get_framebuffer_surface(surf->stfb, ST_SURFACE_BACK_LEFT, &back_surf);
-
- if (back_surf) {
- struct drm_context *ctx = lookup_drm_context(draw->Binding);
-
- st_notify_swapbuffers(surf->stfb);
-
- if (ctx && surf->screen) {
- if (ctx->pipe->surface_copy) {
- ctx->pipe->surface_copy(ctx->pipe,
- surf->screen->surface,
- 0, 0,
- back_surf,
- 0, 0,
- surf->w, surf->h);
- } else {
- util_surface_copy(ctx->pipe, FALSE,
- surf->screen->surface,
- 0, 0,
- back_surf,
- 0, 0,
- surf->w, surf->h);
- }
- ctx->pipe->flush(ctx->pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_TEXTURE_CACHE, NULL);
-
-#ifdef DRM_MODE_FEATURE_DIRTYFB
- /* TODO query connector property to see if this is needed */
- drmModeDirtyFB(dev->drmFD, surf->screen->fbID, NULL, 0);
-#else
- (void)dev;
-#endif
-
- /* TODO more stuff here */
- }
- }
-
- return EGL_TRUE;
-}
diff --git a/src/gallium/state_trackers/egl/egl_tracker.c b/src/gallium/state_trackers/egl/egl_tracker.c
deleted file mode 100644
index 11583ec41c9..00000000000
--- a/src/gallium/state_trackers/egl/egl_tracker.c
+++ /dev/null
@@ -1,272 +0,0 @@
-
-#include "utils.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include "egl_tracker.h"
-
-#include <fcntl.h>
-
-#include "egllog.h"
-#include "state_tracker/drm_api.h"
-
-#include "pipe/p_screen.h"
-#include "pipe/internal/p_winsys_screen.h"
-
-/** HACK */
-void* driDriverAPI;
-
-
-/*
- * Exported functions
- */
-
-/** Called by libEGL just prior to unloading/closing the driver.
- */
-static void
-drm_unload(_EGLDriver *drv)
-{
- free(drv);
-}
-
-/**
- * The bootstrap function. Return a new drm_driver object and
- * plug in API functions.
- * libEGL finds this function with dlopen()/dlsym() and calls it from
- * "load driver" function.
- */
-_EGLDriver *
-_eglMain(const char *args)
-{
- _EGLDriver *drv;
-
- drv = (_EGLDriver *) calloc(1, sizeof(_EGLDriver));
- if (!drv) {
- return NULL;
- }
-
- /* First fill in the dispatch table with defaults */
- _eglInitDriverFallbacks(drv);
- /* then plug in our Drm-specific functions */
- drv->API.Initialize = drm_initialize;
- drv->API.Terminate = drm_terminate;
- drv->API.CreateContext = drm_create_context;
- drv->API.MakeCurrent = drm_make_current;
- drv->API.CreateWindowSurface = drm_create_window_surface;
- drv->API.CreatePixmapSurface = drm_create_pixmap_surface;
- drv->API.CreatePbufferSurface = drm_create_pbuffer_surface;
- drv->API.DestroySurface = drm_destroy_surface;
- drv->API.DestroyContext = drm_destroy_context;
- drv->API.CreateScreenSurfaceMESA = drm_create_screen_surface_mesa;
- drv->API.ShowScreenSurfaceMESA = drm_show_screen_surface_mesa;
- drv->API.SwapBuffers = drm_swap_buffers;
-
- drv->Name = "DRM/Gallium/Win";
- drv->Unload = drm_unload;
-
- return drv;
-}
-
-static void
-drm_get_device_id(struct drm_device *device)
-{
- char path[512];
- FILE *file;
- char *ret;
-
- /* TODO get the real minor */
- int minor = 0;
-
- device->deviceID = 0;
-
- snprintf(path, sizeof(path), "/sys/class/drm/card%d/device/device", minor);
- file = fopen(path, "r");
- if (!file) {
- _eglLog(_EGL_WARNING, "Could not retrive device ID\n");
- return;
- }
-
- ret = fgets(path, sizeof( path ), file);
- fclose(file);
- if (!ret)
- return;
-
- sscanf(path, "%x", &device->deviceID);
-}
-
-static void
-drm_update_res(struct drm_device *dev)
-{
- drmModeFreeResources(dev->res);
- dev->res = drmModeGetResources(dev->drmFD);
-}
-
-static void
-drm_add_modes_from_connector(_EGLScreen *screen, drmModeConnectorPtr connector)
-{
- drmModeModeInfoPtr m = NULL;
- int i;
-
- for (i = 0; i < connector->count_modes; i++) {
- m = &connector->modes[i];
- _eglAddNewMode(screen, m->hdisplay, m->vdisplay, m->vrefresh, m->name);
- }
-}
-
-static void
-drm_find_dpms(struct drm_device *dev, struct drm_screen *screen)
-{
- drmModeConnectorPtr c = screen->connector;
- drmModePropertyPtr p;
- int i;
-
- for (i = 0; i < c->count_props; i++) {
- p = drmModeGetProperty(dev->drmFD, c->props[i]);
- if (!strcmp(p->name, "DPMS"))
- break;
-
- drmModeFreeProperty(p);
- p = NULL;
- }
-
- screen->dpms = p;
-}
-
-static int drm_open_minor(int minor)
-{
- char buf[64];
-
- sprintf(buf, DRM_DEV_NAME, DRM_DIR_NAME, minor);
- return open(buf, O_RDWR, 0);
-}
-
-EGLBoolean
-drm_initialize(_EGLDriver *drv, _EGLDisplay *disp, EGLint *major, EGLint *minor)
-{
- struct drm_device *dev;
- struct drm_screen *screen = NULL;
- drmModeConnectorPtr connector = NULL;
- drmModeResPtr res = NULL;
- unsigned count_connectors = 0;
- int num_screens = 0;
- EGLint i;
- int fd;
- _EGLConfig *config;
-
- dev = (struct drm_device *) calloc(1, sizeof(struct drm_device));
- if (!dev)
- return EGL_FALSE;
- dev->api = drm_api_create();
-
- /* try the first node */
- fd = drm_open_minor(0);
- if (fd < 0)
- goto err_fd;
-
- dev->drmFD = fd;
- drm_get_device_id(dev);
-
- dev->screen = dev->api->create_screen(dev->api, dev->drmFD, NULL);
- if (!dev->screen)
- goto err_screen;
- dev->winsys = dev->screen->winsys;
-
- drm_update_res(dev);
- res = dev->res;
- if (res)
- count_connectors = res->count_connectors;
- else
- _eglLog(_EGL_WARNING, "Could not retrive kms information\n");
-
- for(i = 0; i < count_connectors && i < MAX_SCREENS; i++) {
- connector = drmModeGetConnector(fd, res->connectors[i]);
-
- if (!connector)
- continue;
-
- if (connector->connection != DRM_MODE_CONNECTED) {
- drmModeFreeConnector(connector);
- continue;
- }
-
- screen = malloc(sizeof(struct drm_screen));
- memset(screen, 0, sizeof(*screen));
- screen->connector = connector;
- screen->connectorID = connector->connector_id;
- _eglInitScreen(&screen->base);
- _eglAddScreen(disp, &screen->base);
- drm_add_modes_from_connector(&screen->base, connector);
- drm_find_dpms(dev, screen);
- dev->screens[num_screens++] = screen;
- }
- dev->count_screens = num_screens;
-
- disp->DriverData = dev;
-
- /* for now we only have one config */
- config = calloc(1, sizeof(*config));
- memset(config, 1, sizeof(*config));
- _eglInitConfig(config, 1);
- _eglSetConfigAttrib(config, EGL_RED_SIZE, 8);
- _eglSetConfigAttrib(config, EGL_GREEN_SIZE, 8);
- _eglSetConfigAttrib(config, EGL_BLUE_SIZE, 8);
- _eglSetConfigAttrib(config, EGL_ALPHA_SIZE, 8);
- _eglSetConfigAttrib(config, EGL_BUFFER_SIZE, 32);
- _eglSetConfigAttrib(config, EGL_DEPTH_SIZE, 24);
- _eglSetConfigAttrib(config, EGL_STENCIL_SIZE, 8);
- _eglSetConfigAttrib(config, EGL_SURFACE_TYPE, EGL_PBUFFER_BIT);
- _eglAddConfig(disp, config);
-
- disp->ClientAPIsMask = EGL_OPENGL_BIT /*| EGL_OPENGL_ES_BIT*/;
- /* enable supported extensions */
- disp->Extensions.MESA_screen_surface = EGL_TRUE;
- disp->Extensions.MESA_copy_context = EGL_TRUE;
-
- *major = 1;
- *minor = 4;
-
- return EGL_TRUE;
-
-err_screen:
- drmClose(fd);
-err_fd:
- free(dev);
- return EGL_FALSE;
-}
-
-EGLBoolean
-drm_terminate(_EGLDriver *drv, _EGLDisplay *dpy)
-{
- struct drm_device *dev = lookup_drm_device(dpy);
- struct drm_screen *screen;
- int i = 0;
-
- _eglReleaseDisplayResources(drv, dpy);
- _eglCleanupDisplay(dpy);
-
- drmFreeVersion(dev->version);
-
- for (i = 0; i < dev->count_screens; i++) {
- screen = dev->screens[i];
-
- if (screen->shown)
- drm_takedown_shown_screen(dpy, screen);
-
- drmModeFreeProperty(screen->dpms);
- drmModeFreeConnector(screen->connector);
- _eglDestroyScreen(&screen->base);
- dev->screens[i] = NULL;
- }
-
- dev->screen->destroy(dev->screen);
- dev->winsys = NULL;
-
- drmClose(dev->drmFD);
-
- dev->api->destroy(dev->api);
- free(dev);
- dpy->DriverData = NULL;
-
- return EGL_TRUE;
-}
diff --git a/src/gallium/state_trackers/egl/egl_tracker.h b/src/gallium/state_trackers/egl/egl_tracker.h
deleted file mode 100644
index 73eb1a1226e..00000000000
--- a/src/gallium/state_trackers/egl/egl_tracker.h
+++ /dev/null
@@ -1,195 +0,0 @@
-
-#ifndef _EGL_TRACKER_H_
-#define _EGL_TRACKER_H_
-
-#include <stdint.h>
-
-#include "eglconfig.h"
-#include "eglcontext.h"
-#include "egldisplay.h"
-#include "egldriver.h"
-#include "eglglobals.h"
-#include "eglmode.h"
-#include "eglscreen.h"
-#include "eglsurface.h"
-
-#include "xf86drm.h"
-#include "xf86drmMode.h"
-
-#include "pipe/p_compiler.h"
-
-#include "state_tracker/st_public.h"
-
-#define MAX_SCREENS 16
-
-struct pipe_winsys;
-struct pipe_screen;
-struct pipe_context;
-struct state_tracker;
-
-struct drm_screen;
-struct drm_context;
-
-struct drm_device
-{
- /*
- * pipe
- */
-
- struct drm_api *api;
- struct pipe_winsys *winsys;
- struct pipe_screen *screen;
-
- /*
- * drm
- */
-
- int drmFD;
- drmVersionPtr version;
- int deviceID;
-
- drmModeResPtr res;
-
- struct drm_screen *screens[MAX_SCREENS];
- size_t count_screens;
-};
-
-struct drm_surface
-{
- _EGLSurface base; /* base class/object */
-
- /*
- * pipe
- */
-
-
- struct st_framebuffer *stfb;
-
- /*
- * drm
- */
-
- struct drm_screen *screen;
-
- int w;
- int h;
-};
-
-struct drm_context
-{
- _EGLContext base; /* base class/object */
-
- /* pipe */
-
- struct pipe_context *pipe;
- struct st_context *st;
-};
-
-struct drm_screen
-{
- _EGLScreen base;
-
- /*
- * pipe
- */
-
- struct pipe_texture *tex;
- struct pipe_surface *surface;
-
- /*
- * drm
- */
-
- struct {
- unsigned height;
- unsigned width;
- unsigned pitch;
- unsigned handle;
- } front;
-
- /* currently only support one connector */
- drmModeConnectorPtr connector;
- uint32_t connectorID;
-
- /* dpms property */
- drmModePropertyPtr dpms;
-
- /* Has this screen been shown */
- int shown;
-
- /* Surface that is currently attached to this screen */
- struct drm_surface *surf;
-
- /* framebuffer */
- drmModeFBPtr fb;
- uint32_t fbID;
-
- /* crtc and mode used */
- /*drmModeCrtcPtr crtc;*/
- uint32_t crtcID;
-
- drmModeModeInfoPtr mode;
-};
-
-
-static INLINE struct drm_device *
-lookup_drm_device(_EGLDisplay *d)
-{
- return (struct drm_device *) d->DriverData;
-}
-
-
-static INLINE struct drm_context *
-lookup_drm_context(_EGLContext *c)
-{
- return (struct drm_context *) c;
-}
-
-
-static INLINE struct drm_surface *
-lookup_drm_surface(_EGLSurface *s)
-{
- return (struct drm_surface *) s;
-}
-
-static INLINE struct drm_screen *
-lookup_drm_screen(_EGLScreen *s)
-{
- return (struct drm_screen *) s;
-}
-
-/**
- * egl_visual.h
- */
-/*@{*/
-void drm_visual_modes_destroy(__GLcontextModes *modes);
-__GLcontextModes* drm_visual_modes_create(unsigned count, size_t minimum_size);
-__GLcontextModes* drm_visual_from_config(_EGLConfig *conf);
-/*@}*/
-
-/**
- * egl_surface.h
- */
-/*@{*/
-void drm_takedown_shown_screen(_EGLDisplay *dpy, struct drm_screen *screen);
-/*@}*/
-
-/**
- * All function exported to the egl side.
- */
-/*@{*/
-EGLBoolean drm_initialize(_EGLDriver *drv, _EGLDisplay *dpy, EGLint *major, EGLint *minor);
-EGLBoolean drm_terminate(_EGLDriver *drv, _EGLDisplay *dpy);
-_EGLContext *drm_create_context(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, _EGLContext *share_list, const EGLint *attrib_list);
-EGLBoolean drm_destroy_context(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *context);
-_EGLSurface *drm_create_window_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, NativeWindowType window, const EGLint *attrib_list);
-_EGLSurface *drm_create_pixmap_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, NativePixmapType pixmap, const EGLint *attrib_list);
-_EGLSurface *drm_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, const EGLint *attrib_list);
-_EGLSurface *drm_create_screen_surface_mesa(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, const EGLint *attrib_list);
-EGLBoolean drm_show_screen_surface_mesa(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *screen, _EGLSurface *surface, _EGLMode *mode);
-EGLBoolean drm_destroy_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface);
-EGLBoolean drm_make_current(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw, _EGLSurface *read, _EGLContext *context);
-EGLBoolean drm_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw);
-/*@}*/
-
-#endif
diff --git a/src/gallium/state_trackers/egl/egl_visual.c b/src/gallium/state_trackers/egl/egl_visual.c
deleted file mode 100644
index e59f893851e..00000000000
--- a/src/gallium/state_trackers/egl/egl_visual.c
+++ /dev/null
@@ -1,85 +0,0 @@
-
-#include "egl_tracker.h"
-
-#include "egllog.h"
-
-void
-drm_visual_modes_destroy(__GLcontextModes *modes)
-{
- _eglLog(_EGL_DEBUG, "%s", __FUNCTION__);
-
- while (modes) {
- __GLcontextModes * const next = modes->next;
- free(modes);
- modes = next;
- }
-}
-
-__GLcontextModes *
-drm_visual_modes_create(unsigned count, size_t minimum_size)
-{
- /* This code copied from libGLX, and modified */
- const size_t size = (minimum_size > sizeof(__GLcontextModes))
- ? minimum_size : sizeof(__GLcontextModes);
- __GLcontextModes * head = NULL;
- __GLcontextModes ** next;
- unsigned i;
-
- _eglLog(_EGL_DEBUG, "%s %d %d", __FUNCTION__, count, minimum_size);
-
- next = & head;
- for (i = 0 ; i < count ; i++) {
- *next = (__GLcontextModes *) calloc(1, size);
- if (*next == NULL) {
- drm_visual_modes_destroy(head);
- head = NULL;
- break;
- }
-
- (*next)->doubleBufferMode = 1;
- (*next)->visualID = GLX_DONT_CARE;
- (*next)->visualType = GLX_DONT_CARE;
- (*next)->visualRating = GLX_NONE;
- (*next)->transparentPixel = GLX_NONE;
- (*next)->transparentRed = GLX_DONT_CARE;
- (*next)->transparentGreen = GLX_DONT_CARE;
- (*next)->transparentBlue = GLX_DONT_CARE;
- (*next)->transparentAlpha = GLX_DONT_CARE;
- (*next)->transparentIndex = GLX_DONT_CARE;
- (*next)->xRenderable = GLX_DONT_CARE;
- (*next)->fbconfigID = GLX_DONT_CARE;
- (*next)->swapMethod = GLX_SWAP_UNDEFINED_OML;
- (*next)->bindToTextureRgb = GLX_DONT_CARE;
- (*next)->bindToTextureRgba = GLX_DONT_CARE;
- (*next)->bindToMipmapTexture = GLX_DONT_CARE;
- (*next)->bindToTextureTargets = 0;
- (*next)->yInverted = GLX_DONT_CARE;
-
- next = & ((*next)->next);
- }
-
- return head;
-}
-
-__GLcontextModes *
-drm_visual_from_config(_EGLConfig *conf)
-{
- __GLcontextModes *visual;
- (void)conf;
-
- visual = drm_visual_modes_create(1, sizeof(*visual));
- visual->redBits = 8;
- visual->greenBits = 8;
- visual->blueBits = 8;
- visual->alphaBits = 8;
-
- visual->rgbBits = 32;
- visual->doubleBufferMode = 1;
-
- visual->depthBits = 24;
- visual->haveDepthBuffer = visual->depthBits > 0;
- visual->stencilBits = 8;
- visual->haveStencilBuffer = visual->stencilBits > 0;
-
- return visual;
-}
diff --git a/src/gallium/state_trackers/egl_g3d/kms/native_kms.c b/src/gallium/state_trackers/egl/kms/native_kms.c
index d5baf2c2f05..d5baf2c2f05 100644
--- a/src/gallium/state_trackers/egl_g3d/kms/native_kms.c
+++ b/src/gallium/state_trackers/egl/kms/native_kms.c
diff --git a/src/gallium/state_trackers/egl_g3d/kms/native_kms.h b/src/gallium/state_trackers/egl/kms/native_kms.h
index 095186e3cf3..095186e3cf3 100644
--- a/src/gallium/state_trackers/egl_g3d/kms/native_kms.h
+++ b/src/gallium/state_trackers/egl/kms/native_kms.h
diff --git a/src/gallium/state_trackers/egl_g3d/x11/native_dri2.c b/src/gallium/state_trackers/egl/x11/native_dri2.c
index 07f82d878c5..07f82d878c5 100644
--- a/src/gallium/state_trackers/egl_g3d/x11/native_dri2.c
+++ b/src/gallium/state_trackers/egl/x11/native_dri2.c
diff --git a/src/gallium/state_trackers/egl_g3d/x11/native_x11.c b/src/gallium/state_trackers/egl/x11/native_x11.c
index 695ab88010b..dd3c9f8b6ac 100644
--- a/src/gallium/state_trackers/egl_g3d/x11/native_x11.c
+++ b/src/gallium/state_trackers/egl/x11/native_x11.c
@@ -70,7 +70,8 @@ native_create_probe(EGLNativeDisplayType dpy)
if (xscr) {
if (x11_screen_support(xscr, X11_SCREEN_EXTENSION_DRI2)) {
driver_name = x11_screen_probe_dri2(xscr);
- nprobe->data = strdup(driver_name);
+ if (driver_name)
+ nprobe->data = strdup(driver_name);
}
x11_screen_destroy(xscr);
diff --git a/src/gallium/state_trackers/egl_g3d/x11/native_x11.h b/src/gallium/state_trackers/egl/x11/native_x11.h
index 622ddac5df6..622ddac5df6 100644
--- a/src/gallium/state_trackers/egl_g3d/x11/native_x11.h
+++ b/src/gallium/state_trackers/egl/x11/native_x11.h
diff --git a/src/gallium/state_trackers/egl_g3d/x11/native_ximage.c b/src/gallium/state_trackers/egl/x11/native_ximage.c
index dfa8df22234..dfa8df22234 100644
--- a/src/gallium/state_trackers/egl_g3d/x11/native_ximage.c
+++ b/src/gallium/state_trackers/egl/x11/native_ximage.c
diff --git a/src/gallium/state_trackers/egl_g3d/x11/sw_winsys.c b/src/gallium/state_trackers/egl/x11/sw_winsys.c
index 6ee3ede38cb..6ee3ede38cb 100644
--- a/src/gallium/state_trackers/egl_g3d/x11/sw_winsys.c
+++ b/src/gallium/state_trackers/egl/x11/sw_winsys.c
diff --git a/src/gallium/state_trackers/egl_g3d/x11/sw_winsys.h b/src/gallium/state_trackers/egl/x11/sw_winsys.h
index f96c5a14b0a..f96c5a14b0a 100644
--- a/src/gallium/state_trackers/egl_g3d/x11/sw_winsys.h
+++ b/src/gallium/state_trackers/egl/x11/sw_winsys.h
diff --git a/src/gallium/state_trackers/egl_g3d/x11/x11_screen.c b/src/gallium/state_trackers/egl/x11/x11_screen.c
index fef7878ab9a..76ce45ee574 100644
--- a/src/gallium/state_trackers/egl_g3d/x11/x11_screen.c
+++ b/src/gallium/state_trackers/egl/x11/x11_screen.c
@@ -42,6 +42,10 @@ struct x11_screen {
Display *dpy;
int number;
+ /*
+ * This is used to fetch GLX visuals/fbconfigs. It uses code from egl_xdri.
+ * It might be better to rewrite the part in Xlib or XCB.
+ */
__GLXdisplayPrivate *glx_dpy;
int dri_major, dri_minor;
@@ -93,8 +97,8 @@ x11_screen_destroy(struct x11_screen *xscr)
if (xscr->dri_device)
Xfree(xscr->dri_device);
- if (xscr->glx_dpy)
- __glXRelease(xscr->glx_dpy);
+ /* xscr->glx_dpy will be destroyed with the X display */
+
if (xscr->visuals)
XFree(xscr->visuals);
free(xscr);
diff --git a/src/gallium/state_trackers/egl_g3d/x11/x11_screen.h b/src/gallium/state_trackers/egl/x11/x11_screen.h
index 5432858ac3e..5432858ac3e 100644
--- a/src/gallium/state_trackers/egl_g3d/x11/x11_screen.h
+++ b/src/gallium/state_trackers/egl/x11/x11_screen.h
diff --git a/src/gallium/state_trackers/egl_g3d/Makefile b/src/gallium/state_trackers/egl_g3d/Makefile
deleted file mode 100644
index 213eb3e815b..00000000000
--- a/src/gallium/state_trackers/egl_g3d/Makefile
+++ /dev/null
@@ -1,72 +0,0 @@
-TOP = ../../../..
-include $(TOP)/configs/current
-
-common_INCLUDES = \
- -I. \
- -I$(TOP)/src/gallium/include \
- -I$(TOP)/src/gallium/auxiliary \
- -I$(TOP)/src/egl/main \
- -I$(TOP)/include
-
-common_SOURCES = $(wildcard common/*.c)
-common_OBJECTS = $(common_SOURCES:.c=.o)
-
-
-x11_INCLUDES = \
- -I$(TOP)/src/gallium/drivers \
- -I$(TOP)/src/glx/x11 \
- -I$(TOP)/src/mesa \
- $(shell pkg-config --cflags-only-I libdrm)
-
-x11_SOURCES = $(wildcard x11/*.c) $(TOP)/src/glx/x11/dri2.c
-x11_OBJECTS = $(x11_SOURCES:.c=.o)
-
-
-kms_INCLUDES = $(shell pkg-config --cflags-only-I libdrm)
-kms_SOURCES = $(wildcard kms/*.c)
-kms_OBJECTS = $(kms_SOURCES:.c=.o)
-
-
-ALL_INCLUDES = $(common_INCLUDES) $(x11_INCLUDES) $(kms_INCLUDES)
-ALL_SOURCES = $(common_SOURCES) $(x11_SOURCES) $(kms_SOURCES)
-ALL_OBJECTS = $(common_OBJECTS) $(x11_OBJECTS) $(kms_OBJECTS)
-
-##### TARGETS #####
-
-EGL_DISPLAYS_MODS = $(foreach dpy, $(EGL_DISPLAYS), libegl$(dpy).a)
-
-default: depend $(EGL_DISPLAYS_MODS)
-
-
-libeglx11.a: $(x11_OBJECTS) $(common_OBJECTS) Makefile
- $(MKLIB) -o eglx11 -static $(x11_OBJECTS) $(common_OBJECTS)
-
-libeglkms.a: $(kms_OBJECTS) $(common_OBJECTS) Makefile
- $(MKLIB) -o eglkms -static $(kms_OBJECTS) $(common_OBJECTS)
-
-depend:
- rm -f depend
- touch depend
- $(MKDEP) $(MKDEP_OPTIONS) $(ALL_INCLUDES) $(ALL_SOURCES) 2> /dev/null
-
-clean:
- rm -f $(ALL_OBJECTS)
- rm -f $(EGL_DISPLAYS_MODS)
- rm -f depend depend.bak
-
-# Dummy target
-install:
- @echo -n ""
-
-##### RULES #####
-
-$(common_OBJECTS): %.o: %.c
- $(CC) -c $(common_INCLUDES) $(DEFINES) $(CFLAGS) $< -o $@
-
-$(x11_OBJECTS): %.o: %.c
- $(CC) -c $(common_INCLUDES) $(x11_INCLUDES) $(DEFINES) $(CFLAGS) $< -o $@
-
-$(kms_OBJECTS): %.o: %.c
- $(CC) -c $(common_INCLUDES) $(kms_INCLUDES) $(DEFINES) $(CFLAGS) $< -o $@
-
-sinclude depend
diff --git a/src/gallium/state_trackers/egl_g3d/x11/glxinit.c b/src/gallium/state_trackers/egl_g3d/x11/glxinit.c
deleted file mode 100644
index c955a908b93..00000000000
--- a/src/gallium/state_trackers/egl_g3d/x11/glxinit.c
+++ /dev/null
@@ -1,573 +0,0 @@
-/**
- * GLX initialization. Code based on glxext.c, glx_query.c, and
- * glcontextmodes.c under src/glx/x11/. The major difference is that no DRI
- * related code here.
- *
- */
-
-#include <assert.h>
-#include <X11/Xlib.h>
-#include <X11/Xproto.h>
-#include <X11/extensions/Xext.h>
-#include <X11/extensions/extutil.h>
-#include <sys/time.h>
-
-#include "x11_screen.h"
-#include "glxinit.h"
-
-typedef struct GLXGenericGetString
-{
- CARD8 reqType;
- CARD8 glxCode;
- CARD16 length B16;
- CARD32 for_whom B32;
- CARD32 name B32;
-} xGLXGenericGetStringReq;
-
-#define sz_xGLXGenericGetStringReq 12
-#define X_GLXGenericGetString 0
-
-/* Extension required boiler plate */
-
-static char *__glXExtensionName = GLX_EXTENSION_NAME;
-static XExtensionInfo *__glXExtensionInfo = NULL;
-
-static /* const */ XExtensionHooks __glXExtensionHooks = { NULL };
-static
-XEXT_GENERATE_FIND_DISPLAY(__glXFindDisplay, __glXExtensionInfo,
- __glXExtensionName, &__glXExtensionHooks,
- __GLX_NUMBER_EVENTS, NULL)
-
-static GLint
-_gl_convert_from_x_visual_type(int visualType)
-{
-#define NUM_VISUAL_TYPES 6
- static const int glx_visual_types[NUM_VISUAL_TYPES] = {
- GLX_STATIC_GRAY, GLX_GRAY_SCALE,
- GLX_STATIC_COLOR, GLX_PSEUDO_COLOR,
- GLX_TRUE_COLOR, GLX_DIRECT_COLOR
- };
-
- return ((unsigned) visualType < NUM_VISUAL_TYPES)
- ? glx_visual_types[visualType] : GLX_NONE;
-}
-
-_X_HIDDEN char *
-__glXQueryServerString(Display * dpy, int opcode, CARD32 screen, CARD32 name)
-{
- xGLXGenericGetStringReq *req;
- xGLXSingleReply reply;
- int length;
- int numbytes;
- char *buf;
- CARD32 for_whom = screen;
- CARD32 glxCode = X_GLXQueryServerString;
-
-
- LockDisplay(dpy);
-
-
- /* All of the GLX protocol requests for getting a string from the server
- * look the same. The exact meaning of the for_whom field is usually
- * either the screen number (for glXQueryServerString) or the context tag
- * (for GLXSingle).
- */
-
- GetReq(GLXGenericGetString, req);
- req->reqType = opcode;
- req->glxCode = glxCode;
- req->for_whom = for_whom;
- req->name = name;
-
- _XReply(dpy, (xReply *) & reply, 0, False);
-
- length = reply.length * 4;
- numbytes = reply.size;
-
- buf = (char *) Xmalloc(numbytes);
- if (buf != NULL) {
- _XRead(dpy, buf, numbytes);
- length -= numbytes;
- }
-
- _XEatData(dpy, length);
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- return buf;
-}
-
-/************************************************************************/
-/*
-** Free the per screen configs data as well as the array of
-** __glXScreenConfigs.
-*/
-static void
-FreeScreenConfigs(__GLXdisplayPrivate * priv)
-{
- __GLXscreenConfigs *psc;
- GLint i, screens;
-
- /* Free screen configuration information */
- psc = priv->screenConfigs;
- screens = ScreenCount(priv->dpy);
- for (i = 0; i < screens; i++, psc++) {
- if (psc->configs) {
- x11_context_modes_destroy(psc->configs);
- psc->configs = NULL; /* NOTE: just for paranoia */
- }
- if (psc->visuals) {
- x11_context_modes_destroy(psc->visuals);
- psc->visuals = NULL; /* NOTE: just for paranoia */
- }
- Xfree((char *) psc->serverGLXexts);
- }
- XFree((char *) priv->screenConfigs);
- priv->screenConfigs = NULL;
-}
-
-/************************************************************************/
-
-/*
-** Query the version of the GLX extension. This procedure works even if
-** the client extension is not completely set up.
-*/
-static Bool
-QueryVersion(Display * dpy, int opcode, int *major, int *minor)
-{
- xGLXQueryVersionReq *req;
- xGLXQueryVersionReply reply;
-
- /* Send the glXQueryVersion request */
- LockDisplay(dpy);
- GetReq(GLXQueryVersion, req);
- req->reqType = opcode;
- req->glxCode = X_GLXQueryVersion;
- req->majorVersion = GLX_MAJOR_VERSION;
- req->minorVersion = GLX_MINOR_VERSION;
- _XReply(dpy, (xReply *) & reply, 0, False);
- UnlockDisplay(dpy);
- SyncHandle();
-
- if (reply.majorVersion != GLX_MAJOR_VERSION) {
- /*
- ** The server does not support the same major release as this
- ** client.
- */
- return GL_FALSE;
- }
- *major = reply.majorVersion;
- *minor = min(reply.minorVersion, GLX_MINOR_VERSION);
- return GL_TRUE;
-}
-
-_X_HIDDEN void
-__glXInitializeVisualConfigFromTags(__GLcontextModes * config, int count,
- const INT32 * bp, Bool tagged_only,
- Bool fbconfig_style_tags)
-{
- int i;
-
- if (!tagged_only) {
- /* Copy in the first set of properties */
- config->visualID = *bp++;
-
- config->visualType = _gl_convert_from_x_visual_type(*bp++);
-
- config->rgbMode = *bp++;
-
- config->redBits = *bp++;
- config->greenBits = *bp++;
- config->blueBits = *bp++;
- config->alphaBits = *bp++;
- config->accumRedBits = *bp++;
- config->accumGreenBits = *bp++;
- config->accumBlueBits = *bp++;
- config->accumAlphaBits = *bp++;
-
- config->doubleBufferMode = *bp++;
- config->stereoMode = *bp++;
-
- config->rgbBits = *bp++;
- config->depthBits = *bp++;
- config->stencilBits = *bp++;
- config->numAuxBuffers = *bp++;
- config->level = *bp++;
-
- count -= __GLX_MIN_CONFIG_PROPS;
- }
-
- /*
- ** Additional properties may be in a list at the end
- ** of the reply. They are in pairs of property type
- ** and property value.
- */
-
-#define FETCH_OR_SET(tag) \
- config-> tag = ( fbconfig_style_tags ) ? *bp++ : 1
-
- for (i = 0; i < count; i += 2) {
- switch (*bp++) {
- case GLX_RGBA:
- FETCH_OR_SET(rgbMode);
- break;
- case GLX_BUFFER_SIZE:
- config->rgbBits = *bp++;
- break;
- case GLX_LEVEL:
- config->level = *bp++;
- break;
- case GLX_DOUBLEBUFFER:
- FETCH_OR_SET(doubleBufferMode);
- break;
- case GLX_STEREO:
- FETCH_OR_SET(stereoMode);
- break;
- case GLX_AUX_BUFFERS:
- config->numAuxBuffers = *bp++;
- break;
- case GLX_RED_SIZE:
- config->redBits = *bp++;
- break;
- case GLX_GREEN_SIZE:
- config->greenBits = *bp++;
- break;
- case GLX_BLUE_SIZE:
- config->blueBits = *bp++;
- break;
- case GLX_ALPHA_SIZE:
- config->alphaBits = *bp++;
- break;
- case GLX_DEPTH_SIZE:
- config->depthBits = *bp++;
- break;
- case GLX_STENCIL_SIZE:
- config->stencilBits = *bp++;
- break;
- case GLX_ACCUM_RED_SIZE:
- config->accumRedBits = *bp++;
- break;
- case GLX_ACCUM_GREEN_SIZE:
- config->accumGreenBits = *bp++;
- break;
- case GLX_ACCUM_BLUE_SIZE:
- config->accumBlueBits = *bp++;
- break;
- case GLX_ACCUM_ALPHA_SIZE:
- config->accumAlphaBits = *bp++;
- break;
- case GLX_VISUAL_CAVEAT_EXT:
- config->visualRating = *bp++;
- break;
- case GLX_X_VISUAL_TYPE:
- config->visualType = *bp++;
- break;
- case GLX_TRANSPARENT_TYPE:
- config->transparentPixel = *bp++;
- break;
- case GLX_TRANSPARENT_INDEX_VALUE:
- config->transparentIndex = *bp++;
- break;
- case GLX_TRANSPARENT_RED_VALUE:
- config->transparentRed = *bp++;
- break;
- case GLX_TRANSPARENT_GREEN_VALUE:
- config->transparentGreen = *bp++;
- break;
- case GLX_TRANSPARENT_BLUE_VALUE:
- config->transparentBlue = *bp++;
- break;
- case GLX_TRANSPARENT_ALPHA_VALUE:
- config->transparentAlpha = *bp++;
- break;
- case GLX_VISUAL_ID:
- config->visualID = *bp++;
- break;
- case GLX_DRAWABLE_TYPE:
- config->drawableType = *bp++;
- break;
- case GLX_RENDER_TYPE:
- config->renderType = *bp++;
- break;
- case GLX_X_RENDERABLE:
- config->xRenderable = *bp++;
- break;
- case GLX_FBCONFIG_ID:
- config->fbconfigID = *bp++;
- break;
- case GLX_MAX_PBUFFER_WIDTH:
- config->maxPbufferWidth = *bp++;
- break;
- case GLX_MAX_PBUFFER_HEIGHT:
- config->maxPbufferHeight = *bp++;
- break;
- case GLX_MAX_PBUFFER_PIXELS:
- config->maxPbufferPixels = *bp++;
- break;
- case GLX_OPTIMAL_PBUFFER_WIDTH_SGIX:
- config->optimalPbufferWidth = *bp++;
- break;
- case GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX:
- config->optimalPbufferHeight = *bp++;
- break;
- case GLX_VISUAL_SELECT_GROUP_SGIX:
- config->visualSelectGroup = *bp++;
- break;
- case GLX_SWAP_METHOD_OML:
- config->swapMethod = *bp++;
- break;
- case GLX_SAMPLE_BUFFERS_SGIS:
- config->sampleBuffers = *bp++;
- break;
- case GLX_SAMPLES_SGIS:
- config->samples = *bp++;
- break;
- case GLX_BIND_TO_TEXTURE_RGB_EXT:
- config->bindToTextureRgb = *bp++;
- break;
- case GLX_BIND_TO_TEXTURE_RGBA_EXT:
- config->bindToTextureRgba = *bp++;
- break;
- case GLX_BIND_TO_MIPMAP_TEXTURE_EXT:
- config->bindToMipmapTexture = *bp++;
- break;
- case GLX_BIND_TO_TEXTURE_TARGETS_EXT:
- config->bindToTextureTargets = *bp++;
- break;
- case GLX_Y_INVERTED_EXT:
- config->yInverted = *bp++;
- break;
- case None:
- i = count;
- break;
- default:
- break;
- }
- }
-
- config->renderType =
- (config->rgbMode) ? GLX_RGBA_BIT : GLX_COLOR_INDEX_BIT;
-
- config->haveAccumBuffer = ((config->accumRedBits +
- config->accumGreenBits +
- config->accumBlueBits +
- config->accumAlphaBits) > 0);
- config->haveDepthBuffer = (config->depthBits > 0);
- config->haveStencilBuffer = (config->stencilBits > 0);
-}
-
-static __GLcontextModes *
-createConfigsFromProperties(Display * dpy, int nvisuals, int nprops,
- int screen, GLboolean tagged_only)
-{
- INT32 buf[__GLX_TOTAL_CONFIG], *props;
- unsigned prop_size;
- __GLcontextModes *modes, *m;
- int i;
-
- if (nprops == 0)
- return NULL;
-
- /* FIXME: Is the __GLX_MIN_CONFIG_PROPS test correct for FBconfigs? */
-
- /* Check number of properties */
- if (nprops < __GLX_MIN_CONFIG_PROPS || nprops > __GLX_MAX_CONFIG_PROPS)
- return NULL;
-
- /* Allocate memory for our config structure */
- modes = x11_context_modes_create(nvisuals);
- if (!modes)
- return NULL;
-
- prop_size = nprops * __GLX_SIZE_INT32;
- if (prop_size <= sizeof(buf))
- props = buf;
- else
- props = Xmalloc(prop_size);
-
- /* Read each config structure and convert it into our format */
- m = modes;
- for (i = 0; i < nvisuals; i++) {
- _XRead(dpy, (char *) props, prop_size);
- /* Older X servers don't send this so we default it here. */
- m->drawableType = GLX_WINDOW_BIT;
- __glXInitializeVisualConfigFromTags(m, nprops, props,
- tagged_only, GL_TRUE);
- m->screen = screen;
- m = m->next;
- }
-
- if (props != buf)
- Xfree(props);
-
- return modes;
-}
-
-static GLboolean
-getVisualConfigs(Display * dpy, __GLXdisplayPrivate * priv, int screen)
-{
- xGLXGetVisualConfigsReq *req;
- __GLXscreenConfigs *psc;
- xGLXGetVisualConfigsReply reply;
-
- LockDisplay(dpy);
-
- psc = priv->screenConfigs + screen;
- psc->visuals = NULL;
- GetReq(GLXGetVisualConfigs, req);
- req->reqType = priv->majorOpcode;
- req->glxCode = X_GLXGetVisualConfigs;
- req->screen = screen;
-
- if (!_XReply(dpy, (xReply *) & reply, 0, False))
- goto out;
-
- psc->visuals = createConfigsFromProperties(dpy,
- reply.numVisuals,
- reply.numProps,
- screen, GL_FALSE);
-
- out:
- UnlockDisplay(dpy);
- return psc->visuals != NULL;
-}
-
-static GLboolean
-getFBConfigs(Display * dpy, __GLXdisplayPrivate * priv, int screen)
-{
- xGLXGetFBConfigsReq *fb_req;
- xGLXGetFBConfigsSGIXReq *sgi_req;
- xGLXVendorPrivateWithReplyReq *vpreq;
- xGLXGetFBConfigsReply reply;
- __GLXscreenConfigs *psc;
-
- psc = priv->screenConfigs + screen;
- psc->serverGLXexts =
- __glXQueryServerString(dpy, priv->majorOpcode, screen, GLX_EXTENSIONS);
-
- LockDisplay(dpy);
-
- psc->configs = NULL;
- if (atof(priv->serverGLXversion) >= 1.3) {
- GetReq(GLXGetFBConfigs, fb_req);
- fb_req->reqType = priv->majorOpcode;
- fb_req->glxCode = X_GLXGetFBConfigs;
- fb_req->screen = screen;
- }
- else if (strstr(psc->serverGLXexts, "GLX_SGIX_fbconfig") != NULL) {
- GetReqExtra(GLXVendorPrivateWithReply,
- sz_xGLXGetFBConfigsSGIXReq +
- sz_xGLXVendorPrivateWithReplyReq, vpreq);
- sgi_req = (xGLXGetFBConfigsSGIXReq *) vpreq;
- sgi_req->reqType = priv->majorOpcode;
- sgi_req->glxCode = X_GLXVendorPrivateWithReply;
- sgi_req->vendorCode = X_GLXvop_GetFBConfigsSGIX;
- sgi_req->screen = screen;
- }
- else
- goto out;
-
- if (!_XReply(dpy, (xReply *) & reply, 0, False))
- goto out;
-
- psc->configs = createConfigsFromProperties(dpy,
- reply.numFBConfigs,
- reply.numAttribs * 2,
- screen, GL_TRUE);
-
- out:
- UnlockDisplay(dpy);
- return psc->configs != NULL;
-}
-
-static GLboolean
-AllocAndFetchScreenConfigs(Display * dpy, __GLXdisplayPrivate * priv)
-{
- __GLXscreenConfigs *psc;
- GLint i, screens;
-
- /*
- ** First allocate memory for the array of per screen configs.
- */
- screens = ScreenCount(dpy);
- psc = (__GLXscreenConfigs *) Xmalloc(screens * sizeof(__GLXscreenConfigs));
- if (!psc) {
- return GL_FALSE;
- }
- memset(psc, 0, screens * sizeof(__GLXscreenConfigs));
- priv->screenConfigs = psc;
-
- priv->serverGLXversion =
- __glXQueryServerString(dpy, priv->majorOpcode, 0, GLX_VERSION);
- if (priv->serverGLXversion == NULL) {
- FreeScreenConfigs(priv);
- return GL_FALSE;
- }
-
- for (i = 0; i < screens; i++, psc++) {
- getFBConfigs(dpy, priv, i);
- getVisualConfigs(dpy, priv, i);
- psc->scr = i;
- psc->dpy = dpy;
- }
-
- SyncHandle();
-
- return GL_TRUE;
-}
-
-_X_HIDDEN void
-__glXRelease(__GLXdisplayPrivate *dpyPriv)
-{
- FreeScreenConfigs(dpyPriv);
-
- if (dpyPriv->serverGLXvendor) {
- Xfree((char *) dpyPriv->serverGLXvendor);
- dpyPriv->serverGLXvendor = NULL;
- }
- if (dpyPriv->serverGLXversion) {
- Xfree((char *) dpyPriv->serverGLXversion);
- dpyPriv->serverGLXversion = NULL;
- }
-
- Xfree(dpyPriv);
-}
-
-_X_HIDDEN __GLXdisplayPrivate *
-__glXInitialize(Display * dpy)
-{
- XExtDisplayInfo *info = __glXFindDisplay(dpy);
- __GLXdisplayPrivate *dpyPriv;
- int major, minor;
-
- if (!XextHasExtension(info))
- return NULL;
-
- /* See if the versions are compatible */
- if (!QueryVersion(dpy, info->codes->major_opcode, &major, &minor))
- return NULL;
-
- dpyPriv = (__GLXdisplayPrivate *) Xcalloc(1, sizeof(__GLXdisplayPrivate));
- if (!dpyPriv)
- return NULL;
-
- /*
- ** Init the display private and then read in the screen config
- ** structures from the server.
- */
- dpyPriv->majorOpcode = info->codes->major_opcode;
- dpyPriv->majorVersion = major;
- dpyPriv->minorVersion = minor;
- dpyPriv->dpy = dpy;
-
- dpyPriv->serverGLXvendor = NULL;
- dpyPriv->serverGLXversion = NULL;
-
- if (!AllocAndFetchScreenConfigs(dpy, dpyPriv)) {
- Xfree(dpyPriv);
- return NULL;
- }
-
- return dpyPriv;
-}
diff --git a/src/gallium/state_trackers/egl_g3d/x11/glxinit.h b/src/gallium/state_trackers/egl_g3d/x11/glxinit.h
deleted file mode 100644
index 515a8252220..00000000000
--- a/src/gallium/state_trackers/egl_g3d/x11/glxinit.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef GLXINIT_INCLUDED
-#define GLXINIT_INCLUDED
-
-#include <X11/Xlib.h>
-
-#ifndef GLX_DIRECT_RENDERING
-#define GLX_DIRECT_RENDERING
-#endif
-#include "glxclient.h"
-
-extern void
-__glXRelease(__GLXdisplayPrivate *dpyPriv);
-
-#endif /* GLXINIT_INCLUDED */
diff --git a/src/gallium/state_trackers/es/Makefile b/src/gallium/state_trackers/es/Makefile
index 095ffbb938c..b0365512719 100644
--- a/src/gallium/state_trackers/es/Makefile
+++ b/src/gallium/state_trackers/es/Makefile
@@ -49,7 +49,7 @@ default: $(TOP)/$(LIB_DIR)/$(GLES_1_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLES_2_LIB_NAM
# Make the shared libs
$(TOP)/$(LIB_DIR)/$(GLES_1_LIB_NAME): $(ES1_OBJECTS) $(ES1_LIBS) $(GALLIUM_AUXILIARIES)
- $(MKLIB) -o $(GLES_1_LIB) \
+ $(MKLIB) -o $(GLES_1_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-major $(GLES_1_VERSION_MAJOR) \
-minor $(GLES_1_VERSION_MINOR) \
-patch $(GLES_1_VERSION_PATCH) \
@@ -59,7 +59,7 @@ $(TOP)/$(LIB_DIR)/$(GLES_1_LIB_NAME): $(ES1_OBJECTS) $(ES1_LIBS) $(GALLIUM_AUXIL
$(GALLIUM_AUXILIARIES) $(SYS_LIBS)
$(TOP)/$(LIB_DIR)/$(GLES_2_LIB_NAME): $(ES2_OBJECTS) $(ES1_LIBS) $(GALLIUM_AUXILIARIES)
- $(MKLIB) -o $(GLES_2_LIB) \
+ $(MKLIB) -o $(GLES_2_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-major $(GLES_2_VERSION_MAJOR) \
-minor $(GLES_2_VERSION_MINOR) \
-patch $(GLES_2_VERSION_PATCH) \
diff --git a/src/gallium/state_trackers/python/SConscript b/src/gallium/state_trackers/python/SConscript
index 8498a90812e..527e065cd91 100644
--- a/src/gallium/state_trackers/python/SConscript
+++ b/src/gallium/state_trackers/python/SConscript
@@ -21,6 +21,7 @@ if 'python' in env['statetrackers']:
'gdi32',
'user32',
'kernel32',
+ 'ws2_32',
])
else:
env.Append(LIBS = [
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-cb-1d.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-cb-1d.sh
new file mode 100644
index 00000000000..85fb9ea4e7f
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-cb-1d.sh
@@ -0,0 +1,13 @@
+FRAG
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+DCL CONST[1]
+DCL CONST[3]
+DCL TEMP[0..1]
+
+ADD TEMP[0], IN[0], CONST[1]
+RCP TEMP[1], CONST[3].xxxx
+MUL OUT[0], TEMP[0], TEMP[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-cb-2d.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-cb-2d.sh
new file mode 100644
index 00000000000..f70a5146f4e
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-cb-2d.sh
@@ -0,0 +1,9 @@
+FRAG
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+DCL CONST[1][1..2]
+
+MAD OUT[0], IN[0], CONST[1][2], CONST[1][1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-slt.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-slt.sh
index f2a1521cbf0..d58b7886a12 100644
--- a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-slt.sh
+++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-slt.sh
@@ -1,4 +1,4 @@
-FRAG1.1
+FRAG
DCL IN[0], COLOR, LINEAR
DCL OUT[0], COLOR
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/fragment-shader.py b/src/gallium/state_trackers/python/tests/regress/fragment-shader/fragment-shader.py
index e9d844c7189..41dd69d2542 100644
--- a/src/gallium/state_trackers/python/tests/regress/fragment-shader/fragment-shader.py
+++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/fragment-shader.py
@@ -26,6 +26,7 @@
#
##########################################################################
+import struct
from gallium import *
@@ -146,6 +147,42 @@ def test(dev, name):
fs = Shader(file('frag-' + name + '.sh', 'rt').read())
ctx.set_fragment_shader(fs)
+ constbuf0 = dev.buffer_create(64,
+ (PIPE_BUFFER_USAGE_CONSTANT |
+ PIPE_BUFFER_USAGE_GPU_READ |
+ PIPE_BUFFER_USAGE_CPU_WRITE),
+ 4 * 4 * 4)
+
+ cbdata = ''
+ cbdata += struct.pack('4f', 0.4, 0.0, 0.0, 1.0)
+ cbdata += struct.pack('4f', 1.0, 1.0, 1.0, 1.0)
+ cbdata += struct.pack('4f', 2.0, 2.0, 2.0, 2.0)
+ cbdata += struct.pack('4f', 4.0, 8.0, 16.0, 32.0)
+
+ constbuf0.write(cbdata, 0)
+
+ ctx.set_constant_buffer(PIPE_SHADER_FRAGMENT,
+ 0,
+ constbuf0)
+
+ constbuf1 = dev.buffer_create(64,
+ (PIPE_BUFFER_USAGE_CONSTANT |
+ PIPE_BUFFER_USAGE_GPU_READ |
+ PIPE_BUFFER_USAGE_CPU_WRITE),
+ 4 * 4 * 4)
+
+ cbdata = ''
+ cbdata += struct.pack('4f', 0.1, 0.1, 0.1, 0.1)
+ cbdata += struct.pack('4f', 0.25, 0.25, 0.25, 0.25)
+ cbdata += struct.pack('4f', 0.5, 0.5, 0.5, 0.5)
+ cbdata += struct.pack('4f', 0.75, 0.75, 0.75, 0.75)
+
+ constbuf1.write(cbdata, 0)
+
+ ctx.set_constant_buffer(PIPE_SHADER_FRAGMENT,
+ 1,
+ constbuf1)
+
xy = [
-0.8, -0.8,
0.8, -0.8,
@@ -184,6 +221,8 @@ def main():
tests = [
'abs',
'add',
+ 'cb-1d',
+ 'cb-2d',
'dp3',
'dp4',
'dst',
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-cb-1d.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-cb-1d.sh
new file mode 100644
index 00000000000..b41fe5dd38f
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-cb-1d.sh
@@ -0,0 +1,16 @@
+VERT
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+DCL CONST[1]
+DCL CONST[3]
+DCL TEMP[0..1]
+
+MOV OUT[0], IN[0]
+ADD TEMP[0], IN[1], CONST[1]
+RCP TEMP[1], CONST[3].xxxx
+MUL OUT[1], TEMP[0], TEMP[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-cb-2d.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-cb-2d.sh
new file mode 100644
index 00000000000..45f5e6b7299
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-cb-2d.sh
@@ -0,0 +1,12 @@
+VERT
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+DCL CONST[1][1..2]
+
+MOV OUT[0], IN[0]
+MAD OUT[1], IN[1], CONST[1][2], CONST[1][1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py
index a185474fa39..2c44f872e1d 100644
--- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py
+++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py
@@ -27,6 +27,8 @@
##########################################################################
+import struct
+
from gallium import *
def make_image(surface):
@@ -143,6 +145,42 @@ def test(dev, name):
''')
ctx.set_fragment_shader(fs)
+ constbuf0 = dev.buffer_create(64,
+ (PIPE_BUFFER_USAGE_CONSTANT |
+ PIPE_BUFFER_USAGE_GPU_READ |
+ PIPE_BUFFER_USAGE_CPU_WRITE),
+ 4 * 4 * 4)
+
+ cbdata = ''
+ cbdata += struct.pack('4f', 0.4, 0.0, 0.0, 1.0)
+ cbdata += struct.pack('4f', 1.0, 1.0, 1.0, 1.0)
+ cbdata += struct.pack('4f', 2.0, 2.0, 2.0, 2.0)
+ cbdata += struct.pack('4f', 4.0, 8.0, 16.0, 32.0)
+
+ constbuf0.write(cbdata, 0)
+
+ ctx.set_constant_buffer(PIPE_SHADER_VERTEX,
+ 0,
+ constbuf0)
+
+ constbuf1 = dev.buffer_create(64,
+ (PIPE_BUFFER_USAGE_CONSTANT |
+ PIPE_BUFFER_USAGE_GPU_READ |
+ PIPE_BUFFER_USAGE_CPU_WRITE),
+ 4 * 4 * 4)
+
+ cbdata = ''
+ cbdata += struct.pack('4f', 0.1, 0.1, 0.1, 0.1)
+ cbdata += struct.pack('4f', 0.25, 0.25, 0.25, 0.25)
+ cbdata += struct.pack('4f', 0.5, 0.5, 0.5, 0.5)
+ cbdata += struct.pack('4f', 0.75, 0.75, 0.75, 0.75)
+
+ constbuf1.write(cbdata, 0)
+
+ ctx.set_constant_buffer(PIPE_SHADER_VERTEX,
+ 1,
+ constbuf1)
+
xy = [
0.0, 0.8,
-0.2, 0.4,
@@ -213,6 +251,8 @@ def main():
'add',
'arl',
'arr',
+ 'cb-1d',
+ 'cb-2d',
'dp3',
'dp4',
'dst',
diff --git a/src/gallium/state_trackers/vega/Makefile b/src/gallium/state_trackers/vega/Makefile
index fc97bf51f8f..037d8dc911a 100644
--- a/src/gallium/state_trackers/vega/Makefile
+++ b/src/gallium/state_trackers/vega/Makefile
@@ -1,8 +1,14 @@
-# src/mesa/Makefile
+# src/gallium/state_trackers/vega/Makefile
TOP = ../../../..
include $(TOP)/configs/current
-GALLIUM = $(TOP)
+
+VG_LIB = OpenVG
+VG_LIB_NAME = lib$(VG_LIB).so
+
+VG_MAJOR = 1
+VG_MINOR = 0
+VG_TINY = 0
### Lists of source files, included by Makefiles
@@ -34,88 +40,54 @@ VG_SOURCES = \
shader.c \
shaders_cache.c
+VG_OBJECTS = $(VG_SOURCES:.c=.o)
-### All the core C sources
-
-ALL_SOURCES = \
- $(VG_SOURCES)
-
-
-### Object files
-VG_OBJECTS = \
- $(VG_SOURCES:.c=.o)
+VG_LIBS = $(GALLIUM_AUXILIARIES) -lm
### Include directories
INCLUDE_DIRS = \
-I$(TOP)/include \
- -I$(GALLIUM)/include \
- -I$(GALLIUM)/src/gallium/include \
- -I$(GALLIUM)/src/gallium/auxiliary
+ -I$(TOP)/src/gallium/include \
+ -I$(TOP)/src/gallium/auxiliary
-VG_LIB = OpenVG
-VG_LIB_NAME = lib$(VG_LIB).so
-
-VG_MAJOR = 1
-VG_MINOR = 0
-VG_TINY = 0
-
-GALLIUM_LIBS = \
- $(GALLIUM)/src/gallium/auxiliary/libgallium.a
-
-.SUFFIXES : .cpp
.c.o:
- $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
+ $(CC) -c $(INCLUDE_DIRS) $(DEFINES) $(CFLAGS) $< -o $@
-.cpp.o:
- $(CXX) -c $(INCLUDE_DIRS) $(CXXFLAGS) $< -o $@
-
-.S.o:
- $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
-
-
-default: depend subdirs $(TOP)/$(LIB_DIR)/$(VG_LIB_NAME)
+default: depend $(TOP)/$(LIB_DIR)/$(VG_LIB_NAME)
# Make the OpenVG library
-$(TOP)/$(LIB_DIR)/$(VG_LIB_NAME): $(VG_OBJECTS) $(GALLIUM_LIBS)
- $(TOP)/bin/mklib -o $(VG_LIB) \
+$(TOP)/$(LIB_DIR)/$(VG_LIB_NAME): $(VG_OBJECTS) $(VG_LIBS)
+ $(MKLIB) -o $(VG_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-major $(VG_MAJOR) \
-minor $(VG_MINOR) \
-patch $(VG_TINY) \
-install $(TOP)/$(LIB_DIR) \
- $(VG_OBJECTS) $(GALLIUM_LIBS) \
- -Wl,--whole-archive $(LIBS) -Wl,--no-whole-archive $(SYS_LIBS)
+ $(VG_OBJECTS) $(VG_LIBS)
######################################################################
# Generic stuff
-depend: $(ALL_SOURCES)
+depend: $(VG_SOURCES)
@ echo "running $(MKDEP)"
@ rm -f depend # workaround oops on gutsy?!?
@ touch depend
- @ $(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) $(ALL_SOURCES) \
+ @ $(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) $(VG_SOURCES) \
> /dev/null 2>/dev/null
-
-subdirs:
-
install: default
- $(INSTALL) -d $(INSTALL_DIR)/include/VG
- $(INSTALL) -d $(INSTALL_DIR)/$(LIB_DIR)
- $(INSTALL) -m 644 $(TOP)/include/VG/*.h $(INSTALL_DIR)/include/VG
- @if [ -e $(TOP)/$(LIB_DIR)/$(VG_LIB_NAME) ]; then \
- $(INSTALL) $(TOP)/$(LIB_DIR)/libOpenVG* $(INSTALL_DIR)/$(LIB_DIR); \
- fi
+ $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/VG
+ $(INSTALL) -m 644 $(TOP)/include/VG/*.h $(DESTDIR)$(INSTALL_DIR)/include/VG
+ $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
+ $(MINSTALL) $(TOP)/$(LIB_DIR)/libOpenVG* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
# Emacs tags
tags:
etags `find . -name \*.[ch]` $(TOP)/include/VG/*.h
clean:
- -rm -f *.o
- -rm -f */*.o
- -rm -f */*/*.o
- -rm -f depend depend.bak
+ rm -f $(VG_OBJECTS)
+ rm -f depend depend.bak
-include depend
+sinclude depend
diff --git a/src/gallium/state_trackers/vega/shader.c b/src/gallium/state_trackers/vega/shader.c
index bd5ae79e551..8e59d53dc7a 100644
--- a/src/gallium/state_trackers/vega/shader.c
+++ b/src/gallium/state_trackers/vega/shader.c
@@ -135,8 +135,8 @@ static VGint blend_bind_samplers(struct vg_context *ctx,
textures[2] = stfb->blend_texture;
if (!samplers[0] || !textures[0]) {
- samplers[1] = samplers[2];
- textures[1] = textures[2];
+ samplers[0] = samplers[2];
+ textures[0] = textures[2];
}
if (!samplers[1] || !textures[1]) {
samplers[1] = samplers[0];
diff --git a/src/gallium/state_trackers/wgl/stw_pixelformat.c b/src/gallium/state_trackers/wgl/stw_pixelformat.c
index 54cc3614129..7d4c2430b0c 100644
--- a/src/gallium/state_trackers/wgl/stw_pixelformat.c
+++ b/src/gallium/state_trackers/wgl/stw_pixelformat.c
@@ -95,8 +95,6 @@ stw_pf_depth_stencil[] = {
{ PIPE_FORMAT_Z24X8_UNORM, {24, 0} },
{ PIPE_FORMAT_X8Z24_UNORM, {24, 0} },
{ PIPE_FORMAT_Z16_UNORM, {16, 0} },
- /* pure stencil */
- { PIPE_FORMAT_S8_UNORM, { 0, 8} },
/* combined depth-stencil */
{ PIPE_FORMAT_S8Z24_UNORM, {24, 8} },
{ PIPE_FORMAT_Z24S8_UNORM, {24, 8} }
@@ -220,7 +218,8 @@ stw_pixelformat_init( void )
const struct stw_pf_color_info *color = &stw_pf_color[j];
if(!screen->is_format_supported(screen, color->format, PIPE_TEXTURE_2D,
- PIPE_TEXTURE_USAGE_RENDER_TARGET, 0))
+ PIPE_TEXTURE_USAGE_RENDER_TARGET |
+ PIPE_TEXTURE_USAGE_DISPLAY_TARGET, 0))
continue;
for(k = 0; k < Elements(stw_pf_doublebuffer); ++k) {
diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c
index 66f83f566c5..c50873c1508 100644
--- a/src/gallium/state_trackers/xorg/xorg_composite.c
+++ b/src/gallium/state_trackers/xorg/xorg_composite.c
@@ -4,10 +4,7 @@
#include "xorg_exa_tgsi.h"
#include "cso_cache/cso_context.h"
-#include "util/u_draw_quad.h"
-#include "util/u_math.h"
-#include "pipe/p_inlines.h"
/*XXX also in Xrender.h but the including it here breaks compilition */
#define XFixedToDouble(f) (((double) (f)) / 65536.)
diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c
index 650d2c0d1db..2786558b767 100644
--- a/src/gallium/state_trackers/xorg/xorg_crtc.c
+++ b/src/gallium/state_trackers/xorg/xorg_crtc.c
@@ -50,7 +50,6 @@
#endif
#include "pipe/p_inlines.h"
-#include "util/u_format.h"
#include "util/u_rect.h"
#ifdef HAVE_LIBKMS
diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c
index fd82f4fa1d1..59588f0ff75 100644
--- a/src/gallium/state_trackers/xorg/xorg_dri2.c
+++ b/src/gallium/state_trackers/xorg/xorg_dri2.c
@@ -41,12 +41,14 @@
#include "pipe/p_inlines.h"
#include "util/u_format.h"
-#include "util/u_rect.h"
/* Make all the #if cases in the code esier to read */
-/* XXX can it be set to 1? */
#ifndef DRI2INFOREC_VERSION
-#define DRI2INFOREC_VERSION 0
+#define DRI2INFOREC_VERSION 1
+#endif
+
+#if DRI2INFOREC_VERSION == 2
+static Bool set_format_in_do_create_buffer;
#endif
typedef struct {
@@ -147,7 +149,9 @@ dri2_do_create_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer, unsigned int form
buffer->driverPrivate = private;
buffer->flags = 0; /* not tiled */
#if DRI2INFOREC_VERSION == 2
- ((DRI2Buffer2Ptr)buffer)->format = 0;
+ /* ABI forwards/backwards compatibility */
+ if (set_format_in_do_create_buffer)
+ ((DRI2Buffer2Ptr)buffer)->format = 0;
#elif DRI2INFOREC_VERSION >= 3
buffer->format = 0;
#endif
@@ -211,7 +215,9 @@ dri2_destroy_buffer(DrawablePtr pDraw, DRI2Buffer2Ptr buffer)
xfree(buffer);
}
-#else /* DRI2INFOREC_VERSION < 2 */
+#endif /* DRI2INFOREC_VERSION >= 2 */
+
+#if DRI2INFOREC_VERSION <= 2
static DRI2BufferPtr
dri2_create_buffers(DrawablePtr pDraw, unsigned int *attachments, int count)
@@ -261,7 +267,7 @@ dri2_destroy_buffers(DrawablePtr pDraw, DRI2BufferPtr buffers, int count)
}
}
-#endif /* DRI2INFOREC_VERSION >= 2 */
+#endif /* DRI2INFOREC_VERSION <= 2 */
static void
dri2_copy_region(DrawablePtr pDraw, RegionPtr pRegion,
@@ -369,12 +375,19 @@ xorg_dri2_init(ScreenPtr pScreen)
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
modesettingPtr ms = modesettingPTR(pScrn);
DRI2InfoRec dri2info;
-
#if DRI2INFOREC_VERSION >= 2
- dri2info.version = DRI2INFOREC_VERSION;
-#else
- dri2info.version = 1;
+ int major, minor;
+
+ if (xf86LoaderCheckSymbol("DRI2Version")) {
+ DRI2Version(&major, &minor);
+ } else {
+ /* Assume version 1.0 */
+ major = 1;
+ minor = 0;
+ }
#endif
+
+ dri2info.version = DRI2INFOREC_VERSION;
dri2info.fd = ms->fd;
dri2info.driverName = pScrn->driverName;
@@ -383,7 +396,22 @@ xorg_dri2_init(ScreenPtr pScreen)
#if DRI2INFOREC_VERSION >= 2
dri2info.CreateBuffer = dri2_create_buffer;
dri2info.DestroyBuffer = dri2_destroy_buffer;
-#else
+#endif
+
+ /* For X servers in the 1.6.x series there where two DRI2 version.
+ * This allows us to build one binary that works on both servers.
+ */
+#if DRI2INFOREC_VERSION == 2
+ if (minor == 0) {
+ set_format_in_do_create_buffer = FALSE;
+ dri2info.CreateBuffers = dri2_create_buffers;
+ dri2info.DestroyBuffers = dri2_destroy_buffers;
+ } else
+ set_format_in_do_create_buffer = FALSE;
+#endif
+
+ /* For version 1 set these unconditionaly. */
+#if DRI2INFOREC_VERSION == 1
dri2info.CreateBuffers = dri2_create_buffers;
dri2info.DestroyBuffers = dri2_destroy_buffers;
#endif
diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c
index b02fe68f313..e4ad789e9bc 100644
--- a/src/gallium/state_trackers/xorg/xorg_driver.c
+++ b/src/gallium/state_trackers/xorg/xorg_driver.c
@@ -45,7 +45,6 @@
#include "miscstruct.h"
#include "dixstruct.h"
#include "xf86xv.h"
-#include <X11/extensions/Xv.h>
#ifndef XSERVER_LIBPCIACCESS
#error "libpciaccess needed"
#endif
@@ -79,11 +78,13 @@ typedef enum
{
OPTION_SW_CURSOR,
OPTION_2D_ACCEL,
+ OPTION_DEBUG_FALLBACK,
} drv_option_enums;
static const OptionInfoRec drv_options[] = {
{OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE},
{OPTION_2D_ACCEL, "2DAccel", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_DEBUG_FALLBACK, "DebugFallback", OPTV_BOOLEAN, {0}, FALSE},
{-1, NULL, OPTV_NONE, {0}, FALSE}
};
@@ -111,6 +112,28 @@ xorg_tracker_set_functions(ScrnInfoPtr scrn)
scrn->ValidMode = drv_valid_mode;
}
+Bool
+xorg_tracker_have_modesetting(ScrnInfoPtr pScrn, struct pci_device *device)
+{
+ char *BusID = xalloc(64);
+ sprintf(BusID, "pci:%04x:%02x:%02x.%d",
+ device->domain, device->bus,
+ device->dev, device->func);
+
+ if (drmCheckModesettingSupported(BusID)) {
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 0,
+ "Drm modesetting not supported %s\n", BusID);
+ xfree(BusID);
+ return FALSE;
+ }
+
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 0,
+ "Drm modesetting supported on %s\n", BusID);
+
+ xfree(BusID);
+ return TRUE;
+}
+
/*
* Internal function definitions
@@ -206,16 +229,41 @@ drv_init_drm(ScrnInfoPtr pScrn)
ms->PciInfo->dev, ms->PciInfo->func
);
- ms->fd = drmOpen(NULL, BusID);
- if (ms->fd < 0)
- return FALSE;
+ ms->api = drm_api_create();
+ ms->fd = drmOpen(ms->api ? ms->api->driver_name : NULL, BusID);
+ xfree(BusID);
+
+ if (ms->fd >= 0)
+ return TRUE;
+
+ if (ms->api && ms->api->destroy)
+ ms->api->destroy(ms->api);
+
+ ms->api = NULL;
+
+ return FALSE;
}
return TRUE;
}
static Bool
+drv_close_drm(ScrnInfoPtr pScrn)
+{
+ modesettingPtr ms = modesettingPTR(pScrn);
+
+ if (ms->api && ms->api->destroy)
+ ms->api->destroy(ms->api);
+ ms->api = NULL;
+
+ drmClose(ms->fd);
+ ms->fd = -1;
+
+ return TRUE;
+}
+
+static Bool
drv_init_resource_management(ScrnInfoPtr pScrn)
{
modesettingPtr ms = modesettingPTR(pScrn);
@@ -229,7 +277,6 @@ drv_init_resource_management(ScrnInfoPtr pScrn)
if (ms->screen || ms->kms)
return TRUE;
- ms->api = drm_api_create();
if (ms->api) {
ms->screen = ms->api->create_screen(ms->api, ms->fd, NULL);
@@ -269,10 +316,6 @@ drv_close_resource_management(ScrnInfoPtr pScrn)
}
ms->screen = NULL;
- if (ms->api && ms->api->destroy)
- ms->api->destroy(ms->api);
- ms->api = NULL;
-
#ifdef HAVE_LIBKMS
if (ms->kms)
kms_destroy(&ms->kms);
@@ -629,10 +672,11 @@ drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
xf86SetBlackWhitePixels(pScreen);
+ ms->accelerate_2d = xf86ReturnOptValBool(ms->Options, OPTION_2D_ACCEL, FALSE);
+ ms->debug_fallback = xf86ReturnOptValBool(ms->Options, OPTION_DEBUG_FALLBACK, TRUE);
+
if (ms->screen) {
- ms->exa = xorg_exa_init(pScrn, xf86ReturnOptValBool(ms->Options,
- OPTION_2D_ACCEL, TRUE));
- ms->debug_fallback = debug_get_bool_option("XORG_DEBUG_FALLBACK", TRUE);
+ ms->exa = xorg_exa_init(pScrn, ms->accelerate_2d);
xorg_xv_init(pScreen);
#ifdef DRI2
@@ -640,6 +684,17 @@ drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
#endif
}
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "2D Acceleration is %s\n",
+ ms->screen && ms->accelerate_2d ? "enabled" : "disabled");
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Fallback debugging is %s\n",
+ ms->debug_fallback ? "enabled" : "disabled");
+#ifdef DRI2
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "3D Acceleration is %s\n",
+ ms->screen ? "enabled" : "disabled");
+#else
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "3D Acceleration is disabled\n");
+#endif
+
miInitializeBackingStore(pScreen);
xf86SetBackingStore(pScreen);
xf86SetSilkenMouse(pScreen);
@@ -823,8 +878,7 @@ drv_close_screen(int scrnIndex, ScreenPtr pScreen)
drv_close_resource_management(pScrn);
- drmClose(ms->fd);
- ms->fd = -1;
+ drv_close_drm(pScrn);
pScrn->vtSema = FALSE;
pScreen->CloseScreen = ms->CloseScreen;
@@ -1012,12 +1066,22 @@ drv_bind_front_buffer_kms(ScrnInfoPtr pScrn)
goto err_destroy;
pScreen->ModifyPixmapHeader(rootPixmap,
- pScreen->width,
- pScreen->height,
+ pScrn->virtualX,
+ pScrn->virtualY,
pScreen->rootDepth,
pScrn->bitsPerPixel,
stride,
ptr);
+
+ /* This a hack to work around EnableDisableFBAccess setting the pointer
+ * the real fix would be to replace pScrn->EnableDisableFBAccess hook
+ * and set the rootPixmap->devPrivate.ptr to something valid before that.
+ *
+ * But in its infinit visdome something uses either this some times before
+ * that, so our hook doesn't get called before the crash happens.
+ */
+ pScrn->pixmapPrivate.ptr = ptr;
+
return TRUE;
err_destroy:
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c
index d9432babf18..70af0c5fed3 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa.c
+++ b/src/gallium/state_trackers/xorg/xorg_exa.c
@@ -41,9 +41,7 @@
#include "pipe/p_format.h"
#include "pipe/p_context.h"
#include "pipe/p_state.h"
-#include "pipe/p_inlines.h"
-#include "util/u_format.h"
#include "util/u_rect.h"
#include "util/u_math.h"
#include "util/u_debug.h"
diff --git a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c
index bed17caab77..3e5e6bd6a6e 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c
+++ b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c
@@ -6,11 +6,9 @@
#include "pipe/p_format.h"
#include "pipe/p_context.h"
#include "pipe/p_state.h"
-#include "pipe/p_inlines.h"
#include "pipe/p_shader_tokens.h"
#include "util/u_memory.h"
-#include "util/u_simple_shaders.h"
#include "tgsi/tgsi_ureg.h"
diff --git a/src/gallium/state_trackers/xorg/xorg_output.c b/src/gallium/state_trackers/xorg/xorg_output.c
index 251f331ea7a..13c3fb97e3b 100644
--- a/src/gallium/state_trackers/xorg/xorg_output.c
+++ b/src/gallium/state_trackers/xorg/xorg_output.c
@@ -49,8 +49,6 @@
#include <X11/extensions/dpms.h>
#endif
-#include "X11/Xatom.h"
-
#include "xorg_tracker.h"
static char *output_enum_list[] = {
diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c
index 0b6600da6f5..a3c3993ab81 100644
--- a/src/gallium/state_trackers/xorg/xorg_renderer.c
+++ b/src/gallium/state_trackers/xorg/xorg_renderer.c
@@ -5,7 +5,6 @@
#include "cso_cache/cso_context.h"
#include "util/u_draw_quad.h"
-#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
#include "util/u_rect.h"
diff --git a/src/gallium/state_trackers/xorg/xorg_tracker.h b/src/gallium/state_trackers/xorg/xorg_tracker.h
index 4d5d4780dc4..a88b1d520dc 100644
--- a/src/gallium/state_trackers/xorg/xorg_tracker.h
+++ b/src/gallium/state_trackers/xorg/xorg_tracker.h
@@ -112,6 +112,7 @@ typedef struct _modesettingRec
/* exa */
struct exa_context *exa;
Bool noEvict;
+ Bool accelerate_2d;
Bool debug_fallback;
/* winsys hocks */
diff --git a/src/gallium/state_trackers/xorg/xorg_winsys.h b/src/gallium/state_trackers/xorg/xorg_winsys.h
index 47ee4b9ffd8..865733bca2b 100644
--- a/src/gallium/state_trackers/xorg/xorg_winsys.h
+++ b/src/gallium/state_trackers/xorg/xorg_winsys.h
@@ -45,5 +45,6 @@
void xorg_tracker_set_functions(ScrnInfoPtr scrn);
const OptionInfoRec * xorg_tracker_available_options(int chipid, int busid);
+Bool xorg_tracker_have_modesetting(ScrnInfoPtr pScrn, struct pci_device *device);
#endif
diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c
index 73c076fac43..3dcef22c132 100644
--- a/src/gallium/state_trackers/xorg/xorg_xv.c
+++ b/src/gallium/state_trackers/xorg/xorg_xv.c
@@ -11,9 +11,6 @@
#include "cso_cache/cso_context.h"
#include "pipe/p_screen.h"
-#include "pipe/p_inlines.h"
-
-#include "util/u_format.h"
/*XXX get these from pipe's texture limits */
#define IMAGE_MAX_WIDTH 2048
diff --git a/src/gallium/winsys/drm/Makefile.egl_g3d b/src/gallium/winsys/drm/Makefile.egl
index 3ce27258529..b1f20385502 100644
--- a/src/gallium/winsys/drm/Makefile.egl_g3d
+++ b/src/gallium/winsys/drm/Makefile.egl
@@ -1,4 +1,4 @@
-# src/gallium/winsys/drm/Makefile.egl_g3d
+# src/gallium/winsys/drm/Makefile.egl
# The driver Makefile should define
#
@@ -13,10 +13,10 @@ EGL_DRIVER_OBJECTS = $(EGL_DRIVER_SOURCES:.c=.o)
common_LIBS = -ldrm -lm -ldl
-x11_ST = $(TOP)/src/gallium/state_trackers/egl_g3d/libeglx11.a
+x11_ST = $(TOP)/src/gallium/state_trackers/egl/libeglx11.a
x11_LIBS = $(common_LIBS) -lX11 -lXext -lXfixes
-kms_ST = $(TOP)/src/gallium/state_trackers/egl_g3d/libeglkms.a
+kms_ST = $(TOP)/src/gallium/state_trackers/egl/libeglkms.a
kms_LIBS = $(common_LIBS)
##### RULES #####
@@ -29,17 +29,16 @@ kms_LIBS = $(common_LIBS)
EGL_DISPLAY_DRIVERS = $(foreach dpy, $(EGL_DISPLAYS), egl_$(dpy)_$(EGL_DRIVER_NAME).so)
-LIB_GALLIUM_DIR = $(TOP)/$(LIB_DIR)/gallium
-EGL_DISPLAY_LIBS = $(foreach drv, $(EGL_DISPLAY_DRIVERS), $(LIB_GALLIUM_DIR)/$(drv))
+EGL_DISPLAY_LIBS = $(foreach drv, $(EGL_DISPLAY_DRIVERS), $(TOP)/$(LIB_DIR)/$(drv))
default: $(EGL_DISPLAY_LIBS)
-$(EGL_DISPLAY_LIBS): $(LIB_GALLIUM_DIR)/%.so: %.so
- @mkdir -p $(LIB_GALLIUM_DIR)
- $(INSTALL) $^ $(LIB_GALLIUM_DIR)
+$(EGL_DISPLAY_LIBS): $(TOP)/$(LIB_DIR)/%.so: %.so
+ $(INSTALL) $< $(TOP)/$(LIB_DIR)
define mklib-egl
-$(MKLIB) -noprefix -o $@ $(EGL_DRIVER_OBJECTS) \
+$(MKLIB) -o $@ -noprefix -linker '$(CC)' -ldflags '$(LDFLAGS)' \
+ $(MKLIB_OPTIONS) $(EGL_DRIVER_OBJECTS) \
-Wl,--whole-archive $($(1)_ST) -Wl,--no-whole-archive \
$(EGL_DRIVER_PIPES) $(GALLIUM_AUXILIARIES) $($(1)_LIBS) $(EGL_DRIVER_LIBS)
endef
@@ -55,10 +54,9 @@ clean:
-rm -f $(EGL_DISPLAY_DRIVERS)
install: $(EGL_DISPLAY_LIBS)
- @$(INSTALL) -d $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR)
- @echo "Install $(EGL_DISPLAY_DRIVERS)"
- @for lib in "$(EGL_DISPLAY_LIBS)"; do \
- $(MINSTALL) -m 755 "$$lib" $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR); \
+ $(INSTALL) -d $(DESTDIR)$(EGL_DRIVER_INSTALL_DIR)
+ for lib in $(EGL_DISPLAY_LIBS); do \
+ $(MINSTALL) -m 755 "$$lib" $(DESTDIR)$(EGL_DRIVER_INSTALL_DIR); \
done
depend:
diff --git a/src/gallium/winsys/drm/Makefile.template b/src/gallium/winsys/drm/Makefile.template
index 9635c3c50e9..960353a73d9 100644
--- a/src/gallium/winsys/drm/Makefile.template
+++ b/src/gallium/winsys/drm/Makefile.template
@@ -82,18 +82,11 @@ SHARED_INCLUDES = \
default: depend symlinks $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME)
$(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(PIPE_DRIVERS) $(WINOBJ) Makefile $(TOP)/src/mesa/drivers/dri/Makefile.template
- $(MKLIB) -noprefix -o $@ \
+ $(MKLIB) -o $@ -noprefix -linker '$(CC)' -ldflags '$(LDFLAGS)' \
$(OBJECTS) $(PIPE_DRIVERS) \
-Wl,--start-group $(MESA_MODULES) -Wl,--end-group \
$(WINOBJ) $(DRI_LIB_DEPS) $(DRIVER_EXTRAS)
-$(LIBNAME_EGL): $(WINSYS_OBJECTS) $(LIBS)
- $(MKLIB) -o $(LIBNAME_EGL) \
- -linker "$(CC)" \
- -noprefix \
- $(OBJECTS) $(MKLIB_OPTIONS) $(WINSYS_OBJECTS) $(PIPE_DRIVERS) $(WINOBJ) $(DRI_LIB_DEPS) \
- --whole-archive $(LIBS) $(GALLIUM_AUXILIARIES) --no-whole-archive $(DRIVER_EXTRAS)
-
$(TOP)/$(LIB_DIR)/gallium:
mkdir -p $@
diff --git a/src/gallium/winsys/drm/i965/egl/Makefile b/src/gallium/winsys/drm/i965/egl/Makefile
index a1b32eb2a79..1c132582005 100644
--- a/src/gallium/winsys/drm/i965/egl/Makefile
+++ b/src/gallium/winsys/drm/i965/egl/Makefile
@@ -1,29 +1,14 @@
TOP = ../../../../../..
-GALLIUMDIR = ../../../..
include $(TOP)/configs/current
-LIBNAME = EGL_i965.so
+EGL_DRIVER_NAME = i965
+EGL_DRIVER_SOURCES = dummy.c
+EGL_DRIVER_LIBS = -ldrm_intel
-PIPE_DRIVERS = \
- $(TOP)/src/gallium/state_trackers/egl/libegldrm.a \
- $(GALLIUMDIR)/winsys/drm/i965/gem/libi965drm.a \
+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
-DRIVER_SOURCES =
-
-C_SOURCES = \
- $(COMMON_GALLIUM_SOURCES) \
- $(DRIVER_SOURCES)
-
-DRIVER_EXTRAS = -ldrm_intel
-
-ASM_SOURCES =
-
-DRIVER_DEFINES = -I../gem $(shell pkg-config libdrm --atleast-version=2.3.1 \
- && echo "-DDRM_VBLANK_FLIP=DRM_VBLANK_FLIP")
-
-include ../../Makefile.template
-
-symlinks:
+include ../../Makefile.egl
diff --git a/src/gallium/winsys/drm/i965/egl_g3d/dummy.c b/src/gallium/winsys/drm/i965/egl/dummy.c
index 4a1bc28b0b6..4a1bc28b0b6 100644
--- a/src/gallium/winsys/drm/i965/egl_g3d/dummy.c
+++ b/src/gallium/winsys/drm/i965/egl/dummy.c
diff --git a/src/gallium/winsys/drm/i965/egl_g3d/Makefile b/src/gallium/winsys/drm/i965/egl_g3d/Makefile
deleted file mode 100644
index dd2efe24855..00000000000
--- a/src/gallium/winsys/drm/i965/egl_g3d/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_g3d
diff --git a/src/gallium/winsys/drm/intel/egl/Makefile b/src/gallium/winsys/drm/intel/egl/Makefile
index c9c92b69b65..60d675ca73d 100644
--- a/src/gallium/winsys/drm/intel/egl/Makefile
+++ b/src/gallium/winsys/drm/intel/egl/Makefile
@@ -1,38 +1,14 @@
TOP = ../../../../../..
-GALLIUMDIR = ../../../..
include $(TOP)/configs/current
-LIBNAME = egl_i915.so
+EGL_DRIVER_NAME = i915
+EGL_DRIVER_SOURCES = dummy.c
+EGL_DRIVER_LIBS = -ldrm_intel
-PIPE_DRIVERS = \
- $(TOP)/src/gallium/state_trackers/egl/libegldrm.a \
- $(GALLIUMDIR)/winsys/drm/intel/gem/libinteldrm.a \
+EGL_DRIVER_PIPES = \
+ $(TOP)/src/gallium/winsys/drm/intel/gem/libinteldrm.a \
$(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
$(TOP)/src/gallium/drivers/trace/libtrace.a \
$(TOP)/src/gallium/drivers/i915/libi915.a
-DRIVER_EXTRAS = -lm -lpthread -ldrm_intel
-
-OBJECTS = dummy.o
-
-default: $(TOP)/$(LIB_DIR)/$(LIBNAME)
-
-$(TOP)/$(LIB_DIR)/$(LIBNAME): $(LIBNAME)
- @mkdir -p $(TOP)/$(LIB_DIR)
- $(INSTALL) $(LIBNAME) $(TOP)/$(LIB_DIR)
-
-$(LIBNAME): $(OBJECTS) $(GALLIUM_AUXILIARIES) $(PIPE_DRIVERS) Makefile
- $(MKLIB) -noprefix -o $@ $(OBJECTS) \
- -Wl,--whole-archive $(PIPE_DRIVERS) -Wl,--no-whole-archive \
- -Wl,--start-group $(GALLIUM_AUXILIARIES) -Wl,--end-group \
- $(DRI_LIB_DEPS) $(DRIVER_EXTRAS)
-
-clean:
- -rm -f *.o *.so *~
-
-depend:
-
-symlinks:
-
-install: $(LIBNAME)
- $(MINSTALL) -m 755 $(LIBNAME) $(INSTALL_DIR)/$(LIB_DIR)
+include ../../Makefile.egl
diff --git a/src/gallium/winsys/drm/intel/egl/dummy.c b/src/gallium/winsys/drm/intel/egl/dummy.c
index 58c7af84e0a..4a1bc28b0b6 100644
--- a/src/gallium/winsys/drm/intel/egl/dummy.c
+++ b/src/gallium/winsys/drm/intel/egl/dummy.c
@@ -1 +1 @@
-/* mklib expects at least one .o is given */
+/* mklib expects at least one object file */
diff --git a/src/gallium/winsys/drm/intel/egl_g3d/Makefile b/src/gallium/winsys/drm/intel/egl_g3d/Makefile
deleted file mode 100644
index cdbb680773c..00000000000
--- a/src/gallium/winsys/drm/intel/egl_g3d/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-TOP = ../../../../../..
-include $(TOP)/configs/current
-
-EGL_DRIVER_NAME = i915
-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/drivers/trace/libtrace.a \
- $(TOP)/src/gallium/drivers/i915/libi915.a
-
-include ../../Makefile.egl_g3d
diff --git a/src/gallium/winsys/drm/intel/gem/intel_drm_api.c b/src/gallium/winsys/drm/intel/gem/intel_drm_api.c
index 450ae09b345..8c8176e44ac 100644
--- a/src/gallium/winsys/drm/intel/gem/intel_drm_api.c
+++ b/src/gallium/winsys/drm/intel/gem/intel_drm_api.c
@@ -196,6 +196,7 @@ destroy(struct drm_api *api)
struct drm_api intel_drm_api =
{
.name = "i915",
+ .driver_name = "i915",
.create_context = intel_drm_create_context,
.create_screen = intel_drm_create_screen,
.texture_from_shared_handle = intel_drm_texture_from_shared_handle,
diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c
index 4b2c6a1025e..75cd1e2902b 100644
--- a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c
+++ b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c
@@ -54,6 +54,16 @@ static struct dri1_api nouveau_dri1_api = {
nouveau_dri1_front_surface,
};
+static void
+nouveau_drm_destroy_winsys(struct pipe_winsys *s)
+{
+ struct nouveau_winsys *nv_winsys = nouveau_winsys(s);
+ struct nouveau_screen *nv_screen= nouveau_screen(nv_winsys->pscreen);
+ nouveau_device_close(&nv_screen->device);
+ FREE(nv_winsys->pctx);
+ FREE(nv_winsys);
+}
+
static struct pipe_screen *
nouveau_drm_create_screen(struct drm_api *api, int fd,
struct drm_create_screen_arg *arg)
@@ -105,6 +115,7 @@ nouveau_drm_create_screen(struct drm_api *api, int fd,
return NULL;
}
ws = &nvws->base;
+ ws->destroy = nouveau_drm_destroy_winsys;
nvws->pscreen = init(ws, dev);
if (!nvws->pscreen) {
@@ -255,6 +266,7 @@ nouveau_drm_handle_from_pt(struct drm_api *api, struct pipe_screen *pscreen,
struct drm_api drm_api_hooks = {
.name = "nouveau",
+ .driver_name = "nouveau",
.create_screen = nouveau_drm_create_screen,
.create_context = nouveau_drm_create_context,
.texture_from_shared_handle = nouveau_drm_pt_from_name,
diff --git a/src/gallium/winsys/drm/nouveau/egl_g3d/Makefile b/src/gallium/winsys/drm/nouveau/egl/Makefile
index 865a5d56a97..8e812acc86b 100644
--- a/src/gallium/winsys/drm/nouveau/egl_g3d/Makefile
+++ b/src/gallium/winsys/drm/nouveau/egl/Makefile
@@ -16,4 +16,4 @@ EGL_DRIVER_PIPES = \
$(TOP)/src/gallium/drivers/nouveau/libnouveau.a \
$(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a
-include ../../Makefile.egl_g3d
+include ../../Makefile.egl
diff --git a/src/gallium/winsys/drm/intel/egl_g3d/dummy.c b/src/gallium/winsys/drm/nouveau/egl/dummy.c
index 4a1bc28b0b6..4a1bc28b0b6 100644
--- a/src/gallium/winsys/drm/intel/egl_g3d/dummy.c
+++ b/src/gallium/winsys/drm/nouveau/egl/dummy.c
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c
index b020ff38fa0..f484503e0e6 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c
+++ b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c
@@ -51,6 +51,26 @@ 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,
@@ -71,7 +91,7 @@ static struct pipe_buffer *radeon_buffer_create(struct pipe_winsys *ws,
radeon_buffer->base.usage = usage;
radeon_buffer->base.size = size;
- if (usage == PIPE_BUFFER_USAGE_CONSTANT && is_r3xx(radeon_ws->pci_id)) {
+ 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;
@@ -79,17 +99,7 @@ static struct pipe_buffer *radeon_buffer_create(struct pipe_winsys *ws,
return &radeon_buffer->base;
}
- domain = 0;
-
- 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;
- }
+ domain = radeon_domain_from_usage(usage);
radeon_buffer->bo = radeon_bo_open(radeon_ws->priv->bom, 0, size,
alignment, domain, 0);
@@ -202,6 +212,26 @@ static void radeon_buffer_unmap(struct pipe_winsys *ws,
}
}
+static void radeon_buffer_set_tiling(struct radeon_winsys *ws,
+ struct pipe_buffer *buffer,
+ uint32_t pitch,
+ boolean microtiled,
+ boolean macrotiled)
+{
+ struct radeon_pipe_buffer *radeon_buffer =
+ (struct radeon_pipe_buffer*)buffer;
+ uint32_t flags = 0;
+
+ if (microtiled) {
+ flags |= RADEON_BO_FLAGS_MICRO_TILE;
+ }
+ if (macrotiled) {
+ flags |= RADEON_BO_FLAGS_MACRO_TILE;
+ }
+
+ 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)
@@ -304,5 +334,7 @@ struct radeon_winsys* radeon_pipe_winsys(int fd)
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_drm.c b/src/gallium/winsys/drm/radeon/core/radeon_drm.c
index 9552f0ad6a9..bff6fdc1ad0 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_drm.c
+++ b/src/gallium/winsys/drm/radeon/core/radeon_drm.c
@@ -270,6 +270,7 @@ static boolean radeon_local_handle_from_texture(struct drm_api *api,
struct drm_api drm_api_hooks = {
.name = "radeon",
+ .driver_name = "radeon",
.create_screen = radeon_create_screen,
.create_context = radeon_create_context,
.texture_from_shared_handle = radeon_texture_from_shared_handle,
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm.h b/src/gallium/winsys/drm/radeon/core/radeon_drm.h
index ddd7983824a..077388ee028 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_drm.h
+++ b/src/gallium/winsys/drm/radeon/core/radeon_drm.h
@@ -81,7 +81,7 @@ void radeon_destroy_drm_api(struct drm_api* api);
/* Guess at whether this chipset should use r300g.
*
* I believe that this check is valid, but I haven't been exhaustive. */
-static boolean is_r3xx(int pciid)
+static INLINE boolean is_r3xx(int pciid)
{
return (pciid > 0x3150) && (pciid < 0x796f);
}
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c
index 0875ee41cbf..d759beaba13 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c
+++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c
@@ -81,9 +81,13 @@ static void radeon_write_cs_reloc(struct radeon_winsys* winsys,
uint32_t flags)
{
int retval = 0;
+ struct radeon_pipe_buffer* radeon_buffer =
+ (struct radeon_pipe_buffer*)pbuffer;
- retval = radeon_cs_write_reloc(winsys->priv->cs,
- ((struct radeon_pipe_buffer*)pbuffer)->bo, rd, wd, flags);
+ 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",
@@ -108,6 +112,11 @@ 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) {
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_winsys.h b/src/gallium/winsys/drm/radeon/core/radeon_winsys.h
index 9edc9e038c3..864082b99b3 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_winsys.h
+++ b/src/gallium/winsys/drm/radeon/core/radeon_winsys.h
@@ -100,6 +100,12 @@ struct radeon_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/egl/Makefile b/src/gallium/winsys/drm/radeon/egl/Makefile
index 2bd05a81750..cd4f9b20f06 100644
--- a/src/gallium/winsys/drm/radeon/egl/Makefile
+++ b/src/gallium/winsys/drm/radeon/egl/Makefile
@@ -1,38 +1,14 @@
TOP = ../../../../../..
-GALLIUMDIR = ../../../..
include $(TOP)/configs/current
-LIBNAME = egl_r300.so
+EGL_DRIVER_NAME = radeon
+EGL_DRIVER_SOURCES = dummy.c
+EGL_DRIVER_LIBS = -ldrm_radeon
-PIPE_DRIVERS = \
- $(TOP)/src/gallium/state_trackers/egl/libegldrm.a \
- $(GALLIUMDIR)/winsys/drm/radeon/core/libradeonwinsys.a \
+EGL_DRIVER_PIPES = \
+ $(TOP)/src/gallium/winsys/drm/radeon/core/libradeonwinsys.a \
$(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
$(TOP)/src/gallium/drivers/trace/libtrace.a \
$(TOP)/src/gallium/drivers/r300/libr300.a
-DRIVER_EXTRAS = -lm -lpthread -ldrm_radeon
-
-OBJECTS = dummy.o
-
-default: $(TOP)/$(LIB_DIR)/$(LIBNAME)
-
-$(TOP)/$(LIB_DIR)/$(LIBNAME): $(LIBNAME)
- @mkdir -p $(TOP)/$(LIB_DIR)
- $(INSTALL) $(LIBNAME) $(TOP)/$(LIB_DIR)
-
-$(LIBNAME): $(OBJECTS) $(GALLIUM_AUXILIARIES) $(PIPE_DRIVERS) Makefile
- $(MKLIB) -noprefix -o $@ $(OBJECTS) \
- -Wl,--whole-archive $(PIPE_DRIVERS) -Wl,--no-whole-archive \
- -Wl,--start-group $(GALLIUM_AUXILIARIES) -Wl,--end-group \
- $(DRI_LIB_DEPS) $(DRIVER_EXTRAS)
-
-clean:
- -rm -f *.o *.so *~
-
-depend:
-
-symlinks:
-
-install: $(LIBNAME)
- $(MINSTALL) -m 755 $(LIBNAME) $(INSTALL_DIR)/$(LIB_DIR)
+include ../../Makefile.egl
diff --git a/src/gallium/winsys/drm/radeon/egl/dummy.c b/src/gallium/winsys/drm/radeon/egl/dummy.c
index 58c7af84e0a..4a1bc28b0b6 100644
--- a/src/gallium/winsys/drm/radeon/egl/dummy.c
+++ b/src/gallium/winsys/drm/radeon/egl/dummy.c
@@ -1 +1 @@
-/* mklib expects at least one .o is given */
+/* mklib expects at least one object file */
diff --git a/src/gallium/winsys/drm/radeon/egl_g3d/Makefile b/src/gallium/winsys/drm/radeon/egl_g3d/Makefile
deleted file mode 100644
index 9027a5ff46d..00000000000
--- a/src/gallium/winsys/drm/radeon/egl_g3d/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-TOP = ../../../../../..
-include $(TOP)/configs/current
-
-EGL_DRIVER_NAME = r300
-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/drivers/trace/libtrace.a \
- $(TOP)/src/gallium/drivers/r300/libr300.a
-
-include ../../Makefile.egl_g3d
diff --git a/src/gallium/winsys/drm/swrast/Makefile b/src/gallium/winsys/drm/swrast/Makefile
new file mode 100644
index 00000000000..363b89584f2
--- /dev/null
+++ b/src/gallium/winsys/drm/swrast/Makefile
@@ -0,0 +1,12 @@
+# 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
new file mode 100644
index 00000000000..93931ae22b9
--- /dev/null
+++ b/src/gallium/winsys/drm/swrast/core/Makefile
@@ -0,0 +1,10 @@
+# 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/core/swrast_drm_api.c b/src/gallium/winsys/drm/swrast/core/swrast_drm_api.c
new file mode 100644
index 00000000000..8c9f80e2c15
--- /dev/null
+++ b/src/gallium/winsys/drm/swrast/core/swrast_drm_api.c
@@ -0,0 +1,13 @@
+#include "state_tracker/drm_api.h"
+
+static struct drm_api swrast_drm_api =
+{
+ .name = "swrast",
+};
+
+struct drm_api *
+drm_api_create()
+{
+ (void) swrast_drm_api;
+ return NULL;
+}
diff --git a/src/gallium/winsys/drm/swrast/egl/Makefile b/src/gallium/winsys/drm/swrast/egl/Makefile
new file mode 100644
index 00000000000..26fe2d2805a
--- /dev/null
+++ b/src/gallium/winsys/drm/swrast/egl/Makefile
@@ -0,0 +1,12 @@
+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/nouveau/egl_g3d/dummy.c b/src/gallium/winsys/drm/swrast/egl/dummy.c
index 4a1bc28b0b6..4a1bc28b0b6 100644
--- a/src/gallium/winsys/drm/nouveau/egl_g3d/dummy.c
+++ b/src/gallium/winsys/drm/swrast/egl/dummy.c
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_context.c b/src/gallium/winsys/drm/vmware/core/vmw_context.c
index b6997588de4..b5fd4f5a6a1 100644
--- a/src/gallium/winsys/drm/vmware/core/vmw_context.c
+++ b/src/gallium/winsys/drm/vmware/core/vmw_context.c
@@ -41,9 +41,18 @@
#define VMW_COMMAND_SIZE (64*1024)
#define VMW_SURFACE_RELOCS (1024)
+#define VMW_REGION_RELOCS (512)
#define VMW_MUST_FLUSH_STACK 8
+struct vmw_region_relocation
+{
+ struct SVGAGuestPtr *where;
+ struct pb_buffer *buffer;
+ /* TODO: put offset info inside where */
+ uint32 offset;
+};
+
struct vmw_svga_winsys_context
{
struct svga_winsys_context base;
@@ -69,10 +78,31 @@ struct vmw_svga_winsys_context
uint32_t staged;
uint32_t reserved;
} surface;
+
+ struct {
+ struct vmw_region_relocation relocs[VMW_REGION_RELOCS];
+ uint32_t size;
+ uint32_t used;
+ uint32_t staged;
+ uint32_t reserved;
+ } region;
struct pb_validate *validate;
uint32_t last_fence;
+
+ /**
+ * The amount of GMR that is referred by the commands currently batched
+ * in the context.
+ */
+ uint32_t seen_regions;
+
+ /**
+ * Whether this context should fail to reserve more commands, not because it
+ * ran out of command space, but because a substantial ammount of GMR was
+ * referred.
+ */
+ boolean preemptive_flush;
};
@@ -96,6 +126,19 @@ vmw_swc_flush(struct svga_winsys_context *swc,
ret = pb_validate_validate(vswc->validate);
assert(ret == PIPE_OK);
if(ret == PIPE_OK) {
+
+ /* Apply relocations */
+ for(i = 0; i < vswc->region.used; ++i) {
+ struct vmw_region_relocation *reloc = &vswc->region.relocs[i];
+ struct SVGAGuestPtr ptr;
+
+ if(!vmw_gmr_bufmgr_region_ptr(reloc->buffer, &ptr))
+ assert(0);
+
+ ptr.offset += reloc->offset;
+
+ *reloc->where = ptr;
+ }
if (vswc->command.used)
vmw_ioctl_command(vswc->vws,
@@ -121,9 +164,18 @@ vmw_swc_flush(struct svga_winsys_context *swc,
vswc->surface.used = 0;
vswc->surface.reserved = 0;
+ for(i = 0; i < vswc->region.used + vswc->region.staged; ++i) {
+ pb_reference(&vswc->region.relocs[i].buffer, NULL);
+ }
+
+ vswc->region.used = 0;
+ vswc->region.reserved = 0;
+
#ifdef DEBUG
vswc->must_flush = FALSE;
#endif
+ vswc->preemptive_flush = FALSE;
+ vswc->seen_regions = 0;
if(pfence)
*pfence = fence;
@@ -151,8 +203,10 @@ vmw_swc_reserve(struct svga_winsys_context *swc,
if(nr_bytes > vswc->command.size)
return NULL;
- if(vswc->command.used + nr_bytes > vswc->command.size ||
- vswc->surface.used + nr_relocs > vswc->surface.size) {
+ if(vswc->preemptive_flush ||
+ vswc->command.used + nr_bytes > vswc->command.size ||
+ vswc->surface.used + nr_relocs > vswc->surface.size ||
+ vswc->region.used + nr_relocs > vswc->region.size) {
#ifdef DEBUG
vswc->must_flush = TRUE;
debug_backtrace_capture(vswc->must_flush_stack, 1,
@@ -163,11 +217,14 @@ vmw_swc_reserve(struct svga_winsys_context *swc,
assert(vswc->command.used + nr_bytes <= vswc->command.size);
assert(vswc->surface.used + nr_relocs <= vswc->surface.size);
-
+ assert(vswc->region.used + nr_relocs <= vswc->region.size);
+
vswc->command.reserved = nr_bytes;
vswc->surface.reserved = nr_relocs;
vswc->surface.staged = 0;
-
+ vswc->region.reserved = nr_relocs;
+ vswc->region.staged = 0;
+
return vswc->command.buffer + vswc->command.used;
}
@@ -206,20 +263,41 @@ vmw_swc_region_relocation(struct svga_winsys_context *swc,
unsigned flags)
{
struct vmw_svga_winsys_context *vswc = vmw_svga_winsys_context(swc);
- struct SVGAGuestPtr ptr;
- struct pb_buffer *buf = vmw_pb_buffer(buffer);
+ struct vmw_region_relocation *reloc;
enum pipe_error ret;
+
+ assert(vswc->region.staged < vswc->region.reserved);
- if(!vmw_gmr_bufmgr_region_ptr(buf, &ptr))
- assert(0);
-
- ptr.offset += offset;
+ reloc = &vswc->region.relocs[vswc->region.used + vswc->region.staged];
+ reloc->where = where;
+ pb_reference(&reloc->buffer, vmw_pb_buffer(buffer));
+ reloc->offset = offset;
- *where = ptr;
+ ++vswc->region.staged;
- ret = pb_validate_add_buffer(vswc->validate, buf, flags);
+ ret = pb_validate_add_buffer(vswc->validate, reloc->buffer, flags);
/* TODO: Update pipebuffer to reserve buffers and not fail here */
assert(ret == PIPE_OK);
+
+ /*
+ * Flush preemptively the FIFO commands to keep the GMR working set within
+ * the GMR pool size.
+ *
+ * This is necessary for applications like SPECviewperf that generate huge
+ * amounts of immediate vertex data, so that we don't pile up too much of
+ * that vertex data neither in the guest nor in the host.
+ *
+ * Note that in the current implementation if a region is referred twice in
+ * a command stream, it will be accounted twice. We could detect repeated
+ * regions and count only once, but there is no incentive to do that, since
+ * regions are typically short-lived; always referred in a single command;
+ * and at the worst we just flush the commands a bit sooner, which for the
+ * SVGA virtual device it's not a performance issue since flushing commands
+ * to the FIFO won't cause flushing in the host.
+ */
+ vswc->seen_regions += reloc->buffer->base.size;
+ if(vswc->seen_regions >= VMW_GMR_POOL_SIZE/2)
+ vswc->preemptive_flush = TRUE;
}
@@ -238,6 +316,12 @@ vmw_swc_commit(struct svga_winsys_context *swc)
vswc->surface.used += vswc->surface.staged;
vswc->surface.staged = 0;
vswc->surface.reserved = 0;
+
+ assert(vswc->region.staged <= vswc->region.reserved);
+ assert(vswc->region.used + vswc->region.staged <= vswc->region.size);
+ vswc->region.used += vswc->region.staged;
+ vswc->region.staged = 0;
+ vswc->region.reserved = 0;
}
@@ -246,6 +330,11 @@ vmw_swc_destroy(struct svga_winsys_context *swc)
{
struct vmw_svga_winsys_context *vswc = vmw_svga_winsys_context(swc);
unsigned i;
+
+ for(i = 0; i < vswc->region.used; ++i) {
+ pb_reference(&vswc->region.relocs[i].buffer, NULL);
+ }
+
for(i = 0; i < vswc->surface.used; ++i) {
p_atomic_dec(&vswc->surface.handles[i]->validated);
vmw_svga_winsys_surface_reference(&vswc->surface.handles[i], NULL);
@@ -279,6 +368,7 @@ vmw_svga_winsys_context_create(struct svga_winsys_screen *sws)
vswc->command.size = VMW_COMMAND_SIZE;
vswc->surface.size = VMW_SURFACE_RELOCS;
+ vswc->region.size = VMW_REGION_RELOCS;
vswc->validate = pb_validate_create();
if(!vswc->validate) {
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_screen.h b/src/gallium/winsys/drm/vmware/core/vmw_screen.h
index a875107370c..f1d69865e77 100644
--- a/src/gallium/winsys/drm/vmware/core/vmw_screen.h
+++ b/src/gallium/winsys/drm/vmware/core/vmw_screen.h
@@ -40,6 +40,10 @@
#include "svga_winsys.h"
+
+#define VMW_GMR_POOL_SIZE (16*1024*1024)
+
+
struct pb_manager;
struct vmw_region;
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_screen_dri.c b/src/gallium/winsys/drm/vmware/core/vmw_screen_dri.c
index 4f5ccea4677..d9abde30793 100644
--- a/src/gallium/winsys/drm/vmware/core/vmw_screen_dri.c
+++ b/src/gallium/winsys/drm/vmware/core/vmw_screen_dri.c
@@ -85,6 +85,23 @@ vmw_drm_create_screen(struct drm_api *drm_api,
struct pipe_screen *screen;
struct dri1_create_screen_arg *dri1;
+ if (!arg || arg->mode == DRM_CREATE_NORMAL) {
+ struct dri1_api_version drm_ver;
+ drmVersionPtr ver;
+
+ ver = drmGetVersion(fd);
+ if (ver == NULL)
+ return NULL;
+
+ drm_ver.major = ver->version_major;
+ drm_ver.minor = ver->version_minor;
+
+ drmFreeVersion(ver);
+ if (!vmw_dri1_check_version(&drm_ver, &drm_required,
+ &drm_compat, "vmwgfx drm driver"))
+ return NULL;
+ }
+
if (arg != NULL) {
switch (arg->mode) {
case DRM_CREATE_NORMAL:
@@ -220,22 +237,19 @@ vmw_dri1_present_locked(struct pipe_context *locked_pipe,
vmw_svga_winsys_surface_reference(&vsrf, NULL);
}
-/**
- * FIXME: We'd probably want to cache these buffers in the
- * screen, based on handle.
- */
-
-static struct pipe_buffer *
-vmw_drm_buffer_from_handle(struct drm_api *drm_api,
- struct pipe_screen *screen,
- const char *name,
- unsigned handle)
+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)
{
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_buffer *buf;
+ struct pipe_texture *tex;
union drm_vmw_surface_reference_arg arg;
struct drm_vmw_surface_arg *req = &arg.req;
struct drm_vmw_surface_create_req *rep = &arg.rep;
@@ -282,43 +296,28 @@ vmw_drm_buffer_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;
ssrf = svga_winsys_surface(vsrf);
- buf = svga_screen_buffer_wrap_surface(screen, rep->format, ssrf);
- if (!buf)
+ tex = svga_screen_texture_wrap_surface(screen, templat, rep->format, ssrf);
+ if (!tex)
vmw_svga_winsys_surface_reference(&vsrf, NULL);
- return buf;
+ return tex;
out_mip:
vmw_ioctl_surface_destroy(vws, handle);
return NULL;
}
-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)
-{
- struct pipe_buffer *buffer;
- buffer = vmw_drm_buffer_from_handle(drm_api, screen, name, handle);
-
- if (!buffer)
- return NULL;
-
- return screen->texture_blanket(screen, templat, &stride, buffer);
-}
-
static boolean
-vmw_drm_handle_from_buffer(struct drm_api *drm_api,
+vmw_drm_handle_from_texture(struct drm_api *drm_api,
struct pipe_screen *screen,
- struct pipe_buffer *buffer,
+ struct pipe_texture *texture,
+ unsigned *stride,
unsigned *handle)
{
struct svga_winsys_surface *surface =
- svga_screen_buffer_get_winsys_surface(buffer);
+ svga_screen_texture_get_winsys_surface(texture);
struct vmw_svga_winsys_surface *vsrf;
if (!surface)
@@ -326,25 +325,13 @@ vmw_drm_handle_from_buffer(struct drm_api *drm_api,
vsrf = vmw_svga_winsys_surface(surface);
*handle = vsrf->sid;
+ *stride = util_format_get_nblocksx(texture->format, texture->width0) *
+ util_format_get_blocksize(texture->format);
+
vmw_svga_winsys_surface_reference(&vsrf, NULL);
return TRUE;
}
-static boolean
-vmw_drm_handle_from_texture(struct drm_api *drm_api,
- struct pipe_screen *screen,
- struct pipe_texture *texture,
- unsigned *stride,
- unsigned *handle)
-{
- struct pipe_buffer *buffer;
-
- if (!svga_screen_buffer_from_texture(texture, &buffer, stride))
- return FALSE;
-
- return vmw_drm_handle_from_buffer(drm_api, screen, buffer, handle);
-}
-
static struct pipe_context*
vmw_drm_create_context(struct drm_api *drm_api,
struct pipe_screen *screen)
@@ -359,6 +346,7 @@ static struct dri1_api dri1_api_hooks = {
static struct drm_api vmw_drm_api_hooks = {
.name = "vmwgfx",
+ .driver_name = "vmwgfx",
.create_screen = vmw_drm_create_screen,
.create_context = vmw_drm_create_context,
.texture_from_shared_handle = vmw_drm_texture_from_handle,
diff --git a/src/gallium/winsys/drm/vmware/core/vmw_screen_pools.c b/src/gallium/winsys/drm/vmware/core/vmw_screen_pools.c
index b1c24b0cb6a..b9823d78575 100644
--- a/src/gallium/winsys/drm/vmware/core/vmw_screen_pools.c
+++ b/src/gallium/winsys/drm/vmware/core/vmw_screen_pools.c
@@ -53,14 +53,32 @@ vmw_pools_init(struct vmw_winsys_screen *vws)
goto error;
vws->pools.gmr_mm = mm_bufmgr_create(vws->pools.gmr,
- 16*1024*1024,
+ VMW_GMR_POOL_SIZE,
12 /* 4096 alignment */);
if(!vws->pools.gmr_mm)
goto error;
+ /*
+ * GMR buffers are typically shortlived, but it's possible that at a given
+ * instance a buffer is mapped. So to avoid stalling we tell pipebuffer to
+ * forbid creation of buffers beyond half the GMR pool size,
+ *
+ * XXX: It is unclear weather we want to limit the total amount of temporary
+ * malloc memory used to backup unvalidated GMR buffers. On one hand it is
+ * preferrable to fail an allocation than exhausting the guest memory with
+ * temporary data, but on the other hand it is possible that a stupid
+ * application creates large vertex buffers and does not use them for a long
+ * time -- since the svga pipe driver only emits the DMA uploads when a
+ * buffer is used for drawing this would effectively disabling swapping GMR
+ * buffers to memory. So far, the preemptively flush already seems to keep
+ * total allocated memory within relatively small numbers, so we don't
+ * limit.
+ */
vws->pools.gmr_fenced = fenced_bufmgr_create(
vws->pools.gmr_mm,
- vmw_fence_ops_create(vws));
+ vmw_fence_ops_create(vws),
+ VMW_GMR_POOL_SIZE/2,
+ ~0);
#ifdef DEBUG
vws->pools.gmr_fenced = pb_debug_manager_create(vws->pools.gmr_fenced,
diff --git a/src/gallium/winsys/drm/vmware/egl/Makefile b/src/gallium/winsys/drm/vmware/egl/Makefile
index 8e2980c318c..a3e73131c35 100644
--- a/src/gallium/winsys/drm/vmware/egl/Makefile
+++ b/src/gallium/winsys/drm/vmware/egl/Makefile
@@ -1,18 +1,14 @@
-
TOP = ../../../../../..
include $(TOP)/configs/current
-LIBNAME = EGL_svga.so
+EGL_DRIVER_NAME = vmwgfx
+EGL_DRIVER_SOURCES = dummy.c
+EGL_DRIVER_LIBS =
-PIPE_DRIVERS = \
- $(TOP)/src/gallium/state_trackers/egl/libegldrm.a \
+EGL_DRIVER_PIPES = \
$(TOP)/src/gallium/winsys/drm/vmware/core/libsvgadrm.a \
+ $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
$(TOP)/src/gallium/drivers/trace/libtrace.a \
$(TOP)/src/gallium/drivers/svga/libsvga.a
-C_SOURCES = \
- $(COMMON_GALLIUM_SOURCES)
-
-include ../../Makefile.template
-
-symlinks:
+include ../../Makefile.egl
diff --git a/src/gallium/winsys/drm/radeon/egl_g3d/dummy.c b/src/gallium/winsys/drm/vmware/egl/dummy.c
index 4a1bc28b0b6..4a1bc28b0b6 100644
--- a/src/gallium/winsys/drm/radeon/egl_g3d/dummy.c
+++ b/src/gallium/winsys/drm/vmware/egl/dummy.c
diff --git a/src/gallium/winsys/drm/vmware/egl_g3d/Makefile b/src/gallium/winsys/drm/vmware/egl_g3d/Makefile
deleted file mode 100644
index 3cf79924e08..00000000000
--- a/src/gallium/winsys/drm/vmware/egl_g3d/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-TOP = ../../../../../..
-include $(TOP)/configs/current
-
-EGL_DRIVER_NAME = vmwgfx
-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/drivers/trace/libtrace.a \
- $(TOP)/src/gallium/drivers/svga/libsvga.a
-
-include ../../Makefile.egl_g3d
diff --git a/src/gallium/winsys/drm/vmware/egl_g3d/dummy.c b/src/gallium/winsys/drm/vmware/egl_g3d/dummy.c
deleted file mode 100644
index 4a1bc28b0b6..00000000000
--- a/src/gallium/winsys/drm/vmware/egl_g3d/dummy.c
+++ /dev/null
@@ -1 +0,0 @@
-/* mklib expects at least one object file */
diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_video.c b/src/gallium/winsys/drm/vmware/xorg/vmw_video.c
index b065b96346a..ff3b992d078 100644
--- a/src/gallium/winsys/drm/vmware/xorg/vmw_video.c
+++ b/src/gallium/winsys/drm/vmware/xorg/vmw_video.c
@@ -649,7 +649,8 @@ vmw_video_port_play(ScrnInfoPtr pScrn, struct vmw_video_port *port,
return XvBadAlloc;
}
- port->currBuf = ++port->currBuf & (VMWARE_VID_NUM_BUFFERS - 1);
+ if (++(port->currBuf) >= VMWARE_VID_NUM_BUFFERS)
+ port->currBuf = 0;
return Success;
}
diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_xorg.c b/src/gallium/winsys/drm/vmware/xorg/vmw_xorg.c
index 4b208719ca3..cd273d091fe 100644
--- a/src/gallium/winsys/drm/vmware/xorg/vmw_xorg.c
+++ b/src/gallium/winsys/drm/vmware/xorg/vmw_xorg.c
@@ -34,10 +34,10 @@
#include "vmw_hook.h"
static void vmw_xorg_identify(int flags);
-static Bool vmw_xorg_pci_probe(DriverPtr driver,
- int entity_num,
- struct pci_device *device,
- intptr_t match_data);
+_X_EXPORT Bool vmw_xorg_pci_probe(DriverPtr driver,
+ int entity_num,
+ struct pci_device *device,
+ intptr_t match_data);
static const struct pci_id_match vmw_xorg_device_match[] = {
{0x15ad, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0, 0},
@@ -126,7 +126,7 @@ vmw_xorg_identify(int flags)
vmw_xorg_chipsets);
}
-static Bool
+_X_EXPORT Bool
vmw_xorg_pci_probe(DriverPtr driver,
int entity_num, struct pci_device *device, intptr_t match_data)
{
diff --git a/src/gallium/winsys/egl_xlib/Makefile b/src/gallium/winsys/egl_xlib/Makefile
deleted file mode 100644
index 06c1fb0b913..00000000000
--- a/src/gallium/winsys/egl_xlib/Makefile
+++ /dev/null
@@ -1,84 +0,0 @@
-# src/gallium/winsys/egl_xlib/Makefile
-
-# Build softpipe/xlib/EGL driver library/object: "egl_softpipe.so"
-
-
-TOP = ../../../..
-include $(TOP)/configs/current
-
-
-DRIVER_NAME = egl_softpipe.so
-
-
-INCLUDE_DIRS = \
- -I$(TOP)/include \
- -I$(TOP)/src/egl/main \
- -I$(TOP)/src/mesa \
- -I$(TOP)/src/mesa/main \
- -I$(TOP)/src/gallium/include \
- -I$(TOP)/src/gallium/drivers \
- -I$(TOP)/src/gallium/auxiliary
-
-WINSYS_SOURCES = \
- egl_xlib.c \
- sw_winsys.c
-
-WINSYS_OBJECTS = $(WINSYS_SOURCES:.c=.o)
-
-
-LIBS = \
- $(GALLIUM_DRIVERS) \
- $(GALLIUM_AUXILIARIES)
-LIB_DEPS = $(EGL_LIB_DEPS) -lm -lX11
-
-LOCAL_CFLAGS =
-
-
-.c.o:
- $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $(LOCAL_CFLAGS) $< -o $@
-
-
-.PHONY: library
-
-
-default: depend library Makefile
-
-
-library: $(TOP)/$(LIB_DIR)/$(DRIVER_NAME)
-
-
-# Make the egl_softpipe.so library
-$(TOP)/$(LIB_DIR)/$(DRIVER_NAME): $(WINSYS_OBJECTS) $(LIBS)
- $(TOP)/bin/mklib -o $(DRIVER_NAME) \
- -linker "$(CC)" \
- -noprefix \
- -install $(TOP)/$(LIB_DIR) \
- $(MKLIB_OPTIONS) $(WINSYS_OBJECTS) \
- -Wl,--whole-archive $(LIBS) -Wl,--no-whole-archive \
- $(LIB_DEPS)
-
-
-depend: $(WINSYS_SOURCES)
- @ echo "running $(MKDEP)"
- @ rm -f depend # workaround oops on gutsy?!?
- @ touch depend
- @ $(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) $(WINSYS_SOURCES) \
- > /dev/null 2>/dev/null
-
-
-install: default
- $(INSTALL) -d $(INSTALL_DIR)/$(LIB_DIR)
- @if [ -e $(TOP)/$(LIB_DIR) ]; then \
- $(MINSTALL) $(TOP)/$(LIB_DIR)/$(DRIVER_NAME) $(INSTALL_DIR)/$(LIB_DIR); \
- fi
-
-
-# Emacs tags
-tags:
- etags `find . -name \*.[ch]` $(TOP)/include/GL/*.h
-
-clean:
- -rm -f *.o *~ *.bak
-
-
-include depend
diff --git a/src/gallium/winsys/egl_xlib/egl_xlib.c b/src/gallium/winsys/egl_xlib/egl_xlib.c
deleted file mode 100644
index 1d9bac3871c..00000000000
--- a/src/gallium/winsys/egl_xlib/egl_xlib.c
+++ /dev/null
@@ -1,853 +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.
- *
- **************************************************************************/
-
-/**
- * EGL / softpipe / xlib winsys module
- *
- * Authors: Brian Paul
- */
-
-
-#include <dlfcn.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-#include "pipe/p_compiler.h"
-#include "pipe/p_format.h"
-#include "pipe/p_state.h"
-#include "pipe/internal/p_winsys_screen.h"
-#include "util/u_memory.h"
-#include "util/u_math.h"
-#include "softpipe/sp_winsys.h"
-#include "softpipe/sp_texture.h"
-
-#include "eglconfig.h"
-#include "eglconfigutil.h"
-#include "eglcontext.h"
-#include "egldisplay.h"
-#include "egldriver.h"
-#include "eglglobals.h"
-#include "egllog.h"
-#include "eglsurface.h"
-
-#include "state_tracker/st_public.h"
-
-#include "sw_winsys.h"
-
-
-/** subclass of _EGLDriver */
-struct xlib_egl_driver
-{
- _EGLDriver Base; /**< base class */
- EGLint apis;
-};
-
-
-/** driver data of _EGLDisplay */
-struct xlib_egl_display
-{
- Display *Dpy;
-
- struct pipe_winsys *winsys;
- struct pipe_screen *screen;
-};
-
-
-/** subclass of _EGLContext */
-struct xlib_egl_context
-{
- _EGLContext Base; /**< base class */
-
- struct pipe_context *pipe; /**< Gallium driver context */
- struct st_context *Context; /**< Mesa/gallium state tracker context */
-};
-
-
-/** subclass of _EGLSurface */
-struct xlib_egl_surface
-{
- _EGLSurface Base; /**< base class */
-
- /* These are set for window surface */
- Display *Dpy; /**< The X Display of the window */
- Window Win; /**< The user-created window ID */
- GC Gc;
- XVisualInfo VisInfo;
-
- struct pipe_winsys *winsys;
-
- struct st_framebuffer *Framebuffer;
-};
-
-
-static void
-flush_frontbuffer(struct pipe_winsys *pws,
- struct pipe_surface *psurf,
- void *context_private);
-
-
-/** cast wrapper */
-static INLINE struct xlib_egl_driver *
-xlib_egl_driver(_EGLDriver *drv)
-{
- return (struct xlib_egl_driver *) drv;
-}
-
-
-static INLINE struct xlib_egl_display *
-xlib_egl_display(_EGLDisplay *dpy)
-{
- return (struct xlib_egl_display *) dpy->DriverData;
-}
-
-
-static INLINE struct xlib_egl_surface *
-lookup_surface(_EGLSurface *surf)
-{
- return (struct xlib_egl_surface *) surf;
-}
-
-
-static INLINE struct xlib_egl_context *
-lookup_context(_EGLContext *ctx)
-{
- return (struct xlib_egl_context *) ctx;
-}
-
-
-/**
- * Create the EGLConfigs. (one per X visual)
- */
-static void
-create_configs(struct xlib_egl_display *xdpy, _EGLDisplay *disp)
-{
- static const EGLint all_apis = (EGL_OPENGL_ES_BIT |
- EGL_OPENGL_ES2_BIT |
- EGL_OPENVG_BIT |
- EGL_OPENGL_BIT);
- XVisualInfo *visInfo, visTemplate;
- int num_visuals, i;
-
- /* get list of all X visuals, create an EGL config for each */
- visTemplate.screen = DefaultScreen(xdpy->Dpy);
- visInfo = XGetVisualInfo(xdpy->Dpy, VisualScreenMask,
- &visTemplate, &num_visuals);
- if (!visInfo) {
- printf("egl_xlib.c: couldn't get any X visuals\n");
- abort();
- }
-
- for (i = 0; i < num_visuals; i++) {
- _EGLConfig *config = calloc(1, sizeof(_EGLConfig));
- int id = i + 1;
- int rbits = util_bitcount(visInfo[i].red_mask);
- int gbits = util_bitcount(visInfo[i].green_mask);
- int bbits = util_bitcount(visInfo[i].blue_mask);
- int abits = bbits == 8 ? 8 : 0;
- int zbits = 24;
- int sbits = 8;
- int visid = visInfo[i].visualid;
-#if defined(__cplusplus) || defined(c_plusplus)
- int vistype = visInfo[i].c_class;
-#else
- int vistype = visInfo[i].class;
-#endif
-
- _eglInitConfig(config, id);
- SET_CONFIG_ATTRIB(config, EGL_BUFFER_SIZE, rbits + gbits + bbits + abits);
- SET_CONFIG_ATTRIB(config, EGL_RED_SIZE, rbits);
- SET_CONFIG_ATTRIB(config, EGL_GREEN_SIZE, gbits);
- SET_CONFIG_ATTRIB(config, EGL_BLUE_SIZE, bbits);
- SET_CONFIG_ATTRIB(config, EGL_ALPHA_SIZE, abits);
- SET_CONFIG_ATTRIB(config, EGL_DEPTH_SIZE, zbits);
- SET_CONFIG_ATTRIB(config, EGL_STENCIL_SIZE, sbits);
- SET_CONFIG_ATTRIB(config, EGL_NATIVE_VISUAL_ID, visid);
- SET_CONFIG_ATTRIB(config, EGL_NATIVE_VISUAL_TYPE, vistype);
- SET_CONFIG_ATTRIB(config, EGL_NATIVE_RENDERABLE, EGL_FALSE);
- SET_CONFIG_ATTRIB(config, EGL_CONFORMANT, all_apis);
- SET_CONFIG_ATTRIB(config, EGL_RENDERABLE_TYPE, all_apis);
- SET_CONFIG_ATTRIB(config, EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT);
- SET_CONFIG_ATTRIB(config, EGL_BIND_TO_TEXTURE_RGBA, EGL_TRUE);
- SET_CONFIG_ATTRIB(config, EGL_BIND_TO_TEXTURE_RGB, EGL_TRUE);
-
- _eglAddConfig(disp, config);
- }
-
- XFree(visInfo);
-}
-
-
-/**
- * Called via eglInitialize(), drv->API.Initialize().
- */
-static EGLBoolean
-xlib_eglInitialize(_EGLDriver *drv, _EGLDisplay *dpy,
- EGLint *major, EGLint *minor)
-{
- struct xlib_egl_driver *xdrv = xlib_egl_driver(drv);
- struct xlib_egl_display *xdpy;
-
- xdpy = CALLOC_STRUCT(xlib_egl_display);
- if (!xdpy)
- return _eglError(EGL_BAD_ALLOC, "eglInitialize");
-
- xdpy->Dpy = (Display *) dpy->NativeDisplay;
- if (!xdpy->Dpy) {
- xdpy->Dpy = XOpenDisplay(NULL);
- if (!xdpy->Dpy) {
- free(xdpy);
- return EGL_FALSE;
- }
- }
-
- /* create winsys and pipe screen */
- xdpy->winsys = create_sw_winsys();
- if (!xdpy->winsys) {
- free(xdpy);
- return _eglError(EGL_BAD_ALLOC, "eglInitialize");
- }
- xdpy->winsys->flush_frontbuffer = flush_frontbuffer;
- xdpy->screen = softpipe_create_screen(xdpy->winsys);
- if (!xdpy->screen) {
- free(xdpy->winsys);
- free(xdpy);
- return _eglError(EGL_BAD_ALLOC, "eglInitialize");
- }
-
- dpy->DriverData = (void *) xdpy;
- dpy->ClientAPIsMask = xdrv->apis;
-
- create_configs(xdpy, dpy);
-
- /* we're supporting EGL 1.4 */
- *major = 1;
- *minor = 4;
-
- return EGL_TRUE;
-}
-
-
-/**
- * Called via eglTerminate(), drv->API.Terminate().
- */
-static EGLBoolean
-xlib_eglTerminate(_EGLDriver *drv, _EGLDisplay *dpy)
-{
- struct xlib_egl_display *xdpy = xlib_egl_display(dpy);
-
- _eglReleaseDisplayResources(drv, dpy);
- _eglCleanupDisplay(dpy);
-
- xdpy->screen->destroy(xdpy->screen);
- free(xdpy->winsys);
-
- if (!dpy->NativeDisplay)
- XCloseDisplay(xdpy->Dpy);
- free(xdpy);
-
- return EGL_TRUE;
-}
-
-
-static _EGLProc
-xlib_eglGetProcAddress(_EGLDriver *drv, const char *procname)
-{
- return (_EGLProc) st_get_proc_address(procname);
-}
-
-
-static void
-get_drawable_visual_info(Display *dpy, Drawable d, XVisualInfo *visInfo)
-{
- XWindowAttributes attr;
- XVisualInfo visTemp, *vis;
- int num_visuals;
-
- XGetWindowAttributes(dpy, d, &attr);
-
- visTemp.screen = DefaultScreen(dpy);
- visTemp.visualid = attr.visual->visualid;
- vis = XGetVisualInfo(dpy,
- (VisualScreenMask | VisualIDMask),
- &visTemp, &num_visuals);
- if (vis)
- *visInfo = *vis;
-
- XFree(vis);
-}
-
-
-
-/** Get size of given window */
-static Status
-get_drawable_size(Display *dpy, Drawable d, uint *width, uint *height)
-{
- Window root;
- Status stat;
- int xpos, ypos;
- unsigned int w, h, bw, depth;
- stat = XGetGeometry(dpy, d, &root, &xpos, &ypos, &w, &h, &bw, &depth);
- *width = w;
- *height = h;
- return stat;
-}
-
-
-static void
-check_and_update_buffer_size(struct xlib_egl_surface *surface)
-{
- uint width, height;
- if (surface->Base.Type == EGL_PBUFFER_BIT) {
- width = surface->Base.Width;
- height = surface->Base.Height;
- }
- else {
- get_drawable_size(surface->Dpy, surface->Win, &width, &height);
- }
- st_resize_framebuffer(surface->Framebuffer, width, height);
- surface->Base.Width = width;
- surface->Base.Height = height;
-}
-
-
-
-static void
-display_surface(struct pipe_winsys *pws,
- struct pipe_surface *psurf,
- struct xlib_egl_surface *xsurf)
-{
- struct softpipe_texture *spt = softpipe_texture(psurf->texture);
- XImage *ximage;
- void *data;
-
- if (xsurf->Base.Type == EGL_PBUFFER_BIT)
- return;
-
- ximage = XCreateImage(xsurf->Dpy,
- xsurf->VisInfo.visual,
- xsurf->VisInfo.depth,
- ZPixmap, 0, /* format, offset */
- NULL, /* data */
- 0, 0, /* size */
- 32, /* bitmap_pad */
- 0); /* bytes_per_line */
-
-
- assert(ximage->format);
- assert(ximage->bitmap_unit);
-
- data = pws->buffer_map(pws, spt->buffer, 0);
-
- /* update XImage's fields */
- ximage->data = data;
- ximage->width = psurf->width;
- ximage->height = psurf->height;
- ximage->bytes_per_line = spt->stride[psurf->level];
-
- XPutImage(xsurf->Dpy, xsurf->Win, xsurf->Gc,
- ximage, 0, 0, 0, 0, psurf->width, psurf->height);
-
- XSync(xsurf->Dpy, 0);
-
- ximage->data = NULL;
- XDestroyImage(ximage);
-
- pws->buffer_unmap(pws, spt->buffer);
-}
-
-
-
-/** Display gallium surface in X window */
-static void
-flush_frontbuffer(struct pipe_winsys *pws,
- struct pipe_surface *psurf,
- void *context_private)
-{
- struct xlib_egl_surface *xsurf = (struct xlib_egl_surface *) context_private;
- display_surface(pws, psurf, xsurf);
-}
-
-
-
-/**
- * Called via eglCreateContext(), drv->API.CreateContext().
- */
-static _EGLContext *
-xlib_eglCreateContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
- _EGLContext *share_list, const EGLint *attrib_list)
-{
- struct xlib_egl_display *xdpy = xlib_egl_display(dpy);
- struct xlib_egl_context *ctx;
- struct st_context *share_ctx = NULL; /* XXX fix */
- __GLcontextModes visual;
-
- ctx = CALLOC_STRUCT(xlib_egl_context);
- if (!ctx)
- return NULL;
-
- /* let EGL lib init the common stuff */
- if (!_eglInitContext(drv, &ctx->Base, conf, attrib_list)) {
- free(ctx);
- return NULL;
- }
-
- /* API-dependent context creation */
- switch (ctx->Base.ClientAPI) {
- case EGL_OPENVG_API:
- case EGL_OPENGL_ES_API:
- _eglLog(_EGL_DEBUG, "Create Context for ES version %d\n",
- ctx->Base.ClientVersion);
- /* fall-through */
- case EGL_OPENGL_API:
- /* create a softpipe context */
- ctx->pipe = softpipe_create(xdpy->screen);
- /* Now do xlib / state tracker inits here */
- _eglConfigToContextModesRec(conf, &visual);
- ctx->Context = st_create_context(ctx->pipe, &visual, share_ctx);
- break;
- default:
- _eglError(EGL_BAD_MATCH, "eglCreateContext(unsupported API)");
- free(ctx);
- return NULL;
- }
-
- return &ctx->Base;
-}
-
-
-static EGLBoolean
-xlib_eglDestroyContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx)
-{
- struct xlib_egl_context *context = lookup_context(ctx);
-
- if (!_eglIsContextBound(&context->Base)) {
- /* API-dependent clean-up */
- switch (context->Base.ClientAPI) {
- case EGL_OPENGL_ES_API:
- case EGL_OPENVG_API:
- /* fall-through */
- case EGL_OPENGL_API:
- st_destroy_context(context->Context);
- break;
- default:
- assert(0);
- }
- free(context);
- }
- return EGL_TRUE;
-}
-
-
-/**
- * Called via eglMakeCurrent(), drv->API.MakeCurrent().
- */
-static EGLBoolean
-xlib_eglMakeCurrent(_EGLDriver *drv, _EGLDisplay *dpy,
- _EGLSurface *draw, _EGLSurface *read, _EGLContext *ctx)
-{
- struct xlib_egl_context *context = lookup_context(ctx);
- struct xlib_egl_surface *draw_surf = lookup_surface(draw);
- struct xlib_egl_surface *read_surf = lookup_surface(read);
- struct st_context *oldcontext = NULL;
- _EGLContext *oldctx;
-
- oldctx = _eglGetCurrentContext();
- if (oldctx && _eglIsContextLinked(oldctx))
- oldcontext = st_get_current();
-
- if (!_eglMakeCurrent(drv, dpy, draw, read, ctx))
- return EGL_FALSE;
-
- /* Flush before switching context. Check client API? */
- if (oldcontext)
- st_flush(oldcontext, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, NULL);
- st_make_current((context ? context->Context : NULL),
- (draw_surf ? draw_surf->Framebuffer : NULL),
- (read_surf ? read_surf->Framebuffer : NULL));
-
- if (draw_surf)
- check_and_update_buffer_size(draw_surf);
- if (read_surf && read_surf != draw_surf)
- check_and_update_buffer_size(draw_surf);
-
- return EGL_TRUE;
-}
-
-
-static enum pipe_format
-choose_color_format(const __GLcontextModes *visual)
-{
- if (visual->redBits == 8 &&
- visual->greenBits == 8 &&
- visual->blueBits == 8 &&
- visual->alphaBits == 8) {
- /* XXX this really also depends on the ordering of R,G,B,A */
- return PIPE_FORMAT_A8R8G8B8_UNORM;
- }
- else {
- assert(0);
- return PIPE_FORMAT_NONE;
- }
-}
-
-
-static enum pipe_format
-choose_depth_format(const __GLcontextModes *visual)
-{
- if (visual->depthBits > 0)
- return PIPE_FORMAT_S8Z24_UNORM;
- else
- return PIPE_FORMAT_NONE;
-}
-
-
-static enum pipe_format
-choose_stencil_format(const __GLcontextModes *visual)
-{
- if (visual->stencilBits > 0)
- return PIPE_FORMAT_S8Z24_UNORM;
- else
- return PIPE_FORMAT_NONE;
-}
-
-
-/**
- * Called via eglCreateWindowSurface(), drv->API.CreateWindowSurface().
- */
-static _EGLSurface *
-xlib_eglCreateWindowSurface(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
- NativeWindowType window, const EGLint *attrib_list)
-{
- struct xlib_egl_display *xdpy = xlib_egl_display(disp);
- struct xlib_egl_surface *surf;
- __GLcontextModes visual;
- uint width, height;
-
- surf = CALLOC_STRUCT(xlib_egl_surface);
- if (!surf)
- return NULL;
-
- /* Let EGL lib init the common stuff */
- if (!_eglInitSurface(drv, &surf->Base, EGL_WINDOW_BIT,
- conf, attrib_list)) {
- free(surf);
- return NULL;
- }
-
- /*
- * Now init the Xlib and gallium stuff
- */
- surf->Win = (Window) window; /* The X window ID */
- surf->Dpy = xdpy->Dpy; /* The X display */
- surf->Gc = XCreateGC(surf->Dpy, surf->Win, 0, NULL);
-
- surf->winsys = xdpy->winsys;
-
- _eglConfigToContextModesRec(conf, &visual);
- get_drawable_size(surf->Dpy, surf->Win, &width, &height);
- get_drawable_visual_info(surf->Dpy, surf->Win, &surf->VisInfo);
-
- surf->Base.Width = width;
- surf->Base.Height = height;
-
- /* Create GL statetracker framebuffer */
- surf->Framebuffer = st_create_framebuffer(&visual,
- choose_color_format(&visual),
- choose_depth_format(&visual),
- choose_stencil_format(&visual),
- width, height,
- (void *) surf);
-
- st_resize_framebuffer(surf->Framebuffer, width, height);
-
- return &surf->Base;
-}
-
-
-static _EGLSurface *
-xlib_eglCreatePbufferSurface(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
- const EGLint *attrib_list)
-{
- struct xlib_egl_display *xdpy = xlib_egl_display(disp);
- struct xlib_egl_surface *surf;
- __GLcontextModes visual;
- uint width, height;
- EGLBoolean bind_texture;
-
- surf = CALLOC_STRUCT(xlib_egl_surface);
- if (!surf) {
- _eglError(EGL_BAD_ALLOC, "eglCreatePbufferSurface");
- return NULL;
- }
-
- if (!_eglInitSurface(drv, &surf->Base, EGL_PBUFFER_BIT,
- conf, attrib_list)) {
- free(surf);
- return NULL;
- }
- if (surf->Base.Width < 0 || surf->Base.Height < 0) {
- _eglError(EGL_BAD_PARAMETER, "eglCreatePbufferSurface");
- free(surf);
- return NULL;
- }
-
- bind_texture = (surf->Base.TextureFormat != EGL_NO_TEXTURE);
- width = (uint) surf->Base.Width;
- height = (uint) surf->Base.Height;
- if ((surf->Base.TextureTarget == EGL_NO_TEXTURE && bind_texture) ||
- (surf->Base.TextureTarget != EGL_NO_TEXTURE && !bind_texture)) {
- _eglError(EGL_BAD_MATCH, "eglCreatePbufferSurface");
- free(surf);
- return NULL;
- }
- /* a framebuffer of zero width or height confuses st */
- if (width == 0 || height == 0) {
- _eglError(EGL_BAD_MATCH, "eglCreatePbufferSurface");
- free(surf);
- return NULL;
- }
- /* no mipmap generation */
- if (surf->Base.MipmapTexture) {
- _eglError(EGL_BAD_MATCH, "eglCreatePbufferSurface");
- free(surf);
- return NULL;
- }
-
- surf->winsys = xdpy->winsys;
-
- _eglConfigToContextModesRec(conf, &visual);
-
- /* Create GL statetracker framebuffer */
- surf->Framebuffer = st_create_framebuffer(&visual,
- choose_color_format(&visual),
- choose_depth_format(&visual),
- choose_stencil_format(&visual),
- width, height,
- (void *) surf);
- st_resize_framebuffer(surf->Framebuffer, width, height);
-
- return &surf->Base;
-}
-
-
-static EGLBoolean
-xlib_eglDestroySurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface)
-{
- struct xlib_egl_surface *surf = lookup_surface(surface);
- if (!_eglIsSurfaceBound(&surf->Base)) {
- if (surf->Base.Type != EGL_PBUFFER_BIT)
- XFreeGC(surf->Dpy, surf->Gc);
- st_unreference_framebuffer(surf->Framebuffer);
- free(surf);
- }
- return EGL_TRUE;
-}
-
-
-static EGLBoolean
-xlib_eglBindTexImage(_EGLDriver *drv, _EGLDisplay *dpy,
- _EGLSurface *surface, EGLint buffer)
-{
- struct xlib_egl_surface *xsurf = lookup_surface(surface);
- struct xlib_egl_context *xctx;
- struct pipe_surface *psurf;
- enum pipe_format format;
- int target;
-
- if (!xsurf || xsurf->Base.Type != EGL_PBUFFER_BIT)
- return _eglError(EGL_BAD_SURFACE, "eglBindTexImage");
- if (buffer != EGL_BACK_BUFFER)
- return _eglError(EGL_BAD_PARAMETER, "eglBindTexImage");
- if (xsurf->Base.BoundToTexture)
- return _eglError(EGL_BAD_ACCESS, "eglBindTexImage");
-
- /* this should be updated when choose_color_format is */
- switch (xsurf->Base.TextureFormat) {
- case EGL_TEXTURE_RGB:
- format = PIPE_FORMAT_R8G8B8_UNORM;
- break;
- case EGL_TEXTURE_RGBA:
- format = PIPE_FORMAT_A8R8G8B8_UNORM;
- break;
- default:
- return _eglError(EGL_BAD_MATCH, "eglBindTexImage");
- }
-
- switch (xsurf->Base.TextureTarget) {
- case EGL_TEXTURE_2D:
- target = ST_TEXTURE_2D;
- break;
- default:
- return _eglError(EGL_BAD_MATCH, "eglBindTexImage");
- }
-
- /* flush properly */
- if (eglGetCurrentSurface(EGL_DRAW) == surface) {
- xctx = lookup_context(_eglGetCurrentContext());
- st_flush(xctx->Context, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME,
- NULL);
- }
- else if (_eglIsSurfaceBound(&xsurf->Base)) {
- xctx = lookup_context(xsurf->Base.Binding);
- if (xctx)
- st_finish(xctx->Context);
- }
-
- st_get_framebuffer_surface(xsurf->Framebuffer, ST_SURFACE_BACK_LEFT,
- &psurf);
- st_bind_texture_surface(psurf, target, xsurf->Base.MipmapLevel, format);
- xsurf->Base.BoundToTexture = EGL_TRUE;
-
- return EGL_TRUE;
-}
-
-
-static EGLBoolean
-xlib_eglReleaseTexImage(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface,
- EGLint buffer)
-{
- struct xlib_egl_surface *xsurf = lookup_surface(surface);
- struct pipe_surface *psurf;
-
- if (!xsurf || xsurf->Base.Type != EGL_PBUFFER_BIT ||
- !xsurf->Base.BoundToTexture)
- return _eglError(EGL_BAD_SURFACE, "eglReleaseTexImage");
- if (buffer != EGL_BACK_BUFFER)
- return _eglError(EGL_BAD_PARAMETER, "eglReleaseTexImage");
-
- st_get_framebuffer_surface(xsurf->Framebuffer, ST_SURFACE_BACK_LEFT,
- &psurf);
- st_unbind_texture_surface(psurf, ST_TEXTURE_2D, xsurf->Base.MipmapLevel);
- xsurf->Base.BoundToTexture = EGL_FALSE;
-
- return EGL_TRUE;
-}
-
-
-static EGLBoolean
-xlib_eglSwapBuffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw)
-{
- struct xlib_egl_surface *xsurf = lookup_surface(draw);
- struct pipe_winsys *pws = xsurf->winsys;
- struct pipe_surface *psurf;
-
- st_get_framebuffer_surface(xsurf->Framebuffer, ST_SURFACE_BACK_LEFT,
- &psurf);
-
- st_notify_swapbuffers(xsurf->Framebuffer);
-
- display_surface(pws, psurf, xsurf);
-
- check_and_update_buffer_size(xsurf);
-
- return EGL_TRUE;
-}
-
-
-/**
- * Determine which API(s) is(are) present by looking for some specific
- * global symbols.
- */
-static EGLint
-find_supported_apis(void)
-{
- EGLint mask = 0;
- void *handle;
-
- handle = dlopen(NULL, RTLD_LAZY | RTLD_LOCAL);
- if(!handle)
- return mask;
-
- if (dlsym(handle, "st_api_OpenGL_ES1"))
- mask |= EGL_OPENGL_ES_BIT;
-
- if (dlsym(handle, "st_api_OpenGL_ES2"))
- mask |= EGL_OPENGL_ES2_BIT;
-
- if (dlsym(handle, "st_api_OpenGL"))
- mask |= EGL_OPENGL_BIT;
-
- if (dlsym(handle, "st_api_OpenVG"))
- mask |= EGL_OPENVG_BIT;
-
- dlclose(handle);
-
- return mask;
-}
-
-
-static void
-xlib_Unload(_EGLDriver *drv)
-{
- struct xlib_egl_driver *xdrv = xlib_egl_driver(drv);
- free(xdrv);
-}
-
-
-/**
- * This is the main entrypoint into the driver.
- * Called by libEGL to instantiate an _EGLDriver object.
- */
-_EGLDriver *
-_eglMain(const char *args)
-{
- struct xlib_egl_driver *xdrv;
-
- _eglLog(_EGL_INFO, "Entering EGL/Xlib _eglMain(%s)", args);
-
- xdrv = CALLOC_STRUCT(xlib_egl_driver);
- if (!xdrv)
- return NULL;
-
- _eglInitDriverFallbacks(&xdrv->Base);
- xdrv->Base.API.Initialize = xlib_eglInitialize;
- xdrv->Base.API.Terminate = xlib_eglTerminate;
- xdrv->Base.API.GetProcAddress = xlib_eglGetProcAddress;
- xdrv->Base.API.CreateContext = xlib_eglCreateContext;
- xdrv->Base.API.DestroyContext = xlib_eglDestroyContext;
- xdrv->Base.API.CreateWindowSurface = xlib_eglCreateWindowSurface;
- xdrv->Base.API.CreatePbufferSurface = xlib_eglCreatePbufferSurface;
- xdrv->Base.API.DestroySurface = xlib_eglDestroySurface;
- xdrv->Base.API.BindTexImage = xlib_eglBindTexImage;
- xdrv->Base.API.ReleaseTexImage = xlib_eglReleaseTexImage;
- xdrv->Base.API.MakeCurrent = xlib_eglMakeCurrent;
- xdrv->Base.API.SwapBuffers = xlib_eglSwapBuffers;
-
- xdrv->apis = find_supported_apis();
- if (xdrv->apis == 0x0) {
- /* the app isn't directly linked with any EGL-supprted APIs
- * (such as libGLESv2.so) so use an EGL utility to see what
- * APIs might be loaded dynamically on this system.
- */
- xdrv->apis = _eglFindAPIs();
- }
-
- xdrv->Base.Name = "Xlib/softpipe";
- xdrv->Base.Unload = xlib_Unload;
-
- return &xdrv->Base;
-}
diff --git a/src/gallium/winsys/egl_xlib/sw_winsys.c b/src/gallium/winsys/egl_xlib/sw_winsys.c
deleted file mode 100644
index 6ee3ede38cb..00000000000
--- a/src/gallium/winsys/egl_xlib/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 "pipe/internal/p_winsys_screen.h"
-#include "pipe/p_state.h"
-#include "pipe/p_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/winsys/egl_xlib/sw_winsys.h b/src/gallium/winsys/egl_xlib/sw_winsys.h
deleted file mode 100644
index f96c5a14b0a..00000000000
--- a/src/gallium/winsys/egl_xlib/sw_winsys.h
+++ /dev/null
@@ -1,40 +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.
- *
- **************************************************************************/
-
-
-#ifndef SW_WINSYS_H
-#define SW_WINSYS_H
-
-
-struct pipe_winsys;
-
-
-extern struct pipe_winsys *
-create_sw_winsys(void);
-
-
-#endif /* SW_WINSYS_H */
diff --git a/src/gallium/winsys/xlib/xlib.c b/src/gallium/winsys/xlib/xlib.c
index 541ea7ae352..67617a470d6 100644
--- a/src/gallium/winsys/xlib/xlib.c
+++ b/src/gallium/winsys/xlib/xlib.c
@@ -116,7 +116,8 @@ extern void (*linker_foo(const unsigned char *procName))()
#define GL_GLEXT_PROTOTYPES
#include "GL/gl.h"
#include "glapi/glapi.h"
-#include "glapi/dispatch.h"
+#include "glapi/glapitable.h"
+#include "glapi/glapidispatch.h"
#if defined(USE_MGL_NAMESPACE)
#define NAME(func) mgl##func
diff --git a/src/gallium/winsys/xlib/xlib_softpipe.c b/src/gallium/winsys/xlib/xlib_softpipe.c
index f7c0099584e..bf78aca6869 100644
--- a/src/gallium/winsys/xlib/xlib_softpipe.c
+++ b/src/gallium/winsys/xlib/xlib_softpipe.c
@@ -63,7 +63,7 @@ struct xm_buffer
XImage *tempImage;
#ifdef USE_XSHM
- int shm;
+ boolean shm; /** Is this a shared memory buffer? */
XShmSegmentInfo shminfo;
#endif
};
@@ -152,7 +152,7 @@ alloc_shm_ximage(struct xm_buffer *b, struct xmesa_buffer *xmb,
&b->shminfo,
width, height);
if (b->tempImage == NULL) {
- b->shm = 0;
+ b->shm = FALSE;
return;
}
@@ -169,12 +169,12 @@ alloc_shm_ximage(struct xm_buffer *b, struct xmesa_buffer *xmb,
mesaXErrorFlag = 0;
XDestroyImage(b->tempImage);
b->tempImage = NULL;
- b->shm = 0;
+ b->shm = FALSE;
(void) XSetErrorHandler(old_handler);
return;
}
- b->shm = 1;
+ b->shm = TRUE;
}
#endif /* USE_XSHM */
@@ -204,6 +204,14 @@ 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) {
@@ -213,12 +221,20 @@ xm_buffer_destroy(struct pipe_buffer *buf)
oldBuf->shminfo.shmid = -1;
oldBuf->shminfo.shmaddr = (char *) -1;
}
- else
+
+ if (oldBuf->shm) {
+ oldBuf->data = NULL;
+ }
+
+ if (oldBuf->tempImage) {
+ XDestroyImage(oldBuf->tempImage);
+ oldBuf->tempImage = NULL;
+ }
#endif
- {
- if (!oldBuf->userBuffer) {
- align_free(oldBuf->data);
- }
+
+ if (oldBuf->data && !oldBuf->userBuffer) {
+ /* this was regular malloc'd memory */
+ align_free(oldBuf->data);
}
oldBuf->data = NULL;
@@ -327,10 +343,8 @@ xm_buffer_create(struct pipe_winsys *pws,
buffer->base.usage = usage;
buffer->base.size = size;
- if (buffer->data == NULL) {
- /* align to 16-byte multiple for Cell */
- buffer->data = align_malloc(size, max(alignment, 16));
- }
+ /* align to 16-byte multiple for Cell */
+ buffer->data = align_malloc(size, max(alignment, 16));
return &buffer->base;
}
diff --git a/src/glew/SConscript b/src/glew/SConscript
index ce6e71e1570..45375e083a5 100644
--- a/src/glew/SConscript
+++ b/src/glew/SConscript
@@ -52,6 +52,9 @@ prog_env = env.Clone()
prog_env.Prepend(LIBS = [glew])
+if prog_env['platform'] == 'darwin':
+ prog_env.Append(FRAMEWORKS = ['AGL'])
+
prog_env.Program(
target = 'glewinfo',
source = ['glewinfo.c'],
diff --git a/src/glsl/pp/sl_pp_purify.c b/src/glsl/pp/sl_pp_purify.c
index b50f8192517..acc000cf3dd 100644
--- a/src/glsl/pp/sl_pp_purify.c
+++ b/src/glsl/pp/sl_pp_purify.c
@@ -140,7 +140,7 @@ sl_pp_purify_state_init(struct sl_pp_purify_state *state,
}
-unsigned int
+static unsigned int
_purify_comment(struct sl_pp_purify_state *state,
char *output,
unsigned int *current_line,
diff --git a/src/glx/x11/Makefile b/src/glx/x11/Makefile
index 86d84d4b9ff..e681be834f0 100644
--- a/src/glx/x11/Makefile
+++ b/src/glx/x11/Makefile
@@ -1,7 +1,7 @@
TOP = ../../..
include $(TOP)/configs/current
-EXTRA_DEFINES = -DXF86VIDMODE -D_REENTRANT -UIN_DRI_DRIVER \
+EXTRA_DEFINES = -DXF86VIDMODE -D_REENTRANT \
-DDEFAULT_DRIVER_DIR=\"$(DRI_DRIVER_SEARCH_DIR)\"
SOURCES = \
@@ -39,13 +39,9 @@ SOURCES = \
dri2_glx.c \
dri2.c
-include $(TOP)/src/mesa/sources.mak
+GLAPI_LIB = $(TOP)/src/mesa/libglapi.a
-MESA_GLAPI_ASM_SOURCES = $(addprefix $(TOP)/src/mesa/, $(GLAPI_ASM_SOURCES))
-MESA_GLAPI_SOURCES = $(addprefix $(TOP)/src/mesa/, $(GLAPI_SOURCES))
-MESA_GLAPI_OBJECTS = $(addprefix $(TOP)/src/mesa/, $(GLAPI_OBJECTS))
-
-OBJECTS = $(SOURCES:.c=.o) $(MESA_GLAPI_OBJECTS)
+OBJECTS = $(SOURCES:.c=.o)
INCLUDES = -I. \
-I$(TOP)/include \
@@ -70,18 +66,19 @@ INCLUDES = -I. \
default: depend $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
# Make libGL
-$(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(OBJECTS) Makefile
+$(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(OBJECTS) $(GLAPI_LIB) Makefile
$(MKLIB) -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-major 1 -minor 2 $(MKLIB_OPTIONS) \
-install $(TOP)/$(LIB_DIR) -id $(INSTALL_LIB_DIR)/lib$(GL_LIB).1.dylib \
- $(GL_LIB_DEPS) $(OBJECTS)
+ $(GL_LIB_DEPS) $(OBJECTS) $(GLAPI_LIB)
+$(GLAPI_LIB):
+ @$(MAKE) -C $(TOP)/src/mesa libglapi.a
-depend: $(SOURCES) $(MESA_GLAPI_SOURCES) $(MESA_GLAPI_ASM_SOURCES) Makefile
+depend: $(SOURCES) Makefile
rm -f depend
touch depend
- $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(SOURCES) \
- $(MESA_GLAPI_SOURCES) $(MESA_GLAPI_ASM_SOURCES)
+ $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(SOURCES)
# Emacs tags
diff --git a/src/glx/x11/dri2.c b/src/glx/x11/dri2.c
index 2cb5d3463af..832935a3ba0 100644
--- a/src/glx/x11/dri2.c
+++ b/src/glx/x11/dri2.c
@@ -81,12 +81,15 @@ static XEXT_GENERATE_FIND_DISPLAY (DRI2FindDisplay,
dri2Info,
dri2ExtensionName,
&dri2ExtensionHooks,
- 0, NULL)
+ 1, NULL)
static Bool
DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire)
{
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+ XExtDisplayInfo *glx_info = __glXFindDisplay(dpy);
+ static int glx_event_base;
+ static Bool found_glx_info = False;
XextCheckExtension(dpy, info, dri2ExtensionName, False);
@@ -95,21 +98,26 @@ DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire)
{
GLXBufferSwapComplete *aevent = (GLXBufferSwapComplete *)event;
xDRI2BufferSwapComplete *awire = (xDRI2BufferSwapComplete *)wire;
- switch (awire->type) {
+ aevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *) wire);
+ aevent->type =
+ (glx_info->codes->first_event + GLX_BufferSwapComplete) & 0x75;
+ aevent->send_event = (awire->type & 0x80) != 0;
+ aevent->display = dpy;
+ aevent->drawable = awire->drawable;
+ switch (awire->event_type) {
case DRI2_EXCHANGE_COMPLETE:
- aevent->event_type = GLX_EXCHANGE_COMPLETE;
+ aevent->event_type = GLX_EXCHANGE_COMPLETE_INTEL;
break;
case DRI2_BLIT_COMPLETE:
- aevent->event_type = GLX_BLIT_COMPLETE;
+ aevent->event_type = GLX_BLIT_COMPLETE_INTEL;
break;
case DRI2_FLIP_COMPLETE:
- aevent->event_type = GLX_FLIP_COMPLETE;
+ aevent->event_type = GLX_FLIP_COMPLETE_INTEL;
break;
default:
/* unknown swap completion type */
return False;
}
- aevent->drawable = awire->drawable;
aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo;
aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo;
aevent->sbc = ((CARD64)awire->sbc_hi << 32) | awire->sbc_lo;
diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h
index ded4f5a434a..e0b286b6883 100644
--- a/src/glx/x11/glxclient.h
+++ b/src/glx/x11/glxclient.h
@@ -41,6 +41,7 @@
#define NEED_EVENTS
#include <X11/Xproto.h>
#include <X11/Xlibint.h>
+#include <X11/extensions/extutil.h>
#define GLX_GLXEXT_PROTOTYPES
#include <GL/glx.h>
#include <GL/glxext.h>
@@ -793,6 +794,10 @@ extern GLboolean __glXGetMscRateOML(Display * dpy, GLXDrawable drawable,
GLboolean
__driGetMscRateOML(__DRIdrawable * draw,
int32_t * numerator, int32_t * denominator, void *private);
+
+/* So that dri2.c:DRI2WireToEvent() can access
+ * glx_info->codes->first_event */
+XExtDisplayInfo *__glXFindDisplay (Display *dpy);
#endif
#endif /* !__GLX_client_h__ */
diff --git a/src/glx/x11/glxcurrent.c b/src/glx/x11/glxcurrent.c
index fae1bd9fa62..50de7d612b8 100644
--- a/src/glx/x11/glxcurrent.c
+++ b/src/glx/x11/glxcurrent.c
@@ -162,6 +162,7 @@ __glXSetCurrentContextNull(void)
__glXSetCurrentContext(&dummyContext);
#ifdef GLX_DIRECT_RENDERING
_glapi_set_dispatch(NULL); /* no-op functions */
+ _glapi_set_context(NULL);
#endif
}
diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c
index fe65216c411..09bb8503196 100644
--- a/src/glx/x11/glxext.c
+++ b/src/glx/x11/glxext.c
@@ -120,7 +120,6 @@ static /* const */ XExtensionHooks __glXExtensionHooks = {
__glXErrorString, /* error_string */
};
-static
XEXT_GENERATE_FIND_DISPLAY(__glXFindDisplay, __glXExtensionInfo,
__glXExtensionName, &__glXExtensionHooks,
__GLX_NUMBER_EVENTS, NULL)
@@ -194,11 +193,11 @@ __glXEventToWire(Display *dpy, XEvent *event, xEvent *wire)
break;
case GLX_SAVED:
break;
- case GLX_EXCHANGE_COMPLETE:
+ case GLX_EXCHANGE_COMPLETE_INTEL:
break;
- case GLX_BLIT_COMPLETE:
+ case GLX_BLIT_COMPLETE_INTEL:
break;
- case GLX_FLIP_COMPLETE:
+ case GLX_FLIP_COMPLETE_INTEL:
break;
default:
/* client doesn't support server event */
diff --git a/src/glx/x11/indirect.c b/src/glx/x11/indirect.c
index 262637a9473..48bae1478f4 100644
--- a/src/glx/x11/indirect.c
+++ b/src/glx/x11/indirect.c
@@ -30,7 +30,8 @@
#include "indirect.h"
#include "glxclient.h"
#include "indirect_size.h"
-#include "dispatch.h"
+#include "glapitable.h"
+#include "glapidispatch.h"
#include "glapi.h"
#include "glthread.h"
#include <GL/glxproto.h>
diff --git a/src/glx/x11/indirect_size.c b/src/glx/x11/indirect_size.c
index f8541b5758b..6356ddd49b5 100644
--- a/src/glx/x11/indirect_size.c
+++ b/src/glx/x11/indirect_size.c
@@ -73,6 +73,7 @@ __glCallLists_size(GLenum e)
case GL_SHORT:
case GL_UNSIGNED_SHORT:
case GL_2_BYTES:
+ case GL_HALF_FLOAT:
return 2;
case GL_3_BYTES:
return 3;
diff --git a/src/glx/x11/single2.c b/src/glx/x11/single2.c
index d128ba20537..9ecf589ffff 100644
--- a/src/glx/x11/single2.c
+++ b/src/glx/x11/single2.c
@@ -35,7 +35,8 @@
#include "glxextensions.h"
#include "indirect.h"
#include "indirect_vertex_array.h"
-#include "dispatch.h"
+#include "glapitable.h"
+#include "glapidispatch.h"
#include "glapi.h"
#ifdef USE_XCB
#include <xcb/xcb.h>
diff --git a/src/glx/x11/singlepix.c b/src/glx/x11/singlepix.c
index fa12ac3bbcb..f5ebf4dfdbf 100644
--- a/src/glx/x11/singlepix.c
+++ b/src/glx/x11/singlepix.c
@@ -30,7 +30,8 @@
#include "packsingle.h"
#include "indirect.h"
-#include "dispatch.h"
+#include "glapitable.h"
+#include "glapidispatch.h"
#include "glapi.h"
#include "glthread.h"
#include "glapioffsets.h"
diff --git a/src/mesa/SConscript b/src/mesa/SConscript
index bdcfffed4ba..ea5bad2825a 100644
--- a/src/mesa/SConscript
+++ b/src/mesa/SConscript
@@ -251,6 +251,7 @@ if env['platform'] != 'winddk':
'main/dispatch.c',
'glapi/glapi.c',
'glapi/glapi_getproc.c',
+ 'glapi/glapi_nop.c',
'glapi/glthread.c',
]
diff --git a/src/mesa/drivers/dri/common/spantmp2.h b/src/mesa/drivers/dri/common/spantmp2.h
index 447f3d15b95..c1522269022 100644
--- a/src/mesa/drivers/dri/common/spantmp2.h
+++ b/src/mesa/drivers/dri/common/spantmp2.h
@@ -400,7 +400,7 @@
# define READ_RGBA( rgba, _x, _y ) \
do { \
GLuint p = GET_VALUE(_x, _y); \
- *((uint32_t *) rgba) = (t << 8) | 0xff; \
+ *((uint32_t *) rgba) = (p << 8) | 0xff; \
} while (0)
# else
# define READ_RGBA( rgba, _x, _y ) \
diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c
index b272eb74eaf..81d026a697c 100644
--- a/src/mesa/drivers/dri/common/utils.c
+++ b/src/mesa/drivers/dri/common/utils.c
@@ -34,7 +34,6 @@
#include "main/mtypes.h"
#include "main/cpuinfo.h"
#include "main/extensions.h"
-#include "glapi/dispatch.h"
#include "utils.h"
diff --git a/src/mesa/drivers/dri/fb/Makefile b/src/mesa/drivers/dri/fb/Makefile
index cf9b3a85563..848e2041e27 100644
--- a/src/mesa/drivers/dri/fb/Makefile
+++ b/src/mesa/drivers/dri/fb/Makefile
@@ -5,9 +5,6 @@ include $(TOP)/configs/current
LIBNAME = fb_dri.so
-ifeq ($(USING_EGL), 1)
-EGL_SOURCES = server/radeon_egl.c
-endif
DRIVER_SOURCES = \
fb_dri.c \
diff --git a/src/mesa/drivers/dri/fb/fb_egl.c b/src/mesa/drivers/dri/fb/fb_egl.c
deleted file mode 100644
index 02e44bb8eed..00000000000
--- a/src/mesa/drivers/dri/fb/fb_egl.c
+++ /dev/null
@@ -1,881 +0,0 @@
-/*
- * Test egl driver for fb_dri.so
- */
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <dirent.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <linux/fb.h>
-
-#include "utils.h"
-#include "buffers.h"
-#include "main/extensions.h"
-#include "main/framebuffer.h"
-#include "main/renderbuffer.h"
-#include "vbo/vbo.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/tnl.h"
-#include "tnl/tcontext.h"
-#include "tnl/t_pipeline.h"
-#include "drivers/common/driverfuncs.h"
-#include "drirenderbuffer.h"
-
-#include "eglconfig.h"
-#include "eglmain/context.h"
-#include "egldisplay.h"
-#include "egldriver.h"
-#include "eglglobals.h"
-#include "eglmode.h"
-#include "eglscreen.h"
-#include "eglsurface.h"
-
-extern void
-fbSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis);
-
-/**
- * fb driver-specific driver class derived from _EGLDriver
- */
-typedef struct fb_driver
-{
- _EGLDriver Base; /* base class/object */
- GLuint fbStuff;
-} fbDriver;
-
-/**
- * fb display-specific driver class derived from _EGLDisplay
- */
-typedef struct fb_display
-{
- _EGLDisplay Base; /* base class/object */
- void *pFB;
-} fbDisplay;
-
-/**
- * fb driver-specific screen class derived from _EGLScreen
- */
-typedef struct fb_screen
-{
- _EGLScreen Base;
- char fb[NAME_MAX];
-} fbScreen;
-
-
-/**
- * fb driver-specific surface class derived from _EGLSurface
- */
-typedef struct fb_surface
-{
- _EGLSurface Base; /* base class/object */
- struct gl_framebuffer *mesa_framebuffer;
-} fbSurface;
-
-
-/**
- * fb driver-specific context class derived from _EGLContext
- */
-typedef struct fb_context
-{
- _EGLContext Base; /* base class/object */
- GLcontext *glCtx;
- struct {
- __DRIcontext *context;
- __DRIscreen *screen;
- __DRIdrawable *drawable; /* drawable bound to this ctx */
- } dri;
-} fbContext, *fbContextPtr;
-
-#define FB_CONTEXT(ctx) ((fbContextPtr)(ctx->DriverCtx))
-
-
-static EGLBoolean
-fbFillInConfigs(_EGLDisplay *disp, unsigned pixel_bits, unsigned depth_bits,
- unsigned stencil_bits, GLboolean have_back_buffer) {
- _EGLConfig *configs;
- _EGLConfig *c;
- unsigned int i, num_configs;
- unsigned int depth_buffer_factor;
- unsigned int back_buffer_factor;
- GLenum fb_format;
- GLenum fb_type;
-
- /* Right now GLX_SWAP_COPY_OML isn't supported, but it would be easy
- * enough to add support. Basically, if a context is created with an
- * fbconfig where the swap method is GLX_SWAP_COPY_OML, pageflipping
- * will never be used.
- */
- static const GLenum back_buffer_modes[] = {
- GLX_NONE, GLX_SWAP_UNDEFINED_OML /*, GLX_SWAP_COPY_OML */
- };
-
- uint8_t depth_bits_array[2];
- uint8_t stencil_bits_array[2];
-
- depth_bits_array[0] = 0;
- depth_bits_array[1] = depth_bits;
-
- /* Just like with the accumulation buffer, always provide some modes
- * with a stencil buffer. It will be a sw fallback, but some apps won't
- * care about that.
- */
- stencil_bits_array[0] = 0;
- stencil_bits_array[1] = (stencil_bits == 0) ? 8 : stencil_bits;
-
- depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 2 : 1;
- back_buffer_factor = (have_back_buffer) ? 2 : 1;
-
- num_configs = depth_buffer_factor * back_buffer_factor * 2;
-
- if (pixel_bits == 16) {
- fb_format = GL_RGB;
- fb_type = GL_UNSIGNED_SHORT_5_6_5;
- } else {
- fb_format = GL_RGBA;
- fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
- }
-
- configs = calloc(sizeof(*configs), num_configs);
- c = configs;
- if (!_eglFillInConfigs(c, fb_format, fb_type,
- depth_bits_array, stencil_bits_array, depth_buffer_factor,
- back_buffer_modes, back_buffer_factor,
- GLX_TRUE_COLOR)) {
- fprintf(stderr, "[%s:%u] Error creating FBConfig!\n",
- __func__, __LINE__);
- return EGL_FALSE;
- }
-
- /* Mark the visual as slow if there are "fake" stencil bits.
- */
- for (i = 0, c = configs; i < num_configs; i++, c++) {
- int stencil = GET_CONFIG_ATTRIB(c, EGL_STENCIL_SIZE);
- if ((stencil != 0) && (stencil != stencil_bits)) {
- SET_CONFIG_ATTRIB(c, EGL_CONFIG_CAVEAT, EGL_SLOW_CONFIG);
- }
- }
-
- for (i = 0, c = configs; i < num_configs; i++, c++)
- _eglAddConfig(disp, c);
-
- free(configs);
-
- return EGL_TRUE;
-}
-
-static EGLBoolean
-fbSetupFramebuffer(fbDisplay *disp, char *fbdev)
-{
- int fd;
- char dev[20];
- struct fb_var_screeninfo varInfo;
- struct fb_fix_screeninfo fixedInfo;
-
- snprintf(dev, sizeof(dev), "/dev/%s", fbdev);
-
- /* open the framebuffer device */
- fd = open(dev, O_RDWR);
- if (fd < 0) {
- fprintf(stderr, "Error opening %s: %s\n", fbdev, strerror(errno));
- return EGL_FALSE;
- }
-
- /* get the original variable screen info */
- if (ioctl(fd, FBIOGET_VSCREENINFO, &varInfo)) {
- fprintf(stderr, "error: ioctl(FBIOGET_VSCREENINFO) failed: %s\n",
- strerror(errno));
- return EGL_FALSE;
- }
-
- /* Turn off hw accels (otherwise mmap of mmio region will be
- * refused)
- */
- if (varInfo.accel_flags) {
- varInfo.accel_flags = 0;
- if (ioctl(fd, FBIOPUT_VSCREENINFO, &varInfo)) {
- fprintf(stderr, "error: ioctl(FBIOPUT_VSCREENINFO) failed: %s\n",
- strerror(errno));
- return EGL_FALSE;
- }
- }
-
- /* Get the fixed screen info */
- if (ioctl(fd, FBIOGET_FSCREENINFO, &fixedInfo)) {
- fprintf(stderr, "error: ioctl(FBIOGET_FSCREENINFO) failed: %s\n",
- strerror(errno));
- return EGL_FALSE;
- }
-
- if (fixedInfo.visual == FB_VISUAL_DIRECTCOLOR) {
- struct fb_cmap cmap;
- unsigned short red[256], green[256], blue[256];
- int rcols = 1 << varInfo.red.length;
- int gcols = 1 << varInfo.green.length;
- int bcols = 1 << varInfo.blue.length;
- int i;
-
- cmap.start = 0;
- cmap.len = gcols;
- cmap.red = red;
- cmap.green = green;
- cmap.blue = blue;
- cmap.transp = NULL;
-
- for (i = 0; i < rcols ; i++)
- red[i] = (65536/(rcols-1)) * i;
-
- for (i = 0; i < gcols ; i++)
- green[i] = (65536/(gcols-1)) * i;
-
- for (i = 0; i < bcols ; i++)
- blue[i] = (65536/(bcols-1)) * i;
-
- if (ioctl(fd, FBIOPUTCMAP, (void *) &cmap) < 0) {
- fprintf(stderr, "ioctl(FBIOPUTCMAP) failed [%d]\n", i);
- exit(1);
- }
- }
-
- /* mmap the framebuffer into our address space */
- if (!disp->pFB)
- disp->pFB = (caddr_t)mmap(0, /* start */
- fixedInfo.smem_len, /* bytes */
- PROT_READ | PROT_WRITE, /* prot */
- MAP_SHARED, /* flags */
- fd, /* fd */
- 0); /* offset */
- if (disp->pFB == (caddr_t)-1) {
- fprintf(stderr, "error: unable to mmap framebuffer: %s\n",
- strerror(errno));
- return EGL_FALSE;
- }
-
- return EGL_TRUE;
-}
-
-const char *sysfs = "/sys/class/graphics";
-
-static EGLBoolean
-fbInitialize(_EGLDriver *drv, EGLDisplay dpy, EGLint *major, EGLint *minor)
-{
- _EGLDisplay *disp = _eglLookupDisplay(dpy);
- fbDisplay *display;
- fbScreen *s;
- _EGLScreen *scrn;
- char c;
- unsigned int x, y, r;
- DIR *dir;
- FILE *file;
- struct dirent *dirent;
- char path[NAME_MAX];
-
- /* Switch display structure to one with our private fields */
- display = calloc(1, sizeof(*display));
- display->Base = *disp;
- _eglHashInsert(_eglGlobal.Displays, disp->Handle, display);
- free(disp);
-
- *major = 1;
- *minor = 0;
-
- dir = opendir(sysfs);
- if (!dir) {
- printf("EGL - %s framebuffer device not found.", sysfs);
- return EGL_FALSE;
- }
-
- while ((dirent = readdir(dir))) { /* assignment! */
-
- if (dirent->d_name[0] != 'f')
- continue;
- if (dirent->d_name[1] != 'b')
- continue;
-
- if (fbSetupFramebuffer(display, dirent->d_name) == EGL_FALSE)
- continue;
-
- /* Create a screen */
- s = (fbScreen *) calloc(1, sizeof(fbScreen));
- if (!s)
- return EGL_FALSE;
-
- strncpy(s->fb, dirent->d_name, NAME_MAX);
- scrn = &s->Base;
- _eglInitScreen(scrn);
- _eglAddScreen(&display->Base, scrn);
-
- snprintf(path, sizeof(path), "%s/%s/modes", sysfs, s->fb);
- file = fopen(path, "r");
- while (fgets(path, sizeof(path), file)) {
- sscanf(path, "%c:%ux%u-%u", &c, &x, &y, &r);
- _eglAddMode(scrn, x, y, r * 1000, path);
- }
- fclose(file);
-
- fbFillInConfigs(&display->Base, 32, 24, 8, 1);
-
- }
- closedir(dir);
-
- drv->Initialized = EGL_TRUE;
- return EGL_TRUE;
-}
-
-
-static fbDisplay *
-Lookup_fbDisplay(EGLDisplay dpy)
-{
- _EGLDisplay *d = _eglLookupDisplay(dpy);
- return (fbDisplay *) d;
-}
-
-
-static fbScreen *
-Lookup_fbScreen(EGLDisplay dpy, EGLScreenMESA screen)
-{
- _EGLScreen *s = _eglLookupScreen(dpy, screen);
- return (fbScreen *) s;
-}
-
-
-static fbContext *
-Lookup_fbContext(EGLContext ctx)
-{
- _EGLContext *c = _eglLookupContext(ctx);
- return (fbContext *) c;
-}
-
-
-static fbSurface *
-Lookup_fbSurface(EGLSurface surf)
-{
- _EGLSurface *s = _eglLookupSurface(surf);
- return (fbSurface *) s;
-}
-
-
-static EGLBoolean
-fbTerminate(_EGLDriver *drv, EGLDisplay dpy)
-{
- fbDisplay *display = Lookup_fbDisplay(dpy);
- _eglCleanupDisplay(&display->Base);
- free(display);
- free(drv);
- return EGL_TRUE;
-}
-
-
-static const GLubyte *
-get_string(GLcontext *ctx, GLenum pname)
-{
- (void) ctx;
- switch (pname) {
- case GL_RENDERER:
- return (const GLubyte *) "Mesa dumb framebuffer";
- default:
- return NULL;
- }
-}
-
-
-static void
-update_state( GLcontext *ctx, GLuint new_state )
-{
- /* not much to do here - pass it on */
- _swrast_InvalidateState( ctx, new_state );
- _swsetup_InvalidateState( ctx, new_state );
- _vbo_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
-}
-
-
-/**
- * Called by ctx->Driver.GetBufferSize from in core Mesa to query the
- * current framebuffer size.
- */
-static void
-get_buffer_size( GLframebuffer *buffer, GLuint *width, GLuint *height )
-{
- *width = buffer->Width;
- *height = buffer->Height;
-}
-
-
-static void
-updateFramebufferSize(GLcontext *ctx)
-{
- fbContextPtr fbmesa = FB_CONTEXT(ctx);
- struct gl_framebuffer *fb = ctx->WinSysDrawBuffer;
- if (fbmesa->dri.drawable->w != fb->Width ||
- fbmesa->dri.drawable->h != fb->Height) {
- driUpdateFramebufferSize(ctx, fbmesa->dri.drawable);
- }
-}
-
-static void
-viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
-{
- /* XXX this should be called after we acquire the DRI lock, not here */
- updateFramebufferSize(ctx);
-}
-
-
-static void
-init_core_functions( struct dd_function_table *functions )
-{
- functions->GetString = get_string;
- functions->UpdateState = update_state;
- functions->GetBufferSize = get_buffer_size;
- functions->Viewport = viewport;
-
- functions->Clear = _swrast_Clear; /* could accelerate with blits */
-}
-
-
-static EGLContext
-fbCreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list)
-{
- GLcontext *ctx;
- _EGLConfig *conf;
- fbContext *c;
- _EGLDisplay *disp = _eglLookupDisplay(dpy);
- struct dd_function_table functions;
- GLvisual vis;
- int i;
-
- conf = _eglLookupConfig(drv, dpy, config);
- if (!conf) {
- _eglError(EGL_BAD_CONFIG, "eglCreateContext");
- return EGL_NO_CONTEXT;
- }
-
- for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
- switch (attrib_list[i]) {
- /* no attribs defined for now */
- default:
- _eglError(EGL_BAD_ATTRIBUTE, "eglCreateContext");
- return EGL_NO_CONTEXT;
- }
- }
-
- c = (fbContext *) calloc(1, sizeof(fbContext));
- if (!c)
- return EGL_NO_CONTEXT;
-
- _eglInitContext(&c->Base);
- c->Base.Display = disp;
- c->Base.Config = conf;
- c->Base.DrawSurface = EGL_NO_SURFACE;
- c->Base.ReadSurface = EGL_NO_SURFACE;
-
- /* link to display */
- _eglLinkContext(&c->Base, disp);
- assert(c->Base.Handle);
-
- /* Init default driver functions then plug in our FBdev-specific functions
- */
- _mesa_init_driver_functions(&functions);
- init_core_functions(&functions);
-
- _eglConfigToContextModesRec(conf, &vis);
-
- ctx = c->glCtx = _mesa_create_context(&vis, NULL, &functions, (void *)c);
- if (!c->glCtx) {
- _mesa_free(c);
- return GL_FALSE;
- }
-
- /* Create module contexts */
- _swrast_CreateContext( ctx );
- _vbo_CreateContext( ctx );
- _tnl_CreateContext( ctx );
- _swsetup_CreateContext( ctx );
- _swsetup_Wakeup( ctx );
-
-
- /* use default TCL pipeline */
- {
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- tnl->Driver.RunPipeline = _tnl_run_pipeline;
- }
-
- _mesa_enable_sw_extensions(ctx);
-
- return c->Base.Handle;
-}
-
-
-static EGLSurface
-fbCreateWindowSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list)
-{
- int i;
- for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
- switch (attrib_list[i]) {
- /* no attribs at this time */
- default:
- _eglError(EGL_BAD_ATTRIBUTE, "eglCreateWindowSurface");
- return EGL_NO_SURFACE;
- }
- }
- printf("eglCreateWindowSurface()\n");
- /* XXX unfinished */
-
- return EGL_NO_SURFACE;
-}
-
-
-static EGLSurface
-fbCreatePixmapSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list)
-{
- _EGLConfig *conf;
- EGLint i;
-
- conf = _eglLookupConfig(drv, dpy, config);
- if (!conf) {
- _eglError(EGL_BAD_CONFIG, "eglCreatePixmapSurface");
- return EGL_NO_SURFACE;
- }
-
- for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
- switch (attrib_list[i]) {
- /* no attribs at this time */
- default:
- _eglError(EGL_BAD_ATTRIBUTE, "eglCreatePixmapSurface");
- return EGL_NO_SURFACE;
- }
- }
-
- if (conf->Attrib[EGL_SURFACE_TYPE - FIRST_ATTRIB] == 0) {
- _eglError(EGL_BAD_MATCH, "eglCreatePixmapSurface");
- return EGL_NO_SURFACE;
- }
-
- printf("eglCreatePixmapSurface()\n");
- return EGL_NO_SURFACE;
-}
-
-
-static EGLSurface
-fbCreatePbufferSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
-{
- fbSurface *surf;
-
- surf = (fbSurface *) calloc(1, sizeof(fbSurface));
- if (!surf) {
- return EGL_NO_SURFACE;
- }
-
- if (_eglInitPbufferSurface(&surf->Base, drv, dpy, config, attrib_list) == EGL_NO_SURFACE) {
- free(surf);
- return EGL_NO_SURFACE;
- }
-
- /* create software-based pbuffer */
- {
- GLcontext *ctx = NULL; /* this _should_ be OK */
- GLvisual vis;
- _EGLConfig *conf = _eglLookupConfig(drv, dpy, config);
- assert(conf); /* bad config should be caught earlier */
- _eglConfigToContextModesRec(conf, &vis);
-
- surf->mesa_framebuffer = _mesa_create_framebuffer(&vis);
- _mesa_add_soft_renderbuffers(surf->mesa_framebuffer,
- GL_TRUE, /* color bufs */
- vis.haveDepthBuffer,
- vis.haveStencilBuffer,
- vis.haveAccumBuffer,
- GL_FALSE, /* alpha */
- GL_FALSE /* aux */ );
-
- /* set pbuffer/framebuffer size */
- _mesa_resize_framebuffer(ctx, surf->mesa_framebuffer,
- surf->Base.Width, surf->Base.Height);
- }
-
- return surf->Base.Handle;
-}
-
-
-static EGLBoolean
-fbDestroySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface)
-{
- fbSurface *fs = Lookup_fbSurface(surface);
- _eglUnlinkSurface(&fs->Base);
- if (!_eglIsSurfaceBound(&fs->Base))
- free(fs);
- return EGL_TRUE;
-}
-
-
-static EGLBoolean
-fbDestroyContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext context)
-{
- fbContext *fc = Lookup_fbContext(context);
- _eglUnlinkContext(&fc->Base);
- if (!_eglIsContextBound(&fc->Base))
- free(fc);
- return EGL_TRUE;
-}
-
-
-static EGLBoolean
-fbMakeCurrent(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext context)
-{
- fbSurface *readSurf = Lookup_fbSurface(read);
- fbSurface *drawSurf = Lookup_fbSurface(draw);
- fbContext *ctx = Lookup_fbContext(context);
- EGLBoolean b;
-
- b = _eglMakeCurrent(drv, dpy, draw, read, context);
- if (!b)
- return EGL_FALSE;
-
- if (ctx) {
- _mesa_make_current( ctx->glCtx,
- drawSurf->mesa_framebuffer,
- readSurf->mesa_framebuffer);
- } else
- _mesa_make_current( NULL, NULL, NULL );
-
- return EGL_TRUE;
-}
-
-
-/**
- * Create a drawing surface which can be directly displayed on a screen.
- */
-static EGLSurface
-fbCreateScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLConfig cfg,
- const EGLint *attrib_list)
-{
- _EGLConfig *config = _eglLookupConfig(drv, dpy, cfg);
- fbDisplay *display = Lookup_fbDisplay(dpy);
- fbSurface *surface;
- EGLSurface surf;
- GLvisual vis;
- GLcontext *ctx = NULL; /* this should be OK */
- int origin, bytesPerPixel;
- int width, height, stride;
-
- surface = (fbSurface *) malloc(sizeof(*surface));
- if (!surface) {
- return EGL_NO_SURFACE;
- }
-
- /* init base class, error check, etc. */
- surf = _eglInitScreenSurface(&surface->Base, drv, dpy, cfg, attrib_list);
- if (surf == EGL_NO_SURFACE) {
- free(surface);
- return EGL_NO_SURFACE;
- }
-
- /* convert EGLConfig to GLvisual */
- _eglConfigToContextModesRec(config, &vis);
-
- /* create Mesa framebuffer */
- surface->mesa_framebuffer = _mesa_create_framebuffer(&vis);
- if (!surface->mesa_framebuffer) {
- free(surface);
- _eglUnlinkSurface(&surface->Base);
- return EGL_NO_SURFACE;
- }
-
- width = surface->Base.Width;
- height = surface->Base.Height;
- bytesPerPixel = vis.rgbBits / 8;
- stride = width * bytesPerPixel;
- origin = 0;
-
- /* front color renderbuffer */
- {
- driRenderbuffer *drb = driNewRenderbuffer(MESA_FORMAT_ARGB8888, display->pFB,
- bytesPerPixel,
- origin, stride, NULL);
- fbSetSpanFunctions(drb, &vis);
- _mesa_add_renderbuffer(surface->mesa_framebuffer,
- BUFFER_FRONT_LEFT, &drb->Base);
- }
-
- /* back color renderbuffer */
- if (vis.doubleBufferMode) {
- GLubyte *backBuf = _mesa_malloc(stride * height);
- driRenderbuffer *drb = driNewRenderbuffer(MESA_FORMAT_ARGB8888, backBuf,
- bytesPerPixel,
- origin, stride, NULL);
- fbSetSpanFunctions(drb, &vis);
- _mesa_add_renderbuffer(surface->mesa_framebuffer,
- BUFFER_BACK_LEFT, &drb->Base);
- }
-
- /* other renderbuffers- software based */
- _mesa_add_soft_renderbuffers(surface->mesa_framebuffer,
- GL_FALSE, /* color */
- vis.haveDepthBuffer,
- vis.haveStencilBuffer,
- vis.haveAccumBuffer,
- GL_FALSE, /* alpha */
- GL_FALSE /* aux */);
-
- _mesa_resize_framebuffer(ctx, surface->mesa_framebuffer, width, height);
-
- return surf;
-}
-
-
-/**
- * Show the given surface on the named screen.
- * If surface is EGL_NO_SURFACE, disable the screen's output.
- */
-static EGLBoolean
-fbShowSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen,
- EGLSurface surface, EGLModeMESA m)
-{
- fbDisplay *display = Lookup_fbDisplay(dpy);
- fbScreen *scrn = Lookup_fbScreen(dpy, screen);
- fbSurface *surf = Lookup_fbSurface(surface);
- FILE *file;
- char buffer[NAME_MAX];
- _EGLMode *mode = _eglLookupMode(dpy, m);
- int bits;
-
- if (!_eglShowSurfaceMESA(drv, dpy, screen, surface, m))
- return EGL_FALSE;
-
- snprintf(buffer, sizeof(buffer), "%s/%s/blank", sysfs, scrn->fb);
-
- file = fopen(buffer, "r+");
- if (!file) {
-err:
- printf("chown all fb sysfs attrib to allow write - %s\n", buffer);
- return EGL_FALSE;
- }
- snprintf(buffer, sizeof(buffer), "%d", (m == EGL_NO_MODE_MESA ? VESA_POWERDOWN : VESA_VSYNC_SUSPEND));
- fputs(buffer, file);
- fclose(file);
-
- if (m == EGL_NO_MODE_MESA)
- return EGL_TRUE;
-
- snprintf(buffer, sizeof(buffer), "%s/%s/mode", sysfs, scrn->fb);
-
- file = fopen(buffer, "r+");
- if (!file)
- goto err;
- fputs(mode->Name, file);
- fclose(file);
-
- snprintf(buffer, sizeof(buffer), "%s/%s/bits_per_pixel", sysfs, scrn->fb);
-
- file = fopen(buffer, "r+");
- if (!file)
- goto err;
- bits = GET_CONFIG_ATTRIB(surf->Base.Config, EGL_BUFFER_SIZE);
- snprintf(buffer, sizeof(buffer), "%d", bits);
- fputs(buffer, file);
- fclose(file);
-
- fbSetupFramebuffer(display, scrn->fb);
-
- snprintf(buffer, sizeof(buffer), "%s/%s/blank", sysfs, scrn->fb);
-
- file = fopen(buffer, "r+");
- if (!file)
- goto err;
-
- snprintf(buffer, sizeof(buffer), "%d", VESA_NO_BLANKING);
- fputs(buffer, file);
- fclose(file);
-
- return EGL_TRUE;
-}
-
-
-/* If the backbuffer is on a videocard, this is extraordinarily slow!
- */
-static EGLBoolean
-fbSwapBuffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw)
-{
- fbContext *context = (fbContext *)_eglGetCurrentContext();
- fbSurface *fs = Lookup_fbSurface(draw);
- struct gl_renderbuffer * front_renderbuffer = fs->mesa_framebuffer->Attachment[BUFFER_FRONT_LEFT].Renderbuffer;
- void *frontBuffer = front_renderbuffer->Data;
- int currentPitch = ((driRenderbuffer *)front_renderbuffer)->pitch;
- void *backBuffer = fs->mesa_framebuffer->Attachment[BUFFER_BACK_LEFT].Renderbuffer->Data;
-
- if (!_eglSwapBuffers(drv, dpy, draw))
- return EGL_FALSE;
-
- if (context) {
- GLcontext *ctx = context->glCtx;
-
- if (ctx->Visual.doubleBufferMode) {
- int i;
- int offset = 0;
- char *tmp = _mesa_malloc(currentPitch);
-
- _mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */
-
- ASSERT(frontBuffer);
- ASSERT(backBuffer);
-
- for (i = 0; i < fs->Base.Height; i++) {
- _mesa_memcpy(tmp, (char *) backBuffer + offset,
- currentPitch);
- _mesa_memcpy((char *) frontBuffer + offset, tmp,
- currentPitch);
- offset += currentPitch;
- }
-
- _mesa_free(tmp);
- }
- }
- else {
- /* XXX this shouldn't be an error but we can't handle it for now */
- _mesa_problem(NULL, "fbSwapBuffers: drawable has no context!\n");
- return EGL_FALSE;
- }
- return EGL_TRUE;
-}
-
-
-/**
- * The bootstrap function. Return a new fbDriver object and
- * plug in API functions.
- */
-_EGLDriver *
-_eglMain(_EGLDisplay *dpy)
-{
- fbDriver *fb;
-
- fb = (fbDriver *) calloc(1, sizeof(fbDriver));
- if (!fb) {
- return NULL;
- }
-
- /* First fill in the dispatch table with defaults */
- _eglInitDriverFallbacks(&fb->Base);
-
- /* then plug in our fb-specific functions */
- fb->Base.Initialize = fbInitialize;
- fb->Base.Terminate = fbTerminate;
- fb->Base.CreateContext = fbCreateContext;
- fb->Base.MakeCurrent = fbMakeCurrent;
- fb->Base.CreateWindowSurface = fbCreateWindowSurface;
- fb->Base.CreatePixmapSurface = fbCreatePixmapSurface;
- fb->Base.CreatePbufferSurface = fbCreatePbufferSurface;
- fb->Base.DestroySurface = fbDestroySurface;
- fb->Base.DestroyContext = fbDestroyContext;
- fb->Base.CreateScreenSurfaceMESA = fbCreateScreenSurfaceMESA;
- fb->Base.ShowSurfaceMESA = fbShowSurfaceMESA;
- fb->Base.SwapBuffers = fbSwapBuffers;
-
- /* enable supported extensions */
- fb->Base.MESA_screen_surface = EGL_TRUE;
- fb->Base.MESA_copy_context = EGL_TRUE;
-
- return &fb->Base;
-}
diff --git a/src/mesa/drivers/dri/ffb/ffb_bitmap.c b/src/mesa/drivers/dri/ffb/ffb_bitmap.c
index 611afddfaf5..b71a552c9dc 100644
--- a/src/mesa/drivers/dri/ffb/ffb_bitmap.c
+++ b/src/mesa/drivers/dri/ffb/ffb_bitmap.c
@@ -30,7 +30,6 @@
#include "ffb_lock.h"
#include "ffb_bitmap.h"
#include "swrast/swrast.h"
-#include "main/image.h"
#include "main/macros.h"
/* Compute ceiling of integer quotient of A divided by B: */
diff --git a/src/mesa/drivers/dri/ffb/ffb_clear.c b/src/mesa/drivers/dri/ffb/ffb_clear.c
index dfe60f36f2b..aa3fa0a86c5 100644
--- a/src/mesa/drivers/dri/ffb/ffb_clear.c
+++ b/src/mesa/drivers/dri/ffb/ffb_clear.c
@@ -26,15 +26,12 @@
*/
#include "main/mtypes.h"
-#include "main/extensions.h"
#include "main/mm.h"
#include "ffb_dd.h"
#include "ffb_span.h"
-#include "ffb_depth.h"
#include "ffb_context.h"
#include "ffb_vb.h"
-#include "ffb_tris.h"
#include "ffb_clear.h"
#include "ffb_lock.h"
diff --git a/src/mesa/drivers/dri/ffb/ffb_dd.c b/src/mesa/drivers/dri/ffb/ffb_dd.c
index cf83b91f0d4..91b6d3153af 100644
--- a/src/mesa/drivers/dri/ffb/ffb_dd.c
+++ b/src/mesa/drivers/dri/ffb/ffb_dd.c
@@ -27,13 +27,9 @@
#include "main/mtypes.h"
#include "main/mm.h"
-#include "main/extensions.h"
#include "ffb_dd.h"
#include "ffb_span.h"
-#include "ffb_depth.h"
#include "ffb_context.h"
-#include "ffb_vb.h"
-#include "ffb_tris.h"
#include "ffb_clear.h"
#include "ffb_lock.h"
diff --git a/src/mesa/drivers/dri/ffb/ffb_depth.c b/src/mesa/drivers/dri/ffb/ffb_depth.c
index 5d509ff6963..d19385b776b 100644
--- a/src/mesa/drivers/dri/ffb/ffb_depth.c
+++ b/src/mesa/drivers/dri/ffb/ffb_depth.c
@@ -26,7 +26,6 @@
*/
#include "main/mtypes.h"
-#include "swrast/swrast.h"
#include "ffb_dd.h"
#include "ffb_span.h"
#include "ffb_context.h"
diff --git a/src/mesa/drivers/dri/ffb/ffb_lines.c b/src/mesa/drivers/dri/ffb/ffb_lines.c
index 19dff509354..6dca4edd29b 100644
--- a/src/mesa/drivers/dri/ffb/ffb_lines.c
+++ b/src/mesa/drivers/dri/ffb/ffb_lines.c
@@ -27,15 +27,11 @@
#include "main/mtypes.h"
#include "main/mm.h"
-#include "main/extensions.h"
#include "ffb_dd.h"
#include "ffb_span.h"
-#include "ffb_depth.h"
#include "ffb_context.h"
#include "ffb_vb.h"
#include "ffb_lines.h"
-#include "ffb_tris.h"
-#include "ffb_lock.h"
#undef FFB_LINE_TRACE
diff --git a/src/mesa/drivers/dri/ffb/ffb_points.c b/src/mesa/drivers/dri/ffb/ffb_points.c
index 9c37a47aeb9..5bf4f8f0707 100644
--- a/src/mesa/drivers/dri/ffb/ffb_points.c
+++ b/src/mesa/drivers/dri/ffb/ffb_points.c
@@ -30,8 +30,6 @@
#include "ffb_context.h"
#include "ffb_vb.h"
#include "ffb_points.h"
-#include "ffb_tris.h"
-#include "ffb_lock.h"
#undef FFB_POINT_TRACE
diff --git a/src/mesa/drivers/dri/ffb/ffb_span.c b/src/mesa/drivers/dri/ffb/ffb_span.c
index 8ec33a11bc6..61901cccadd 100644
--- a/src/mesa/drivers/dri/ffb/ffb_span.c
+++ b/src/mesa/drivers/dri/ffb/ffb_span.c
@@ -31,8 +31,6 @@
#include "ffb_context.h"
#include "ffb_lock.h"
-#include "swrast/swrast.h"
-
#define DBG 0
#define HW_LOCK() \
diff --git a/src/mesa/drivers/dri/ffb/ffb_state.c b/src/mesa/drivers/dri/ffb/ffb_state.c
index 6f8a46d1fc7..c09d2fef838 100644
--- a/src/mesa/drivers/dri/ffb/ffb_state.c
+++ b/src/mesa/drivers/dri/ffb/ffb_state.c
@@ -27,8 +27,6 @@
#include "main/mtypes.h"
#include "main/colormac.h"
-#include "main/mm.h"
-#include "main/extensions.h"
#include "main/enums.h"
#include "vbo/vbo.h"
@@ -39,12 +37,9 @@
#include "ffb_dd.h"
#include "ffb_span.h"
-#include "ffb_depth.h"
#include "ffb_context.h"
-#include "ffb_vb.h"
#include "ffb_tris.h"
#include "ffb_state.h"
-#include "ffb_lock.h"
#undef STATE_TRACE
diff --git a/src/mesa/drivers/dri/ffb/ffb_stencil.c b/src/mesa/drivers/dri/ffb/ffb_stencil.c
index ce8ef43c91e..10cdfbc616e 100644
--- a/src/mesa/drivers/dri/ffb/ffb_stencil.c
+++ b/src/mesa/drivers/dri/ffb/ffb_stencil.c
@@ -32,8 +32,6 @@
#include "ffb_stencil.h"
#include "ffb_lock.h"
-#include "swrast/swrast.h"
-
#undef STENCIL_TRACE
static void FFBWriteStencilSpan( GLcontext *ctx,
diff --git a/src/mesa/drivers/dri/ffb/ffb_vb.c b/src/mesa/drivers/dri/ffb/ffb_vb.c
index f9c6fd1f310..ca8ffb27219 100644
--- a/src/mesa/drivers/dri/ffb/ffb_vb.c
+++ b/src/mesa/drivers/dri/ffb/ffb_vb.c
@@ -30,8 +30,6 @@
#include "ffb_vb.h"
#include "main/imports.h"
#include "tnl/t_context.h"
-#include "swrast_setup/swrast_setup.h"
-#include "math/m_translate.h"
#undef VB_DEBUG
diff --git a/src/mesa/drivers/dri/ffb/ffb_xmesa.c b/src/mesa/drivers/dri/ffb/ffb_xmesa.c
index 88285f454e9..6a846514795 100644
--- a/src/mesa/drivers/dri/ffb/ffb_xmesa.c
+++ b/src/mesa/drivers/dri/ffb/ffb_xmesa.c
@@ -28,7 +28,6 @@
#include "ffb_xmesa.h"
#include "main/context.h"
#include "main/framebuffer.h"
-#include "main/matrix.h"
#include "main/renderbuffer.h"
#include "main/simple_list.h"
#include "main/imports.h"
@@ -52,7 +51,6 @@
#include "ffb_lines.h"
#include "ffb_points.h"
#include "ffb_state.h"
-#include "ffb_tex.h"
#include "ffb_lock.h"
#include "ffb_vtxfmt.h"
#include "ffb_bitmap.h"
diff --git a/src/mesa/drivers/dri/i810/i810context.c b/src/mesa/drivers/dri/i810/i810context.c
index bd9cfe5c0f7..34e34606b4b 100644
--- a/src/mesa/drivers/dri/i810/i810context.c
+++ b/src/mesa/drivers/dri/i810/i810context.c
@@ -34,10 +34,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "main/glheader.h"
#include "main/context.h"
-#include "main/matrix.h"
#include "main/simple_list.h"
-#include "main/extensions.h"
-#include "main/framebuffer.h"
#include "main/imports.h"
#include "main/points.h"
diff --git a/src/mesa/drivers/dri/i810/i810render.c b/src/mesa/drivers/dri/i810/i810render.c
index 1d98e006885..b543d4f012c 100644
--- a/src/mesa/drivers/dri/i810/i810render.c
+++ b/src/mesa/drivers/dri/i810/i810render.c
@@ -44,7 +44,6 @@
#include "i810context.h"
#include "i810tris.h"
-#include "i810state.h"
#include "i810vb.h"
#include "i810ioctl.h"
diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c
index 2a30782afd4..476c8013580 100644
--- a/src/mesa/drivers/dri/i810/i810screen.c
+++ b/src/mesa/drivers/dri/i810/i810screen.c
@@ -36,8 +36,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "main/imports.h"
#include "main/context.h"
#include "main/framebuffer.h"
-#include "main/fbobject.h"
-#include "main/matrix.h"
#include "main/renderbuffer.h"
#include "main/simple_list.h"
#include "utils.h"
@@ -48,8 +46,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "i810state.h"
#include "i810tex.h"
#include "i810span.h"
-#include "i810tris.h"
-#include "i810ioctl.h"
#include "GL/internal/dri_interface.h"
diff --git a/src/mesa/drivers/dri/i810/i810state.c b/src/mesa/drivers/dri/i810/i810state.c
index 642245c61c8..0c68e120b02 100644
--- a/src/mesa/drivers/dri/i810/i810state.c
+++ b/src/mesa/drivers/dri/i810/i810state.c
@@ -20,8 +20,6 @@
#include "i810context.h"
#include "i810state.h"
#include "i810tex.h"
-#include "i810vb.h"
-#include "i810tris.h"
#include "i810ioctl.h"
diff --git a/src/mesa/drivers/dri/i810/i810tex.c b/src/mesa/drivers/dri/i810/i810tex.c
index e764644a6c1..2ccb9562e90 100644
--- a/src/mesa/drivers/dri/i810/i810tex.c
+++ b/src/mesa/drivers/dri/i810/i810tex.c
@@ -33,7 +33,6 @@
#include "main/colormac.h"
#include "main/texobj.h"
#include "main/mm.h"
-#include "swrast/swrast.h"
#include "texmem.h"
@@ -42,7 +41,6 @@
#include "i810context.h"
#include "i810tex.h"
-#include "i810state.h"
#include "i810ioctl.h"
diff --git a/src/mesa/drivers/dri/i810/i810texmem.c b/src/mesa/drivers/dri/i810/i810texmem.c
index d93afbf9ef6..bb426a41122 100644
--- a/src/mesa/drivers/dri/i810/i810texmem.c
+++ b/src/mesa/drivers/dri/i810/i810texmem.c
@@ -35,7 +35,6 @@
#include "i810_dri.h"
#include "i810context.h"
#include "i810tex.h"
-#include "i810state.h"
#include "i810ioctl.h"
diff --git a/src/mesa/drivers/dri/i810/i810vb.c b/src/mesa/drivers/dri/i810/i810vb.c
index 30890dc9b70..09a772258c5 100644
--- a/src/mesa/drivers/dri/i810/i810vb.c
+++ b/src/mesa/drivers/dri/i810/i810vb.c
@@ -38,7 +38,6 @@
#include "i810context.h"
#include "i810vb.h"
#include "i810ioctl.h"
-#include "i810tris.h"
#include "i810state.h"
diff --git a/src/mesa/drivers/dri/i915/i830_context.c b/src/mesa/drivers/dri/i915/i830_context.c
index 4cb63059884..947330b2f16 100644
--- a/src/mesa/drivers/dri/i915/i830_context.c
+++ b/src/mesa/drivers/dri/i915/i830_context.c
@@ -28,14 +28,11 @@
#include "i830_context.h"
#include "main/imports.h"
#include "texmem.h"
-#include "intel_tex.h"
#include "tnl/tnl.h"
#include "tnl/t_vertex.h"
#include "tnl/t_context.h"
#include "tnl/t_pipeline.h"
-#include "utils.h"
#include "intel_span.h"
-#include "intel_pixel.h"
#include "intel_tris.h"
/***************************************
diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c b/src/mesa/drivers/dri/i915/i830_vtbl.c
index 4471ca2bbbd..3767712d191 100644
--- a/src/mesa/drivers/dri/i915/i830_vtbl.c
+++ b/src/mesa/drivers/dri/i915/i830_vtbl.c
@@ -25,8 +25,6 @@
*
**************************************************************************/
-#include "glapi/glapi.h"
-
#include "i830_context.h"
#include "i830_reg.h"
#include "intel_batchbuffer.h"
diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c
index 7c7711da099..8477e2f9a42 100644
--- a/src/mesa/drivers/dri/i915/i915_context.c
+++ b/src/mesa/drivers/dri/i915/i915_context.c
@@ -28,7 +28,6 @@
#include "i915_context.h"
#include "main/imports.h"
#include "main/macros.h"
-#include "intel_tex.h"
#include "intel_tris.h"
#include "tnl/t_context.h"
#include "tnl/t_pipeline.h"
@@ -38,15 +37,11 @@
#include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h"
-#include "utils.h"
#include "i915_reg.h"
#include "i915_program.h"
-#include "intel_regions.h"
-#include "intel_batchbuffer.h"
#include "intel_tris.h"
#include "intel_span.h"
-#include "intel_pixel.h"
/***************************************
* Mesa's Driver Functions
diff --git a/src/mesa/drivers/dri/i915/i915_debug_fp.c b/src/mesa/drivers/dri/i915/i915_debug_fp.c
index 84347a01efe..bf500e54fa2 100644
--- a/src/mesa/drivers/dri/i915/i915_debug_fp.c
+++ b/src/mesa/drivers/dri/i915/i915_debug_fp.c
@@ -30,9 +30,6 @@
#include "i915_reg.h"
#include "i915_debug.h"
#include "main/imports.h"
-#include "shader/program.h"
-#include "shader/prog_instruction.h"
-#include "shader/prog_print.h"
#define PRINTF( ... ) _mesa_printf( __VA_ARGS__ )
diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c
index 266e6848c3c..933a565f028 100644
--- a/src/mesa/drivers/dri/i915/i915_vtbl.c
+++ b/src/mesa/drivers/dri/i915/i915_vtbl.c
@@ -37,7 +37,6 @@
#include "tnl/t_vertex.h"
#include "intel_batchbuffer.h"
-#include "intel_tex.h"
#include "intel_regions.h"
#include "intel_tris.h"
#include "intel_fbo.h"
@@ -46,8 +45,6 @@
#include "i915_reg.h"
#include "i915_context.h"
-#include "glapi/glapi.h"
-
static void
i915_render_prevalidate(struct intel_context *intel)
{
diff --git a/src/mesa/drivers/dri/i915/intel_tris.c b/src/mesa/drivers/dri/i915/intel_tris.c
index e99baf8e0e6..763c1a0ae7e 100644
--- a/src/mesa/drivers/dri/i915/intel_tris.c
+++ b/src/mesa/drivers/dri/i915/intel_tris.c
@@ -52,7 +52,6 @@
#include "intel_buffers.h"
#include "intel_reg.h"
#include "intel_span.h"
-#include "intel_tex.h"
#include "intel_chipset.h"
#include "i830_context.h"
#include "i830_reg.h"
diff --git a/src/mesa/drivers/dri/i965/brw_cc.c b/src/mesa/drivers/dri/i965/brw_cc.c
index 016f27a6a31..fa2d394b222 100644
--- a/src/mesa/drivers/dri/i965/brw_cc.c
+++ b/src/mesa/drivers/dri/i965/brw_cc.c
@@ -34,9 +34,7 @@
#include "brw_state.h"
#include "brw_defines.h"
#include "brw_util.h"
-#include "intel_fbo.h"
#include "main/macros.h"
-#include "main/enums.h"
static void prepare_cc_vp( struct brw_context *brw )
{
diff --git a/src/mesa/drivers/dri/i965/brw_clip_line.c b/src/mesa/drivers/dri/i965/brw_clip_line.c
index afc0b110494..ceb62a31162 100644
--- a/src/mesa/drivers/dri/i965/brw_clip_line.c
+++ b/src/mesa/drivers/dri/i965/brw_clip_line.c
@@ -39,7 +39,6 @@
#include "brw_defines.h"
#include "brw_context.h"
#include "brw_eu.h"
-#include "brw_util.h"
#include "brw_clip.h"
diff --git a/src/mesa/drivers/dri/i965/brw_clip_point.c b/src/mesa/drivers/dri/i965/brw_clip_point.c
index 8458f61c5a0..7f47634dca8 100644
--- a/src/mesa/drivers/dri/i965/brw_clip_point.c
+++ b/src/mesa/drivers/dri/i965/brw_clip_point.c
@@ -39,7 +39,6 @@
#include "brw_defines.h"
#include "brw_context.h"
#include "brw_eu.h"
-#include "brw_util.h"
#include "brw_clip.h"
diff --git a/src/mesa/drivers/dri/i965/brw_clip_state.c b/src/mesa/drivers/dri/i965/brw_clip_state.c
index 22df7722b68..424c9a1f198 100644
--- a/src/mesa/drivers/dri/i965/brw_clip_state.c
+++ b/src/mesa/drivers/dri/i965/brw_clip_state.c
@@ -32,7 +32,6 @@
#include "brw_context.h"
#include "brw_state.h"
#include "brw_defines.h"
-#include "main/macros.h"
struct brw_clip_unit_key {
unsigned int total_grf;
diff --git a/src/mesa/drivers/dri/i965/brw_clip_tri.c b/src/mesa/drivers/dri/i965/brw_clip_tri.c
index cfbb8f2686a..815211acc21 100644
--- a/src/mesa/drivers/dri/i965/brw_clip_tri.c
+++ b/src/mesa/drivers/dri/i965/brw_clip_tri.c
@@ -39,7 +39,6 @@
#include "brw_defines.h"
#include "brw_context.h"
#include "brw_eu.h"
-#include "brw_util.h"
#include "brw_clip.h"
static void release_tmps( struct brw_clip_compile *c )
diff --git a/src/mesa/drivers/dri/i965/brw_clip_unfilled.c b/src/mesa/drivers/dri/i965/brw_clip_unfilled.c
index ad1bfa435fb..f36d22fdbf8 100644
--- a/src/mesa/drivers/dri/i965/brw_clip_unfilled.c
+++ b/src/mesa/drivers/dri/i965/brw_clip_unfilled.c
@@ -39,7 +39,6 @@
#include "brw_defines.h"
#include "brw_context.h"
#include "brw_eu.h"
-#include "brw_util.h"
#include "brw_clip.h"
diff --git a/src/mesa/drivers/dri/i965/brw_clip_util.c b/src/mesa/drivers/dri/i965/brw_clip_util.c
index 86fed59fa4b..14bc889b0f8 100644
--- a/src/mesa/drivers/dri/i965/brw_clip_util.c
+++ b/src/mesa/drivers/dri/i965/brw_clip_util.c
@@ -40,7 +40,6 @@
#include "brw_defines.h"
#include "brw_context.h"
#include "brw_eu.h"
-#include "brw_util.h"
#include "brw_clip.h"
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 7bb15956b56..65f51be3410 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -33,7 +33,6 @@
#include "main/imports.h"
#include "main/api_noop.h"
#include "main/macros.h"
-#include "main/vtxfmt.h"
#include "main/simple_list.h"
#include "shader/shader_api.h"
@@ -41,16 +40,9 @@
#include "brw_defines.h"
#include "brw_draw.h"
#include "brw_state.h"
-#include "brw_vs.h"
-#include "intel_tex.h"
-#include "intel_blit.h"
-#include "intel_batchbuffer.h"
-#include "intel_pixel.h"
#include "intel_span.h"
#include "tnl/t_pipeline.h"
-#include "utils.h"
-
/***************************************
* Mesa's Driver Functions
diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c
index df281b27d5c..d510d767f97 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -39,10 +39,8 @@
#include "brw_defines.h"
#include "brw_context.h"
#include "brw_state.h"
-#include "brw_fallback.h"
#include "intel_batchbuffer.h"
-#include "intel_buffer_objects.h"
#define FILE_DEBUG_FLAG DEBUG_BATCH
diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c
index c773b71507c..c46b9ba89ce 100644
--- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
@@ -29,19 +29,15 @@
#include "main/glheader.h"
#include "main/bufferobj.h"
#include "main/context.h"
-#include "main/state.h"
-#include "main/api_validate.h"
#include "main/enums.h"
#include "brw_draw.h"
#include "brw_defines.h"
#include "brw_context.h"
#include "brw_state.h"
-#include "brw_fallback.h"
#include "intel_batchbuffer.h"
#include "intel_buffer_objects.h"
-#include "intel_tex.h"
static GLuint double_types[5] = {
0,
@@ -59,6 +55,14 @@ static GLuint float_types[5] = {
BRW_SURFACEFORMAT_R32G32B32A32_FLOAT
};
+static GLuint half_float_types[5] = {
+ 0,
+ BRW_SURFACEFORMAT_R16_FLOAT,
+ BRW_SURFACEFORMAT_R16G16_FLOAT,
+ 0, /* can't seem to render this one */
+ BRW_SURFACEFORMAT_R16G16B16A16_FLOAT
+};
+
static GLuint uint_types_norm[5] = {
0,
BRW_SURFACEFORMAT_R32_UNORM,
@@ -172,6 +176,7 @@ static GLuint get_surface_type( GLenum type, GLuint size,
switch (type) {
case GL_DOUBLE: return double_types[size];
case GL_FLOAT: return float_types[size];
+ case GL_HALF_FLOAT: return half_float_types[size];
case GL_INT: return int_types_norm[size];
case GL_SHORT: return short_types_norm[size];
case GL_BYTE: return byte_types_norm[size];
@@ -194,6 +199,7 @@ static GLuint get_surface_type( GLenum type, GLuint size,
switch (type) {
case GL_DOUBLE: return double_types[size];
case GL_FLOAT: return float_types[size];
+ case GL_HALF_FLOAT: return half_float_types[size];
case GL_INT: return int_types_scale[size];
case GL_SHORT: return short_types_scale[size];
case GL_BYTE: return byte_types_scale[size];
@@ -211,6 +217,7 @@ static GLuint get_size( GLenum type )
switch (type) {
case GL_DOUBLE: return sizeof(GLdouble);
case GL_FLOAT: return sizeof(GLfloat);
+ case GL_HALF_FLOAT: return sizeof(GLhalfARB);
case GL_INT: return sizeof(GLint);
case GL_SHORT: return sizeof(GLshort);
case GL_BYTE: return sizeof(GLbyte);
diff --git a/src/mesa/drivers/dri/i965/brw_fallback.c b/src/mesa/drivers/dri/i965/brw_fallback.c
index fe5c1ae2791..79691c3a0f9 100644
--- a/src/mesa/drivers/dri/i965/brw_fallback.c
+++ b/src/mesa/drivers/dri/i965/brw_fallback.c
@@ -36,13 +36,10 @@
#include "swrast/swrast.h"
#include "tnl/tnl.h"
#include "brw_context.h"
-#include "brw_fallback.h"
#include "intel_chipset.h"
#include "intel_fbo.h"
#include "intel_regions.h"
-#include "glapi/glapi.h"
-
#define FILE_DEBUG_FLAG DEBUG_FALLBACKS
static GLboolean do_check_fallback(struct brw_context *brw)
diff --git a/src/mesa/drivers/dri/i965/brw_gs_emit.c b/src/mesa/drivers/dri/i965/brw_gs_emit.c
index a81b972ef4b..dd7b057d620 100644
--- a/src/mesa/drivers/dri/i965/brw_gs_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_gs_emit.c
@@ -40,7 +40,6 @@
#include "brw_defines.h"
#include "brw_context.h"
#include "brw_eu.h"
-#include "brw_util.h"
#include "brw_gs.h"
static void brw_gs_alloc_regs( struct brw_gs_compile *c,
diff --git a/src/mesa/drivers/dri/i965/brw_gs_state.c b/src/mesa/drivers/dri/i965/brw_gs_state.c
index 7d5a944bf7d..d8ad5cecf3f 100644
--- a/src/mesa/drivers/dri/i965/brw_gs_state.c
+++ b/src/mesa/drivers/dri/i965/brw_gs_state.c
@@ -34,7 +34,6 @@
#include "brw_context.h"
#include "brw_state.h"
#include "brw_defines.h"
-#include "main/macros.h"
struct brw_gs_unit_key {
unsigned int total_grf;
diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c
index 7b70f787b7b..f708ee00632 100644
--- a/src/mesa/drivers/dri/i965/brw_misc_state.c
+++ b/src/mesa/drivers/dri/i965/brw_misc_state.c
@@ -327,7 +327,7 @@ const struct brw_tracked_state brw_polygon_stipple = {
static void upload_polygon_stipple_offset(struct brw_context *brw)
{
- __DRIdrawable *dPriv = brw->intel.driDrawable;
+ GLcontext *ctx = &brw->intel.ctx;
struct brw_polygon_stipple_offset bpso;
memset(&bpso, 0, sizeof(bpso));
@@ -343,8 +343,8 @@ static void upload_polygon_stipple_offset(struct brw_context *brw)
* worry about.
*/
if (brw->intel.ctx.DrawBuffer->Name == 0) {
- bpso.bits0.x_offset = (32 - (dPriv->x & 31)) & 31;
- bpso.bits0.y_offset = (32 - ((dPriv->y + dPriv->h) & 31)) & 31;
+ bpso.bits0.x_offset = 0;
+ bpso.bits0.y_offset = (32 - (ctx->DrawBuffer->Height & 31)) & 31;
}
else {
bpso.bits0.y_offset = 0;
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index bac69187c19..e3b6fccc49f 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -37,7 +37,6 @@
#include "tnl/tnl.h"
#include "brw_context.h"
-#include "brw_util.h"
#include "brw_wm.h"
static void brwBindProgram( GLcontext *ctx,
diff --git a/src/mesa/drivers/dri/i965/brw_sf_state.c b/src/mesa/drivers/dri/i965/brw_sf_state.c
index b9b42cd6d55..847c886279d 100644
--- a/src/mesa/drivers/dri/i965/brw_sf_state.c
+++ b/src/mesa/drivers/dri/i965/brw_sf_state.c
@@ -35,7 +35,6 @@
#include "brw_state.h"
#include "brw_defines.h"
#include "main/macros.h"
-#include "intel_fbo.h"
static void upload_sf_vp(struct brw_context *brw)
{
@@ -70,9 +69,9 @@ static void upload_sf_vp(struct brw_context *brw)
* for DrawBuffer->_[XY]{min,max}
*/
- /* The scissor only needs to handle the intersection of drawable and
- * scissor rect. Clipping to the boundaries of static shared buffers
- * for front/back/depth is covered by looping over cliprects in brw_draw.c.
+ /* The scissor only needs to handle the intersection of drawable
+ * and scissor rect, since there are no longer cliprects for shared
+ * buffers with DRI2.
*
* Note that the hardware's coordinates are inclusive, while Mesa's min is
* inclusive but max is exclusive.
diff --git a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
index 3f6e16fcb0a..ead623fc0ea 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
@@ -35,7 +35,6 @@
#include "brw_context.h"
#include "brw_state.h"
-#include "brw_defines.h"
/* Creates a new VS constant buffer reflecting the current VS program's
* constants, if needed by the VS program.
@@ -156,7 +155,7 @@ brw_vs_get_binding_table(struct brw_context *brw)
if (bind_bo == NULL) {
GLuint data_size = BRW_VS_MAX_SURF * sizeof(GLuint);
- uint32_t *data = malloc(data_size);
+ uint32_t data[BRW_VS_MAX_SURF];
int i;
for (i = 0; i < BRW_VS_MAX_SURF; i++)
@@ -181,8 +180,6 @@ brw_vs_get_binding_table(struct brw_context *brw)
I915_GEM_DOMAIN_INSTRUCTION, 0);
}
}
-
- free(data);
}
return bind_bo;
diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c b/src/mesa/drivers/dri/i965/brw_vtbl.c
index bb7a2938123..e08f32c4e27 100644
--- a/src/mesa/drivers/dri/i965/brw_vtbl.c
+++ b/src/mesa/drivers/dri/i965/brw_vtbl.c
@@ -44,7 +44,6 @@
#include "brw_state.h"
#include "brw_draw.h"
#include "brw_state.h"
-#include "brw_fallback.h"
#include "brw_vs.h"
#include "brw_wm.h"
diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
index fb24379c90b..9191c81755d 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -30,7 +30,6 @@
*/
#include "brw_context.h"
-#include "brw_util.h"
#include "brw_wm.h"
#include "brw_state.h"
@@ -337,11 +336,7 @@ static void brw_wm_populate_key( struct brw_context *brw,
* drawable height in order to invert the Y axis.
*/
if (fp->program.Base.InputsRead & FRAG_BIT_WPOS) {
- if (brw->intel.driDrawable != NULL) {
- key->origin_x = brw->intel.driDrawable->x;
- key->origin_y = brw->intel.driDrawable->y;
- key->drawable_height = brw->intel.driDrawable->h;
- }
+ key->drawable_height = ctx->DrawBuffer->Height;
}
key->nr_color_regions = brw->state.nr_color_regions;
diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h
index b9b987ea70a..88d84ee82fe 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.h
+++ b/src/mesa/drivers/dri/i965/brw_wm.h
@@ -76,7 +76,6 @@ struct brw_wm_prog_key {
GLushort tex_swizzles[BRW_MAX_TEX_UNIT];
- GLushort origin_x, origin_y;
GLushort drawable_height;
GLbitfield64 vp_outputs_written;
GLuint program_string_id:32;
diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c
index f316e0cda49..fa0898c5862 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c
@@ -138,19 +138,43 @@ void emit_wpos_xy(struct brw_wm_compile *c,
* X and Y channels.
*/
if (mask & WRITEMASK_X) {
- /* X' = X - origin */
- brw_ADD(p,
- dst[0],
- retype(arg0[0], BRW_REGISTER_TYPE_W),
- brw_imm_d(0 - c->key.origin_x));
+ if (c->fp->program.PixelCenterInteger) {
+ /* X' = X */
+ brw_MOV(p,
+ dst[0],
+ retype(arg0[0], BRW_REGISTER_TYPE_W));
+ } else {
+ /* X' = X + 0.5 */
+ brw_ADD(p,
+ dst[0],
+ retype(arg0[0], BRW_REGISTER_TYPE_W),
+ brw_imm_f(0.5));
+ }
}
if (mask & WRITEMASK_Y) {
- /* Y' = height - (Y - origin_y) = height + origin_y - Y */
- brw_ADD(p,
- dst[1],
- negate(retype(arg0[1], BRW_REGISTER_TYPE_W)),
- brw_imm_d(c->key.origin_y + c->key.drawable_height - 1));
+ if (c->fp->program.OriginUpperLeft) {
+ if (c->fp->program.PixelCenterInteger) {
+ /* Y' = Y */
+ brw_MOV(p,
+ dst[1],
+ retype(arg0[1], BRW_REGISTER_TYPE_W));
+ } else {
+ /* Y' = Y + 0.5 */
+ brw_ADD(p,
+ dst[1],
+ retype(arg0[1], BRW_REGISTER_TYPE_W),
+ brw_imm_f(0.5));
+ }
+ } else {
+ float center_offset = c->fp->program.PixelCenterInteger ? 0.0 : 0.5;
+
+ /* Y' = (height - 1) - Y + center */
+ brw_ADD(p,
+ dst[1],
+ negate(retype(arg0[1], BRW_REGISTER_TYPE_W)),
+ brw_imm_f(c->key.drawable_height - 1 + center_offset));
+ }
}
}
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 357c8c90de3..1db438ae7b5 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -577,7 +577,7 @@ brw_update_renderbuffer_surface(struct brw_context *brw,
key.draw_y = 0;
}
/* _NEW_COLOR */
- memcpy(key.color_mask, ctx->Color.ColorMask[0],
+ memcpy(key.color_mask, ctx->Color.ColorMask[unit],
sizeof(key.color_mask));
/* As mentioned above, disable writes to the alpha component when the
@@ -587,7 +587,7 @@ brw_update_renderbuffer_surface(struct brw_context *brw,
key.color_mask[3] = GL_FALSE;
key.color_blend = (!ctx->Color._LogicOpEnabled &&
- ctx->Color.BlendEnabled);
+ (ctx->Color.BlendEnabled & (1 << unit)));
dri_bo_unreference(brw->wm.surf_bo[unit]);
brw->wm.surf_bo[unit] = brw_search_cache(&brw->surface_cache,
diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.c b/src/mesa/drivers/dri/intel/intel_batchbuffer.c
index 3a4b21a844f..ae0f8a16f95 100644
--- a/src/mesa/drivers/dri/intel/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.c
@@ -32,44 +32,6 @@
#include "intel_bufmgr.h"
#include "intel_buffers.h"
-/* Relocations in kernel space:
- * - pass dma buffer seperately
- * - memory manager knows how to patch
- * - pass list of dependent buffers
- * - pass relocation list
- *
- * Either:
- * - get back an offset for buffer to fire
- * - memory manager knows how to fire buffer
- *
- * Really want the buffer to be AGP and pinned.
- *
- */
-
-/* Cliprect fence: The highest fence protecting a dma buffer
- * containing explicit cliprect information. Like the old drawable
- * lock but irq-driven. X server must wait for this fence to expire
- * before changing cliprects [and then doing sw rendering?]. For
- * other dma buffers, the scheduler will grab current cliprect info
- * and mix into buffer. X server must hold the lock while changing
- * cliprects??? Make per-drawable. Need cliprects in shared memory
- * -- beats storing them with every cmd buffer in the queue.
- *
- * ==> X server must wait for this fence to expire before touching the
- * framebuffer with new cliprects.
- *
- * ==> Cliprect-dependent buffers associated with a
- * cliprect-timestamp. All of the buffers associated with a timestamp
- * must go to hardware before any buffer with a newer timestamp.
- *
- * ==> Dma should be queued per-drawable for correct X/GL
- * synchronization. Or can fences be used for this?
- *
- * Applies to: Blit operations, metaops, X server operations -- X
- * server automatically waits on its own dma to complete before
- * modifying cliprects ???
- */
-
void
intel_batchbuffer_reset(struct intel_batchbuffer *batch)
{
@@ -167,7 +129,8 @@ _intel_batchbuffer_flush(struct intel_batchbuffer *batch, const char *file,
struct intel_context *intel = batch->intel;
GLuint used = batch->ptr - batch->map;
- if (intel->first_post_swapbuffers_batch == NULL) {
+ if (!intel->using_dri2_swapbuffers &&
+ intel->first_post_swapbuffers_batch == NULL) {
intel->first_post_swapbuffers_batch = intel->batch->buf;
drm_intel_bo_reference(intel->first_post_swapbuffers_batch);
}
diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c
index 55bee0084c1..f12a1c6fd39 100644
--- a/src/mesa/drivers/dri/intel/intel_blit.c
+++ b/src/mesa/drivers/dri/intel/intel_blit.c
@@ -38,7 +38,6 @@
#include "intel_reg.h"
#include "intel_regions.h"
#include "intel_batchbuffer.h"
-#include "intel_chipset.h"
#define FILE_DEBUG_FLAG DEBUG_BLIT
@@ -103,7 +102,7 @@ intelEmitCopyBlit(struct intel_context *intel,
return GL_FALSE;
}
- /* do space/cliprects check before going any further */
+ /* do space check before going any further */
do {
aper_array[0] = intel->batch->buf;
aper_array[1] = dst_buffer;
@@ -213,10 +212,8 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask)
struct intel_context *intel = intel_context(ctx);
struct gl_framebuffer *fb = ctx->DrawBuffer;
GLuint clear_depth;
- GLbitfield skipBuffers = 0;
- unsigned int num_cliprects;
- struct drm_clip_rect *cliprects;
- int x_off, y_off;
+ GLboolean all;
+ GLint cx, cy, cw, ch;
BATCH_LOCALS;
/*
@@ -230,183 +227,134 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask)
clear_depth |= (ctx->Stencil.Clear & 0xff) << 24;
}
- /* If clearing both depth and stencil, skip BUFFER_BIT_STENCIL in
- * the loop below.
- */
- if ((mask & BUFFER_BIT_DEPTH) && (mask & BUFFER_BIT_STENCIL)) {
- skipBuffers = BUFFER_BIT_STENCIL;
- }
-
- intel_get_cliprects(intel, &cliprects, &num_cliprects, &x_off, &y_off);
- if (num_cliprects) {
- GLint cx, cy, cw, ch;
- drm_clip_rect_t clear;
- int i;
-
- /* Get clear bounds after locking */
- cx = fb->_Xmin;
+ cx = fb->_Xmin;
+ if (fb->Name == 0)
cy = fb->_Ymin;
- cw = fb->_Xmax - cx;
- ch = fb->_Ymax - cy;
-
- if (fb->Name == 0) {
- /* clearing a window */
-
- /* flip top to bottom */
- clear.x1 = cx + x_off;
- clear.y1 = intel->driDrawable->y + intel->driDrawable->h - cy - ch;
- clear.x2 = clear.x1 + cw;
- clear.y2 = clear.y1 + ch;
- }
- else {
- /* clearing FBO */
- assert(num_cliprects == 1);
- assert(cliprects == &intel->fboRect);
- clear.x1 = cx;
- clear.y1 = cy;
- clear.x2 = clear.x1 + cw;
- clear.y2 = clear.y1 + ch;
- /* no change to mask */
+ else
+ cy = ctx->DrawBuffer->Height - fb->_Ymax;
+ cw = fb->_Xmax - fb->_Xmin;
+ ch = fb->_Ymax - fb->_Ymin;
+
+ if (cw == 0 || ch == 0)
+ return;
+
+ GLuint buf;
+ all = (cw == fb->Width && ch == fb->Height);
+
+ /* Loop over all renderbuffers */
+ for (buf = 0; buf < BUFFER_COUNT && mask; buf++) {
+ const GLbitfield bufBit = 1 << buf;
+ struct intel_renderbuffer *irb;
+ drm_intel_bo *write_buffer;
+ int x1, y1, x2, y2;
+ uint32_t clear_val;
+ uint32_t BR13, CMD;
+ int pitch, cpp;
+
+ if (!(mask & bufBit))
+ continue;
+
+ /* OK, clear this renderbuffer */
+ irb = intel_get_renderbuffer(fb, buf);
+ write_buffer = intel_region_buffer(intel, irb->region,
+ all ? INTEL_WRITE_FULL :
+ INTEL_WRITE_PART);
+ x1 = cx + irb->region->draw_x;
+ y1 = cy + irb->region->draw_y;
+ x2 = cx + cw + irb->region->draw_x;
+ y2 = cy + ch + irb->region->draw_y;
+
+ pitch = irb->region->pitch;
+ cpp = irb->region->cpp;
+
+ DBG("%s dst:buf(%p)/%d %d,%d sz:%dx%d\n",
+ __FUNCTION__,
+ irb->region->buffer, (pitch * cpp),
+ x1, y1, x2 - x1, y2 - y1);
+
+ BR13 = 0xf0 << 16;
+ CMD = XY_COLOR_BLT_CMD;
+
+ /* Setup the blit command */
+ if (cpp == 4) {
+ BR13 |= BR13_8888;
+ if (buf == BUFFER_DEPTH || buf == BUFFER_STENCIL) {
+ if (mask & BUFFER_BIT_DEPTH)
+ CMD |= XY_BLT_WRITE_RGB;
+ if (mask & BUFFER_BIT_STENCIL)
+ CMD |= XY_BLT_WRITE_ALPHA;
+ } else {
+ /* clearing RGBA */
+ CMD |= XY_BLT_WRITE_ALPHA | XY_BLT_WRITE_RGB;
+ }
+ } else {
+ ASSERT(cpp == 2);
+ BR13 |= BR13_565;
}
- for (i = 0; i < num_cliprects; i++) {
- const drm_clip_rect_t *box = &cliprects[i];
- drm_clip_rect_t b;
- GLuint buf;
- GLuint clearMask = mask; /* use copy, since we modify it below */
- GLboolean all = (cw == fb->Width && ch == fb->Height);
-
- if (!all) {
- intel_intersect_cliprects(&b, &clear, box);
- }
- else {
- b = *box;
- }
-
- if (b.x1 >= b.x2 || b.y1 >= b.y2)
- continue;
-
- if (0)
- _mesa_printf("clear %d,%d..%d,%d, mask %x\n",
- b.x1, b.y1, b.x2, b.y2, mask);
-
- /* Loop over all renderbuffers */
- for (buf = 0; buf < BUFFER_COUNT && clearMask; buf++) {
- const GLbitfield bufBit = 1 << buf;
- if ((clearMask & bufBit) && !(bufBit & skipBuffers)) {
- /* OK, clear this renderbuffer */
- struct intel_renderbuffer *irb = intel_get_renderbuffer(fb, buf);
- dri_bo *write_buffer =
- intel_region_buffer(intel, irb->region,
- all ? INTEL_WRITE_FULL :
- INTEL_WRITE_PART);
- int x1 = b.x1 + irb->region->draw_x;
- int y1 = b.y1 + irb->region->draw_y;
- int x2 = b.x2 + irb->region->draw_x;
- int y2 = b.y2 + irb->region->draw_y;
-
- GLuint clearVal;
- GLint pitch, cpp;
- GLuint BR13, CMD;
-
- pitch = irb->region->pitch;
- cpp = irb->region->cpp;
-
- DBG("%s dst:buf(%p)/%d %d,%d sz:%dx%d\n",
- __FUNCTION__,
- irb->region->buffer, (pitch * cpp),
- x1, y1, x2 - x1, y2 - y1);
-
- BR13 = 0xf0 << 16;
- CMD = XY_COLOR_BLT_CMD;
-
- /* Setup the blit command */
- if (cpp == 4) {
- BR13 |= BR13_8888;
- if (buf == BUFFER_DEPTH || buf == BUFFER_STENCIL) {
- if (clearMask & BUFFER_BIT_DEPTH)
- CMD |= XY_BLT_WRITE_RGB;
- if (clearMask & BUFFER_BIT_STENCIL)
- CMD |= XY_BLT_WRITE_ALPHA;
- }
- else {
- /* clearing RGBA */
- CMD |= XY_BLT_WRITE_ALPHA | XY_BLT_WRITE_RGB;
- }
- }
- else {
- ASSERT(cpp == 2);
- BR13 |= BR13_565;
- }
-
- assert(irb->region->tiling != I915_TILING_Y);
+ assert(irb->region->tiling != I915_TILING_Y);
#ifndef I915
- if (irb->region->tiling != I915_TILING_NONE) {
- CMD |= XY_DST_TILED;
- pitch /= 4;
- }
+ if (irb->region->tiling != I915_TILING_NONE) {
+ CMD |= XY_DST_TILED;
+ pitch /= 4;
+ }
#endif
- BR13 |= (pitch * cpp);
-
- if (buf == BUFFER_DEPTH || buf == BUFFER_STENCIL) {
- clearVal = clear_depth;
- }
- else {
- uint8_t clear[4];
- GLclampf *color = ctx->Color.ClearColor;
-
- CLAMPED_FLOAT_TO_UBYTE(clear[0], color[0]);
- CLAMPED_FLOAT_TO_UBYTE(clear[1], color[1]);
- CLAMPED_FLOAT_TO_UBYTE(clear[2], color[2]);
- CLAMPED_FLOAT_TO_UBYTE(clear[3], color[3]);
-
- switch (irb->Base.Format) {
- case MESA_FORMAT_ARGB8888:
- case MESA_FORMAT_XRGB8888:
- clearVal = PACK_COLOR_8888(clear[3], clear[0],
- clear[1], clear[2]);
- break;
- case MESA_FORMAT_RGB565:
- clearVal = PACK_COLOR_565(clear[0], clear[1], clear[2]);
- break;
- case MESA_FORMAT_ARGB4444:
- clearVal = PACK_COLOR_4444(clear[3], clear[0],
- clear[1], clear[2]);
- break;
- case MESA_FORMAT_ARGB1555:
- clearVal = PACK_COLOR_1555(clear[3], clear[0],
- clear[1], clear[2]);
- break;
- default:
- _mesa_problem(ctx, "Unexpected renderbuffer format: %d\n",
- irb->Base.Format);
- clearVal = 0;
- }
- }
-
- /*
- _mesa_debug(ctx, "hardware blit clear buf %d rb id %d\n",
- buf, irb->Base.Name);
- */
-
- assert(x1 < x2);
- assert(y1 < y2);
-
- BEGIN_BATCH(6);
- OUT_BATCH(CMD);
- OUT_BATCH(BR13);
- OUT_BATCH((y1 << 16) | x1);
- OUT_BATCH((y2 << 16) | x2);
- OUT_RELOC(write_buffer,
- I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
- 0);
- OUT_BATCH(clearVal);
- ADVANCE_BATCH();
- clearMask &= ~bufBit; /* turn off bit, for faster loop exit */
- }
- }
+ BR13 |= (pitch * cpp);
+
+ if (buf == BUFFER_DEPTH || buf == BUFFER_STENCIL) {
+ clear_val = clear_depth;
+ } else {
+ uint8_t clear[4];
+ GLclampf *color = ctx->Color.ClearColor;
+
+ CLAMPED_FLOAT_TO_UBYTE(clear[0], color[0]);
+ CLAMPED_FLOAT_TO_UBYTE(clear[1], color[1]);
+ CLAMPED_FLOAT_TO_UBYTE(clear[2], color[2]);
+ CLAMPED_FLOAT_TO_UBYTE(clear[3], color[3]);
+
+ switch (irb->Base.Format) {
+ case MESA_FORMAT_ARGB8888:
+ case MESA_FORMAT_XRGB8888:
+ clear_val = PACK_COLOR_8888(clear[3], clear[0],
+ clear[1], clear[2]);
+ break;
+ case MESA_FORMAT_RGB565:
+ clear_val = PACK_COLOR_565(clear[0], clear[1], clear[2]);
+ break;
+ case MESA_FORMAT_ARGB4444:
+ clear_val = PACK_COLOR_4444(clear[3], clear[0],
+ clear[1], clear[2]);
+ break;
+ case MESA_FORMAT_ARGB1555:
+ clear_val = PACK_COLOR_1555(clear[3], clear[0],
+ clear[1], clear[2]);
+ break;
+ default:
+ _mesa_problem(ctx, "Unexpected renderbuffer format: %d\n",
+ irb->Base.Format);
+ clear_val = 0;
+ }
}
+
+ assert(x1 < x2);
+ assert(y1 < y2);
+
+ BEGIN_BATCH(6);
+ OUT_BATCH(CMD);
+ OUT_BATCH(BR13);
+ OUT_BATCH((y1 << 16) | x1);
+ OUT_BATCH((y2 << 16) | x2);
+ OUT_RELOC(write_buffer,
+ I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
+ 0);
+ OUT_BATCH(clear_val);
+ ADVANCE_BATCH();
+
+ if (buf == BUFFER_DEPTH || buf == BUFFER_STENCIL)
+ mask &= ~(BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL);
+ else
+ mask &= ~bufBit; /* turn off bit, for faster loop exit */
}
}
diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c b/src/mesa/drivers/dri/intel/intel_buffers.c
index 7c4b79f743a..5bf0bdb9635 100644
--- a/src/mesa/drivers/dri/intel/intel_buffers.c
+++ b/src/mesa/drivers/dri/intel/intel_buffers.c
@@ -28,45 +28,8 @@
#include "intel_context.h"
#include "intel_buffers.h"
#include "intel_fbo.h"
-#include "intel_regions.h"
#include "intel_batchbuffer.h"
#include "main/framebuffer.h"
-#include "drirenderbuffer.h"
-
-
-/**
- * XXX move this into a new dri/common/cliprects.c file.
- */
-GLboolean
-intel_intersect_cliprects(drm_clip_rect_t * dst,
- const drm_clip_rect_t * a,
- const drm_clip_rect_t * b)
-{
- GLint bx = b->x1;
- GLint by = b->y1;
- GLint bw = b->x2 - bx;
- GLint bh = b->y2 - by;
-
- if (bx < a->x1)
- bw -= a->x1 - bx, bx = a->x1;
- if (by < a->y1)
- bh -= a->y1 - by, by = a->y1;
- if (bx + bw > a->x2)
- bw = a->x2 - bx;
- if (by + bh > a->y2)
- bh = a->y2 - by;
- if (bw <= 0)
- return GL_FALSE;
- if (bh <= 0)
- return GL_FALSE;
-
- dst->x1 = bx;
- dst->y1 = by;
- dst->x2 = bx + bw;
- dst->y2 = by + bh;
-
- return GL_TRUE;
-}
/**
* Return pointer to current color drawing region, or NULL.
@@ -96,24 +59,6 @@ intel_readbuf_region(struct intel_context *intel)
return NULL;
}
-void
-intel_get_cliprects(struct intel_context *intel,
- struct drm_clip_rect **cliprects,
- unsigned int *num_cliprects,
- int *x_off, int *y_off)
-{
- intel->fboRect.x1 = 0;
- intel->fboRect.y1 = 0;
- intel->fboRect.x2 = intel->ctx.DrawBuffer->Width;
- intel->fboRect.y2 = intel->ctx.DrawBuffer->Height;
-
- *cliprects = &intel->fboRect;
- *num_cliprects = 1;
- *x_off = 0;
- *y_off = 0;
-}
-
-
/**
* Check if we're about to draw into the front color buffer.
* If so, set the intel->front_buffer_dirty field to true.
diff --git a/src/mesa/drivers/dri/intel/intel_buffers.h b/src/mesa/drivers/dri/intel/intel_buffers.h
index d7800f2ca2f..abb86aade60 100644
--- a/src/mesa/drivers/dri/intel/intel_buffers.h
+++ b/src/mesa/drivers/dri/intel/intel_buffers.h
@@ -35,12 +35,6 @@
struct intel_context;
struct intel_framebuffer;
-
-extern GLboolean
-intel_intersect_cliprects(drm_clip_rect_t * dest,
- const drm_clip_rect_t * a,
- const drm_clip_rect_t * b);
-
extern struct intel_region *intel_readbuf_region(struct intel_context *intel);
extern struct intel_region *intel_drawbuf_region(struct intel_context *intel);
diff --git a/src/mesa/drivers/dri/intel/intel_clear.c b/src/mesa/drivers/dri/intel/intel_clear.c
index 956f2339ff0..ca78681538c 100644
--- a/src/mesa/drivers/dri/intel/intel_clear.c
+++ b/src/mesa/drivers/dri/intel/intel_clear.c
@@ -33,12 +33,9 @@
#include "intel_context.h"
#include "intel_blit.h"
-#include "intel_chipset.h"
#include "intel_clear.h"
#include "intel_fbo.h"
-#include "intel_pixel.h"
#include "intel_regions.h"
-#include "intel_batchbuffer.h"
#define FILE_DEBUG_FLAG DEBUG_BLIT
diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index d52fe2eef2c..3896bfa091e 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -28,7 +28,6 @@
#include "main/glheader.h"
#include "main/context.h"
-#include "main/arrayobj.h"
#include "main/extensions.h"
#include "main/framebuffer.h"
#include "main/imports.h"
@@ -506,7 +505,28 @@ intelFlush(GLcontext * ctx)
static void
intel_glFlush(GLcontext *ctx)
{
+ struct intel_context *intel = intel_context(ctx);
+
intel_flush(ctx, GL_TRUE);
+
+ /* We're using glFlush as an indicator that a frame is done, which is
+ * what DRI2 does before calling SwapBuffers (and means we should catch
+ * people doing front-buffer rendering, as well)..
+ *
+ * Wait for the swapbuffers before the one we just emitted, so we don't
+ * get too many swaps outstanding for apps that are GPU-heavy but not
+ * CPU-heavy.
+ *
+ * Unfortunately, we don't have a handle to the batch containing the swap,
+ * and getting our hands on that doesn't seem worth it, so we just us the
+ * first batch we emitted after the last swap.
+ */
+ if (!intel->using_dri2_swapbuffers &&
+ intel->first_post_swapbuffers_batch != NULL) {
+ drm_intel_bo_wait_rendering(intel->first_post_swapbuffers_batch);
+ drm_intel_bo_unreference(intel->first_post_swapbuffers_batch);
+ intel->first_post_swapbuffers_batch = NULL;
+ }
}
void
diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h
index 6ba281cc144..8d7c95976f8 100644
--- a/src/mesa/drivers/dri/intel/intel_context.h
+++ b/src/mesa/drivers/dri/intel/intel_context.h
@@ -186,6 +186,7 @@ struct intel_context
struct intel_batchbuffer *batch;
drm_intel_bo *first_post_swapbuffers_batch;
GLboolean no_batch_wrap;
+ GLboolean using_dri2_swapbuffers;
struct
{
@@ -272,10 +273,6 @@ struct intel_context
GLboolean use_texture_tiling;
GLboolean use_early_z;
- drm_clip_rect_t fboRect; /**< cliprect for FBO rendering */
-
- drm_clip_rect_t draw_rect;
- drm_clip_rect_t scissor_rect;
int driFd;
diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c
index 5ac5ce10afb..84c8d013e30 100644
--- a/src/mesa/drivers/dri/intel/intel_extensions.c
+++ b/src/mesa/drivers/dri/intel/intel_extensions.c
@@ -48,6 +48,7 @@
#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_framebuffer_blit
@@ -154,12 +155,14 @@ static const struct dri_extension brw_extensions[] = {
{ "GL_ARB_fragment_program_shadow", NULL },
{ "GL_ARB_fragment_shader", NULL },
{ "GL_ARB_framebuffer_object", GL_ARB_framebuffer_object_functions},
+ { "GL_ARB_half_float_vertex", NULL },
{ "GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions },
{ "GL_ARB_point_sprite", NULL },
{ "GL_ARB_seamless_cube_map", NULL },
{ "GL_ARB_shadow", NULL },
{ "GL_MESA_texture_signed_rgba", NULL },
{ "GL_ARB_texture_non_power_of_two", NULL },
+ { "GL_EXT_draw_buffers2", GL_EXT_draw_buffers2_functions },
{ "GL_EXT_shadow_funcs", NULL },
{ "GL_EXT_stencil_two_side", GL_EXT_stencil_two_side_functions },
{ "GL_EXT_texture_sRGB", NULL },
diff --git a/src/mesa/drivers/dri/intel/intel_pixel.c b/src/mesa/drivers/dri/intel/intel_pixel.c
index 5142f3dcd99..cb088e40329 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel.c
@@ -29,14 +29,7 @@
#include "main/state.h"
#include "main/bufferobj.h"
#include "main/context.h"
-#include "main/enable.h"
-#include "main/matrix.h"
-#include "main/texstate.h"
-#include "main/varray.h"
-#include "main/viewport.h"
#include "swrast/swrast.h"
-#include "shader/arbprogram.h"
-#include "shader/program.h"
#include "intel_context.h"
#include "intel_pixel.h"
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
index 85e5ad2cdd4..1e517650b7a 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c
@@ -37,7 +37,6 @@
#include "main/polygon.h"
#include "main/state.h"
#include "main/teximage.h"
-#include "main/texenv.h"
#include "main/texobj.h"
#include "main/texstate.h"
#include "main/texparam.h"
@@ -46,7 +45,6 @@
#include "main/enable.h"
#include "main/viewport.h"
#include "shader/arbprogram.h"
-#include "glapi/dispatch.h"
#include "swrast/swrast.h"
#include "intel_screen.h"
@@ -54,7 +52,6 @@
#include "intel_batchbuffer.h"
#include "intel_blit.h"
#include "intel_regions.h"
-#include "intel_buffer_objects.h"
#include "intel_buffers.h"
#include "intel_pixel.h"
#include "intel_reg.h"
@@ -106,7 +103,7 @@ static void set_bit( GLubyte *dest, GLuint bit )
}
/* Extract a rectangle's worth of data from the bitmap. Called
- * per-cliprect.
+ * per chunk of HW-sized bitmap.
*/
static GLuint get_bitmap_rect(GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *unpack,
@@ -191,11 +188,12 @@ do_blit_bitmap( GLcontext *ctx,
GLfloat tmpColor[4];
GLubyte ubcolor[4];
GLuint color;
- unsigned int num_cliprects;
- drm_clip_rect_t *cliprects;
- int x_off, y_off;
GLsizei bitmap_width = width;
GLsizei bitmap_height = height;
+ GLint px, py;
+ GLuint stipple[32];
+ GLint orig_dstx = dstx;
+ GLint orig_dsty = dsty;
/* Update draw buffer bounds */
_mesa_update_state(ctx);
@@ -236,90 +234,60 @@ do_blit_bitmap( GLcontext *ctx,
if (!intel_check_blit_fragment_ops(ctx, tmpColor[3] == 1.0F))
return GL_FALSE;
- intel_get_cliprects(intel, &cliprects, &num_cliprects, &x_off, &y_off);
- if (num_cliprects != 0) {
- GLuint i;
- GLint orig_dstx = dstx;
- GLint orig_dsty = dsty;
-
- /* Clip to buffer bounds and scissor. */
- if (!_mesa_clip_to_region(fb->_Xmin, fb->_Ymin,
- fb->_Xmax, fb->_Ymax,
- &dstx, &dsty, &width, &height))
- goto out;
-
- dstx = x_off + dstx;
- dsty = y_off + y_flip(fb, dsty, height);
-
- for (i = 0; i < num_cliprects; i++) {
- int box_x, box_y, box_w, box_h;
- GLint px, py;
- GLuint stipple[32];
-
- box_x = dstx;
- box_y = dsty;
- box_w = width;
- box_h = height;
-
- /* Clip to drawable cliprect */
- if (!_mesa_clip_to_region(cliprects[i].x1,
- cliprects[i].y1,
- cliprects[i].x2,
- cliprects[i].y2,
- &box_x, &box_y, &box_w, &box_h))
- continue;
+ /* Clip to buffer bounds and scissor. */
+ if (!_mesa_clip_to_region(fb->_Xmin, fb->_Ymin,
+ fb->_Xmax, fb->_Ymax,
+ &dstx, &dsty, &width, &height))
+ goto out;
+
+ dsty = y_flip(fb, dsty, height);
#define DY 32
#define DX 32
- /* Then, finally, chop it all into chunks that can be
- * digested by hardware:
+ /* Chop it all into chunks that can be digested by hardware: */
+ for (py = 0; py < height; py += DY) {
+ for (px = 0; px < width; px += DX) {
+ int h = MIN2(DY, height - py);
+ int w = MIN2(DX, width - px);
+ GLuint sz = ALIGN(ALIGN(w,8) * h, 64)/8;
+ GLenum logic_op = ctx->Color.ColorLogicOpEnabled ?
+ ctx->Color.LogicOp : GL_COPY;
+
+ assert(sz <= sizeof(stipple));
+ memset(stipple, 0, sz);
+
+ /* May need to adjust this when padding has been introduced in
+ * sz above:
+ *
+ * Have to translate destination coordinates back into source
+ * coordinates.
*/
- for (py = 0; py < box_h; py += DY) {
- for (px = 0; px < box_w; px += DX) {
- int h = MIN2(DY, box_h - py);
- int w = MIN2(DX, box_w - px);
- GLuint sz = ALIGN(ALIGN(w,8) * h, 64)/8;
- GLenum logic_op = ctx->Color.ColorLogicOpEnabled ?
- ctx->Color.LogicOp : GL_COPY;
-
- assert(sz <= sizeof(stipple));
- memset(stipple, 0, sz);
-
- /* May need to adjust this when padding has been introduced in
- * sz above:
- *
- * Have to translate destination coordinates back into source
- * coordinates.
- */
- if (get_bitmap_rect(bitmap_width, bitmap_height, unpack,
- bitmap,
- -orig_dstx + (box_x + px - x_off),
- -orig_dsty + y_flip(fb,
- box_y + py - y_off, h),
- w, h,
- (GLubyte *)stipple,
- 8,
- fb->Name == 0 ? GL_TRUE : GL_FALSE) == 0)
- continue;
-
- if (!intelEmitImmediateColorExpandBlit(intel,
- dst->cpp,
- (GLubyte *)stipple,
- sz,
- color,
- dst->pitch,
- dst->buffer,
- 0,
- dst->tiling,
- box_x + px,
- box_y + py,
- w, h,
- logic_op)) {
- return GL_FALSE;
- }
- }
- }
+ if (get_bitmap_rect(bitmap_width, bitmap_height, unpack,
+ bitmap,
+ -orig_dstx + (dstx + px),
+ -orig_dsty + y_flip(fb, dsty + py, h),
+ w, h,
+ (GLubyte *)stipple,
+ 8,
+ fb->Name == 0 ? GL_TRUE : GL_FALSE) == 0)
+ continue;
+
+ if (!intelEmitImmediateColorExpandBlit(intel,
+ dst->cpp,
+ (GLubyte *)stipple,
+ sz,
+ color,
+ dst->pitch,
+ dst->buffer,
+ 0,
+ dst->tiling,
+ dstx + px,
+ dsty + py,
+ w, h,
+ logic_op)) {
+ return GL_FALSE;
+ }
}
}
out:
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_copy.c b/src/mesa/drivers/dri/intel/intel_pixel_copy.c
index e002516cdd0..87c293d8b07 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_copy.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_copy.c
@@ -112,9 +112,10 @@ do_blit_copypixels(GLcontext * ctx,
struct intel_region *src = copypix_src_region(intel, type);
struct gl_framebuffer *fb = ctx->DrawBuffer;
struct gl_framebuffer *read_fb = ctx->ReadBuffer;
- unsigned int num_cliprects;
- drm_clip_rect_t *cliprects;
- int x_off, y_off;
+ GLint orig_dstx;
+ GLint orig_dsty;
+ GLint orig_srcx;
+ GLint orig_srcy;
if (type == GL_DEPTH || type == GL_STENCIL) {
if (INTEL_DEBUG & DEBUG_FALLBACKS)
@@ -135,94 +136,56 @@ do_blit_copypixels(GLcontext * ctx,
if (!src || !dst)
return GL_FALSE;
-
-
intelFlush(&intel->ctx);
- intel_get_cliprects(intel, &cliprects, &num_cliprects, &x_off, &y_off);
- if (num_cliprects != 0) {
- GLint delta_x;
- GLint delta_y;
- GLint orig_dstx;
- GLint orig_dsty;
- GLint orig_srcx;
- GLint orig_srcy;
- GLuint i;
-
- /* XXX: We fail to handle different inversion between read and draw framebuffer. */
-
- /* Clip to destination buffer. */
- orig_dstx = dstx;
- orig_dsty = dsty;
- if (!_mesa_clip_to_region(fb->_Xmin, fb->_Ymin,
- fb->_Xmax, fb->_Ymax,
- &dstx, &dsty, &width, &height))
- goto out;
- /* Adjust src coords for our post-clipped destination origin */
- srcx += dstx - orig_dstx;
- srcy += dsty - orig_dsty;
-
- /* Clip to source buffer. */
- orig_srcx = srcx;
- orig_srcy = srcy;
- if (!_mesa_clip_to_region(0, 0,
- read_fb->Width, read_fb->Height,
- &srcx, &srcy, &width, &height))
- goto out;
- /* Adjust dst coords for our post-clipped source origin */
- dstx += srcx - orig_srcx;
- dsty += srcy - orig_srcy;
-
- /* Convert from GL to hardware coordinates:
- */
- if (fb->Name == 0) {
- /* copypixels to a system framebuffer */
- dstx = x_off + dstx;
- dsty = y_off + (fb->Height - dsty - height);
- } else {
- /* copypixels to a user framebuffer object */
- dstx = x_off + dstx;
- dsty = y_off + dsty;
- }
-
- /* Flip source Y if it's a system framebuffer. */
- if (read_fb->Name == 0) {
- srcx = intel->driReadDrawable->x + srcx;
- srcy = intel->driReadDrawable->y + (fb->Height - srcy - height);
- }
-
- delta_x = srcx - dstx;
- delta_y = srcy - dsty;
- /* Could do slightly more clipping: Eg, take the intersection of
- * the destination cliprects and the read drawable cliprects
- *
- * This code will not overwrite other windows, but will
- * introduce garbage when copying from obscured window regions.
- */
- for (i = 0; i < num_cliprects; i++) {
- GLint clip_x = dstx;
- GLint clip_y = dsty;
- GLint clip_w = width;
- GLint clip_h = height;
-
- if (!_mesa_clip_to_region(cliprects[i].x1, cliprects[i].y1,
- cliprects[i].x2, cliprects[i].y2,
- &clip_x, &clip_y, &clip_w, &clip_h))
- continue;
-
- if (!intel_region_copy(intel,
- dst, 0, clip_x, clip_y,
- src, 0, clip_x + delta_x, clip_y + delta_y,
- clip_w, clip_h,
- ctx->Color.ColorLogicOpEnabled ?
- ctx->Color.LogicOp : GL_COPY)) {
- DBG("%s: blit failure\n", __FUNCTION__);
- return GL_FALSE;
- }
- }
+ /* XXX: We fail to handle different inversion between read and draw framebuffer. */
+
+ /* Clip to destination buffer. */
+ orig_dstx = dstx;
+ orig_dsty = dsty;
+ if (!_mesa_clip_to_region(fb->_Xmin, fb->_Ymin,
+ fb->_Xmax, fb->_Ymax,
+ &dstx, &dsty, &width, &height))
+ goto out;
+ /* Adjust src coords for our post-clipped destination origin */
+ srcx += dstx - orig_dstx;
+ srcy += dsty - orig_dsty;
+
+ /* Clip to source buffer. */
+ orig_srcx = srcx;
+ orig_srcy = srcy;
+ if (!_mesa_clip_to_region(0, 0,
+ read_fb->Width, read_fb->Height,
+ &srcx, &srcy, &width, &height))
+ goto out;
+ /* Adjust dst coords for our post-clipped source origin */
+ dstx += srcx - orig_srcx;
+ dsty += srcy - orig_srcy;
+
+ /* Convert from GL to hardware coordinates: */
+ if (fb->Name == 0) {
+ /* copypixels to a system framebuffer */
+ dsty = fb->Height - dsty - height;
+ } else {
+ /* copypixels to a user framebuffer object */
+ dsty = dsty;
}
-out:
+ /* Flip source Y if it's a system framebuffer. */
+ if (read_fb->Name == 0)
+ srcy = fb->Height - srcy - height;
+
+ if (!intel_region_copy(intel,
+ dst, 0, dstx, dsty,
+ src, 0, srcx, srcy,
+ width, height,
+ ctx->Color.ColorLogicOpEnabled ?
+ ctx->Color.LogicOp : GL_COPY)) {
+ DBG("%s: blit failure\n", __FUNCTION__);
+ return GL_FALSE;
+ }
+
+out:
intel_check_front_buffer_rendering(intel);
DBG("%s: success\n", __FUNCTION__);
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_draw.c b/src/mesa/drivers/dri/intel/intel_pixel_draw.c
index b870e9315e0..7e82c5b8aa2 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_draw.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_draw.c
@@ -46,10 +46,7 @@
#include "drivers/common/meta.h"
#include "intel_context.h"
-#include "intel_batchbuffer.h"
-#include "intel_blit.h"
#include "intel_buffers.h"
-#include "intel_regions.h"
#include "intel_pixel.h"
#include "intel_fbo.h"
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_read.c b/src/mesa/drivers/dri/intel/intel_pixel_read.c
index 9c0fdc6067c..80a2b9740fb 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_read.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_read.c
@@ -36,7 +36,6 @@
#include "intel_screen.h"
#include "intel_context.h"
-#include "intel_batchbuffer.h"
#include "intel_blit.h"
#include "intel_buffers.h"
#include "intel_regions.h"
@@ -169,6 +168,9 @@ do_blit_readpixels(GLcontext * ctx,
struct intel_buffer_object *dst = intel_buffer_object(pack->BufferObj);
GLuint dst_offset;
GLuint rowLength;
+ drm_intel_bo *dst_buffer;
+ GLboolean all;
+ GLint dst_x, dst_y;
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s\n", __FUNCTION__);
@@ -209,56 +211,42 @@ do_blit_readpixels(GLcontext * ctx,
return GL_FALSE;
}
else {
- rowLength = -rowLength;
+ if (ctx->ReadBuffer->Name == 0)
+ rowLength = -rowLength;
}
dst_offset = (GLintptr) _mesa_image_address(2, pack, pixels, width, height,
format, type, 0, 0, 0);
+ if (!_mesa_clip_copytexsubimage(ctx,
+ &dst_x, &dst_y,
+ &x, &y,
+ &width, &height)) {
+ return GL_TRUE;
+ }
- /* Although the blits go on the command buffer, need to do this and
- * fire with lock held to guarentee cliprects are correct.
- */
- intelFlush(&intel->ctx);
-
- if (intel->driReadDrawable->numClipRects) {
- GLboolean all = (width * height * src->cpp == dst->Base.Size &&
- x == 0 && dst_offset == 0);
-
- dri_bo *dst_buffer = intel_bufferobj_buffer(intel, dst,
- all ? INTEL_WRITE_FULL :
- INTEL_WRITE_PART);
- __DRIdrawable *dPriv = intel->driReadDrawable;
- int nbox = dPriv->numClipRects;
- drm_clip_rect_t *box = dPriv->pClipRects;
- drm_clip_rect_t rect;
- drm_clip_rect_t src_rect;
- int i;
-
- src_rect.x1 = dPriv->x + x;
- src_rect.y1 = dPriv->y + dPriv->h - (y + height);
- src_rect.x2 = src_rect.x1 + width;
- src_rect.y2 = src_rect.y1 + height;
-
-
-
- for (i = 0; i < nbox; i++) {
- if (!intel_intersect_cliprects(&rect, &src_rect, &box[i]))
- continue;
-
- if (!intelEmitCopyBlit(intel,
- src->cpp,
- src->pitch, src->buffer, 0, src->tiling,
- rowLength, dst_buffer, dst_offset, GL_FALSE,
- rect.x1,
- rect.y1,
- rect.x1 - src_rect.x1,
- rect.y2 - src_rect.y2,
- rect.x2 - rect.x1, rect.y2 - rect.y1,
- GL_COPY)) {
- return GL_FALSE;
- }
- }
+ all = (width * height * src->cpp == dst->Base.Size &&
+ x == 0 && dst_offset == 0);
+
+ dst_x = 0;
+ dst_y = 0;
+
+ dst_buffer = intel_bufferobj_buffer(intel, dst,
+ all ? INTEL_WRITE_FULL :
+ INTEL_WRITE_PART);
+
+ if (ctx->ReadBuffer->Name == 0)
+ y = ctx->ReadBuffer->Height - (y + height);
+
+ if (!intelEmitCopyBlit(intel,
+ src->cpp,
+ src->pitch, src->buffer, 0, src->tiling,
+ rowLength, dst_buffer, dst_offset, GL_FALSE,
+ x, y,
+ dst_x, dst_y,
+ width, height,
+ GL_COPY)) {
+ return GL_FALSE;
}
if (INTEL_DEBUG & DEBUG_PIXEL)
diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c
index 61aefa01b8a..f415589c5da 100644
--- a/src/mesa/drivers/dri/intel/intel_regions.c
+++ b/src/mesa/drivers/dri/intel/intel_regions.c
@@ -48,7 +48,6 @@
#include "intel_buffer_objects.h"
#include "intel_bufmgr.h"
#include "intel_batchbuffer.h"
-#include "intel_chipset.h"
#define FILE_DEBUG_FLAG DEBUG_REGION
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
index 6c2cb3b57e2..96e7f2885a3 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -37,11 +37,9 @@
#include "intel_buffers.h"
#include "intel_bufmgr.h"
#include "intel_chipset.h"
-#include "intel_extensions.h"
#include "intel_fbo.h"
#include "intel_regions.h"
#include "intel_screen.h"
-#include "intel_span.h"
#include "intel_tex.h"
#include "i915_drm.h"
@@ -130,27 +128,12 @@ intelDRI2FlushInvalidate(__DRIdrawable *drawable)
{
struct intel_context *intel = drawable->driContextPriv->driverPrivate;
+ intel->using_dri2_swapbuffers = GL_TRUE;
+
intelDRI2Flush(drawable);
drawable->validBuffers = GL_FALSE;
- /* We're using FlushInvalidate as an indicator that a frame is
- * done. It's only called immediately after SwapBuffers, so it
- * won't affect front-buffer rendering or applications explicitly
- * managing swap regions using MESA_copy_buffer.
- *
- * Wait for the swapbuffers before the one we just emitted, so we don't
- * get too many swaps outstanding for apps that are GPU-heavy but not
- * CPU-heavy.
- *
- * Unfortunately, we don't have a handle to the batch containing the swap,
- * and getting our hands on that doesn't seem worth it, so we just use the
- * first batch we emitted after the last swap.
- */
- if (intel->first_post_swapbuffers_batch != NULL) {
- drm_intel_bo_wait_rendering(intel->first_post_swapbuffers_batch);
- drm_intel_bo_unreference(intel->first_post_swapbuffers_batch);
- intel->first_post_swapbuffers_batch = NULL;
- }
+ intel_update_renderbuffers(intel->driContext, drawable);
}
static const struct __DRI2flushExtensionRec intelFlushExtension = {
diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c
index 605734d8e58..d925cb9997f 100644
--- a/src/mesa/drivers/dri/intel/intel_span.c
+++ b/src/mesa/drivers/dri/intel/intel_span.c
@@ -259,36 +259,20 @@ static uint32_t y_tile_swizzle(struct intel_renderbuffer *irb,
#define DBG 0
#define LOCAL_VARS \
- struct intel_context *intel = intel_context(ctx); \
struct intel_renderbuffer *irb = intel_renderbuffer(rb); \
const GLint yScale = ctx->DrawBuffer->Name ? 1 : -1; \
const GLint yBias = ctx->DrawBuffer->Name ? 0 : irb->Base.Height - 1;\
- unsigned int num_cliprects; \
- struct drm_clip_rect *cliprects; \
- int x_off, y_off; \
+ int minx = 0, miny = 0; \
+ int maxx = ctx->DrawBuffer->Width; \
+ int maxy = ctx->DrawBuffer->Height; \
int pitch = irb->region->pitch * irb->region->cpp; \
void *buf = irb->region->buffer->virtual; \
GLuint p; \
(void) p; \
(void)buf; (void)pitch; /* unused for non-gttmap. */ \
- intel_get_cliprects(intel, &cliprects, &num_cliprects, &x_off, &y_off);
-/* XXX FBO: this is identical to the macro in spantmp2.h except we get
- * the cliprect info from the context, not the driDrawable.
- * Move this into spantmp2.h someday.
- */
-#define HW_CLIPLOOP() \
- do { \
- int _nc = num_cliprects; \
- while ( _nc-- ) { \
- int minx = cliprects[_nc].x1 - x_off; \
- int miny = cliprects[_nc].y1 - y_off; \
- int maxx = cliprects[_nc].x2 - x_off; \
- int maxy = cliprects[_nc].y2 - y_off;
-
-#if 0
- }}
-#endif
+#define HW_CLIPLOOP()
+#define HW_ENDCLIPLOOP()
#define Y_FLIP(_y) ((_y) * yScale + yBias)
@@ -297,9 +281,9 @@ static uint32_t y_tile_swizzle(struct intel_renderbuffer *irb,
#define HW_UNLOCK()
/* Convenience macros to avoid typing the swizzle argument over and over */
-#define NO_TILE(_X, _Y) no_tile_swizzle(irb, (_X) + x_off, (_Y) + y_off)
-#define X_TILE(_X, _Y) x_tile_swizzle(irb, (_X) + x_off, (_Y) + y_off)
-#define Y_TILE(_X, _Y) y_tile_swizzle(irb, (_X) + x_off, (_Y) + y_off)
+#define NO_TILE(_X, _Y) no_tile_swizzle(irb, (_X), (_Y))
+#define X_TILE(_X, _Y) x_tile_swizzle(irb, (_X), (_Y))
+#define Y_TILE(_X, _Y) y_tile_swizzle(irb, (_X), (_Y))
/* r5g6b5 color span and pixel functions */
#define INTEL_PIXEL_FMT GL_RGB
@@ -342,18 +326,15 @@ static uint32_t y_tile_swizzle(struct intel_renderbuffer *irb,
#include "intel_spantmp.h"
#define LOCAL_DEPTH_VARS \
- struct intel_context *intel = intel_context(ctx); \
struct intel_renderbuffer *irb = intel_renderbuffer(rb); \
const GLint yScale = ctx->DrawBuffer->Name ? 1 : -1; \
const GLint yBias = ctx->DrawBuffer->Name ? 0 : irb->Base.Height - 1;\
- unsigned int num_cliprects; \
- struct drm_clip_rect *cliprects; \
- int x_off, y_off; \
+ int minx = 0, miny = 0; \
+ int maxx = ctx->DrawBuffer->Width; \
+ int maxy = ctx->DrawBuffer->Height; \
int pitch = irb->region->pitch * irb->region->cpp; \
void *buf = irb->region->buffer->virtual; \
(void)buf; (void)pitch; /* unused for non-gttmap. */ \
- intel_get_cliprects(intel, &cliprects, &num_cliprects, &x_off, &y_off);
-
#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
diff --git a/src/mesa/drivers/dri/intel/intel_state.c b/src/mesa/drivers/dri/intel/intel_state.c
index aefae53eb20..c5ef909dbf1 100644
--- a/src/mesa/drivers/dri/intel/intel_state.c
+++ b/src/mesa/drivers/dri/intel/intel_state.c
@@ -35,8 +35,6 @@
#include "intel_screen.h"
#include "intel_context.h"
-#include "intel_regions.h"
-#include "swrast/swrast.h"
int
intel_translate_shadow_compare_func(GLenum func)
diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c
index d8e71093c47..d67451cf8ec 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_copy.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c
@@ -36,7 +36,6 @@
#include "intel_screen.h"
#include "intel_context.h"
-#include "intel_batchbuffer.h"
#include "intel_buffers.h"
#include "intel_mipmap_tree.h"
#include "intel_regions.h"
@@ -114,8 +113,6 @@ do_copy_texsubimage(struct intel_context *intel,
drm_intel_bo *dst_bo = intel_region_buffer(intel,
intelImage->mt->region,
INTEL_WRITE_PART);
- const GLint orig_x = x;
- const GLint orig_y = y;
GLuint image_x, image_y;
GLshort src_pitch;
@@ -125,9 +122,6 @@ do_copy_texsubimage(struct intel_context *intel,
intelImage->face,
0,
&image_x, &image_y);
- /* Update dst for clipped src. Need to also clip the source rect. */
- dstx += x - orig_x;
- dsty += y - orig_y;
/* Can't blit to tiled buffers with non-tile-aligned offset. */
if (intelImage->mt->region->tiling == I915_TILING_Y) {
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c
index 6f41eafd0ef..f5d0dabebb6 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -7,7 +7,6 @@
#include "main/convolve.h"
#include "main/context.h"
#include "main/formats.h"
-#include "main/image.h"
#include "main/texcompress.h"
#include "main/texstore.h"
#include "main/texgetimage.h"
diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c b/src/mesa/drivers/dri/intel/intel_tex_validate.c
index c9a24ac3983..ed5c5d896b9 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_validate.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c
@@ -2,10 +2,8 @@
#include "main/macros.h"
#include "intel_context.h"
-#include "intel_batchbuffer.h"
#include "intel_mipmap_tree.h"
#include "intel_tex.h"
-#include "intel_chipset.h"
#define FILE_DEBUG_FLAG DEBUG_TEXTURE
diff --git a/src/mesa/drivers/dri/mach64/mach64_context.c b/src/mesa/drivers/dri/mach64/mach64_context.c
index 3b4ef7ffd82..11bce31b12c 100644
--- a/src/mesa/drivers/dri/mach64/mach64_context.c
+++ b/src/mesa/drivers/dri/mach64/mach64_context.c
@@ -33,8 +33,6 @@
#include "main/context.h"
#include "main/simple_list.h"
#include "main/imports.h"
-#include "main/matrix.h"
-#include "main/extensions.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
diff --git a/src/mesa/drivers/dri/mach64/mach64_dd.c b/src/mesa/drivers/dri/mach64/mach64_dd.c
index e400e9a918d..ca713e2de5e 100644
--- a/src/mesa/drivers/dri/mach64/mach64_dd.c
+++ b/src/mesa/drivers/dri/mach64/mach64_dd.c
@@ -31,12 +31,9 @@
#include "mach64_context.h"
#include "mach64_ioctl.h"
-#include "mach64_state.h"
-#include "mach64_vb.h"
#include "mach64_dd.h"
#include "main/context.h"
-#include "main/framebuffer.h"
#include "utils.h"
diff --git a/src/mesa/drivers/dri/mach64/mach64_lock.c b/src/mesa/drivers/dri/mach64/mach64_lock.c
index 8653c77da57..1a95a8f619d 100644
--- a/src/mesa/drivers/dri/mach64/mach64_lock.c
+++ b/src/mesa/drivers/dri/mach64/mach64_lock.c
@@ -32,7 +32,6 @@
#include "mach64_context.h"
#include "mach64_state.h"
#include "mach64_lock.h"
-#include "mach64_tex.h"
#include "drirenderbuffer.h"
#if DEBUG_LOCKING
diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c
index 1ed3b0b70ef..5cbfb85627a 100644
--- a/src/mesa/drivers/dri/mach64/mach64_screen.c
+++ b/src/mesa/drivers/dri/mach64/mach64_screen.c
@@ -31,8 +31,6 @@
#include "mach64_context.h"
#include "mach64_ioctl.h"
-#include "mach64_tris.h"
-#include "mach64_vb.h"
#include "mach64_span.h"
#include "main/context.h"
diff --git a/src/mesa/drivers/dri/mach64/mach64_span.c b/src/mesa/drivers/dri/mach64/mach64_span.c
index b4ba2a41c98..0c52c0c88cb 100644
--- a/src/mesa/drivers/dri/mach64/mach64_span.c
+++ b/src/mesa/drivers/dri/mach64/mach64_span.c
@@ -31,7 +31,6 @@
#include "mach64_context.h"
#include "mach64_ioctl.h"
-#include "mach64_state.h"
#include "mach64_span.h"
#include "swrast/swrast.h"
diff --git a/src/mesa/drivers/dri/mach64/mach64_state.c b/src/mesa/drivers/dri/mach64/mach64_state.c
index df7cbc8670e..b9093b5a139 100644
--- a/src/mesa/drivers/dri/mach64/mach64_state.c
+++ b/src/mesa/drivers/dri/mach64/mach64_state.c
@@ -36,7 +36,6 @@
#include "mach64_vb.h"
#include "mach64_tex.h"
-#include "main/context.h"
#include "main/enums.h"
#include "main/colormac.h"
#include "swrast/swrast.h"
@@ -44,8 +43,6 @@
#include "tnl/tnl.h"
#include "swrast_setup/swrast_setup.h"
-#include "tnl/t_pipeline.h"
-
/* =============================================================
* Alpha blending
diff --git a/src/mesa/drivers/dri/mach64/mach64_tex.c b/src/mesa/drivers/dri/mach64/mach64_tex.c
index 6627d3c38a0..1bce967d58f 100644
--- a/src/mesa/drivers/dri/mach64/mach64_tex.c
+++ b/src/mesa/drivers/dri/mach64/mach64_tex.c
@@ -31,13 +31,8 @@
#include "mach64_context.h"
#include "mach64_ioctl.h"
-#include "mach64_state.h"
-#include "mach64_vb.h"
-#include "mach64_tris.h"
#include "mach64_tex.h"
-#include "main/context.h"
-#include "main/macros.h"
#include "main/simple_list.h"
#include "main/enums.h"
#include "main/texstore.h"
diff --git a/src/mesa/drivers/dri/mach64/mach64_texmem.c b/src/mesa/drivers/dri/mach64/mach64_texmem.c
index b97e9eec25b..46cee4320d0 100644
--- a/src/mesa/drivers/dri/mach64/mach64_texmem.c
+++ b/src/mesa/drivers/dri/mach64/mach64_texmem.c
@@ -37,10 +37,7 @@
#include "main/imports.h"
#include "mach64_context.h"
-#include "mach64_state.h"
#include "mach64_ioctl.h"
-#include "mach64_vb.h"
-#include "mach64_tris.h"
#include "mach64_tex.h"
diff --git a/src/mesa/drivers/dri/mach64/mach64_texstate.c b/src/mesa/drivers/dri/mach64/mach64_texstate.c
index df0a09a5c12..adf774ec194 100644
--- a/src/mesa/drivers/dri/mach64/mach64_texstate.c
+++ b/src/mesa/drivers/dri/mach64/mach64_texstate.c
@@ -36,8 +36,6 @@
#include "mach64_context.h"
#include "mach64_ioctl.h"
-#include "mach64_state.h"
-#include "mach64_vb.h"
#include "mach64_tris.h"
#include "mach64_tex.h"
diff --git a/src/mesa/drivers/dri/mach64/mach64_vb.c b/src/mesa/drivers/dri/mach64/mach64_vb.c
index e58812e9028..00da8353769 100644
--- a/src/mesa/drivers/dri/mach64/mach64_vb.c
+++ b/src/mesa/drivers/dri/mach64/mach64_vb.c
@@ -42,7 +42,6 @@
#include "mach64_vb.h"
#include "mach64_ioctl.h"
#include "mach64_tris.h"
-#include "mach64_state.h"
#define MACH64_TEX1_BIT 0x1
diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c
index f835cb8bd6b..e7813b63725 100644
--- a/src/mesa/drivers/dri/mga/mga_xmesa.c
+++ b/src/mesa/drivers/dri/mga/mga_xmesa.c
@@ -35,7 +35,6 @@
#include "mga_drm.h"
#include "mga_xmesa.h"
#include "main/context.h"
-#include "main/matrix.h"
#include "main/simple_list.h"
#include "main/imports.h"
#include "main/framebuffer.h"
@@ -64,7 +63,6 @@
#include "utils.h"
#include "vblank.h"
-#include "main/extensions.h"
#include "drirenderbuffer.h"
#include "GL/internal/dri_interface.h"
diff --git a/src/mesa/drivers/dri/mga/mgadd.c b/src/mesa/drivers/dri/mga/mgadd.c
index 3b1ea22b609..2f23c0e5142 100644
--- a/src/mesa/drivers/dri/mga/mgadd.c
+++ b/src/mesa/drivers/dri/mga/mgadd.c
@@ -32,11 +32,6 @@
#include "mgacontext.h"
#include "mgadd.h"
-#include "mgastate.h"
-#include "mgaspan.h"
-#include "mgatex.h"
-#include "mgatris.h"
-#include "mgavb.h"
#include "mga_xmesa.h"
#include "utils.h"
diff --git a/src/mesa/drivers/dri/mga/mgaioctl.c b/src/mesa/drivers/dri/mga/mgaioctl.c
index 8ce5d802ab8..259358eaa3f 100644
--- a/src/mesa/drivers/dri/mga/mgaioctl.c
+++ b/src/mesa/drivers/dri/mga/mgaioctl.c
@@ -42,10 +42,7 @@
#include "mgacontext.h"
#include "mgadd.h"
#include "mgastate.h"
-#include "mgatex.h"
-#include "mgavb.h"
#include "mgaioctl.h"
-#include "mgatris.h"
#include "vblank.h"
diff --git a/src/mesa/drivers/dri/mga/mgarender.c b/src/mesa/drivers/dri/mga/mgarender.c
index 517c3b8f82c..8b8fc485d31 100644
--- a/src/mesa/drivers/dri/mga/mgarender.c
+++ b/src/mesa/drivers/dri/mga/mgarender.c
@@ -48,7 +48,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "mgacontext.h"
#include "mgatris.h"
-#include "mgastate.h"
#include "mgaioctl.h"
#include "mgavb.h"
diff --git a/src/mesa/drivers/dri/mga/mgatex.c b/src/mesa/drivers/dri/mga/mgatex.c
index 62a9317cd48..ca3dd4b0139 100644
--- a/src/mesa/drivers/dri/mga/mgatex.c
+++ b/src/mesa/drivers/dri/mga/mgatex.c
@@ -40,11 +40,8 @@
#include "mgacontext.h"
#include "mgatex.h"
#include "mgaregs.h"
-#include "mgatris.h"
#include "mgaioctl.h"
-#include "swrast/swrast.h"
-
#include "xmlpool.h"
/**
diff --git a/src/mesa/drivers/dri/mga/mgatris.c b/src/mesa/drivers/dri/mga/mgatris.c
index c1bcd4b8531..4c58c3bdb04 100644
--- a/src/mesa/drivers/dri/mga/mgatris.c
+++ b/src/mesa/drivers/dri/mga/mgatris.c
@@ -38,7 +38,6 @@
#include "mgaioctl.h"
#include "mgatris.h"
#include "mgavb.h"
-#include "mgastate.h"
static void mgaRenderPrimitive( GLcontext *ctx, GLenum prim );
diff --git a/src/mesa/drivers/dri/mga/mgavb.c b/src/mesa/drivers/dri/mga/mgavb.c
index 1c635b23a65..def5109863c 100644
--- a/src/mesa/drivers/dri/mga/mgavb.c
+++ b/src/mesa/drivers/dri/mga/mgavb.c
@@ -39,7 +39,6 @@
#include "main/colormac.h"
#include "tnl/t_context.h"
-#include "swrast_setup/swrast_setup.h"
#include "swrast/swrast.h"
diff --git a/src/mesa/drivers/dri/r200/Makefile b/src/mesa/drivers/dri/r200/Makefile
index a93dbaee910..14eb96c1bab 100644
--- a/src/mesa/drivers/dri/r200/Makefile
+++ b/src/mesa/drivers/dri/r200/Makefile
@@ -9,10 +9,6 @@ LIBNAME = r200_dri.so
MINIGLX_SOURCES = server/radeon_dri.c
-ifeq ($(USING_EGL), 1)
-EGL_SOURCES = server/radeon_egl.c
-endif
-
ifeq ($(RADEON_LDFLAGS),)
CS_SOURCES = radeon_cs_space_drm.c radeon_bo.c radeon_cs.c
endif
diff --git a/src/mesa/drivers/dri/r200/r200_blit.c b/src/mesa/drivers/dri/r200/r200_blit.c
index b6fcc6e20c5..e446d532cf7 100644
--- a/src/mesa/drivers/dri/r200/r200_blit.c
+++ b/src/mesa/drivers/dri/r200/r200_blit.c
@@ -363,6 +363,10 @@ unsigned r200_blit(GLcontext *ctx,
return GL_FALSE;
}
+ if (src_offset % 32 || dst_offset % 32) {
+ return GL_FALSE;
+ }
+
if (0) {
fprintf(stderr, "src: size [%d x %d], pitch %d, "
"offset [%d x %d], format %s, bo %p\n",
diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c
index 3d6d0f5ec0d..453c8de2200 100644
--- a/src/mesa/drivers/dri/r200/r200_context.c
+++ b/src/mesa/drivers/dri/r200/r200_context.c
@@ -333,10 +333,6 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual,
r200InitShaderFuncs(&functions);
radeonInitQueryObjFunctions(&functions);
- if (rmesa->radeon.radeonScreen->kernel_mm) {
- r200_init_texcopy_functions(&functions);
- }
-
if (!radeonInitContext(&rmesa->radeon, &functions,
glVisual, driContextPriv,
sharedContextPrivate)) {
diff --git a/src/mesa/drivers/dri/r200/r200_state_init.c b/src/mesa/drivers/dri/r200/r200_state_init.c
index 6c5a0b79eed..80b08dcc992 100644
--- a/src/mesa/drivers/dri/r200/r200_state_init.c
+++ b/src/mesa/drivers/dri/r200/r200_state_init.c
@@ -698,7 +698,8 @@ static void tex_emit_mm(GLcontext *ctx, struct radeon_state_atom *atom)
uint32_t dwords = atom->check(ctx, atom);
int i = atom->idx;
radeonTexObj *t = r200->state.texture.unit[i].texobj;
- if (!r200->state.texture.unit[i].unitneeded)
+
+ if (!r200->state.texture.unit[i].unitneeded && !(dwords <= atom->cmd_size))
dwords -= 4;
BEGIN_BATCH_NO_AUTOSTATE(dwords);
diff --git a/src/mesa/drivers/dri/r200/r200_vertprog.c b/src/mesa/drivers/dri/r200/r200_vertprog.c
index 11405d7caee..4f225a233da 100644
--- a/src/mesa/drivers/dri/r200/r200_vertprog.c
+++ b/src/mesa/drivers/dri/r200/r200_vertprog.c
@@ -437,7 +437,7 @@ static GLboolean r200_translate_vertex_program(GLcontext *ctx, struct r200_verte
(1 << VERT_RESULT_TEX2) | (1 << VERT_RESULT_TEX3) | (1 << VERT_RESULT_TEX4) |
(1 << VERT_RESULT_TEX5) | (1 << VERT_RESULT_PSIZ))) != 0) {
if (R200_DEBUG & RADEON_FALLBACKS) {
- fprintf(stderr, "can't handle vert prog outputs 0x%x\n",
+ fprintf(stderr, "can't handle vert prog outputs 0x%llx\n",
mesa_vp->Base.OutputsWritten);
}
return GL_FALSE;
diff --git a/src/mesa/drivers/dri/r200/server/radeon_egl.c b/src/mesa/drivers/dri/r200/server/radeon_egl.c
deleted file mode 120000
index d7735a76438..00000000000
--- a/src/mesa/drivers/dri/r200/server/radeon_egl.c
+++ /dev/null
@@ -1 +0,0 @@
-../../radeon/server/radeon_egl.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r300/Makefile b/src/mesa/drivers/dri/r300/Makefile
index acc4d4d8b18..04459c2ddfa 100644
--- a/src/mesa/drivers/dri/r300/Makefile
+++ b/src/mesa/drivers/dri/r300/Makefile
@@ -9,10 +9,6 @@ LIBNAME = r300_dri.so
MINIGLX_SOURCES = server/radeon_dri.c
-ifeq ($(USING_EGL), 1)
-EGL_SOURCES = server/radeon_egl.c
-endif
-
ifeq ($(RADEON_LDFLAGS),)
CS_SOURCES = radeon_cs_space_drm.c radeon_bo.c radeon_cs.c
endif
diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c
index e1c33bbb2cf..4787bafc66a 100644
--- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c
+++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c
@@ -39,7 +39,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "main/macros.h"
#include "main/context.h"
#include "main/simple_list.h"
-#include "swrast/swrast.h"
#include "drm.h"
#include "radeon_drm.h"
@@ -50,7 +49,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r300_emit.h"
#include "radeon_bocs_wrapper.h"
#include "radeon_mipmap_tree.h"
-#include "r300_state.h"
#include "radeon_queryobj.h"
/** # of dwords reserved for additional instructions that may need to be written
diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c
index bb0e6db3139..eedb7b6ed86 100644
--- a/src/mesa/drivers/dri/r300/r300_context.c
+++ b/src/mesa/drivers/dri/r300/r300_context.c
@@ -40,9 +40,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "main/context.h"
#include "main/simple_list.h"
#include "main/imports.h"
-#include "main/matrix.h"
#include "main/extensions.h"
-#include "main/state.h"
#include "main/bufferobj.h"
#include "main/texobj.h"
@@ -52,13 +50,11 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "tnl/tnl.h"
#include "tnl/t_pipeline.h"
-#include "tnl/t_vp_build.h"
#include "drivers/common/driverfuncs.h"
#include "drivers/common/meta.h"
#include "r300_context.h"
-#include "radeon_context.h"
#include "radeon_span.h"
#include "r300_blit.h"
#include "r300_cmdbuf.h"
@@ -70,7 +66,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "radeon_buffer_objects.h"
#include "radeon_queryobj.h"
-#include "vblank.h"
#include "utils.h"
#include "xmlpool.h" /* for symbolic values of enum-type options */
@@ -451,6 +446,8 @@ static void r300InitGLExtensions(GLcontext *ctx)
if (!r300->radeon.radeonScreen->drmSupportsOcclusionQueries) {
_mesa_disable_extension(ctx, "GL_ARB_occlusion_query");
}
+ if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV350)
+ _mesa_enable_extension(ctx, "GL_ARB_half_float_vertex");
}
static void r300InitIoctlFuncs(struct dd_function_table *functions)
diff --git a/src/mesa/drivers/dri/r300/r300_draw.c b/src/mesa/drivers/dri/r300/r300_draw.c
index 3dcd986e226..813495a0466 100644
--- a/src/mesa/drivers/dri/r300/r300_draw.c
+++ b/src/mesa/drivers/dri/r300/r300_draw.c
@@ -29,7 +29,6 @@
#include "main/glheader.h"
#include "main/context.h"
#include "main/state.h"
-#include "main/api_validate.h"
#include "main/enums.h"
#include "main/simple_list.h"
@@ -47,8 +46,6 @@
#include "tnl/tnl.h"
#include "tnl/t_vp_build.h"
#include "vbo/vbo_context.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
static int getTypeSize(GLenum type)
@@ -56,6 +53,8 @@ static int getTypeSize(GLenum type)
switch (type) {
case GL_DOUBLE:
return sizeof(GLdouble);
+ case GL_HALF_FLOAT:
+ return sizeof(GLhalfARB);
case GL_FLOAT:
return sizeof(GLfloat);
case GL_INT:
@@ -385,6 +384,18 @@ static void r300TranslateAttrib(GLcontext *ctx, GLuint attr, int count, const st
r300_attr._signed = 0;
r300_attr.normalize = 0;
break;
+ case GL_HALF_FLOAT:
+ switch (input->Size) {
+ case 1:
+ case 2:
+ r300_attr.data_type = R300_DATA_TYPE_FLT16_2;
+ break;
+ case 3:
+ case 4:
+ r300_attr.data_type = R300_DATA_TYPE_FLT16_4;
+ break;
+ }
+ break;
case GL_SHORT:
r300_attr._signed = 1;
r300_attr.normalize = input->Normalized;
diff --git a/src/mesa/drivers/dri/r300/r300_emit.c b/src/mesa/drivers/dri/r300/r300_emit.c
index 15aeaf05148..740c9022217 100644
--- a/src/mesa/drivers/dri/r300/r300_emit.c
+++ b/src/mesa/drivers/dri/r300/r300_emit.c
@@ -39,19 +39,17 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "main/colormac.h"
#include "main/imports.h"
#include "main/macros.h"
-#include "main/image.h"
#include "swrast_setup/swrast_setup.h"
-#include "math/m_translate.h"
#include "tnl/tnl.h"
#include "tnl/t_context.h"
#include "r300_context.h"
-#include "r300_state.h"
#include "r300_emit.h"
#include "r300_render.h"
#include "r300_swtcl.h"
+
GLuint r300VAPInputCntl0(GLcontext * ctx, GLuint InputsRead)
{
/* No idea what this value means. I have seen other values written to
diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_common.c b/src/mesa/drivers/dri/r300/r300_fragprog_common.c
index 2933d31136c..e41aeff91a4 100644
--- a/src/mesa/drivers/dri/r300/r300_fragprog_common.c
+++ b/src/mesa/drivers/dri/r300/r300_fragprog_common.c
@@ -38,14 +38,12 @@
#include "r300_fragprog_common.h"
-#include "shader/program.h"
#include "shader/prog_parameter.h"
#include "shader/prog_print.h"
#include "compiler/radeon_compiler.h"
#include "radeon_mesa_to_rc.h"
-#include "r300_state.h"
static GLuint build_dtm(GLuint depthmode)
diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h
index ea684e7df18..d18ebab8ff2 100644
--- a/src/mesa/drivers/dri/r300/r300_reg.h
+++ b/src/mesa/drivers/dri/r300/r300_reg.h
@@ -230,6 +230,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
# define R300_DATA_TYPE_SHORT_4 7
# define R300_DATA_TYPE_VECTOR_3_TTT 8
# define R300_DATA_TYPE_VECTOR_3_EET 9
+# define R300_DATA_TYPE_FLT16_2 11
+# define R300_DATA_TYPE_FLT16_4 12
+
# define R300_SKIP_DWORDS_SHIFT 4
# define R300_DST_VEC_LOC_SHIFT 8
# define R300_LAST_VEC (1 << 13)
diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c
index 02c94250a8f..e3e62857840 100644
--- a/src/mesa/drivers/dri/r300/r300_render.c
+++ b/src/mesa/drivers/dri/r300/r300_render.c
@@ -53,7 +53,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r300_render.h"
#include "main/glheader.h"
-#include "main/state.h"
#include "main/imports.h"
#include "main/enums.h"
#include "main/macros.h"
@@ -65,14 +64,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "swrast_setup/swrast_setup.h"
#include "vbo/vbo.h"
#include "vbo/vbo_split.h"
-#include "tnl/tnl.h"
-#include "tnl/t_vp_build.h"
#include "r300_context.h"
#include "r300_state.h"
#include "r300_reg.h"
-#include "r300_tex.h"
#include "r300_emit.h"
-#include "r300_fragprog_common.h"
#include "r300_swtcl.h"
/**
diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c
index c51285aad93..017d45a5039 100644
--- a/src/mesa/drivers/dri/r300/r300_state.c
+++ b/src/mesa/drivers/dri/r300/r300_state.c
@@ -58,13 +58,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r300_state.h"
#include "r300_reg.h"
#include "r300_emit.h"
-#include "r300_tex.h"
#include "r300_fragprog_common.h"
#include "r300_render.h"
#include "r300_vertprog.h"
-#include "drirenderbuffer.h"
-
static void r300BlendColor(GLcontext * ctx, const GLfloat cf[4])
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
diff --git a/src/mesa/drivers/dri/r300/r300_tex.c b/src/mesa/drivers/dri/r300/r300_tex.c
index eb5d2d50041..8dd85073954 100644
--- a/src/mesa/drivers/dri/r300/r300_tex.c
+++ b/src/mesa/drivers/dri/r300/r300_tex.c
@@ -41,18 +41,14 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "main/mipmap.h"
#include "main/simple_list.h"
#include "main/texstore.h"
-#include "main/teximage.h"
#include "main/texobj.h"
#include "texmem.h"
#include "r300_context.h"
-#include "r300_state.h"
#include "radeon_mipmap_tree.h"
#include "r300_tex.h"
-#include "xmlpool.h"
-
static unsigned int translate_wrap_mode(GLenum wrapmode)
{
diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c
index 78ff54574f6..09e046859a4 100644
--- a/src/mesa/drivers/dri/r300/r300_texstate.c
+++ b/src/mesa/drivers/dri/r300/r300_texstate.c
@@ -45,7 +45,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "main/simple_list.h"
#include "r300_context.h"
-#include "r300_state.h"
#include "radeon_mipmap_tree.h"
#include "r300_tex.h"
#include "r300_reg.h"
diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c
index aa98a049aa4..e6fa57d439b 100644
--- a/src/mesa/drivers/dri/r300/r300_vertprog.c
+++ b/src/mesa/drivers/dri/r300/r300_vertprog.c
@@ -34,7 +34,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "shader/program.h"
#include "shader/programopt.h"
#include "shader/prog_instruction.h"
-#include "shader/prog_optimize.h"
#include "shader/prog_parameter.h"
#include "shader/prog_print.h"
#include "shader/prog_statevars.h"
diff --git a/src/mesa/drivers/dri/r300/server/radeon_egl.c b/src/mesa/drivers/dri/r300/server/radeon_egl.c
deleted file mode 120000
index d7735a76438..00000000000
--- a/src/mesa/drivers/dri/r300/server/radeon_egl.c
+++ /dev/null
@@ -1 +0,0 @@
-../../radeon/server/radeon_egl.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r600/Makefile b/src/mesa/drivers/dri/r600/Makefile
index 8a45fc51b38..5d509415393 100644
--- a/src/mesa/drivers/dri/r600/Makefile
+++ b/src/mesa/drivers/dri/r600/Makefile
@@ -9,10 +9,6 @@ LIBNAME = r600_dri.so
MINIGLX_SOURCES = server/radeon_dri.c
-ifeq ($(USING_EGL), 1)
-EGL_SOURCES = server/radeon_egl.c
-endif
-
ifeq ($(RADEON_LDFLAGS),)
CS_SOURCES = radeon_cs_space_drm.c radeon_bo.c radeon_cs.c
endif
diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c
index 68112c49dc3..ab3c7723c9d 100644
--- a/src/mesa/drivers/dri/r600/r600_context.c
+++ b/src/mesa/drivers/dri/r600/r600_context.c
@@ -246,12 +246,11 @@ static void r600_init_vtbl(radeonContextPtr radeon)
static void r600InitConstValues(GLcontext *ctx, radeonScreenPtr screen)
{
- context_t *r600 = R700_CONTEXT(ctx);
-
- ctx->Const.MaxTextureImageUnits =
- driQueryOptioni(&r600->radeon.optionCache, "texture_image_units");
- ctx->Const.MaxTextureCoordUnits =
- driQueryOptioni(&r600->radeon.optionCache, "texture_coord_units");
+ ctx->Const.MaxTextureImageUnits = 16;
+ /* 8 per clause on r6xx, 16 on r7xx
+ * but I think mesa only supports 8 at the moment
+ */
+ ctx->Const.MaxTextureCoordUnits = 8;
ctx->Const.MaxTextureUnits =
MIN2(ctx->Const.MaxTextureImageUnits,
ctx->Const.MaxTextureCoordUnits);
@@ -286,9 +285,8 @@ static void r600InitConstValues(GLcontext *ctx, radeonScreenPtr screen)
ctx->Const.FragmentProgram.MaxNativeAttribs = 32;
ctx->Const.FragmentProgram.MaxNativeParameters = 256;
ctx->Const.FragmentProgram.MaxNativeAluInstructions = 8192;
- /* 8 per clause on r6xx, 16 on rv670/r7xx */
- if ((screen->chip_family == CHIP_FAMILY_RV670) ||
- (screen->chip_family >= CHIP_FAMILY_RV770))
+ /* 8 per clause on r6xx, 16 on r7xx */
+ if (screen->chip_family >= CHIP_FAMILY_RV770)
ctx->Const.FragmentProgram.MaxNativeTexInstructions = 16;
else
ctx->Const.FragmentProgram.MaxNativeTexInstructions = 8;
diff --git a/src/mesa/drivers/dri/r600/r600_tex.h b/src/mesa/drivers/dri/r600/r600_tex.h
index c2141ef5e5c..1d75a2ecd69 100644
--- a/src/mesa/drivers/dri/r600/r600_tex.h
+++ b/src/mesa/drivers/dri/r600/r600_tex.h
@@ -42,7 +42,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
/* Texel pitch is 8 alignment. */
#define R700_TEXEL_PITCH_ALIGNMENT_MASK 0x7
-#define R700_MAX_TEXTURE_UNITS 8 /* TODO : should be 16, lets make it work, review later */
+#define R700_MAX_TEXTURE_UNITS 16
extern void r600SetDepthTexMode(struct gl_texture_object *tObj);
diff --git a/src/mesa/drivers/dri/r600/r600_texstate.c b/src/mesa/drivers/dri/r600/r600_texstate.c
index b8466bdd75e..3289d89c926 100644
--- a/src/mesa/drivers/dri/r600/r600_texstate.c
+++ b/src/mesa/drivers/dri/r600/r600_texstate.c
@@ -85,6 +85,7 @@ static GLboolean r600GetTexFormat(struct gl_texture_object *tObj, gl_format mesa
CLEARfield(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
CLEARfield(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
CLEARfield(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ CLEARbit(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__FORCE_DEGAMMA_bit);
SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_UNSIGNED,
FORMAT_COMP_X_shift, FORMAT_COMP_X_mask);
@@ -95,6 +96,11 @@ static GLboolean r600GetTexFormat(struct gl_texture_object *tObj, gl_format mesa
SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_UNSIGNED,
FORMAT_COMP_W_shift, FORMAT_COMP_W_mask);
+ CLEARbit(t->SQ_TEX_RESOURCE0, TILE_TYPE_bit);
+ SETfield(t->SQ_TEX_RESOURCE0, ARRAY_LINEAR_GENERAL,
+ SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_shift,
+ SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_mask);
+
switch (mesa_format) /* This is mesa format. */
{
case MESA_FORMAT_RGBA8888:
@@ -158,6 +164,32 @@ static GLboolean r600GetTexFormat(struct gl_texture_object *tObj, gl_format mesa
SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W,
SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
break;
+ case MESA_FORMAT_XRGB8888:
+ SETfield(t->SQ_TEX_RESOURCE1, FMT_8_8_8_8,
+ SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask);
+
+ SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ break;
+ case MESA_FORMAT_XRGB8888_REV:
+ SETfield(t->SQ_TEX_RESOURCE1, FMT_8_8_8_8,
+ SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask);
+
+ SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ break;
case MESA_FORMAT_ARGB8888_REV:
SETfield(t->SQ_TEX_RESOURCE1, FMT_8_8_8_8,
SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask);
@@ -515,6 +547,10 @@ static GLboolean r600GetTexFormat(struct gl_texture_object *tObj, gl_format mesa
case MESA_FORMAT_Z24_S8:
case MESA_FORMAT_Z32:
case MESA_FORMAT_S8:
+ SETbit(t->SQ_TEX_RESOURCE0, TILE_TYPE_bit);
+ SETfield(t->SQ_TEX_RESOURCE0, ARRAY_1D_TILED_THIN1,
+ SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_shift,
+ SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_mask);
switch (mesa_format) {
case MESA_FORMAT_Z16:
SETfield(t->SQ_TEX_RESOURCE1, FMT_16,
@@ -651,6 +687,12 @@ static GLuint r600_translate_shadow_func(GLenum func)
}
}
+static INLINE uint32_t
+S_FIXED(float value, uint32_t frac_bits)
+{
+ return value * (1 << frac_bits);
+}
+
void r600SetDepthTexMode(struct gl_texture_object *tObj)
{
radeonTexObjPtr t;
@@ -670,8 +712,9 @@ void r600SetDepthTexMode(struct gl_texture_object *tObj)
* \param rmesa Context pointer
* \param t the r300 texture object
*/
-static void setup_hardware_state(context_t *rmesa, struct gl_texture_object *texObj)
+static void setup_hardware_state(GLcontext * ctx, struct gl_texture_object *texObj, int unit)
{
+ context_t *rmesa = R700_CONTEXT(ctx);
radeonTexObj *t = radeon_tex_obj(texObj);
const struct gl_texture_image *firstImage;
GLuint uTexelPitch, row_align;
@@ -733,11 +776,21 @@ static void setup_hardware_state(context_t *rmesa, struct gl_texture_object *tex
t->SQ_TEX_RESOURCE2 = get_base_teximage_offset(t) / 256;
- if ((t->maxLod - t->minLod) > 0) {
- t->SQ_TEX_RESOURCE3 = radeon_miptree_image_offset(t->mt, 0, t->minLod + 1) / 256;
- SETfield(t->SQ_TEX_RESOURCE4, 0, BASE_LEVEL_shift, BASE_LEVEL_mask);
- SETfield(t->SQ_TEX_RESOURCE5, t->maxLod - t->minLod, LAST_LEVEL_shift, LAST_LEVEL_mask);
- }
+ t->SQ_TEX_RESOURCE3 = radeon_miptree_image_offset(t->mt, 0, t->minLod + 1) / 256;
+
+ SETfield(t->SQ_TEX_RESOURCE4, 0, BASE_LEVEL_shift, BASE_LEVEL_mask);
+ SETfield(t->SQ_TEX_RESOURCE5, t->maxLod - t->minLod, LAST_LEVEL_shift, LAST_LEVEL_mask);
+
+ SETfield(t->SQ_TEX_SAMPLER1,
+ S_FIXED(CLAMP(t->base.MinLod - t->minLod, 0, 15), 6),
+ MIN_LOD_shift, MIN_LOD_mask);
+ SETfield(t->SQ_TEX_SAMPLER1,
+ S_FIXED(CLAMP(t->base.MaxLod - t->minLod, 0, 15), 6),
+ MAX_LOD_shift, MAX_LOD_mask);
+ SETfield(t->SQ_TEX_SAMPLER1,
+ S_FIXED(CLAMP(ctx->Texture.Unit[unit].LodBias + t->base.LodBias, -16, 16), 6),
+ SQ_TEX_SAMPLER_WORD1_0__LOD_BIAS_shift, SQ_TEX_SAMPLER_WORD1_0__LOD_BIAS_mask);
+
if(texObj->CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB)
{
SETfield(t->SQ_TEX_SAMPLER0, r600_translate_shadow_func(texObj->CompareFunc), DEPTH_COMPARE_FUNCTION_shift, DEPTH_COMPARE_FUNCTION_mask);
@@ -754,9 +807,8 @@ static void setup_hardware_state(context_t *rmesa, struct gl_texture_object *tex
*
* Mostly this means populating the texture object's mipmap tree.
*/
-static GLboolean r600_validate_texture(GLcontext * ctx, struct gl_texture_object *texObj)
+static GLboolean r600_validate_texture(GLcontext * ctx, struct gl_texture_object *texObj, int unit)
{
- context_t *rmesa = R700_CONTEXT(ctx);
radeonTexObj *t = radeon_tex_obj(texObj);
if (!radeon_validate_texture_miptree(ctx, texObj))
@@ -764,7 +816,7 @@ static GLboolean r600_validate_texture(GLcontext * ctx, struct gl_texture_object
/* Configure the hardware registers (more precisely, the cached version
* of the hardware registers). */
- setup_hardware_state(rmesa, texObj);
+ setup_hardware_state(ctx, texObj, unit);
t->validated = GL_TRUE;
return GL_TRUE;
@@ -805,7 +857,7 @@ GLboolean r600ValidateBuffers(GLcontext * ctx)
if (!ctx->Texture.Unit[i]._ReallyEnabled)
continue;
- if (!r600_validate_texture(ctx, ctx->Texture.Unit[i]._Current)) {
+ if (!r600_validate_texture(ctx, ctx->Texture.Unit[i]._Current, i)) {
radeon_warning("failed to validate texture for unit %d.\n", i);
}
t = radeon_tex_obj(ctx->Texture.Unit[i]._Current);
diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c
index c01b2fbb146..89adb77bf53 100644
--- a/src/mesa/drivers/dri/r600/r700_assembler.c
+++ b/src/mesa/drivers/dri/r600/r700_assembler.c
@@ -4491,20 +4491,21 @@ GLboolean assemble_TEX(r700_AssemblerBase *pAsm)
GLboolean assemble_XPD(r700_AssemblerBase *pAsm)
{
- BITS tmp;
+ BITS tmp1;
+ BITS tmp2 = 0;
if( GL_FALSE == checkop2(pAsm) )
{
return GL_FALSE;
}
- tmp = gethelpr(pAsm);
+ tmp1 = gethelpr(pAsm);
pAsm->D.dst.opcode = SQ_OP2_INST_MUL;
setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE);
pAsm->D.dst.rtype = DST_REG_TEMPORARY;
- pAsm->D.dst.reg = tmp;
+ pAsm->D.dst.reg = tmp1;
nomask_PVSDST(&(pAsm->D.dst));
if( GL_FALSE == assemble_src(pAsm, 0, -1) )
@@ -4530,11 +4531,11 @@ GLboolean assemble_XPD(r700_AssemblerBase *pAsm)
if(0xF != pAsm->pILInst[pAsm->uiCurInst].DstReg.WriteMask)
{
- tmp = gethelpr(pAsm);
+ tmp2 = gethelpr(pAsm);
setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE);
pAsm->D.dst.rtype = DST_REG_TEMPORARY;
- pAsm->D.dst.reg = tmp;
+ pAsm->D.dst.reg = tmp2;
nomask_PVSDST(&(pAsm->D.dst));
}
@@ -4562,7 +4563,7 @@ GLboolean assemble_XPD(r700_AssemblerBase *pAsm)
// result1 + (neg) result0
setaddrmode_PVSSRC(&(pAsm->S[2].src),ADDR_ABSOLUTE);
pAsm->S[2].src.rtype = SRC_REG_TEMPORARY;
- pAsm->S[2].src.reg = tmp;
+ pAsm->S[2].src.reg = tmp1;
neg_PVSSRC(&(pAsm->S[2].src));
noswizzle_PVSSRC(&(pAsm->S[2].src));
@@ -4585,7 +4586,7 @@ GLboolean assemble_XPD(r700_AssemblerBase *pAsm)
// Use tmp as source
setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE);
pAsm->S[0].src.rtype = SRC_REG_TEMPORARY;
- pAsm->S[0].src.reg = tmp;
+ pAsm->S[0].src.reg = tmp2;
noneg_PVSSRC(&(pAsm->S[0].src));
noswizzle_PVSSRC(&(pAsm->S[0].src));
diff --git a/src/mesa/drivers/dri/r600/r700_chip.c b/src/mesa/drivers/dri/r600/r700_chip.c
index 1a1a87c3cf9..ef25cd93fe4 100644
--- a/src/mesa/drivers/dri/r600/r700_chip.c
+++ b/src/mesa/drivers/dri/r600/r700_chip.c
@@ -303,14 +303,13 @@ static void r700SetRenderTarget(context_t *context, int id)
R600_STATECHANGE(context, cb_target);
/* color buffer */
- r700->render_target[id].CB_COLOR0_BASE.u32All = context->radeon.state.color.draw_offset;
+ r700->render_target[id].CB_COLOR0_BASE.u32All = context->radeon.state.color.draw_offset / 256;
nPitchInPixel = rrb->pitch/rrb->cpp;
SETfield(r700->render_target[id].CB_COLOR0_SIZE.u32All, (nPitchInPixel/8)-1,
PITCH_TILE_MAX_shift, PITCH_TILE_MAX_mask);
SETfield(r700->render_target[id].CB_COLOR0_SIZE.u32All, ( (nPitchInPixel * context->radeon.radeonScreen->driScreen->fbHeight)/64 )-1,
SLICE_TILE_MAX_shift, SLICE_TILE_MAX_mask);
- r700->render_target[id].CB_COLOR0_BASE.u32All = 0;
SETfield(r700->render_target[id].CB_COLOR0_INFO.u32All, ENDIAN_NONE, ENDIAN_shift, ENDIAN_mask);
SETfield(r700->render_target[id].CB_COLOR0_INFO.u32All, ARRAY_LINEAR_GENERAL,
CB_COLOR0_INFO__ARRAY_MODE_shift, CB_COLOR0_INFO__ARRAY_MODE_mask);
diff --git a/src/mesa/drivers/dri/r600/r700_state.c b/src/mesa/drivers/dri/r600/r700_state.c
index 3c8cb579f9b..20e8afefbaa 100644
--- a/src/mesa/drivers/dri/r600/r700_state.c
+++ b/src/mesa/drivers/dri/r600/r700_state.c
@@ -59,6 +59,7 @@ static void r700SetClipPlaneState(GLcontext * ctx, GLenum cap, GLboolean state);
static void r700UpdatePolygonMode(GLcontext * ctx);
static void r700SetPolygonOffsetState(GLcontext * ctx, GLboolean state);
static void r700SetStencilState(GLcontext * ctx, GLboolean state);
+static void r700UpdateWindow(GLcontext * ctx, int id);
void r700UpdateShaders(GLcontext * ctx)
{
@@ -780,6 +781,9 @@ static void r700Enable(GLcontext * ctx, GLenum cap, GLboolean state) //---------
case GL_LINE_STIPPLE:
r700UpdateLineStipple(ctx);
break;
+ case GL_DEPTH_CLAMP:
+ r700UpdateWindow(ctx, 0);
+ break;
default:
break;
}
@@ -1576,9 +1580,9 @@ static void r700InitSQConfig(GLcontext * ctx)
SETbit(r700->sq_config.SQ_CONFIG.u32All, DX9_CONSTS_bit);
SETbit(r700->sq_config.SQ_CONFIG.u32All, ALU_INST_PREFER_VECTOR_bit);
SETfield(r700->sq_config.SQ_CONFIG.u32All, ps_prio, PS_PRIO_shift, PS_PRIO_mask);
- SETfield(r700->sq_config.SQ_CONFIG.u32All, ps_prio, VS_PRIO_shift, VS_PRIO_mask);
- SETfield(r700->sq_config.SQ_CONFIG.u32All, ps_prio, GS_PRIO_shift, GS_PRIO_mask);
- SETfield(r700->sq_config.SQ_CONFIG.u32All, ps_prio, ES_PRIO_shift, ES_PRIO_mask);
+ SETfield(r700->sq_config.SQ_CONFIG.u32All, vs_prio, VS_PRIO_shift, VS_PRIO_mask);
+ SETfield(r700->sq_config.SQ_CONFIG.u32All, gs_prio, GS_PRIO_shift, GS_PRIO_mask);
+ SETfield(r700->sq_config.SQ_CONFIG.u32All, es_prio, ES_PRIO_shift, ES_PRIO_mask);
r700->sq_config.SQ_GPR_RESOURCE_MGMT_1.u32All = 0;
SETfield(r700->sq_config.SQ_GPR_RESOURCE_MGMT_1.u32All, num_ps_gprs, NUM_PS_GPRS_shift, NUM_PS_GPRS_mask);
diff --git a/src/mesa/drivers/dri/r600/server/radeon_egl.c b/src/mesa/drivers/dri/r600/server/radeon_egl.c
deleted file mode 120000
index d7735a76438..00000000000
--- a/src/mesa/drivers/dri/r600/server/radeon_egl.c
+++ /dev/null
@@ -1 +0,0 @@
-../../radeon/server/radeon_egl.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c
index e0b853bc97d..79f3ff7da65 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common.c
@@ -1036,10 +1036,11 @@ static INLINE void radeon_emit_atom(radeonContextPtr radeon, struct radeon_state
OUT_BATCH_TABLE(atom->cmd, dwords);
END_BATCH();
}
+ atom->dirty = GL_FALSE;
+
} else {
radeon_print(RADEON_STATE, RADEON_VERBOSE, " skip state %s\n", atom->name);
}
- atom->dirty = GL_FALSE;
}
diff --git a/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c b/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c
index bf46eb8aaba..cc951a12cbc 100644
--- a/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c
+++ b/src/mesa/drivers/dri/radeon/radeon_cs_legacy.c
@@ -180,7 +180,6 @@ static int cs_begin(struct radeon_cs_int *cs,
if (cs->cdw + ndw > cs->ndw) {
uint32_t tmp, *ptr;
- int num = (ndw > 0x3FF) ? ndw : 0x3FF;
tmp = (cs->cdw + ndw + 0x3ff) & (~0x3ff);
ptr = (uint32_t*)realloc(cs->packets, 4 * tmp);
diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c
index 7b1f84a7154..e780b9eef1b 100644
--- a/src/mesa/drivers/dri/radeon/radeon_fbo.c
+++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c
@@ -531,10 +531,9 @@ radeon_render_texture(GLcontext * ctx,
att->TextureLevel);
if (att->Texture->Target == GL_TEXTURE_3D) {
- GLuint offsets[6];
- radeon_miptree_depth_offsets(radeon_image->mt, att->TextureLevel,
- offsets);
- imageOffset += offsets[att->Zoffset];
+ imageOffset += radeon_image->mt->levels[att->TextureLevel].rowstride *
+ radeon_image->mt->levels[att->TextureLevel].height *
+ att->Zoffset;
}
/* store that offset in the region, along with the correct pitch for
diff --git a/src/mesa/drivers/dri/radeon/radeon_ioctl.c b/src/mesa/drivers/dri/radeon/radeon_ioctl.c
index a9d50c5d078..afe3d9f12e2 100644
--- a/src/mesa/drivers/dri/radeon/radeon_ioctl.c
+++ b/src/mesa/drivers/dri/radeon/radeon_ioctl.c
@@ -46,7 +46,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "main/shaders.h"
#include "main/texstate.h"
#include "main/varray.h"
-#include "glapi/dispatch.h"
#include "swrast/swrast.h"
#include "main/stencil.h"
#include "main/matrix.h"
diff --git a/src/mesa/drivers/dri/radeon/radeon_lighting.c b/src/mesa/drivers/dri/radeon/radeon_lighting.c
deleted file mode 100644
index ba444f2b100..00000000000
--- a/src/mesa/drivers/dri/radeon/radeon_lighting.c
+++ /dev/null
@@ -1,681 +0,0 @@
-/*
- * Copyright 2000, 2001 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, 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
- * 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:
- * Gareth Hughes <[email protected]>
- * Keith Whitwell <[email protected]>
- */
-
-#include "main/glheader.h"
-#include "main/imports.h"
-#include "api_arrayelt.h"
-/* #include "mmath.h" */
-#include "main/enums.h"
-#include "colormac.h"
-
-
-#include "radeon_context.h"
-#include "radeon_ioctl.h"
-#include "radeon_state.h"
-#include "radeon_tcl.h"
-#include "radeon_tex.h"
-#include "radeon_vtxfmt.h"
-
-
-
-/* =============================================================
- * Materials
- */
-
-
-/* Update on colormaterial, material emmissive/ambient,
- * lightmodel.globalambient
- */
-void update_global_ambient( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- float *fcmd = (float *)RADEON_DB_STATE( glt );
-
- /* Need to do more if both emmissive & ambient are PREMULT:
- */
- if ((rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] &
- ((3 << RADEON_EMISSIVE_SOURCE_SHIFT) |
- (3 << RADEON_AMBIENT_SOURCE_SHIFT))) == 0)
- {
- COPY_3V( &fcmd[GLT_RED],
- ctx->Light.Material[0].Emission);
- ACC_SCALE_3V( &fcmd[GLT_RED],
- ctx->Light.Model.Ambient,
- ctx->Light.Material[0].Ambient);
- }
- else
- {
- COPY_3V( &fcmd[GLT_RED], ctx->Light.Model.Ambient );
- }
-
- RADEON_DB_STATECHANGE(rmesa, &rmesa->hw.glt);
-}
-
-/* Update on change to
- * - light[p].colors
- * - light[p].enabled
- * - material,
- * - colormaterial enabled
- * - colormaterial bitmask
- */
-void update_light_colors( GLcontext *ctx, GLuint p )
-{
- struct gl_light *l = &ctx->Light.Light[p];
-
-/* fprintf(stderr, "%s\n", __FUNCTION__); */
-
- if (l->Enabled) {
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- float *fcmd = (float *)RADEON_DB_STATE( lit[p] );
- GLuint bitmask = ctx->Light.ColorMaterialBitmask;
- struct gl_material *mat = &ctx->Light.Material[0];
-
- COPY_4V( &fcmd[LIT_AMBIENT_RED], l->Ambient );
- COPY_4V( &fcmd[LIT_DIFFUSE_RED], l->Diffuse );
- COPY_4V( &fcmd[LIT_SPECULAR_RED], l->Specular );
-
- if (!ctx->Light.ColorMaterialEnabled)
- bitmask = 0;
-
- if ((bitmask & FRONT_AMBIENT_BIT) == 0)
- SELF_SCALE_3V( &fcmd[LIT_AMBIENT_RED], mat->Ambient );
-
- if ((bitmask & FRONT_DIFFUSE_BIT) == 0)
- SELF_SCALE_3V( &fcmd[LIT_DIFFUSE_RED], mat->Diffuse );
-
- if ((bitmask & FRONT_SPECULAR_BIT) == 0)
- SELF_SCALE_3V( &fcmd[LIT_SPECULAR_RED], mat->Specular );
-
- RADEON_DB_STATECHANGE( rmesa, &rmesa->hw.lit[p] );
- }
-}
-
-/* Also fallback for asym colormaterial mode in twoside lighting...
- */
-void check_twoside_fallback( GLcontext *ctx )
-{
- GLboolean fallback = GL_FALSE;
-
- if (ctx->Light.Enabled && ctx->Light.Model.TwoSide) {
- if (memcmp( &ctx->Light.Material[0],
- &ctx->Light.Material[1],
- sizeof(struct gl_material)) != 0)
- fallback = GL_TRUE;
- else if (ctx->Light.ColorMaterialEnabled &&
- (ctx->Light.ColorMaterialBitmask & BACK_MATERIAL_BITS) !=
- ((ctx->Light.ColorMaterialBitmask & FRONT_MATERIAL_BITS)<<1))
- fallback = GL_TRUE;
- }
-
- TCL_FALLBACK( ctx, RADEON_TCL_FALLBACK_LIGHT_TWOSIDE, fallback );
-}
-
-void radeonColorMaterial( GLcontext *ctx, GLenum face, GLenum mode )
-{
- if (ctx->Light.ColorMaterialEnabled) {
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint light_model_ctl = rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL];
- GLuint mask = ctx->Light.ColorMaterialBitmask;
-
- /* Default to PREMULT:
- */
- light_model_ctl &= ~((3 << RADEON_EMISSIVE_SOURCE_SHIFT) |
- (3 << RADEON_AMBIENT_SOURCE_SHIFT) |
- (3 << RADEON_DIFFUSE_SOURCE_SHIFT) |
- (3 << RADEON_SPECULAR_SOURCE_SHIFT));
-
- if (mask & FRONT_EMISSION_BIT) {
- light_model_ctl |= (RADEON_LM_SOURCE_VERTEX_DIFFUSE <<
- RADEON_EMISSIVE_SOURCE_SHIFT);
- }
-
- if (mask & FRONT_AMBIENT_BIT) {
- light_model_ctl |= (RADEON_LM_SOURCE_VERTEX_DIFFUSE <<
- RADEON_AMBIENT_SOURCE_SHIFT);
- }
-
- if (mask & FRONT_DIFFUSE_BIT) {
- light_model_ctl |= (RADEON_LM_SOURCE_VERTEX_DIFFUSE <<
- RADEON_DIFFUSE_SOURCE_SHIFT);
- }
-
- if (mask & FRONT_SPECULAR_BIT) {
- light_model_ctl |= (RADEON_LM_SOURCE_VERTEX_DIFFUSE <<
- RADEON_SPECULAR_SOURCE_SHIFT);
- }
-
- if (light_model_ctl != rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL]) {
- GLuint p;
-
- RADEON_STATECHANGE( rmesa, tcl );
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] = light_model_ctl;
-
- for (p = 0 ; p < MAX_LIGHTS; p++)
- update_light_colors( ctx, p );
- update_global_ambient( ctx );
- }
- }
-
- check_twoside_fallback( ctx );
-}
-
-void radeonUpdateMaterial( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLfloat *fcmd = (GLfloat *)RADEON_DB_STATE( mtl );
- GLuint p;
- GLuint mask = ~0;
-
- if (ctx->Light.ColorMaterialEnabled)
- mask &= ~ctx->Light.ColorMaterialBitmask;
-
- if (RADEON_DEBUG & RADEON_STATE)
- fprintf(stderr, "%s\n", __FUNCTION__);
-
-
- if (mask & FRONT_EMISSION_BIT) {
- fcmd[MTL_EMMISSIVE_RED] = ctx->Light.Material[0].Emission[0];
- fcmd[MTL_EMMISSIVE_GREEN] = ctx->Light.Material[0].Emission[1];
- fcmd[MTL_EMMISSIVE_BLUE] = ctx->Light.Material[0].Emission[2];
- fcmd[MTL_EMMISSIVE_ALPHA] = ctx->Light.Material[0].Emission[3];
- }
- if (mask & FRONT_AMBIENT_BIT) {
- fcmd[MTL_AMBIENT_RED] = ctx->Light.Material[0].Ambient[0];
- fcmd[MTL_AMBIENT_GREEN] = ctx->Light.Material[0].Ambient[1];
- fcmd[MTL_AMBIENT_BLUE] = ctx->Light.Material[0].Ambient[2];
- fcmd[MTL_AMBIENT_ALPHA] = ctx->Light.Material[0].Ambient[3];
- }
- if (mask & FRONT_DIFFUSE_BIT) {
- fcmd[MTL_DIFFUSE_RED] = ctx->Light.Material[0].Diffuse[0];
- fcmd[MTL_DIFFUSE_GREEN] = ctx->Light.Material[0].Diffuse[1];
- fcmd[MTL_DIFFUSE_BLUE] = ctx->Light.Material[0].Diffuse[2];
- fcmd[MTL_DIFFUSE_ALPHA] = ctx->Light.Material[0].Diffuse[3];
- }
- if (mask & FRONT_SPECULAR_BIT) {
- fcmd[MTL_SPECULAR_RED] = ctx->Light.Material[0].Specular[0];
- fcmd[MTL_SPECULAR_GREEN] = ctx->Light.Material[0].Specular[1];
- fcmd[MTL_SPECULAR_BLUE] = ctx->Light.Material[0].Specular[2];
- fcmd[MTL_SPECULAR_ALPHA] = ctx->Light.Material[0].Specular[3];
- }
- if (mask & FRONT_SHININESS_BIT) {
- fcmd[MTL_SHININESS] = ctx->Light.Material[0].Shininess;
- }
-
- if (RADEON_DB_STATECHANGE( rmesa, &rmesa->hw.mtl )) {
- for (p = 0 ; p < MAX_LIGHTS; p++)
- update_light_colors( ctx, p );
-
- check_twoside_fallback( ctx );
- update_global_ambient( ctx );
- }
- else if (RADEON_DEBUG & (RADEON_PRIMS|DEBUG_STATE))
- fprintf(stderr, "%s: Elided noop material call\n", __FUNCTION__);
-}
-
-/* _NEW_LIGHT
- * _NEW_MODELVIEW
- * _MESA_NEW_NEED_EYE_COORDS
- *
- * Uses derived state from mesa:
- * _VP_inf_norm
- * _h_inf_norm
- * _Position
- * _NormSpotDirection
- * _ModelViewInvScale
- * _NeedEyeCoords
- * _EyeZDir
- *
- * which are calculated in light.c and are correct for the current
- * lighting space (model or eye), hence dependencies on _NEW_MODELVIEW
- * and _MESA_NEW_NEED_EYE_COORDS.
- */
-void radeonUpdateLighting( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- /* Have to check these, or have an automatic shortcircuit mechanism
- * to remove noop statechanges. (Or just do a better job on the
- * front end).
- */
- {
- GLuint tmp = rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL];
-
- if (ctx->_NeedEyeCoords)
- tmp &= ~RADEON_LIGHT_IN_MODELSPACE;
- else
- tmp |= RADEON_LIGHT_IN_MODELSPACE;
-
-
- /* Leave this test disabled: (unexplained q3 lockup) (even with
- new packets)
- */
- if (tmp != rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL])
- {
- RADEON_STATECHANGE( rmesa, tcl );
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] = tmp;
- }
- }
-
- {
- GLfloat *fcmd = (GLfloat *)RADEON_DB_STATE( eye );
- fcmd[EYE_X] = ctx->_EyeZDir[0];
- fcmd[EYE_Y] = ctx->_EyeZDir[1];
- fcmd[EYE_Z] = - ctx->_EyeZDir[2];
- fcmd[EYE_RESCALE_FACTOR] = ctx->_ModelViewInvScale;
- RADEON_DB_STATECHANGE( rmesa, &rmesa->hw.eye );
- }
-
-
-/* RADEON_STATECHANGE( rmesa, glt ); */
-
- if (ctx->Light.Enabled) {
- GLint p;
- for (p = 0 ; p < MAX_LIGHTS; p++) {
- if (ctx->Light.Light[p].Enabled) {
- struct gl_light *l = &ctx->Light.Light[p];
- GLfloat *fcmd = (GLfloat *)RADEON_DB_STATE( lit[p] );
-
- if (l->EyePosition[3] == 0.0) {
- COPY_3FV( &fcmd[LIT_POSITION_X], l->_VP_inf_norm );
- COPY_3FV( &fcmd[LIT_DIRECTION_X], l->_h_inf_norm );
- fcmd[LIT_POSITION_W] = 0;
- fcmd[LIT_DIRECTION_W] = 0;
- } else {
- COPY_4V( &fcmd[LIT_POSITION_X], l->_Position );
- fcmd[LIT_DIRECTION_X] = -l->_NormSpotDirection[0];
- fcmd[LIT_DIRECTION_Y] = -l->_NormSpotDirection[1];
- fcmd[LIT_DIRECTION_Z] = -l->_NormSpotDirection[2];
- fcmd[LIT_DIRECTION_W] = 0;
- }
-
- RADEON_DB_STATECHANGE( rmesa, &rmesa->hw.lit[p] );
- }
- }
- }
-}
-
-
-void radeonLightfv( GLcontext *ctx, GLenum light,
- GLenum pname, const GLfloat *params )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLint p = light - GL_LIGHT0;
- struct gl_light *l = &ctx->Light.Light[p];
- GLfloat *fcmd = (GLfloat *)rmesa->hw.lit[p].cmd;
-
-
- switch (pname) {
- case GL_AMBIENT:
- case GL_DIFFUSE:
- case GL_SPECULAR:
- update_light_colors( ctx, p );
- break;
-
- case GL_SPOT_DIRECTION:
- /* picked up in update_light */
- break;
-
- case GL_POSITION: {
- /* positions picked up in update_light, but can do flag here */
- GLuint flag = (p&1)? RADEON_LIGHT_1_IS_LOCAL : RADEON_LIGHT_0_IS_LOCAL;
- GLuint idx = TCL_PER_LIGHT_CTL_0 + p/2;
-
- RADEON_STATECHANGE(rmesa, tcl);
- if (l->EyePosition[3] != 0.0F)
- rmesa->hw.tcl.cmd[idx] |= flag;
- else
- rmesa->hw.tcl.cmd[idx] &= ~flag;
- break;
- }
-
- case GL_SPOT_EXPONENT:
- RADEON_STATECHANGE(rmesa, lit[p]);
- fcmd[LIT_SPOT_EXPONENT] = params[0];
- break;
-
- case GL_SPOT_CUTOFF: {
- GLuint flag = (p&1) ? RADEON_LIGHT_1_IS_SPOT : RADEON_LIGHT_0_IS_SPOT;
- GLuint idx = TCL_PER_LIGHT_CTL_0 + p/2;
-
- RADEON_STATECHANGE(rmesa, lit[p]);
- fcmd[LIT_SPOT_CUTOFF] = l->_CosCutoff;
-
- RADEON_STATECHANGE(rmesa, tcl);
- if (l->SpotCutoff != 180.0F)
- rmesa->hw.tcl.cmd[idx] |= flag;
- else
- rmesa->hw.tcl.cmd[idx] &= ~flag;
- break;
- }
-
- case GL_CONSTANT_ATTENUATION:
- RADEON_STATECHANGE(rmesa, lit[p]);
- fcmd[LIT_ATTEN_CONST] = params[0];
- break;
- case GL_LINEAR_ATTENUATION:
- RADEON_STATECHANGE(rmesa, lit[p]);
- fcmd[LIT_ATTEN_LINEAR] = params[0];
- break;
- case GL_QUADRATIC_ATTENUATION:
- RADEON_STATECHANGE(rmesa, lit[p]);
- fcmd[LIT_ATTEN_QUADRATIC] = params[0];
- break;
- default:
- return;
- }
-
-}
-
-
-
-
-void radeonLightModelfv( GLcontext *ctx, GLenum pname,
- const GLfloat *param )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
-
- switch (pname) {
- case GL_LIGHT_MODEL_AMBIENT:
- update_global_ambient( ctx );
- break;
-
- case GL_LIGHT_MODEL_LOCAL_VIEWER:
- RADEON_STATECHANGE( rmesa, tcl );
- if (ctx->Light.Model.LocalViewer)
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] |= RADEON_LOCAL_VIEWER;
- else
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] &= ~RADEON_LOCAL_VIEWER;
- break;
-
- case GL_LIGHT_MODEL_TWO_SIDE:
- RADEON_STATECHANGE( rmesa, tcl );
- if (ctx->Light.Model.TwoSide)
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= RADEON_LIGHT_TWOSIDE;
- else
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~RADEON_LIGHT_TWOSIDE;
-
- check_twoside_fallback( ctx );
-
-#if _HAVE_SWTNL
- if (rmesa->TclFallback) {
- radeonChooseRenderState( ctx );
- radeonChooseVertexState( ctx );
- }
-#endif
- break;
-
- case GL_LIGHT_MODEL_COLOR_CONTROL:
- radeonUpdateSpecular(ctx);
-
- RADEON_STATECHANGE( rmesa, tcl );
- if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] &=
- ~RADEON_DIFFUSE_SPECULAR_COMBINE;
- else
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] |=
- RADEON_DIFFUSE_SPECULAR_COMBINE;
- break;
-
- default:
- break;
- }
-}
-
-
-/* =============================================================
- * Fog
- */
-
-
-static void radeonFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- union { int i; float f; } c, d;
- GLchan col[4];
-
- c.i = rmesa->hw.fog.cmd[FOG_C];
- d.i = rmesa->hw.fog.cmd[FOG_D];
-
- switch (pname) {
- case GL_FOG_MODE:
- if (!ctx->Fog.Enabled)
- return;
- RADEON_STATECHANGE(rmesa, tcl);
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~RADEON_TCL_FOG_MASK;
- switch (ctx->Fog.Mode) {
- case GL_LINEAR:
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= RADEON_TCL_FOG_LINEAR;
- if (ctx->Fog.Start == ctx->Fog.End) {
- c.f = 1.0F;
- d.f = 1.0F;
- }
- else {
- c.f = ctx->Fog.End/(ctx->Fog.End-ctx->Fog.Start);
- d.f = 1.0/(ctx->Fog.End-ctx->Fog.Start);
- }
- break;
- case GL_EXP:
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= RADEON_TCL_FOG_EXP;
- c.f = 0.0;
- d.f = ctx->Fog.Density;
- break;
- case GL_EXP2:
- rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] |= RADEON_TCL_FOG_EXP2;
- c.f = 0.0;
- d.f = -(ctx->Fog.Density * ctx->Fog.Density);
- break;
- default:
- return;
- }
- break;
- case GL_FOG_DENSITY:
- switch (ctx->Fog.Mode) {
- case GL_EXP:
- c.f = 0.0;
- d.f = ctx->Fog.Density;
- break;
- case GL_EXP2:
- c.f = 0.0;
- d.f = -(ctx->Fog.Density * ctx->Fog.Density);
- break;
- default:
- break;
- }
- break;
- case GL_FOG_START:
- case GL_FOG_END:
- if (ctx->Fog.Mode == GL_LINEAR) {
- if (ctx->Fog.Start == ctx->Fog.End) {
- c.f = 1.0F;
- d.f = 1.0F;
- } else {
- c.f = ctx->Fog.End/(ctx->Fog.End-ctx->Fog.Start);
- d.f = 1.0/(ctx->Fog.End-ctx->Fog.Start);
- }
- }
- break;
- case GL_FOG_COLOR:
- RADEON_STATECHANGE( rmesa, ctx );
- UNCLAMPED_FLOAT_TO_RGB_CHAN( col, ctx->Fog.Color );
- rmesa->hw.ctx.cmd[CTX_PP_FOG_COLOR] =
- radeonPackColor( 4, col[0], col[1], col[2], 0 );
- break;
- case GL_FOG_COORDINATE_SOURCE_EXT:
- /* What to do?
- */
- break;
- default:
- return;
- }
-
- if (c.i != rmesa->hw.fog.cmd[FOG_C] || d.i != rmesa->hw.fog.cmd[FOG_D]) {
- RADEON_STATECHANGE( rmesa, fog );
- rmesa->hw.fog.cmd[FOG_C] = c.i;
- rmesa->hw.fog.cmd[FOG_D] = d.i;
- }
-}
-
-/* Examine lighting and texture state to determine if separate specular
- * should be enabled.
- */
-void radeonUpdateSpecular( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint p = rmesa->hw.ctx.cmd[CTX_PP_CNTL];
-
- if (NEED_SECONDARY_COLOR(ctx)) {
- p |= RADEON_SPECULAR_ENABLE;
- } else {
- p &= ~RADEON_SPECULAR_ENABLE;
- }
-
- if ( rmesa->hw.ctx.cmd[CTX_PP_CNTL] != p ) {
- RADEON_STATECHANGE( rmesa, ctx );
- rmesa->hw.ctx.cmd[CTX_PP_CNTL] = p;
- }
-
- /* Bizzare: have to leave lighting enabled to get fog.
- */
- RADEON_STATECHANGE( rmesa, tcl );
- if ((ctx->Light.Enabled &&
- ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)) {
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] |= RADEON_TCL_COMPUTE_SPECULAR;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] |= RADEON_TCL_COMPUTE_DIFFUSE;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_PK_SPEC;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_PK_DIFFUSE;
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] |= RADEON_LIGHTING_ENABLE;
- }
- else if (ctx->Fog.Enabled) {
- if (ctx->Light.Enabled) {
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] |= RADEON_TCL_COMPUTE_SPECULAR;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] |= RADEON_TCL_COMPUTE_DIFFUSE;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_PK_SPEC;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_PK_DIFFUSE;
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] |= RADEON_LIGHTING_ENABLE;
- } else {
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] |= RADEON_TCL_COMPUTE_SPECULAR;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] &= ~RADEON_TCL_COMPUTE_DIFFUSE;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_PK_SPEC;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_PK_DIFFUSE;
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] |= RADEON_LIGHTING_ENABLE;
- }
- }
- else if (ctx->Light.Enabled) {
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] &= ~RADEON_TCL_COMPUTE_SPECULAR;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] |= RADEON_TCL_COMPUTE_DIFFUSE;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] &= ~RADEON_TCL_VTX_PK_SPEC;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_PK_DIFFUSE;
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] |= RADEON_LIGHTING_ENABLE;
- } else if (ctx->Fog.ColorSumEnabled ) {
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] &= ~RADEON_TCL_COMPUTE_SPECULAR;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] &= ~RADEON_TCL_COMPUTE_DIFFUSE;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_PK_SPEC;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_PK_DIFFUSE;
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] &= ~RADEON_LIGHTING_ENABLE;
- } else {
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] &= ~RADEON_TCL_COMPUTE_SPECULAR;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXSEL] &= ~RADEON_TCL_COMPUTE_DIFFUSE;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] &= ~RADEON_TCL_VTX_PK_SPEC;
- rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] |= RADEON_TCL_VTX_PK_DIFFUSE;
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] &= ~RADEON_LIGHTING_ENABLE;
- }
-
-#if _HAVE_SWTNL
- /* Update vertex/render formats
- */
- if (rmesa->TclFallback) {
- radeonChooseRenderState( ctx );
- radeonChooseVertexState( ctx );
- }
-#endif
-}
-
-
-
-static void radeonLightingSpaceChange( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLboolean tmp;
- RADEON_STATECHANGE( rmesa, tcl );
-
- if (RADEON_DEBUG & RADEON_STATE)
- fprintf(stderr, "%s %d\n", __FUNCTION__, ctx->_NeedEyeCoords);
-
- if (ctx->_NeedEyeCoords)
- tmp = ctx->Transform.RescaleNormals;
- else
- tmp = !ctx->Transform.RescaleNormals;
-
- if ( tmp ) {
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] |= RADEON_RESCALE_NORMALS;
- } else {
- rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL] &= ~RADEON_RESCALE_NORMALS;
- }
-}
-
-void radeonInitLightStateFuncs( GLcontext *ctx )
-{
- radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- int i;
-
- ctx->Driver.LightModelfv = radeonLightModelfv;
- ctx->Driver.Lightfv = radeonLightfv;
- ctx->Driver.Fogfv = radeonFogfv;
- ctx->Driver.LightingSpaceChange = radeonLightingSpaceChange;
-
- for (i = 0 ; i < 8; i++) {
- struct gl_light *l = &ctx->Light.Light[i];
- GLenum p = GL_LIGHT0 + i;
- *(float *)&(rmesa->hw.lit[i].cmd[LIT_RANGE_CUTOFF]) = FLT_MAX;
-
- ctx->Driver.Lightfv( ctx, p, GL_AMBIENT, l->Ambient );
- ctx->Driver.Lightfv( ctx, p, GL_DIFFUSE, l->Diffuse );
- ctx->Driver.Lightfv( ctx, p, GL_SPECULAR, l->Specular );
- ctx->Driver.Lightfv( ctx, p, GL_POSITION, 0 );
- ctx->Driver.Lightfv( ctx, p, GL_SPOT_DIRECTION, 0 );
- ctx->Driver.Lightfv( ctx, p, GL_SPOT_EXPONENT, &l->SpotExponent );
- ctx->Driver.Lightfv( ctx, p, GL_SPOT_CUTOFF, &l->SpotCutoff );
- ctx->Driver.Lightfv( ctx, p, GL_CONSTANT_ATTENUATION,
- &l->ConstantAttenuation );
- ctx->Driver.Lightfv( ctx, p, GL_LINEAR_ATTENUATION,
- &l->LinearAttenuation );
- ctx->Driver.Lightfv( ctx, p, GL_QUADRATIC_ATTENUATION,
- &l->QuadraticAttenuation );
- }
-
- ctx->Driver.LightModelfv( ctx, GL_LIGHT_MODEL_AMBIENT,
- ctx->Light.Model.Ambient );
-
- ctx->Driver.Fogfv( ctx, GL_FOG_MODE, 0 );
- ctx->Driver.Fogfv( ctx, GL_FOG_DENSITY, &ctx->Fog.Density );
- ctx->Driver.Fogfv( ctx, GL_FOG_START, &ctx->Fog.Start );
- ctx->Driver.Fogfv( ctx, GL_FOG_END, &ctx->Fog.End );
- ctx->Driver.Fogfv( ctx, GL_FOG_COLOR, ctx->Fog.Color );
- ctx->Driver.Fogfv( ctx, GL_FOG_COORDINATE_SOURCE_EXT, 0 );
-}
diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
index 033f26db2a1..a1a523931fb 100644
--- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
+++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
@@ -177,6 +177,12 @@ static void calculate_miptree_layout_r300(radeonContextPtr rmesa, radeon_mipmap_
for(face = 0; face < mt->faces; face++)
compute_tex_image_offset(rmesa, mt, face, level, &curOffset);
+ /* r600 cube levels seems to be aligned to 8 faces but
+ * we have separate register for 1'st level offset so add
+ * 2 image alignment after 1'st mip level */
+ if(rmesa->radeonScreen->chip_family >= CHIP_FAMILY_R600 &&
+ mt->target == GL_TEXTURE_CUBE_MAP && level >= 1)
+ curOffset += 2 * mt->levels[level].size;
}
/* Note the required size in memory */
@@ -380,25 +386,6 @@ void radeon_try_alloc_miptree(radeonContextPtr rmesa, radeonTexObj *t)
texImg->Depth, t->tile_bits);
}
-/* Although we use the image_offset[] array to store relative offsets
- * to cube faces, Mesa doesn't know anything about this and expects
- * each cube face to be treated as a separate image.
- *
- * These functions present that view to mesa:
- */
-void
-radeon_miptree_depth_offsets(radeon_mipmap_tree *mt, GLuint level, GLuint *offsets)
-{
- if (mt->target != GL_TEXTURE_3D || mt->faces == 1) {
- offsets[0] = 0;
- } else {
- int i;
- for (i = 0; i < 6; i++) {
- offsets[i] = mt->levels[level].faces[i].offset;
- }
- }
-}
-
GLuint
radeon_miptree_image_offset(radeon_mipmap_tree *mt,
GLuint face, GLuint level)
@@ -619,4 +606,4 @@ uint32_t get_base_teximage_offset(radeonTexObj *texObj)
} else {
return radeon_miptree_image_offset(texObj->mt, 0, texObj->minLod);
}
-} \ No newline at end of file
+}
diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h
index a10649b5aea..c911688c1a5 100644
--- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h
+++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h
@@ -88,7 +88,5 @@ GLboolean radeon_miptree_matches_image(radeon_mipmap_tree *mt,
void radeon_try_alloc_miptree(radeonContextPtr rmesa, radeonTexObj *t);
GLuint radeon_miptree_image_offset(radeon_mipmap_tree *mt,
GLuint face, GLuint level);
-void radeon_miptree_depth_offsets(radeon_mipmap_tree *mt, GLuint level, GLuint *offsets);
-
uint32_t get_base_teximage_offset(radeonTexObj *texObj);
#endif /* __RADEON_MIPMAP_TREE_H_ */
diff --git a/src/mesa/drivers/dri/radeon/radeon_queryobj.c b/src/mesa/drivers/dri/radeon/radeon_queryobj.c
index 98117cdfc14..d0dcf0e431a 100644
--- a/src/mesa/drivers/dri/radeon/radeon_queryobj.c
+++ b/src/mesa/drivers/dri/radeon/radeon_queryobj.c
@@ -65,7 +65,7 @@ static void radeonQueryGetResult(GLcontext *ctx, struct gl_query_object *q)
}
radeon_print(RADEON_STATE, RADEON_TRACE,
- "%d start: %lx, end: %lx %ld\n", i, start, end, end - start);
+ "%d start: %llx, end: %llx %lld\n", i, start, end, end - start);
}
} else {
for (i = 0; i < query->curr_offset/sizeof(uint32_t); ++i) {
diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c
index 20a27ad9a70..4538e74eea1 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.c
@@ -233,8 +233,15 @@ static void radeon_generate_mipmap(GLcontext *ctx, GLenum target,
void radeonGenerateMipmap(GLcontext* ctx, GLenum target, struct gl_texture_object *texObj)
{
+ radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
+ struct radeon_bo *bo;
GLuint face = _mesa_tex_target_to_face(target);
radeon_texture_image *baseimage = get_radeon_texture_image(texObj->Image[face][texObj->BaseLevel]);
+ bo = !baseimage->mt ? baseimage->bo : baseimage->mt->bo;
+
+ if (bo && radeon_bo_is_referenced_by_cs(bo, rmesa->cmdbuf.cs)) {
+ radeon_firevertices(rmesa);
+ }
radeon_teximage_map(baseimage, GL_FALSE);
radeon_generate_mipmap(ctx, target, texObj);
diff --git a/src/mesa/drivers/dri/radeon/server/radeon_egl.c b/src/mesa/drivers/dri/radeon/server/radeon_egl.c
deleted file mode 100644
index c16d66e4ece..00000000000
--- a/src/mesa/drivers/dri/radeon/server/radeon_egl.c
+++ /dev/null
@@ -1,1088 +0,0 @@
-/*
- * EGL driver for radeon_dri.so
- */
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <dirent.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-
-#include "eglconfig.h"
-#include "eglcontext.h"
-#include "egldisplay.h"
-#include "egldriver.h"
-#include "eglglobals.h"
-#include "egllog.h"
-#include "eglmode.h"
-#include "eglscreen.h"
-#include "eglsurface.h"
-#include "egldri.h"
-
-#include "mtypes.h"
-#include "memops.h"
-#include "drm.h"
-#include "drm_sarea.h"
-#include "radeon_drm.h"
-#include "radeon_dri.h"
-#include "radeon.h"
-
-static size_t radeon_drm_page_size;
-
-/**
- * radeon driver-specific driver class derived from _EGLDriver
- */
-typedef struct radeon_driver
-{
- _EGLDriver Base; /* base class/object */
- GLuint radeonStuff;
-} radeonDriver;
-
-static int
-RADEONSetParam(driDisplay *disp, int param, int value)
-{
- drm_radeon_setparam_t sp;
- int ret;
-
- memset(&sp, 0, sizeof(sp));
- sp.param = param;
- sp.value = value;
-
- if ((ret=drmCommandWrite(disp->drmFD, DRM_RADEON_SETPARAM, &sp, sizeof(sp)))) {
- fprintf(stderr,"Set param failed\n", ret);
- return -1;
- }
-
- return 0;
-}
-
-static int
-RADEONCheckDRMVersion(driDisplay *disp, RADEONInfoPtr info)
-{
- drmVersionPtr version;
-
- version = drmGetVersion(disp->drmFD);
- if (version) {
- int req_minor, req_patch;
-
- /* Need 1.21.x for card type detection getparam
- */
- req_minor = 21;
- 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;
-}
-
-
-/**
- * \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;
-}
-
-
-/* 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(driDisplay *disp, RADEONInfoPtr info)
-{
- int ret;
- int flags = DRM_READ_ONLY | DRM_LOCKED | DRM_KERNEL;
- int s, l;
-
- ret = drmScatterGatherAlloc(disp->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%04lx\n",
- info->gartSize*1024, (long) 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(disp->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%08lx\n", info->ringHandle);
-
- if (drmAddMap(disp->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(disp->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(disp->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%08lx\n",
- info->gartTexHandle);
-
- return 1;
-}
-
-
-/**
- * \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( driDisplay *disp, RADEONInfoPtr info)
-{
- int mode, ret;
- int s, l;
- int agpmode = 1;
-
- if (drmAgpAcquire(disp->drmFD) < 0) {
- fprintf(stderr, "[gart] AGP not available\n");
- return 0;
- }
-
- mode = drmAgpGetMode(disp->drmFD); /* Default mode */
- /* Disable fast write entirely - too many lockups.
- */
- mode &= ~RADEON_AGP_MODE_MASK;
- switch (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(disp->drmFD, mode) < 0) {
- fprintf(stderr, "[gart] AGP not enabled\n");
- drmAgpRelease(disp->drmFD);
- return 0;
- }
-
-#if 0
- /* Workaround for some hardware bugs */
- if (info->ChipFamily < CHIP_FAMILY_R200)
- OUTREG(RADEON_AGP_CNTL, INREG(RADEON_AGP_CNTL) | 0x000e0000);
-#endif
- info->gartOffset = 0;
-
- if ((ret = drmAgpAlloc(disp->drmFD, info->gartSize*1024*1024, 0, NULL,
- &info->gartMemHandle)) < 0) {
- fprintf(stderr, "[gart] Out of memory (%d)\n", ret);
- drmAgpRelease(disp->drmFD);
- return 0;
- }
- fprintf(stderr,
- "[gart] %d kB allocated with handle 0x%08x\n",
- info->gartSize*1024, (unsigned)info->gartMemHandle);
-
- if (drmAgpBind(disp->drmFD,
- info->gartMemHandle, info->gartOffset) < 0) {
- fprintf(stderr, "[gart] Could not bind\n");
- drmAgpFree(disp->drmFD, info->gartMemHandle);
- drmAgpRelease(disp->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(disp->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%08lx\n", info->ringHandle);
-
-
- if (drmAddMap(disp->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(disp->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%08lx\n",
- info->bufHandle);
-
- if (drmAddMap(disp->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);
-
- return 1;
-}
-
-
-/**
- * Initialize all the memory-related fields of the RADEONInfo object.
- * This includes the various 'offset' and 'size' fields.
- */
-static int
-RADEONMemoryInit(driDisplay *disp, RADEONInfoPtr info)
-{
- int width_bytes = disp->virtualWidth * disp->cpp;
- int cpp = disp->cpp;
- int bufferSize = ((disp->virtualHeight * width_bytes
- + RADEON_BUFFER_ALIGN)
- & ~RADEON_BUFFER_ALIGN);
- int depthSize = ((((disp->virtualHeight+15) & ~15) * width_bytes
- + RADEON_BUFFER_ALIGN)
- & ~RADEON_BUFFER_ALIGN);
- int l;
- int pcie_gart_table_size = 0;
-
- info->frontOffset = 0;
- info->frontPitch = disp->virtualWidth;
-
- if (disp->card_type==RADEON_CARD_PCIE)
- pcie_gart_table_size = RADEON_PCIGART_TABLE_SIZE;
-
- /* Front, back and depth buffers - everything else texture??
- */
- info->textureSize = disp->fbSize - pcie_gart_table_size - 2 * bufferSize - depthSize;
-
- 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 */
- info->textureOffset = ((disp->fbSize - pcie_gart_table_size - 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 = disp->virtualWidth;
-
- info->backOffset = ((info->depthOffset - bufferSize +
- RADEON_BUFFER_ALIGN) &
- ~RADEON_BUFFER_ALIGN);
- info->backPitch = disp->virtualWidth;
-
- if (pcie_gart_table_size)
- info->pcieGartTableOffset = disp->fbSize - pcie_gart_table_size;
-
- fprintf(stderr,
- "Will use back buffer at offset 0x%x, pitch %d\n",
- info->backOffset, info->backPitch);
- fprintf(stderr,
- "Will use depth buffer at offset 0x%x, pitch %d\n",
- info->depthOffset, info->depthPitch);
- fprintf(stderr,
- "Will use %d kb for textures at offset 0x%x\n",
- info->textureSize/1024, info->textureOffset);
- if (pcie_gart_table_size)
- {
- fprintf(stderr,
- "Will use %d kb for PCIE GART Table at offset 0x%x\n",
- pcie_gart_table_size/1024, info->pcieGartTableOffset);
- }
-
- /* XXX I don't think these are needed. */
-#if 0
- 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));
-#endif
-
- if (pcie_gart_table_size)
- RADEONSetParam(disp, RADEON_SETPARAM_PCIGART_LOCATION, info->pcieGartTableOffset);
-
- 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( driDisplay *disp,
- RADEONInfoPtr info)
-{
- int cpp = disp->bpp / 8;
- drm_radeon_init_t drmInfo;
- int ret;
-
- memset(&drmInfo, 0, sizeof(drmInfo));
-
- if ( (info->ChipFamily >= CHIP_FAMILY_R300) )
- drmInfo.func = RADEON_INIT_R300_CP;
- else 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 */
- /* XXX problem here:
- * The front/back/depth_offset/pitch fields may change depending upon
- * which drawing surface we're using!!! They can't be set just once
- * during initialization.
- * Looks like we'll need a new ioctl to update these fields for drawing
- * to other surfaces...
- */
- drmInfo.sarea_priv_offset = sizeof(drm_sarea_t);
- 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 = disp->bpp;
- drmInfo.depth_bpp = disp->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.ring_offset = info->ringHandle;
- drmInfo.ring_rptr_offset = info->ringReadPtrHandle;
- drmInfo.buffers_offset = info->bufHandle;
- drmInfo.gart_textures_offset = info->gartTexHandle;
-
- ret = drmCommandWrite(disp->drmFD, DRM_RADEON_CP_INIT, &drmInfo,
- sizeof(drm_radeon_init_t));
-
- 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 RADEONDRIBufInit( driDisplay *disp, RADEONInfoPtr info )
-{
- /* Initialize vertex buffers */
- info->bufNumBufs = drmAddBufs(disp->drmFD,
- info->bufMapSize / RADEON_BUFFER_SIZE,
- RADEON_BUFFER_SIZE,
- (disp->card_type!=RADEON_CARD_AGP) ? 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 disp 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(driDisplay *disp, RADEONInfoPtr info)
-{
- if ((drmCtlInstHandler(disp->drmFD, 0)) != 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");
-}
-
-
-/**
- * \brief Initialize the AGP heap.
- *
- * \param disp 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(driDisplay *disp,
- 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(disp->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);
- }
-}
-
-static int RADEONGetCardType(driDisplay *disp, RADEONInfoPtr info)
-{
- drm_radeon_getparam_t gp;
- int ret;
-
- gp.param = RADEON_PARAM_CARD_TYPE;
- gp.value = &disp->card_type;
-
- ret=drmCommandWriteRead(disp->drmFD, DRM_RADEON_GETPARAM, &gp, sizeof(gp));
- if (ret) {
- fprintf(stderr, "drm_radeon_getparam_t (RADEON_PARAM_CARD_TYPE) : %d\n", ret);
- return -1;
- }
-
- return disp->card_type;
-}
-
-/**
- * Called at the start of each server generation.
- *
- * \param disp 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( driDisplay *disp, RADEONInfoPtr info,
- RADEONDRIPtr pRADEONDRI)
-{
- int i, err;
-
- /* XXX this probably isn't needed here */
- {
- int width_bytes = (disp->virtualWidth * disp->cpp);
- int maxy = disp->fbSize / width_bytes;
-
- if (maxy <= disp->virtualHeight * 3) {
- _eglLog(_EGL_WARNING,
- "Static buffer allocation failed -- "
- "need at least %d kB video memory (have %d kB)\n",
- (disp->virtualWidth * disp->virtualHeight *
- disp->cpp * 3 + 1023) / 1024,
- disp->fbSize / 1024);
- return 0;
- }
- }
-
- /* Memory manager setup */
- if (!RADEONMemoryInit(disp, info)) {
- return 0;
- }
-
- /* Create a 'server' context so we can grab the lock for
- * initialization ioctls.
- */
- if ((err = drmCreateContext(disp->drmFD, &disp->serverContext)) != 0) {
- _eglLog(_EGL_WARNING, "%s: drmCreateContext failed %d\n",
- __FUNCTION__, err);
- return 0;
- }
-
- DRM_LOCK(disp->drmFD, disp->pSAREA, disp->serverContext, 0);
-
- /* Initialize the kernel data structures */
- if (!RADEONDRIKernelInit(disp, info)) {
- _eglLog(_EGL_WARNING, "RADEONDRIKernelInit failed\n");
- DRM_UNLOCK(disp->drmFD, disp->pSAREA, disp->serverContext);
- return 0;
- }
-
- /* Initialize the vertex buffers list */
- if (!RADEONDRIBufInit(disp, info)) {
- fprintf(stderr, "RADEONDRIBufInit failed\n");
- DRM_UNLOCK(disp->drmFD, disp->pSAREA, disp->serverContext);
- return 0;
- }
-
- /* Initialize IRQ */
- RADEONDRIIrqInit(disp, info);
-
- /* Initialize kernel gart memory manager */
- RADEONDRIAgpHeapInit(disp, info);
-
- /* Initialize the SAREA private data structure */
- {
- drm_radeon_sarea_t *pSAREAPriv;
- pSAREAPriv = (drm_radeon_sarea_t *)(((char*)disp->pSAREA) +
- sizeof(drm_sarea_t));
- memset(pSAREAPriv, 0, sizeof(*pSAREAPriv));
- pSAREAPriv->pfState = info->page_flip_enable;
- }
-
- for ( i = 0;; i++ ) {
- drmMapType type;
- drmMapFlags flags;
- drm_handle_t handle, offset;
- drmSize size;
- int rc, mtrr;
-
- if ( ( rc = drmGetMap( disp->drmFD, i, &offset, &size, &type, &flags, &handle, &mtrr ) ) != 0 )
- break;
- if ( type == DRM_REGISTERS ) {
- pRADEONDRI->registerHandle = offset;
- pRADEONDRI->registerSize = size;
- break;
- }
- }
- /* 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 *)disp->pFB + info->frontOffset,
- 0xEE,
- info->frontPitch * disp->cpp * disp->virtualHeight );
-
- drimemsetio((char *)disp->pFB + info->backOffset,
- 0x30,
- info->backPitch * disp->cpp * disp->virtualHeight );
-
-
- /* This is the struct passed to radeon_dri.so for its initialization */
- pRADEONDRI->deviceID = info->Chipset;
- pRADEONDRI->width = disp->virtualWidth;
- pRADEONDRI->height = disp->virtualHeight;
- pRADEONDRI->depth = disp->bpp; /* XXX: depth */
- pRADEONDRI->bpp = disp->bpp;
- pRADEONDRI->IsPCI = (disp->card_type != RADEON_CARD_AGP);;
- 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->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;
-
- case PCI_CHIP_RV370_5460:
- info->ChipFamily = CHIP_FAMILY_RV380;
- break;
-
- default:
- /* Original Radeon/7200 */
- info->ChipFamily = CHIP_FAMILY_RADEON;
- }
-
- return 1;
-}
-
-
-/**
- * \brief Initialize the framebuffer device mode
- *
- * \param disp display handle.
- *
- * \return one on success, or zero on failure.
- *
- * Fills in \p info with some default values and some information from \p disp
- * and then calls RADEONScreenInit() for the screen initialization.
- *
- * Before exiting clears the framebuffer memory accessing it directly.
- */
-static int radeonInitFBDev( driDisplay *disp, RADEONDRIPtr pRADEONDRI )
-{
- int err;
- RADEONInfoPtr info = calloc(1, sizeof(*info));
-
- disp->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;
-
- 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);
- fprintf(stderr,
- "page flipping %sabled\n", info->page_flip_enable?"en":"dis");
-
- info->Chipset = disp->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;
- }
-#if 0
- if (info->ChipFamily >= CHIP_FAMILY_R300) {
- fprintf(stderr,
- "Direct rendering not yet supported on "
- "Radeon 9700 and newer cards\n");
- return 0;
- }
-#endif
-
-#if 00
- /* don't seem to need this here */
- info->frontPitch = disp->virtualWidth;
-#endif
-
- /* Check the radeon DRM version */
- if (!RADEONCheckDRMVersion(disp, info)) {
- return 0;
- }
-
- if (RADEONGetCardType(disp, info)<0)
- return 0;
-
- if (disp->card_type!=RADEON_CARD_AGP) {
- /* Initialize PCI */
- if (!RADEONDRIPciInit(disp, info))
- return 0;
- }
- else {
- /* Initialize AGP */
- if (!RADEONDRIAgpInit(disp, info))
- return 0;
- }
-
- if (!RADEONScreenInit( disp, info, pRADEONDRI))
- return 0;
-
- /* Initialize and start the CP if required */
- if ((err = drmCommandNone(disp->drmFD, DRM_RADEON_CP_START)) != 0) {
- fprintf(stderr, "%s: CP start %d\n", __FUNCTION__, err);
- return 0;
- }
-
- return 1;
-}
-
-
-/**
- * Create list of all supported surface configs, attach list to the display.
- */
-static EGLBoolean
-radeonFillInConfigs(_EGLDisplay *disp, unsigned pixel_bits,
- unsigned depth_bits,
- unsigned stencil_bits, GLboolean have_back_buffer)
-{
- _EGLConfig *configs;
- _EGLConfig *c;
- unsigned int i, num_configs;
- unsigned int depth_buffer_factor;
- unsigned int back_buffer_factor;
- GLenum fb_format;
- GLenum fb_type;
-
- /* Right now GLX_SWAP_COPY_OML isn't supported, but it would be easy
- * enough to add support. Basically, if a context is created with an
- * fbconfig where the swap method is GLX_SWAP_COPY_OML, pageflipping
- * will never be used.
- */
- static const GLenum back_buffer_modes[] = {
- GLX_NONE, GLX_SWAP_UNDEFINED_OML /*, GLX_SWAP_COPY_OML */
- };
-
- uint8_t depth_bits_array[2];
- uint8_t stencil_bits_array[2];
-
- depth_bits_array[0] = depth_bits;
- depth_bits_array[1] = depth_bits;
-
- /* Just like with the accumulation buffer, always provide some modes
- * with a stencil buffer. It will be a sw fallback, but some apps won't
- * care about that.
- */
- stencil_bits_array[0] = 0;
- stencil_bits_array[1] = (stencil_bits == 0) ? 8 : stencil_bits;
-
- depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 2 : 1;
- back_buffer_factor = (have_back_buffer) ? 2 : 1;
-
- num_configs = depth_buffer_factor * back_buffer_factor * 2;
-
- if (pixel_bits == 16) {
- fb_format = GL_RGB;
- fb_type = GL_UNSIGNED_SHORT_5_6_5;
- } else {
- fb_format = GL_RGBA;
- fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
- }
-
- configs = calloc(sizeof(*configs), num_configs);
- c = configs;
- if (!_eglFillInConfigs(c, fb_format, fb_type,
- depth_bits_array, stencil_bits_array,
- depth_buffer_factor,
- back_buffer_modes, back_buffer_factor,
- GLX_TRUE_COLOR)) {
- fprintf(stderr, "[%s:%u] Error creating FBConfig!\n",
- __func__, __LINE__);
- return EGL_FALSE;
- }
-
- /* Mark the visual as slow if there are "fake" stencil bits.
- */
- for (i = 0, c = configs; i < num_configs; i++, c++) {
- int stencil = GET_CONFIG_ATTRIB(c, EGL_STENCIL_SIZE);
- if ((stencil != 0) && (stencil != stencil_bits)) {
- SET_CONFIG_ATTRIB(c, EGL_CONFIG_CAVEAT, EGL_SLOW_CONFIG);
- }
- }
-
- for (i = 0, c = configs; i < num_configs; i++, c++)
- _eglAddConfig(disp, c);
-
- free(configs);
-
- return EGL_TRUE;
-}
-
-
-/**
- * Show the given surface on the named screen.
- * If surface is EGL_NO_SURFACE, disable the screen's output.
- */
-static EGLBoolean
-radeonShowScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen,
- EGLSurface surface, EGLModeMESA m)
-{
- EGLBoolean b = _eglDRIShowScreenSurfaceMESA(drv, dpy, screen, surface, m);
- return b;
-}
-
-
-/**
- * Called via eglInitialize() by user.
- */
-static EGLBoolean
-radeonInitialize(_EGLDriver *drv, EGLDisplay dpy, EGLint *major, EGLint *minor)
-{
- __DRIframebuffer framebuffer;
- driDisplay *display;
-
- /* one-time init */
- radeon_drm_page_size = getpagesize();
-
- if (!_eglDRIInitialize(drv, dpy, major, minor))
- return EGL_FALSE;
-
- display = Lookup_driDisplay(dpy);
-
- framebuffer.dev_priv_size = sizeof(RADEONDRIRec);
- framebuffer.dev_priv = malloc(sizeof(RADEONDRIRec));
-
- /* XXX we shouldn't hard-code values here! */
- /* we won't know the screen surface size until the user calls
- * eglCreateScreenSurfaceMESA().
- */
-#if 0
- display->virtualWidth = 1024;
- display->virtualHeight = 768;
-#else
- display->virtualWidth = 1280;
- display->virtualHeight = 1024;
-#endif
- display->bpp = 32;
- display->cpp = 4;
-
- if (!_eglDRIGetDisplayInfo(display))
- return EGL_FALSE;
-
- framebuffer.base = display->pFB;
- framebuffer.width = display->virtualWidth;
- framebuffer.height = display->virtualHeight;
- framebuffer.stride = display->virtualWidth;
- framebuffer.size = display->fbSize;
- radeonInitFBDev( display, framebuffer.dev_priv );
-
- if (!_eglDRICreateDisplay(display, &framebuffer))
- return EGL_FALSE;
-
- if (!_eglDRICreateScreens(display))
- return EGL_FALSE;
-
- /* create a variety of both 32 and 16-bit configurations */
- radeonFillInConfigs(&display->Base, 32, 24, 8, GL_TRUE);
- radeonFillInConfigs(&display->Base, 16, 16, 0, GL_TRUE);
-
- drv->Initialized = EGL_TRUE;
- return EGL_TRUE;
-}
-
-
-/**
- * The bootstrap function. Return a new radeonDriver object and
- * plug in API functions.
- */
-_EGLDriver *
-_eglMain(_EGLDisplay *dpy)
-{
- radeonDriver *radeon;
-
- radeon = (radeonDriver *) calloc(1, sizeof(*radeon));
- if (!radeon) {
- return NULL;
- }
-
- /* First fill in the dispatch table with defaults */
- _eglDRIInitDriverFallbacks(&radeon->Base);
-
- /* then plug in our radeon-specific functions */
- radeon->Base.API.Initialize = radeonInitialize;
- radeon->Base.API.ShowScreenSurfaceMESA = radeonShowScreenSurfaceMESA;
-
- return &radeon->Base;
-}
diff --git a/src/mesa/drivers/dri/savage/savagedd.c b/src/mesa/drivers/dri/savage/savagedd.c
index 32ca86de8ae..bbf49aec272 100644
--- a/src/mesa/drivers/dri/savage/savagedd.c
+++ b/src/mesa/drivers/dri/savage/savagedd.c
@@ -29,15 +29,11 @@
#include <stdio.h>
#include "main/mm.h"
-#include "swrast/swrast.h"
#include "savagedd.h"
#include "savagestate.h"
-#include "savagespan.h"
#include "savagetex.h"
-#include "savagetris.h"
#include "savagecontext.h"
-#include "main/extensions.h"
#include "utils.h"
diff --git a/src/mesa/drivers/dri/savage/savageioctl.c b/src/mesa/drivers/dri/savage/savageioctl.c
index d0b64e801a9..9e181ce3be9 100644
--- a/src/mesa/drivers/dri/savage/savageioctl.c
+++ b/src/mesa/drivers/dri/savage/savageioctl.c
@@ -37,12 +37,10 @@
#include "savagecontext.h"
#include "savageioctl.h"
-#include "savage_bci.h"
#include "savagestate.h"
#include "savagespan.h"
#include "drm.h"
-#include <sys/ioctl.h>
#include <sys/timeb.h>
#define DEPTH_SCALE_16 ((1<<16)-1)
diff --git a/src/mesa/drivers/dri/savage/savagerender.c b/src/mesa/drivers/dri/savage/savagerender.c
index 8221edf3872..c369bb124c2 100644
--- a/src/mesa/drivers/dri/savage/savagerender.c
+++ b/src/mesa/drivers/dri/savage/savagerender.c
@@ -36,7 +36,6 @@
#include "tnl/t_context.h"
#include "savagecontext.h"
-#include "savagetris.h"
#include "savagestate.h"
#include "savageioctl.h"
diff --git a/src/mesa/drivers/dri/savage/savagespan.c b/src/mesa/drivers/dri/savage/savagespan.c
index 792e166d9c7..0913dd1278c 100644
--- a/src/mesa/drivers/dri/savage/savagespan.c
+++ b/src/mesa/drivers/dri/savage/savagespan.c
@@ -26,7 +26,6 @@
#include "savagedd.h"
#include "savagespan.h"
#include "savageioctl.h"
-#include "savage_bci.h"
#include "savage_3d_reg.h"
#include "swrast/swrast.h"
diff --git a/src/mesa/drivers/dri/savage/savagetex.c b/src/mesa/drivers/dri/savage/savagetex.c
index 97598f599e5..394be44eac5 100644
--- a/src/mesa/drivers/dri/savage/savagetex.c
+++ b/src/mesa/drivers/dri/savage/savagetex.c
@@ -33,8 +33,6 @@
#include "main/simple_list.h"
#include "main/enums.h"
-#include "swrast/swrast.h"
-
#include "savagecontext.h"
#include "savagetex.h"
#include "savagetris.h"
diff --git a/src/mesa/drivers/dri/savage/savagetris.c b/src/mesa/drivers/dri/savage/savagetris.c
index 9a92541ef7e..a177a7d2b60 100644
--- a/src/mesa/drivers/dri/savage/savagetris.c
+++ b/src/mesa/drivers/dri/savage/savagetris.c
@@ -52,7 +52,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "savagestate.h"
#include "savagetex.h"
#include "savageioctl.h"
-#include "savage_bci.h"
static void savageRasterPrimitive( GLcontext *ctx, GLuint prim );
static void savageRenderPrimitive( GLcontext *ctx, GLenum prim );
diff --git a/src/mesa/drivers/dri/sis/sis6326_state.c b/src/mesa/drivers/dri/sis/sis6326_state.c
index 65d4c064660..52008c7ea32 100644
--- a/src/mesa/drivers/dri/sis/sis6326_state.c
+++ b/src/mesa/drivers/dri/sis/sis6326_state.c
@@ -34,14 +34,12 @@
#include "sis_reg.h"
#include "main/context.h"
-#include "main/enums.h"
#include "main/colormac.h"
#include "swrast/swrast.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
#include "swrast_setup/swrast_setup.h"
-#include "tnl/t_pipeline.h"
/* =============================================================
* Alpha blending
diff --git a/src/mesa/drivers/dri/sis/sis_context.c b/src/mesa/drivers/dri/sis/sis_context.c
index 0944f4d8b4e..400681a04ab 100644
--- a/src/mesa/drivers/dri/sis/sis_context.c
+++ b/src/mesa/drivers/dri/sis/sis_context.c
@@ -43,8 +43,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "sis_alloc.h"
#include "main/imports.h"
-#include "main/matrix.h"
-#include "main/extensions.h"
#include "utils.h"
#include "main/framebuffer.h"
@@ -55,7 +53,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "vbo/vbo.h"
#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
#define need_GL_EXT_fog_coord
#define need_GL_EXT_secondary_color
diff --git a/src/mesa/drivers/dri/sis/sis_dd.c b/src/mesa/drivers/dri/sis/sis_dd.c
index 217d77557f3..fe4ade85920 100644
--- a/src/mesa/drivers/dri/sis/sis_dd.c
+++ b/src/mesa/drivers/dri/sis/sis_dd.c
@@ -40,9 +40,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "sis_state.h"
#include "sis_tris.h"
-#include "swrast/swrast.h"
#include "main/formats.h"
-#include "main/framebuffer.h"
#include "main/renderbuffer.h"
#include "utils.h"
diff --git a/src/mesa/drivers/dri/sis/sis_fog.c b/src/mesa/drivers/dri/sis/sis_fog.c
index 517d5722e6a..6c774e010eb 100644
--- a/src/mesa/drivers/dri/sis/sis_fog.c
+++ b/src/mesa/drivers/dri/sis/sis_fog.c
@@ -33,7 +33,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "sis_context.h"
#include "sis_state.h"
-#include "swrast/swrast.h"
#include "main/macros.h"
diff --git a/src/mesa/drivers/dri/sis/sis_screen.c b/src/mesa/drivers/dri/sis/sis_screen.c
index d38b93ec9b8..cb7ed8a08bb 100644
--- a/src/mesa/drivers/dri/sis/sis_screen.c
+++ b/src/mesa/drivers/dri/sis/sis_screen.c
@@ -39,7 +39,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "sis_context.h"
#include "sis_dri.h"
#include "sis_lock.h"
-#include "sis_span.h"
#include "xmlpool.h"
diff --git a/src/mesa/drivers/dri/sis/sis_state.c b/src/mesa/drivers/dri/sis/sis_state.c
index 98e8d02fabe..a22195ccceb 100644
--- a/src/mesa/drivers/dri/sis/sis_state.c
+++ b/src/mesa/drivers/dri/sis/sis_state.c
@@ -35,17 +35,13 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "sis_state.h"
#include "sis_tris.h"
#include "sis_lock.h"
-#include "sis_tex.h"
#include "main/context.h"
-#include "main/enums.h"
-#include "main/colormac.h"
#include "swrast/swrast.h"
#include "vbo/vbo.h"
#include "tnl/tnl.h"
#include "swrast_setup/swrast_setup.h"
-#include "tnl/t_pipeline.h"
/* =============================================================
* Alpha blending
diff --git a/src/mesa/drivers/dri/sis/sis_tex.c b/src/mesa/drivers/dri/sis/sis_tex.c
index 951c470dadf..31709c3af6e 100644
--- a/src/mesa/drivers/dri/sis/sis_tex.c
+++ b/src/mesa/drivers/dri/sis/sis_tex.c
@@ -31,7 +31,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "swrast/swrast.h"
#include "main/imports.h"
#include "main/texstore.h"
-#include "main/teximage.h"
#include "main/texobj.h"
#include "sis_context.h"
diff --git a/src/mesa/drivers/dri/sis/sis_texstate.c b/src/mesa/drivers/dri/sis/sis_texstate.c
index 4c22a10cf7e..7b0eebd066f 100644
--- a/src/mesa/drivers/dri/sis/sis_texstate.c
+++ b/src/mesa/drivers/dri/sis/sis_texstate.c
@@ -38,7 +38,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "main/macros.h"
#include "sis_context.h"
-#include "sis_state.h"
#include "sis_tex.h"
#include "sis_tris.h"
#include "sis_alloc.h"
diff --git a/src/mesa/drivers/dri/sis/sis_tris.c b/src/mesa/drivers/dri/sis/sis_tris.c
index 4690274c3c0..4b41d78d82a 100644
--- a/src/mesa/drivers/dri/sis/sis_tris.c
+++ b/src/mesa/drivers/dri/sis/sis_tris.c
@@ -47,7 +47,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "sis_state.h"
#include "sis_lock.h"
#include "sis_span.h"
-#include "sis_alloc.h"
#include "sis_tex.h"
/* 6326 and 300-series shared */
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_dd.c b/src/mesa/drivers/dri/tdfx/tdfx_dd.c
index ed8a3315492..2cbbeb81141 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_dd.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_dd.c
@@ -35,17 +35,10 @@
#include "tdfx_context.h"
#include "tdfx_dd.h"
#include "tdfx_lock.h"
-#include "tdfx_vb.h"
#include "tdfx_pixels.h"
#include "utils.h"
#include "main/context.h"
-#include "main/enums.h"
-#include "main/framebuffer.h"
-#include "swrast/swrast.h"
-#if defined(USE_X86_ASM)
-#include "x86/common_x86_asm.h"
-#endif
#define DRIVER_DATE "20061113"
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_lock.c b/src/mesa/drivers/dri/tdfx/tdfx_lock.c
index 4f84240104a..f218e4ee576 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_lock.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_lock.c
@@ -38,7 +38,6 @@
#include "tdfx_state.h"
#include "tdfx_render.h"
#include "tdfx_texman.h"
-#include "tdfx_tris.h"
#include "drirenderbuffer.h"
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_pixels.c b/src/mesa/drivers/dri/tdfx/tdfx_pixels.c
index 65f0464f8a5..44496274188 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_pixels.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_pixels.c
@@ -38,7 +38,6 @@
#include "tdfx_context.h"
#include "tdfx_dd.h"
#include "tdfx_lock.h"
-#include "tdfx_vb.h"
#include "tdfx_pixels.h"
#include "tdfx_render.h"
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c
index 4422b5dec46..9f6b35faa28 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c
@@ -36,9 +36,7 @@
#include "tdfx_dri.h"
#include "tdfx_context.h"
#include "tdfx_lock.h"
-#include "tdfx_vb.h"
#include "tdfx_span.h"
-#include "tdfx_tris.h"
#include "main/framebuffer.h"
#include "main/renderbuffer.h"
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_state.c b/src/mesa/drivers/dri/tdfx/tdfx_state.c
index cdb61a0ce05..dcbc7647f29 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_state.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_state.c
@@ -40,8 +40,6 @@
#include "main/mtypes.h"
#include "main/colormac.h"
-#include "main/texstore.h"
-#include "main/teximage.h"
#include "swrast/swrast.h"
#include "vbo/vbo.h"
@@ -51,11 +49,9 @@
#include "tdfx_context.h"
#include "tdfx_state.h"
-#include "tdfx_vb.h"
#include "tdfx_tex.h"
#include "tdfx_texman.h"
#include "tdfx_texstate.h"
-#include "tdfx_tris.h"
#include "tdfx_render.h"
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_texman.c b/src/mesa/drivers/dri/tdfx/tdfx_texman.c
index 35636ee5efb..726cc58a10b 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_texman.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_texman.c
@@ -35,7 +35,6 @@
*/
#include "tdfx_context.h"
-#include "tdfx_tex.h"
#include "tdfx_texman.h"
#include "main/texobj.h"
#include "main/hash.h"
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_texstate.c b/src/mesa/drivers/dri/tdfx/tdfx_texstate.c
index 3f737878ed9..6658b4d0c3e 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_texstate.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_texstate.c
@@ -38,7 +38,6 @@
*/
#include "tdfx_state.h"
-#include "tdfx_tex.h"
#include "tdfx_texman.h"
#include "tdfx_texstate.h"
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_vb.c b/src/mesa/drivers/dri/tdfx/tdfx_vb.c
index c200ba3255a..0f3c877a3e7 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_vb.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_vb.c
@@ -29,13 +29,8 @@
#include "main/macros.h"
#include "main/colormac.h"
-#include "math/m_translate.h"
-#include "swrast_setup/swrast_setup.h"
-
#include "tdfx_context.h"
#include "tdfx_vb.h"
-#include "tdfx_tris.h"
-#include "tdfx_state.h"
#include "tdfx_render.h"
static void copy_pv( GLcontext *ctx, GLuint edst, GLuint esrc )
diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c
index d17a160271d..9da96bdd45a 100644
--- a/src/mesa/drivers/dri/unichrome/via_context.c
+++ b/src/mesa/drivers/dri/unichrome/via_context.c
@@ -33,10 +33,7 @@
#include "main/glheader.h"
#include "main/context.h"
#include "main/formats.h"
-#include "main/matrix.h"
-#include "main/state.h"
#include "main/simple_list.h"
-#include "main/extensions.h"
#include "main/framebuffer.h"
#include "main/renderbuffer.h"
diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.c b/src/mesa/drivers/dri/unichrome/via_ioctl.c
index 8d4edfa3058..c9a31f3383c 100644
--- a/src/mesa/drivers/dri/unichrome/via_ioctl.c
+++ b/src/mesa/drivers/dri/unichrome/via_ioctl.c
@@ -34,7 +34,6 @@
#include "via_context.h"
#include "via_tris.h"
#include "via_ioctl.h"
-#include "via_state.h"
#include "via_fb.h"
#include "via_3d_reg.h"
diff --git a/src/mesa/drivers/dri/unichrome/via_render.c b/src/mesa/drivers/dri/unichrome/via_render.c
index f676cc13c81..896c43db1b0 100644
--- a/src/mesa/drivers/dri/unichrome/via_render.c
+++ b/src/mesa/drivers/dri/unichrome/via_render.c
@@ -37,7 +37,6 @@
#include "via_context.h"
#include "via_tris.h"
-#include "via_state.h"
#include "via_ioctl.h"
/*
diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c
index 2cfb98317da..8c91c937c68 100644
--- a/src/mesa/drivers/dri/unichrome/via_screen.c
+++ b/src/mesa/drivers/dri/unichrome/via_screen.c
@@ -30,17 +30,13 @@
#include "main/context.h"
#include "main/framebuffer.h"
#include "main/renderbuffer.h"
-#include "main/matrix.h"
#include "main/simple_list.h"
#include "vblank.h"
#include "via_state.h"
#include "via_tex.h"
#include "via_span.h"
-#include "via_tris.h"
-#include "via_ioctl.h"
#include "via_screen.h"
-#include "via_fb.h"
#include "via_dri.h"
#include "GL/internal/dri_interface.h"
diff --git a/src/mesa/drivers/dri/unichrome/via_state.c b/src/mesa/drivers/dri/unichrome/via_state.c
index e6e5526d344..f7029b94928 100644
--- a/src/mesa/drivers/dri/unichrome/via_state.c
+++ b/src/mesa/drivers/dri/unichrome/via_state.c
@@ -35,7 +35,6 @@
#include "via_context.h"
#include "via_state.h"
#include "via_tex.h"
-#include "via_tris.h"
#include "via_ioctl.h"
#include "via_3d_reg.h"
@@ -44,8 +43,6 @@
#include "tnl/tnl.h"
#include "swrast_setup/swrast_setup.h"
-#include "tnl/t_pipeline.h"
-
static GLuint ROP[16] = {
HC_HROP_BLACK, /* GL_CLEAR 0 */
diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c
index 24924d26138..917f9754669 100644
--- a/src/mesa/drivers/dri/unichrome/via_tex.c
+++ b/src/mesa/drivers/dri/unichrome/via_tex.c
@@ -37,14 +37,12 @@
#include "main/mipmap.h"
#include "main/mm.h"
#include "main/simple_list.h"
-#include "main/texcompress.h"
#include "main/texobj.h"
#include "main/texstore.h"
#include "via_context.h"
#include "via_fb.h"
#include "via_tex.h"
-#include "via_state.h"
#include "via_ioctl.h"
#include "via_3d_reg.h"
diff --git a/src/mesa/drivers/dri/unichrome/via_texcombine.c b/src/mesa/drivers/dri/unichrome/via_texcombine.c
index b6468978486..f87ba071f3b 100644
--- a/src/mesa/drivers/dri/unichrome/via_texcombine.c
+++ b/src/mesa/drivers/dri/unichrome/via_texcombine.c
@@ -38,7 +38,6 @@
#include "main/enums.h"
#include "via_context.h"
-#include "via_state.h"
#include "via_tex.h"
#include "via_3d_reg.h"
diff --git a/src/mesa/drivers/x11/glxapi.c b/src/mesa/drivers/x11/glxapi.c
index 5c7e8eb90cd..e11aff1a849 100644
--- a/src/mesa/drivers/x11/glxapi.c
+++ b/src/mesa/drivers/x11/glxapi.c
@@ -57,7 +57,8 @@ struct display_dispatch {
*/
#ifdef GLX_INDIRECT_RENDERING
-#include "glapi/dispatch.h"
+#include "glapi/glapitable.h"
+#include "glapi/glapidispatch.h"
#define KEYWORD1 PUBLIC
diff --git a/src/mesa/es/Makefile b/src/mesa/es/Makefile
index ca38dc4aed0..fbe67445c93 100644
--- a/src/mesa/es/Makefile
+++ b/src/mesa/es/Makefile
@@ -10,12 +10,14 @@ ES1_LIBS := libes1gallium.a libes1api.a
ES2_LIBS := libes2gallium.a libes2api.a
# Default rule: create ES1 and ES2 libs
-.PHONY: default
-default: subdirs depend es1 es2
+.PHONY: default es1 es2
+default: depend es1 es2
es1: $(ES1_LIBS)
+ @rm -f subdirs-stamp-tmp
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
@@ -104,24 +106,26 @@ clean:
-rm -f $(ES1_LIBS) $(ES2_LIBS)
-rm -rf $(ES1_OBJ_DIR) $(ES2_OBJ_DIR)
-rm -f $(GENERATED_SOURCES)
- -rm -f depend
- -rm -f *~
+ -rm -f depend depend.bak
+ -rm -f subdirs-stamp-tmp
+ @$(MAKE) -C glapi clean
# nothing to install
install:
-glapi/glapi-stamp:
- $(MAKE) -C glapi
+subdirs-stamp-tmp:
+ @$(MAKE) -C $(MESA) asm_subdirs
+ @$(MAKE) -C $(MESA) glsl_builtin
+ @$(MAKE) -C glapi
+ @touch subdirs-stamp-tmp
-subdirs: glapi/glapi-stamp
- $(MAKE) -C $(MESA) asm_subdirs
- $(MAKE) -C $(MESA) glsl_builtin
+# sort to avoid duplicates
+ALL_SOURCES := $(sort $(ES1_ALL_SOURCES) $(ES2_ALL_SOURCES))
-# remove generated sources because "depend" is checked even when "make clean"
-DEPEND_SOURCES := $(filter-out $(GENERATED_SOURCES), $(ES1_ALL_SOURCES) $(ES2_ALL_SOURCES))
-DEPEND_SOURCES := $(filter-out glapi/%, $(DEPEND_SOURCES))
+# need to make sure the subdirs are processed first
+$(ALL_SOURCES): | subdirs-stamp-tmp
-depend: glapi/glapi-stamp $(DEPEND_SOURCES)
+depend: $(ALL_SOURCES)
@echo "running $(MKDEP)"
@touch depend
@# MESA is "..", but luckily, directories are longer than 2 characters
@@ -132,4 +136,6 @@ depend: glapi/glapi-stamp $(DEPEND_SOURCES)
$(ES2_INCLUDES) $(ES2_ALL_SOURCES) 2>/dev/null | \
sed -e 's,^$(ES2_OBJ_DIR)/$(MESA)/,$(ES2_OBJ_DIR)/,' >> depend
+ifneq ($(MAKECMDGOALS),clean)
-include depend
+endif
diff --git a/src/mesa/es/glapi/Makefile b/src/mesa/es/glapi/Makefile
index 1256be953d1..1e32af867d5 100644
--- a/src/mesa/es/glapi/Makefile
+++ b/src/mesa/es/glapi/Makefile
@@ -30,10 +30,7 @@ ES2_DEPS = $(ES2_APIXML) base2_API.xml es2_EXT.xml es_EXT.xml \
ES1_OUTPUTS := $(addprefix $(ES1_OUTPUT_DIR)/, $(OUTPUTS))
ES2_OUTPUTS := $(addprefix $(ES2_OUTPUT_DIR)/, $(OUTPUTS))
-all: glapi-stamp
-
-glapi-stamp: $(ES1_OUTPUTS) $(ES2_OUTPUTS)
- @touch glapi-stamp
+all: $(ES1_OUTPUTS) $(ES2_OUTPUTS)
$(ES1_OUTPUTS): APIXML := $(ES1_APIXML)
$(ES2_OUTPUTS): APIXML := $(ES2_APIXML)
@@ -89,6 +86,5 @@ verify_xml:
@rm -f tmp.xml
clean:
- -rm -f glapi-stamp
-rm -rf $(ES1_OUTPUT_DIR) $(ES2_OUTPUT_DIR)
-rm -f *~ *.pyc *.pyo
diff --git a/src/mesa/glapi/Makefile b/src/mesa/glapi/Makefile
index 4db0ff1425e..bfc3db4313c 100644
--- a/src/mesa/glapi/Makefile
+++ b/src/mesa/glapi/Makefile
@@ -25,6 +25,7 @@ GLX_DIR = $(XORG_BASE)/glx
SERVER_GLAPI_FILES = \
$(GLX_DIR)/glapi.h \
$(GLX_DIR)/glapi.c \
+ $(GLX_DIR)/glapi_nop.c \
$(GLX_DIR)/glthread.c \
$(GLX_DIR)/glthread.h
@@ -43,7 +44,6 @@ SERVER_OUTPUTS = \
$(GLX_DIR)/glapioffsets.h \
$(GLX_DIR)/glapidispatch.h \
$(GLX_DIR)/glprocs.h \
- $(GLX_DIR)/dispatch.h \
$(SERVER_GLAPI_FILES)
API_XML = gl_API.xml \
diff --git a/src/mesa/glapi/gl_API.xml b/src/mesa/glapi/gl_API.xml
index 75d2f3c4383..fbf8b0c3e4a 100644
--- a/src/mesa/glapi/gl_API.xml
+++ b/src/mesa/glapi/gl_API.xml
@@ -866,6 +866,9 @@
<enum name="4_BYTES" count="4" value="0x1409">
<size name="CallLists"/>
</enum>
+ <enum name="HALF_FLOAT" count="2" value="0x140B">
+ <size name="CallLists"/>
+ </enum>
<enum name="CLEAR" value="0x1500"/>
<enum name="AND" value="0x1501"/>
<enum name="AND_REVERSE" value="0x1502"/>
diff --git a/src/mesa/glapi/gl_apitemp.py b/src/mesa/glapi/gl_apitemp.py
index 09b0d364ce3..41a40fbeb68 100644
--- a/src/mesa/glapi/gl_apitemp.py
+++ b/src/mesa/glapi/gl_apitemp.py
@@ -180,7 +180,7 @@ class PrintGlOffsets(gl_XML.gl_print_base):
#error _GLAPI_SKIP_NORMAL_ENTRY_POINTS must not be defined
#endif
-static _glapi_proc DISPATCH_TABLE_NAME[] = {"""
+_glapi_proc DISPATCH_TABLE_NAME[] = {"""
for f in api.functionIterateByOffset():
print ' TABLE_ENTRY(%s),' % (f.dispatch_name())
@@ -204,7 +204,7 @@ static _glapi_proc DISPATCH_TABLE_NAME[] = {"""
* We list the functions which are not otherwise used.
*/
#ifdef UNUSED_TABLE_NAME
-static _glapi_proc UNUSED_TABLE_NAME[] = {"""
+_glapi_proc UNUSED_TABLE_NAME[] = {"""
normal_entries = []
proto_entries = []
diff --git a/src/mesa/glapi/gl_x86_asm.py b/src/mesa/glapi/gl_x86_asm.py
index d293497736b..d210f3a2481 100644
--- a/src/mesa/glapi/gl_x86_asm.py
+++ b/src/mesa/glapi/gl_x86_asm.py
@@ -73,7 +73,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
print ''
print '#define GL_OFFSET(x) CODEPTR(REGOFF(4 * x, EAX))'
print ''
- print '#if defined(GNU_ASSEMBLER) && !defined(__DJGPP__) && !defined(__MINGW32__)'
+ print '#if defined(GNU_ASSEMBLER) && !defined(__DJGPP__) && !defined(__MINGW32__) && !defined(__APPLE__)'
print '#define GLOBL_FN(x) GLOBL x ; .type x, function'
print '#else'
print '#define GLOBL_FN(x) GLOBL x'
diff --git a/src/mesa/glapi/glapi.c b/src/mesa/glapi/glapi.c
index adb47f9fecb..469523d57cf 100644
--- a/src/mesa/glapi/glapi.c
+++ b/src/mesa/glapi/glapi.c
@@ -73,85 +73,7 @@
#include "glapi/glapioffsets.h"
#include "glapi/glapitable.h"
-/***** BEGIN NO-OP DISPATCH *****/
-
-static GLboolean WarnFlag = GL_FALSE;
-static _glapi_warning_func warning_func;
-
-/*
- * Enable/disable printing of warning messages.
- */
-PUBLIC void
-_glapi_noop_enable_warnings(GLboolean enable)
-{
- WarnFlag = enable;
-}
-
-/*
- * Register a callback function for reporting errors.
- */
-PUBLIC void
-_glapi_set_warning_func( _glapi_warning_func func )
-{
- warning_func = func;
-}
-
-static int
-warn(const char *func)
-{
-#if !defined(_WIN32_WCE)
- if ((WarnFlag || getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG"))
- && warning_func) {
- warning_func(NULL, "GL User Error: called without context: %s", func);
- }
-#endif
- return 0;
-}
-
-#ifdef DEBUG
-
-#define KEYWORD1 static
-#define KEYWORD1_ALT static
-#define KEYWORD2 GLAPIENTRY
-#define NAME(func) NoOp##func
-
-#define F NULL
-
-#define DISPATCH(func, args, msg) \
- warn(#func);
-
-#define RETURN_DISPATCH(func, args, msg) \
- return warn(#func);
-
-#define TABLE_ENTRY(name) (_glapi_proc) NoOp##name
-
-#else
-
-static void
-NoOpGeneric(void)
-{
- if ((WarnFlag || getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG"))
- && warning_func) {
- warning_func(NULL, "GL User Error: calling GL function");
- }
-}
-
-#define TABLE_ENTRY(name) (_glapi_proc) NoOpGeneric
-
-#endif
-
-#define DISPATCH_TABLE_NAME __glapi_noop_table
-#define UNUSED_TABLE_NAME __unused_noop_functions
-
-static GLint NoOpUnused(void)
-{
- return warn("extension function");
-}
-
-#include "glapi/glapitemp.h"
-
-/***** END NO-OP DISPATCH *****/
-
+extern _glapi_proc __glapi_noop_table[];
/**
@@ -278,7 +200,6 @@ _glapi_check_multithread(void)
PUBLIC void
_glapi_set_context(void *context)
{
- (void) __unused_noop_functions; /* silence a warning */
#if defined(GLX_USE_TLS)
_glapi_tls_Context = context;
#elif defined(THREADS)
diff --git a/src/mesa/glapi/glapi.h b/src/mesa/glapi/glapi.h
index 5fb5401229a..47ea23e92b5 100644
--- a/src/mesa/glapi/glapi.h
+++ b/src/mesa/glapi/glapi.h
@@ -55,8 +55,6 @@ struct _glapi_table;
typedef void (*_glapi_proc)(void); /* generic function pointer */
-typedef void (*_glapi_warning_func)(void *ctx, const char *str, ...);
-
#if defined(USE_MGL_NAMESPACE)
#define _glapi_set_dispatch _mglapi_set_dispatch
@@ -107,12 +105,6 @@ extern struct _glapi_table *_glapi_Dispatch;
**/
extern void
-_glapi_noop_enable_warnings(GLboolean enable);
-
-extern void
-_glapi_set_warning_func(_glapi_warning_func func);
-
-extern void
_glapi_check_multithread(void);
diff --git a/src/mesa/glapi/glapi_nop.c b/src/mesa/glapi/glapi_nop.c
new file mode 100644
index 00000000000..5d2769c0738
--- /dev/null
+++ b/src/mesa/glapi/glapi_nop.c
@@ -0,0 +1,91 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.8
+ *
+ * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
+ * 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.
+ */
+
+
+/**
+ * No-op dispatch table.
+ *
+ * This file defines a special dispatch table which is loaded with no-op
+ * functions.
+ *
+ * When there's no current rendering context, calling a GL function like
+ * glBegin() is a no-op. Apps should never normally do this. So as a
+ * debugging aid, each of the no-op functions will emit a warning to
+ * stderr if the MESA_DEBUG or LIBGL_DEBUG env var is set.
+ */
+
+
+
+#include "main/compiler.h"
+#include "main/glheader.h"
+#include "glapi/glapi.h"
+
+
+/**
+ * Called by each of the no-op GL entrypoints.
+ */
+static int
+Warn(const char *func)
+{
+#if !defined(_WIN32_WCE)
+ if (getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG")) {
+ fprintf(stderr, "GL User Error: gl%s called without a rendering context\n",
+ func);
+ }
+#endif
+ return 0;
+}
+
+
+/**
+ * This is called if the user somehow calls an unassigned GL dispatch function.
+ */
+static GLint
+NoOpUnused(void)
+{
+ return Warn(" function");
+}
+
+
+/*
+ * Defines for the glapitemp.h functions.
+ */
+#define KEYWORD1 static
+#define KEYWORD1_ALT static
+#define KEYWORD2 GLAPIENTRY
+#define NAME(func) NoOp##func
+#define DISPATCH(func, args, msg) Warn(#func);
+#define RETURN_DISPATCH(func, args, msg) Warn(#func); return 0
+
+
+/*
+ * Defines for the table of no-op entry points.
+ */
+#define TABLE_ENTRY(name) (_glapi_proc) NoOp##name
+#define DISPATCH_TABLE_NAME __glapi_noop_table
+#define UNUSED_TABLE_NAME __unused_noop_functions
+
+
+#include "glapi/glapitemp.h"
diff --git a/src/mesa/glapi/glapitemp.h b/src/mesa/glapi/glapitemp.h
index b8bfcc1a160..2540ef64657 100644
--- a/src/mesa/glapi/glapitemp.h
+++ b/src/mesa/glapi/glapitemp.h
@@ -5764,7 +5764,7 @@ KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_366)(GLenum target, GLenum pname,
#error _GLAPI_SKIP_NORMAL_ENTRY_POINTS must not be defined
#endif
-static _glapi_proc DISPATCH_TABLE_NAME[] = {
+_glapi_proc DISPATCH_TABLE_NAME[] = {
TABLE_ENTRY(NewList),
TABLE_ENTRY(EndList),
TABLE_ENTRY(CallList),
@@ -6680,7 +6680,7 @@ static _glapi_proc DISPATCH_TABLE_NAME[] = {
* We list the functions which are not otherwise used.
*/
#ifdef UNUSED_TABLE_NAME
-static _glapi_proc UNUSED_TABLE_NAME[] = {
+_glapi_proc UNUSED_TABLE_NAME[] = {
#ifndef _GLAPI_SKIP_NORMAL_ENTRY_POINTS
TABLE_ENTRY(ArrayElementEXT),
TABLE_ENTRY(BindTextureEXT),
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 0641b98b3b7..3fbdba2b3fe 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -33,7 +33,6 @@
#include "bufferobj.h"
#include "clear.h"
#include "colormac.h"
-#include "colortab.h"
#include "context.h"
#include "depth.h"
#include "enable.h"
diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c
index b8170dd4686..de60031cc80 100644
--- a/src/mesa/main/blend.c
+++ b/src/mesa/main/blend.c
@@ -35,7 +35,6 @@
#include "enums.h"
#include "macros.h"
#include "mtypes.h"
-#include "glapi/glapitable.h"
/**
diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index 97f06597581..fb30b599609 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -35,8 +35,6 @@
#include "colormac.h"
#include "context.h"
#include "enums.h"
-#include "fbobject.h"
-#include "state.h"
#define BAD_MASK ~0u
diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h
index 9eab1ead246..9cef99f67a5 100644
--- a/src/mesa/main/compiler.h
+++ b/src/mesa/main/compiler.h
@@ -223,8 +223,8 @@ extern "C" {
/**
- * Either define MESA_BIG_ENDIAN or MESA_LITTLE_ENDIAN.
- * Do not use them unless absolutely necessary!
+ * Either define MESA_BIG_ENDIAN or MESA_LITTLE_ENDIAN, and CPU_TO_LE32.
+ * Do not use these unless absolutely necessary!
* Try to use a runtime test instead.
* For now, only used by some DRI hardware drivers for color/texel packing.
*/
@@ -236,10 +236,13 @@ extern "C" {
#include <CoreFoundation/CFByteOrder.h>
#define CPU_TO_LE32( x ) CFSwapInt32HostToLittle( x )
#elif (defined(_AIX) || defined(__blrts))
-#define CPU_TO_LE32( x ) x = ((x & 0x000000ff) << 24) | \
- ((x & 0x0000ff00) << 8) | \
- ((x & 0x00ff0000) >> 8) | \
- ((x & 0xff000000) >> 24);
+static INLINE GLuint CPU_TO_LE32(GLuint x)
+{
+ return (((x & 0x000000ff) << 24) |
+ ((x & 0x0000ff00) << 8) |
+ ((x & 0x00ff0000) >> 8) |
+ ((x & 0xff000000) >> 24));
+}
#else /*__linux__ */
#include <sys/endian.h>
#define CPU_TO_LE32( x ) bswap32( x )
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 320c59068cc..a570506d57b 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -415,14 +415,6 @@ one_time_init( GLcontext *ctx )
_mesa_ubyte_to_float_color_tab[i] = (float) i / 255.0F;
}
- if (_mesa_getenv("MESA_DEBUG")) {
- _glapi_noop_enable_warnings(GL_TRUE);
- _glapi_set_warning_func( (_glapi_warning_func) _mesa_warning );
- }
- else {
- _glapi_noop_enable_warnings(GL_FALSE);
- }
-
#if defined(DEBUG) && defined(__DATE__) && defined(__TIME__)
_mesa_debug(ctx, "Mesa %s DEBUG build %s %s\n",
MESA_VERSION_STRING, __DATE__, __TIME__);
diff --git a/src/mesa/main/convolve.c b/src/mesa/main/convolve.c
index 8db3e79d384..5ed93e0c600 100644
--- a/src/mesa/main/convolve.c
+++ b/src/mesa/main/convolve.c
@@ -38,7 +38,6 @@
#include "context.h"
#include "image.h"
#include "mtypes.h"
-#include "pixel.h"
#include "state.h"
#include "glapi/dispatch.h"
diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c
index a42113edcac..9bad83487fb 100644
--- a/src/mesa/main/debug.c
+++ b/src/mesa/main/debug.c
@@ -26,7 +26,6 @@
#include "mtypes.h"
#include "attrib.h"
#include "colormac.h"
-#include "context.h"
#include "enums.h"
#include "formats.h"
#include "hash.h"
@@ -35,7 +34,6 @@
#include "get.h"
#include "pixelstore.h"
#include "readpix.h"
-#include "texgetimage.h"
#include "texobj.h"
@@ -54,7 +52,7 @@ const char *_mesa_prim_name[GL_POLYGON+4] = {
"GL_QUAD_STRIP",
"GL_POLYGON",
"outside begin/end",
- "inside unkown primitive",
+ "inside unknown primitive",
"unknown state"
};
diff --git a/src/mesa/main/depthstencil.c b/src/mesa/main/depthstencil.c
index 193c7f8255f..49946a65062 100644
--- a/src/mesa/main/depthstencil.c
+++ b/src/mesa/main/depthstencil.c
@@ -25,7 +25,6 @@
#include "glheader.h"
#include "imports.h"
#include "context.h"
-#include "fbobject.h"
#include "formats.h"
#include "mtypes.h"
#include "depthstencil.h"
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index 21a8216254b..b182bbe0d00 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -35,46 +35,25 @@
#include "api_loopback.h"
#include "config.h"
#include "mfeatures.h"
-#include "attrib.h"
-#include "blend.h"
-#include "buffers.h"
#if FEATURE_ARB_vertex_buffer_object
#include "bufferobj.h"
#endif
#include "arrayobj.h"
-#include "clip.h"
-#include "colortab.h"
#include "context.h"
-#include "convolve.h"
-#include "depth.h"
#include "dlist.h"
-#include "enable.h"
#include "enums.h"
#include "eval.h"
-#include "extensions.h"
-#include "feedback.h"
#include "framebuffer.h"
-#include "get.h"
#include "glapi/glapi.h"
#include "hash.h"
-#include "histogram.h"
#include "image.h"
#include "light.h"
-#include "lines.h"
#include "dlist.h"
#include "macros.h"
-#include "matrix.h"
-#include "pixel.h"
-#include "points.h"
-#include "polygon.h"
#include "queryobj.h"
-#include "state.h"
-#include "texobj.h"
#include "teximage.h"
-#include "texstate.h"
#include "mtypes.h"
#include "varray.h"
-#include "vtxfmt.h"
#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
#include "shader/arbprogram.h"
#include "shader/program.h"
@@ -3750,7 +3729,7 @@ save_TexEnvi(GLenum target, GLenum pname, GLint param)
{
GLfloat p[4];
p[0] = (GLfloat) param;
- p[1] = p[2] = p[3] = 0.0;
+ p[1] = p[2] = p[3] = 0.0F;
save_TexEnvfv(target, pname, p);
}
@@ -3884,7 +3863,7 @@ save_TexParameteri(GLenum target, GLenum pname, GLint param)
{
GLfloat fparam[4];
fparam[0] = (GLfloat) param;
- fparam[1] = fparam[2] = fparam[3] = 0.0;
+ fparam[1] = fparam[2] = fparam[3] = 0.0F;
save_TexParameterfv(target, pname, fparam);
}
@@ -3894,7 +3873,7 @@ save_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
{
GLfloat fparam[4];
fparam[0] = (GLfloat) params[0];
- fparam[1] = fparam[2] = fparam[3] = 0.0;
+ fparam[1] = fparam[2] = fparam[3] = 0.0F;
save_TexParameterfv(target, pname, fparam);
}
diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c
index 5d4b53af4cb..0afd47b797f 100644
--- a/src/mesa/main/drawpix.c
+++ b/src/mesa/main/drawpix.c
@@ -30,7 +30,6 @@
#include "enums.h"
#include "feedback.h"
#include "framebuffer.h"
-#include "image.h"
#include "readpix.h"
#include "state.h"
#include "glapi/dispatch.h"
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index cd6e881ad2d..f5c88a63e6e 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -32,7 +32,6 @@
#include "context.h"
#include "enable.h"
#include "light.h"
-#include "macros.h"
#include "simple_list.h"
#include "mtypes.h"
#include "enums.h"
diff --git a/src/mesa/main/enums.c b/src/mesa/main/enums.c
index aaf17aafdd6..1d495b7ae58 100644
--- a/src/mesa/main/enums.c
+++ b/src/mesa/main/enums.c
@@ -640,6 +640,7 @@ LONGSTRING static const char enum_string_table[] =
"GL_GREEN_BIAS\0"
"GL_GREEN_BITS\0"
"GL_GREEN_SCALE\0"
+ "GL_HALF_FLOAT\0"
"GL_HINT_BIT\0"
"GL_HISTOGRAM\0"
"GL_HISTOGRAM_ALPHA_SIZE\0"
@@ -1922,7 +1923,7 @@ LONGSTRING static const char enum_string_table[] =
"GL_ZOOM_Y\0"
;
-static const enum_elt all_enums[1884] =
+static const enum_elt all_enums[1885] =
{
{ 0, 0x00000600 }, /* GL_2D */
{ 6, 0x00001407 }, /* GL_2_BYTES */
@@ -2528,1365 +2529,1366 @@ static const enum_elt all_enums[1884] =
{ 12769, 0x00000D19 }, /* GL_GREEN_BIAS */
{ 12783, 0x00000D53 }, /* GL_GREEN_BITS */
{ 12797, 0x00000D18 }, /* GL_GREEN_SCALE */
- { 12812, 0x00008000 }, /* GL_HINT_BIT */
- { 12824, 0x00008024 }, /* GL_HISTOGRAM */
- { 12837, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE */
- { 12861, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE_EXT */
- { 12889, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE */
- { 12912, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE_EXT */
- { 12939, 0x00008024 }, /* GL_HISTOGRAM_EXT */
- { 12956, 0x00008027 }, /* GL_HISTOGRAM_FORMAT */
- { 12976, 0x00008027 }, /* GL_HISTOGRAM_FORMAT_EXT */
- { 13000, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE */
- { 13024, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE_EXT */
- { 13052, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE */
- { 13080, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE_EXT */
- { 13112, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE */
- { 13134, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE_EXT */
- { 13160, 0x0000802D }, /* GL_HISTOGRAM_SINK */
- { 13178, 0x0000802D }, /* GL_HISTOGRAM_SINK_EXT */
- { 13200, 0x00008026 }, /* GL_HISTOGRAM_WIDTH */
- { 13219, 0x00008026 }, /* GL_HISTOGRAM_WIDTH_EXT */
- { 13242, 0x0000862A }, /* GL_IDENTITY_NV */
- { 13257, 0x00008150 }, /* GL_IGNORE_BORDER_HP */
- { 13277, 0x00008B9B }, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */
- { 13317, 0x00008B9A }, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */
- { 13355, 0x00001E02 }, /* GL_INCR */
- { 13363, 0x00008507 }, /* GL_INCR_WRAP */
- { 13376, 0x00008507 }, /* GL_INCR_WRAP_EXT */
- { 13393, 0x00008222 }, /* GL_INDEX */
- { 13402, 0x00008077 }, /* GL_INDEX_ARRAY */
- { 13417, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING */
- { 13447, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING_ARB */
- { 13481, 0x00008091 }, /* GL_INDEX_ARRAY_POINTER */
- { 13504, 0x00008086 }, /* GL_INDEX_ARRAY_STRIDE */
- { 13526, 0x00008085 }, /* GL_INDEX_ARRAY_TYPE */
- { 13546, 0x00000D51 }, /* GL_INDEX_BITS */
- { 13560, 0x00000C20 }, /* GL_INDEX_CLEAR_VALUE */
- { 13581, 0x00000BF1 }, /* GL_INDEX_LOGIC_OP */
- { 13599, 0x00000C30 }, /* GL_INDEX_MODE */
- { 13613, 0x00000D13 }, /* GL_INDEX_OFFSET */
- { 13629, 0x00000D12 }, /* GL_INDEX_SHIFT */
- { 13644, 0x00000C21 }, /* GL_INDEX_WRITEMASK */
- { 13663, 0x00008B84 }, /* GL_INFO_LOG_LENGTH */
- { 13682, 0x00001404 }, /* GL_INT */
- { 13689, 0x00008049 }, /* GL_INTENSITY */
- { 13702, 0x0000804C }, /* GL_INTENSITY12 */
- { 13717, 0x0000804C }, /* GL_INTENSITY12_EXT */
- { 13736, 0x0000804D }, /* GL_INTENSITY16 */
- { 13751, 0x0000804D }, /* GL_INTENSITY16_EXT */
- { 13770, 0x0000804A }, /* GL_INTENSITY4 */
- { 13784, 0x0000804A }, /* GL_INTENSITY4_EXT */
- { 13802, 0x0000804B }, /* GL_INTENSITY8 */
- { 13816, 0x0000804B }, /* GL_INTENSITY8_EXT */
- { 13834, 0x00008049 }, /* GL_INTENSITY_EXT */
- { 13851, 0x00008575 }, /* GL_INTERPOLATE */
- { 13866, 0x00008575 }, /* GL_INTERPOLATE_ARB */
- { 13885, 0x00008575 }, /* GL_INTERPOLATE_EXT */
- { 13904, 0x00008B53 }, /* GL_INT_VEC2 */
- { 13916, 0x00008B53 }, /* GL_INT_VEC2_ARB */
- { 13932, 0x00008B54 }, /* GL_INT_VEC3 */
- { 13944, 0x00008B54 }, /* GL_INT_VEC3_ARB */
- { 13960, 0x00008B55 }, /* GL_INT_VEC4 */
- { 13972, 0x00008B55 }, /* GL_INT_VEC4_ARB */
- { 13988, 0x00000500 }, /* GL_INVALID_ENUM */
- { 14004, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION */
- { 14037, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_EXT */
- { 14074, 0x00000502 }, /* GL_INVALID_OPERATION */
- { 14095, 0x00000501 }, /* GL_INVALID_VALUE */
- { 14112, 0x0000862B }, /* GL_INVERSE_NV */
- { 14126, 0x0000862D }, /* GL_INVERSE_TRANSPOSE_NV */
- { 14150, 0x0000150A }, /* GL_INVERT */
- { 14160, 0x00001E00 }, /* GL_KEEP */
- { 14168, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION */
- { 14194, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION_EXT */
- { 14224, 0x00000406 }, /* GL_LEFT */
- { 14232, 0x00000203 }, /* GL_LEQUAL */
- { 14242, 0x00000201 }, /* GL_LESS */
- { 14250, 0x00004000 }, /* GL_LIGHT0 */
- { 14260, 0x00004001 }, /* GL_LIGHT1 */
- { 14270, 0x00004002 }, /* GL_LIGHT2 */
- { 14280, 0x00004003 }, /* GL_LIGHT3 */
- { 14290, 0x00004004 }, /* GL_LIGHT4 */
- { 14300, 0x00004005 }, /* GL_LIGHT5 */
- { 14310, 0x00004006 }, /* GL_LIGHT6 */
- { 14320, 0x00004007 }, /* GL_LIGHT7 */
- { 14330, 0x00000B50 }, /* GL_LIGHTING */
- { 14342, 0x00000040 }, /* GL_LIGHTING_BIT */
- { 14358, 0x00000B53 }, /* GL_LIGHT_MODEL_AMBIENT */
- { 14381, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL */
- { 14410, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL_EXT */
- { 14443, 0x00000B51 }, /* GL_LIGHT_MODEL_LOCAL_VIEWER */
- { 14471, 0x00000B52 }, /* GL_LIGHT_MODEL_TWO_SIDE */
- { 14495, 0x00001B01 }, /* GL_LINE */
- { 14503, 0x00002601 }, /* GL_LINEAR */
- { 14513, 0x00001208 }, /* GL_LINEAR_ATTENUATION */
- { 14535, 0x00008170 }, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */
- { 14565, 0x0000844F }, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */
- { 14596, 0x00002703 }, /* GL_LINEAR_MIPMAP_LINEAR */
- { 14620, 0x00002701 }, /* GL_LINEAR_MIPMAP_NEAREST */
- { 14645, 0x00000001 }, /* GL_LINES */
- { 14654, 0x00000004 }, /* GL_LINE_BIT */
- { 14666, 0x00000002 }, /* GL_LINE_LOOP */
- { 14679, 0x00000707 }, /* GL_LINE_RESET_TOKEN */
- { 14699, 0x00000B20 }, /* GL_LINE_SMOOTH */
- { 14714, 0x00000C52 }, /* GL_LINE_SMOOTH_HINT */
- { 14734, 0x00000B24 }, /* GL_LINE_STIPPLE */
- { 14750, 0x00000B25 }, /* GL_LINE_STIPPLE_PATTERN */
- { 14774, 0x00000B26 }, /* GL_LINE_STIPPLE_REPEAT */
- { 14797, 0x00000003 }, /* GL_LINE_STRIP */
- { 14811, 0x00000702 }, /* GL_LINE_TOKEN */
- { 14825, 0x00000B21 }, /* GL_LINE_WIDTH */
- { 14839, 0x00000B23 }, /* GL_LINE_WIDTH_GRANULARITY */
- { 14865, 0x00000B22 }, /* GL_LINE_WIDTH_RANGE */
- { 14885, 0x00008B82 }, /* GL_LINK_STATUS */
- { 14900, 0x00000B32 }, /* GL_LIST_BASE */
- { 14913, 0x00020000 }, /* GL_LIST_BIT */
- { 14925, 0x00000B33 }, /* GL_LIST_INDEX */
- { 14939, 0x00000B30 }, /* GL_LIST_MODE */
- { 14952, 0x00000101 }, /* GL_LOAD */
- { 14960, 0x00000BF1 }, /* GL_LOGIC_OP */
- { 14972, 0x00000BF0 }, /* GL_LOGIC_OP_MODE */
- { 14989, 0x00008CA1 }, /* GL_LOWER_LEFT */
- { 15003, 0x00001909 }, /* GL_LUMINANCE */
- { 15016, 0x00008041 }, /* GL_LUMINANCE12 */
- { 15031, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12 */
- { 15054, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12_EXT */
- { 15081, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4 */
- { 15103, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4_EXT */
- { 15129, 0x00008041 }, /* GL_LUMINANCE12_EXT */
- { 15148, 0x00008042 }, /* GL_LUMINANCE16 */
- { 15163, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16 */
- { 15186, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16_EXT */
- { 15213, 0x00008042 }, /* GL_LUMINANCE16_EXT */
- { 15232, 0x0000803F }, /* GL_LUMINANCE4 */
- { 15246, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4 */
- { 15267, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4_EXT */
- { 15292, 0x0000803F }, /* GL_LUMINANCE4_EXT */
- { 15310, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2 */
- { 15331, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2_EXT */
- { 15356, 0x00008040 }, /* GL_LUMINANCE8 */
- { 15370, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8 */
- { 15391, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8_EXT */
- { 15416, 0x00008040 }, /* GL_LUMINANCE8_EXT */
- { 15434, 0x0000190A }, /* GL_LUMINANCE_ALPHA */
- { 15453, 0x00000D90 }, /* GL_MAP1_COLOR_4 */
- { 15469, 0x00000DD0 }, /* GL_MAP1_GRID_DOMAIN */
- { 15489, 0x00000DD1 }, /* GL_MAP1_GRID_SEGMENTS */
- { 15511, 0x00000D91 }, /* GL_MAP1_INDEX */
- { 15525, 0x00000D92 }, /* GL_MAP1_NORMAL */
- { 15540, 0x00000D93 }, /* GL_MAP1_TEXTURE_COORD_1 */
- { 15564, 0x00000D94 }, /* GL_MAP1_TEXTURE_COORD_2 */
- { 15588, 0x00000D95 }, /* GL_MAP1_TEXTURE_COORD_3 */
- { 15612, 0x00000D96 }, /* GL_MAP1_TEXTURE_COORD_4 */
- { 15636, 0x00000D97 }, /* GL_MAP1_VERTEX_3 */
- { 15653, 0x00000D98 }, /* GL_MAP1_VERTEX_4 */
- { 15670, 0x00008660 }, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */
- { 15698, 0x0000866A }, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */
- { 15727, 0x0000866B }, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */
- { 15756, 0x0000866C }, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */
- { 15785, 0x0000866D }, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */
- { 15814, 0x0000866E }, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */
- { 15843, 0x0000866F }, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */
- { 15872, 0x00008661 }, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */
- { 15900, 0x00008662 }, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */
- { 15928, 0x00008663 }, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */
- { 15956, 0x00008664 }, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */
- { 15984, 0x00008665 }, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */
- { 16012, 0x00008666 }, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */
- { 16040, 0x00008667 }, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */
- { 16068, 0x00008668 }, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */
- { 16096, 0x00008669 }, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */
- { 16124, 0x00000DB0 }, /* GL_MAP2_COLOR_4 */
- { 16140, 0x00000DD2 }, /* GL_MAP2_GRID_DOMAIN */
- { 16160, 0x00000DD3 }, /* GL_MAP2_GRID_SEGMENTS */
- { 16182, 0x00000DB1 }, /* GL_MAP2_INDEX */
- { 16196, 0x00000DB2 }, /* GL_MAP2_NORMAL */
- { 16211, 0x00000DB3 }, /* GL_MAP2_TEXTURE_COORD_1 */
- { 16235, 0x00000DB4 }, /* GL_MAP2_TEXTURE_COORD_2 */
- { 16259, 0x00000DB5 }, /* GL_MAP2_TEXTURE_COORD_3 */
- { 16283, 0x00000DB6 }, /* GL_MAP2_TEXTURE_COORD_4 */
- { 16307, 0x00000DB7 }, /* GL_MAP2_VERTEX_3 */
- { 16324, 0x00000DB8 }, /* GL_MAP2_VERTEX_4 */
- { 16341, 0x00008670 }, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */
- { 16369, 0x0000867A }, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */
- { 16398, 0x0000867B }, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */
- { 16427, 0x0000867C }, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */
- { 16456, 0x0000867D }, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */
- { 16485, 0x0000867E }, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */
- { 16514, 0x0000867F }, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */
- { 16543, 0x00008671 }, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */
- { 16571, 0x00008672 }, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */
- { 16599, 0x00008673 }, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */
- { 16627, 0x00008674 }, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */
- { 16655, 0x00008675 }, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */
- { 16683, 0x00008676 }, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */
- { 16711, 0x00008677 }, /* GL_MAP2_VERTEX_ATTRIB7_4_NV */
- { 16739, 0x00008678 }, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */
- { 16767, 0x00008679 }, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */
- { 16795, 0x00000D10 }, /* GL_MAP_COLOR */
- { 16808, 0x00000010 }, /* GL_MAP_FLUSH_EXPLICIT_BIT */
- { 16834, 0x00000008 }, /* GL_MAP_INVALIDATE_BUFFER_BIT */
- { 16863, 0x00000004 }, /* GL_MAP_INVALIDATE_RANGE_BIT */
- { 16891, 0x00000001 }, /* GL_MAP_READ_BIT */
- { 16907, 0x00000D11 }, /* GL_MAP_STENCIL */
- { 16922, 0x00000020 }, /* GL_MAP_UNSYNCHRONIZED_BIT */
- { 16948, 0x00000002 }, /* GL_MAP_WRITE_BIT */
- { 16965, 0x000088C0 }, /* GL_MATRIX0_ARB */
- { 16980, 0x00008630 }, /* GL_MATRIX0_NV */
- { 16994, 0x000088CA }, /* GL_MATRIX10_ARB */
- { 17010, 0x000088CB }, /* GL_MATRIX11_ARB */
- { 17026, 0x000088CC }, /* GL_MATRIX12_ARB */
- { 17042, 0x000088CD }, /* GL_MATRIX13_ARB */
- { 17058, 0x000088CE }, /* GL_MATRIX14_ARB */
- { 17074, 0x000088CF }, /* GL_MATRIX15_ARB */
- { 17090, 0x000088D0 }, /* GL_MATRIX16_ARB */
- { 17106, 0x000088D1 }, /* GL_MATRIX17_ARB */
- { 17122, 0x000088D2 }, /* GL_MATRIX18_ARB */
- { 17138, 0x000088D3 }, /* GL_MATRIX19_ARB */
- { 17154, 0x000088C1 }, /* GL_MATRIX1_ARB */
- { 17169, 0x00008631 }, /* GL_MATRIX1_NV */
- { 17183, 0x000088D4 }, /* GL_MATRIX20_ARB */
- { 17199, 0x000088D5 }, /* GL_MATRIX21_ARB */
- { 17215, 0x000088D6 }, /* GL_MATRIX22_ARB */
- { 17231, 0x000088D7 }, /* GL_MATRIX23_ARB */
- { 17247, 0x000088D8 }, /* GL_MATRIX24_ARB */
- { 17263, 0x000088D9 }, /* GL_MATRIX25_ARB */
- { 17279, 0x000088DA }, /* GL_MATRIX26_ARB */
- { 17295, 0x000088DB }, /* GL_MATRIX27_ARB */
- { 17311, 0x000088DC }, /* GL_MATRIX28_ARB */
- { 17327, 0x000088DD }, /* GL_MATRIX29_ARB */
- { 17343, 0x000088C2 }, /* GL_MATRIX2_ARB */
- { 17358, 0x00008632 }, /* GL_MATRIX2_NV */
- { 17372, 0x000088DE }, /* GL_MATRIX30_ARB */
- { 17388, 0x000088DF }, /* GL_MATRIX31_ARB */
- { 17404, 0x000088C3 }, /* GL_MATRIX3_ARB */
- { 17419, 0x00008633 }, /* GL_MATRIX3_NV */
- { 17433, 0x000088C4 }, /* GL_MATRIX4_ARB */
- { 17448, 0x00008634 }, /* GL_MATRIX4_NV */
- { 17462, 0x000088C5 }, /* GL_MATRIX5_ARB */
- { 17477, 0x00008635 }, /* GL_MATRIX5_NV */
- { 17491, 0x000088C6 }, /* GL_MATRIX6_ARB */
- { 17506, 0x00008636 }, /* GL_MATRIX6_NV */
- { 17520, 0x000088C7 }, /* GL_MATRIX7_ARB */
- { 17535, 0x00008637 }, /* GL_MATRIX7_NV */
- { 17549, 0x000088C8 }, /* GL_MATRIX8_ARB */
- { 17564, 0x000088C9 }, /* GL_MATRIX9_ARB */
- { 17579, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_ARB */
- { 17605, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */
- { 17639, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */
- { 17670, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */
- { 17703, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */
- { 17734, 0x00000BA0 }, /* GL_MATRIX_MODE */
- { 17749, 0x00008840 }, /* GL_MATRIX_PALETTE_ARB */
- { 17771, 0x00008008 }, /* GL_MAX */
- { 17778, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE */
- { 17801, 0x000088FF }, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */
- { 17833, 0x00000D35 }, /* GL_MAX_ATTRIB_STACK_DEPTH */
- { 17859, 0x00000D3B }, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */
- { 17892, 0x00008177 }, /* GL_MAX_CLIPMAP_DEPTH_SGIX */
- { 17918, 0x00008178 }, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */
- { 17952, 0x00000D32 }, /* GL_MAX_CLIP_PLANES */
- { 17971, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS */
- { 17996, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS_EXT */
- { 18025, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */
- { 18057, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI */
- { 18093, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */
- { 18129, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB */
- { 18169, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT */
- { 18195, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT_EXT */
- { 18225, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH */
- { 18250, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH_EXT */
- { 18279, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */
- { 18308, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB */
- { 18341, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS */
- { 18361, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ARB */
- { 18385, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ATI */
- { 18409, 0x000080E9 }, /* GL_MAX_ELEMENTS_INDICES */
- { 18433, 0x000080E8 }, /* GL_MAX_ELEMENTS_VERTICES */
- { 18458, 0x00000D30 }, /* GL_MAX_EVAL_ORDER */
- { 18476, 0x00008008 }, /* GL_MAX_EXT */
- { 18487, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */
- { 18522, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB */
- { 18561, 0x00000D31 }, /* GL_MAX_LIGHTS */
- { 18575, 0x00000B31 }, /* GL_MAX_LIST_NESTING */
- { 18595, 0x00008841 }, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */
- { 18633, 0x00000D36 }, /* GL_MAX_MODELVIEW_STACK_DEPTH */
- { 18662, 0x00000D37 }, /* GL_MAX_NAME_STACK_DEPTH */
- { 18686, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_ARB */
- { 18714, 0x00000D34 }, /* GL_MAX_PIXEL_MAP_TABLE */
- { 18737, 0x000088B1 }, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */
- { 18774, 0x0000880B }, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */
- { 18810, 0x000088AD }, /* GL_MAX_PROGRAM_ATTRIBS_ARB */
- { 18837, 0x000088F5 }, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */
- { 18866, 0x000088B5 }, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */
- { 18900, 0x000088F4 }, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */
- { 18936, 0x000088F6 }, /* GL_MAX_PROGRAM_IF_DEPTH_NV */
- { 18963, 0x000088A1 }, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */
- { 18995, 0x000088B4 }, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */
- { 19031, 0x000088F8 }, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */
- { 19060, 0x000088F7 }, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */
- { 19089, 0x0000862F }, /* GL_MAX_PROGRAM_MATRICES_ARB */
- { 19117, 0x0000862E }, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */
- { 19155, 0x000088B3 }, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
- { 19199, 0x0000880E }, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
- { 19242, 0x000088AF }, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */
- { 19276, 0x000088A3 }, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
- { 19315, 0x000088AB }, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */
- { 19352, 0x000088A7 }, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */
- { 19390, 0x00008810 }, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
- { 19433, 0x0000880F }, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
- { 19476, 0x000088A9 }, /* GL_MAX_PROGRAM_PARAMETERS_ARB */
- { 19506, 0x000088A5 }, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */
- { 19537, 0x0000880D }, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */
- { 19573, 0x0000880C }, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */
- { 19609, 0x00000D38 }, /* GL_MAX_PROJECTION_STACK_DEPTH */
- { 19639, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */
- { 19673, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_NV */
- { 19706, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE */
- { 19731, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_EXT */
- { 19760, 0x00008D57 }, /* GL_MAX_SAMPLES */
- { 19775, 0x00008D57 }, /* GL_MAX_SAMPLES_EXT */
- { 19794, 0x00009111 }, /* GL_MAX_SERVER_WAIT_TIMEOUT */
- { 19821, 0x00008504 }, /* GL_MAX_SHININESS_NV */
- { 19841, 0x00008505 }, /* GL_MAX_SPOT_EXPONENT_NV */
- { 19865, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS */
- { 19887, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS_ARB */
- { 19913, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS */
- { 19940, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS_ARB */
- { 19971, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS */
- { 19995, 0x000084FF }, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */
- { 20029, 0x00000D33 }, /* GL_MAX_TEXTURE_SIZE */
- { 20049, 0x00000D39 }, /* GL_MAX_TEXTURE_STACK_DEPTH */
- { 20076, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS */
- { 20097, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS_ARB */
- { 20122, 0x0000862F }, /* GL_MAX_TRACK_MATRICES_NV */
- { 20147, 0x0000862E }, /* GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV */
- { 20182, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS */
- { 20204, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS_ARB */
- { 20230, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS */
- { 20252, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS_ARB */
- { 20278, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */
- { 20312, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */
- { 20350, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */
- { 20383, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB */
- { 20420, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_ARB */
- { 20444, 0x00000D3A }, /* GL_MAX_VIEWPORT_DIMS */
- { 20465, 0x00008007 }, /* GL_MIN */
- { 20472, 0x0000802E }, /* GL_MINMAX */
- { 20482, 0x0000802E }, /* GL_MINMAX_EXT */
- { 20496, 0x0000802F }, /* GL_MINMAX_FORMAT */
- { 20513, 0x0000802F }, /* GL_MINMAX_FORMAT_EXT */
- { 20534, 0x00008030 }, /* GL_MINMAX_SINK */
- { 20549, 0x00008030 }, /* GL_MINMAX_SINK_EXT */
- { 20568, 0x00008007 }, /* GL_MIN_EXT */
- { 20579, 0x00008370 }, /* GL_MIRRORED_REPEAT */
- { 20598, 0x00008370 }, /* GL_MIRRORED_REPEAT_ARB */
- { 20621, 0x00008370 }, /* GL_MIRRORED_REPEAT_IBM */
- { 20644, 0x00008742 }, /* GL_MIRROR_CLAMP_ATI */
- { 20664, 0x00008742 }, /* GL_MIRROR_CLAMP_EXT */
- { 20684, 0x00008912 }, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */
- { 20714, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_ATI */
- { 20742, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */
- { 20770, 0x00001700 }, /* GL_MODELVIEW */
- { 20783, 0x00001700 }, /* GL_MODELVIEW0_ARB */
- { 20801, 0x0000872A }, /* GL_MODELVIEW10_ARB */
- { 20820, 0x0000872B }, /* GL_MODELVIEW11_ARB */
- { 20839, 0x0000872C }, /* GL_MODELVIEW12_ARB */
- { 20858, 0x0000872D }, /* GL_MODELVIEW13_ARB */
- { 20877, 0x0000872E }, /* GL_MODELVIEW14_ARB */
- { 20896, 0x0000872F }, /* GL_MODELVIEW15_ARB */
- { 20915, 0x00008730 }, /* GL_MODELVIEW16_ARB */
- { 20934, 0x00008731 }, /* GL_MODELVIEW17_ARB */
- { 20953, 0x00008732 }, /* GL_MODELVIEW18_ARB */
- { 20972, 0x00008733 }, /* GL_MODELVIEW19_ARB */
- { 20991, 0x0000850A }, /* GL_MODELVIEW1_ARB */
- { 21009, 0x00008734 }, /* GL_MODELVIEW20_ARB */
- { 21028, 0x00008735 }, /* GL_MODELVIEW21_ARB */
- { 21047, 0x00008736 }, /* GL_MODELVIEW22_ARB */
- { 21066, 0x00008737 }, /* GL_MODELVIEW23_ARB */
- { 21085, 0x00008738 }, /* GL_MODELVIEW24_ARB */
- { 21104, 0x00008739 }, /* GL_MODELVIEW25_ARB */
- { 21123, 0x0000873A }, /* GL_MODELVIEW26_ARB */
- { 21142, 0x0000873B }, /* GL_MODELVIEW27_ARB */
- { 21161, 0x0000873C }, /* GL_MODELVIEW28_ARB */
- { 21180, 0x0000873D }, /* GL_MODELVIEW29_ARB */
- { 21199, 0x00008722 }, /* GL_MODELVIEW2_ARB */
- { 21217, 0x0000873E }, /* GL_MODELVIEW30_ARB */
- { 21236, 0x0000873F }, /* GL_MODELVIEW31_ARB */
- { 21255, 0x00008723 }, /* GL_MODELVIEW3_ARB */
- { 21273, 0x00008724 }, /* GL_MODELVIEW4_ARB */
- { 21291, 0x00008725 }, /* GL_MODELVIEW5_ARB */
- { 21309, 0x00008726 }, /* GL_MODELVIEW6_ARB */
- { 21327, 0x00008727 }, /* GL_MODELVIEW7_ARB */
- { 21345, 0x00008728 }, /* GL_MODELVIEW8_ARB */
- { 21363, 0x00008729 }, /* GL_MODELVIEW9_ARB */
- { 21381, 0x00000BA6 }, /* GL_MODELVIEW_MATRIX */
- { 21401, 0x00008629 }, /* GL_MODELVIEW_PROJECTION_NV */
- { 21428, 0x00000BA3 }, /* GL_MODELVIEW_STACK_DEPTH */
- { 21453, 0x00002100 }, /* GL_MODULATE */
- { 21465, 0x00008744 }, /* GL_MODULATE_ADD_ATI */
- { 21485, 0x00008745 }, /* GL_MODULATE_SIGNED_ADD_ATI */
- { 21512, 0x00008746 }, /* GL_MODULATE_SUBTRACT_ATI */
- { 21537, 0x00000103 }, /* GL_MULT */
- { 21545, 0x0000809D }, /* GL_MULTISAMPLE */
- { 21560, 0x000086B2 }, /* GL_MULTISAMPLE_3DFX */
- { 21580, 0x0000809D }, /* GL_MULTISAMPLE_ARB */
- { 21599, 0x20000000 }, /* GL_MULTISAMPLE_BIT */
- { 21618, 0x20000000 }, /* GL_MULTISAMPLE_BIT_3DFX */
- { 21642, 0x20000000 }, /* GL_MULTISAMPLE_BIT_ARB */
- { 21665, 0x00008534 }, /* GL_MULTISAMPLE_FILTER_HINT_NV */
- { 21695, 0x00002A25 }, /* GL_N3F_V3F */
- { 21706, 0x00000D70 }, /* GL_NAME_STACK_DEPTH */
- { 21726, 0x0000150E }, /* GL_NAND */
- { 21734, 0x00002600 }, /* GL_NEAREST */
- { 21745, 0x0000844E }, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */
- { 21776, 0x0000844D }, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */
- { 21808, 0x00002702 }, /* GL_NEAREST_MIPMAP_LINEAR */
- { 21833, 0x00002700 }, /* GL_NEAREST_MIPMAP_NEAREST */
- { 21859, 0x00000200 }, /* GL_NEVER */
- { 21868, 0x00001102 }, /* GL_NICEST */
- { 21878, 0x00000000 }, /* GL_NONE */
- { 21886, 0x00001505 }, /* GL_NOOP */
- { 21894, 0x00001508 }, /* GL_NOR */
- { 21901, 0x00000BA1 }, /* GL_NORMALIZE */
- { 21914, 0x00008075 }, /* GL_NORMAL_ARRAY */
- { 21930, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING */
- { 21961, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING_ARB */
- { 21996, 0x0000808F }, /* GL_NORMAL_ARRAY_POINTER */
- { 22020, 0x0000807F }, /* GL_NORMAL_ARRAY_STRIDE */
- { 22043, 0x0000807E }, /* GL_NORMAL_ARRAY_TYPE */
- { 22064, 0x00008511 }, /* GL_NORMAL_MAP */
- { 22078, 0x00008511 }, /* GL_NORMAL_MAP_ARB */
- { 22096, 0x00008511 }, /* GL_NORMAL_MAP_NV */
- { 22113, 0x00000205 }, /* GL_NOTEQUAL */
- { 22125, 0x00000000 }, /* GL_NO_ERROR */
- { 22137, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */
- { 22171, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB */
- { 22209, 0x00008B89 }, /* GL_OBJECT_ACTIVE_ATTRIBUTES_ARB */
- { 22241, 0x00008B8A }, /* GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB */
- { 22283, 0x00008B86 }, /* GL_OBJECT_ACTIVE_UNIFORMS_ARB */
- { 22313, 0x00008B87 }, /* GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB */
- { 22353, 0x00008B85 }, /* GL_OBJECT_ATTACHED_OBJECTS_ARB */
- { 22384, 0x00008B81 }, /* GL_OBJECT_COMPILE_STATUS_ARB */
- { 22413, 0x00008B80 }, /* GL_OBJECT_DELETE_STATUS_ARB */
- { 22441, 0x00008B84 }, /* GL_OBJECT_INFO_LOG_LENGTH_ARB */
- { 22471, 0x00002401 }, /* GL_OBJECT_LINEAR */
- { 22488, 0x00008B82 }, /* GL_OBJECT_LINK_STATUS_ARB */
- { 22514, 0x00002501 }, /* GL_OBJECT_PLANE */
- { 22530, 0x00008B88 }, /* GL_OBJECT_SHADER_SOURCE_LENGTH_ARB */
- { 22565, 0x00008B4F }, /* GL_OBJECT_SUBTYPE_ARB */
- { 22587, 0x00009112 }, /* GL_OBJECT_TYPE */
- { 22602, 0x00008B4E }, /* GL_OBJECT_TYPE_ARB */
- { 22621, 0x00008B83 }, /* GL_OBJECT_VALIDATE_STATUS_ARB */
- { 22651, 0x00008165 }, /* GL_OCCLUSION_TEST_HP */
- { 22672, 0x00008166 }, /* GL_OCCLUSION_TEST_RESULT_HP */
- { 22700, 0x00000001 }, /* GL_ONE */
- { 22707, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA */
- { 22735, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA_EXT */
- { 22767, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR */
- { 22795, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR_EXT */
- { 22827, 0x00000305 }, /* GL_ONE_MINUS_DST_ALPHA */
- { 22850, 0x00000307 }, /* GL_ONE_MINUS_DST_COLOR */
- { 22873, 0x00000303 }, /* GL_ONE_MINUS_SRC_ALPHA */
- { 22896, 0x00000301 }, /* GL_ONE_MINUS_SRC_COLOR */
- { 22919, 0x00008598 }, /* GL_OPERAND0_ALPHA */
- { 22937, 0x00008598 }, /* GL_OPERAND0_ALPHA_ARB */
- { 22959, 0x00008598 }, /* GL_OPERAND0_ALPHA_EXT */
- { 22981, 0x00008590 }, /* GL_OPERAND0_RGB */
- { 22997, 0x00008590 }, /* GL_OPERAND0_RGB_ARB */
- { 23017, 0x00008590 }, /* GL_OPERAND0_RGB_EXT */
- { 23037, 0x00008599 }, /* GL_OPERAND1_ALPHA */
- { 23055, 0x00008599 }, /* GL_OPERAND1_ALPHA_ARB */
- { 23077, 0x00008599 }, /* GL_OPERAND1_ALPHA_EXT */
- { 23099, 0x00008591 }, /* GL_OPERAND1_RGB */
- { 23115, 0x00008591 }, /* GL_OPERAND1_RGB_ARB */
- { 23135, 0x00008591 }, /* GL_OPERAND1_RGB_EXT */
- { 23155, 0x0000859A }, /* GL_OPERAND2_ALPHA */
- { 23173, 0x0000859A }, /* GL_OPERAND2_ALPHA_ARB */
- { 23195, 0x0000859A }, /* GL_OPERAND2_ALPHA_EXT */
- { 23217, 0x00008592 }, /* GL_OPERAND2_RGB */
- { 23233, 0x00008592 }, /* GL_OPERAND2_RGB_ARB */
- { 23253, 0x00008592 }, /* GL_OPERAND2_RGB_EXT */
- { 23273, 0x0000859B }, /* GL_OPERAND3_ALPHA_NV */
- { 23294, 0x00008593 }, /* GL_OPERAND3_RGB_NV */
- { 23313, 0x00001507 }, /* GL_OR */
- { 23319, 0x00000A01 }, /* GL_ORDER */
- { 23328, 0x0000150D }, /* GL_OR_INVERTED */
- { 23343, 0x0000150B }, /* GL_OR_REVERSE */
- { 23357, 0x00000505 }, /* GL_OUT_OF_MEMORY */
- { 23374, 0x00000D05 }, /* GL_PACK_ALIGNMENT */
- { 23392, 0x0000806C }, /* GL_PACK_IMAGE_HEIGHT */
- { 23413, 0x00008758 }, /* GL_PACK_INVERT_MESA */
- { 23433, 0x00000D01 }, /* GL_PACK_LSB_FIRST */
- { 23451, 0x00000D02 }, /* GL_PACK_ROW_LENGTH */
- { 23470, 0x0000806B }, /* GL_PACK_SKIP_IMAGES */
- { 23490, 0x00000D04 }, /* GL_PACK_SKIP_PIXELS */
- { 23510, 0x00000D03 }, /* GL_PACK_SKIP_ROWS */
- { 23528, 0x00000D00 }, /* GL_PACK_SWAP_BYTES */
- { 23547, 0x00008B92 }, /* GL_PALETTE4_R5_G6_B5_OES */
- { 23572, 0x00008B94 }, /* GL_PALETTE4_RGB5_A1_OES */
- { 23596, 0x00008B90 }, /* GL_PALETTE4_RGB8_OES */
- { 23617, 0x00008B93 }, /* GL_PALETTE4_RGBA4_OES */
- { 23639, 0x00008B91 }, /* GL_PALETTE4_RGBA8_OES */
- { 23661, 0x00008B97 }, /* GL_PALETTE8_R5_G6_B5_OES */
- { 23686, 0x00008B99 }, /* GL_PALETTE8_RGB5_A1_OES */
- { 23710, 0x00008B95 }, /* GL_PALETTE8_RGB8_OES */
- { 23731, 0x00008B98 }, /* GL_PALETTE8_RGBA4_OES */
- { 23753, 0x00008B96 }, /* GL_PALETTE8_RGBA8_OES */
- { 23775, 0x00000700 }, /* GL_PASS_THROUGH_TOKEN */
- { 23797, 0x00000C50 }, /* GL_PERSPECTIVE_CORRECTION_HINT */
- { 23828, 0x00000C79 }, /* GL_PIXEL_MAP_A_TO_A */
- { 23848, 0x00000CB9 }, /* GL_PIXEL_MAP_A_TO_A_SIZE */
- { 23873, 0x00000C78 }, /* GL_PIXEL_MAP_B_TO_B */
- { 23893, 0x00000CB8 }, /* GL_PIXEL_MAP_B_TO_B_SIZE */
- { 23918, 0x00000C77 }, /* GL_PIXEL_MAP_G_TO_G */
- { 23938, 0x00000CB7 }, /* GL_PIXEL_MAP_G_TO_G_SIZE */
- { 23963, 0x00000C75 }, /* GL_PIXEL_MAP_I_TO_A */
- { 23983, 0x00000CB5 }, /* GL_PIXEL_MAP_I_TO_A_SIZE */
- { 24008, 0x00000C74 }, /* GL_PIXEL_MAP_I_TO_B */
- { 24028, 0x00000CB4 }, /* GL_PIXEL_MAP_I_TO_B_SIZE */
- { 24053, 0x00000C73 }, /* GL_PIXEL_MAP_I_TO_G */
- { 24073, 0x00000CB3 }, /* GL_PIXEL_MAP_I_TO_G_SIZE */
- { 24098, 0x00000C70 }, /* GL_PIXEL_MAP_I_TO_I */
- { 24118, 0x00000CB0 }, /* GL_PIXEL_MAP_I_TO_I_SIZE */
- { 24143, 0x00000C72 }, /* GL_PIXEL_MAP_I_TO_R */
- { 24163, 0x00000CB2 }, /* GL_PIXEL_MAP_I_TO_R_SIZE */
- { 24188, 0x00000C76 }, /* GL_PIXEL_MAP_R_TO_R */
- { 24208, 0x00000CB6 }, /* GL_PIXEL_MAP_R_TO_R_SIZE */
- { 24233, 0x00000C71 }, /* GL_PIXEL_MAP_S_TO_S */
- { 24253, 0x00000CB1 }, /* GL_PIXEL_MAP_S_TO_S_SIZE */
- { 24278, 0x00000020 }, /* GL_PIXEL_MODE_BIT */
- { 24296, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER */
- { 24317, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING */
- { 24346, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING_EXT */
- { 24379, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER_EXT */
- { 24404, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER */
- { 24427, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING */
- { 24458, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING_EXT */
- { 24493, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER_EXT */
- { 24520, 0x00001B00 }, /* GL_POINT */
- { 24529, 0x00000000 }, /* GL_POINTS */
- { 24539, 0x00000002 }, /* GL_POINT_BIT */
- { 24552, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION */
- { 24582, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_ARB */
- { 24616, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_EXT */
- { 24650, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_SGIS */
- { 24685, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE */
- { 24714, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_ARB */
- { 24747, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_EXT */
- { 24780, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_SGIS */
- { 24814, 0x00000B11 }, /* GL_POINT_SIZE */
- { 24828, 0x00000B13 }, /* GL_POINT_SIZE_GRANULARITY */
- { 24854, 0x00008127 }, /* GL_POINT_SIZE_MAX */
- { 24872, 0x00008127 }, /* GL_POINT_SIZE_MAX_ARB */
- { 24894, 0x00008127 }, /* GL_POINT_SIZE_MAX_EXT */
- { 24916, 0x00008127 }, /* GL_POINT_SIZE_MAX_SGIS */
- { 24939, 0x00008126 }, /* GL_POINT_SIZE_MIN */
- { 24957, 0x00008126 }, /* GL_POINT_SIZE_MIN_ARB */
- { 24979, 0x00008126 }, /* GL_POINT_SIZE_MIN_EXT */
- { 25001, 0x00008126 }, /* GL_POINT_SIZE_MIN_SGIS */
- { 25024, 0x00000B12 }, /* GL_POINT_SIZE_RANGE */
- { 25044, 0x00000B10 }, /* GL_POINT_SMOOTH */
- { 25060, 0x00000C51 }, /* GL_POINT_SMOOTH_HINT */
- { 25081, 0x00008861 }, /* GL_POINT_SPRITE */
- { 25097, 0x00008861 }, /* GL_POINT_SPRITE_ARB */
- { 25117, 0x00008CA0 }, /* GL_POINT_SPRITE_COORD_ORIGIN */
- { 25146, 0x00008861 }, /* GL_POINT_SPRITE_NV */
- { 25165, 0x00008863 }, /* GL_POINT_SPRITE_R_MODE_NV */
- { 25191, 0x00000701 }, /* GL_POINT_TOKEN */
- { 25206, 0x00000009 }, /* GL_POLYGON */
- { 25217, 0x00000008 }, /* GL_POLYGON_BIT */
- { 25232, 0x00000B40 }, /* GL_POLYGON_MODE */
- { 25248, 0x00008039 }, /* GL_POLYGON_OFFSET_BIAS */
- { 25271, 0x00008038 }, /* GL_POLYGON_OFFSET_FACTOR */
- { 25296, 0x00008037 }, /* GL_POLYGON_OFFSET_FILL */
- { 25319, 0x00002A02 }, /* GL_POLYGON_OFFSET_LINE */
- { 25342, 0x00002A01 }, /* GL_POLYGON_OFFSET_POINT */
- { 25366, 0x00002A00 }, /* GL_POLYGON_OFFSET_UNITS */
- { 25390, 0x00000B41 }, /* GL_POLYGON_SMOOTH */
- { 25408, 0x00000C53 }, /* GL_POLYGON_SMOOTH_HINT */
- { 25431, 0x00000B42 }, /* GL_POLYGON_STIPPLE */
- { 25450, 0x00000010 }, /* GL_POLYGON_STIPPLE_BIT */
- { 25473, 0x00000703 }, /* GL_POLYGON_TOKEN */
- { 25490, 0x00001203 }, /* GL_POSITION */
- { 25502, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */
- { 25534, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI */
- { 25570, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */
- { 25603, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI */
- { 25640, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */
- { 25671, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI */
- { 25706, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */
- { 25738, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI */
- { 25774, 0x000080D2 }, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */
- { 25807, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */
- { 25839, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI */
- { 25875, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */
- { 25908, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI */
- { 25945, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS */
- { 25975, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS_SGI */
- { 26009, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE */
- { 26040, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE_SGI */
- { 26075, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS */
- { 26106, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS_EXT */
- { 26141, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE */
- { 26173, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE_EXT */
- { 26209, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS */
- { 26239, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS_EXT */
- { 26273, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE */
- { 26304, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE_EXT */
- { 26339, 0x000080D1 }, /* GL_POST_CONVOLUTION_COLOR_TABLE */
- { 26371, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS */
- { 26402, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS_EXT */
- { 26437, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE */
- { 26469, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE_EXT */
- { 26505, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS */
- { 26534, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS_EXT */
- { 26567, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE */
- { 26597, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE_EXT */
- { 26631, 0x0000817B }, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */
- { 26670, 0x00008179 }, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */
- { 26703, 0x0000817C }, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */
- { 26743, 0x0000817A }, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */
- { 26777, 0x00008578 }, /* GL_PREVIOUS */
- { 26789, 0x00008578 }, /* GL_PREVIOUS_ARB */
- { 26805, 0x00008578 }, /* GL_PREVIOUS_EXT */
- { 26821, 0x00008577 }, /* GL_PRIMARY_COLOR */
- { 26838, 0x00008577 }, /* GL_PRIMARY_COLOR_ARB */
- { 26859, 0x00008577 }, /* GL_PRIMARY_COLOR_EXT */
- { 26880, 0x000088B0 }, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */
- { 26913, 0x00008805 }, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */
- { 26945, 0x000088AC }, /* GL_PROGRAM_ATTRIBS_ARB */
- { 26968, 0x00008677 }, /* GL_PROGRAM_BINDING_ARB */
- { 26991, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_ARB */
- { 27021, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_NV */
- { 27050, 0x00008874 }, /* GL_PROGRAM_ERROR_STRING_ARB */
- { 27078, 0x00008876 }, /* GL_PROGRAM_FORMAT_ARB */
- { 27100, 0x00008875 }, /* GL_PROGRAM_FORMAT_ASCII_ARB */
- { 27128, 0x000088A0 }, /* GL_PROGRAM_INSTRUCTIONS_ARB */
- { 27156, 0x00008627 }, /* GL_PROGRAM_LENGTH_ARB */
- { 27178, 0x00008627 }, /* GL_PROGRAM_LENGTH_NV */
- { 27199, 0x000088B2 }, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
- { 27239, 0x00008808 }, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
- { 27278, 0x000088AE }, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */
- { 27308, 0x000088A2 }, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
- { 27343, 0x000088AA }, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */
- { 27376, 0x000088A6 }, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */
- { 27410, 0x0000880A }, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
- { 27449, 0x00008809 }, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
- { 27488, 0x00008B40 }, /* GL_PROGRAM_OBJECT_ARB */
- { 27510, 0x000088A8 }, /* GL_PROGRAM_PARAMETERS_ARB */
- { 27536, 0x00008644 }, /* GL_PROGRAM_PARAMETER_NV */
- { 27560, 0x00008647 }, /* GL_PROGRAM_RESIDENT_NV */
- { 27583, 0x00008628 }, /* GL_PROGRAM_STRING_ARB */
- { 27605, 0x00008628 }, /* GL_PROGRAM_STRING_NV */
- { 27626, 0x00008646 }, /* GL_PROGRAM_TARGET_NV */
- { 27647, 0x000088A4 }, /* GL_PROGRAM_TEMPORARIES_ARB */
- { 27674, 0x00008807 }, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */
- { 27706, 0x00008806 }, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */
- { 27738, 0x000088B6 }, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */
- { 27773, 0x00001701 }, /* GL_PROJECTION */
- { 27787, 0x00000BA7 }, /* GL_PROJECTION_MATRIX */
- { 27808, 0x00000BA4 }, /* GL_PROJECTION_STACK_DEPTH */
- { 27834, 0x00008E4F }, /* GL_PROVOKING_VERTEX */
- { 27854, 0x00008E4F }, /* GL_PROVOKING_VERTEX_EXT */
- { 27878, 0x000080D3 }, /* GL_PROXY_COLOR_TABLE */
- { 27899, 0x00008025 }, /* GL_PROXY_HISTOGRAM */
- { 27918, 0x00008025 }, /* GL_PROXY_HISTOGRAM_EXT */
- { 27941, 0x000080D5 }, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */
- { 27980, 0x000080D4 }, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */
- { 28018, 0x00008063 }, /* GL_PROXY_TEXTURE_1D */
- { 28038, 0x00008C19 }, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */
- { 28068, 0x00008063 }, /* GL_PROXY_TEXTURE_1D_EXT */
- { 28092, 0x00008064 }, /* GL_PROXY_TEXTURE_2D */
- { 28112, 0x00008C1B }, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */
- { 28142, 0x00008064 }, /* GL_PROXY_TEXTURE_2D_EXT */
- { 28166, 0x00008070 }, /* GL_PROXY_TEXTURE_3D */
- { 28186, 0x000080BD }, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */
- { 28219, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP */
- { 28245, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP_ARB */
- { 28275, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */
- { 28306, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_NV */
- { 28336, 0x00002003 }, /* GL_Q */
- { 28341, 0x00001209 }, /* GL_QUADRATIC_ATTENUATION */
- { 28366, 0x00000007 }, /* GL_QUADS */
- { 28375, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */
- { 28419, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT */
- { 28467, 0x00008614 }, /* GL_QUAD_MESH_SUN */
- { 28484, 0x00000008 }, /* GL_QUAD_STRIP */
- { 28498, 0x00008E16 }, /* GL_QUERY_BY_REGION_NO_WAIT_NV */
- { 28528, 0x00008E15 }, /* GL_QUERY_BY_REGION_WAIT_NV */
- { 28555, 0x00008864 }, /* GL_QUERY_COUNTER_BITS */
- { 28577, 0x00008864 }, /* GL_QUERY_COUNTER_BITS_ARB */
- { 28603, 0x00008E14 }, /* GL_QUERY_NO_WAIT_NV */
- { 28623, 0x00008866 }, /* GL_QUERY_RESULT */
- { 28639, 0x00008866 }, /* GL_QUERY_RESULT_ARB */
- { 28659, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE */
- { 28685, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE_ARB */
- { 28715, 0x00008E13 }, /* GL_QUERY_WAIT_NV */
- { 28732, 0x00002002 }, /* GL_R */
- { 28737, 0x00002A10 }, /* GL_R3_G3_B2 */
- { 28749, 0x00019262 }, /* GL_RASTER_POSITION_UNCLIPPED_IBM */
- { 28782, 0x00000C02 }, /* GL_READ_BUFFER */
- { 28797, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER */
- { 28817, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING */
- { 28845, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING_EXT */
- { 28877, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER_EXT */
- { 28901, 0x000088B8 }, /* GL_READ_ONLY */
- { 28914, 0x000088B8 }, /* GL_READ_ONLY_ARB */
- { 28931, 0x000088BA }, /* GL_READ_WRITE */
- { 28945, 0x000088BA }, /* GL_READ_WRITE_ARB */
- { 28963, 0x00001903 }, /* GL_RED */
- { 28970, 0x00008016 }, /* GL_REDUCE */
- { 28980, 0x00008016 }, /* GL_REDUCE_EXT */
- { 28994, 0x00000D15 }, /* GL_RED_BIAS */
- { 29006, 0x00000D52 }, /* GL_RED_BITS */
- { 29018, 0x00000D14 }, /* GL_RED_SCALE */
- { 29031, 0x00008512 }, /* GL_REFLECTION_MAP */
- { 29049, 0x00008512 }, /* GL_REFLECTION_MAP_ARB */
- { 29071, 0x00008512 }, /* GL_REFLECTION_MAP_NV */
- { 29092, 0x00001C00 }, /* GL_RENDER */
- { 29102, 0x00008D41 }, /* GL_RENDERBUFFER */
- { 29118, 0x00008D53 }, /* GL_RENDERBUFFER_ALPHA_SIZE */
- { 29145, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING */
- { 29169, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_EXT */
- { 29197, 0x00008D52 }, /* GL_RENDERBUFFER_BLUE_SIZE */
- { 29223, 0x00008D54 }, /* GL_RENDERBUFFER_DEPTH_SIZE */
- { 29250, 0x00008D41 }, /* GL_RENDERBUFFER_EXT */
- { 29270, 0x00008D51 }, /* GL_RENDERBUFFER_GREEN_SIZE */
- { 29297, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT */
- { 29320, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_EXT */
- { 29347, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT */
- { 29379, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_EXT */
- { 29415, 0x00008D50 }, /* GL_RENDERBUFFER_RED_SIZE */
- { 29440, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES */
- { 29464, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES_EXT */
- { 29492, 0x00008D55 }, /* GL_RENDERBUFFER_STENCIL_SIZE */
- { 29521, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH */
- { 29543, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_EXT */
- { 29569, 0x00001F01 }, /* GL_RENDERER */
- { 29581, 0x00000C40 }, /* GL_RENDER_MODE */
- { 29596, 0x00002901 }, /* GL_REPEAT */
- { 29606, 0x00001E01 }, /* GL_REPLACE */
- { 29617, 0x00008062 }, /* GL_REPLACE_EXT */
- { 29632, 0x00008153 }, /* GL_REPLICATE_BORDER_HP */
- { 29655, 0x0000803A }, /* GL_RESCALE_NORMAL */
- { 29673, 0x0000803A }, /* GL_RESCALE_NORMAL_EXT */
- { 29695, 0x00000102 }, /* GL_RETURN */
- { 29705, 0x00001907 }, /* GL_RGB */
- { 29712, 0x00008052 }, /* GL_RGB10 */
- { 29721, 0x00008059 }, /* GL_RGB10_A2 */
- { 29733, 0x00008059 }, /* GL_RGB10_A2_EXT */
- { 29749, 0x00008052 }, /* GL_RGB10_EXT */
- { 29762, 0x00008053 }, /* GL_RGB12 */
- { 29771, 0x00008053 }, /* GL_RGB12_EXT */
- { 29784, 0x00008054 }, /* GL_RGB16 */
- { 29793, 0x00008054 }, /* GL_RGB16_EXT */
- { 29806, 0x0000804E }, /* GL_RGB2_EXT */
- { 29818, 0x0000804F }, /* GL_RGB4 */
- { 29826, 0x0000804F }, /* GL_RGB4_EXT */
- { 29838, 0x000083A1 }, /* GL_RGB4_S3TC */
- { 29851, 0x00008050 }, /* GL_RGB5 */
- { 29859, 0x00008057 }, /* GL_RGB5_A1 */
- { 29870, 0x00008057 }, /* GL_RGB5_A1_EXT */
- { 29885, 0x00008050 }, /* GL_RGB5_EXT */
- { 29897, 0x00008051 }, /* GL_RGB8 */
- { 29905, 0x00008051 }, /* GL_RGB8_EXT */
- { 29917, 0x00001908 }, /* GL_RGBA */
- { 29925, 0x0000805A }, /* GL_RGBA12 */
- { 29935, 0x0000805A }, /* GL_RGBA12_EXT */
- { 29949, 0x0000805B }, /* GL_RGBA16 */
- { 29959, 0x0000805B }, /* GL_RGBA16_EXT */
- { 29973, 0x00008055 }, /* GL_RGBA2 */
- { 29982, 0x00008055 }, /* GL_RGBA2_EXT */
- { 29995, 0x00008056 }, /* GL_RGBA4 */
- { 30004, 0x000083A5 }, /* GL_RGBA4_DXT5_S3TC */
- { 30023, 0x00008056 }, /* GL_RGBA4_EXT */
- { 30036, 0x000083A3 }, /* GL_RGBA4_S3TC */
- { 30050, 0x00008058 }, /* GL_RGBA8 */
- { 30059, 0x00008058 }, /* GL_RGBA8_EXT */
- { 30072, 0x00008F97 }, /* GL_RGBA8_SNORM */
- { 30087, 0x000083A4 }, /* GL_RGBA_DXT5_S3TC */
- { 30105, 0x00000C31 }, /* GL_RGBA_MODE */
- { 30118, 0x000083A2 }, /* GL_RGBA_S3TC */
- { 30131, 0x00008F93 }, /* GL_RGBA_SNORM */
- { 30145, 0x000083A0 }, /* GL_RGB_S3TC */
- { 30157, 0x00008573 }, /* GL_RGB_SCALE */
- { 30170, 0x00008573 }, /* GL_RGB_SCALE_ARB */
- { 30187, 0x00008573 }, /* GL_RGB_SCALE_EXT */
- { 30204, 0x00000407 }, /* GL_RIGHT */
- { 30213, 0x00002000 }, /* GL_S */
- { 30218, 0x00008B5D }, /* GL_SAMPLER_1D */
- { 30232, 0x00008B61 }, /* GL_SAMPLER_1D_SHADOW */
- { 30253, 0x00008B5E }, /* GL_SAMPLER_2D */
- { 30267, 0x00008B62 }, /* GL_SAMPLER_2D_SHADOW */
- { 30288, 0x00008B5F }, /* GL_SAMPLER_3D */
- { 30302, 0x00008B60 }, /* GL_SAMPLER_CUBE */
- { 30318, 0x000080A9 }, /* GL_SAMPLES */
- { 30329, 0x000086B4 }, /* GL_SAMPLES_3DFX */
- { 30345, 0x000080A9 }, /* GL_SAMPLES_ARB */
- { 30360, 0x00008914 }, /* GL_SAMPLES_PASSED */
- { 30378, 0x00008914 }, /* GL_SAMPLES_PASSED_ARB */
- { 30400, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE */
- { 30428, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE_ARB */
- { 30460, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE */
- { 30483, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE_ARB */
- { 30510, 0x000080A8 }, /* GL_SAMPLE_BUFFERS */
- { 30528, 0x000086B3 }, /* GL_SAMPLE_BUFFERS_3DFX */
- { 30551, 0x000080A8 }, /* GL_SAMPLE_BUFFERS_ARB */
- { 30573, 0x000080A0 }, /* GL_SAMPLE_COVERAGE */
- { 30592, 0x000080A0 }, /* GL_SAMPLE_COVERAGE_ARB */
- { 30615, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT */
- { 30641, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT_ARB */
- { 30671, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE */
- { 30696, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE_ARB */
- { 30725, 0x00080000 }, /* GL_SCISSOR_BIT */
- { 30740, 0x00000C10 }, /* GL_SCISSOR_BOX */
- { 30755, 0x00000C11 }, /* GL_SCISSOR_TEST */
- { 30771, 0x0000845E }, /* GL_SECONDARY_COLOR_ARRAY */
- { 30796, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */
- { 30836, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB */
- { 30880, 0x0000845D }, /* GL_SECONDARY_COLOR_ARRAY_POINTER */
- { 30913, 0x0000845A }, /* GL_SECONDARY_COLOR_ARRAY_SIZE */
- { 30943, 0x0000845C }, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */
- { 30975, 0x0000845B }, /* GL_SECONDARY_COLOR_ARRAY_TYPE */
- { 31005, 0x00001C02 }, /* GL_SELECT */
- { 31015, 0x00000DF3 }, /* GL_SELECTION_BUFFER_POINTER */
- { 31043, 0x00000DF4 }, /* GL_SELECTION_BUFFER_SIZE */
- { 31068, 0x00008012 }, /* GL_SEPARABLE_2D */
- { 31084, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR */
- { 31111, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR_EXT */
- { 31142, 0x0000150F }, /* GL_SET */
- { 31149, 0x00008B48 }, /* GL_SHADER_OBJECT_ARB */
- { 31170, 0x00008B88 }, /* GL_SHADER_SOURCE_LENGTH */
- { 31194, 0x00008B4F }, /* GL_SHADER_TYPE */
- { 31209, 0x00000B54 }, /* GL_SHADE_MODEL */
- { 31224, 0x00008B8C }, /* GL_SHADING_LANGUAGE_VERSION */
- { 31252, 0x000080BF }, /* GL_SHADOW_AMBIENT_SGIX */
- { 31275, 0x000081FB }, /* GL_SHARED_TEXTURE_PALETTE_EXT */
- { 31305, 0x00001601 }, /* GL_SHININESS */
- { 31318, 0x00001402 }, /* GL_SHORT */
- { 31327, 0x00009119 }, /* GL_SIGNALED */
- { 31339, 0x00008F9C }, /* GL_SIGNED_NORMALIZED */
- { 31360, 0x000081F9 }, /* GL_SINGLE_COLOR */
- { 31376, 0x000081F9 }, /* GL_SINGLE_COLOR_EXT */
- { 31396, 0x000085CC }, /* GL_SLICE_ACCUM_SUN */
- { 31415, 0x00008C46 }, /* GL_SLUMINANCE */
- { 31429, 0x00008C47 }, /* GL_SLUMINANCE8 */
- { 31444, 0x00008C45 }, /* GL_SLUMINANCE8_ALPHA8 */
- { 31466, 0x00008C44 }, /* GL_SLUMINANCE_ALPHA */
- { 31486, 0x00001D01 }, /* GL_SMOOTH */
- { 31496, 0x00000B23 }, /* GL_SMOOTH_LINE_WIDTH_GRANULARITY */
- { 31529, 0x00000B22 }, /* GL_SMOOTH_LINE_WIDTH_RANGE */
- { 31556, 0x00000B13 }, /* GL_SMOOTH_POINT_SIZE_GRANULARITY */
- { 31589, 0x00000B12 }, /* GL_SMOOTH_POINT_SIZE_RANGE */
- { 31616, 0x00008588 }, /* GL_SOURCE0_ALPHA */
- { 31633, 0x00008588 }, /* GL_SOURCE0_ALPHA_ARB */
- { 31654, 0x00008588 }, /* GL_SOURCE0_ALPHA_EXT */
- { 31675, 0x00008580 }, /* GL_SOURCE0_RGB */
- { 31690, 0x00008580 }, /* GL_SOURCE0_RGB_ARB */
- { 31709, 0x00008580 }, /* GL_SOURCE0_RGB_EXT */
- { 31728, 0x00008589 }, /* GL_SOURCE1_ALPHA */
- { 31745, 0x00008589 }, /* GL_SOURCE1_ALPHA_ARB */
- { 31766, 0x00008589 }, /* GL_SOURCE1_ALPHA_EXT */
- { 31787, 0x00008581 }, /* GL_SOURCE1_RGB */
- { 31802, 0x00008581 }, /* GL_SOURCE1_RGB_ARB */
- { 31821, 0x00008581 }, /* GL_SOURCE1_RGB_EXT */
- { 31840, 0x0000858A }, /* GL_SOURCE2_ALPHA */
- { 31857, 0x0000858A }, /* GL_SOURCE2_ALPHA_ARB */
- { 31878, 0x0000858A }, /* GL_SOURCE2_ALPHA_EXT */
- { 31899, 0x00008582 }, /* GL_SOURCE2_RGB */
- { 31914, 0x00008582 }, /* GL_SOURCE2_RGB_ARB */
- { 31933, 0x00008582 }, /* GL_SOURCE2_RGB_EXT */
- { 31952, 0x0000858B }, /* GL_SOURCE3_ALPHA_NV */
- { 31972, 0x00008583 }, /* GL_SOURCE3_RGB_NV */
- { 31990, 0x00001202 }, /* GL_SPECULAR */
- { 32002, 0x00002402 }, /* GL_SPHERE_MAP */
- { 32016, 0x00001206 }, /* GL_SPOT_CUTOFF */
- { 32031, 0x00001204 }, /* GL_SPOT_DIRECTION */
- { 32049, 0x00001205 }, /* GL_SPOT_EXPONENT */
- { 32066, 0x00008588 }, /* GL_SRC0_ALPHA */
- { 32080, 0x00008580 }, /* GL_SRC0_RGB */
- { 32092, 0x00008589 }, /* GL_SRC1_ALPHA */
- { 32106, 0x00008581 }, /* GL_SRC1_RGB */
- { 32118, 0x0000858A }, /* GL_SRC2_ALPHA */
- { 32132, 0x00008582 }, /* GL_SRC2_RGB */
- { 32144, 0x00000302 }, /* GL_SRC_ALPHA */
- { 32157, 0x00000308 }, /* GL_SRC_ALPHA_SATURATE */
- { 32179, 0x00000300 }, /* GL_SRC_COLOR */
- { 32192, 0x00008C40 }, /* GL_SRGB */
- { 32200, 0x00008C41 }, /* GL_SRGB8 */
- { 32209, 0x00008C43 }, /* GL_SRGB8_ALPHA8 */
- { 32225, 0x00008C42 }, /* GL_SRGB_ALPHA */
- { 32239, 0x00000503 }, /* GL_STACK_OVERFLOW */
- { 32257, 0x00000504 }, /* GL_STACK_UNDERFLOW */
- { 32276, 0x000088E6 }, /* GL_STATIC_COPY */
- { 32291, 0x000088E6 }, /* GL_STATIC_COPY_ARB */
- { 32310, 0x000088E4 }, /* GL_STATIC_DRAW */
- { 32325, 0x000088E4 }, /* GL_STATIC_DRAW_ARB */
- { 32344, 0x000088E5 }, /* GL_STATIC_READ */
- { 32359, 0x000088E5 }, /* GL_STATIC_READ_ARB */
- { 32378, 0x00001802 }, /* GL_STENCIL */
- { 32389, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT */
- { 32411, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_EXT */
- { 32437, 0x00008801 }, /* GL_STENCIL_BACK_FAIL */
- { 32458, 0x00008801 }, /* GL_STENCIL_BACK_FAIL_ATI */
- { 32483, 0x00008800 }, /* GL_STENCIL_BACK_FUNC */
- { 32504, 0x00008800 }, /* GL_STENCIL_BACK_FUNC_ATI */
- { 32529, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */
- { 32561, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI */
- { 32597, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */
- { 32629, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI */
- { 32665, 0x00008CA3 }, /* GL_STENCIL_BACK_REF */
- { 32685, 0x00008CA4 }, /* GL_STENCIL_BACK_VALUE_MASK */
- { 32712, 0x00008CA5 }, /* GL_STENCIL_BACK_WRITEMASK */
- { 32738, 0x00000D57 }, /* GL_STENCIL_BITS */
- { 32754, 0x00000400 }, /* GL_STENCIL_BUFFER_BIT */
- { 32776, 0x00000B91 }, /* GL_STENCIL_CLEAR_VALUE */
- { 32799, 0x00000B94 }, /* GL_STENCIL_FAIL */
- { 32815, 0x00000B92 }, /* GL_STENCIL_FUNC */
- { 32831, 0x00001901 }, /* GL_STENCIL_INDEX */
- { 32848, 0x00008D46 }, /* GL_STENCIL_INDEX1 */
- { 32866, 0x00008D49 }, /* GL_STENCIL_INDEX16 */
- { 32885, 0x00008D49 }, /* GL_STENCIL_INDEX16_EXT */
- { 32908, 0x00008D46 }, /* GL_STENCIL_INDEX1_EXT */
- { 32930, 0x00008D47 }, /* GL_STENCIL_INDEX4 */
- { 32948, 0x00008D47 }, /* GL_STENCIL_INDEX4_EXT */
- { 32970, 0x00008D48 }, /* GL_STENCIL_INDEX8 */
- { 32988, 0x00008D48 }, /* GL_STENCIL_INDEX8_EXT */
- { 33010, 0x00008D45 }, /* GL_STENCIL_INDEX_EXT */
- { 33031, 0x00000B95 }, /* GL_STENCIL_PASS_DEPTH_FAIL */
- { 33058, 0x00000B96 }, /* GL_STENCIL_PASS_DEPTH_PASS */
- { 33085, 0x00000B97 }, /* GL_STENCIL_REF */
- { 33100, 0x00000B90 }, /* GL_STENCIL_TEST */
- { 33116, 0x00008910 }, /* GL_STENCIL_TEST_TWO_SIDE_EXT */
- { 33145, 0x00000B93 }, /* GL_STENCIL_VALUE_MASK */
- { 33167, 0x00000B98 }, /* GL_STENCIL_WRITEMASK */
- { 33188, 0x00000C33 }, /* GL_STEREO */
- { 33198, 0x000085BE }, /* GL_STORAGE_CACHED_APPLE */
- { 33222, 0x000085BD }, /* GL_STORAGE_PRIVATE_APPLE */
- { 33247, 0x000085BF }, /* GL_STORAGE_SHARED_APPLE */
- { 33271, 0x000088E2 }, /* GL_STREAM_COPY */
- { 33286, 0x000088E2 }, /* GL_STREAM_COPY_ARB */
- { 33305, 0x000088E0 }, /* GL_STREAM_DRAW */
- { 33320, 0x000088E0 }, /* GL_STREAM_DRAW_ARB */
- { 33339, 0x000088E1 }, /* GL_STREAM_READ */
- { 33354, 0x000088E1 }, /* GL_STREAM_READ_ARB */
- { 33373, 0x00000D50 }, /* GL_SUBPIXEL_BITS */
- { 33390, 0x000084E7 }, /* GL_SUBTRACT */
- { 33402, 0x000084E7 }, /* GL_SUBTRACT_ARB */
- { 33418, 0x00009113 }, /* GL_SYNC_CONDITION */
- { 33436, 0x00009116 }, /* GL_SYNC_FENCE */
- { 33450, 0x00009115 }, /* GL_SYNC_FLAGS */
- { 33464, 0x00000001 }, /* GL_SYNC_FLUSH_COMMANDS_BIT */
- { 33491, 0x00009117 }, /* GL_SYNC_GPU_COMMANDS_COMPLETE */
- { 33521, 0x00009114 }, /* GL_SYNC_STATUS */
- { 33536, 0x00002001 }, /* GL_T */
- { 33541, 0x00002A2A }, /* GL_T2F_C3F_V3F */
- { 33556, 0x00002A2C }, /* GL_T2F_C4F_N3F_V3F */
- { 33575, 0x00002A29 }, /* GL_T2F_C4UB_V3F */
- { 33591, 0x00002A2B }, /* GL_T2F_N3F_V3F */
- { 33606, 0x00002A27 }, /* GL_T2F_V3F */
- { 33617, 0x00002A2D }, /* GL_T4F_C4F_N3F_V4F */
- { 33636, 0x00002A28 }, /* GL_T4F_V4F */
- { 33647, 0x00008031 }, /* GL_TABLE_TOO_LARGE_EXT */
- { 33670, 0x00001702 }, /* GL_TEXTURE */
- { 33681, 0x000084C0 }, /* GL_TEXTURE0 */
- { 33693, 0x000084C0 }, /* GL_TEXTURE0_ARB */
- { 33709, 0x000084C1 }, /* GL_TEXTURE1 */
- { 33721, 0x000084CA }, /* GL_TEXTURE10 */
- { 33734, 0x000084CA }, /* GL_TEXTURE10_ARB */
- { 33751, 0x000084CB }, /* GL_TEXTURE11 */
- { 33764, 0x000084CB }, /* GL_TEXTURE11_ARB */
- { 33781, 0x000084CC }, /* GL_TEXTURE12 */
- { 33794, 0x000084CC }, /* GL_TEXTURE12_ARB */
- { 33811, 0x000084CD }, /* GL_TEXTURE13 */
- { 33824, 0x000084CD }, /* GL_TEXTURE13_ARB */
- { 33841, 0x000084CE }, /* GL_TEXTURE14 */
- { 33854, 0x000084CE }, /* GL_TEXTURE14_ARB */
- { 33871, 0x000084CF }, /* GL_TEXTURE15 */
- { 33884, 0x000084CF }, /* GL_TEXTURE15_ARB */
- { 33901, 0x000084D0 }, /* GL_TEXTURE16 */
- { 33914, 0x000084D0 }, /* GL_TEXTURE16_ARB */
- { 33931, 0x000084D1 }, /* GL_TEXTURE17 */
- { 33944, 0x000084D1 }, /* GL_TEXTURE17_ARB */
- { 33961, 0x000084D2 }, /* GL_TEXTURE18 */
- { 33974, 0x000084D2 }, /* GL_TEXTURE18_ARB */
- { 33991, 0x000084D3 }, /* GL_TEXTURE19 */
- { 34004, 0x000084D3 }, /* GL_TEXTURE19_ARB */
- { 34021, 0x000084C1 }, /* GL_TEXTURE1_ARB */
- { 34037, 0x000084C2 }, /* GL_TEXTURE2 */
- { 34049, 0x000084D4 }, /* GL_TEXTURE20 */
- { 34062, 0x000084D4 }, /* GL_TEXTURE20_ARB */
- { 34079, 0x000084D5 }, /* GL_TEXTURE21 */
- { 34092, 0x000084D5 }, /* GL_TEXTURE21_ARB */
- { 34109, 0x000084D6 }, /* GL_TEXTURE22 */
- { 34122, 0x000084D6 }, /* GL_TEXTURE22_ARB */
- { 34139, 0x000084D7 }, /* GL_TEXTURE23 */
- { 34152, 0x000084D7 }, /* GL_TEXTURE23_ARB */
- { 34169, 0x000084D8 }, /* GL_TEXTURE24 */
- { 34182, 0x000084D8 }, /* GL_TEXTURE24_ARB */
- { 34199, 0x000084D9 }, /* GL_TEXTURE25 */
- { 34212, 0x000084D9 }, /* GL_TEXTURE25_ARB */
- { 34229, 0x000084DA }, /* GL_TEXTURE26 */
- { 34242, 0x000084DA }, /* GL_TEXTURE26_ARB */
- { 34259, 0x000084DB }, /* GL_TEXTURE27 */
- { 34272, 0x000084DB }, /* GL_TEXTURE27_ARB */
- { 34289, 0x000084DC }, /* GL_TEXTURE28 */
- { 34302, 0x000084DC }, /* GL_TEXTURE28_ARB */
- { 34319, 0x000084DD }, /* GL_TEXTURE29 */
- { 34332, 0x000084DD }, /* GL_TEXTURE29_ARB */
- { 34349, 0x000084C2 }, /* GL_TEXTURE2_ARB */
- { 34365, 0x000084C3 }, /* GL_TEXTURE3 */
- { 34377, 0x000084DE }, /* GL_TEXTURE30 */
- { 34390, 0x000084DE }, /* GL_TEXTURE30_ARB */
- { 34407, 0x000084DF }, /* GL_TEXTURE31 */
- { 34420, 0x000084DF }, /* GL_TEXTURE31_ARB */
- { 34437, 0x000084C3 }, /* GL_TEXTURE3_ARB */
- { 34453, 0x000084C4 }, /* GL_TEXTURE4 */
- { 34465, 0x000084C4 }, /* GL_TEXTURE4_ARB */
- { 34481, 0x000084C5 }, /* GL_TEXTURE5 */
- { 34493, 0x000084C5 }, /* GL_TEXTURE5_ARB */
- { 34509, 0x000084C6 }, /* GL_TEXTURE6 */
- { 34521, 0x000084C6 }, /* GL_TEXTURE6_ARB */
- { 34537, 0x000084C7 }, /* GL_TEXTURE7 */
- { 34549, 0x000084C7 }, /* GL_TEXTURE7_ARB */
- { 34565, 0x000084C8 }, /* GL_TEXTURE8 */
- { 34577, 0x000084C8 }, /* GL_TEXTURE8_ARB */
- { 34593, 0x000084C9 }, /* GL_TEXTURE9 */
- { 34605, 0x000084C9 }, /* GL_TEXTURE9_ARB */
- { 34621, 0x00000DE0 }, /* GL_TEXTURE_1D */
- { 34635, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY_EXT */
- { 34659, 0x00000DE1 }, /* GL_TEXTURE_2D */
- { 34673, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY_EXT */
- { 34697, 0x0000806F }, /* GL_TEXTURE_3D */
- { 34711, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE */
- { 34733, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE_EXT */
- { 34759, 0x0000813C }, /* GL_TEXTURE_BASE_LEVEL */
- { 34781, 0x00008068 }, /* GL_TEXTURE_BINDING_1D */
- { 34803, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */
- { 34835, 0x00008069 }, /* GL_TEXTURE_BINDING_2D */
- { 34857, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */
- { 34889, 0x0000806A }, /* GL_TEXTURE_BINDING_3D */
- { 34911, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP */
- { 34939, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_ARB */
- { 34971, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */
- { 35004, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_NV */
- { 35036, 0x00040000 }, /* GL_TEXTURE_BIT */
- { 35051, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE */
- { 35072, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE_EXT */
- { 35097, 0x00001005 }, /* GL_TEXTURE_BORDER */
- { 35115, 0x00001004 }, /* GL_TEXTURE_BORDER_COLOR */
- { 35139, 0x00008171 }, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */
- { 35170, 0x00008176 }, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */
- { 35200, 0x00008172 }, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */
- { 35230, 0x00008175 }, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */
- { 35265, 0x00008173 }, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */
- { 35296, 0x00008174 }, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */
- { 35334, 0x000080BC }, /* GL_TEXTURE_COLOR_TABLE_SGI */
- { 35361, 0x000081EF }, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */
- { 35393, 0x000080BF }, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
- { 35427, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC */
- { 35451, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC_ARB */
- { 35479, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE */
- { 35503, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE_ARB */
- { 35531, 0x0000819B }, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */
- { 35564, 0x0000819A }, /* GL_TEXTURE_COMPARE_SGIX */
- { 35588, 0x00001003 }, /* GL_TEXTURE_COMPONENTS */
- { 35610, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED */
- { 35632, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED_ARB */
- { 35658, 0x000086A3 }, /* GL_TEXTURE_COMPRESSED_FORMATS_ARB */
- { 35692, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */
- { 35725, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB */
- { 35762, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT */
- { 35790, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT_ARB */
- { 35822, 0x00008078 }, /* GL_TEXTURE_COORD_ARRAY */
- { 35845, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */
- { 35883, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB */
- { 35925, 0x00008092 }, /* GL_TEXTURE_COORD_ARRAY_POINTER */
- { 35956, 0x00008088 }, /* GL_TEXTURE_COORD_ARRAY_SIZE */
- { 35984, 0x0000808A }, /* GL_TEXTURE_COORD_ARRAY_STRIDE */
- { 36014, 0x00008089 }, /* GL_TEXTURE_COORD_ARRAY_TYPE */
- { 36042, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP */
- { 36062, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_ARB */
- { 36086, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */
- { 36117, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB */
- { 36152, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */
- { 36183, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB */
- { 36218, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */
- { 36249, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB */
- { 36284, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */
- { 36315, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB */
- { 36350, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */
- { 36381, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB */
- { 36416, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */
- { 36447, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */
- { 36482, 0x000088F4 }, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */
- { 36511, 0x00008071 }, /* GL_TEXTURE_DEPTH */
- { 36528, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */
- { 36550, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */
- { 36576, 0x00002300 }, /* GL_TEXTURE_ENV */
- { 36591, 0x00002201 }, /* GL_TEXTURE_ENV_COLOR */
- { 36612, 0x00002200 }, /* GL_TEXTURE_ENV_MODE */
- { 36632, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL */
- { 36658, 0x00002500 }, /* GL_TEXTURE_GEN_MODE */
- { 36678, 0x00000C63 }, /* GL_TEXTURE_GEN_Q */
- { 36695, 0x00000C62 }, /* GL_TEXTURE_GEN_R */
- { 36712, 0x00000C60 }, /* GL_TEXTURE_GEN_S */
- { 36729, 0x00000C61 }, /* GL_TEXTURE_GEN_T */
- { 36746, 0x0000819D }, /* GL_TEXTURE_GEQUAL_R_SGIX */
- { 36771, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE */
- { 36793, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE_EXT */
- { 36819, 0x00001001 }, /* GL_TEXTURE_HEIGHT */
- { 36837, 0x000080ED }, /* GL_TEXTURE_INDEX_SIZE_EXT */
- { 36863, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE */
- { 36889, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE_EXT */
- { 36919, 0x00001003 }, /* GL_TEXTURE_INTERNAL_FORMAT */
- { 36946, 0x0000819C }, /* GL_TEXTURE_LEQUAL_R_SGIX */
- { 36971, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS */
- { 36991, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS_EXT */
- { 37015, 0x00008190 }, /* GL_TEXTURE_LOD_BIAS_R_SGIX */
- { 37042, 0x0000818E }, /* GL_TEXTURE_LOD_BIAS_S_SGIX */
- { 37069, 0x0000818F }, /* GL_TEXTURE_LOD_BIAS_T_SGIX */
- { 37096, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE */
- { 37122, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE_EXT */
- { 37152, 0x00002800 }, /* GL_TEXTURE_MAG_FILTER */
- { 37174, 0x00000BA8 }, /* GL_TEXTURE_MATRIX */
- { 37192, 0x000084FE }, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */
- { 37222, 0x0000836B }, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */
- { 37250, 0x00008369 }, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */
- { 37278, 0x0000836A }, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */
- { 37306, 0x0000813D }, /* GL_TEXTURE_MAX_LEVEL */
- { 37327, 0x0000813B }, /* GL_TEXTURE_MAX_LOD */
- { 37346, 0x00002801 }, /* GL_TEXTURE_MIN_FILTER */
- { 37368, 0x0000813A }, /* GL_TEXTURE_MIN_LOD */
- { 37387, 0x00008066 }, /* GL_TEXTURE_PRIORITY */
- { 37407, 0x000085B7 }, /* GL_TEXTURE_RANGE_LENGTH_APPLE */
- { 37437, 0x000085B8 }, /* GL_TEXTURE_RANGE_POINTER_APPLE */
- { 37468, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_ARB */
- { 37493, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_NV */
- { 37517, 0x0000805C }, /* GL_TEXTURE_RED_SIZE */
- { 37537, 0x0000805C }, /* GL_TEXTURE_RED_SIZE_EXT */
- { 37561, 0x00008067 }, /* GL_TEXTURE_RESIDENT */
- { 37581, 0x00000BA5 }, /* GL_TEXTURE_STACK_DEPTH */
- { 37604, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE */
- { 37628, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE_EXT */
- { 37656, 0x000085BC }, /* GL_TEXTURE_STORAGE_HINT_APPLE */
- { 37686, 0x00008065 }, /* GL_TEXTURE_TOO_LARGE_EXT */
- { 37711, 0x0000888F }, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */
- { 37745, 0x00001000 }, /* GL_TEXTURE_WIDTH */
- { 37762, 0x00008072 }, /* GL_TEXTURE_WRAP_R */
- { 37780, 0x00002802 }, /* GL_TEXTURE_WRAP_S */
- { 37798, 0x00002803 }, /* GL_TEXTURE_WRAP_T */
- { 37816, 0x0000911B }, /* GL_TIMEOUT_EXPIRED */
- { 37835, 0x000088BF }, /* GL_TIME_ELAPSED_EXT */
- { 37855, 0x00008648 }, /* GL_TRACK_MATRIX_NV */
- { 37874, 0x00008649 }, /* GL_TRACK_MATRIX_TRANSFORM_NV */
- { 37903, 0x00001000 }, /* GL_TRANSFORM_BIT */
- { 37920, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX */
- { 37946, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX_ARB */
- { 37976, 0x000088B7 }, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */
- { 38008, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX */
- { 38038, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX_ARB */
- { 38072, 0x0000862C }, /* GL_TRANSPOSE_NV */
- { 38088, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX */
- { 38119, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX_ARB */
- { 38154, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX */
- { 38182, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX_ARB */
- { 38214, 0x00000004 }, /* GL_TRIANGLES */
- { 38227, 0x00000006 }, /* GL_TRIANGLE_FAN */
- { 38243, 0x00008615 }, /* GL_TRIANGLE_MESH_SUN */
- { 38264, 0x00000005 }, /* GL_TRIANGLE_STRIP */
- { 38282, 0x00000001 }, /* GL_TRUE */
- { 38290, 0x00000CF5 }, /* GL_UNPACK_ALIGNMENT */
- { 38310, 0x0000806E }, /* GL_UNPACK_IMAGE_HEIGHT */
- { 38333, 0x00000CF1 }, /* GL_UNPACK_LSB_FIRST */
- { 38353, 0x00000CF2 }, /* GL_UNPACK_ROW_LENGTH */
- { 38374, 0x0000806D }, /* GL_UNPACK_SKIP_IMAGES */
- { 38396, 0x00000CF4 }, /* GL_UNPACK_SKIP_PIXELS */
- { 38418, 0x00000CF3 }, /* GL_UNPACK_SKIP_ROWS */
- { 38438, 0x00000CF0 }, /* GL_UNPACK_SWAP_BYTES */
- { 38459, 0x00009118 }, /* GL_UNSIGNALED */
- { 38473, 0x00001401 }, /* GL_UNSIGNED_BYTE */
- { 38490, 0x00008362 }, /* GL_UNSIGNED_BYTE_2_3_3_REV */
- { 38517, 0x00008032 }, /* GL_UNSIGNED_BYTE_3_3_2 */
- { 38540, 0x00001405 }, /* GL_UNSIGNED_INT */
- { 38556, 0x00008036 }, /* GL_UNSIGNED_INT_10_10_10_2 */
- { 38583, 0x000084FA }, /* GL_UNSIGNED_INT_24_8 */
- { 38604, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_EXT */
- { 38629, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_NV */
- { 38653, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV */
- { 38684, 0x00008035 }, /* GL_UNSIGNED_INT_8_8_8_8 */
- { 38708, 0x00008367 }, /* GL_UNSIGNED_INT_8_8_8_8_REV */
- { 38736, 0x00008C17 }, /* GL_UNSIGNED_NORMALIZED */
- { 38759, 0x00001403 }, /* GL_UNSIGNED_SHORT */
- { 38777, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */
- { 38807, 0x00008033 }, /* GL_UNSIGNED_SHORT_4_4_4_4 */
- { 38833, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */
- { 38863, 0x00008034 }, /* GL_UNSIGNED_SHORT_5_5_5_1 */
- { 38889, 0x00008363 }, /* GL_UNSIGNED_SHORT_5_6_5 */
- { 38913, 0x00008364 }, /* GL_UNSIGNED_SHORT_5_6_5_REV */
- { 38941, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_APPLE */
- { 38969, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_MESA */
- { 38996, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */
- { 39028, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_MESA */
- { 39059, 0x00008CA2 }, /* GL_UPPER_LEFT */
- { 39073, 0x00002A20 }, /* GL_V2F */
- { 39080, 0x00002A21 }, /* GL_V3F */
- { 39087, 0x00008B83 }, /* GL_VALIDATE_STATUS */
- { 39106, 0x00001F00 }, /* GL_VENDOR */
- { 39116, 0x00001F02 }, /* GL_VERSION */
- { 39127, 0x00008074 }, /* GL_VERTEX_ARRAY */
- { 39143, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING */
- { 39167, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING_APPLE */
- { 39197, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING */
- { 39228, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING_ARB */
- { 39263, 0x0000808E }, /* GL_VERTEX_ARRAY_POINTER */
- { 39287, 0x0000807A }, /* GL_VERTEX_ARRAY_SIZE */
- { 39308, 0x0000807C }, /* GL_VERTEX_ARRAY_STRIDE */
- { 39331, 0x0000807B }, /* GL_VERTEX_ARRAY_TYPE */
- { 39352, 0x00008650 }, /* GL_VERTEX_ATTRIB_ARRAY0_NV */
- { 39379, 0x0000865A }, /* GL_VERTEX_ATTRIB_ARRAY10_NV */
- { 39407, 0x0000865B }, /* GL_VERTEX_ATTRIB_ARRAY11_NV */
- { 39435, 0x0000865C }, /* GL_VERTEX_ATTRIB_ARRAY12_NV */
- { 39463, 0x0000865D }, /* GL_VERTEX_ATTRIB_ARRAY13_NV */
- { 39491, 0x0000865E }, /* GL_VERTEX_ATTRIB_ARRAY14_NV */
- { 39519, 0x0000865F }, /* GL_VERTEX_ATTRIB_ARRAY15_NV */
- { 39547, 0x00008651 }, /* GL_VERTEX_ATTRIB_ARRAY1_NV */
- { 39574, 0x00008652 }, /* GL_VERTEX_ATTRIB_ARRAY2_NV */
- { 39601, 0x00008653 }, /* GL_VERTEX_ATTRIB_ARRAY3_NV */
- { 39628, 0x00008654 }, /* GL_VERTEX_ATTRIB_ARRAY4_NV */
- { 39655, 0x00008655 }, /* GL_VERTEX_ATTRIB_ARRAY5_NV */
- { 39682, 0x00008656 }, /* GL_VERTEX_ATTRIB_ARRAY6_NV */
- { 39709, 0x00008657 }, /* GL_VERTEX_ATTRIB_ARRAY7_NV */
- { 39736, 0x00008658 }, /* GL_VERTEX_ATTRIB_ARRAY8_NV */
- { 39763, 0x00008659 }, /* GL_VERTEX_ATTRIB_ARRAY9_NV */
- { 39790, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */
- { 39828, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB */
- { 39870, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */
- { 39901, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */
- { 39936, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */
- { 39970, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */
- { 40008, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */
- { 40039, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */
- { 40074, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */
- { 40102, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */
- { 40134, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */
- { 40164, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */
- { 40198, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */
- { 40226, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */
- { 40258, 0x000086A7 }, /* GL_VERTEX_BLEND_ARB */
- { 40278, 0x00008620 }, /* GL_VERTEX_PROGRAM_ARB */
- { 40300, 0x0000864A }, /* GL_VERTEX_PROGRAM_BINDING_NV */
- { 40329, 0x00008620 }, /* GL_VERTEX_PROGRAM_NV */
- { 40350, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE */
- { 40379, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */
- { 40412, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */
- { 40444, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE */
- { 40471, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */
- { 40502, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */
- { 40532, 0x00008B31 }, /* GL_VERTEX_SHADER */
- { 40549, 0x00008B31 }, /* GL_VERTEX_SHADER_ARB */
- { 40570, 0x00008621 }, /* GL_VERTEX_STATE_PROGRAM_NV */
- { 40597, 0x00000BA2 }, /* GL_VIEWPORT */
- { 40609, 0x00000800 }, /* GL_VIEWPORT_BIT */
- { 40625, 0x0000911D }, /* GL_WAIT_FAILED */
- { 40640, 0x000086AD }, /* GL_WEIGHT_ARRAY_ARB */
- { 40660, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */
- { 40691, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB */
- { 40726, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_ARB */
- { 40754, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_ARB */
- { 40779, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_ARB */
- { 40806, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_ARB */
- { 40831, 0x000086A6 }, /* GL_WEIGHT_SUM_UNITY_ARB */
- { 40855, 0x000081D4 }, /* GL_WRAP_BORDER_SUN */
- { 40874, 0x000088B9 }, /* GL_WRITE_ONLY */
- { 40888, 0x000088B9 }, /* GL_WRITE_ONLY_ARB */
- { 40906, 0x00001506 }, /* GL_XOR */
- { 40913, 0x000085B9 }, /* GL_YCBCR_422_APPLE */
- { 40932, 0x00008757 }, /* GL_YCBCR_MESA */
- { 40946, 0x00000000 }, /* GL_ZERO */
- { 40954, 0x00000D16 }, /* GL_ZOOM_X */
- { 40964, 0x00000D17 }, /* GL_ZOOM_Y */
+ { 12812, 0x0000140B }, /* GL_HALF_FLOAT */
+ { 12826, 0x00008000 }, /* GL_HINT_BIT */
+ { 12838, 0x00008024 }, /* GL_HISTOGRAM */
+ { 12851, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE */
+ { 12875, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE_EXT */
+ { 12903, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE */
+ { 12926, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE_EXT */
+ { 12953, 0x00008024 }, /* GL_HISTOGRAM_EXT */
+ { 12970, 0x00008027 }, /* GL_HISTOGRAM_FORMAT */
+ { 12990, 0x00008027 }, /* GL_HISTOGRAM_FORMAT_EXT */
+ { 13014, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE */
+ { 13038, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE_EXT */
+ { 13066, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE */
+ { 13094, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE_EXT */
+ { 13126, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE */
+ { 13148, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE_EXT */
+ { 13174, 0x0000802D }, /* GL_HISTOGRAM_SINK */
+ { 13192, 0x0000802D }, /* GL_HISTOGRAM_SINK_EXT */
+ { 13214, 0x00008026 }, /* GL_HISTOGRAM_WIDTH */
+ { 13233, 0x00008026 }, /* GL_HISTOGRAM_WIDTH_EXT */
+ { 13256, 0x0000862A }, /* GL_IDENTITY_NV */
+ { 13271, 0x00008150 }, /* GL_IGNORE_BORDER_HP */
+ { 13291, 0x00008B9B }, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */
+ { 13331, 0x00008B9A }, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */
+ { 13369, 0x00001E02 }, /* GL_INCR */
+ { 13377, 0x00008507 }, /* GL_INCR_WRAP */
+ { 13390, 0x00008507 }, /* GL_INCR_WRAP_EXT */
+ { 13407, 0x00008222 }, /* GL_INDEX */
+ { 13416, 0x00008077 }, /* GL_INDEX_ARRAY */
+ { 13431, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING */
+ { 13461, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING_ARB */
+ { 13495, 0x00008091 }, /* GL_INDEX_ARRAY_POINTER */
+ { 13518, 0x00008086 }, /* GL_INDEX_ARRAY_STRIDE */
+ { 13540, 0x00008085 }, /* GL_INDEX_ARRAY_TYPE */
+ { 13560, 0x00000D51 }, /* GL_INDEX_BITS */
+ { 13574, 0x00000C20 }, /* GL_INDEX_CLEAR_VALUE */
+ { 13595, 0x00000BF1 }, /* GL_INDEX_LOGIC_OP */
+ { 13613, 0x00000C30 }, /* GL_INDEX_MODE */
+ { 13627, 0x00000D13 }, /* GL_INDEX_OFFSET */
+ { 13643, 0x00000D12 }, /* GL_INDEX_SHIFT */
+ { 13658, 0x00000C21 }, /* GL_INDEX_WRITEMASK */
+ { 13677, 0x00008B84 }, /* GL_INFO_LOG_LENGTH */
+ { 13696, 0x00001404 }, /* GL_INT */
+ { 13703, 0x00008049 }, /* GL_INTENSITY */
+ { 13716, 0x0000804C }, /* GL_INTENSITY12 */
+ { 13731, 0x0000804C }, /* GL_INTENSITY12_EXT */
+ { 13750, 0x0000804D }, /* GL_INTENSITY16 */
+ { 13765, 0x0000804D }, /* GL_INTENSITY16_EXT */
+ { 13784, 0x0000804A }, /* GL_INTENSITY4 */
+ { 13798, 0x0000804A }, /* GL_INTENSITY4_EXT */
+ { 13816, 0x0000804B }, /* GL_INTENSITY8 */
+ { 13830, 0x0000804B }, /* GL_INTENSITY8_EXT */
+ { 13848, 0x00008049 }, /* GL_INTENSITY_EXT */
+ { 13865, 0x00008575 }, /* GL_INTERPOLATE */
+ { 13880, 0x00008575 }, /* GL_INTERPOLATE_ARB */
+ { 13899, 0x00008575 }, /* GL_INTERPOLATE_EXT */
+ { 13918, 0x00008B53 }, /* GL_INT_VEC2 */
+ { 13930, 0x00008B53 }, /* GL_INT_VEC2_ARB */
+ { 13946, 0x00008B54 }, /* GL_INT_VEC3 */
+ { 13958, 0x00008B54 }, /* GL_INT_VEC3_ARB */
+ { 13974, 0x00008B55 }, /* GL_INT_VEC4 */
+ { 13986, 0x00008B55 }, /* GL_INT_VEC4_ARB */
+ { 14002, 0x00000500 }, /* GL_INVALID_ENUM */
+ { 14018, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION */
+ { 14051, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_EXT */
+ { 14088, 0x00000502 }, /* GL_INVALID_OPERATION */
+ { 14109, 0x00000501 }, /* GL_INVALID_VALUE */
+ { 14126, 0x0000862B }, /* GL_INVERSE_NV */
+ { 14140, 0x0000862D }, /* GL_INVERSE_TRANSPOSE_NV */
+ { 14164, 0x0000150A }, /* GL_INVERT */
+ { 14174, 0x00001E00 }, /* GL_KEEP */
+ { 14182, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION */
+ { 14208, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION_EXT */
+ { 14238, 0x00000406 }, /* GL_LEFT */
+ { 14246, 0x00000203 }, /* GL_LEQUAL */
+ { 14256, 0x00000201 }, /* GL_LESS */
+ { 14264, 0x00004000 }, /* GL_LIGHT0 */
+ { 14274, 0x00004001 }, /* GL_LIGHT1 */
+ { 14284, 0x00004002 }, /* GL_LIGHT2 */
+ { 14294, 0x00004003 }, /* GL_LIGHT3 */
+ { 14304, 0x00004004 }, /* GL_LIGHT4 */
+ { 14314, 0x00004005 }, /* GL_LIGHT5 */
+ { 14324, 0x00004006 }, /* GL_LIGHT6 */
+ { 14334, 0x00004007 }, /* GL_LIGHT7 */
+ { 14344, 0x00000B50 }, /* GL_LIGHTING */
+ { 14356, 0x00000040 }, /* GL_LIGHTING_BIT */
+ { 14372, 0x00000B53 }, /* GL_LIGHT_MODEL_AMBIENT */
+ { 14395, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL */
+ { 14424, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL_EXT */
+ { 14457, 0x00000B51 }, /* GL_LIGHT_MODEL_LOCAL_VIEWER */
+ { 14485, 0x00000B52 }, /* GL_LIGHT_MODEL_TWO_SIDE */
+ { 14509, 0x00001B01 }, /* GL_LINE */
+ { 14517, 0x00002601 }, /* GL_LINEAR */
+ { 14527, 0x00001208 }, /* GL_LINEAR_ATTENUATION */
+ { 14549, 0x00008170 }, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */
+ { 14579, 0x0000844F }, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */
+ { 14610, 0x00002703 }, /* GL_LINEAR_MIPMAP_LINEAR */
+ { 14634, 0x00002701 }, /* GL_LINEAR_MIPMAP_NEAREST */
+ { 14659, 0x00000001 }, /* GL_LINES */
+ { 14668, 0x00000004 }, /* GL_LINE_BIT */
+ { 14680, 0x00000002 }, /* GL_LINE_LOOP */
+ { 14693, 0x00000707 }, /* GL_LINE_RESET_TOKEN */
+ { 14713, 0x00000B20 }, /* GL_LINE_SMOOTH */
+ { 14728, 0x00000C52 }, /* GL_LINE_SMOOTH_HINT */
+ { 14748, 0x00000B24 }, /* GL_LINE_STIPPLE */
+ { 14764, 0x00000B25 }, /* GL_LINE_STIPPLE_PATTERN */
+ { 14788, 0x00000B26 }, /* GL_LINE_STIPPLE_REPEAT */
+ { 14811, 0x00000003 }, /* GL_LINE_STRIP */
+ { 14825, 0x00000702 }, /* GL_LINE_TOKEN */
+ { 14839, 0x00000B21 }, /* GL_LINE_WIDTH */
+ { 14853, 0x00000B23 }, /* GL_LINE_WIDTH_GRANULARITY */
+ { 14879, 0x00000B22 }, /* GL_LINE_WIDTH_RANGE */
+ { 14899, 0x00008B82 }, /* GL_LINK_STATUS */
+ { 14914, 0x00000B32 }, /* GL_LIST_BASE */
+ { 14927, 0x00020000 }, /* GL_LIST_BIT */
+ { 14939, 0x00000B33 }, /* GL_LIST_INDEX */
+ { 14953, 0x00000B30 }, /* GL_LIST_MODE */
+ { 14966, 0x00000101 }, /* GL_LOAD */
+ { 14974, 0x00000BF1 }, /* GL_LOGIC_OP */
+ { 14986, 0x00000BF0 }, /* GL_LOGIC_OP_MODE */
+ { 15003, 0x00008CA1 }, /* GL_LOWER_LEFT */
+ { 15017, 0x00001909 }, /* GL_LUMINANCE */
+ { 15030, 0x00008041 }, /* GL_LUMINANCE12 */
+ { 15045, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12 */
+ { 15068, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12_EXT */
+ { 15095, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4 */
+ { 15117, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4_EXT */
+ { 15143, 0x00008041 }, /* GL_LUMINANCE12_EXT */
+ { 15162, 0x00008042 }, /* GL_LUMINANCE16 */
+ { 15177, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16 */
+ { 15200, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16_EXT */
+ { 15227, 0x00008042 }, /* GL_LUMINANCE16_EXT */
+ { 15246, 0x0000803F }, /* GL_LUMINANCE4 */
+ { 15260, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4 */
+ { 15281, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4_EXT */
+ { 15306, 0x0000803F }, /* GL_LUMINANCE4_EXT */
+ { 15324, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2 */
+ { 15345, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2_EXT */
+ { 15370, 0x00008040 }, /* GL_LUMINANCE8 */
+ { 15384, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8 */
+ { 15405, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8_EXT */
+ { 15430, 0x00008040 }, /* GL_LUMINANCE8_EXT */
+ { 15448, 0x0000190A }, /* GL_LUMINANCE_ALPHA */
+ { 15467, 0x00000D90 }, /* GL_MAP1_COLOR_4 */
+ { 15483, 0x00000DD0 }, /* GL_MAP1_GRID_DOMAIN */
+ { 15503, 0x00000DD1 }, /* GL_MAP1_GRID_SEGMENTS */
+ { 15525, 0x00000D91 }, /* GL_MAP1_INDEX */
+ { 15539, 0x00000D92 }, /* GL_MAP1_NORMAL */
+ { 15554, 0x00000D93 }, /* GL_MAP1_TEXTURE_COORD_1 */
+ { 15578, 0x00000D94 }, /* GL_MAP1_TEXTURE_COORD_2 */
+ { 15602, 0x00000D95 }, /* GL_MAP1_TEXTURE_COORD_3 */
+ { 15626, 0x00000D96 }, /* GL_MAP1_TEXTURE_COORD_4 */
+ { 15650, 0x00000D97 }, /* GL_MAP1_VERTEX_3 */
+ { 15667, 0x00000D98 }, /* GL_MAP1_VERTEX_4 */
+ { 15684, 0x00008660 }, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */
+ { 15712, 0x0000866A }, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */
+ { 15741, 0x0000866B }, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */
+ { 15770, 0x0000866C }, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */
+ { 15799, 0x0000866D }, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */
+ { 15828, 0x0000866E }, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */
+ { 15857, 0x0000866F }, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */
+ { 15886, 0x00008661 }, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */
+ { 15914, 0x00008662 }, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */
+ { 15942, 0x00008663 }, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */
+ { 15970, 0x00008664 }, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */
+ { 15998, 0x00008665 }, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */
+ { 16026, 0x00008666 }, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */
+ { 16054, 0x00008667 }, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */
+ { 16082, 0x00008668 }, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */
+ { 16110, 0x00008669 }, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */
+ { 16138, 0x00000DB0 }, /* GL_MAP2_COLOR_4 */
+ { 16154, 0x00000DD2 }, /* GL_MAP2_GRID_DOMAIN */
+ { 16174, 0x00000DD3 }, /* GL_MAP2_GRID_SEGMENTS */
+ { 16196, 0x00000DB1 }, /* GL_MAP2_INDEX */
+ { 16210, 0x00000DB2 }, /* GL_MAP2_NORMAL */
+ { 16225, 0x00000DB3 }, /* GL_MAP2_TEXTURE_COORD_1 */
+ { 16249, 0x00000DB4 }, /* GL_MAP2_TEXTURE_COORD_2 */
+ { 16273, 0x00000DB5 }, /* GL_MAP2_TEXTURE_COORD_3 */
+ { 16297, 0x00000DB6 }, /* GL_MAP2_TEXTURE_COORD_4 */
+ { 16321, 0x00000DB7 }, /* GL_MAP2_VERTEX_3 */
+ { 16338, 0x00000DB8 }, /* GL_MAP2_VERTEX_4 */
+ { 16355, 0x00008670 }, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */
+ { 16383, 0x0000867A }, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */
+ { 16412, 0x0000867B }, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */
+ { 16441, 0x0000867C }, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */
+ { 16470, 0x0000867D }, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */
+ { 16499, 0x0000867E }, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */
+ { 16528, 0x0000867F }, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */
+ { 16557, 0x00008671 }, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */
+ { 16585, 0x00008672 }, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */
+ { 16613, 0x00008673 }, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */
+ { 16641, 0x00008674 }, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */
+ { 16669, 0x00008675 }, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */
+ { 16697, 0x00008676 }, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */
+ { 16725, 0x00008677 }, /* GL_MAP2_VERTEX_ATTRIB7_4_NV */
+ { 16753, 0x00008678 }, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */
+ { 16781, 0x00008679 }, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */
+ { 16809, 0x00000D10 }, /* GL_MAP_COLOR */
+ { 16822, 0x00000010 }, /* GL_MAP_FLUSH_EXPLICIT_BIT */
+ { 16848, 0x00000008 }, /* GL_MAP_INVALIDATE_BUFFER_BIT */
+ { 16877, 0x00000004 }, /* GL_MAP_INVALIDATE_RANGE_BIT */
+ { 16905, 0x00000001 }, /* GL_MAP_READ_BIT */
+ { 16921, 0x00000D11 }, /* GL_MAP_STENCIL */
+ { 16936, 0x00000020 }, /* GL_MAP_UNSYNCHRONIZED_BIT */
+ { 16962, 0x00000002 }, /* GL_MAP_WRITE_BIT */
+ { 16979, 0x000088C0 }, /* GL_MATRIX0_ARB */
+ { 16994, 0x00008630 }, /* GL_MATRIX0_NV */
+ { 17008, 0x000088CA }, /* GL_MATRIX10_ARB */
+ { 17024, 0x000088CB }, /* GL_MATRIX11_ARB */
+ { 17040, 0x000088CC }, /* GL_MATRIX12_ARB */
+ { 17056, 0x000088CD }, /* GL_MATRIX13_ARB */
+ { 17072, 0x000088CE }, /* GL_MATRIX14_ARB */
+ { 17088, 0x000088CF }, /* GL_MATRIX15_ARB */
+ { 17104, 0x000088D0 }, /* GL_MATRIX16_ARB */
+ { 17120, 0x000088D1 }, /* GL_MATRIX17_ARB */
+ { 17136, 0x000088D2 }, /* GL_MATRIX18_ARB */
+ { 17152, 0x000088D3 }, /* GL_MATRIX19_ARB */
+ { 17168, 0x000088C1 }, /* GL_MATRIX1_ARB */
+ { 17183, 0x00008631 }, /* GL_MATRIX1_NV */
+ { 17197, 0x000088D4 }, /* GL_MATRIX20_ARB */
+ { 17213, 0x000088D5 }, /* GL_MATRIX21_ARB */
+ { 17229, 0x000088D6 }, /* GL_MATRIX22_ARB */
+ { 17245, 0x000088D7 }, /* GL_MATRIX23_ARB */
+ { 17261, 0x000088D8 }, /* GL_MATRIX24_ARB */
+ { 17277, 0x000088D9 }, /* GL_MATRIX25_ARB */
+ { 17293, 0x000088DA }, /* GL_MATRIX26_ARB */
+ { 17309, 0x000088DB }, /* GL_MATRIX27_ARB */
+ { 17325, 0x000088DC }, /* GL_MATRIX28_ARB */
+ { 17341, 0x000088DD }, /* GL_MATRIX29_ARB */
+ { 17357, 0x000088C2 }, /* GL_MATRIX2_ARB */
+ { 17372, 0x00008632 }, /* GL_MATRIX2_NV */
+ { 17386, 0x000088DE }, /* GL_MATRIX30_ARB */
+ { 17402, 0x000088DF }, /* GL_MATRIX31_ARB */
+ { 17418, 0x000088C3 }, /* GL_MATRIX3_ARB */
+ { 17433, 0x00008633 }, /* GL_MATRIX3_NV */
+ { 17447, 0x000088C4 }, /* GL_MATRIX4_ARB */
+ { 17462, 0x00008634 }, /* GL_MATRIX4_NV */
+ { 17476, 0x000088C5 }, /* GL_MATRIX5_ARB */
+ { 17491, 0x00008635 }, /* GL_MATRIX5_NV */
+ { 17505, 0x000088C6 }, /* GL_MATRIX6_ARB */
+ { 17520, 0x00008636 }, /* GL_MATRIX6_NV */
+ { 17534, 0x000088C7 }, /* GL_MATRIX7_ARB */
+ { 17549, 0x00008637 }, /* GL_MATRIX7_NV */
+ { 17563, 0x000088C8 }, /* GL_MATRIX8_ARB */
+ { 17578, 0x000088C9 }, /* GL_MATRIX9_ARB */
+ { 17593, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_ARB */
+ { 17619, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */
+ { 17653, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */
+ { 17684, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */
+ { 17717, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */
+ { 17748, 0x00000BA0 }, /* GL_MATRIX_MODE */
+ { 17763, 0x00008840 }, /* GL_MATRIX_PALETTE_ARB */
+ { 17785, 0x00008008 }, /* GL_MAX */
+ { 17792, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE */
+ { 17815, 0x000088FF }, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */
+ { 17847, 0x00000D35 }, /* GL_MAX_ATTRIB_STACK_DEPTH */
+ { 17873, 0x00000D3B }, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */
+ { 17906, 0x00008177 }, /* GL_MAX_CLIPMAP_DEPTH_SGIX */
+ { 17932, 0x00008178 }, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */
+ { 17966, 0x00000D32 }, /* GL_MAX_CLIP_PLANES */
+ { 17985, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS */
+ { 18010, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS_EXT */
+ { 18039, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */
+ { 18071, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI */
+ { 18107, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */
+ { 18143, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB */
+ { 18183, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT */
+ { 18209, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT_EXT */
+ { 18239, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH */
+ { 18264, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH_EXT */
+ { 18293, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */
+ { 18322, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB */
+ { 18355, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS */
+ { 18375, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ARB */
+ { 18399, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ATI */
+ { 18423, 0x000080E9 }, /* GL_MAX_ELEMENTS_INDICES */
+ { 18447, 0x000080E8 }, /* GL_MAX_ELEMENTS_VERTICES */
+ { 18472, 0x00000D30 }, /* GL_MAX_EVAL_ORDER */
+ { 18490, 0x00008008 }, /* GL_MAX_EXT */
+ { 18501, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */
+ { 18536, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB */
+ { 18575, 0x00000D31 }, /* GL_MAX_LIGHTS */
+ { 18589, 0x00000B31 }, /* GL_MAX_LIST_NESTING */
+ { 18609, 0x00008841 }, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */
+ { 18647, 0x00000D36 }, /* GL_MAX_MODELVIEW_STACK_DEPTH */
+ { 18676, 0x00000D37 }, /* GL_MAX_NAME_STACK_DEPTH */
+ { 18700, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_ARB */
+ { 18728, 0x00000D34 }, /* GL_MAX_PIXEL_MAP_TABLE */
+ { 18751, 0x000088B1 }, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */
+ { 18788, 0x0000880B }, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */
+ { 18824, 0x000088AD }, /* GL_MAX_PROGRAM_ATTRIBS_ARB */
+ { 18851, 0x000088F5 }, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */
+ { 18880, 0x000088B5 }, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */
+ { 18914, 0x000088F4 }, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */
+ { 18950, 0x000088F6 }, /* GL_MAX_PROGRAM_IF_DEPTH_NV */
+ { 18977, 0x000088A1 }, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */
+ { 19009, 0x000088B4 }, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */
+ { 19045, 0x000088F8 }, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */
+ { 19074, 0x000088F7 }, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */
+ { 19103, 0x0000862F }, /* GL_MAX_PROGRAM_MATRICES_ARB */
+ { 19131, 0x0000862E }, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */
+ { 19169, 0x000088B3 }, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
+ { 19213, 0x0000880E }, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
+ { 19256, 0x000088AF }, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */
+ { 19290, 0x000088A3 }, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
+ { 19329, 0x000088AB }, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */
+ { 19366, 0x000088A7 }, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */
+ { 19404, 0x00008810 }, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
+ { 19447, 0x0000880F }, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
+ { 19490, 0x000088A9 }, /* GL_MAX_PROGRAM_PARAMETERS_ARB */
+ { 19520, 0x000088A5 }, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */
+ { 19551, 0x0000880D }, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */
+ { 19587, 0x0000880C }, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */
+ { 19623, 0x00000D38 }, /* GL_MAX_PROJECTION_STACK_DEPTH */
+ { 19653, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */
+ { 19687, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_NV */
+ { 19720, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE */
+ { 19745, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_EXT */
+ { 19774, 0x00008D57 }, /* GL_MAX_SAMPLES */
+ { 19789, 0x00008D57 }, /* GL_MAX_SAMPLES_EXT */
+ { 19808, 0x00009111 }, /* GL_MAX_SERVER_WAIT_TIMEOUT */
+ { 19835, 0x00008504 }, /* GL_MAX_SHININESS_NV */
+ { 19855, 0x00008505 }, /* GL_MAX_SPOT_EXPONENT_NV */
+ { 19879, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS */
+ { 19901, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS_ARB */
+ { 19927, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS */
+ { 19954, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS_ARB */
+ { 19985, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS */
+ { 20009, 0x000084FF }, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */
+ { 20043, 0x00000D33 }, /* GL_MAX_TEXTURE_SIZE */
+ { 20063, 0x00000D39 }, /* GL_MAX_TEXTURE_STACK_DEPTH */
+ { 20090, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS */
+ { 20111, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS_ARB */
+ { 20136, 0x0000862F }, /* GL_MAX_TRACK_MATRICES_NV */
+ { 20161, 0x0000862E }, /* GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV */
+ { 20196, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS */
+ { 20218, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS_ARB */
+ { 20244, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS */
+ { 20266, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS_ARB */
+ { 20292, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */
+ { 20326, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */
+ { 20364, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */
+ { 20397, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB */
+ { 20434, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_ARB */
+ { 20458, 0x00000D3A }, /* GL_MAX_VIEWPORT_DIMS */
+ { 20479, 0x00008007 }, /* GL_MIN */
+ { 20486, 0x0000802E }, /* GL_MINMAX */
+ { 20496, 0x0000802E }, /* GL_MINMAX_EXT */
+ { 20510, 0x0000802F }, /* GL_MINMAX_FORMAT */
+ { 20527, 0x0000802F }, /* GL_MINMAX_FORMAT_EXT */
+ { 20548, 0x00008030 }, /* GL_MINMAX_SINK */
+ { 20563, 0x00008030 }, /* GL_MINMAX_SINK_EXT */
+ { 20582, 0x00008007 }, /* GL_MIN_EXT */
+ { 20593, 0x00008370 }, /* GL_MIRRORED_REPEAT */
+ { 20612, 0x00008370 }, /* GL_MIRRORED_REPEAT_ARB */
+ { 20635, 0x00008370 }, /* GL_MIRRORED_REPEAT_IBM */
+ { 20658, 0x00008742 }, /* GL_MIRROR_CLAMP_ATI */
+ { 20678, 0x00008742 }, /* GL_MIRROR_CLAMP_EXT */
+ { 20698, 0x00008912 }, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */
+ { 20728, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_ATI */
+ { 20756, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */
+ { 20784, 0x00001700 }, /* GL_MODELVIEW */
+ { 20797, 0x00001700 }, /* GL_MODELVIEW0_ARB */
+ { 20815, 0x0000872A }, /* GL_MODELVIEW10_ARB */
+ { 20834, 0x0000872B }, /* GL_MODELVIEW11_ARB */
+ { 20853, 0x0000872C }, /* GL_MODELVIEW12_ARB */
+ { 20872, 0x0000872D }, /* GL_MODELVIEW13_ARB */
+ { 20891, 0x0000872E }, /* GL_MODELVIEW14_ARB */
+ { 20910, 0x0000872F }, /* GL_MODELVIEW15_ARB */
+ { 20929, 0x00008730 }, /* GL_MODELVIEW16_ARB */
+ { 20948, 0x00008731 }, /* GL_MODELVIEW17_ARB */
+ { 20967, 0x00008732 }, /* GL_MODELVIEW18_ARB */
+ { 20986, 0x00008733 }, /* GL_MODELVIEW19_ARB */
+ { 21005, 0x0000850A }, /* GL_MODELVIEW1_ARB */
+ { 21023, 0x00008734 }, /* GL_MODELVIEW20_ARB */
+ { 21042, 0x00008735 }, /* GL_MODELVIEW21_ARB */
+ { 21061, 0x00008736 }, /* GL_MODELVIEW22_ARB */
+ { 21080, 0x00008737 }, /* GL_MODELVIEW23_ARB */
+ { 21099, 0x00008738 }, /* GL_MODELVIEW24_ARB */
+ { 21118, 0x00008739 }, /* GL_MODELVIEW25_ARB */
+ { 21137, 0x0000873A }, /* GL_MODELVIEW26_ARB */
+ { 21156, 0x0000873B }, /* GL_MODELVIEW27_ARB */
+ { 21175, 0x0000873C }, /* GL_MODELVIEW28_ARB */
+ { 21194, 0x0000873D }, /* GL_MODELVIEW29_ARB */
+ { 21213, 0x00008722 }, /* GL_MODELVIEW2_ARB */
+ { 21231, 0x0000873E }, /* GL_MODELVIEW30_ARB */
+ { 21250, 0x0000873F }, /* GL_MODELVIEW31_ARB */
+ { 21269, 0x00008723 }, /* GL_MODELVIEW3_ARB */
+ { 21287, 0x00008724 }, /* GL_MODELVIEW4_ARB */
+ { 21305, 0x00008725 }, /* GL_MODELVIEW5_ARB */
+ { 21323, 0x00008726 }, /* GL_MODELVIEW6_ARB */
+ { 21341, 0x00008727 }, /* GL_MODELVIEW7_ARB */
+ { 21359, 0x00008728 }, /* GL_MODELVIEW8_ARB */
+ { 21377, 0x00008729 }, /* GL_MODELVIEW9_ARB */
+ { 21395, 0x00000BA6 }, /* GL_MODELVIEW_MATRIX */
+ { 21415, 0x00008629 }, /* GL_MODELVIEW_PROJECTION_NV */
+ { 21442, 0x00000BA3 }, /* GL_MODELVIEW_STACK_DEPTH */
+ { 21467, 0x00002100 }, /* GL_MODULATE */
+ { 21479, 0x00008744 }, /* GL_MODULATE_ADD_ATI */
+ { 21499, 0x00008745 }, /* GL_MODULATE_SIGNED_ADD_ATI */
+ { 21526, 0x00008746 }, /* GL_MODULATE_SUBTRACT_ATI */
+ { 21551, 0x00000103 }, /* GL_MULT */
+ { 21559, 0x0000809D }, /* GL_MULTISAMPLE */
+ { 21574, 0x000086B2 }, /* GL_MULTISAMPLE_3DFX */
+ { 21594, 0x0000809D }, /* GL_MULTISAMPLE_ARB */
+ { 21613, 0x20000000 }, /* GL_MULTISAMPLE_BIT */
+ { 21632, 0x20000000 }, /* GL_MULTISAMPLE_BIT_3DFX */
+ { 21656, 0x20000000 }, /* GL_MULTISAMPLE_BIT_ARB */
+ { 21679, 0x00008534 }, /* GL_MULTISAMPLE_FILTER_HINT_NV */
+ { 21709, 0x00002A25 }, /* GL_N3F_V3F */
+ { 21720, 0x00000D70 }, /* GL_NAME_STACK_DEPTH */
+ { 21740, 0x0000150E }, /* GL_NAND */
+ { 21748, 0x00002600 }, /* GL_NEAREST */
+ { 21759, 0x0000844E }, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */
+ { 21790, 0x0000844D }, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */
+ { 21822, 0x00002702 }, /* GL_NEAREST_MIPMAP_LINEAR */
+ { 21847, 0x00002700 }, /* GL_NEAREST_MIPMAP_NEAREST */
+ { 21873, 0x00000200 }, /* GL_NEVER */
+ { 21882, 0x00001102 }, /* GL_NICEST */
+ { 21892, 0x00000000 }, /* GL_NONE */
+ { 21900, 0x00001505 }, /* GL_NOOP */
+ { 21908, 0x00001508 }, /* GL_NOR */
+ { 21915, 0x00000BA1 }, /* GL_NORMALIZE */
+ { 21928, 0x00008075 }, /* GL_NORMAL_ARRAY */
+ { 21944, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING */
+ { 21975, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING_ARB */
+ { 22010, 0x0000808F }, /* GL_NORMAL_ARRAY_POINTER */
+ { 22034, 0x0000807F }, /* GL_NORMAL_ARRAY_STRIDE */
+ { 22057, 0x0000807E }, /* GL_NORMAL_ARRAY_TYPE */
+ { 22078, 0x00008511 }, /* GL_NORMAL_MAP */
+ { 22092, 0x00008511 }, /* GL_NORMAL_MAP_ARB */
+ { 22110, 0x00008511 }, /* GL_NORMAL_MAP_NV */
+ { 22127, 0x00000205 }, /* GL_NOTEQUAL */
+ { 22139, 0x00000000 }, /* GL_NO_ERROR */
+ { 22151, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */
+ { 22185, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB */
+ { 22223, 0x00008B89 }, /* GL_OBJECT_ACTIVE_ATTRIBUTES_ARB */
+ { 22255, 0x00008B8A }, /* GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB */
+ { 22297, 0x00008B86 }, /* GL_OBJECT_ACTIVE_UNIFORMS_ARB */
+ { 22327, 0x00008B87 }, /* GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB */
+ { 22367, 0x00008B85 }, /* GL_OBJECT_ATTACHED_OBJECTS_ARB */
+ { 22398, 0x00008B81 }, /* GL_OBJECT_COMPILE_STATUS_ARB */
+ { 22427, 0x00008B80 }, /* GL_OBJECT_DELETE_STATUS_ARB */
+ { 22455, 0x00008B84 }, /* GL_OBJECT_INFO_LOG_LENGTH_ARB */
+ { 22485, 0x00002401 }, /* GL_OBJECT_LINEAR */
+ { 22502, 0x00008B82 }, /* GL_OBJECT_LINK_STATUS_ARB */
+ { 22528, 0x00002501 }, /* GL_OBJECT_PLANE */
+ { 22544, 0x00008B88 }, /* GL_OBJECT_SHADER_SOURCE_LENGTH_ARB */
+ { 22579, 0x00008B4F }, /* GL_OBJECT_SUBTYPE_ARB */
+ { 22601, 0x00009112 }, /* GL_OBJECT_TYPE */
+ { 22616, 0x00008B4E }, /* GL_OBJECT_TYPE_ARB */
+ { 22635, 0x00008B83 }, /* GL_OBJECT_VALIDATE_STATUS_ARB */
+ { 22665, 0x00008165 }, /* GL_OCCLUSION_TEST_HP */
+ { 22686, 0x00008166 }, /* GL_OCCLUSION_TEST_RESULT_HP */
+ { 22714, 0x00000001 }, /* GL_ONE */
+ { 22721, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA */
+ { 22749, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA_EXT */
+ { 22781, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR */
+ { 22809, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR_EXT */
+ { 22841, 0x00000305 }, /* GL_ONE_MINUS_DST_ALPHA */
+ { 22864, 0x00000307 }, /* GL_ONE_MINUS_DST_COLOR */
+ { 22887, 0x00000303 }, /* GL_ONE_MINUS_SRC_ALPHA */
+ { 22910, 0x00000301 }, /* GL_ONE_MINUS_SRC_COLOR */
+ { 22933, 0x00008598 }, /* GL_OPERAND0_ALPHA */
+ { 22951, 0x00008598 }, /* GL_OPERAND0_ALPHA_ARB */
+ { 22973, 0x00008598 }, /* GL_OPERAND0_ALPHA_EXT */
+ { 22995, 0x00008590 }, /* GL_OPERAND0_RGB */
+ { 23011, 0x00008590 }, /* GL_OPERAND0_RGB_ARB */
+ { 23031, 0x00008590 }, /* GL_OPERAND0_RGB_EXT */
+ { 23051, 0x00008599 }, /* GL_OPERAND1_ALPHA */
+ { 23069, 0x00008599 }, /* GL_OPERAND1_ALPHA_ARB */
+ { 23091, 0x00008599 }, /* GL_OPERAND1_ALPHA_EXT */
+ { 23113, 0x00008591 }, /* GL_OPERAND1_RGB */
+ { 23129, 0x00008591 }, /* GL_OPERAND1_RGB_ARB */
+ { 23149, 0x00008591 }, /* GL_OPERAND1_RGB_EXT */
+ { 23169, 0x0000859A }, /* GL_OPERAND2_ALPHA */
+ { 23187, 0x0000859A }, /* GL_OPERAND2_ALPHA_ARB */
+ { 23209, 0x0000859A }, /* GL_OPERAND2_ALPHA_EXT */
+ { 23231, 0x00008592 }, /* GL_OPERAND2_RGB */
+ { 23247, 0x00008592 }, /* GL_OPERAND2_RGB_ARB */
+ { 23267, 0x00008592 }, /* GL_OPERAND2_RGB_EXT */
+ { 23287, 0x0000859B }, /* GL_OPERAND3_ALPHA_NV */
+ { 23308, 0x00008593 }, /* GL_OPERAND3_RGB_NV */
+ { 23327, 0x00001507 }, /* GL_OR */
+ { 23333, 0x00000A01 }, /* GL_ORDER */
+ { 23342, 0x0000150D }, /* GL_OR_INVERTED */
+ { 23357, 0x0000150B }, /* GL_OR_REVERSE */
+ { 23371, 0x00000505 }, /* GL_OUT_OF_MEMORY */
+ { 23388, 0x00000D05 }, /* GL_PACK_ALIGNMENT */
+ { 23406, 0x0000806C }, /* GL_PACK_IMAGE_HEIGHT */
+ { 23427, 0x00008758 }, /* GL_PACK_INVERT_MESA */
+ { 23447, 0x00000D01 }, /* GL_PACK_LSB_FIRST */
+ { 23465, 0x00000D02 }, /* GL_PACK_ROW_LENGTH */
+ { 23484, 0x0000806B }, /* GL_PACK_SKIP_IMAGES */
+ { 23504, 0x00000D04 }, /* GL_PACK_SKIP_PIXELS */
+ { 23524, 0x00000D03 }, /* GL_PACK_SKIP_ROWS */
+ { 23542, 0x00000D00 }, /* GL_PACK_SWAP_BYTES */
+ { 23561, 0x00008B92 }, /* GL_PALETTE4_R5_G6_B5_OES */
+ { 23586, 0x00008B94 }, /* GL_PALETTE4_RGB5_A1_OES */
+ { 23610, 0x00008B90 }, /* GL_PALETTE4_RGB8_OES */
+ { 23631, 0x00008B93 }, /* GL_PALETTE4_RGBA4_OES */
+ { 23653, 0x00008B91 }, /* GL_PALETTE4_RGBA8_OES */
+ { 23675, 0x00008B97 }, /* GL_PALETTE8_R5_G6_B5_OES */
+ { 23700, 0x00008B99 }, /* GL_PALETTE8_RGB5_A1_OES */
+ { 23724, 0x00008B95 }, /* GL_PALETTE8_RGB8_OES */
+ { 23745, 0x00008B98 }, /* GL_PALETTE8_RGBA4_OES */
+ { 23767, 0x00008B96 }, /* GL_PALETTE8_RGBA8_OES */
+ { 23789, 0x00000700 }, /* GL_PASS_THROUGH_TOKEN */
+ { 23811, 0x00000C50 }, /* GL_PERSPECTIVE_CORRECTION_HINT */
+ { 23842, 0x00000C79 }, /* GL_PIXEL_MAP_A_TO_A */
+ { 23862, 0x00000CB9 }, /* GL_PIXEL_MAP_A_TO_A_SIZE */
+ { 23887, 0x00000C78 }, /* GL_PIXEL_MAP_B_TO_B */
+ { 23907, 0x00000CB8 }, /* GL_PIXEL_MAP_B_TO_B_SIZE */
+ { 23932, 0x00000C77 }, /* GL_PIXEL_MAP_G_TO_G */
+ { 23952, 0x00000CB7 }, /* GL_PIXEL_MAP_G_TO_G_SIZE */
+ { 23977, 0x00000C75 }, /* GL_PIXEL_MAP_I_TO_A */
+ { 23997, 0x00000CB5 }, /* GL_PIXEL_MAP_I_TO_A_SIZE */
+ { 24022, 0x00000C74 }, /* GL_PIXEL_MAP_I_TO_B */
+ { 24042, 0x00000CB4 }, /* GL_PIXEL_MAP_I_TO_B_SIZE */
+ { 24067, 0x00000C73 }, /* GL_PIXEL_MAP_I_TO_G */
+ { 24087, 0x00000CB3 }, /* GL_PIXEL_MAP_I_TO_G_SIZE */
+ { 24112, 0x00000C70 }, /* GL_PIXEL_MAP_I_TO_I */
+ { 24132, 0x00000CB0 }, /* GL_PIXEL_MAP_I_TO_I_SIZE */
+ { 24157, 0x00000C72 }, /* GL_PIXEL_MAP_I_TO_R */
+ { 24177, 0x00000CB2 }, /* GL_PIXEL_MAP_I_TO_R_SIZE */
+ { 24202, 0x00000C76 }, /* GL_PIXEL_MAP_R_TO_R */
+ { 24222, 0x00000CB6 }, /* GL_PIXEL_MAP_R_TO_R_SIZE */
+ { 24247, 0x00000C71 }, /* GL_PIXEL_MAP_S_TO_S */
+ { 24267, 0x00000CB1 }, /* GL_PIXEL_MAP_S_TO_S_SIZE */
+ { 24292, 0x00000020 }, /* GL_PIXEL_MODE_BIT */
+ { 24310, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER */
+ { 24331, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING */
+ { 24360, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING_EXT */
+ { 24393, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER_EXT */
+ { 24418, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER */
+ { 24441, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING */
+ { 24472, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING_EXT */
+ { 24507, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER_EXT */
+ { 24534, 0x00001B00 }, /* GL_POINT */
+ { 24543, 0x00000000 }, /* GL_POINTS */
+ { 24553, 0x00000002 }, /* GL_POINT_BIT */
+ { 24566, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION */
+ { 24596, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_ARB */
+ { 24630, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_EXT */
+ { 24664, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_SGIS */
+ { 24699, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE */
+ { 24728, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_ARB */
+ { 24761, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_EXT */
+ { 24794, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_SGIS */
+ { 24828, 0x00000B11 }, /* GL_POINT_SIZE */
+ { 24842, 0x00000B13 }, /* GL_POINT_SIZE_GRANULARITY */
+ { 24868, 0x00008127 }, /* GL_POINT_SIZE_MAX */
+ { 24886, 0x00008127 }, /* GL_POINT_SIZE_MAX_ARB */
+ { 24908, 0x00008127 }, /* GL_POINT_SIZE_MAX_EXT */
+ { 24930, 0x00008127 }, /* GL_POINT_SIZE_MAX_SGIS */
+ { 24953, 0x00008126 }, /* GL_POINT_SIZE_MIN */
+ { 24971, 0x00008126 }, /* GL_POINT_SIZE_MIN_ARB */
+ { 24993, 0x00008126 }, /* GL_POINT_SIZE_MIN_EXT */
+ { 25015, 0x00008126 }, /* GL_POINT_SIZE_MIN_SGIS */
+ { 25038, 0x00000B12 }, /* GL_POINT_SIZE_RANGE */
+ { 25058, 0x00000B10 }, /* GL_POINT_SMOOTH */
+ { 25074, 0x00000C51 }, /* GL_POINT_SMOOTH_HINT */
+ { 25095, 0x00008861 }, /* GL_POINT_SPRITE */
+ { 25111, 0x00008861 }, /* GL_POINT_SPRITE_ARB */
+ { 25131, 0x00008CA0 }, /* GL_POINT_SPRITE_COORD_ORIGIN */
+ { 25160, 0x00008861 }, /* GL_POINT_SPRITE_NV */
+ { 25179, 0x00008863 }, /* GL_POINT_SPRITE_R_MODE_NV */
+ { 25205, 0x00000701 }, /* GL_POINT_TOKEN */
+ { 25220, 0x00000009 }, /* GL_POLYGON */
+ { 25231, 0x00000008 }, /* GL_POLYGON_BIT */
+ { 25246, 0x00000B40 }, /* GL_POLYGON_MODE */
+ { 25262, 0x00008039 }, /* GL_POLYGON_OFFSET_BIAS */
+ { 25285, 0x00008038 }, /* GL_POLYGON_OFFSET_FACTOR */
+ { 25310, 0x00008037 }, /* GL_POLYGON_OFFSET_FILL */
+ { 25333, 0x00002A02 }, /* GL_POLYGON_OFFSET_LINE */
+ { 25356, 0x00002A01 }, /* GL_POLYGON_OFFSET_POINT */
+ { 25380, 0x00002A00 }, /* GL_POLYGON_OFFSET_UNITS */
+ { 25404, 0x00000B41 }, /* GL_POLYGON_SMOOTH */
+ { 25422, 0x00000C53 }, /* GL_POLYGON_SMOOTH_HINT */
+ { 25445, 0x00000B42 }, /* GL_POLYGON_STIPPLE */
+ { 25464, 0x00000010 }, /* GL_POLYGON_STIPPLE_BIT */
+ { 25487, 0x00000703 }, /* GL_POLYGON_TOKEN */
+ { 25504, 0x00001203 }, /* GL_POSITION */
+ { 25516, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */
+ { 25548, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI */
+ { 25584, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */
+ { 25617, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI */
+ { 25654, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */
+ { 25685, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI */
+ { 25720, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */
+ { 25752, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI */
+ { 25788, 0x000080D2 }, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */
+ { 25821, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */
+ { 25853, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI */
+ { 25889, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */
+ { 25922, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI */
+ { 25959, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS */
+ { 25989, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS_SGI */
+ { 26023, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE */
+ { 26054, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE_SGI */
+ { 26089, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS */
+ { 26120, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS_EXT */
+ { 26155, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE */
+ { 26187, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE_EXT */
+ { 26223, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS */
+ { 26253, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS_EXT */
+ { 26287, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE */
+ { 26318, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE_EXT */
+ { 26353, 0x000080D1 }, /* GL_POST_CONVOLUTION_COLOR_TABLE */
+ { 26385, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS */
+ { 26416, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS_EXT */
+ { 26451, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE */
+ { 26483, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE_EXT */
+ { 26519, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS */
+ { 26548, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS_EXT */
+ { 26581, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE */
+ { 26611, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE_EXT */
+ { 26645, 0x0000817B }, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */
+ { 26684, 0x00008179 }, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */
+ { 26717, 0x0000817C }, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */
+ { 26757, 0x0000817A }, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */
+ { 26791, 0x00008578 }, /* GL_PREVIOUS */
+ { 26803, 0x00008578 }, /* GL_PREVIOUS_ARB */
+ { 26819, 0x00008578 }, /* GL_PREVIOUS_EXT */
+ { 26835, 0x00008577 }, /* GL_PRIMARY_COLOR */
+ { 26852, 0x00008577 }, /* GL_PRIMARY_COLOR_ARB */
+ { 26873, 0x00008577 }, /* GL_PRIMARY_COLOR_EXT */
+ { 26894, 0x000088B0 }, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */
+ { 26927, 0x00008805 }, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */
+ { 26959, 0x000088AC }, /* GL_PROGRAM_ATTRIBS_ARB */
+ { 26982, 0x00008677 }, /* GL_PROGRAM_BINDING_ARB */
+ { 27005, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_ARB */
+ { 27035, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_NV */
+ { 27064, 0x00008874 }, /* GL_PROGRAM_ERROR_STRING_ARB */
+ { 27092, 0x00008876 }, /* GL_PROGRAM_FORMAT_ARB */
+ { 27114, 0x00008875 }, /* GL_PROGRAM_FORMAT_ASCII_ARB */
+ { 27142, 0x000088A0 }, /* GL_PROGRAM_INSTRUCTIONS_ARB */
+ { 27170, 0x00008627 }, /* GL_PROGRAM_LENGTH_ARB */
+ { 27192, 0x00008627 }, /* GL_PROGRAM_LENGTH_NV */
+ { 27213, 0x000088B2 }, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
+ { 27253, 0x00008808 }, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
+ { 27292, 0x000088AE }, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */
+ { 27322, 0x000088A2 }, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
+ { 27357, 0x000088AA }, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */
+ { 27390, 0x000088A6 }, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */
+ { 27424, 0x0000880A }, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
+ { 27463, 0x00008809 }, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
+ { 27502, 0x00008B40 }, /* GL_PROGRAM_OBJECT_ARB */
+ { 27524, 0x000088A8 }, /* GL_PROGRAM_PARAMETERS_ARB */
+ { 27550, 0x00008644 }, /* GL_PROGRAM_PARAMETER_NV */
+ { 27574, 0x00008647 }, /* GL_PROGRAM_RESIDENT_NV */
+ { 27597, 0x00008628 }, /* GL_PROGRAM_STRING_ARB */
+ { 27619, 0x00008628 }, /* GL_PROGRAM_STRING_NV */
+ { 27640, 0x00008646 }, /* GL_PROGRAM_TARGET_NV */
+ { 27661, 0x000088A4 }, /* GL_PROGRAM_TEMPORARIES_ARB */
+ { 27688, 0x00008807 }, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */
+ { 27720, 0x00008806 }, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */
+ { 27752, 0x000088B6 }, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */
+ { 27787, 0x00001701 }, /* GL_PROJECTION */
+ { 27801, 0x00000BA7 }, /* GL_PROJECTION_MATRIX */
+ { 27822, 0x00000BA4 }, /* GL_PROJECTION_STACK_DEPTH */
+ { 27848, 0x00008E4F }, /* GL_PROVOKING_VERTEX */
+ { 27868, 0x00008E4F }, /* GL_PROVOKING_VERTEX_EXT */
+ { 27892, 0x000080D3 }, /* GL_PROXY_COLOR_TABLE */
+ { 27913, 0x00008025 }, /* GL_PROXY_HISTOGRAM */
+ { 27932, 0x00008025 }, /* GL_PROXY_HISTOGRAM_EXT */
+ { 27955, 0x000080D5 }, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */
+ { 27994, 0x000080D4 }, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */
+ { 28032, 0x00008063 }, /* GL_PROXY_TEXTURE_1D */
+ { 28052, 0x00008C19 }, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */
+ { 28082, 0x00008063 }, /* GL_PROXY_TEXTURE_1D_EXT */
+ { 28106, 0x00008064 }, /* GL_PROXY_TEXTURE_2D */
+ { 28126, 0x00008C1B }, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */
+ { 28156, 0x00008064 }, /* GL_PROXY_TEXTURE_2D_EXT */
+ { 28180, 0x00008070 }, /* GL_PROXY_TEXTURE_3D */
+ { 28200, 0x000080BD }, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */
+ { 28233, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP */
+ { 28259, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP_ARB */
+ { 28289, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */
+ { 28320, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_NV */
+ { 28350, 0x00002003 }, /* GL_Q */
+ { 28355, 0x00001209 }, /* GL_QUADRATIC_ATTENUATION */
+ { 28380, 0x00000007 }, /* GL_QUADS */
+ { 28389, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */
+ { 28433, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT */
+ { 28481, 0x00008614 }, /* GL_QUAD_MESH_SUN */
+ { 28498, 0x00000008 }, /* GL_QUAD_STRIP */
+ { 28512, 0x00008E16 }, /* GL_QUERY_BY_REGION_NO_WAIT_NV */
+ { 28542, 0x00008E15 }, /* GL_QUERY_BY_REGION_WAIT_NV */
+ { 28569, 0x00008864 }, /* GL_QUERY_COUNTER_BITS */
+ { 28591, 0x00008864 }, /* GL_QUERY_COUNTER_BITS_ARB */
+ { 28617, 0x00008E14 }, /* GL_QUERY_NO_WAIT_NV */
+ { 28637, 0x00008866 }, /* GL_QUERY_RESULT */
+ { 28653, 0x00008866 }, /* GL_QUERY_RESULT_ARB */
+ { 28673, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE */
+ { 28699, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE_ARB */
+ { 28729, 0x00008E13 }, /* GL_QUERY_WAIT_NV */
+ { 28746, 0x00002002 }, /* GL_R */
+ { 28751, 0x00002A10 }, /* GL_R3_G3_B2 */
+ { 28763, 0x00019262 }, /* GL_RASTER_POSITION_UNCLIPPED_IBM */
+ { 28796, 0x00000C02 }, /* GL_READ_BUFFER */
+ { 28811, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER */
+ { 28831, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING */
+ { 28859, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING_EXT */
+ { 28891, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER_EXT */
+ { 28915, 0x000088B8 }, /* GL_READ_ONLY */
+ { 28928, 0x000088B8 }, /* GL_READ_ONLY_ARB */
+ { 28945, 0x000088BA }, /* GL_READ_WRITE */
+ { 28959, 0x000088BA }, /* GL_READ_WRITE_ARB */
+ { 28977, 0x00001903 }, /* GL_RED */
+ { 28984, 0x00008016 }, /* GL_REDUCE */
+ { 28994, 0x00008016 }, /* GL_REDUCE_EXT */
+ { 29008, 0x00000D15 }, /* GL_RED_BIAS */
+ { 29020, 0x00000D52 }, /* GL_RED_BITS */
+ { 29032, 0x00000D14 }, /* GL_RED_SCALE */
+ { 29045, 0x00008512 }, /* GL_REFLECTION_MAP */
+ { 29063, 0x00008512 }, /* GL_REFLECTION_MAP_ARB */
+ { 29085, 0x00008512 }, /* GL_REFLECTION_MAP_NV */
+ { 29106, 0x00001C00 }, /* GL_RENDER */
+ { 29116, 0x00008D41 }, /* GL_RENDERBUFFER */
+ { 29132, 0x00008D53 }, /* GL_RENDERBUFFER_ALPHA_SIZE */
+ { 29159, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING */
+ { 29183, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_EXT */
+ { 29211, 0x00008D52 }, /* GL_RENDERBUFFER_BLUE_SIZE */
+ { 29237, 0x00008D54 }, /* GL_RENDERBUFFER_DEPTH_SIZE */
+ { 29264, 0x00008D41 }, /* GL_RENDERBUFFER_EXT */
+ { 29284, 0x00008D51 }, /* GL_RENDERBUFFER_GREEN_SIZE */
+ { 29311, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT */
+ { 29334, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_EXT */
+ { 29361, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT */
+ { 29393, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_EXT */
+ { 29429, 0x00008D50 }, /* GL_RENDERBUFFER_RED_SIZE */
+ { 29454, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES */
+ { 29478, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES_EXT */
+ { 29506, 0x00008D55 }, /* GL_RENDERBUFFER_STENCIL_SIZE */
+ { 29535, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH */
+ { 29557, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_EXT */
+ { 29583, 0x00001F01 }, /* GL_RENDERER */
+ { 29595, 0x00000C40 }, /* GL_RENDER_MODE */
+ { 29610, 0x00002901 }, /* GL_REPEAT */
+ { 29620, 0x00001E01 }, /* GL_REPLACE */
+ { 29631, 0x00008062 }, /* GL_REPLACE_EXT */
+ { 29646, 0x00008153 }, /* GL_REPLICATE_BORDER_HP */
+ { 29669, 0x0000803A }, /* GL_RESCALE_NORMAL */
+ { 29687, 0x0000803A }, /* GL_RESCALE_NORMAL_EXT */
+ { 29709, 0x00000102 }, /* GL_RETURN */
+ { 29719, 0x00001907 }, /* GL_RGB */
+ { 29726, 0x00008052 }, /* GL_RGB10 */
+ { 29735, 0x00008059 }, /* GL_RGB10_A2 */
+ { 29747, 0x00008059 }, /* GL_RGB10_A2_EXT */
+ { 29763, 0x00008052 }, /* GL_RGB10_EXT */
+ { 29776, 0x00008053 }, /* GL_RGB12 */
+ { 29785, 0x00008053 }, /* GL_RGB12_EXT */
+ { 29798, 0x00008054 }, /* GL_RGB16 */
+ { 29807, 0x00008054 }, /* GL_RGB16_EXT */
+ { 29820, 0x0000804E }, /* GL_RGB2_EXT */
+ { 29832, 0x0000804F }, /* GL_RGB4 */
+ { 29840, 0x0000804F }, /* GL_RGB4_EXT */
+ { 29852, 0x000083A1 }, /* GL_RGB4_S3TC */
+ { 29865, 0x00008050 }, /* GL_RGB5 */
+ { 29873, 0x00008057 }, /* GL_RGB5_A1 */
+ { 29884, 0x00008057 }, /* GL_RGB5_A1_EXT */
+ { 29899, 0x00008050 }, /* GL_RGB5_EXT */
+ { 29911, 0x00008051 }, /* GL_RGB8 */
+ { 29919, 0x00008051 }, /* GL_RGB8_EXT */
+ { 29931, 0x00001908 }, /* GL_RGBA */
+ { 29939, 0x0000805A }, /* GL_RGBA12 */
+ { 29949, 0x0000805A }, /* GL_RGBA12_EXT */
+ { 29963, 0x0000805B }, /* GL_RGBA16 */
+ { 29973, 0x0000805B }, /* GL_RGBA16_EXT */
+ { 29987, 0x00008055 }, /* GL_RGBA2 */
+ { 29996, 0x00008055 }, /* GL_RGBA2_EXT */
+ { 30009, 0x00008056 }, /* GL_RGBA4 */
+ { 30018, 0x000083A5 }, /* GL_RGBA4_DXT5_S3TC */
+ { 30037, 0x00008056 }, /* GL_RGBA4_EXT */
+ { 30050, 0x000083A3 }, /* GL_RGBA4_S3TC */
+ { 30064, 0x00008058 }, /* GL_RGBA8 */
+ { 30073, 0x00008058 }, /* GL_RGBA8_EXT */
+ { 30086, 0x00008F97 }, /* GL_RGBA8_SNORM */
+ { 30101, 0x000083A4 }, /* GL_RGBA_DXT5_S3TC */
+ { 30119, 0x00000C31 }, /* GL_RGBA_MODE */
+ { 30132, 0x000083A2 }, /* GL_RGBA_S3TC */
+ { 30145, 0x00008F93 }, /* GL_RGBA_SNORM */
+ { 30159, 0x000083A0 }, /* GL_RGB_S3TC */
+ { 30171, 0x00008573 }, /* GL_RGB_SCALE */
+ { 30184, 0x00008573 }, /* GL_RGB_SCALE_ARB */
+ { 30201, 0x00008573 }, /* GL_RGB_SCALE_EXT */
+ { 30218, 0x00000407 }, /* GL_RIGHT */
+ { 30227, 0x00002000 }, /* GL_S */
+ { 30232, 0x00008B5D }, /* GL_SAMPLER_1D */
+ { 30246, 0x00008B61 }, /* GL_SAMPLER_1D_SHADOW */
+ { 30267, 0x00008B5E }, /* GL_SAMPLER_2D */
+ { 30281, 0x00008B62 }, /* GL_SAMPLER_2D_SHADOW */
+ { 30302, 0x00008B5F }, /* GL_SAMPLER_3D */
+ { 30316, 0x00008B60 }, /* GL_SAMPLER_CUBE */
+ { 30332, 0x000080A9 }, /* GL_SAMPLES */
+ { 30343, 0x000086B4 }, /* GL_SAMPLES_3DFX */
+ { 30359, 0x000080A9 }, /* GL_SAMPLES_ARB */
+ { 30374, 0x00008914 }, /* GL_SAMPLES_PASSED */
+ { 30392, 0x00008914 }, /* GL_SAMPLES_PASSED_ARB */
+ { 30414, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE */
+ { 30442, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE_ARB */
+ { 30474, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE */
+ { 30497, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE_ARB */
+ { 30524, 0x000080A8 }, /* GL_SAMPLE_BUFFERS */
+ { 30542, 0x000086B3 }, /* GL_SAMPLE_BUFFERS_3DFX */
+ { 30565, 0x000080A8 }, /* GL_SAMPLE_BUFFERS_ARB */
+ { 30587, 0x000080A0 }, /* GL_SAMPLE_COVERAGE */
+ { 30606, 0x000080A0 }, /* GL_SAMPLE_COVERAGE_ARB */
+ { 30629, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT */
+ { 30655, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT_ARB */
+ { 30685, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE */
+ { 30710, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE_ARB */
+ { 30739, 0x00080000 }, /* GL_SCISSOR_BIT */
+ { 30754, 0x00000C10 }, /* GL_SCISSOR_BOX */
+ { 30769, 0x00000C11 }, /* GL_SCISSOR_TEST */
+ { 30785, 0x0000845E }, /* GL_SECONDARY_COLOR_ARRAY */
+ { 30810, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */
+ { 30850, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB */
+ { 30894, 0x0000845D }, /* GL_SECONDARY_COLOR_ARRAY_POINTER */
+ { 30927, 0x0000845A }, /* GL_SECONDARY_COLOR_ARRAY_SIZE */
+ { 30957, 0x0000845C }, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */
+ { 30989, 0x0000845B }, /* GL_SECONDARY_COLOR_ARRAY_TYPE */
+ { 31019, 0x00001C02 }, /* GL_SELECT */
+ { 31029, 0x00000DF3 }, /* GL_SELECTION_BUFFER_POINTER */
+ { 31057, 0x00000DF4 }, /* GL_SELECTION_BUFFER_SIZE */
+ { 31082, 0x00008012 }, /* GL_SEPARABLE_2D */
+ { 31098, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR */
+ { 31125, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR_EXT */
+ { 31156, 0x0000150F }, /* GL_SET */
+ { 31163, 0x00008B48 }, /* GL_SHADER_OBJECT_ARB */
+ { 31184, 0x00008B88 }, /* GL_SHADER_SOURCE_LENGTH */
+ { 31208, 0x00008B4F }, /* GL_SHADER_TYPE */
+ { 31223, 0x00000B54 }, /* GL_SHADE_MODEL */
+ { 31238, 0x00008B8C }, /* GL_SHADING_LANGUAGE_VERSION */
+ { 31266, 0x000080BF }, /* GL_SHADOW_AMBIENT_SGIX */
+ { 31289, 0x000081FB }, /* GL_SHARED_TEXTURE_PALETTE_EXT */
+ { 31319, 0x00001601 }, /* GL_SHININESS */
+ { 31332, 0x00001402 }, /* GL_SHORT */
+ { 31341, 0x00009119 }, /* GL_SIGNALED */
+ { 31353, 0x00008F9C }, /* GL_SIGNED_NORMALIZED */
+ { 31374, 0x000081F9 }, /* GL_SINGLE_COLOR */
+ { 31390, 0x000081F9 }, /* GL_SINGLE_COLOR_EXT */
+ { 31410, 0x000085CC }, /* GL_SLICE_ACCUM_SUN */
+ { 31429, 0x00008C46 }, /* GL_SLUMINANCE */
+ { 31443, 0x00008C47 }, /* GL_SLUMINANCE8 */
+ { 31458, 0x00008C45 }, /* GL_SLUMINANCE8_ALPHA8 */
+ { 31480, 0x00008C44 }, /* GL_SLUMINANCE_ALPHA */
+ { 31500, 0x00001D01 }, /* GL_SMOOTH */
+ { 31510, 0x00000B23 }, /* GL_SMOOTH_LINE_WIDTH_GRANULARITY */
+ { 31543, 0x00000B22 }, /* GL_SMOOTH_LINE_WIDTH_RANGE */
+ { 31570, 0x00000B13 }, /* GL_SMOOTH_POINT_SIZE_GRANULARITY */
+ { 31603, 0x00000B12 }, /* GL_SMOOTH_POINT_SIZE_RANGE */
+ { 31630, 0x00008588 }, /* GL_SOURCE0_ALPHA */
+ { 31647, 0x00008588 }, /* GL_SOURCE0_ALPHA_ARB */
+ { 31668, 0x00008588 }, /* GL_SOURCE0_ALPHA_EXT */
+ { 31689, 0x00008580 }, /* GL_SOURCE0_RGB */
+ { 31704, 0x00008580 }, /* GL_SOURCE0_RGB_ARB */
+ { 31723, 0x00008580 }, /* GL_SOURCE0_RGB_EXT */
+ { 31742, 0x00008589 }, /* GL_SOURCE1_ALPHA */
+ { 31759, 0x00008589 }, /* GL_SOURCE1_ALPHA_ARB */
+ { 31780, 0x00008589 }, /* GL_SOURCE1_ALPHA_EXT */
+ { 31801, 0x00008581 }, /* GL_SOURCE1_RGB */
+ { 31816, 0x00008581 }, /* GL_SOURCE1_RGB_ARB */
+ { 31835, 0x00008581 }, /* GL_SOURCE1_RGB_EXT */
+ { 31854, 0x0000858A }, /* GL_SOURCE2_ALPHA */
+ { 31871, 0x0000858A }, /* GL_SOURCE2_ALPHA_ARB */
+ { 31892, 0x0000858A }, /* GL_SOURCE2_ALPHA_EXT */
+ { 31913, 0x00008582 }, /* GL_SOURCE2_RGB */
+ { 31928, 0x00008582 }, /* GL_SOURCE2_RGB_ARB */
+ { 31947, 0x00008582 }, /* GL_SOURCE2_RGB_EXT */
+ { 31966, 0x0000858B }, /* GL_SOURCE3_ALPHA_NV */
+ { 31986, 0x00008583 }, /* GL_SOURCE3_RGB_NV */
+ { 32004, 0x00001202 }, /* GL_SPECULAR */
+ { 32016, 0x00002402 }, /* GL_SPHERE_MAP */
+ { 32030, 0x00001206 }, /* GL_SPOT_CUTOFF */
+ { 32045, 0x00001204 }, /* GL_SPOT_DIRECTION */
+ { 32063, 0x00001205 }, /* GL_SPOT_EXPONENT */
+ { 32080, 0x00008588 }, /* GL_SRC0_ALPHA */
+ { 32094, 0x00008580 }, /* GL_SRC0_RGB */
+ { 32106, 0x00008589 }, /* GL_SRC1_ALPHA */
+ { 32120, 0x00008581 }, /* GL_SRC1_RGB */
+ { 32132, 0x0000858A }, /* GL_SRC2_ALPHA */
+ { 32146, 0x00008582 }, /* GL_SRC2_RGB */
+ { 32158, 0x00000302 }, /* GL_SRC_ALPHA */
+ { 32171, 0x00000308 }, /* GL_SRC_ALPHA_SATURATE */
+ { 32193, 0x00000300 }, /* GL_SRC_COLOR */
+ { 32206, 0x00008C40 }, /* GL_SRGB */
+ { 32214, 0x00008C41 }, /* GL_SRGB8 */
+ { 32223, 0x00008C43 }, /* GL_SRGB8_ALPHA8 */
+ { 32239, 0x00008C42 }, /* GL_SRGB_ALPHA */
+ { 32253, 0x00000503 }, /* GL_STACK_OVERFLOW */
+ { 32271, 0x00000504 }, /* GL_STACK_UNDERFLOW */
+ { 32290, 0x000088E6 }, /* GL_STATIC_COPY */
+ { 32305, 0x000088E6 }, /* GL_STATIC_COPY_ARB */
+ { 32324, 0x000088E4 }, /* GL_STATIC_DRAW */
+ { 32339, 0x000088E4 }, /* GL_STATIC_DRAW_ARB */
+ { 32358, 0x000088E5 }, /* GL_STATIC_READ */
+ { 32373, 0x000088E5 }, /* GL_STATIC_READ_ARB */
+ { 32392, 0x00001802 }, /* GL_STENCIL */
+ { 32403, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT */
+ { 32425, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_EXT */
+ { 32451, 0x00008801 }, /* GL_STENCIL_BACK_FAIL */
+ { 32472, 0x00008801 }, /* GL_STENCIL_BACK_FAIL_ATI */
+ { 32497, 0x00008800 }, /* GL_STENCIL_BACK_FUNC */
+ { 32518, 0x00008800 }, /* GL_STENCIL_BACK_FUNC_ATI */
+ { 32543, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */
+ { 32575, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI */
+ { 32611, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */
+ { 32643, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI */
+ { 32679, 0x00008CA3 }, /* GL_STENCIL_BACK_REF */
+ { 32699, 0x00008CA4 }, /* GL_STENCIL_BACK_VALUE_MASK */
+ { 32726, 0x00008CA5 }, /* GL_STENCIL_BACK_WRITEMASK */
+ { 32752, 0x00000D57 }, /* GL_STENCIL_BITS */
+ { 32768, 0x00000400 }, /* GL_STENCIL_BUFFER_BIT */
+ { 32790, 0x00000B91 }, /* GL_STENCIL_CLEAR_VALUE */
+ { 32813, 0x00000B94 }, /* GL_STENCIL_FAIL */
+ { 32829, 0x00000B92 }, /* GL_STENCIL_FUNC */
+ { 32845, 0x00001901 }, /* GL_STENCIL_INDEX */
+ { 32862, 0x00008D46 }, /* GL_STENCIL_INDEX1 */
+ { 32880, 0x00008D49 }, /* GL_STENCIL_INDEX16 */
+ { 32899, 0x00008D49 }, /* GL_STENCIL_INDEX16_EXT */
+ { 32922, 0x00008D46 }, /* GL_STENCIL_INDEX1_EXT */
+ { 32944, 0x00008D47 }, /* GL_STENCIL_INDEX4 */
+ { 32962, 0x00008D47 }, /* GL_STENCIL_INDEX4_EXT */
+ { 32984, 0x00008D48 }, /* GL_STENCIL_INDEX8 */
+ { 33002, 0x00008D48 }, /* GL_STENCIL_INDEX8_EXT */
+ { 33024, 0x00008D45 }, /* GL_STENCIL_INDEX_EXT */
+ { 33045, 0x00000B95 }, /* GL_STENCIL_PASS_DEPTH_FAIL */
+ { 33072, 0x00000B96 }, /* GL_STENCIL_PASS_DEPTH_PASS */
+ { 33099, 0x00000B97 }, /* GL_STENCIL_REF */
+ { 33114, 0x00000B90 }, /* GL_STENCIL_TEST */
+ { 33130, 0x00008910 }, /* GL_STENCIL_TEST_TWO_SIDE_EXT */
+ { 33159, 0x00000B93 }, /* GL_STENCIL_VALUE_MASK */
+ { 33181, 0x00000B98 }, /* GL_STENCIL_WRITEMASK */
+ { 33202, 0x00000C33 }, /* GL_STEREO */
+ { 33212, 0x000085BE }, /* GL_STORAGE_CACHED_APPLE */
+ { 33236, 0x000085BD }, /* GL_STORAGE_PRIVATE_APPLE */
+ { 33261, 0x000085BF }, /* GL_STORAGE_SHARED_APPLE */
+ { 33285, 0x000088E2 }, /* GL_STREAM_COPY */
+ { 33300, 0x000088E2 }, /* GL_STREAM_COPY_ARB */
+ { 33319, 0x000088E0 }, /* GL_STREAM_DRAW */
+ { 33334, 0x000088E0 }, /* GL_STREAM_DRAW_ARB */
+ { 33353, 0x000088E1 }, /* GL_STREAM_READ */
+ { 33368, 0x000088E1 }, /* GL_STREAM_READ_ARB */
+ { 33387, 0x00000D50 }, /* GL_SUBPIXEL_BITS */
+ { 33404, 0x000084E7 }, /* GL_SUBTRACT */
+ { 33416, 0x000084E7 }, /* GL_SUBTRACT_ARB */
+ { 33432, 0x00009113 }, /* GL_SYNC_CONDITION */
+ { 33450, 0x00009116 }, /* GL_SYNC_FENCE */
+ { 33464, 0x00009115 }, /* GL_SYNC_FLAGS */
+ { 33478, 0x00000001 }, /* GL_SYNC_FLUSH_COMMANDS_BIT */
+ { 33505, 0x00009117 }, /* GL_SYNC_GPU_COMMANDS_COMPLETE */
+ { 33535, 0x00009114 }, /* GL_SYNC_STATUS */
+ { 33550, 0x00002001 }, /* GL_T */
+ { 33555, 0x00002A2A }, /* GL_T2F_C3F_V3F */
+ { 33570, 0x00002A2C }, /* GL_T2F_C4F_N3F_V3F */
+ { 33589, 0x00002A29 }, /* GL_T2F_C4UB_V3F */
+ { 33605, 0x00002A2B }, /* GL_T2F_N3F_V3F */
+ { 33620, 0x00002A27 }, /* GL_T2F_V3F */
+ { 33631, 0x00002A2D }, /* GL_T4F_C4F_N3F_V4F */
+ { 33650, 0x00002A28 }, /* GL_T4F_V4F */
+ { 33661, 0x00008031 }, /* GL_TABLE_TOO_LARGE_EXT */
+ { 33684, 0x00001702 }, /* GL_TEXTURE */
+ { 33695, 0x000084C0 }, /* GL_TEXTURE0 */
+ { 33707, 0x000084C0 }, /* GL_TEXTURE0_ARB */
+ { 33723, 0x000084C1 }, /* GL_TEXTURE1 */
+ { 33735, 0x000084CA }, /* GL_TEXTURE10 */
+ { 33748, 0x000084CA }, /* GL_TEXTURE10_ARB */
+ { 33765, 0x000084CB }, /* GL_TEXTURE11 */
+ { 33778, 0x000084CB }, /* GL_TEXTURE11_ARB */
+ { 33795, 0x000084CC }, /* GL_TEXTURE12 */
+ { 33808, 0x000084CC }, /* GL_TEXTURE12_ARB */
+ { 33825, 0x000084CD }, /* GL_TEXTURE13 */
+ { 33838, 0x000084CD }, /* GL_TEXTURE13_ARB */
+ { 33855, 0x000084CE }, /* GL_TEXTURE14 */
+ { 33868, 0x000084CE }, /* GL_TEXTURE14_ARB */
+ { 33885, 0x000084CF }, /* GL_TEXTURE15 */
+ { 33898, 0x000084CF }, /* GL_TEXTURE15_ARB */
+ { 33915, 0x000084D0 }, /* GL_TEXTURE16 */
+ { 33928, 0x000084D0 }, /* GL_TEXTURE16_ARB */
+ { 33945, 0x000084D1 }, /* GL_TEXTURE17 */
+ { 33958, 0x000084D1 }, /* GL_TEXTURE17_ARB */
+ { 33975, 0x000084D2 }, /* GL_TEXTURE18 */
+ { 33988, 0x000084D2 }, /* GL_TEXTURE18_ARB */
+ { 34005, 0x000084D3 }, /* GL_TEXTURE19 */
+ { 34018, 0x000084D3 }, /* GL_TEXTURE19_ARB */
+ { 34035, 0x000084C1 }, /* GL_TEXTURE1_ARB */
+ { 34051, 0x000084C2 }, /* GL_TEXTURE2 */
+ { 34063, 0x000084D4 }, /* GL_TEXTURE20 */
+ { 34076, 0x000084D4 }, /* GL_TEXTURE20_ARB */
+ { 34093, 0x000084D5 }, /* GL_TEXTURE21 */
+ { 34106, 0x000084D5 }, /* GL_TEXTURE21_ARB */
+ { 34123, 0x000084D6 }, /* GL_TEXTURE22 */
+ { 34136, 0x000084D6 }, /* GL_TEXTURE22_ARB */
+ { 34153, 0x000084D7 }, /* GL_TEXTURE23 */
+ { 34166, 0x000084D7 }, /* GL_TEXTURE23_ARB */
+ { 34183, 0x000084D8 }, /* GL_TEXTURE24 */
+ { 34196, 0x000084D8 }, /* GL_TEXTURE24_ARB */
+ { 34213, 0x000084D9 }, /* GL_TEXTURE25 */
+ { 34226, 0x000084D9 }, /* GL_TEXTURE25_ARB */
+ { 34243, 0x000084DA }, /* GL_TEXTURE26 */
+ { 34256, 0x000084DA }, /* GL_TEXTURE26_ARB */
+ { 34273, 0x000084DB }, /* GL_TEXTURE27 */
+ { 34286, 0x000084DB }, /* GL_TEXTURE27_ARB */
+ { 34303, 0x000084DC }, /* GL_TEXTURE28 */
+ { 34316, 0x000084DC }, /* GL_TEXTURE28_ARB */
+ { 34333, 0x000084DD }, /* GL_TEXTURE29 */
+ { 34346, 0x000084DD }, /* GL_TEXTURE29_ARB */
+ { 34363, 0x000084C2 }, /* GL_TEXTURE2_ARB */
+ { 34379, 0x000084C3 }, /* GL_TEXTURE3 */
+ { 34391, 0x000084DE }, /* GL_TEXTURE30 */
+ { 34404, 0x000084DE }, /* GL_TEXTURE30_ARB */
+ { 34421, 0x000084DF }, /* GL_TEXTURE31 */
+ { 34434, 0x000084DF }, /* GL_TEXTURE31_ARB */
+ { 34451, 0x000084C3 }, /* GL_TEXTURE3_ARB */
+ { 34467, 0x000084C4 }, /* GL_TEXTURE4 */
+ { 34479, 0x000084C4 }, /* GL_TEXTURE4_ARB */
+ { 34495, 0x000084C5 }, /* GL_TEXTURE5 */
+ { 34507, 0x000084C5 }, /* GL_TEXTURE5_ARB */
+ { 34523, 0x000084C6 }, /* GL_TEXTURE6 */
+ { 34535, 0x000084C6 }, /* GL_TEXTURE6_ARB */
+ { 34551, 0x000084C7 }, /* GL_TEXTURE7 */
+ { 34563, 0x000084C7 }, /* GL_TEXTURE7_ARB */
+ { 34579, 0x000084C8 }, /* GL_TEXTURE8 */
+ { 34591, 0x000084C8 }, /* GL_TEXTURE8_ARB */
+ { 34607, 0x000084C9 }, /* GL_TEXTURE9 */
+ { 34619, 0x000084C9 }, /* GL_TEXTURE9_ARB */
+ { 34635, 0x00000DE0 }, /* GL_TEXTURE_1D */
+ { 34649, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY_EXT */
+ { 34673, 0x00000DE1 }, /* GL_TEXTURE_2D */
+ { 34687, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY_EXT */
+ { 34711, 0x0000806F }, /* GL_TEXTURE_3D */
+ { 34725, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE */
+ { 34747, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE_EXT */
+ { 34773, 0x0000813C }, /* GL_TEXTURE_BASE_LEVEL */
+ { 34795, 0x00008068 }, /* GL_TEXTURE_BINDING_1D */
+ { 34817, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */
+ { 34849, 0x00008069 }, /* GL_TEXTURE_BINDING_2D */
+ { 34871, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */
+ { 34903, 0x0000806A }, /* GL_TEXTURE_BINDING_3D */
+ { 34925, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP */
+ { 34953, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_ARB */
+ { 34985, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */
+ { 35018, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_NV */
+ { 35050, 0x00040000 }, /* GL_TEXTURE_BIT */
+ { 35065, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE */
+ { 35086, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE_EXT */
+ { 35111, 0x00001005 }, /* GL_TEXTURE_BORDER */
+ { 35129, 0x00001004 }, /* GL_TEXTURE_BORDER_COLOR */
+ { 35153, 0x00008171 }, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */
+ { 35184, 0x00008176 }, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */
+ { 35214, 0x00008172 }, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */
+ { 35244, 0x00008175 }, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */
+ { 35279, 0x00008173 }, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */
+ { 35310, 0x00008174 }, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */
+ { 35348, 0x000080BC }, /* GL_TEXTURE_COLOR_TABLE_SGI */
+ { 35375, 0x000081EF }, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */
+ { 35407, 0x000080BF }, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
+ { 35441, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC */
+ { 35465, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC_ARB */
+ { 35493, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE */
+ { 35517, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE_ARB */
+ { 35545, 0x0000819B }, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */
+ { 35578, 0x0000819A }, /* GL_TEXTURE_COMPARE_SGIX */
+ { 35602, 0x00001003 }, /* GL_TEXTURE_COMPONENTS */
+ { 35624, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED */
+ { 35646, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED_ARB */
+ { 35672, 0x000086A3 }, /* GL_TEXTURE_COMPRESSED_FORMATS_ARB */
+ { 35706, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */
+ { 35739, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB */
+ { 35776, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT */
+ { 35804, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT_ARB */
+ { 35836, 0x00008078 }, /* GL_TEXTURE_COORD_ARRAY */
+ { 35859, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */
+ { 35897, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB */
+ { 35939, 0x00008092 }, /* GL_TEXTURE_COORD_ARRAY_POINTER */
+ { 35970, 0x00008088 }, /* GL_TEXTURE_COORD_ARRAY_SIZE */
+ { 35998, 0x0000808A }, /* GL_TEXTURE_COORD_ARRAY_STRIDE */
+ { 36028, 0x00008089 }, /* GL_TEXTURE_COORD_ARRAY_TYPE */
+ { 36056, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP */
+ { 36076, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_ARB */
+ { 36100, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */
+ { 36131, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB */
+ { 36166, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */
+ { 36197, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB */
+ { 36232, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */
+ { 36263, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB */
+ { 36298, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */
+ { 36329, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB */
+ { 36364, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */
+ { 36395, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB */
+ { 36430, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */
+ { 36461, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */
+ { 36496, 0x000088F4 }, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */
+ { 36525, 0x00008071 }, /* GL_TEXTURE_DEPTH */
+ { 36542, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */
+ { 36564, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */
+ { 36590, 0x00002300 }, /* GL_TEXTURE_ENV */
+ { 36605, 0x00002201 }, /* GL_TEXTURE_ENV_COLOR */
+ { 36626, 0x00002200 }, /* GL_TEXTURE_ENV_MODE */
+ { 36646, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL */
+ { 36672, 0x00002500 }, /* GL_TEXTURE_GEN_MODE */
+ { 36692, 0x00000C63 }, /* GL_TEXTURE_GEN_Q */
+ { 36709, 0x00000C62 }, /* GL_TEXTURE_GEN_R */
+ { 36726, 0x00000C60 }, /* GL_TEXTURE_GEN_S */
+ { 36743, 0x00000C61 }, /* GL_TEXTURE_GEN_T */
+ { 36760, 0x0000819D }, /* GL_TEXTURE_GEQUAL_R_SGIX */
+ { 36785, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE */
+ { 36807, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE_EXT */
+ { 36833, 0x00001001 }, /* GL_TEXTURE_HEIGHT */
+ { 36851, 0x000080ED }, /* GL_TEXTURE_INDEX_SIZE_EXT */
+ { 36877, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE */
+ { 36903, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE_EXT */
+ { 36933, 0x00001003 }, /* GL_TEXTURE_INTERNAL_FORMAT */
+ { 36960, 0x0000819C }, /* GL_TEXTURE_LEQUAL_R_SGIX */
+ { 36985, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS */
+ { 37005, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS_EXT */
+ { 37029, 0x00008190 }, /* GL_TEXTURE_LOD_BIAS_R_SGIX */
+ { 37056, 0x0000818E }, /* GL_TEXTURE_LOD_BIAS_S_SGIX */
+ { 37083, 0x0000818F }, /* GL_TEXTURE_LOD_BIAS_T_SGIX */
+ { 37110, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE */
+ { 37136, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE_EXT */
+ { 37166, 0x00002800 }, /* GL_TEXTURE_MAG_FILTER */
+ { 37188, 0x00000BA8 }, /* GL_TEXTURE_MATRIX */
+ { 37206, 0x000084FE }, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */
+ { 37236, 0x0000836B }, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */
+ { 37264, 0x00008369 }, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */
+ { 37292, 0x0000836A }, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */
+ { 37320, 0x0000813D }, /* GL_TEXTURE_MAX_LEVEL */
+ { 37341, 0x0000813B }, /* GL_TEXTURE_MAX_LOD */
+ { 37360, 0x00002801 }, /* GL_TEXTURE_MIN_FILTER */
+ { 37382, 0x0000813A }, /* GL_TEXTURE_MIN_LOD */
+ { 37401, 0x00008066 }, /* GL_TEXTURE_PRIORITY */
+ { 37421, 0x000085B7 }, /* GL_TEXTURE_RANGE_LENGTH_APPLE */
+ { 37451, 0x000085B8 }, /* GL_TEXTURE_RANGE_POINTER_APPLE */
+ { 37482, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_ARB */
+ { 37507, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_NV */
+ { 37531, 0x0000805C }, /* GL_TEXTURE_RED_SIZE */
+ { 37551, 0x0000805C }, /* GL_TEXTURE_RED_SIZE_EXT */
+ { 37575, 0x00008067 }, /* GL_TEXTURE_RESIDENT */
+ { 37595, 0x00000BA5 }, /* GL_TEXTURE_STACK_DEPTH */
+ { 37618, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE */
+ { 37642, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE_EXT */
+ { 37670, 0x000085BC }, /* GL_TEXTURE_STORAGE_HINT_APPLE */
+ { 37700, 0x00008065 }, /* GL_TEXTURE_TOO_LARGE_EXT */
+ { 37725, 0x0000888F }, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */
+ { 37759, 0x00001000 }, /* GL_TEXTURE_WIDTH */
+ { 37776, 0x00008072 }, /* GL_TEXTURE_WRAP_R */
+ { 37794, 0x00002802 }, /* GL_TEXTURE_WRAP_S */
+ { 37812, 0x00002803 }, /* GL_TEXTURE_WRAP_T */
+ { 37830, 0x0000911B }, /* GL_TIMEOUT_EXPIRED */
+ { 37849, 0x000088BF }, /* GL_TIME_ELAPSED_EXT */
+ { 37869, 0x00008648 }, /* GL_TRACK_MATRIX_NV */
+ { 37888, 0x00008649 }, /* GL_TRACK_MATRIX_TRANSFORM_NV */
+ { 37917, 0x00001000 }, /* GL_TRANSFORM_BIT */
+ { 37934, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX */
+ { 37960, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX_ARB */
+ { 37990, 0x000088B7 }, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */
+ { 38022, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX */
+ { 38052, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX_ARB */
+ { 38086, 0x0000862C }, /* GL_TRANSPOSE_NV */
+ { 38102, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX */
+ { 38133, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX_ARB */
+ { 38168, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX */
+ { 38196, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX_ARB */
+ { 38228, 0x00000004 }, /* GL_TRIANGLES */
+ { 38241, 0x00000006 }, /* GL_TRIANGLE_FAN */
+ { 38257, 0x00008615 }, /* GL_TRIANGLE_MESH_SUN */
+ { 38278, 0x00000005 }, /* GL_TRIANGLE_STRIP */
+ { 38296, 0x00000001 }, /* GL_TRUE */
+ { 38304, 0x00000CF5 }, /* GL_UNPACK_ALIGNMENT */
+ { 38324, 0x0000806E }, /* GL_UNPACK_IMAGE_HEIGHT */
+ { 38347, 0x00000CF1 }, /* GL_UNPACK_LSB_FIRST */
+ { 38367, 0x00000CF2 }, /* GL_UNPACK_ROW_LENGTH */
+ { 38388, 0x0000806D }, /* GL_UNPACK_SKIP_IMAGES */
+ { 38410, 0x00000CF4 }, /* GL_UNPACK_SKIP_PIXELS */
+ { 38432, 0x00000CF3 }, /* GL_UNPACK_SKIP_ROWS */
+ { 38452, 0x00000CF0 }, /* GL_UNPACK_SWAP_BYTES */
+ { 38473, 0x00009118 }, /* GL_UNSIGNALED */
+ { 38487, 0x00001401 }, /* GL_UNSIGNED_BYTE */
+ { 38504, 0x00008362 }, /* GL_UNSIGNED_BYTE_2_3_3_REV */
+ { 38531, 0x00008032 }, /* GL_UNSIGNED_BYTE_3_3_2 */
+ { 38554, 0x00001405 }, /* GL_UNSIGNED_INT */
+ { 38570, 0x00008036 }, /* GL_UNSIGNED_INT_10_10_10_2 */
+ { 38597, 0x000084FA }, /* GL_UNSIGNED_INT_24_8 */
+ { 38618, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_EXT */
+ { 38643, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_NV */
+ { 38667, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV */
+ { 38698, 0x00008035 }, /* GL_UNSIGNED_INT_8_8_8_8 */
+ { 38722, 0x00008367 }, /* GL_UNSIGNED_INT_8_8_8_8_REV */
+ { 38750, 0x00008C17 }, /* GL_UNSIGNED_NORMALIZED */
+ { 38773, 0x00001403 }, /* GL_UNSIGNED_SHORT */
+ { 38791, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */
+ { 38821, 0x00008033 }, /* GL_UNSIGNED_SHORT_4_4_4_4 */
+ { 38847, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */
+ { 38877, 0x00008034 }, /* GL_UNSIGNED_SHORT_5_5_5_1 */
+ { 38903, 0x00008363 }, /* GL_UNSIGNED_SHORT_5_6_5 */
+ { 38927, 0x00008364 }, /* GL_UNSIGNED_SHORT_5_6_5_REV */
+ { 38955, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_APPLE */
+ { 38983, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_MESA */
+ { 39010, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */
+ { 39042, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_MESA */
+ { 39073, 0x00008CA2 }, /* GL_UPPER_LEFT */
+ { 39087, 0x00002A20 }, /* GL_V2F */
+ { 39094, 0x00002A21 }, /* GL_V3F */
+ { 39101, 0x00008B83 }, /* GL_VALIDATE_STATUS */
+ { 39120, 0x00001F00 }, /* GL_VENDOR */
+ { 39130, 0x00001F02 }, /* GL_VERSION */
+ { 39141, 0x00008074 }, /* GL_VERTEX_ARRAY */
+ { 39157, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING */
+ { 39181, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING_APPLE */
+ { 39211, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING */
+ { 39242, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING_ARB */
+ { 39277, 0x0000808E }, /* GL_VERTEX_ARRAY_POINTER */
+ { 39301, 0x0000807A }, /* GL_VERTEX_ARRAY_SIZE */
+ { 39322, 0x0000807C }, /* GL_VERTEX_ARRAY_STRIDE */
+ { 39345, 0x0000807B }, /* GL_VERTEX_ARRAY_TYPE */
+ { 39366, 0x00008650 }, /* GL_VERTEX_ATTRIB_ARRAY0_NV */
+ { 39393, 0x0000865A }, /* GL_VERTEX_ATTRIB_ARRAY10_NV */
+ { 39421, 0x0000865B }, /* GL_VERTEX_ATTRIB_ARRAY11_NV */
+ { 39449, 0x0000865C }, /* GL_VERTEX_ATTRIB_ARRAY12_NV */
+ { 39477, 0x0000865D }, /* GL_VERTEX_ATTRIB_ARRAY13_NV */
+ { 39505, 0x0000865E }, /* GL_VERTEX_ATTRIB_ARRAY14_NV */
+ { 39533, 0x0000865F }, /* GL_VERTEX_ATTRIB_ARRAY15_NV */
+ { 39561, 0x00008651 }, /* GL_VERTEX_ATTRIB_ARRAY1_NV */
+ { 39588, 0x00008652 }, /* GL_VERTEX_ATTRIB_ARRAY2_NV */
+ { 39615, 0x00008653 }, /* GL_VERTEX_ATTRIB_ARRAY3_NV */
+ { 39642, 0x00008654 }, /* GL_VERTEX_ATTRIB_ARRAY4_NV */
+ { 39669, 0x00008655 }, /* GL_VERTEX_ATTRIB_ARRAY5_NV */
+ { 39696, 0x00008656 }, /* GL_VERTEX_ATTRIB_ARRAY6_NV */
+ { 39723, 0x00008657 }, /* GL_VERTEX_ATTRIB_ARRAY7_NV */
+ { 39750, 0x00008658 }, /* GL_VERTEX_ATTRIB_ARRAY8_NV */
+ { 39777, 0x00008659 }, /* GL_VERTEX_ATTRIB_ARRAY9_NV */
+ { 39804, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */
+ { 39842, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB */
+ { 39884, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */
+ { 39915, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */
+ { 39950, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */
+ { 39984, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */
+ { 40022, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */
+ { 40053, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */
+ { 40088, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */
+ { 40116, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */
+ { 40148, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */
+ { 40178, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */
+ { 40212, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */
+ { 40240, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */
+ { 40272, 0x000086A7 }, /* GL_VERTEX_BLEND_ARB */
+ { 40292, 0x00008620 }, /* GL_VERTEX_PROGRAM_ARB */
+ { 40314, 0x0000864A }, /* GL_VERTEX_PROGRAM_BINDING_NV */
+ { 40343, 0x00008620 }, /* GL_VERTEX_PROGRAM_NV */
+ { 40364, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE */
+ { 40393, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */
+ { 40426, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */
+ { 40458, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE */
+ { 40485, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */
+ { 40516, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */
+ { 40546, 0x00008B31 }, /* GL_VERTEX_SHADER */
+ { 40563, 0x00008B31 }, /* GL_VERTEX_SHADER_ARB */
+ { 40584, 0x00008621 }, /* GL_VERTEX_STATE_PROGRAM_NV */
+ { 40611, 0x00000BA2 }, /* GL_VIEWPORT */
+ { 40623, 0x00000800 }, /* GL_VIEWPORT_BIT */
+ { 40639, 0x0000911D }, /* GL_WAIT_FAILED */
+ { 40654, 0x000086AD }, /* GL_WEIGHT_ARRAY_ARB */
+ { 40674, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */
+ { 40705, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB */
+ { 40740, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_ARB */
+ { 40768, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_ARB */
+ { 40793, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_ARB */
+ { 40820, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_ARB */
+ { 40845, 0x000086A6 }, /* GL_WEIGHT_SUM_UNITY_ARB */
+ { 40869, 0x000081D4 }, /* GL_WRAP_BORDER_SUN */
+ { 40888, 0x000088B9 }, /* GL_WRITE_ONLY */
+ { 40902, 0x000088B9 }, /* GL_WRITE_ONLY_ARB */
+ { 40920, 0x00001506 }, /* GL_XOR */
+ { 40927, 0x000085B9 }, /* GL_YCBCR_422_APPLE */
+ { 40946, 0x00008757 }, /* GL_YCBCR_MESA */
+ { 40960, 0x00000000 }, /* GL_ZERO */
+ { 40968, 0x00000D16 }, /* GL_ZOOM_X */
+ { 40978, 0x00000D17 }, /* GL_ZOOM_Y */
};
-static const unsigned reduced_enums[1350] =
+static const unsigned reduced_enums[1351] =
{
479, /* GL_FALSE */
- 701, /* GL_LINES */
- 703, /* GL_LINE_LOOP */
- 710, /* GL_LINE_STRIP */
- 1769, /* GL_TRIANGLES */
- 1772, /* GL_TRIANGLE_STRIP */
- 1770, /* GL_TRIANGLE_FAN */
- 1285, /* GL_QUADS */
- 1289, /* GL_QUAD_STRIP */
- 1171, /* GL_POLYGON */
- 1183, /* GL_POLYGON_STIPPLE_BIT */
- 1132, /* GL_PIXEL_MODE_BIT */
- 688, /* GL_LIGHTING_BIT */
+ 702, /* GL_LINES */
+ 704, /* GL_LINE_LOOP */
+ 711, /* GL_LINE_STRIP */
+ 1770, /* GL_TRIANGLES */
+ 1773, /* GL_TRIANGLE_STRIP */
+ 1771, /* GL_TRIANGLE_FAN */
+ 1286, /* GL_QUADS */
+ 1290, /* GL_QUAD_STRIP */
+ 1172, /* GL_POLYGON */
+ 1184, /* GL_POLYGON_STIPPLE_BIT */
+ 1133, /* GL_PIXEL_MODE_BIT */
+ 689, /* GL_LIGHTING_BIT */
509, /* GL_FOG_BIT */
8, /* GL_ACCUM */
- 720, /* GL_LOAD */
- 1348, /* GL_RETURN */
- 1004, /* GL_MULT */
+ 721, /* GL_LOAD */
+ 1349, /* GL_RETURN */
+ 1005, /* GL_MULT */
23, /* GL_ADD */
- 1020, /* GL_NEVER */
- 678, /* GL_LESS */
+ 1021, /* GL_NEVER */
+ 679, /* GL_LESS */
469, /* GL_EQUAL */
- 677, /* GL_LEQUAL */
+ 678, /* GL_LEQUAL */
599, /* GL_GREATER */
- 1035, /* GL_NOTEQUAL */
+ 1036, /* GL_NOTEQUAL */
598, /* GL_GEQUAL */
47, /* GL_ALWAYS */
- 1489, /* GL_SRC_COLOR */
- 1065, /* GL_ONE_MINUS_SRC_COLOR */
- 1487, /* GL_SRC_ALPHA */
- 1064, /* GL_ONE_MINUS_SRC_ALPHA */
+ 1490, /* GL_SRC_COLOR */
+ 1066, /* GL_ONE_MINUS_SRC_COLOR */
+ 1488, /* GL_SRC_ALPHA */
+ 1065, /* GL_ONE_MINUS_SRC_ALPHA */
448, /* GL_DST_ALPHA */
- 1062, /* GL_ONE_MINUS_DST_ALPHA */
+ 1063, /* GL_ONE_MINUS_DST_ALPHA */
449, /* GL_DST_COLOR */
- 1063, /* GL_ONE_MINUS_DST_COLOR */
- 1488, /* GL_SRC_ALPHA_SATURATE */
+ 1064, /* GL_ONE_MINUS_DST_COLOR */
+ 1489, /* GL_SRC_ALPHA_SATURATE */
586, /* GL_FRONT_LEFT */
587, /* GL_FRONT_RIGHT */
69, /* GL_BACK_LEFT */
70, /* GL_BACK_RIGHT */
583, /* GL_FRONT */
68, /* GL_BACK */
- 676, /* GL_LEFT */
- 1390, /* GL_RIGHT */
+ 677, /* GL_LEFT */
+ 1391, /* GL_RIGHT */
584, /* GL_FRONT_AND_BACK */
63, /* GL_AUX0 */
64, /* GL_AUX1 */
65, /* GL_AUX2 */
66, /* GL_AUX3 */
- 665, /* GL_INVALID_ENUM */
- 669, /* GL_INVALID_VALUE */
- 668, /* GL_INVALID_OPERATION */
- 1494, /* GL_STACK_OVERFLOW */
- 1495, /* GL_STACK_UNDERFLOW */
- 1090, /* GL_OUT_OF_MEMORY */
- 666, /* GL_INVALID_FRAMEBUFFER_OPERATION */
+ 666, /* GL_INVALID_ENUM */
+ 670, /* GL_INVALID_VALUE */
+ 669, /* GL_INVALID_OPERATION */
+ 1495, /* GL_STACK_OVERFLOW */
+ 1496, /* GL_STACK_UNDERFLOW */
+ 1091, /* GL_OUT_OF_MEMORY */
+ 667, /* GL_INVALID_FRAMEBUFFER_OPERATION */
0, /* GL_2D */
2, /* GL_3D */
3, /* GL_3D_COLOR */
4, /* GL_3D_COLOR_TEXTURE */
6, /* GL_4D_COLOR_TEXTURE */
- 1110, /* GL_PASS_THROUGH_TOKEN */
- 1170, /* GL_POINT_TOKEN */
- 711, /* GL_LINE_TOKEN */
- 1184, /* GL_POLYGON_TOKEN */
+ 1111, /* GL_PASS_THROUGH_TOKEN */
+ 1171, /* GL_POINT_TOKEN */
+ 712, /* GL_LINE_TOKEN */
+ 1185, /* GL_POLYGON_TOKEN */
74, /* GL_BITMAP_TOKEN */
447, /* GL_DRAW_PIXEL_TOKEN */
301, /* GL_COPY_PIXEL_TOKEN */
- 704, /* GL_LINE_RESET_TOKEN */
+ 705, /* GL_LINE_RESET_TOKEN */
472, /* GL_EXP */
473, /* GL_EXP2 */
337, /* GL_CW */
125, /* GL_CCW */
146, /* GL_COEFF */
- 1087, /* GL_ORDER */
+ 1088, /* GL_ORDER */
384, /* GL_DOMAIN */
311, /* GL_CURRENT_COLOR */
314, /* GL_CURRENT_INDEX */
@@ -3898,33 +3900,33 @@ static const unsigned reduced_enums[1350] =
328, /* GL_CURRENT_RASTER_POSITION */
329, /* GL_CURRENT_RASTER_POSITION_VALID */
326, /* GL_CURRENT_RASTER_DISTANCE */
- 1163, /* GL_POINT_SMOOTH */
- 1152, /* GL_POINT_SIZE */
- 1162, /* GL_POINT_SIZE_RANGE */
- 1153, /* GL_POINT_SIZE_GRANULARITY */
- 705, /* GL_LINE_SMOOTH */
- 712, /* GL_LINE_WIDTH */
- 714, /* GL_LINE_WIDTH_RANGE */
- 713, /* GL_LINE_WIDTH_GRANULARITY */
- 707, /* GL_LINE_STIPPLE */
- 708, /* GL_LINE_STIPPLE_PATTERN */
- 709, /* GL_LINE_STIPPLE_REPEAT */
- 719, /* GL_LIST_MODE */
- 885, /* GL_MAX_LIST_NESTING */
- 716, /* GL_LIST_BASE */
- 718, /* GL_LIST_INDEX */
- 1173, /* GL_POLYGON_MODE */
- 1180, /* GL_POLYGON_SMOOTH */
- 1182, /* GL_POLYGON_STIPPLE */
+ 1164, /* GL_POINT_SMOOTH */
+ 1153, /* GL_POINT_SIZE */
+ 1163, /* GL_POINT_SIZE_RANGE */
+ 1154, /* GL_POINT_SIZE_GRANULARITY */
+ 706, /* GL_LINE_SMOOTH */
+ 713, /* GL_LINE_WIDTH */
+ 715, /* GL_LINE_WIDTH_RANGE */
+ 714, /* GL_LINE_WIDTH_GRANULARITY */
+ 708, /* GL_LINE_STIPPLE */
+ 709, /* GL_LINE_STIPPLE_PATTERN */
+ 710, /* GL_LINE_STIPPLE_REPEAT */
+ 720, /* GL_LIST_MODE */
+ 886, /* GL_MAX_LIST_NESTING */
+ 717, /* GL_LIST_BASE */
+ 719, /* GL_LIST_INDEX */
+ 1174, /* GL_POLYGON_MODE */
+ 1181, /* GL_POLYGON_SMOOTH */
+ 1183, /* GL_POLYGON_STIPPLE */
458, /* GL_EDGE_FLAG */
304, /* GL_CULL_FACE */
305, /* GL_CULL_FACE_MODE */
585, /* GL_FRONT_FACE */
- 687, /* GL_LIGHTING */
- 692, /* GL_LIGHT_MODEL_LOCAL_VIEWER */
- 693, /* GL_LIGHT_MODEL_TWO_SIDE */
- 689, /* GL_LIGHT_MODEL_AMBIENT */
- 1436, /* GL_SHADE_MODEL */
+ 688, /* GL_LIGHTING */
+ 693, /* GL_LIGHT_MODEL_LOCAL_VIEWER */
+ 694, /* GL_LIGHT_MODEL_TWO_SIDE */
+ 690, /* GL_LIGHT_MODEL_AMBIENT */
+ 1437, /* GL_SHADE_MODEL */
193, /* GL_COLOR_MATERIAL_FACE */
194, /* GL_COLOR_MATERIAL_PARAMETER */
192, /* GL_COLOR_MATERIAL */
@@ -3941,24 +3943,24 @@ static const unsigned reduced_enums[1350] =
358, /* GL_DEPTH_CLEAR_VALUE */
369, /* GL_DEPTH_FUNC */
12, /* GL_ACCUM_CLEAR_VALUE */
- 1534, /* GL_STENCIL_TEST */
- 1518, /* GL_STENCIL_CLEAR_VALUE */
- 1520, /* GL_STENCIL_FUNC */
- 1536, /* GL_STENCIL_VALUE_MASK */
- 1519, /* GL_STENCIL_FAIL */
- 1531, /* GL_STENCIL_PASS_DEPTH_FAIL */
- 1532, /* GL_STENCIL_PASS_DEPTH_PASS */
- 1533, /* GL_STENCIL_REF */
- 1537, /* GL_STENCIL_WRITEMASK */
- 853, /* GL_MATRIX_MODE */
- 1025, /* GL_NORMALIZE */
- 1864, /* GL_VIEWPORT */
- 999, /* GL_MODELVIEW_STACK_DEPTH */
- 1263, /* GL_PROJECTION_STACK_DEPTH */
- 1744, /* GL_TEXTURE_STACK_DEPTH */
- 997, /* GL_MODELVIEW_MATRIX */
- 1262, /* GL_PROJECTION_MATRIX */
- 1727, /* GL_TEXTURE_MATRIX */
+ 1535, /* GL_STENCIL_TEST */
+ 1519, /* GL_STENCIL_CLEAR_VALUE */
+ 1521, /* GL_STENCIL_FUNC */
+ 1537, /* GL_STENCIL_VALUE_MASK */
+ 1520, /* GL_STENCIL_FAIL */
+ 1532, /* GL_STENCIL_PASS_DEPTH_FAIL */
+ 1533, /* GL_STENCIL_PASS_DEPTH_PASS */
+ 1534, /* GL_STENCIL_REF */
+ 1538, /* GL_STENCIL_WRITEMASK */
+ 854, /* GL_MATRIX_MODE */
+ 1026, /* GL_NORMALIZE */
+ 1865, /* GL_VIEWPORT */
+ 1000, /* GL_MODELVIEW_STACK_DEPTH */
+ 1264, /* GL_PROJECTION_STACK_DEPTH */
+ 1745, /* GL_TEXTURE_STACK_DEPTH */
+ 998, /* GL_MODELVIEW_MATRIX */
+ 1263, /* GL_PROJECTION_MATRIX */
+ 1728, /* GL_TEXTURE_MATRIX */
61, /* GL_ATTRIB_STACK_DEPTH */
136, /* GL_CLIENT_ATTRIB_STACK_DEPTH */
43, /* GL_ALPHA_TEST */
@@ -3968,72 +3970,72 @@ static const unsigned reduced_enums[1350] =
78, /* GL_BLEND_DST */
87, /* GL_BLEND_SRC */
75, /* GL_BLEND */
- 722, /* GL_LOGIC_OP_MODE */
- 639, /* GL_INDEX_LOGIC_OP */
+ 723, /* GL_LOGIC_OP_MODE */
+ 640, /* GL_INDEX_LOGIC_OP */
191, /* GL_COLOR_LOGIC_OP */
67, /* GL_AUX_BUFFERS */
394, /* GL_DRAW_BUFFER */
- 1303, /* GL_READ_BUFFER */
- 1417, /* GL_SCISSOR_BOX */
- 1418, /* GL_SCISSOR_TEST */
- 638, /* GL_INDEX_CLEAR_VALUE */
- 643, /* GL_INDEX_WRITEMASK */
+ 1304, /* GL_READ_BUFFER */
+ 1418, /* GL_SCISSOR_BOX */
+ 1419, /* GL_SCISSOR_TEST */
+ 639, /* GL_INDEX_CLEAR_VALUE */
+ 644, /* GL_INDEX_WRITEMASK */
188, /* GL_COLOR_CLEAR_VALUE */
230, /* GL_COLOR_WRITEMASK */
- 640, /* GL_INDEX_MODE */
- 1383, /* GL_RGBA_MODE */
+ 641, /* GL_INDEX_MODE */
+ 1384, /* GL_RGBA_MODE */
393, /* GL_DOUBLEBUFFER */
- 1538, /* GL_STEREO */
- 1341, /* GL_RENDER_MODE */
- 1111, /* GL_PERSPECTIVE_CORRECTION_HINT */
- 1164, /* GL_POINT_SMOOTH_HINT */
- 706, /* GL_LINE_SMOOTH_HINT */
- 1181, /* GL_POLYGON_SMOOTH_HINT */
+ 1539, /* GL_STEREO */
+ 1342, /* GL_RENDER_MODE */
+ 1112, /* GL_PERSPECTIVE_CORRECTION_HINT */
+ 1165, /* GL_POINT_SMOOTH_HINT */
+ 707, /* GL_LINE_SMOOTH_HINT */
+ 1182, /* GL_POLYGON_SMOOTH_HINT */
529, /* GL_FOG_HINT */
- 1708, /* GL_TEXTURE_GEN_S */
- 1709, /* GL_TEXTURE_GEN_T */
- 1707, /* GL_TEXTURE_GEN_R */
- 1706, /* GL_TEXTURE_GEN_Q */
- 1124, /* GL_PIXEL_MAP_I_TO_I */
- 1130, /* GL_PIXEL_MAP_S_TO_S */
- 1126, /* GL_PIXEL_MAP_I_TO_R */
- 1122, /* GL_PIXEL_MAP_I_TO_G */
- 1120, /* GL_PIXEL_MAP_I_TO_B */
- 1118, /* GL_PIXEL_MAP_I_TO_A */
- 1128, /* GL_PIXEL_MAP_R_TO_R */
- 1116, /* GL_PIXEL_MAP_G_TO_G */
- 1114, /* GL_PIXEL_MAP_B_TO_B */
- 1112, /* GL_PIXEL_MAP_A_TO_A */
- 1125, /* GL_PIXEL_MAP_I_TO_I_SIZE */
- 1131, /* GL_PIXEL_MAP_S_TO_S_SIZE */
- 1127, /* GL_PIXEL_MAP_I_TO_R_SIZE */
- 1123, /* GL_PIXEL_MAP_I_TO_G_SIZE */
- 1121, /* GL_PIXEL_MAP_I_TO_B_SIZE */
- 1119, /* GL_PIXEL_MAP_I_TO_A_SIZE */
- 1129, /* GL_PIXEL_MAP_R_TO_R_SIZE */
- 1117, /* GL_PIXEL_MAP_G_TO_G_SIZE */
- 1115, /* GL_PIXEL_MAP_B_TO_B_SIZE */
- 1113, /* GL_PIXEL_MAP_A_TO_A_SIZE */
- 1781, /* GL_UNPACK_SWAP_BYTES */
- 1776, /* GL_UNPACK_LSB_FIRST */
- 1777, /* GL_UNPACK_ROW_LENGTH */
- 1780, /* GL_UNPACK_SKIP_ROWS */
- 1779, /* GL_UNPACK_SKIP_PIXELS */
- 1774, /* GL_UNPACK_ALIGNMENT */
- 1099, /* GL_PACK_SWAP_BYTES */
- 1094, /* GL_PACK_LSB_FIRST */
- 1095, /* GL_PACK_ROW_LENGTH */
- 1098, /* GL_PACK_SKIP_ROWS */
- 1097, /* GL_PACK_SKIP_PIXELS */
- 1091, /* GL_PACK_ALIGNMENT */
- 800, /* GL_MAP_COLOR */
- 805, /* GL_MAP_STENCIL */
- 642, /* GL_INDEX_SHIFT */
- 641, /* GL_INDEX_OFFSET */
- 1317, /* GL_RED_SCALE */
- 1315, /* GL_RED_BIAS */
- 1882, /* GL_ZOOM_X */
- 1883, /* GL_ZOOM_Y */
+ 1709, /* GL_TEXTURE_GEN_S */
+ 1710, /* GL_TEXTURE_GEN_T */
+ 1708, /* GL_TEXTURE_GEN_R */
+ 1707, /* GL_TEXTURE_GEN_Q */
+ 1125, /* GL_PIXEL_MAP_I_TO_I */
+ 1131, /* GL_PIXEL_MAP_S_TO_S */
+ 1127, /* GL_PIXEL_MAP_I_TO_R */
+ 1123, /* GL_PIXEL_MAP_I_TO_G */
+ 1121, /* GL_PIXEL_MAP_I_TO_B */
+ 1119, /* GL_PIXEL_MAP_I_TO_A */
+ 1129, /* GL_PIXEL_MAP_R_TO_R */
+ 1117, /* GL_PIXEL_MAP_G_TO_G */
+ 1115, /* GL_PIXEL_MAP_B_TO_B */
+ 1113, /* GL_PIXEL_MAP_A_TO_A */
+ 1126, /* GL_PIXEL_MAP_I_TO_I_SIZE */
+ 1132, /* GL_PIXEL_MAP_S_TO_S_SIZE */
+ 1128, /* GL_PIXEL_MAP_I_TO_R_SIZE */
+ 1124, /* GL_PIXEL_MAP_I_TO_G_SIZE */
+ 1122, /* GL_PIXEL_MAP_I_TO_B_SIZE */
+ 1120, /* GL_PIXEL_MAP_I_TO_A_SIZE */
+ 1130, /* GL_PIXEL_MAP_R_TO_R_SIZE */
+ 1118, /* GL_PIXEL_MAP_G_TO_G_SIZE */
+ 1116, /* GL_PIXEL_MAP_B_TO_B_SIZE */
+ 1114, /* GL_PIXEL_MAP_A_TO_A_SIZE */
+ 1782, /* GL_UNPACK_SWAP_BYTES */
+ 1777, /* GL_UNPACK_LSB_FIRST */
+ 1778, /* GL_UNPACK_ROW_LENGTH */
+ 1781, /* GL_UNPACK_SKIP_ROWS */
+ 1780, /* GL_UNPACK_SKIP_PIXELS */
+ 1775, /* GL_UNPACK_ALIGNMENT */
+ 1100, /* GL_PACK_SWAP_BYTES */
+ 1095, /* GL_PACK_LSB_FIRST */
+ 1096, /* GL_PACK_ROW_LENGTH */
+ 1099, /* GL_PACK_SKIP_ROWS */
+ 1098, /* GL_PACK_SKIP_PIXELS */
+ 1092, /* GL_PACK_ALIGNMENT */
+ 801, /* GL_MAP_COLOR */
+ 806, /* GL_MAP_STENCIL */
+ 643, /* GL_INDEX_SHIFT */
+ 642, /* GL_INDEX_OFFSET */
+ 1318, /* GL_RED_SCALE */
+ 1316, /* GL_RED_BIAS */
+ 1883, /* GL_ZOOM_X */
+ 1884, /* GL_ZOOM_Y */
603, /* GL_GREEN_SCALE */
601, /* GL_GREEN_BIAS */
93, /* GL_BLUE_SCALE */
@@ -4042,375 +4044,376 @@ static const unsigned reduced_enums[1350] =
40, /* GL_ALPHA_BIAS */
371, /* GL_DEPTH_SCALE */
351, /* GL_DEPTH_BIAS */
- 880, /* GL_MAX_EVAL_ORDER */
- 884, /* GL_MAX_LIGHTS */
- 862, /* GL_MAX_CLIP_PLANES */
- 932, /* GL_MAX_TEXTURE_SIZE */
- 890, /* GL_MAX_PIXEL_MAP_TABLE */
- 858, /* GL_MAX_ATTRIB_STACK_DEPTH */
- 887, /* GL_MAX_MODELVIEW_STACK_DEPTH */
- 888, /* GL_MAX_NAME_STACK_DEPTH */
- 916, /* GL_MAX_PROJECTION_STACK_DEPTH */
- 933, /* GL_MAX_TEXTURE_STACK_DEPTH */
- 947, /* GL_MAX_VIEWPORT_DIMS */
- 859, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */
- 1548, /* GL_SUBPIXEL_BITS */
- 637, /* GL_INDEX_BITS */
- 1316, /* GL_RED_BITS */
+ 881, /* GL_MAX_EVAL_ORDER */
+ 885, /* GL_MAX_LIGHTS */
+ 863, /* GL_MAX_CLIP_PLANES */
+ 933, /* GL_MAX_TEXTURE_SIZE */
+ 891, /* GL_MAX_PIXEL_MAP_TABLE */
+ 859, /* GL_MAX_ATTRIB_STACK_DEPTH */
+ 888, /* GL_MAX_MODELVIEW_STACK_DEPTH */
+ 889, /* GL_MAX_NAME_STACK_DEPTH */
+ 917, /* GL_MAX_PROJECTION_STACK_DEPTH */
+ 934, /* GL_MAX_TEXTURE_STACK_DEPTH */
+ 948, /* GL_MAX_VIEWPORT_DIMS */
+ 860, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */
+ 1549, /* GL_SUBPIXEL_BITS */
+ 638, /* GL_INDEX_BITS */
+ 1317, /* GL_RED_BITS */
602, /* GL_GREEN_BITS */
92, /* GL_BLUE_BITS */
41, /* GL_ALPHA_BITS */
352, /* GL_DEPTH_BITS */
- 1516, /* GL_STENCIL_BITS */
+ 1517, /* GL_STENCIL_BITS */
14, /* GL_ACCUM_RED_BITS */
13, /* GL_ACCUM_GREEN_BITS */
10, /* GL_ACCUM_BLUE_BITS */
9, /* GL_ACCUM_ALPHA_BITS */
- 1013, /* GL_NAME_STACK_DEPTH */
+ 1014, /* GL_NAME_STACK_DEPTH */
62, /* GL_AUTO_NORMAL */
- 746, /* GL_MAP1_COLOR_4 */
- 749, /* GL_MAP1_INDEX */
- 750, /* GL_MAP1_NORMAL */
- 751, /* GL_MAP1_TEXTURE_COORD_1 */
- 752, /* GL_MAP1_TEXTURE_COORD_2 */
- 753, /* GL_MAP1_TEXTURE_COORD_3 */
- 754, /* GL_MAP1_TEXTURE_COORD_4 */
- 755, /* GL_MAP1_VERTEX_3 */
- 756, /* GL_MAP1_VERTEX_4 */
- 773, /* GL_MAP2_COLOR_4 */
- 776, /* GL_MAP2_INDEX */
- 777, /* GL_MAP2_NORMAL */
- 778, /* GL_MAP2_TEXTURE_COORD_1 */
- 779, /* GL_MAP2_TEXTURE_COORD_2 */
- 780, /* GL_MAP2_TEXTURE_COORD_3 */
- 781, /* GL_MAP2_TEXTURE_COORD_4 */
- 782, /* GL_MAP2_VERTEX_3 */
- 783, /* GL_MAP2_VERTEX_4 */
- 747, /* GL_MAP1_GRID_DOMAIN */
- 748, /* GL_MAP1_GRID_SEGMENTS */
- 774, /* GL_MAP2_GRID_DOMAIN */
- 775, /* GL_MAP2_GRID_SEGMENTS */
- 1631, /* GL_TEXTURE_1D */
- 1633, /* GL_TEXTURE_2D */
+ 747, /* GL_MAP1_COLOR_4 */
+ 750, /* GL_MAP1_INDEX */
+ 751, /* GL_MAP1_NORMAL */
+ 752, /* GL_MAP1_TEXTURE_COORD_1 */
+ 753, /* GL_MAP1_TEXTURE_COORD_2 */
+ 754, /* GL_MAP1_TEXTURE_COORD_3 */
+ 755, /* GL_MAP1_TEXTURE_COORD_4 */
+ 756, /* GL_MAP1_VERTEX_3 */
+ 757, /* GL_MAP1_VERTEX_4 */
+ 774, /* GL_MAP2_COLOR_4 */
+ 777, /* GL_MAP2_INDEX */
+ 778, /* GL_MAP2_NORMAL */
+ 779, /* GL_MAP2_TEXTURE_COORD_1 */
+ 780, /* GL_MAP2_TEXTURE_COORD_2 */
+ 781, /* GL_MAP2_TEXTURE_COORD_3 */
+ 782, /* GL_MAP2_TEXTURE_COORD_4 */
+ 783, /* GL_MAP2_VERTEX_3 */
+ 784, /* GL_MAP2_VERTEX_4 */
+ 748, /* GL_MAP1_GRID_DOMAIN */
+ 749, /* GL_MAP1_GRID_SEGMENTS */
+ 775, /* GL_MAP2_GRID_DOMAIN */
+ 776, /* GL_MAP2_GRID_SEGMENTS */
+ 1632, /* GL_TEXTURE_1D */
+ 1634, /* GL_TEXTURE_2D */
482, /* GL_FEEDBACK_BUFFER_POINTER */
483, /* GL_FEEDBACK_BUFFER_SIZE */
484, /* GL_FEEDBACK_BUFFER_TYPE */
- 1427, /* GL_SELECTION_BUFFER_POINTER */
- 1428, /* GL_SELECTION_BUFFER_SIZE */
- 1750, /* GL_TEXTURE_WIDTH */
- 1713, /* GL_TEXTURE_HEIGHT */
- 1668, /* GL_TEXTURE_COMPONENTS */
- 1652, /* GL_TEXTURE_BORDER_COLOR */
- 1651, /* GL_TEXTURE_BORDER */
+ 1428, /* GL_SELECTION_BUFFER_POINTER */
+ 1429, /* GL_SELECTION_BUFFER_SIZE */
+ 1751, /* GL_TEXTURE_WIDTH */
+ 1714, /* GL_TEXTURE_HEIGHT */
+ 1669, /* GL_TEXTURE_COMPONENTS */
+ 1653, /* GL_TEXTURE_BORDER_COLOR */
+ 1652, /* GL_TEXTURE_BORDER */
385, /* GL_DONT_CARE */
480, /* GL_FASTEST */
- 1021, /* GL_NICEST */
+ 1022, /* GL_NICEST */
48, /* GL_AMBIENT */
382, /* GL_DIFFUSE */
- 1476, /* GL_SPECULAR */
- 1185, /* GL_POSITION */
- 1479, /* GL_SPOT_DIRECTION */
- 1480, /* GL_SPOT_EXPONENT */
- 1478, /* GL_SPOT_CUTOFF */
+ 1477, /* GL_SPECULAR */
+ 1186, /* GL_POSITION */
+ 1480, /* GL_SPOT_DIRECTION */
+ 1481, /* GL_SPOT_EXPONENT */
+ 1479, /* GL_SPOT_CUTOFF */
275, /* GL_CONSTANT_ATTENUATION */
- 696, /* GL_LINEAR_ATTENUATION */
- 1284, /* GL_QUADRATIC_ATTENUATION */
+ 697, /* GL_LINEAR_ATTENUATION */
+ 1285, /* GL_QUADRATIC_ATTENUATION */
244, /* GL_COMPILE */
245, /* GL_COMPILE_AND_EXECUTE */
120, /* GL_BYTE */
- 1783, /* GL_UNSIGNED_BYTE */
- 1441, /* GL_SHORT */
- 1795, /* GL_UNSIGNED_SHORT */
- 645, /* GL_INT */
- 1786, /* GL_UNSIGNED_INT */
+ 1784, /* GL_UNSIGNED_BYTE */
+ 1442, /* GL_SHORT */
+ 1796, /* GL_UNSIGNED_SHORT */
+ 646, /* GL_INT */
+ 1787, /* GL_UNSIGNED_INT */
489, /* GL_FLOAT */
1, /* GL_2_BYTES */
5, /* GL_3_BYTES */
7, /* GL_4_BYTES */
392, /* GL_DOUBLE */
+ 604, /* GL_HALF_FLOAT */
132, /* GL_CLEAR */
50, /* GL_AND */
52, /* GL_AND_REVERSE */
299, /* GL_COPY */
51, /* GL_AND_INVERTED */
- 1023, /* GL_NOOP */
- 1878, /* GL_XOR */
- 1086, /* GL_OR */
- 1024, /* GL_NOR */
+ 1024, /* GL_NOOP */
+ 1879, /* GL_XOR */
+ 1087, /* GL_OR */
+ 1025, /* GL_NOR */
470, /* GL_EQUIV */
- 672, /* GL_INVERT */
- 1089, /* GL_OR_REVERSE */
+ 673, /* GL_INVERT */
+ 1090, /* GL_OR_REVERSE */
300, /* GL_COPY_INVERTED */
- 1088, /* GL_OR_INVERTED */
- 1014, /* GL_NAND */
- 1432, /* GL_SET */
+ 1089, /* GL_OR_INVERTED */
+ 1015, /* GL_NAND */
+ 1433, /* GL_SET */
467, /* GL_EMISSION */
- 1440, /* GL_SHININESS */
+ 1441, /* GL_SHININESS */
49, /* GL_AMBIENT_AND_DIFFUSE */
190, /* GL_COLOR_INDEXES */
- 964, /* GL_MODELVIEW */
- 1261, /* GL_PROJECTION */
- 1566, /* GL_TEXTURE */
+ 965, /* GL_MODELVIEW */
+ 1262, /* GL_PROJECTION */
+ 1567, /* GL_TEXTURE */
147, /* GL_COLOR */
346, /* GL_DEPTH */
- 1502, /* GL_STENCIL */
+ 1503, /* GL_STENCIL */
189, /* GL_COLOR_INDEX */
- 1521, /* GL_STENCIL_INDEX */
+ 1522, /* GL_STENCIL_INDEX */
359, /* GL_DEPTH_COMPONENT */
- 1312, /* GL_RED */
+ 1313, /* GL_RED */
600, /* GL_GREEN */
90, /* GL_BLUE */
31, /* GL_ALPHA */
- 1349, /* GL_RGB */
- 1368, /* GL_RGBA */
- 724, /* GL_LUMINANCE */
- 745, /* GL_LUMINANCE_ALPHA */
+ 1350, /* GL_RGB */
+ 1369, /* GL_RGBA */
+ 725, /* GL_LUMINANCE */
+ 746, /* GL_LUMINANCE_ALPHA */
73, /* GL_BITMAP */
- 1141, /* GL_POINT */
- 694, /* GL_LINE */
+ 1142, /* GL_POINT */
+ 695, /* GL_LINE */
485, /* GL_FILL */
- 1321, /* GL_RENDER */
+ 1322, /* GL_RENDER */
481, /* GL_FEEDBACK */
- 1426, /* GL_SELECT */
+ 1427, /* GL_SELECT */
488, /* GL_FLAT */
- 1451, /* GL_SMOOTH */
- 673, /* GL_KEEP */
- 1343, /* GL_REPLACE */
- 627, /* GL_INCR */
+ 1452, /* GL_SMOOTH */
+ 674, /* GL_KEEP */
+ 1344, /* GL_REPLACE */
+ 628, /* GL_INCR */
342, /* GL_DECR */
- 1810, /* GL_VENDOR */
- 1340, /* GL_RENDERER */
- 1811, /* GL_VERSION */
+ 1811, /* GL_VENDOR */
+ 1341, /* GL_RENDERER */
+ 1812, /* GL_VERSION */
474, /* GL_EXTENSIONS */
- 1391, /* GL_S */
- 1557, /* GL_T */
- 1300, /* GL_R */
- 1283, /* GL_Q */
- 1000, /* GL_MODULATE */
+ 1392, /* GL_S */
+ 1558, /* GL_T */
+ 1301, /* GL_R */
+ 1284, /* GL_Q */
+ 1001, /* GL_MODULATE */
341, /* GL_DECAL */
- 1703, /* GL_TEXTURE_ENV_MODE */
- 1702, /* GL_TEXTURE_ENV_COLOR */
- 1701, /* GL_TEXTURE_ENV */
+ 1704, /* GL_TEXTURE_ENV_MODE */
+ 1703, /* GL_TEXTURE_ENV_COLOR */
+ 1702, /* GL_TEXTURE_ENV */
475, /* GL_EYE_LINEAR */
- 1047, /* GL_OBJECT_LINEAR */
- 1477, /* GL_SPHERE_MAP */
- 1705, /* GL_TEXTURE_GEN_MODE */
- 1049, /* GL_OBJECT_PLANE */
+ 1048, /* GL_OBJECT_LINEAR */
+ 1478, /* GL_SPHERE_MAP */
+ 1706, /* GL_TEXTURE_GEN_MODE */
+ 1050, /* GL_OBJECT_PLANE */
476, /* GL_EYE_PLANE */
- 1015, /* GL_NEAREST */
- 695, /* GL_LINEAR */
- 1019, /* GL_NEAREST_MIPMAP_NEAREST */
- 700, /* GL_LINEAR_MIPMAP_NEAREST */
- 1018, /* GL_NEAREST_MIPMAP_LINEAR */
- 699, /* GL_LINEAR_MIPMAP_LINEAR */
- 1726, /* GL_TEXTURE_MAG_FILTER */
- 1734, /* GL_TEXTURE_MIN_FILTER */
- 1752, /* GL_TEXTURE_WRAP_S */
- 1753, /* GL_TEXTURE_WRAP_T */
+ 1016, /* GL_NEAREST */
+ 696, /* GL_LINEAR */
+ 1020, /* GL_NEAREST_MIPMAP_NEAREST */
+ 701, /* GL_LINEAR_MIPMAP_NEAREST */
+ 1019, /* GL_NEAREST_MIPMAP_LINEAR */
+ 700, /* GL_LINEAR_MIPMAP_LINEAR */
+ 1727, /* GL_TEXTURE_MAG_FILTER */
+ 1735, /* GL_TEXTURE_MIN_FILTER */
+ 1753, /* GL_TEXTURE_WRAP_S */
+ 1754, /* GL_TEXTURE_WRAP_T */
126, /* GL_CLAMP */
- 1342, /* GL_REPEAT */
- 1179, /* GL_POLYGON_OFFSET_UNITS */
- 1178, /* GL_POLYGON_OFFSET_POINT */
- 1177, /* GL_POLYGON_OFFSET_LINE */
- 1301, /* GL_R3_G3_B2 */
- 1807, /* GL_V2F */
- 1808, /* GL_V3F */
+ 1343, /* GL_REPEAT */
+ 1180, /* GL_POLYGON_OFFSET_UNITS */
+ 1179, /* GL_POLYGON_OFFSET_POINT */
+ 1178, /* GL_POLYGON_OFFSET_LINE */
+ 1302, /* GL_R3_G3_B2 */
+ 1808, /* GL_V2F */
+ 1809, /* GL_V3F */
123, /* GL_C4UB_V2F */
124, /* GL_C4UB_V3F */
121, /* GL_C3F_V3F */
- 1012, /* GL_N3F_V3F */
+ 1013, /* GL_N3F_V3F */
122, /* GL_C4F_N3F_V3F */
- 1562, /* GL_T2F_V3F */
- 1564, /* GL_T4F_V4F */
- 1560, /* GL_T2F_C4UB_V3F */
- 1558, /* GL_T2F_C3F_V3F */
- 1561, /* GL_T2F_N3F_V3F */
- 1559, /* GL_T2F_C4F_N3F_V3F */
- 1563, /* GL_T4F_C4F_N3F_V4F */
+ 1563, /* GL_T2F_V3F */
+ 1565, /* GL_T4F_V4F */
+ 1561, /* GL_T2F_C4UB_V3F */
+ 1559, /* GL_T2F_C3F_V3F */
+ 1562, /* GL_T2F_N3F_V3F */
+ 1560, /* GL_T2F_C4F_N3F_V3F */
+ 1564, /* GL_T4F_C4F_N3F_V4F */
139, /* GL_CLIP_PLANE0 */
140, /* GL_CLIP_PLANE1 */
141, /* GL_CLIP_PLANE2 */
142, /* GL_CLIP_PLANE3 */
143, /* GL_CLIP_PLANE4 */
144, /* GL_CLIP_PLANE5 */
- 679, /* GL_LIGHT0 */
- 680, /* GL_LIGHT1 */
- 681, /* GL_LIGHT2 */
- 682, /* GL_LIGHT3 */
- 683, /* GL_LIGHT4 */
- 684, /* GL_LIGHT5 */
- 685, /* GL_LIGHT6 */
- 686, /* GL_LIGHT7 */
- 604, /* GL_HINT_BIT */
+ 680, /* GL_LIGHT0 */
+ 681, /* GL_LIGHT1 */
+ 682, /* GL_LIGHT2 */
+ 683, /* GL_LIGHT3 */
+ 684, /* GL_LIGHT4 */
+ 685, /* GL_LIGHT5 */
+ 686, /* GL_LIGHT6 */
+ 687, /* GL_LIGHT7 */
+ 605, /* GL_HINT_BIT */
277, /* GL_CONSTANT_COLOR */
- 1060, /* GL_ONE_MINUS_CONSTANT_COLOR */
+ 1061, /* GL_ONE_MINUS_CONSTANT_COLOR */
272, /* GL_CONSTANT_ALPHA */
- 1058, /* GL_ONE_MINUS_CONSTANT_ALPHA */
+ 1059, /* GL_ONE_MINUS_CONSTANT_ALPHA */
76, /* GL_BLEND_COLOR */
588, /* GL_FUNC_ADD */
- 948, /* GL_MIN */
- 855, /* GL_MAX */
+ 949, /* GL_MIN */
+ 856, /* GL_MAX */
81, /* GL_BLEND_EQUATION */
592, /* GL_FUNC_SUBTRACT */
590, /* GL_FUNC_REVERSE_SUBTRACT */
280, /* GL_CONVOLUTION_1D */
281, /* GL_CONVOLUTION_2D */
- 1429, /* GL_SEPARABLE_2D */
+ 1430, /* GL_SEPARABLE_2D */
284, /* GL_CONVOLUTION_BORDER_MODE */
288, /* GL_CONVOLUTION_FILTER_SCALE */
286, /* GL_CONVOLUTION_FILTER_BIAS */
- 1313, /* GL_REDUCE */
+ 1314, /* GL_REDUCE */
290, /* GL_CONVOLUTION_FORMAT */
294, /* GL_CONVOLUTION_WIDTH */
292, /* GL_CONVOLUTION_HEIGHT */
- 871, /* GL_MAX_CONVOLUTION_WIDTH */
- 869, /* GL_MAX_CONVOLUTION_HEIGHT */
- 1218, /* GL_POST_CONVOLUTION_RED_SCALE */
- 1214, /* GL_POST_CONVOLUTION_GREEN_SCALE */
- 1209, /* GL_POST_CONVOLUTION_BLUE_SCALE */
- 1205, /* GL_POST_CONVOLUTION_ALPHA_SCALE */
- 1216, /* GL_POST_CONVOLUTION_RED_BIAS */
- 1212, /* GL_POST_CONVOLUTION_GREEN_BIAS */
- 1207, /* GL_POST_CONVOLUTION_BLUE_BIAS */
- 1203, /* GL_POST_CONVOLUTION_ALPHA_BIAS */
- 605, /* GL_HISTOGRAM */
- 1267, /* GL_PROXY_HISTOGRAM */
- 621, /* GL_HISTOGRAM_WIDTH */
- 611, /* GL_HISTOGRAM_FORMAT */
- 617, /* GL_HISTOGRAM_RED_SIZE */
- 613, /* GL_HISTOGRAM_GREEN_SIZE */
- 608, /* GL_HISTOGRAM_BLUE_SIZE */
- 606, /* GL_HISTOGRAM_ALPHA_SIZE */
- 615, /* GL_HISTOGRAM_LUMINANCE_SIZE */
- 619, /* GL_HISTOGRAM_SINK */
- 949, /* GL_MINMAX */
- 951, /* GL_MINMAX_FORMAT */
- 953, /* GL_MINMAX_SINK */
- 1565, /* GL_TABLE_TOO_LARGE_EXT */
- 1785, /* GL_UNSIGNED_BYTE_3_3_2 */
- 1797, /* GL_UNSIGNED_SHORT_4_4_4_4 */
- 1799, /* GL_UNSIGNED_SHORT_5_5_5_1 */
- 1792, /* GL_UNSIGNED_INT_8_8_8_8 */
- 1787, /* GL_UNSIGNED_INT_10_10_10_2 */
- 1176, /* GL_POLYGON_OFFSET_FILL */
- 1175, /* GL_POLYGON_OFFSET_FACTOR */
- 1174, /* GL_POLYGON_OFFSET_BIAS */
- 1346, /* GL_RESCALE_NORMAL */
+ 872, /* GL_MAX_CONVOLUTION_WIDTH */
+ 870, /* GL_MAX_CONVOLUTION_HEIGHT */
+ 1219, /* GL_POST_CONVOLUTION_RED_SCALE */
+ 1215, /* GL_POST_CONVOLUTION_GREEN_SCALE */
+ 1210, /* GL_POST_CONVOLUTION_BLUE_SCALE */
+ 1206, /* GL_POST_CONVOLUTION_ALPHA_SCALE */
+ 1217, /* GL_POST_CONVOLUTION_RED_BIAS */
+ 1213, /* GL_POST_CONVOLUTION_GREEN_BIAS */
+ 1208, /* GL_POST_CONVOLUTION_BLUE_BIAS */
+ 1204, /* GL_POST_CONVOLUTION_ALPHA_BIAS */
+ 606, /* GL_HISTOGRAM */
+ 1268, /* GL_PROXY_HISTOGRAM */
+ 622, /* GL_HISTOGRAM_WIDTH */
+ 612, /* GL_HISTOGRAM_FORMAT */
+ 618, /* GL_HISTOGRAM_RED_SIZE */
+ 614, /* GL_HISTOGRAM_GREEN_SIZE */
+ 609, /* GL_HISTOGRAM_BLUE_SIZE */
+ 607, /* GL_HISTOGRAM_ALPHA_SIZE */
+ 616, /* GL_HISTOGRAM_LUMINANCE_SIZE */
+ 620, /* GL_HISTOGRAM_SINK */
+ 950, /* GL_MINMAX */
+ 952, /* GL_MINMAX_FORMAT */
+ 954, /* GL_MINMAX_SINK */
+ 1566, /* GL_TABLE_TOO_LARGE_EXT */
+ 1786, /* GL_UNSIGNED_BYTE_3_3_2 */
+ 1798, /* GL_UNSIGNED_SHORT_4_4_4_4 */
+ 1800, /* GL_UNSIGNED_SHORT_5_5_5_1 */
+ 1793, /* GL_UNSIGNED_INT_8_8_8_8 */
+ 1788, /* GL_UNSIGNED_INT_10_10_10_2 */
+ 1177, /* GL_POLYGON_OFFSET_FILL */
+ 1176, /* GL_POLYGON_OFFSET_FACTOR */
+ 1175, /* GL_POLYGON_OFFSET_BIAS */
+ 1347, /* GL_RESCALE_NORMAL */
36, /* GL_ALPHA4 */
38, /* GL_ALPHA8 */
32, /* GL_ALPHA12 */
34, /* GL_ALPHA16 */
- 735, /* GL_LUMINANCE4 */
- 741, /* GL_LUMINANCE8 */
- 725, /* GL_LUMINANCE12 */
- 731, /* GL_LUMINANCE16 */
- 736, /* GL_LUMINANCE4_ALPHA4 */
- 739, /* GL_LUMINANCE6_ALPHA2 */
- 742, /* GL_LUMINANCE8_ALPHA8 */
- 728, /* GL_LUMINANCE12_ALPHA4 */
- 726, /* GL_LUMINANCE12_ALPHA12 */
- 732, /* GL_LUMINANCE16_ALPHA16 */
- 646, /* GL_INTENSITY */
- 651, /* GL_INTENSITY4 */
- 653, /* GL_INTENSITY8 */
- 647, /* GL_INTENSITY12 */
- 649, /* GL_INTENSITY16 */
- 1358, /* GL_RGB2_EXT */
- 1359, /* GL_RGB4 */
- 1362, /* GL_RGB5 */
- 1366, /* GL_RGB8 */
- 1350, /* GL_RGB10 */
- 1354, /* GL_RGB12 */
- 1356, /* GL_RGB16 */
- 1373, /* GL_RGBA2 */
- 1375, /* GL_RGBA4 */
- 1363, /* GL_RGB5_A1 */
- 1379, /* GL_RGBA8 */
- 1351, /* GL_RGB10_A2 */
- 1369, /* GL_RGBA12 */
- 1371, /* GL_RGBA16 */
- 1741, /* GL_TEXTURE_RED_SIZE */
- 1711, /* GL_TEXTURE_GREEN_SIZE */
- 1649, /* GL_TEXTURE_BLUE_SIZE */
- 1636, /* GL_TEXTURE_ALPHA_SIZE */
- 1724, /* GL_TEXTURE_LUMINANCE_SIZE */
- 1715, /* GL_TEXTURE_INTENSITY_SIZE */
- 1344, /* GL_REPLACE_EXT */
- 1271, /* GL_PROXY_TEXTURE_1D */
- 1274, /* GL_PROXY_TEXTURE_2D */
- 1748, /* GL_TEXTURE_TOO_LARGE_EXT */
- 1736, /* GL_TEXTURE_PRIORITY */
- 1743, /* GL_TEXTURE_RESIDENT */
- 1639, /* GL_TEXTURE_BINDING_1D */
- 1641, /* GL_TEXTURE_BINDING_2D */
- 1643, /* GL_TEXTURE_BINDING_3D */
- 1096, /* GL_PACK_SKIP_IMAGES */
- 1092, /* GL_PACK_IMAGE_HEIGHT */
- 1778, /* GL_UNPACK_SKIP_IMAGES */
- 1775, /* GL_UNPACK_IMAGE_HEIGHT */
- 1635, /* GL_TEXTURE_3D */
- 1277, /* GL_PROXY_TEXTURE_3D */
- 1698, /* GL_TEXTURE_DEPTH */
- 1751, /* GL_TEXTURE_WRAP_R */
- 856, /* GL_MAX_3D_TEXTURE_SIZE */
- 1812, /* GL_VERTEX_ARRAY */
- 1026, /* GL_NORMAL_ARRAY */
+ 736, /* GL_LUMINANCE4 */
+ 742, /* GL_LUMINANCE8 */
+ 726, /* GL_LUMINANCE12 */
+ 732, /* GL_LUMINANCE16 */
+ 737, /* GL_LUMINANCE4_ALPHA4 */
+ 740, /* GL_LUMINANCE6_ALPHA2 */
+ 743, /* GL_LUMINANCE8_ALPHA8 */
+ 729, /* GL_LUMINANCE12_ALPHA4 */
+ 727, /* GL_LUMINANCE12_ALPHA12 */
+ 733, /* GL_LUMINANCE16_ALPHA16 */
+ 647, /* GL_INTENSITY */
+ 652, /* GL_INTENSITY4 */
+ 654, /* GL_INTENSITY8 */
+ 648, /* GL_INTENSITY12 */
+ 650, /* GL_INTENSITY16 */
+ 1359, /* GL_RGB2_EXT */
+ 1360, /* GL_RGB4 */
+ 1363, /* GL_RGB5 */
+ 1367, /* GL_RGB8 */
+ 1351, /* GL_RGB10 */
+ 1355, /* GL_RGB12 */
+ 1357, /* GL_RGB16 */
+ 1374, /* GL_RGBA2 */
+ 1376, /* GL_RGBA4 */
+ 1364, /* GL_RGB5_A1 */
+ 1380, /* GL_RGBA8 */
+ 1352, /* GL_RGB10_A2 */
+ 1370, /* GL_RGBA12 */
+ 1372, /* GL_RGBA16 */
+ 1742, /* GL_TEXTURE_RED_SIZE */
+ 1712, /* GL_TEXTURE_GREEN_SIZE */
+ 1650, /* GL_TEXTURE_BLUE_SIZE */
+ 1637, /* GL_TEXTURE_ALPHA_SIZE */
+ 1725, /* GL_TEXTURE_LUMINANCE_SIZE */
+ 1716, /* GL_TEXTURE_INTENSITY_SIZE */
+ 1345, /* GL_REPLACE_EXT */
+ 1272, /* GL_PROXY_TEXTURE_1D */
+ 1275, /* GL_PROXY_TEXTURE_2D */
+ 1749, /* GL_TEXTURE_TOO_LARGE_EXT */
+ 1737, /* GL_TEXTURE_PRIORITY */
+ 1744, /* GL_TEXTURE_RESIDENT */
+ 1640, /* GL_TEXTURE_BINDING_1D */
+ 1642, /* GL_TEXTURE_BINDING_2D */
+ 1644, /* GL_TEXTURE_BINDING_3D */
+ 1097, /* GL_PACK_SKIP_IMAGES */
+ 1093, /* GL_PACK_IMAGE_HEIGHT */
+ 1779, /* GL_UNPACK_SKIP_IMAGES */
+ 1776, /* GL_UNPACK_IMAGE_HEIGHT */
+ 1636, /* GL_TEXTURE_3D */
+ 1278, /* GL_PROXY_TEXTURE_3D */
+ 1699, /* GL_TEXTURE_DEPTH */
+ 1752, /* GL_TEXTURE_WRAP_R */
+ 857, /* GL_MAX_3D_TEXTURE_SIZE */
+ 1813, /* GL_VERTEX_ARRAY */
+ 1027, /* GL_NORMAL_ARRAY */
148, /* GL_COLOR_ARRAY */
- 631, /* GL_INDEX_ARRAY */
- 1676, /* GL_TEXTURE_COORD_ARRAY */
+ 632, /* GL_INDEX_ARRAY */
+ 1677, /* GL_TEXTURE_COORD_ARRAY */
459, /* GL_EDGE_FLAG_ARRAY */
- 1818, /* GL_VERTEX_ARRAY_SIZE */
- 1820, /* GL_VERTEX_ARRAY_TYPE */
- 1819, /* GL_VERTEX_ARRAY_STRIDE */
- 1031, /* GL_NORMAL_ARRAY_TYPE */
- 1030, /* GL_NORMAL_ARRAY_STRIDE */
+ 1819, /* GL_VERTEX_ARRAY_SIZE */
+ 1821, /* GL_VERTEX_ARRAY_TYPE */
+ 1820, /* GL_VERTEX_ARRAY_STRIDE */
+ 1032, /* GL_NORMAL_ARRAY_TYPE */
+ 1031, /* GL_NORMAL_ARRAY_STRIDE */
152, /* GL_COLOR_ARRAY_SIZE */
154, /* GL_COLOR_ARRAY_TYPE */
153, /* GL_COLOR_ARRAY_STRIDE */
- 636, /* GL_INDEX_ARRAY_TYPE */
- 635, /* GL_INDEX_ARRAY_STRIDE */
- 1680, /* GL_TEXTURE_COORD_ARRAY_SIZE */
- 1682, /* GL_TEXTURE_COORD_ARRAY_TYPE */
- 1681, /* GL_TEXTURE_COORD_ARRAY_STRIDE */
+ 637, /* GL_INDEX_ARRAY_TYPE */
+ 636, /* GL_INDEX_ARRAY_STRIDE */
+ 1681, /* GL_TEXTURE_COORD_ARRAY_SIZE */
+ 1683, /* GL_TEXTURE_COORD_ARRAY_TYPE */
+ 1682, /* GL_TEXTURE_COORD_ARRAY_STRIDE */
463, /* GL_EDGE_FLAG_ARRAY_STRIDE */
- 1817, /* GL_VERTEX_ARRAY_POINTER */
- 1029, /* GL_NORMAL_ARRAY_POINTER */
+ 1818, /* GL_VERTEX_ARRAY_POINTER */
+ 1030, /* GL_NORMAL_ARRAY_POINTER */
151, /* GL_COLOR_ARRAY_POINTER */
- 634, /* GL_INDEX_ARRAY_POINTER */
- 1679, /* GL_TEXTURE_COORD_ARRAY_POINTER */
+ 635, /* GL_INDEX_ARRAY_POINTER */
+ 1680, /* GL_TEXTURE_COORD_ARRAY_POINTER */
462, /* GL_EDGE_FLAG_ARRAY_POINTER */
- 1005, /* GL_MULTISAMPLE */
- 1403, /* GL_SAMPLE_ALPHA_TO_COVERAGE */
- 1405, /* GL_SAMPLE_ALPHA_TO_ONE */
- 1410, /* GL_SAMPLE_COVERAGE */
- 1407, /* GL_SAMPLE_BUFFERS */
- 1398, /* GL_SAMPLES */
- 1414, /* GL_SAMPLE_COVERAGE_VALUE */
- 1412, /* GL_SAMPLE_COVERAGE_INVERT */
+ 1006, /* GL_MULTISAMPLE */
+ 1404, /* GL_SAMPLE_ALPHA_TO_COVERAGE */
+ 1406, /* GL_SAMPLE_ALPHA_TO_ONE */
+ 1411, /* GL_SAMPLE_COVERAGE */
+ 1408, /* GL_SAMPLE_BUFFERS */
+ 1399, /* GL_SAMPLES */
+ 1415, /* GL_SAMPLE_COVERAGE_VALUE */
+ 1413, /* GL_SAMPLE_COVERAGE_INVERT */
195, /* GL_COLOR_MATRIX */
197, /* GL_COLOR_MATRIX_STACK_DEPTH */
- 865, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */
- 1201, /* GL_POST_COLOR_MATRIX_RED_SCALE */
- 1197, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */
- 1192, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */
- 1188, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */
- 1199, /* GL_POST_COLOR_MATRIX_RED_BIAS */
- 1195, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */
- 1190, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */
- 1186, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */
- 1659, /* GL_TEXTURE_COLOR_TABLE_SGI */
- 1278, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */
- 1661, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
+ 866, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */
+ 1202, /* GL_POST_COLOR_MATRIX_RED_SCALE */
+ 1198, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */
+ 1193, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */
+ 1189, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */
+ 1200, /* GL_POST_COLOR_MATRIX_RED_BIAS */
+ 1196, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */
+ 1191, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */
+ 1187, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */
+ 1660, /* GL_TEXTURE_COLOR_TABLE_SGI */
+ 1279, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */
+ 1662, /* 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 */
201, /* GL_COLOR_TABLE */
- 1211, /* GL_POST_CONVOLUTION_COLOR_TABLE */
- 1194, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */
- 1266, /* GL_PROXY_COLOR_TABLE */
- 1270, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */
- 1269, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */
+ 1212, /* GL_POST_CONVOLUTION_COLOR_TABLE */
+ 1195, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */
+ 1267, /* GL_PROXY_COLOR_TABLE */
+ 1271, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */
+ 1270, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */
225, /* GL_COLOR_TABLE_SCALE */
205, /* GL_COLOR_TABLE_BIAS */
210, /* GL_COLOR_TABLE_FORMAT */
@@ -4423,62 +4426,62 @@ static const unsigned reduced_enums[1350] =
216, /* GL_COLOR_TABLE_INTENSITY_SIZE */
71, /* GL_BGR */
72, /* GL_BGRA */
- 879, /* GL_MAX_ELEMENTS_VERTICES */
- 878, /* GL_MAX_ELEMENTS_INDICES */
- 1714, /* GL_TEXTURE_INDEX_SIZE_EXT */
+ 880, /* GL_MAX_ELEMENTS_VERTICES */
+ 879, /* GL_MAX_ELEMENTS_INDICES */
+ 1715, /* GL_TEXTURE_INDEX_SIZE_EXT */
145, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */
- 1158, /* GL_POINT_SIZE_MIN */
- 1154, /* GL_POINT_SIZE_MAX */
- 1148, /* GL_POINT_FADE_THRESHOLD_SIZE */
- 1144, /* GL_POINT_DISTANCE_ATTENUATION */
+ 1159, /* GL_POINT_SIZE_MIN */
+ 1155, /* GL_POINT_SIZE_MAX */
+ 1149, /* GL_POINT_FADE_THRESHOLD_SIZE */
+ 1145, /* GL_POINT_DISTANCE_ATTENUATION */
127, /* GL_CLAMP_TO_BORDER */
130, /* GL_CLAMP_TO_EDGE */
- 1735, /* GL_TEXTURE_MIN_LOD */
- 1733, /* GL_TEXTURE_MAX_LOD */
- 1638, /* GL_TEXTURE_BASE_LEVEL */
- 1732, /* GL_TEXTURE_MAX_LEVEL */
- 624, /* GL_IGNORE_BORDER_HP */
+ 1736, /* GL_TEXTURE_MIN_LOD */
+ 1734, /* GL_TEXTURE_MAX_LOD */
+ 1639, /* GL_TEXTURE_BASE_LEVEL */
+ 1733, /* GL_TEXTURE_MAX_LEVEL */
+ 625, /* GL_IGNORE_BORDER_HP */
276, /* GL_CONSTANT_BORDER_HP */
- 1345, /* GL_REPLICATE_BORDER_HP */
+ 1346, /* GL_REPLICATE_BORDER_HP */
282, /* GL_CONVOLUTION_BORDER_COLOR */
- 1055, /* GL_OCCLUSION_TEST_HP */
- 1056, /* GL_OCCLUSION_TEST_RESULT_HP */
- 697, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */
- 1653, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */
- 1655, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */
- 1657, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */
- 1658, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */
- 1656, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */
- 1654, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */
- 860, /* GL_MAX_CLIPMAP_DEPTH_SGIX */
- 861, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */
- 1221, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */
- 1223, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */
- 1220, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */
- 1222, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */
- 1722, /* GL_TEXTURE_LOD_BIAS_S_SGIX */
- 1723, /* GL_TEXTURE_LOD_BIAS_T_SGIX */
- 1721, /* GL_TEXTURE_LOD_BIAS_R_SGIX */
+ 1056, /* GL_OCCLUSION_TEST_HP */
+ 1057, /* GL_OCCLUSION_TEST_RESULT_HP */
+ 698, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */
+ 1654, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */
+ 1656, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */
+ 1658, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */
+ 1659, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */
+ 1657, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */
+ 1655, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */
+ 861, /* GL_MAX_CLIPMAP_DEPTH_SGIX */
+ 862, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */
+ 1222, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */
+ 1224, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */
+ 1221, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */
+ 1223, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */
+ 1723, /* GL_TEXTURE_LOD_BIAS_S_SGIX */
+ 1724, /* GL_TEXTURE_LOD_BIAS_T_SGIX */
+ 1722, /* GL_TEXTURE_LOD_BIAS_R_SGIX */
594, /* GL_GENERATE_MIPMAP */
595, /* GL_GENERATE_MIPMAP_HINT */
532, /* GL_FOG_OFFSET_SGIX */
533, /* GL_FOG_OFFSET_VALUE_SGIX */
- 1667, /* GL_TEXTURE_COMPARE_SGIX */
- 1666, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */
- 1718, /* GL_TEXTURE_LEQUAL_R_SGIX */
- 1710, /* GL_TEXTURE_GEQUAL_R_SGIX */
+ 1668, /* GL_TEXTURE_COMPARE_SGIX */
+ 1667, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */
+ 1719, /* GL_TEXTURE_LEQUAL_R_SGIX */
+ 1711, /* GL_TEXTURE_GEQUAL_R_SGIX */
360, /* GL_DEPTH_COMPONENT16 */
363, /* GL_DEPTH_COMPONENT24 */
366, /* GL_DEPTH_COMPONENT32 */
306, /* GL_CULL_VERTEX_EXT */
308, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */
307, /* GL_CULL_VERTEX_EYE_POSITION_EXT */
- 1875, /* GL_WRAP_BORDER_SUN */
- 1660, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */
- 690, /* GL_LIGHT_MODEL_COLOR_CONTROL */
- 1444, /* GL_SINGLE_COLOR */
- 1430, /* GL_SEPARATE_SPECULAR_COLOR */
- 1439, /* GL_SHARED_TEXTURE_PALETTE_EXT */
+ 1876, /* GL_WRAP_BORDER_SUN */
+ 1661, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */
+ 691, /* GL_LIGHT_MODEL_COLOR_CONTROL */
+ 1445, /* GL_SINGLE_COLOR */
+ 1431, /* GL_SEPARATE_SPECULAR_COLOR */
+ 1440, /* GL_SHARED_TEXTURE_PALETTE_EXT */
543, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */
544, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */
551, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */
@@ -4490,31 +4493,31 @@ static const unsigned reduced_enums[1350] =
564, /* GL_FRAMEBUFFER_DEFAULT */
580, /* GL_FRAMEBUFFER_UNDEFINED */
373, /* GL_DEPTH_STENCIL_ATTACHMENT */
- 630, /* GL_INDEX */
- 1784, /* GL_UNSIGNED_BYTE_2_3_3_REV */
- 1800, /* GL_UNSIGNED_SHORT_5_6_5 */
- 1801, /* GL_UNSIGNED_SHORT_5_6_5_REV */
- 1798, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */
- 1796, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */
- 1793, /* GL_UNSIGNED_INT_8_8_8_8_REV */
- 1791, /* GL_UNSIGNED_INT_2_10_10_10_REV */
- 1730, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */
- 1731, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */
- 1729, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */
- 956, /* GL_MIRRORED_REPEAT */
- 1386, /* GL_RGB_S3TC */
- 1361, /* GL_RGB4_S3TC */
- 1384, /* GL_RGBA_S3TC */
- 1378, /* GL_RGBA4_S3TC */
- 1382, /* GL_RGBA_DXT5_S3TC */
- 1376, /* GL_RGBA4_DXT5_S3TC */
+ 631, /* GL_INDEX */
+ 1785, /* GL_UNSIGNED_BYTE_2_3_3_REV */
+ 1801, /* GL_UNSIGNED_SHORT_5_6_5 */
+ 1802, /* GL_UNSIGNED_SHORT_5_6_5_REV */
+ 1799, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */
+ 1797, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */
+ 1794, /* GL_UNSIGNED_INT_8_8_8_8_REV */
+ 1792, /* GL_UNSIGNED_INT_2_10_10_10_REV */
+ 1731, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */
+ 1732, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */
+ 1730, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */
+ 957, /* GL_MIRRORED_REPEAT */
+ 1387, /* GL_RGB_S3TC */
+ 1362, /* GL_RGB4_S3TC */
+ 1385, /* GL_RGBA_S3TC */
+ 1379, /* GL_RGBA4_S3TC */
+ 1383, /* GL_RGBA_DXT5_S3TC */
+ 1377, /* GL_RGBA4_DXT5_S3TC */
264, /* GL_COMPRESSED_RGB_S3TC_DXT1_EXT */
259, /* GL_COMPRESSED_RGBA_S3TC_DXT1_EXT */
260, /* GL_COMPRESSED_RGBA_S3TC_DXT3_EXT */
261, /* GL_COMPRESSED_RGBA_S3TC_DXT5_EXT */
- 1017, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */
- 1016, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */
- 698, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */
+ 1018, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */
+ 1017, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */
+ 699, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */
519, /* GL_FOG_COORDINATE_SOURCE */
511, /* GL_FOG_COORD */
535, /* GL_FRAGMENT_DEPTH */
@@ -4525,278 +4528,278 @@ static const unsigned reduced_enums[1350] =
513, /* GL_FOG_COORDINATE_ARRAY */
199, /* GL_COLOR_SUM */
332, /* GL_CURRENT_SECONDARY_COLOR */
- 1423, /* GL_SECONDARY_COLOR_ARRAY_SIZE */
- 1425, /* GL_SECONDARY_COLOR_ARRAY_TYPE */
- 1424, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */
- 1422, /* GL_SECONDARY_COLOR_ARRAY_POINTER */
- 1419, /* GL_SECONDARY_COLOR_ARRAY */
+ 1424, /* GL_SECONDARY_COLOR_ARRAY_SIZE */
+ 1426, /* GL_SECONDARY_COLOR_ARRAY_TYPE */
+ 1425, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */
+ 1423, /* GL_SECONDARY_COLOR_ARRAY_POINTER */
+ 1420, /* GL_SECONDARY_COLOR_ARRAY */
330, /* GL_CURRENT_RASTER_SECONDARY_COLOR */
28, /* GL_ALIASED_POINT_SIZE_RANGE */
27, /* GL_ALIASED_LINE_WIDTH_RANGE */
- 1567, /* GL_TEXTURE0 */
- 1569, /* GL_TEXTURE1 */
- 1591, /* GL_TEXTURE2 */
- 1613, /* GL_TEXTURE3 */
- 1619, /* GL_TEXTURE4 */
- 1621, /* GL_TEXTURE5 */
- 1623, /* GL_TEXTURE6 */
- 1625, /* GL_TEXTURE7 */
- 1627, /* GL_TEXTURE8 */
- 1629, /* GL_TEXTURE9 */
- 1570, /* GL_TEXTURE10 */
- 1572, /* GL_TEXTURE11 */
- 1574, /* GL_TEXTURE12 */
- 1576, /* GL_TEXTURE13 */
- 1578, /* GL_TEXTURE14 */
- 1580, /* GL_TEXTURE15 */
- 1582, /* GL_TEXTURE16 */
- 1584, /* GL_TEXTURE17 */
- 1586, /* GL_TEXTURE18 */
- 1588, /* GL_TEXTURE19 */
- 1592, /* GL_TEXTURE20 */
- 1594, /* GL_TEXTURE21 */
- 1596, /* GL_TEXTURE22 */
- 1598, /* GL_TEXTURE23 */
- 1600, /* GL_TEXTURE24 */
- 1602, /* GL_TEXTURE25 */
- 1604, /* GL_TEXTURE26 */
- 1606, /* GL_TEXTURE27 */
- 1608, /* GL_TEXTURE28 */
- 1610, /* GL_TEXTURE29 */
- 1614, /* GL_TEXTURE30 */
- 1616, /* GL_TEXTURE31 */
+ 1568, /* GL_TEXTURE0 */
+ 1570, /* GL_TEXTURE1 */
+ 1592, /* GL_TEXTURE2 */
+ 1614, /* GL_TEXTURE3 */
+ 1620, /* GL_TEXTURE4 */
+ 1622, /* GL_TEXTURE5 */
+ 1624, /* GL_TEXTURE6 */
+ 1626, /* GL_TEXTURE7 */
+ 1628, /* GL_TEXTURE8 */
+ 1630, /* GL_TEXTURE9 */
+ 1571, /* GL_TEXTURE10 */
+ 1573, /* GL_TEXTURE11 */
+ 1575, /* GL_TEXTURE12 */
+ 1577, /* GL_TEXTURE13 */
+ 1579, /* GL_TEXTURE14 */
+ 1581, /* GL_TEXTURE15 */
+ 1583, /* GL_TEXTURE16 */
+ 1585, /* GL_TEXTURE17 */
+ 1587, /* GL_TEXTURE18 */
+ 1589, /* GL_TEXTURE19 */
+ 1593, /* GL_TEXTURE20 */
+ 1595, /* GL_TEXTURE21 */
+ 1597, /* GL_TEXTURE22 */
+ 1599, /* GL_TEXTURE23 */
+ 1601, /* GL_TEXTURE24 */
+ 1603, /* GL_TEXTURE25 */
+ 1605, /* GL_TEXTURE26 */
+ 1607, /* GL_TEXTURE27 */
+ 1609, /* GL_TEXTURE28 */
+ 1611, /* GL_TEXTURE29 */
+ 1615, /* GL_TEXTURE30 */
+ 1617, /* GL_TEXTURE31 */
18, /* GL_ACTIVE_TEXTURE */
133, /* GL_CLIENT_ACTIVE_TEXTURE */
- 934, /* GL_MAX_TEXTURE_UNITS */
- 1762, /* GL_TRANSPOSE_MODELVIEW_MATRIX */
- 1765, /* GL_TRANSPOSE_PROJECTION_MATRIX */
- 1767, /* GL_TRANSPOSE_TEXTURE_MATRIX */
- 1759, /* GL_TRANSPOSE_COLOR_MATRIX */
- 1549, /* GL_SUBTRACT */
- 919, /* GL_MAX_RENDERBUFFER_SIZE */
+ 935, /* GL_MAX_TEXTURE_UNITS */
+ 1763, /* GL_TRANSPOSE_MODELVIEW_MATRIX */
+ 1766, /* GL_TRANSPOSE_PROJECTION_MATRIX */
+ 1768, /* GL_TRANSPOSE_TEXTURE_MATRIX */
+ 1760, /* GL_TRANSPOSE_COLOR_MATRIX */
+ 1550, /* GL_SUBTRACT */
+ 920, /* GL_MAX_RENDERBUFFER_SIZE */
247, /* GL_COMPRESSED_ALPHA */
251, /* GL_COMPRESSED_LUMINANCE */
252, /* GL_COMPRESSED_LUMINANCE_ALPHA */
249, /* GL_COMPRESSED_INTENSITY */
255, /* GL_COMPRESSED_RGB */
256, /* GL_COMPRESSED_RGBA */
- 1674, /* GL_TEXTURE_COMPRESSION_HINT */
- 1739, /* GL_TEXTURE_RECTANGLE_ARB */
- 1646, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */
- 1281, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */
- 917, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */
+ 1675, /* GL_TEXTURE_COMPRESSION_HINT */
+ 1740, /* GL_TEXTURE_RECTANGLE_ARB */
+ 1647, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */
+ 1282, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */
+ 918, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */
372, /* GL_DEPTH_STENCIL */
- 1788, /* GL_UNSIGNED_INT_24_8 */
- 930, /* GL_MAX_TEXTURE_LOD_BIAS */
- 1728, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */
- 931, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */
- 1704, /* GL_TEXTURE_FILTER_CONTROL */
- 1719, /* GL_TEXTURE_LOD_BIAS */
+ 1789, /* GL_UNSIGNED_INT_24_8 */
+ 931, /* GL_MAX_TEXTURE_LOD_BIAS */
+ 1729, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */
+ 932, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */
+ 1705, /* GL_TEXTURE_FILTER_CONTROL */
+ 1720, /* GL_TEXTURE_LOD_BIAS */
232, /* GL_COMBINE4 */
- 924, /* GL_MAX_SHININESS_NV */
- 925, /* GL_MAX_SPOT_EXPONENT_NV */
- 628, /* GL_INCR_WRAP */
+ 925, /* GL_MAX_SHININESS_NV */
+ 926, /* GL_MAX_SPOT_EXPONENT_NV */
+ 629, /* GL_INCR_WRAP */
343, /* GL_DECR_WRAP */
- 976, /* GL_MODELVIEW1_ARB */
- 1032, /* GL_NORMAL_MAP */
- 1318, /* GL_REFLECTION_MAP */
- 1683, /* GL_TEXTURE_CUBE_MAP */
- 1644, /* GL_TEXTURE_BINDING_CUBE_MAP */
- 1691, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */
- 1685, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */
- 1693, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */
- 1687, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */
- 1695, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */
- 1689, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */
- 1279, /* GL_PROXY_TEXTURE_CUBE_MAP */
- 873, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */
- 1011, /* GL_MULTISAMPLE_FILTER_HINT_NV */
+ 977, /* GL_MODELVIEW1_ARB */
+ 1033, /* GL_NORMAL_MAP */
+ 1319, /* GL_REFLECTION_MAP */
+ 1684, /* GL_TEXTURE_CUBE_MAP */
+ 1645, /* GL_TEXTURE_BINDING_CUBE_MAP */
+ 1692, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */
+ 1686, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */
+ 1694, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */
+ 1688, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */
+ 1696, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */
+ 1690, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */
+ 1280, /* GL_PROXY_TEXTURE_CUBE_MAP */
+ 874, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */
+ 1012, /* GL_MULTISAMPLE_FILTER_HINT_NV */
527, /* GL_FOG_DISTANCE_MODE_NV */
478, /* GL_EYE_RADIAL_NV */
477, /* GL_EYE_PLANE_ABSOLUTE_NV */
231, /* GL_COMBINE */
238, /* GL_COMBINE_RGB */
233, /* GL_COMBINE_ALPHA */
- 1387, /* GL_RGB_SCALE */
+ 1388, /* GL_RGB_SCALE */
24, /* GL_ADD_SIGNED */
- 656, /* GL_INTERPOLATE */
+ 657, /* GL_INTERPOLATE */
271, /* GL_CONSTANT */
- 1227, /* GL_PRIMARY_COLOR */
- 1224, /* GL_PREVIOUS */
- 1459, /* GL_SOURCE0_RGB */
- 1465, /* GL_SOURCE1_RGB */
- 1471, /* GL_SOURCE2_RGB */
- 1475, /* GL_SOURCE3_RGB_NV */
- 1456, /* GL_SOURCE0_ALPHA */
- 1462, /* GL_SOURCE1_ALPHA */
- 1468, /* GL_SOURCE2_ALPHA */
- 1474, /* GL_SOURCE3_ALPHA_NV */
- 1069, /* GL_OPERAND0_RGB */
- 1075, /* GL_OPERAND1_RGB */
- 1081, /* GL_OPERAND2_RGB */
- 1085, /* GL_OPERAND3_RGB_NV */
- 1066, /* GL_OPERAND0_ALPHA */
- 1072, /* GL_OPERAND1_ALPHA */
- 1078, /* GL_OPERAND2_ALPHA */
- 1084, /* GL_OPERAND3_ALPHA_NV */
- 1813, /* GL_VERTEX_ARRAY_BINDING */
- 1737, /* GL_TEXTURE_RANGE_LENGTH_APPLE */
- 1738, /* GL_TEXTURE_RANGE_POINTER_APPLE */
- 1879, /* GL_YCBCR_422_APPLE */
- 1802, /* GL_UNSIGNED_SHORT_8_8_APPLE */
- 1804, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */
- 1747, /* GL_TEXTURE_STORAGE_HINT_APPLE */
- 1540, /* GL_STORAGE_PRIVATE_APPLE */
- 1539, /* GL_STORAGE_CACHED_APPLE */
- 1541, /* GL_STORAGE_SHARED_APPLE */
- 1446, /* GL_SLICE_ACCUM_SUN */
- 1288, /* GL_QUAD_MESH_SUN */
- 1771, /* GL_TRIANGLE_MESH_SUN */
- 1852, /* GL_VERTEX_PROGRAM_ARB */
- 1863, /* GL_VERTEX_STATE_PROGRAM_NV */
- 1839, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */
- 1845, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */
- 1847, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */
- 1849, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */
+ 1228, /* GL_PRIMARY_COLOR */
+ 1225, /* GL_PREVIOUS */
+ 1460, /* GL_SOURCE0_RGB */
+ 1466, /* GL_SOURCE1_RGB */
+ 1472, /* GL_SOURCE2_RGB */
+ 1476, /* GL_SOURCE3_RGB_NV */
+ 1457, /* GL_SOURCE0_ALPHA */
+ 1463, /* GL_SOURCE1_ALPHA */
+ 1469, /* GL_SOURCE2_ALPHA */
+ 1475, /* GL_SOURCE3_ALPHA_NV */
+ 1070, /* GL_OPERAND0_RGB */
+ 1076, /* GL_OPERAND1_RGB */
+ 1082, /* GL_OPERAND2_RGB */
+ 1086, /* GL_OPERAND3_RGB_NV */
+ 1067, /* GL_OPERAND0_ALPHA */
+ 1073, /* GL_OPERAND1_ALPHA */
+ 1079, /* GL_OPERAND2_ALPHA */
+ 1085, /* GL_OPERAND3_ALPHA_NV */
+ 1814, /* GL_VERTEX_ARRAY_BINDING */
+ 1738, /* GL_TEXTURE_RANGE_LENGTH_APPLE */
+ 1739, /* GL_TEXTURE_RANGE_POINTER_APPLE */
+ 1880, /* GL_YCBCR_422_APPLE */
+ 1803, /* GL_UNSIGNED_SHORT_8_8_APPLE */
+ 1805, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */
+ 1748, /* GL_TEXTURE_STORAGE_HINT_APPLE */
+ 1541, /* GL_STORAGE_PRIVATE_APPLE */
+ 1540, /* GL_STORAGE_CACHED_APPLE */
+ 1542, /* GL_STORAGE_SHARED_APPLE */
+ 1447, /* GL_SLICE_ACCUM_SUN */
+ 1289, /* GL_QUAD_MESH_SUN */
+ 1772, /* GL_TRIANGLE_MESH_SUN */
+ 1853, /* GL_VERTEX_PROGRAM_ARB */
+ 1864, /* GL_VERTEX_STATE_PROGRAM_NV */
+ 1840, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */
+ 1846, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */
+ 1848, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */
+ 1850, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */
334, /* GL_CURRENT_VERTEX_ATTRIB */
- 1240, /* GL_PROGRAM_LENGTH_ARB */
- 1254, /* GL_PROGRAM_STRING_ARB */
- 998, /* GL_MODELVIEW_PROJECTION_NV */
- 623, /* GL_IDENTITY_NV */
- 670, /* GL_INVERSE_NV */
- 1764, /* GL_TRANSPOSE_NV */
- 671, /* GL_INVERSE_TRANSPOSE_NV */
- 903, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */
- 902, /* GL_MAX_PROGRAM_MATRICES_ARB */
- 809, /* GL_MATRIX0_NV */
- 821, /* GL_MATRIX1_NV */
- 833, /* GL_MATRIX2_NV */
- 837, /* GL_MATRIX3_NV */
- 839, /* GL_MATRIX4_NV */
- 841, /* GL_MATRIX5_NV */
- 843, /* GL_MATRIX6_NV */
- 845, /* GL_MATRIX7_NV */
+ 1241, /* GL_PROGRAM_LENGTH_ARB */
+ 1255, /* GL_PROGRAM_STRING_ARB */
+ 999, /* GL_MODELVIEW_PROJECTION_NV */
+ 624, /* GL_IDENTITY_NV */
+ 671, /* GL_INVERSE_NV */
+ 1765, /* GL_TRANSPOSE_NV */
+ 672, /* GL_INVERSE_TRANSPOSE_NV */
+ 904, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */
+ 903, /* GL_MAX_PROGRAM_MATRICES_ARB */
+ 810, /* GL_MATRIX0_NV */
+ 822, /* GL_MATRIX1_NV */
+ 834, /* GL_MATRIX2_NV */
+ 838, /* GL_MATRIX3_NV */
+ 840, /* GL_MATRIX4_NV */
+ 842, /* GL_MATRIX5_NV */
+ 844, /* GL_MATRIX6_NV */
+ 846, /* GL_MATRIX7_NV */
318, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */
315, /* GL_CURRENT_MATRIX_ARB */
- 1855, /* GL_VERTEX_PROGRAM_POINT_SIZE */
- 1858, /* GL_VERTEX_PROGRAM_TWO_SIDE */
- 1252, /* GL_PROGRAM_PARAMETER_NV */
- 1843, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */
- 1256, /* GL_PROGRAM_TARGET_NV */
- 1253, /* GL_PROGRAM_RESIDENT_NV */
- 1756, /* GL_TRACK_MATRIX_NV */
- 1757, /* GL_TRACK_MATRIX_TRANSFORM_NV */
- 1853, /* GL_VERTEX_PROGRAM_BINDING_NV */
- 1234, /* GL_PROGRAM_ERROR_POSITION_ARB */
+ 1856, /* GL_VERTEX_PROGRAM_POINT_SIZE */
+ 1859, /* GL_VERTEX_PROGRAM_TWO_SIDE */
+ 1253, /* GL_PROGRAM_PARAMETER_NV */
+ 1844, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */
+ 1257, /* GL_PROGRAM_TARGET_NV */
+ 1254, /* GL_PROGRAM_RESIDENT_NV */
+ 1757, /* GL_TRACK_MATRIX_NV */
+ 1758, /* GL_TRACK_MATRIX_TRANSFORM_NV */
+ 1854, /* GL_VERTEX_PROGRAM_BINDING_NV */
+ 1235, /* GL_PROGRAM_ERROR_POSITION_ARB */
356, /* GL_DEPTH_CLAMP */
- 1821, /* GL_VERTEX_ATTRIB_ARRAY0_NV */
- 1828, /* GL_VERTEX_ATTRIB_ARRAY1_NV */
- 1829, /* GL_VERTEX_ATTRIB_ARRAY2_NV */
- 1830, /* GL_VERTEX_ATTRIB_ARRAY3_NV */
- 1831, /* GL_VERTEX_ATTRIB_ARRAY4_NV */
- 1832, /* GL_VERTEX_ATTRIB_ARRAY5_NV */
- 1833, /* GL_VERTEX_ATTRIB_ARRAY6_NV */
- 1834, /* GL_VERTEX_ATTRIB_ARRAY7_NV */
- 1835, /* GL_VERTEX_ATTRIB_ARRAY8_NV */
- 1836, /* GL_VERTEX_ATTRIB_ARRAY9_NV */
- 1822, /* GL_VERTEX_ATTRIB_ARRAY10_NV */
- 1823, /* GL_VERTEX_ATTRIB_ARRAY11_NV */
- 1824, /* GL_VERTEX_ATTRIB_ARRAY12_NV */
- 1825, /* GL_VERTEX_ATTRIB_ARRAY13_NV */
- 1826, /* GL_VERTEX_ATTRIB_ARRAY14_NV */
- 1827, /* GL_VERTEX_ATTRIB_ARRAY15_NV */
- 757, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */
- 764, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */
- 765, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */
- 766, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */
- 767, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */
- 768, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */
- 769, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */
- 770, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */
- 771, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */
- 772, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */
- 758, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */
- 759, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */
- 760, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */
- 761, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */
- 762, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */
- 763, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */
- 784, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */
- 791, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */
- 792, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */
- 793, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */
- 794, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */
- 795, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */
- 796, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */
- 1233, /* GL_PROGRAM_BINDING_ARB */
- 798, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */
- 799, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */
- 785, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */
- 786, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */
- 787, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */
- 788, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */
- 789, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */
- 790, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */
- 1672, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */
- 1669, /* GL_TEXTURE_COMPRESSED */
- 1037, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */
+ 1822, /* GL_VERTEX_ATTRIB_ARRAY0_NV */
+ 1829, /* GL_VERTEX_ATTRIB_ARRAY1_NV */
+ 1830, /* GL_VERTEX_ATTRIB_ARRAY2_NV */
+ 1831, /* GL_VERTEX_ATTRIB_ARRAY3_NV */
+ 1832, /* GL_VERTEX_ATTRIB_ARRAY4_NV */
+ 1833, /* GL_VERTEX_ATTRIB_ARRAY5_NV */
+ 1834, /* GL_VERTEX_ATTRIB_ARRAY6_NV */
+ 1835, /* GL_VERTEX_ATTRIB_ARRAY7_NV */
+ 1836, /* GL_VERTEX_ATTRIB_ARRAY8_NV */
+ 1837, /* GL_VERTEX_ATTRIB_ARRAY9_NV */
+ 1823, /* GL_VERTEX_ATTRIB_ARRAY10_NV */
+ 1824, /* GL_VERTEX_ATTRIB_ARRAY11_NV */
+ 1825, /* GL_VERTEX_ATTRIB_ARRAY12_NV */
+ 1826, /* GL_VERTEX_ATTRIB_ARRAY13_NV */
+ 1827, /* GL_VERTEX_ATTRIB_ARRAY14_NV */
+ 1828, /* GL_VERTEX_ATTRIB_ARRAY15_NV */
+ 758, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */
+ 765, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */
+ 766, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */
+ 767, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */
+ 768, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */
+ 769, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */
+ 770, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */
+ 771, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */
+ 772, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */
+ 773, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */
+ 759, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */
+ 760, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */
+ 761, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */
+ 762, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */
+ 763, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */
+ 764, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */
+ 785, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */
+ 792, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */
+ 793, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */
+ 794, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */
+ 795, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */
+ 796, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */
+ 797, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */
+ 1234, /* GL_PROGRAM_BINDING_ARB */
+ 799, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */
+ 800, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */
+ 786, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */
+ 787, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */
+ 788, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */
+ 789, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */
+ 790, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */
+ 791, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */
+ 1673, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */
+ 1670, /* GL_TEXTURE_COMPRESSED */
+ 1038, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */
269, /* GL_COMPRESSED_TEXTURE_FORMATS */
- 946, /* GL_MAX_VERTEX_UNITS_ARB */
+ 947, /* GL_MAX_VERTEX_UNITS_ARB */
22, /* GL_ACTIVE_VERTEX_UNITS_ARB */
- 1874, /* GL_WEIGHT_SUM_UNITY_ARB */
- 1851, /* GL_VERTEX_BLEND_ARB */
+ 1875, /* GL_WEIGHT_SUM_UNITY_ARB */
+ 1852, /* GL_VERTEX_BLEND_ARB */
336, /* GL_CURRENT_WEIGHT_ARB */
- 1873, /* GL_WEIGHT_ARRAY_TYPE_ARB */
- 1872, /* GL_WEIGHT_ARRAY_STRIDE_ARB */
- 1871, /* GL_WEIGHT_ARRAY_SIZE_ARB */
- 1870, /* GL_WEIGHT_ARRAY_POINTER_ARB */
- 1867, /* GL_WEIGHT_ARRAY_ARB */
+ 1874, /* GL_WEIGHT_ARRAY_TYPE_ARB */
+ 1873, /* GL_WEIGHT_ARRAY_STRIDE_ARB */
+ 1872, /* GL_WEIGHT_ARRAY_SIZE_ARB */
+ 1871, /* GL_WEIGHT_ARRAY_POINTER_ARB */
+ 1868, /* GL_WEIGHT_ARRAY_ARB */
386, /* GL_DOT3_RGB */
387, /* GL_DOT3_RGBA */
263, /* GL_COMPRESSED_RGB_FXT1_3DFX */
258, /* GL_COMPRESSED_RGBA_FXT1_3DFX */
- 1006, /* GL_MULTISAMPLE_3DFX */
- 1408, /* GL_SAMPLE_BUFFERS_3DFX */
- 1399, /* GL_SAMPLES_3DFX */
- 987, /* GL_MODELVIEW2_ARB */
- 990, /* GL_MODELVIEW3_ARB */
- 991, /* GL_MODELVIEW4_ARB */
- 992, /* GL_MODELVIEW5_ARB */
- 993, /* GL_MODELVIEW6_ARB */
- 994, /* GL_MODELVIEW7_ARB */
- 995, /* GL_MODELVIEW8_ARB */
- 996, /* GL_MODELVIEW9_ARB */
- 966, /* GL_MODELVIEW10_ARB */
- 967, /* GL_MODELVIEW11_ARB */
- 968, /* GL_MODELVIEW12_ARB */
- 969, /* GL_MODELVIEW13_ARB */
- 970, /* GL_MODELVIEW14_ARB */
- 971, /* GL_MODELVIEW15_ARB */
- 972, /* GL_MODELVIEW16_ARB */
- 973, /* GL_MODELVIEW17_ARB */
- 974, /* GL_MODELVIEW18_ARB */
- 975, /* GL_MODELVIEW19_ARB */
- 977, /* GL_MODELVIEW20_ARB */
- 978, /* GL_MODELVIEW21_ARB */
- 979, /* GL_MODELVIEW22_ARB */
- 980, /* GL_MODELVIEW23_ARB */
- 981, /* GL_MODELVIEW24_ARB */
- 982, /* GL_MODELVIEW25_ARB */
- 983, /* GL_MODELVIEW26_ARB */
- 984, /* GL_MODELVIEW27_ARB */
- 985, /* GL_MODELVIEW28_ARB */
- 986, /* GL_MODELVIEW29_ARB */
- 988, /* GL_MODELVIEW30_ARB */
- 989, /* GL_MODELVIEW31_ARB */
+ 1007, /* GL_MULTISAMPLE_3DFX */
+ 1409, /* GL_SAMPLE_BUFFERS_3DFX */
+ 1400, /* GL_SAMPLES_3DFX */
+ 988, /* GL_MODELVIEW2_ARB */
+ 991, /* GL_MODELVIEW3_ARB */
+ 992, /* GL_MODELVIEW4_ARB */
+ 993, /* GL_MODELVIEW5_ARB */
+ 994, /* GL_MODELVIEW6_ARB */
+ 995, /* GL_MODELVIEW7_ARB */
+ 996, /* GL_MODELVIEW8_ARB */
+ 997, /* GL_MODELVIEW9_ARB */
+ 967, /* GL_MODELVIEW10_ARB */
+ 968, /* GL_MODELVIEW11_ARB */
+ 969, /* GL_MODELVIEW12_ARB */
+ 970, /* GL_MODELVIEW13_ARB */
+ 971, /* GL_MODELVIEW14_ARB */
+ 972, /* GL_MODELVIEW15_ARB */
+ 973, /* GL_MODELVIEW16_ARB */
+ 974, /* GL_MODELVIEW17_ARB */
+ 975, /* GL_MODELVIEW18_ARB */
+ 976, /* GL_MODELVIEW19_ARB */
+ 978, /* GL_MODELVIEW20_ARB */
+ 979, /* GL_MODELVIEW21_ARB */
+ 980, /* GL_MODELVIEW22_ARB */
+ 981, /* GL_MODELVIEW23_ARB */
+ 982, /* GL_MODELVIEW24_ARB */
+ 983, /* GL_MODELVIEW25_ARB */
+ 984, /* GL_MODELVIEW26_ARB */
+ 985, /* GL_MODELVIEW27_ARB */
+ 986, /* GL_MODELVIEW28_ARB */
+ 987, /* GL_MODELVIEW29_ARB */
+ 989, /* GL_MODELVIEW30_ARB */
+ 990, /* GL_MODELVIEW31_ARB */
391, /* GL_DOT3_RGB_EXT */
389, /* GL_DOT3_RGBA_EXT */
- 960, /* GL_MIRROR_CLAMP_EXT */
- 963, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */
- 1001, /* GL_MODULATE_ADD_ATI */
- 1002, /* GL_MODULATE_SIGNED_ADD_ATI */
- 1003, /* GL_MODULATE_SUBTRACT_ATI */
- 1880, /* GL_YCBCR_MESA */
- 1093, /* GL_PACK_INVERT_MESA */
+ 961, /* GL_MIRROR_CLAMP_EXT */
+ 964, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */
+ 1002, /* GL_MODULATE_ADD_ATI */
+ 1003, /* GL_MODULATE_SIGNED_ADD_ATI */
+ 1004, /* GL_MODULATE_SUBTRACT_ATI */
+ 1881, /* GL_YCBCR_MESA */
+ 1094, /* GL_PACK_INVERT_MESA */
339, /* GL_DEBUG_OBJECT_MESA */
340, /* GL_DEBUG_PRINT_MESA */
338, /* GL_DEBUG_ASSERT_MESA */
@@ -4810,24 +4813,24 @@ static const unsigned reduced_enums[1350] =
450, /* GL_DU8DV8_ATI */
114, /* GL_BUMP_ENVMAP_ATI */
118, /* GL_BUMP_TARGET_ATI */
- 1507, /* GL_STENCIL_BACK_FUNC */
- 1505, /* GL_STENCIL_BACK_FAIL */
- 1509, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */
- 1511, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */
+ 1508, /* GL_STENCIL_BACK_FUNC */
+ 1506, /* GL_STENCIL_BACK_FAIL */
+ 1510, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */
+ 1512, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */
536, /* GL_FRAGMENT_PROGRAM_ARB */
- 1231, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */
- 1259, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */
- 1258, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */
- 1243, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
- 1249, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
- 1248, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
- 892, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */
- 915, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */
- 914, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */
- 905, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
- 911, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
- 910, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
- 875, /* GL_MAX_DRAW_BUFFERS */
+ 1232, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */
+ 1260, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */
+ 1259, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */
+ 1244, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
+ 1250, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
+ 1249, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
+ 893, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */
+ 916, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */
+ 915, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */
+ 906, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
+ 912, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
+ 911, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
+ 876, /* GL_MAX_DRAW_BUFFERS */
395, /* GL_DRAW_BUFFER0 */
398, /* GL_DRAW_BUFFER1 */
419, /* GL_DRAW_BUFFER2 */
@@ -4845,161 +4848,161 @@ static const unsigned reduced_enums[1350] =
411, /* GL_DRAW_BUFFER14 */
414, /* GL_DRAW_BUFFER15 */
82, /* GL_BLEND_EQUATION_ALPHA */
- 854, /* GL_MATRIX_PALETTE_ARB */
- 886, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */
- 889, /* GL_MAX_PALETTE_MATRICES_ARB */
+ 855, /* GL_MATRIX_PALETTE_ARB */
+ 887, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */
+ 890, /* GL_MAX_PALETTE_MATRICES_ARB */
321, /* GL_CURRENT_PALETTE_MATRIX_ARB */
- 848, /* GL_MATRIX_INDEX_ARRAY_ARB */
+ 849, /* GL_MATRIX_INDEX_ARRAY_ARB */
316, /* GL_CURRENT_MATRIX_INDEX_ARB */
- 850, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */
- 852, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */
- 851, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */
- 849, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */
- 1699, /* GL_TEXTURE_DEPTH_SIZE */
+ 851, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */
+ 853, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */
+ 852, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */
+ 850, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */
+ 1700, /* GL_TEXTURE_DEPTH_SIZE */
379, /* GL_DEPTH_TEXTURE_MODE */
- 1664, /* GL_TEXTURE_COMPARE_MODE */
- 1662, /* GL_TEXTURE_COMPARE_FUNC */
+ 1665, /* GL_TEXTURE_COMPARE_MODE */
+ 1663, /* GL_TEXTURE_COMPARE_FUNC */
242, /* GL_COMPARE_R_TO_TEXTURE */
- 1165, /* GL_POINT_SPRITE */
+ 1166, /* GL_POINT_SPRITE */
296, /* GL_COORD_REPLACE */
- 1169, /* GL_POINT_SPRITE_R_MODE_NV */
- 1292, /* GL_QUERY_COUNTER_BITS */
+ 1170, /* GL_POINT_SPRITE_R_MODE_NV */
+ 1293, /* GL_QUERY_COUNTER_BITS */
323, /* GL_CURRENT_QUERY */
- 1295, /* GL_QUERY_RESULT */
- 1297, /* GL_QUERY_RESULT_AVAILABLE */
- 940, /* GL_MAX_VERTEX_ATTRIBS */
- 1841, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */
+ 1296, /* GL_QUERY_RESULT */
+ 1298, /* GL_QUERY_RESULT_AVAILABLE */
+ 941, /* GL_MAX_VERTEX_ATTRIBS */
+ 1842, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */
377, /* GL_DEPTH_STENCIL_TO_RGBA_NV */
376, /* GL_DEPTH_STENCIL_TO_BGRA_NV */
- 926, /* GL_MAX_TEXTURE_COORDS */
- 928, /* GL_MAX_TEXTURE_IMAGE_UNITS */
- 1236, /* GL_PROGRAM_ERROR_STRING_ARB */
- 1238, /* GL_PROGRAM_FORMAT_ASCII_ARB */
- 1237, /* GL_PROGRAM_FORMAT_ARB */
- 1749, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */
+ 927, /* GL_MAX_TEXTURE_COORDS */
+ 929, /* GL_MAX_TEXTURE_IMAGE_UNITS */
+ 1237, /* GL_PROGRAM_ERROR_STRING_ARB */
+ 1239, /* GL_PROGRAM_FORMAT_ASCII_ARB */
+ 1238, /* GL_PROGRAM_FORMAT_ARB */
+ 1750, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */
354, /* GL_DEPTH_BOUNDS_TEST_EXT */
353, /* GL_DEPTH_BOUNDS_EXT */
53, /* GL_ARRAY_BUFFER */
464, /* GL_ELEMENT_ARRAY_BUFFER */
54, /* GL_ARRAY_BUFFER_BINDING */
465, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */
- 1815, /* GL_VERTEX_ARRAY_BUFFER_BINDING */
- 1027, /* GL_NORMAL_ARRAY_BUFFER_BINDING */
+ 1816, /* GL_VERTEX_ARRAY_BUFFER_BINDING */
+ 1028, /* GL_NORMAL_ARRAY_BUFFER_BINDING */
149, /* GL_COLOR_ARRAY_BUFFER_BINDING */
- 632, /* GL_INDEX_ARRAY_BUFFER_BINDING */
- 1677, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */
+ 633, /* GL_INDEX_ARRAY_BUFFER_BINDING */
+ 1678, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */
460, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */
- 1420, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */
+ 1421, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */
514, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */
- 1868, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */
- 1837, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */
- 1239, /* GL_PROGRAM_INSTRUCTIONS_ARB */
- 898, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */
- 1245, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
- 907, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
- 1257, /* GL_PROGRAM_TEMPORARIES_ARB */
- 913, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */
- 1247, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */
- 909, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */
- 1251, /* GL_PROGRAM_PARAMETERS_ARB */
- 912, /* GL_MAX_PROGRAM_PARAMETERS_ARB */
- 1246, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */
- 908, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */
- 1232, /* GL_PROGRAM_ATTRIBS_ARB */
- 893, /* GL_MAX_PROGRAM_ATTRIBS_ARB */
- 1244, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */
- 906, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */
- 1230, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */
- 891, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */
- 1242, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
- 904, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
- 899, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */
- 895, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */
- 1260, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */
- 1761, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */
- 1308, /* GL_READ_ONLY */
- 1876, /* GL_WRITE_ONLY */
- 1310, /* GL_READ_WRITE */
+ 1869, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */
+ 1838, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */
+ 1240, /* GL_PROGRAM_INSTRUCTIONS_ARB */
+ 899, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */
+ 1246, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
+ 908, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
+ 1258, /* GL_PROGRAM_TEMPORARIES_ARB */
+ 914, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */
+ 1248, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */
+ 910, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */
+ 1252, /* GL_PROGRAM_PARAMETERS_ARB */
+ 913, /* GL_MAX_PROGRAM_PARAMETERS_ARB */
+ 1247, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */
+ 909, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */
+ 1233, /* GL_PROGRAM_ATTRIBS_ARB */
+ 894, /* GL_MAX_PROGRAM_ATTRIBS_ARB */
+ 1245, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */
+ 907, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */
+ 1231, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */
+ 892, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */
+ 1243, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
+ 905, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
+ 900, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */
+ 896, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */
+ 1261, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */
+ 1762, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */
+ 1309, /* GL_READ_ONLY */
+ 1877, /* GL_WRITE_ONLY */
+ 1311, /* GL_READ_WRITE */
102, /* GL_BUFFER_ACCESS */
105, /* GL_BUFFER_MAPPED */
107, /* GL_BUFFER_MAP_POINTER */
- 1755, /* GL_TIME_ELAPSED_EXT */
- 808, /* GL_MATRIX0_ARB */
- 820, /* GL_MATRIX1_ARB */
- 832, /* GL_MATRIX2_ARB */
- 836, /* GL_MATRIX3_ARB */
- 838, /* GL_MATRIX4_ARB */
- 840, /* GL_MATRIX5_ARB */
- 842, /* GL_MATRIX6_ARB */
- 844, /* GL_MATRIX7_ARB */
- 846, /* GL_MATRIX8_ARB */
- 847, /* GL_MATRIX9_ARB */
- 810, /* GL_MATRIX10_ARB */
- 811, /* GL_MATRIX11_ARB */
- 812, /* GL_MATRIX12_ARB */
- 813, /* GL_MATRIX13_ARB */
- 814, /* GL_MATRIX14_ARB */
- 815, /* GL_MATRIX15_ARB */
- 816, /* GL_MATRIX16_ARB */
- 817, /* GL_MATRIX17_ARB */
- 818, /* GL_MATRIX18_ARB */
- 819, /* GL_MATRIX19_ARB */
- 822, /* GL_MATRIX20_ARB */
- 823, /* GL_MATRIX21_ARB */
- 824, /* GL_MATRIX22_ARB */
- 825, /* GL_MATRIX23_ARB */
- 826, /* GL_MATRIX24_ARB */
- 827, /* GL_MATRIX25_ARB */
- 828, /* GL_MATRIX26_ARB */
- 829, /* GL_MATRIX27_ARB */
- 830, /* GL_MATRIX28_ARB */
- 831, /* GL_MATRIX29_ARB */
- 834, /* GL_MATRIX30_ARB */
- 835, /* GL_MATRIX31_ARB */
- 1544, /* GL_STREAM_DRAW */
- 1546, /* GL_STREAM_READ */
- 1542, /* GL_STREAM_COPY */
- 1498, /* GL_STATIC_DRAW */
- 1500, /* GL_STATIC_READ */
- 1496, /* GL_STATIC_COPY */
+ 1756, /* GL_TIME_ELAPSED_EXT */
+ 809, /* GL_MATRIX0_ARB */
+ 821, /* GL_MATRIX1_ARB */
+ 833, /* GL_MATRIX2_ARB */
+ 837, /* GL_MATRIX3_ARB */
+ 839, /* GL_MATRIX4_ARB */
+ 841, /* GL_MATRIX5_ARB */
+ 843, /* GL_MATRIX6_ARB */
+ 845, /* GL_MATRIX7_ARB */
+ 847, /* GL_MATRIX8_ARB */
+ 848, /* GL_MATRIX9_ARB */
+ 811, /* GL_MATRIX10_ARB */
+ 812, /* GL_MATRIX11_ARB */
+ 813, /* GL_MATRIX12_ARB */
+ 814, /* GL_MATRIX13_ARB */
+ 815, /* GL_MATRIX14_ARB */
+ 816, /* GL_MATRIX15_ARB */
+ 817, /* GL_MATRIX16_ARB */
+ 818, /* GL_MATRIX17_ARB */
+ 819, /* GL_MATRIX18_ARB */
+ 820, /* GL_MATRIX19_ARB */
+ 823, /* GL_MATRIX20_ARB */
+ 824, /* GL_MATRIX21_ARB */
+ 825, /* GL_MATRIX22_ARB */
+ 826, /* GL_MATRIX23_ARB */
+ 827, /* GL_MATRIX24_ARB */
+ 828, /* GL_MATRIX25_ARB */
+ 829, /* GL_MATRIX26_ARB */
+ 830, /* GL_MATRIX27_ARB */
+ 831, /* GL_MATRIX28_ARB */
+ 832, /* GL_MATRIX29_ARB */
+ 835, /* GL_MATRIX30_ARB */
+ 836, /* GL_MATRIX31_ARB */
+ 1545, /* GL_STREAM_DRAW */
+ 1547, /* GL_STREAM_READ */
+ 1543, /* GL_STREAM_COPY */
+ 1499, /* GL_STATIC_DRAW */
+ 1501, /* GL_STATIC_READ */
+ 1497, /* GL_STATIC_COPY */
454, /* GL_DYNAMIC_DRAW */
456, /* GL_DYNAMIC_READ */
452, /* GL_DYNAMIC_COPY */
- 1133, /* GL_PIXEL_PACK_BUFFER */
- 1137, /* GL_PIXEL_UNPACK_BUFFER */
- 1134, /* GL_PIXEL_PACK_BUFFER_BINDING */
- 1138, /* GL_PIXEL_UNPACK_BUFFER_BINDING */
+ 1134, /* GL_PIXEL_PACK_BUFFER */
+ 1138, /* GL_PIXEL_UNPACK_BUFFER */
+ 1135, /* GL_PIXEL_PACK_BUFFER_BINDING */
+ 1139, /* GL_PIXEL_UNPACK_BUFFER_BINDING */
347, /* GL_DEPTH24_STENCIL8 */
- 1745, /* GL_TEXTURE_STENCIL_SIZE */
- 1697, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */
- 894, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */
- 897, /* GL_MAX_PROGRAM_IF_DEPTH_NV */
- 901, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */
- 900, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */
- 857, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */
- 1535, /* GL_STENCIL_TEST_TWO_SIDE_EXT */
+ 1746, /* GL_TEXTURE_STENCIL_SIZE */
+ 1698, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */
+ 895, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */
+ 898, /* GL_MAX_PROGRAM_IF_DEPTH_NV */
+ 902, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */
+ 901, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */
+ 858, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */
+ 1536, /* GL_STENCIL_TEST_TWO_SIDE_EXT */
17, /* GL_ACTIVE_STENCIL_FACE_EXT */
- 961, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */
- 1401, /* GL_SAMPLES_PASSED */
+ 962, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */
+ 1402, /* GL_SAMPLES_PASSED */
109, /* GL_BUFFER_SERIALIZED_MODIFY_APPLE */
104, /* GL_BUFFER_FLUSHING_UNMAP_APPLE */
537, /* GL_FRAGMENT_SHADER */
- 1861, /* GL_VERTEX_SHADER */
- 1250, /* GL_PROGRAM_OBJECT_ARB */
- 1433, /* GL_SHADER_OBJECT_ARB */
- 882, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */
- 944, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */
- 938, /* GL_MAX_VARYING_FLOATS */
- 942, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */
- 867, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */
- 1053, /* GL_OBJECT_TYPE_ARB */
- 1435, /* GL_SHADER_TYPE */
+ 1862, /* GL_VERTEX_SHADER */
+ 1251, /* GL_PROGRAM_OBJECT_ARB */
+ 1434, /* GL_SHADER_OBJECT_ARB */
+ 883, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */
+ 945, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */
+ 939, /* GL_MAX_VARYING_FLOATS */
+ 943, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */
+ 868, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */
+ 1054, /* GL_OBJECT_TYPE_ARB */
+ 1436, /* GL_SHADER_TYPE */
502, /* GL_FLOAT_VEC2 */
504, /* GL_FLOAT_VEC3 */
506, /* GL_FLOAT_VEC4 */
- 659, /* GL_INT_VEC2 */
- 661, /* GL_INT_VEC3 */
- 663, /* GL_INT_VEC4 */
+ 660, /* GL_INT_VEC2 */
+ 662, /* GL_INT_VEC3 */
+ 664, /* GL_INT_VEC4 */
94, /* GL_BOOL */
96, /* GL_BOOL_VEC2 */
98, /* GL_BOOL_VEC3 */
@@ -5007,12 +5010,12 @@ static const unsigned reduced_enums[1350] =
490, /* GL_FLOAT_MAT2 */
494, /* GL_FLOAT_MAT3 */
498, /* GL_FLOAT_MAT4 */
- 1392, /* GL_SAMPLER_1D */
- 1394, /* GL_SAMPLER_2D */
- 1396, /* GL_SAMPLER_3D */
- 1397, /* GL_SAMPLER_CUBE */
- 1393, /* GL_SAMPLER_1D_SHADOW */
- 1395, /* GL_SAMPLER_2D_SHADOW */
+ 1393, /* GL_SAMPLER_1D */
+ 1395, /* GL_SAMPLER_2D */
+ 1397, /* GL_SAMPLER_3D */
+ 1398, /* GL_SAMPLER_CUBE */
+ 1394, /* GL_SAMPLER_1D_SHADOW */
+ 1396, /* GL_SAMPLER_2D_SHADOW */
492, /* GL_FLOAT_MAT2x3 */
493, /* GL_FLOAT_MAT2x4 */
496, /* GL_FLOAT_MAT3x2 */
@@ -5021,61 +5024,61 @@ static const unsigned reduced_enums[1350] =
501, /* GL_FLOAT_MAT4x3 */
345, /* GL_DELETE_STATUS */
246, /* GL_COMPILE_STATUS */
- 715, /* GL_LINK_STATUS */
- 1809, /* GL_VALIDATE_STATUS */
- 644, /* GL_INFO_LOG_LENGTH */
+ 716, /* GL_LINK_STATUS */
+ 1810, /* GL_VALIDATE_STATUS */
+ 645, /* GL_INFO_LOG_LENGTH */
56, /* GL_ATTACHED_SHADERS */
20, /* GL_ACTIVE_UNIFORMS */
21, /* GL_ACTIVE_UNIFORM_MAX_LENGTH */
- 1434, /* GL_SHADER_SOURCE_LENGTH */
+ 1435, /* GL_SHADER_SOURCE_LENGTH */
15, /* GL_ACTIVE_ATTRIBUTES */
16, /* GL_ACTIVE_ATTRIBUTE_MAX_LENGTH */
539, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */
- 1437, /* GL_SHADING_LANGUAGE_VERSION */
+ 1438, /* GL_SHADING_LANGUAGE_VERSION */
322, /* GL_CURRENT_PROGRAM */
- 1102, /* GL_PALETTE4_RGB8_OES */
- 1104, /* GL_PALETTE4_RGBA8_OES */
- 1100, /* GL_PALETTE4_R5_G6_B5_OES */
- 1103, /* GL_PALETTE4_RGBA4_OES */
- 1101, /* GL_PALETTE4_RGB5_A1_OES */
- 1107, /* GL_PALETTE8_RGB8_OES */
- 1109, /* GL_PALETTE8_RGBA8_OES */
- 1105, /* GL_PALETTE8_R5_G6_B5_OES */
- 1108, /* GL_PALETTE8_RGBA4_OES */
- 1106, /* GL_PALETTE8_RGB5_A1_OES */
- 626, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */
- 625, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */
- 1794, /* GL_UNSIGNED_NORMALIZED */
- 1632, /* GL_TEXTURE_1D_ARRAY_EXT */
- 1272, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */
- 1634, /* GL_TEXTURE_2D_ARRAY_EXT */
- 1275, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */
- 1640, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */
- 1642, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */
- 1490, /* GL_SRGB */
- 1491, /* GL_SRGB8 */
- 1493, /* GL_SRGB_ALPHA */
- 1492, /* GL_SRGB8_ALPHA8 */
- 1450, /* GL_SLUMINANCE_ALPHA */
- 1449, /* GL_SLUMINANCE8_ALPHA8 */
- 1447, /* GL_SLUMINANCE */
- 1448, /* GL_SLUMINANCE8 */
+ 1103, /* GL_PALETTE4_RGB8_OES */
+ 1105, /* GL_PALETTE4_RGBA8_OES */
+ 1101, /* GL_PALETTE4_R5_G6_B5_OES */
+ 1104, /* GL_PALETTE4_RGBA4_OES */
+ 1102, /* GL_PALETTE4_RGB5_A1_OES */
+ 1108, /* GL_PALETTE8_RGB8_OES */
+ 1110, /* GL_PALETTE8_RGBA8_OES */
+ 1106, /* GL_PALETTE8_R5_G6_B5_OES */
+ 1109, /* GL_PALETTE8_RGBA4_OES */
+ 1107, /* GL_PALETTE8_RGB5_A1_OES */
+ 627, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */
+ 626, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */
+ 1795, /* GL_UNSIGNED_NORMALIZED */
+ 1633, /* GL_TEXTURE_1D_ARRAY_EXT */
+ 1273, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */
+ 1635, /* GL_TEXTURE_2D_ARRAY_EXT */
+ 1276, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */
+ 1641, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */
+ 1643, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */
+ 1491, /* GL_SRGB */
+ 1492, /* GL_SRGB8 */
+ 1494, /* GL_SRGB_ALPHA */
+ 1493, /* GL_SRGB8_ALPHA8 */
+ 1451, /* GL_SLUMINANCE_ALPHA */
+ 1450, /* GL_SLUMINANCE8_ALPHA8 */
+ 1448, /* GL_SLUMINANCE */
+ 1449, /* GL_SLUMINANCE8 */
267, /* GL_COMPRESSED_SRGB */
268, /* GL_COMPRESSED_SRGB_ALPHA */
265, /* GL_COMPRESSED_SLUMINANCE */
266, /* GL_COMPRESSED_SLUMINANCE_ALPHA */
- 1167, /* GL_POINT_SPRITE_COORD_ORIGIN */
- 723, /* GL_LOWER_LEFT */
- 1806, /* GL_UPPER_LEFT */
- 1513, /* GL_STENCIL_BACK_REF */
- 1514, /* GL_STENCIL_BACK_VALUE_MASK */
- 1515, /* GL_STENCIL_BACK_WRITEMASK */
+ 1168, /* GL_POINT_SPRITE_COORD_ORIGIN */
+ 724, /* GL_LOWER_LEFT */
+ 1807, /* GL_UPPER_LEFT */
+ 1514, /* GL_STENCIL_BACK_REF */
+ 1515, /* GL_STENCIL_BACK_VALUE_MASK */
+ 1516, /* GL_STENCIL_BACK_WRITEMASK */
444, /* GL_DRAW_FRAMEBUFFER_BINDING */
- 1324, /* GL_RENDERBUFFER_BINDING */
- 1304, /* GL_READ_FRAMEBUFFER */
+ 1325, /* GL_RENDERBUFFER_BINDING */
+ 1305, /* GL_READ_FRAMEBUFFER */
443, /* GL_DRAW_FRAMEBUFFER */
- 1305, /* GL_READ_FRAMEBUFFER_BINDING */
- 1335, /* GL_RENDERBUFFER_SAMPLES */
+ 1306, /* GL_READ_FRAMEBUFFER_BINDING */
+ 1336, /* GL_RENDERBUFFER_SAMPLES */
549, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */
547, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */
558, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */
@@ -5091,7 +5094,7 @@ static const unsigned reduced_enums[1350] =
577, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER */
581, /* GL_FRAMEBUFFER_UNSUPPORTED */
579, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */
- 863, /* GL_MAX_COLOR_ATTACHMENTS */
+ 864, /* GL_MAX_COLOR_ATTACHMENTS */
155, /* GL_COLOR_ATTACHMENT0 */
157, /* GL_COLOR_ATTACHMENT1 */
171, /* GL_COLOR_ATTACHMENT2 */
@@ -5109,58 +5112,58 @@ static const unsigned reduced_enums[1350] =
166, /* GL_COLOR_ATTACHMENT14 */
168, /* GL_COLOR_ATTACHMENT15 */
349, /* GL_DEPTH_ATTACHMENT */
- 1503, /* GL_STENCIL_ATTACHMENT */
+ 1504, /* GL_STENCIL_ATTACHMENT */
540, /* GL_FRAMEBUFFER */
- 1322, /* GL_RENDERBUFFER */
- 1338, /* GL_RENDERBUFFER_WIDTH */
- 1330, /* GL_RENDERBUFFER_HEIGHT */
- 1332, /* GL_RENDERBUFFER_INTERNAL_FORMAT */
- 1530, /* GL_STENCIL_INDEX_EXT */
- 1522, /* GL_STENCIL_INDEX1 */
- 1526, /* GL_STENCIL_INDEX4 */
- 1528, /* GL_STENCIL_INDEX8 */
- 1523, /* GL_STENCIL_INDEX16 */
- 1334, /* GL_RENDERBUFFER_RED_SIZE */
- 1329, /* GL_RENDERBUFFER_GREEN_SIZE */
- 1326, /* GL_RENDERBUFFER_BLUE_SIZE */
- 1323, /* GL_RENDERBUFFER_ALPHA_SIZE */
- 1327, /* GL_RENDERBUFFER_DEPTH_SIZE */
- 1337, /* GL_RENDERBUFFER_STENCIL_SIZE */
+ 1323, /* GL_RENDERBUFFER */
+ 1339, /* GL_RENDERBUFFER_WIDTH */
+ 1331, /* GL_RENDERBUFFER_HEIGHT */
+ 1333, /* GL_RENDERBUFFER_INTERNAL_FORMAT */
+ 1531, /* GL_STENCIL_INDEX_EXT */
+ 1523, /* GL_STENCIL_INDEX1 */
+ 1527, /* GL_STENCIL_INDEX4 */
+ 1529, /* GL_STENCIL_INDEX8 */
+ 1524, /* GL_STENCIL_INDEX16 */
+ 1335, /* GL_RENDERBUFFER_RED_SIZE */
+ 1330, /* GL_RENDERBUFFER_GREEN_SIZE */
+ 1327, /* GL_RENDERBUFFER_BLUE_SIZE */
+ 1324, /* GL_RENDERBUFFER_ALPHA_SIZE */
+ 1328, /* GL_RENDERBUFFER_DEPTH_SIZE */
+ 1338, /* GL_RENDERBUFFER_STENCIL_SIZE */
575, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */
- 921, /* GL_MAX_SAMPLES */
- 1299, /* GL_QUERY_WAIT_NV */
- 1294, /* GL_QUERY_NO_WAIT_NV */
- 1291, /* GL_QUERY_BY_REGION_WAIT_NV */
- 1290, /* GL_QUERY_BY_REGION_NO_WAIT_NV */
- 1286, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */
+ 922, /* GL_MAX_SAMPLES */
+ 1300, /* GL_QUERY_WAIT_NV */
+ 1295, /* GL_QUERY_NO_WAIT_NV */
+ 1292, /* GL_QUERY_BY_REGION_WAIT_NV */
+ 1291, /* GL_QUERY_BY_REGION_NO_WAIT_NV */
+ 1287, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */
486, /* GL_FIRST_VERTEX_CONVENTION */
- 674, /* GL_LAST_VERTEX_CONVENTION */
- 1264, /* GL_PROVOKING_VERTEX */
+ 675, /* GL_LAST_VERTEX_CONVENTION */
+ 1265, /* GL_PROVOKING_VERTEX */
302, /* GL_COPY_READ_BUFFER */
303, /* GL_COPY_WRITE_BUFFER */
- 1385, /* GL_RGBA_SNORM */
- 1381, /* GL_RGBA8_SNORM */
- 1443, /* GL_SIGNED_NORMALIZED */
- 923, /* GL_MAX_SERVER_WAIT_TIMEOUT */
- 1052, /* GL_OBJECT_TYPE */
- 1551, /* GL_SYNC_CONDITION */
- 1556, /* GL_SYNC_STATUS */
- 1553, /* GL_SYNC_FLAGS */
- 1552, /* GL_SYNC_FENCE */
- 1555, /* GL_SYNC_GPU_COMMANDS_COMPLETE */
- 1782, /* GL_UNSIGNALED */
- 1442, /* GL_SIGNALED */
+ 1386, /* GL_RGBA_SNORM */
+ 1382, /* GL_RGBA8_SNORM */
+ 1444, /* GL_SIGNED_NORMALIZED */
+ 924, /* GL_MAX_SERVER_WAIT_TIMEOUT */
+ 1053, /* GL_OBJECT_TYPE */
+ 1552, /* GL_SYNC_CONDITION */
+ 1557, /* GL_SYNC_STATUS */
+ 1554, /* GL_SYNC_FLAGS */
+ 1553, /* GL_SYNC_FENCE */
+ 1556, /* GL_SYNC_GPU_COMMANDS_COMPLETE */
+ 1783, /* GL_UNSIGNALED */
+ 1443, /* GL_SIGNALED */
46, /* GL_ALREADY_SIGNALED */
- 1754, /* GL_TIMEOUT_EXPIRED */
+ 1755, /* GL_TIMEOUT_EXPIRED */
270, /* GL_CONDITION_SATISFIED */
- 1866, /* GL_WAIT_FAILED */
+ 1867, /* GL_WAIT_FAILED */
471, /* GL_EVAL_BIT */
- 1302, /* GL_RASTER_POSITION_UNCLIPPED_IBM */
- 717, /* GL_LIST_BIT */
- 1648, /* GL_TEXTURE_BIT */
- 1416, /* GL_SCISSOR_BIT */
+ 1303, /* GL_RASTER_POSITION_UNCLIPPED_IBM */
+ 718, /* GL_LIST_BIT */
+ 1649, /* GL_TEXTURE_BIT */
+ 1417, /* GL_SCISSOR_BIT */
29, /* GL_ALL_ATTRIB_BITS */
- 1008, /* GL_MULTISAMPLE_BIT */
+ 1009, /* GL_MULTISAMPLE_BIT */
30, /* GL_ALL_CLIENT_ATTRIB_BITS */
};
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 00427aa5806..73be24d80cf 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -50,11 +50,13 @@ static const struct {
{ OFF, "GL_ARB_depth_clamp", F(ARB_depth_clamp) },
{ ON, "GL_ARB_draw_buffers", F(ARB_draw_buffers) },
{ OFF, "GL_ARB_draw_elements_base_vertex", F(ARB_draw_elements_base_vertex) },
+ { OFF, "GL_ARB_fragment_coord_conventions", F(ARB_fragment_coord_conventions) },
{ OFF, "GL_ARB_fragment_program", F(ARB_fragment_program) },
{ OFF, "GL_ARB_fragment_program_shadow", F(ARB_fragment_program_shadow) },
{ OFF, "GL_ARB_fragment_shader", F(ARB_fragment_shader) },
{ OFF, "GL_ARB_framebuffer_object", F(ARB_framebuffer_object) },
{ OFF, "GL_ARB_half_float_pixel", F(ARB_half_float_pixel) },
+ { OFF, "GL_ARB_half_float_vertex", F(ARB_half_float_vertex) },
{ OFF, "GL_ARB_imaging", F(ARB_imaging) },
{ OFF, "GL_ARB_map_buffer_range", F(ARB_map_buffer_range) },
{ ON, "GL_ARB_multisample", F(ARB_multisample) },
@@ -219,6 +221,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx)
ctx->Extensions.ARB_framebuffer_object = GL_TRUE;
#endif
ctx->Extensions.ARB_half_float_pixel = GL_TRUE;
+ ctx->Extensions.ARB_half_float_vertex = GL_TRUE;
ctx->Extensions.ARB_imaging = GL_TRUE;
ctx->Extensions.ARB_map_buffer_range = GL_TRUE;
ctx->Extensions.ARB_multitexture = GL_TRUE;
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 4da245ab495..0e6f69f573a 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -40,13 +40,10 @@
#include "framebuffer.h"
#include "hash.h"
#include "macros.h"
-#include "mipmap.h"
#include "renderbuffer.h"
#include "state.h"
#include "teximage.h"
#include "texobj.h"
-#include "texstore.h"
-#include "texstate.h"
/** Set this to 1 to help debug FBO incompleteness problems */
@@ -957,7 +954,7 @@ renderbuffer_storage(GLenum target, GLenum internalFormat,
/* NumSamples == 0 indicates non-multisampling */
samples = 0;
}
- else if (samples > ctx->Const.MaxSamples) {
+ else if (samples > (GLsizei) ctx->Const.MaxSamples) {
/* note: driver may choose to use more samples than what's requested */
_mesa_error(ctx, GL_INVALID_VALUE, "%s(samples)", func);
return;
@@ -1356,15 +1353,26 @@ _mesa_DeleteFramebuffersEXT(GLsizei n, const GLuint *framebuffers)
ASSERT(fb == &DummyFramebuffer || fb->Name == framebuffers[i]);
/* check if deleting currently bound framebuffer object */
- if (fb == ctx->DrawBuffer) {
- /* bind default */
- ASSERT(fb->RefCount >= 2);
- _mesa_BindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0);
+ if (ctx->Extensions.EXT_framebuffer_blit) {
+ /* separate draw/read binding points */
+ if (fb == ctx->DrawBuffer) {
+ /* bind default */
+ ASSERT(fb->RefCount >= 2);
+ _mesa_BindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0);
+ }
+ if (fb == ctx->ReadBuffer) {
+ /* bind default */
+ ASSERT(fb->RefCount >= 2);
+ _mesa_BindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0);
+ }
}
- if (fb == ctx->ReadBuffer) {
- /* bind default */
- ASSERT(fb->RefCount >= 2);
- _mesa_BindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0);
+ else {
+ /* only one binding point for read/draw buffers */
+ if (fb == ctx->DrawBuffer || fb == ctx->ReadBuffer) {
+ /* bind default */
+ ASSERT(fb->RefCount >= 2);
+ _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+ }
}
/* remove from hash table immediately, to free the ID */
diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index 5983f00e2dd..d0c9c0028b2 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -27,7 +27,6 @@
#include "imports.h"
#include "formats.h"
#include "config.h"
-#include "texstore.h"
/**
diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
index fc278bb8afa..81993e7063b 100644
--- a/src/mesa/main/image.c
+++ b/src/mesa/main/image.c
@@ -37,7 +37,6 @@
#include "image.h"
#include "imports.h"
#include "macros.h"
-#include "pixel.h"
/**
diff --git a/src/mesa/main/lines.c b/src/mesa/main/lines.c
index 81d0d33abb4..cc63a759ec0 100644
--- a/src/mesa/main/lines.c
+++ b/src/mesa/main/lines.c
@@ -25,10 +25,8 @@
#include "glheader.h"
#include "context.h"
-#include "depth.h"
#include "lines.h"
#include "macros.h"
-#include "texstate.h"
#include "mtypes.h"
diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
index 7350c7a3d2c..77cd1d41595 100644
--- a/src/mesa/main/mipmap.c
+++ b/src/mesa/main/mipmap.c
@@ -30,7 +30,6 @@
#include "imports.h"
#include "formats.h"
#include "mipmap.h"
-#include "texcompress.h"
#include "teximage.h"
#include "texstore.h"
#include "image.h"
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 7eff5cadd0d..297c5ae878a 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1762,6 +1762,8 @@ struct gl_fragment_program
struct gl_program Base; /**< base class */
GLenum FogOption;
GLboolean UsesKill; /**< shader uses KIL instruction */
+ GLboolean OriginUpperLeft;
+ GLboolean PixelCenterInteger;
};
@@ -2395,11 +2397,13 @@ struct gl_extensions
GLboolean ARB_depth_clamp;
GLboolean ARB_draw_buffers;
GLboolean ARB_draw_elements_base_vertex;
+ GLboolean ARB_fragment_coord_conventions;
GLboolean ARB_fragment_program;
GLboolean ARB_fragment_program_shadow;
GLboolean ARB_fragment_shader;
GLboolean ARB_framebuffer_object;
GLboolean ARB_half_float_pixel;
+ GLboolean ARB_half_float_vertex;
GLboolean ARB_imaging;
GLboolean ARB_map_buffer_range;
GLboolean ARB_multisample;
diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c
index 3820ebd8894..f6f9c1173a1 100644
--- a/src/mesa/main/pixel.c
+++ b/src/mesa/main/pixel.c
@@ -32,7 +32,6 @@
#include "bufferobj.h"
#include "colormac.h"
#include "context.h"
-#include "image.h"
#include "macros.h"
#include "pixel.h"
#include "mtypes.h"
diff --git a/src/mesa/main/pixelstore.c b/src/mesa/main/pixelstore.c
index 6a641f83f27..ec585ef0cce 100644
--- a/src/mesa/main/pixelstore.c
+++ b/src/mesa/main/pixelstore.c
@@ -30,10 +30,7 @@
#include "glheader.h"
#include "bufferobj.h"
-#include "colormac.h"
#include "context.h"
-#include "image.h"
-#include "macros.h"
#include "pixelstore.h"
#include "mtypes.h"
diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c
index dcaeccd90d4..e743a2e6bdb 100644
--- a/src/mesa/main/points.c
+++ b/src/mesa/main/points.c
@@ -32,7 +32,6 @@
#include "context.h"
#include "macros.h"
#include "points.h"
-#include "texstate.h"
#include "mtypes.h"
diff --git a/src/mesa/main/polygon.c b/src/mesa/main/polygon.c
index 376a87a3967..dcde6758c3f 100644
--- a/src/mesa/main/polygon.c
+++ b/src/mesa/main/polygon.c
@@ -34,7 +34,6 @@
#include "context.h"
#include "image.h"
#include "enums.h"
-#include "macros.h"
#include "polygon.h"
#include "mtypes.h"
diff --git a/src/mesa/main/scissor.c b/src/mesa/main/scissor.c
index b5f4cde7898..523f3c3ab83 100644
--- a/src/mesa/main/scissor.c
+++ b/src/mesa/main/scissor.c
@@ -37,14 +37,14 @@ _mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height )
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glScissor %d %d %d %d\n", x, y, width, height);
+
if (width < 0 || height < 0) {
_mesa_error( ctx, GL_INVALID_VALUE, "glScissor" );
return;
}
- if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug(ctx, "glScissor %d %d %d %d\n", x, y, width, height);
-
_mesa_set_scissor(ctx, x, y, width, height);
}
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index f10e6b04b7c..5e07d1d2f15 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -48,7 +48,6 @@
#include "texenvprogram.h"
#include "texobj.h"
#include "texstate.h"
-#include "viewport.h"
static void
@@ -83,12 +82,6 @@ compute_max_element(struct gl_client_array *array)
} else {
array->_MaxElement = 0;
}
- /* Compute the max element we can access in the VBO without going
- * out of bounds.
- */
- array->_MaxElement = ((GLsizeiptrARB) array->BufferObj->Size
- - (GLsizeiptrARB) array->Ptr + array->StrideB
- - array->_ElementSize) / array->StrideB;
}
else {
/* user-space array, no idea how big it is */
diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c
index a4f1926ab37..cff6de89ee3 100644
--- a/src/mesa/main/texcompress.c
+++ b/src/mesa/main/texcompress.c
@@ -35,10 +35,7 @@
#include "colormac.h"
#include "context.h"
#include "formats.h"
-#include "image.h"
-#include "mipmap.h"
#include "texcompress.h"
-#include "texstore.h"
/**
diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
index 1a374e7bee5..096945a6432 100644
--- a/src/mesa/main/texformat.c
+++ b/src/mesa/main/texformat.c
@@ -35,8 +35,6 @@
#include "context.h"
#include "texcompress.h"
-#include "texcompress_fxt1.h"
-#include "texcompress_s3tc.h"
#include "texformat.h"
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index d7943eaa1e9..66d01c15d04 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -35,10 +35,8 @@
#include "context.h"
#include "formats.h"
#include "image.h"
-#include "texcompress.h"
#include "texgetimage.h"
#include "teximage.h"
-#include "texstate.h"
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index b946f3c69d7..da3c6f9841f 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -46,7 +46,6 @@
#include "texfetch.h"
#include "teximage.h"
#include "texstate.h"
-#include "texstore.h"
#include "mtypes.h"
@@ -3225,8 +3224,8 @@ compressed_subtexture_error_check2(GLcontext *ctx, GLuint dims,
}
if (((width == 1 || width == 2) &&
- (GLuint) width != texImage->Width) ||
- (width > texImage->Width)) {
+ width != (GLsizei) texImage->Width) ||
+ (width > (GLsizei) texImage->Width)) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glCompressedTexSubImage%uD(width=%d)", dims, width);
return GL_TRUE;
@@ -3234,8 +3233,8 @@ compressed_subtexture_error_check2(GLcontext *ctx, GLuint dims,
if (dims >= 2) {
if (((height == 1 || height == 2) &&
- (GLuint) height != texImage->Height) ||
- (height > texImage->Height)) {
+ height != (GLsizei) texImage->Height) ||
+ (height > (GLsizei) texImage->Height)) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glCompressedTexSubImage%uD(height=%d)", dims, height);
return GL_TRUE;
@@ -3244,8 +3243,8 @@ compressed_subtexture_error_check2(GLcontext *ctx, GLuint dims,
if (dims >= 3) {
if (((depth == 1 || depth == 2) &&
- (GLuint) depth != texImage->Depth) ||
- (depth > texImage->Depth)) {
+ depth != (GLsizei) texImage->Depth) ||
+ (depth > (GLsizei) texImage->Depth)) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glCompressedTexSubImage%uD(depth=%d)", dims, depth);
return GL_TRUE;
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 7f0a246025a..9db95814d00 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -38,7 +38,6 @@
#include "imports.h"
#include "macros.h"
#include "teximage.h"
-#include "texstate.h"
#include "texobj.h"
#include "mtypes.h"
#include "shader/prog_instruction.h"
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index d917e21e744..c4f24950187 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -33,7 +33,6 @@
#include "main/glheader.h"
#include "main/colormac.h"
#include "main/context.h"
-#include "main/enums.h"
#include "main/formats.h"
#include "main/macros.h"
#include "main/texcompress.h"
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index c735e18affb..2b26f651a54 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -35,11 +35,9 @@
#include "context.h"
#include "enums.h"
#include "macros.h"
-#include "texcompress.h"
#include "texobj.h"
#include "teximage.h"
#include "texstate.h"
-#include "texenvprogram.h"
#include "mtypes.h"
@@ -293,7 +291,8 @@ _mesa_ActiveTextureARB(GLenum texture)
_mesa_lookup_enum_by_nr(texture));
if (texUnit >= ctx->Const.MaxTextureImageUnits) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glActiveTexture(texture)");
+ _mesa_error(ctx, GL_INVALID_ENUM, "glActiveTexture(texture=%s)",
+ _mesa_lookup_enum_by_nr(texture));
return;
}
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index 792c83141ec..fcd0a56d76a 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -263,7 +263,7 @@ compute_component_mapping(GLenum inFormat, GLenum outFormat,
map[ZERO] = ZERO;
map[ONE] = ONE;
-/*
+#if 0
_mesa_printf("from %x/%s to %x/%s map %d %d %d %d %d %d\n",
inFormat, _mesa_lookup_enum_by_nr(inFormat),
outFormat, _mesa_lookup_enum_by_nr(outFormat),
@@ -273,7 +273,7 @@ compute_component_mapping(GLenum inFormat, GLenum outFormat,
map[3],
map[4],
map[5]);
-*/
+#endif
}
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index c2193074cdf..0b6295d5e16 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -121,6 +121,9 @@ _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
case GL_DOUBLE:
elementSize = size * sizeof(GLdouble);
break;
+ case GL_HALF_FLOAT:
+ elementSize = size * sizeof(GLhalfARB);
+ break;
#if FEATURE_fixedpt
case GL_FIXED:
elementSize = size * sizeof(GLfixed);
@@ -174,6 +177,9 @@ _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr )
case GL_DOUBLE:
elementSize = 3 * sizeof(GLdouble);
break;
+ case GL_HALF_FLOAT:
+ elementSize = 3 * sizeof(GLhalfARB);
+ break;
#if FEATURE_fixedpt
case GL_FIXED:
elementSize = 3 * sizeof(GLfixed);
@@ -250,6 +256,9 @@ _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
case GL_DOUBLE:
elementSize = size * sizeof(GLdouble);
break;
+ case GL_HALF_FLOAT:
+ elementSize = size * sizeof(GLhalfARB);
+ break;
#if FEATURE_fixedpt
case GL_FIXED:
elementSize = size * sizeof(GLfixed);
@@ -285,6 +294,9 @@ _mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr)
case GL_DOUBLE:
elementSize = sizeof(GLdouble);
break;
+ case GL_HALF_FLOAT:
+ elementSize = sizeof(GLhalfARB);
+ break;
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glFogCoordPointer(type)" );
return;
@@ -394,6 +406,9 @@ _mesa_SecondaryColorPointerEXT(GLint size, GLenum type,
case GL_DOUBLE:
elementSize = size * sizeof(GLdouble);
break;
+ case GL_HALF_FLOAT:
+ elementSize = size * sizeof(GLhalfARB);
+ break;
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glSecondaryColorPointer(type=%s)",
_mesa_lookup_enum_by_nr(type));
@@ -441,6 +456,9 @@ _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride,
case GL_DOUBLE:
elementSize = size * sizeof(GLdouble);
break;
+ case GL_HALF_FLOAT:
+ elementSize = size * sizeof(GLhalfARB);
+ break;
#if FEATURE_fixedpt
case GL_FIXED:
elementSize = size * sizeof(GLfixed);
@@ -670,6 +688,9 @@ _mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type,
case GL_DOUBLE:
elementSize = size * sizeof(GLdouble);
break;
+ case GL_HALF_FLOAT:
+ elementSize = size * sizeof(GLhalfARB);
+ break;
#if FEATURE_fixedpt
case GL_FIXED:
elementSize = size * sizeof(GLfixed);
diff --git a/src/mesa/main/vtxfmt.c b/src/mesa/main/vtxfmt.c
index c9eea8ab830..0dd3e5e52ee 100644
--- a/src/mesa/main/vtxfmt.c
+++ b/src/mesa/main/vtxfmt.c
@@ -28,11 +28,9 @@
#include "glheader.h"
#include "api_arrayelt.h"
-#include "api_loopback.h"
#include "context.h"
#include "imports.h"
#include "mtypes.h"
-#include "state.h"
#include "vtxfmt.h"
#include "eval.h"
#include "dlist.h"
diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c
index a09be71020e..bdd26b7f3a7 100644
--- a/src/mesa/shader/arbprogparse.c
+++ b/src/mesa/shader/arbprogparse.c
@@ -54,10 +54,8 @@ having three separate program parameter arrays.
#include "main/glheader.h"
#include "main/imports.h"
#include "main/context.h"
-#include "main/macros.h"
#include "main/mtypes.h"
#include "arbprogparse.h"
-#include "program.h"
#include "programopt.h"
#include "prog_parameter.h"
#include "prog_statevars.h"
@@ -123,6 +121,8 @@ _mesa_parse_arb_fragment_program(GLcontext* ctx, GLenum target,
case OPTION_FOG_LINEAR: program->FogOption = GL_LINEAR; break;
default: program->FogOption = GL_NONE; break;
}
+ program->OriginUpperLeft = state.option.OriginUpperLeft;
+ program->PixelCenterInteger = state.option.PixelCenterInteger;
program->UsesKill = state.fragment.UsesKill;
diff --git a/src/mesa/shader/arbprogram.c b/src/mesa/shader/arbprogram.c
index eb537cd1b99..746138071ed 100644
--- a/src/mesa/shader/arbprogram.c
+++ b/src/mesa/shader/arbprogram.c
@@ -180,23 +180,24 @@ _mesa_DeletePrograms(GLsizei n, const GLuint *ids)
}
else if (prog) {
/* Unbind program if necessary */
- if (prog->Target == GL_VERTEX_PROGRAM_ARB || /* == GL_VERTEX_PROGRAM_NV */
- prog->Target == GL_VERTEX_STATE_PROGRAM_NV) {
+ switch (prog->Target) {
+ case GL_VERTEX_PROGRAM_ARB: /* == GL_VERTEX_PROGRAM_NV */
+ case GL_VERTEX_STATE_PROGRAM_NV:
if (ctx->VertexProgram.Current &&
ctx->VertexProgram.Current->Base.Id == ids[i]) {
/* unbind this currently bound program */
_mesa_BindProgram(prog->Target, 0);
}
- }
- else if (prog->Target == GL_FRAGMENT_PROGRAM_NV ||
- prog->Target == GL_FRAGMENT_PROGRAM_ARB) {
+ break;
+ case GL_FRAGMENT_PROGRAM_NV:
+ case GL_FRAGMENT_PROGRAM_ARB:
if (ctx->FragmentProgram.Current &&
ctx->FragmentProgram.Current->Base.Id == ids[i]) {
/* unbind this currently bound program */
_mesa_BindProgram(prog->Target, 0);
}
- }
- else {
+ break;
+ default:
_mesa_problem(ctx, "bad target in glDeleteProgramsNV");
return;
}
@@ -561,6 +562,8 @@ _mesa_ProgramEnvParameter4fARB(GLenum target, GLuint index,
}
}
+
+
/**
* Set a program env parameter register.
* \note Called from the GL API dispatcher.
@@ -569,10 +572,35 @@ _mesa_ProgramEnvParameter4fARB(GLenum target, GLuint index,
*/
void GLAPIENTRY
_mesa_ProgramEnvParameter4fvARB(GLenum target, GLuint index,
- const GLfloat *params)
+ const GLfloat *params)
{
- _mesa_ProgramEnvParameter4fARB(target, index, params[0], params[1],
- params[2], params[3]);
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);
+
+ if (target == GL_FRAGMENT_PROGRAM_ARB
+ && ctx->Extensions.ARB_fragment_program) {
+ if (index >= ctx->Const.FragmentProgram.MaxEnvParams) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glProgramEnvParameter4fv(index)");
+ return;
+ }
+ memcpy(ctx->FragmentProgram.Parameters[index], params,
+ 4 * sizeof(GLfloat));
+ }
+ else if (target == GL_VERTEX_PROGRAM_ARB /* == GL_VERTEX_PROGRAM_NV */
+ && (ctx->Extensions.ARB_vertex_program || ctx->Extensions.NV_vertex_program)) {
+ if (index >= ctx->Const.VertexProgram.MaxEnvParams) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glProgramEnvParameter4fv(index)");
+ return;
+ }
+ memcpy(ctx->VertexProgram.Parameters[index], params,
+ 4 * sizeof(GLfloat));
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glProgramEnvParameter4fv(target)");
+ return;
+ }
}
@@ -581,7 +609,6 @@ _mesa_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
const GLfloat *params)
{
GET_CURRENT_CONTEXT(ctx);
- GLint i;
GLfloat * dest;
ASSERT_OUTSIDE_BEGIN_END(ctx);
@@ -612,11 +639,7 @@ _mesa_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
return;
}
- for ( i = 0 ; i < count ; i++ ) {
- COPY_4V(dest, params);
- params += 4;
- dest += 4;
- }
+ memcpy(dest, params, count * 4 * sizeof(GLfloat));
}
@@ -729,8 +752,7 @@ _mesa_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
const GLfloat *params)
{
GET_CURRENT_CONTEXT(ctx);
- struct gl_program *prog;
- GLint i;
+ GLfloat *dest;
ASSERT_OUTSIDE_BEGIN_END(ctx);
FLUSH_VERTICES(ctx, _NEW_PROGRAM_CONSTANTS);
@@ -745,7 +767,7 @@ _mesa_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
_mesa_error(ctx, GL_INVALID_VALUE, "glProgramLocalParameters4fvEXT(index + count)");
return;
}
- prog = &(ctx->FragmentProgram.Current->Base);
+ dest = ctx->FragmentProgram.Current->Base.LocalParams[index];
}
else if (target == GL_VERTEX_PROGRAM_ARB
&& ctx->Extensions.ARB_vertex_program) {
@@ -753,18 +775,14 @@ _mesa_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count,
_mesa_error(ctx, GL_INVALID_VALUE, "glProgramLocalParameters4fvEXT(index + count)");
return;
}
- prog = &(ctx->VertexProgram.Current->Base);
+ dest = ctx->VertexProgram.Current->Base.LocalParams[index];
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glProgramLocalParameters4fvEXT(target)");
return;
}
- for (i = 0; i < count; i++) {
- ASSERT((index + i) < MAX_PROGRAM_LOCAL_PARAMS);
- COPY_4V(prog->LocalParams[index + i], params);
- params += 4;
- }
+ memcpy(dest, params, count * 4 * sizeof(GLfloat));
}
diff --git a/src/mesa/shader/lex.yy.c b/src/mesa/shader/lex.yy.c
index 68543ae2e12..d1af35fedb6 100644
--- a/src/mesa/shader/lex.yy.c
+++ b/src/mesa/shader/lex.yy.c
@@ -1043,12 +1043,12 @@ static yyconst flex_int16_t yy_chk[1368] =
*/
#include "main/glheader.h"
#include "main/imports.h"
-#include "prog_instruction.h"
-#include "prog_statevars.h"
+#include "shader/prog_instruction.h"
+#include "shader/prog_statevars.h"
-#include "symbol_table.h"
-#include "program_parser.h"
-#include "program_parse.tab.h"
+#include "shader/symbol_table.h"
+#include "shader/program_parser.h"
+#include "shader/program_parse.tab.h"
#define require_ARB_vp (yyextra->mode == ARB_vertex)
#define require_ARB_fp (yyextra->mode == ARB_fragment)
diff --git a/src/mesa/shader/nvprogram.c b/src/mesa/shader/nvprogram.c
index fd6cbb0f409..87f295e39ae 100644
--- a/src/mesa/shader/nvprogram.c
+++ b/src/mesa/shader/nvprogram.c
@@ -515,7 +515,7 @@ _mesa_emit_nv_temp_initialization(GLcontext *ctx,
struct gl_program *program)
{
struct prog_instruction *inst;
- int i;
+ GLuint i;
if (!ctx->Shader.EmitNVTempInitialization)
return;
@@ -559,7 +559,7 @@ _mesa_emit_nv_temp_initialization(GLcontext *ctx,
void
_mesa_setup_nv_temporary_count(GLcontext *ctx, struct gl_program *program)
{
- int i;
+ GLuint i;
program->NumTemporaries = 0;
for (i = 0; i < program->NumInstructions; i++) {
diff --git a/src/mesa/shader/nvvertparse.c b/src/mesa/shader/nvvertparse.c
index 8574016050c..baff7658d18 100644
--- a/src/mesa/shader/nvvertparse.c
+++ b/src/mesa/shader/nvvertparse.c
@@ -40,7 +40,6 @@
#include "main/glheader.h"
#include "main/context.h"
#include "main/imports.h"
-#include "main/macros.h"
#include "nvprogram.h"
#include "nvvertparse.h"
#include "prog_instruction.h"
diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c
index 7f034520cd4..5641014d2c6 100644
--- a/src/mesa/shader/prog_execute.c
+++ b/src/mesa/shader/prog_execute.c
@@ -38,7 +38,6 @@
#include "main/glheader.h"
#include "main/colormac.h"
#include "main/context.h"
-#include "program.h"
#include "prog_execute.h"
#include "prog_instruction.h"
#include "prog_parameter.h"
@@ -352,6 +351,28 @@ fetch_vector1(const struct prog_src_register *source,
}
+static GLuint
+fetch_vector1ui(const struct prog_src_register *source,
+ const struct gl_program_machine *machine)
+{
+ const GLuint *src = (GLuint *) get_src_register_pointer(source, machine);
+ GLuint result;
+
+ ASSERT(src);
+
+ result = src[GET_SWZ(source->Swizzle, 0)];
+
+ if (source->Abs) {
+ result = FABSF(result);
+ }
+ if (source->Negate) {
+ result = -result;
+ }
+
+ return result;
+}
+
+
/**
* Fetch texel from texture. Use partial derivatives when possible.
*/
@@ -996,12 +1017,12 @@ _mesa_execute_program(GLcontext * ctx,
/* XXX we could probably just use pow() here */
if (a[0] > 0.0F) {
if (a[1] == 0.0 && a[3] == 0.0)
- result[2] = 1.0;
+ result[2] = 1.0F;
else
result[2] = (GLfloat) _mesa_pow(a[1], a[3]);
}
else {
- result[2] = 0.0;
+ result[2] = 0.0F;
}
result[3] = 1.0F;
store_vector4(inst, machine, result);
@@ -1668,13 +1689,11 @@ _mesa_execute_program(GLcontext * ctx,
break;
case OPCODE_UP2H: /* unpack two 16-bit floats */
{
- GLfloat a[4], result[4];
- fi_type fi;
- GLhalfNV hx, hy;
- fetch_vector1(&inst->SrcReg[0], machine, a);
- fi.f = a[0];
- hx = fi.i & 0xffff;
- hy = fi.i >> 16;
+ const GLuint raw = fetch_vector1ui(&inst->SrcReg[0], machine);
+ GLfloat result[4];
+ GLushort hx, hy;
+ hx = raw & 0xffff;
+ hy = raw >> 16;
result[0] = result[2] = _mesa_half_to_float(hx);
result[1] = result[3] = _mesa_half_to_float(hy);
store_vector4(inst, machine, result);
@@ -1682,13 +1701,11 @@ _mesa_execute_program(GLcontext * ctx,
break;
case OPCODE_UP2US: /* unpack two GLushorts */
{
- GLfloat a[4], result[4];
- fi_type fi;
+ const GLuint raw = fetch_vector1ui(&inst->SrcReg[0], machine);
+ GLfloat result[4];
GLushort usx, usy;
- fetch_vector1(&inst->SrcReg[0], machine, a);
- fi.f = a[0];
- usx = fi.i & 0xffff;
- usy = fi.i >> 16;
+ usx = raw & 0xffff;
+ usy = raw >> 16;
result[0] = result[2] = usx * (1.0f / 65535.0f);
result[1] = result[3] = usy * (1.0f / 65535.0f);
store_vector4(inst, machine, result);
@@ -1696,27 +1713,23 @@ _mesa_execute_program(GLcontext * ctx,
break;
case OPCODE_UP4B: /* unpack four GLbytes */
{
- GLfloat a[4], result[4];
- fi_type fi;
- fetch_vector1(&inst->SrcReg[0], machine, a);
- fi.f = a[0];
- result[0] = (((fi.i >> 0) & 0xff) - 128) / 127.0F;
- result[1] = (((fi.i >> 8) & 0xff) - 128) / 127.0F;
- result[2] = (((fi.i >> 16) & 0xff) - 128) / 127.0F;
- result[3] = (((fi.i >> 24) & 0xff) - 128) / 127.0F;
+ const GLuint raw = fetch_vector1ui(&inst->SrcReg[0], machine);
+ GLfloat result[4];
+ result[0] = (((raw >> 0) & 0xff) - 128) / 127.0F;
+ result[1] = (((raw >> 8) & 0xff) - 128) / 127.0F;
+ result[2] = (((raw >> 16) & 0xff) - 128) / 127.0F;
+ result[3] = (((raw >> 24) & 0xff) - 128) / 127.0F;
store_vector4(inst, machine, result);
}
break;
case OPCODE_UP4UB: /* unpack four GLubytes */
{
- GLfloat a[4], result[4];
- fi_type fi;
- fetch_vector1(&inst->SrcReg[0], machine, a);
- fi.f = a[0];
- result[0] = ((fi.i >> 0) & 0xff) / 255.0F;
- result[1] = ((fi.i >> 8) & 0xff) / 255.0F;
- result[2] = ((fi.i >> 16) & 0xff) / 255.0F;
- result[3] = ((fi.i >> 24) & 0xff) / 255.0F;
+ const GLuint raw = fetch_vector1ui(&inst->SrcReg[0], machine);
+ GLfloat result[4];
+ result[0] = ((raw >> 0) & 0xff) / 255.0F;
+ result[1] = ((raw >> 8) & 0xff) / 255.0F;
+ result[2] = ((raw >> 16) & 0xff) / 255.0F;
+ result[3] = ((raw >> 24) & 0xff) / 255.0F;
store_vector4(inst, machine, result);
}
break;
diff --git a/src/mesa/shader/prog_optimize.c b/src/mesa/shader/prog_optimize.c
index ce411731b22..e1ec52254c0 100644
--- a/src/mesa/shader/prog_optimize.c
+++ b/src/mesa/shader/prog_optimize.c
@@ -459,7 +459,7 @@ _mesa_remove_extra_move_use(struct gl_program *prog)
*/
for (j = i + 1; j < prog->NumInstructions; j++) {
struct prog_instruction *inst2 = prog->Instructions + j;
- int arg;
+ GLuint arg;
if (_mesa_is_flow_control_opcode(inst2->Opcode))
break;
@@ -867,7 +867,7 @@ find_live_intervals(struct gl_program *prog,
_mesa_printf("Reg[%d] live [%d, %d]:",
inv->Reg, inv->Start, inv->End);
if (1) {
- int j;
+ GLuint j;
for (j = 0; j < inv->Start; j++)
_mesa_printf(" ");
for (j = inv->Start; j <= inv->End; j++)
@@ -945,7 +945,7 @@ _mesa_reallocate_registers(struct gl_program *prog)
*/
{
GLint j;
- for (j = 0; j < activeIntervals.Num; j++) {
+ for (j = 0; j < (GLint) activeIntervals.Num; j++) {
const struct interval *inv = activeIntervals.Intervals + j;
if (inv->End >= live->Start) {
/* Stop now. Since the activeInterval list is sorted
@@ -994,7 +994,7 @@ _mesa_reallocate_registers(struct gl_program *prog)
}
}
- if (maxTemp + 1 < liveIntervals.Num) {
+ if (maxTemp + 1 < (GLint) liveIntervals.Num) {
/* OK, we've reduced the number of registers needed.
* Scan the program and replace all the old temporary register
* indexes with the new indexes.
diff --git a/src/mesa/shader/prog_statevars.c b/src/mesa/shader/prog_statevars.c
index 058d4bbafb7..3a446fd9bb2 100644
--- a/src/mesa/shader/prog_statevars.c
+++ b/src/mesa/shader/prog_statevars.c
@@ -31,7 +31,6 @@
#include "main/glheader.h"
#include "main/context.h"
-#include "main/hash.h"
#include "main/imports.h"
#include "main/macros.h"
#include "main/mtypes.h"
diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c
index 6b8d94e6614..3e86d0adad4 100644
--- a/src/mesa/shader/program.c
+++ b/src/mesa/shader/program.c
@@ -580,7 +580,7 @@ _mesa_delete_instructions(struct gl_program *prog, GLuint start, GLuint count)
for (i = 0; i < prog->NumInstructions; i++) {
struct prog_instruction *inst = prog->Instructions + i;
if (inst->BranchTarget > 0) {
- if (inst->BranchTarget > start) {
+ if (inst->BranchTarget > (GLint) start) {
inst->BranchTarget -= count;
}
}
diff --git a/src/mesa/shader/program_lexer.l b/src/mesa/shader/program_lexer.l
index e2acb3c0c96..83bc5089d9e 100644
--- a/src/mesa/shader/program_lexer.l
+++ b/src/mesa/shader/program_lexer.l
@@ -23,12 +23,12 @@
*/
#include "main/glheader.h"
#include "main/imports.h"
-#include "prog_instruction.h"
-#include "prog_statevars.h"
+#include "shader/prog_instruction.h"
+#include "shader/prog_statevars.h"
-#include "symbol_table.h"
-#include "program_parser.h"
-#include "program_parse.tab.h"
+#include "shader/symbol_table.h"
+#include "shader/program_parser.h"
+#include "shader/program_parse.tab.h"
#define require_ARB_vp (yyextra->mode == ARB_vertex)
#define require_ARB_fp (yyextra->mode == ARB_fragment)
diff --git a/src/mesa/shader/program_parse.tab.c b/src/mesa/shader/program_parse.tab.c
index b12dcee9dfa..2adfb409739 100644
--- a/src/mesa/shader/program_parse.tab.c
+++ b/src/mesa/shader/program_parse.tab.c
@@ -98,14 +98,14 @@
#include "main/mtypes.h"
#include "main/imports.h"
-#include "program.h"
-#include "prog_parameter.h"
-#include "prog_parameter_layout.h"
-#include "prog_statevars.h"
-#include "prog_instruction.h"
-
-#include "symbol_table.h"
-#include "program_parser.h"
+#include "shader/program.h"
+#include "shader/prog_parameter.h"
+#include "shader/prog_parameter_layout.h"
+#include "shader/prog_statevars.h"
+#include "shader/prog_instruction.h"
+
+#include "shader/symbol_table.h"
+#include "shader/program_parser.h"
extern void *yy_scan_string(char *);
extern void yy_delete_buffer(void *);
diff --git a/src/mesa/shader/program_parse.y b/src/mesa/shader/program_parse.y
index 5c5d8d75908..3880d549172 100644
--- a/src/mesa/shader/program_parse.y
+++ b/src/mesa/shader/program_parse.y
@@ -27,14 +27,14 @@
#include "main/mtypes.h"
#include "main/imports.h"
-#include "program.h"
-#include "prog_parameter.h"
-#include "prog_parameter_layout.h"
-#include "prog_statevars.h"
-#include "prog_instruction.h"
-
-#include "symbol_table.h"
-#include "program_parser.h"
+#include "shader/program.h"
+#include "shader/prog_parameter.h"
+#include "shader/prog_parameter_layout.h"
+#include "shader/prog_statevars.h"
+#include "shader/prog_instruction.h"
+
+#include "shader/symbol_table.h"
+#include "shader/program_parser.h"
extern void *yy_scan_string(char *);
extern void yy_delete_buffer(void *);
diff --git a/src/mesa/shader/program_parse_extra.c b/src/mesa/shader/program_parse_extra.c
index 0656c5eaa8e..ae98b782b70 100644
--- a/src/mesa/shader/program_parse_extra.c
+++ b/src/mesa/shader/program_parse_extra.c
@@ -216,6 +216,18 @@ _mesa_ARBfp_parse_option(struct asm_parser_state *state, const char *option)
state->option.Shadow = 1;
return 1;
}
+ } else if (strncmp(option, "fragment_coord_", 15) == 0) {
+ option += 15;
+ if (state->ctx->Extensions.ARB_fragment_coord_conventions) {
+ if (strcmp(option, "origin_upper_left") == 0) {
+ state->option.OriginUpperLeft = 1;
+ return 1;
+ }
+ else if (strcmp(option, "pixel_center_integer") == 0) {
+ state->option.PixelCenterInteger = 1;
+ return 1;
+ }
+ }
}
} else if (strncmp(option, "NV_fragment_program", 19) == 0) {
option += 19;
diff --git a/src/mesa/shader/program_parser.h b/src/mesa/shader/program_parser.h
index 69396ca2c0f..730466c30f5 100644
--- a/src/mesa/shader/program_parser.h
+++ b/src/mesa/shader/program_parser.h
@@ -209,6 +209,8 @@ struct asm_parser_state {
unsigned TexRect:1;
unsigned TexArray:1;
unsigned NV_fragment:1;
+ unsigned OriginUpperLeft:1;
+ unsigned PixelCenterInteger:1;
} option;
struct {
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c
index 453cd3964af..d53580f5f69 100644
--- a/src/mesa/shader/shader_api.c
+++ b/src/mesa/shader/shader_api.c
@@ -39,10 +39,8 @@
#include "main/glheader.h"
#include "main/context.h"
#include "main/hash.h"
-#include "main/macros.h"
#include "shader/program.h"
#include "shader/prog_parameter.h"
-#include "shader/prog_print.h"
#include "shader/prog_statevars.h"
#include "shader/prog_uniform.h"
#include "shader/shader_api.h"
@@ -957,7 +955,7 @@ _mesa_get_active_uniform(GLcontext *ctx, GLuint program, GLuint index,
if (size) {
GLint typeSize = sizeof_glsl_type(param->DataType);
- if (param->Size > typeSize) {
+ if ((GLint) param->Size > typeSize) {
/* This is an array.
* Array elements are placed on vector[4] boundaries so they're
* a multiple of four floats. We round typeSize up to next multiple
@@ -1728,7 +1726,7 @@ set_program_uniform(GLcontext *ctx, struct gl_program *program,
const GLint typeSize = sizeof_glsl_type(param->DataType);
GLsizei k, i;
- if (param->Size > typeSize) {
+ if ((GLint) param->Size > typeSize) {
/* an array */
/* we'll ignore extra data below */
}
@@ -1913,7 +1911,7 @@ set_program_uniform_matrix(GLcontext *ctx, struct gl_program *program,
GLuint mat, row, col;
GLuint src = 0;
const struct gl_program_parameter * param = &program->Parameters->Parameters[index];
- const GLint slots = (param->Size + 3) / 4;
+ const GLuint slots = (param->Size + 3) / 4;
const GLint typeSize = sizeof_glsl_type(param->DataType);
GLint nr, nc;
@@ -1925,7 +1923,7 @@ set_program_uniform_matrix(GLcontext *ctx, struct gl_program *program,
return;
}
- if (param->Size <= typeSize) {
+ if ((GLint) param->Size <= typeSize) {
/* non-array: count must be at most one; count == 0 is handled by the loop below */
if (count > 1) {
_mesa_error(ctx, GL_INVALID_OPERATION,
diff --git a/src/mesa/shader/slang/slang_builtin.c b/src/mesa/shader/slang/slang_builtin.c
index e5809509c93..0a9f0b97fb9 100644
--- a/src/mesa/shader/slang/slang_builtin.c
+++ b/src/mesa/shader/slang/slang_builtin.c
@@ -36,7 +36,6 @@
#include "shader/prog_parameter.h"
#include "shader/prog_statevars.h"
#include "shader/slang/slang_ir.h"
-#include "shader/slang/slang_emit.h"
#include "shader/slang/slang_builtin.h"
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index 372a9acdd03..83098b7350e 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -3196,7 +3196,7 @@ _slang_unroll_for_loop(slang_assemble_ctx * A, const slang_operation *oper)
newOper = slang_operation_new(1);
newOper->type = SLANG_OPER_LITERAL_INT;
newOper->literal_size = 1;
- newOper->literal[0] = iter;
+ newOper->literal[0] = (GLfloat) iter;
/* replace instances of the loop variable with newOper */
slang_substitute(A, body, 1, &oldVar, &newOper, GL_FALSE);
diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c
index 6499cfcb2fe..63d10f45978 100644
--- a/src/mesa/shader/slang/slang_compile.c
+++ b/src/mesa/shader/slang/slang_compile.c
@@ -40,14 +40,11 @@
#include "slang_codegen.h"
#include "slang_compile.h"
#include "slang_storage.h"
-#include "slang_emit.h"
#include "slang_log.h"
#include "slang_mem.h"
#include "slang_vartable.h"
#include "slang_simplify.h"
-#include "slang_print.h"
-
/*
* This is a straightforward implementation of the slang front-end
* compiler. Lots of error-checking functionality is missing but
diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c
index ce3f6ab7ea2..c9ecbd275b8 100644
--- a/src/mesa/shader/slang/slang_emit.c
+++ b/src/mesa/shader/slang/slang_emit.c
@@ -38,7 +38,6 @@
#include "main/imports.h"
#include "main/context.h"
-#include "main/macros.h"
#include "shader/program.h"
#include "shader/prog_instruction.h"
#include "shader/prog_parameter.h"
diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c
index ed27821a951..21497b34e25 100644
--- a/src/mesa/shader/slang/slang_link.c
+++ b/src/mesa/shader/slang/slang_link.c
@@ -31,7 +31,6 @@
#include "main/imports.h"
#include "main/context.h"
-#include "main/hash.h"
#include "main/macros.h"
#include "shader/program.h"
#include "shader/prog_instruction.h"
diff --git a/src/mesa/shader/slang/slang_log.c b/src/mesa/shader/slang/slang_log.c
index d7d2b4fbfd0..4f6b8541c5a 100644
--- a/src/mesa/shader/slang/slang_log.c
+++ b/src/mesa/shader/slang/slang_log.c
@@ -24,7 +24,6 @@
*/
#include "main/imports.h"
-#include "main/context.h"
#include "slang_log.h"
#include "slang_utility.h"
diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak
index a4d09c75bb6..12d4c2831d8 100644
--- a/src/mesa/sources.mak
+++ b/src/mesa/sources.mak
@@ -89,6 +89,7 @@ GLAPI_SOURCES = \
main/dispatch.c \
glapi/glapi.c \
glapi/glapi_getproc.c \
+ glapi/glapi_nop.c \
glapi/glthread.c
MATH_SOURCES = \
diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c
index 8ca4335e330..8d045f2c6c0 100644
--- a/src/mesa/state_tracker/st_atom_framebuffer.c
+++ b/src/mesa/state_tracker/st_atom_framebuffer.c
@@ -37,7 +37,6 @@
#include "st_public.h"
#include "st_texture.h"
#include "pipe/p_context.h"
-#include "pipe/p_inlines.h"
#include "cso_cache/cso_context.h"
#include "util/u_rect.h"
#include "util/u_math.h"
diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c b/src/mesa/state_tracker/st_atom_pixeltransfer.c
index 6a5854e9ba5..0b2e3f53812 100644
--- a/src/mesa/state_tracker/st_atom_pixeltransfer.c
+++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c
@@ -43,7 +43,6 @@
#include "st_context.h"
#include "st_format.h"
-#include "st_program.h"
#include "st_texture.h"
#include "st_inlines.h"
diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
index 7b84a86ba48..9d63f1c6ab6 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -37,7 +37,6 @@
#include "st_context.h"
#include "st_cb_texture.h"
#include "st_atom.h"
-#include "st_program.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
diff --git a/src/mesa/state_tracker/st_atom_scissor.c b/src/mesa/state_tracker/st_atom_scissor.c
index 3fd59e1945c..5e0c51cff0a 100644
--- a/src/mesa/state_tracker/st_atom_scissor.c
+++ b/src/mesa/state_tracker/st_atom_scissor.c
@@ -31,6 +31,7 @@
*/
+#include "main/macros.h"
#include "st_context.h"
#include "pipe/p_context.h"
#include "st_atom.h"
@@ -52,15 +53,19 @@ update_scissor( struct st_context *st )
scissor.maxy = fb->Height;
if (st->ctx->Scissor.Enabled) {
- if ((GLuint)st->ctx->Scissor.X > scissor.minx)
+ /* need to be careful here with xmax or ymax < 0 */
+ GLint xmax = MAX2(0, st->ctx->Scissor.X + st->ctx->Scissor.Width);
+ GLint ymax = MAX2(0, st->ctx->Scissor.Y + st->ctx->Scissor.Height);
+
+ if (st->ctx->Scissor.X > (GLint)scissor.minx)
scissor.minx = st->ctx->Scissor.X;
- if ((GLuint)st->ctx->Scissor.Y > scissor.miny)
+ if (st->ctx->Scissor.Y > (GLint)scissor.miny)
scissor.miny = st->ctx->Scissor.Y;
- if ((GLuint)st->ctx->Scissor.X + st->ctx->Scissor.Width < scissor.maxx)
- scissor.maxx = st->ctx->Scissor.X + st->ctx->Scissor.Width;
- if ((GLuint)st->ctx->Scissor.Y + st->ctx->Scissor.Height < scissor.maxy)
- scissor.maxy = st->ctx->Scissor.Y + st->ctx->Scissor.Height;
+ if (xmax < (GLint) scissor.maxx)
+ scissor.maxx = xmax;
+ if (ymax < (GLint) scissor.maxy)
+ scissor.maxy = ymax;
/* check for null space */
if (scissor.minx >= scissor.maxx || scissor.miny >= scissor.maxy)
diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c
index 176f3ea68d7..181f88a3348 100644
--- a/src/mesa/state_tracker/st_atom_shader.c
+++ b/src/mesa/state_tracker/st_atom_shader.c
@@ -51,7 +51,6 @@
#include "st_atom.h"
#include "st_program.h"
#include "st_atom_shader.h"
-#include "st_mesa_to_tgsi.h"
@@ -79,7 +78,7 @@ translate_fp(struct st_context *st,
stfp->num_input_slots = numIn;
- assert(stfp->Base.Base.NumInstructions > 1);
+ assert(stfp->Base.Base.NumInstructions > 0);
st_translate_fragment_program(st, stfp, stfp->input_to_slot);
}
diff --git a/src/mesa/state_tracker/st_cb_accum.c b/src/mesa/state_tracker/st_cb_accum.c
index da7b97d3253..798081ec899 100644
--- a/src/mesa/state_tracker/st_cb_accum.c
+++ b/src/mesa/state_tracker/st_cb_accum.c
@@ -38,9 +38,7 @@
#include "st_context.h"
#include "st_cb_accum.h"
#include "st_cb_fbo.h"
-#include "st_draw.h"
#include "st_public.h"
-#include "st_format.h"
#include "st_texture.h"
#include "st_inlines.h"
#include "pipe/p_context.h"
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index 1bdeaccda3e..d1b35f796ec 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -34,9 +34,7 @@
#include "main/image.h"
#include "main/bufferobj.h"
#include "main/macros.h"
-#include "main/texformat.h"
#include "shader/program.h"
-#include "shader/prog_parameter.h"
#include "shader/prog_print.h"
#include "st_context.h"
@@ -44,15 +42,12 @@
#include "st_atom_constbuf.h"
#include "st_program.h"
#include "st_cb_bitmap.h"
-#include "st_cb_program.h"
-#include "st_mesa_to_tgsi.h"
#include "st_texture.h"
#include "st_inlines.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
-#include "util/u_tile.h"
#include "util/u_draw_quad.h"
#include "util/u_simple_shaders.h"
#include "shader/prog_instruction.h"
@@ -386,11 +381,11 @@ setup_bitmap_vertex_data(struct st_context *st,
}
/* put vertex data into vbuf */
- st_no_flush_pipe_buffer_write(st,
- st->bitmap.vbuf,
- st->bitmap.vbuf_slot * sizeof st->bitmap.vertices,
- sizeof st->bitmap.vertices,
- st->bitmap.vertices);
+ st_no_flush_pipe_buffer_write_nooverlap(st,
+ st->bitmap.vbuf,
+ st->bitmap.vbuf_slot * sizeof st->bitmap.vertices,
+ sizeof st->bitmap.vertices,
+ st->bitmap.vertices);
return st->bitmap.vbuf_slot++ * sizeof st->bitmap.vertices;
}
diff --git a/src/mesa/state_tracker/st_cb_blit.c b/src/mesa/state_tracker/st_cb_blit.c
index 563615ed0d1..65aa2a28ac2 100644
--- a/src/mesa/state_tracker/st_cb_blit.c
+++ b/src/mesa/state_tracker/st_cb_blit.c
@@ -33,14 +33,10 @@
#include "main/imports.h"
#include "main/image.h"
#include "main/macros.h"
-#include "main/texformat.h"
#include "shader/program.h"
-#include "shader/prog_parameter.h"
-#include "shader/prog_print.h"
#include "st_context.h"
#include "st_texture.h"
-#include "st_program.h"
#include "st_cb_blit.h"
#include "st_cb_fbo.h"
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c
index 2c1be41ad83..94693d91f39 100644
--- a/src/mesa/state_tracker/st_cb_clear.c
+++ b/src/mesa/state_tracker/st_cb_clear.c
@@ -42,10 +42,8 @@
#include "st_cb_accum.h"
#include "st_cb_clear.h"
#include "st_cb_fbo.h"
-#include "st_draw.h"
#include "st_program.h"
#include "st_public.h"
-#include "st_mesa_to_tgsi.h"
#include "st_inlines.h"
#include "pipe/p_context.h"
@@ -53,7 +51,6 @@
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
#include "util/u_format.h"
-#include "util/u_pack_color.h"
#include "util/u_simple_shaders.h"
#include "util/u_draw_quad.h"
@@ -166,10 +163,10 @@ draw_quad(GLcontext *ctx,
}
/* put vertex data into vbuf */
- st_no_flush_pipe_buffer_write(st, st->clear.vbuf,
- st->clear.vbuf_slot * sizeof(st->clear.vertices),
- sizeof(st->clear.vertices),
- st->clear.vertices);
+ st_no_flush_pipe_buffer_write_nooverlap(st, st->clear.vbuf,
+ st->clear.vbuf_slot * sizeof(st->clear.vertices),
+ sizeof(st->clear.vertices),
+ st->clear.vertices);
/* draw */
util_draw_vertex_buffer(pipe,
diff --git a/src/mesa/state_tracker/st_cb_condrender.c b/src/mesa/state_tracker/st_cb_condrender.c
index 780b40c2065..8483b93bd85 100644
--- a/src/mesa/state_tracker/st_cb_condrender.c
+++ b/src/mesa/state_tracker/st_cb_condrender.c
@@ -69,6 +69,7 @@ st_BeginConditionalRender(GLcontext *ctx, struct gl_query_object *q,
break;
default:
assert(0 && "bad mode in st_BeginConditionalRender");
+ m = PIPE_RENDER_COND_WAIT;
}
pipe->render_condition(pipe, stq->pq, m);
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 7c664267d4e..7afdc31ede9 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -36,24 +36,18 @@
#include "main/macros.h"
#include "main/texformat.h"
#include "main/texstore.h"
-#include "main/state.h"
#include "shader/program.h"
-#include "shader/prog_parameter.h"
#include "shader/prog_print.h"
#include "st_debug.h"
#include "st_context.h"
#include "st_atom.h"
#include "st_atom_constbuf.h"
-#include "st_draw.h"
#include "st_program.h"
#include "st_cb_drawpixels.h"
#include "st_cb_readpixels.h"
#include "st_cb_fbo.h"
-#include "st_cb_texture.h"
-#include "st_draw.h"
#include "st_format.h"
-#include "st_mesa_to_tgsi.h"
#include "st_texture.h"
#include "st_inlines.h"
@@ -1138,6 +1132,8 @@ st_destroy_drawpix(struct st_context *st)
{
st_reference_fragprog(st, &st->drawpix.z_shader, NULL);
st_reference_fragprog(st, &st->pixel_xfer.combined_prog, NULL);
- st_reference_vertprog(st, &st->drawpix.vert_shaders[0], NULL);
- st_reference_vertprog(st, &st->drawpix.vert_shaders[1], NULL);
+ if (st->drawpix.vert_shaders[0])
+ free(st->drawpix.vert_shaders[0]);
+ if (st->drawpix.vert_shaders[1])
+ free(st->drawpix.vert_shaders[1]);
}
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index 45ce34a85f7..f7350ef1e3c 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -44,7 +44,6 @@
#include "pipe/p_screen.h"
#include "st_context.h"
#include "st_cb_fbo.h"
-#include "st_cb_texture.h"
#include "st_format.h"
#include "st_public.h"
#include "st_texture.h"
diff --git a/src/mesa/state_tracker/st_cb_feedback.c b/src/mesa/state_tracker/st_cb_feedback.c
index 93f71452192..17261f8321b 100644
--- a/src/mesa/state_tracker/st_cb_feedback.c
+++ b/src/mesa/state_tracker/st_cb_feedback.c
@@ -45,14 +45,11 @@
#include "vbo/vbo.h"
#include "st_context.h"
-#include "st_atom.h"
#include "st_draw.h"
#include "st_cb_feedback.h"
-#include "st_cb_bufferobjects.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
-#include "cso_cache/cso_cache.h"
#include "draw/draw_context.h"
#include "draw/draw_pipe.h"
diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c
index 8c276f8128e..5138e596a9c 100644
--- a/src/mesa/state_tracker/st_cb_program.c
+++ b/src/mesa/state_tracker/st_cb_program.c
@@ -36,7 +36,6 @@
#include "shader/prog_instruction.h"
#include "shader/prog_parameter.h"
#include "shader/program.h"
-#include "shader/programopt.h"
#include "shader/shader_api.h"
#include "cso_cache/cso_context.h"
diff --git a/src/mesa/state_tracker/st_cb_queryobj.c b/src/mesa/state_tracker/st_cb_queryobj.c
index 10629e92254..2281d10e999 100644
--- a/src/mesa/state_tracker/st_cb_queryobj.c
+++ b/src/mesa/state_tracker/st_cb_queryobj.c
@@ -41,7 +41,6 @@
#include "pipe/p_defines.h"
#include "st_context.h"
#include "st_cb_queryobj.h"
-#include "st_public.h"
static struct gl_query_object *
diff --git a/src/mesa/state_tracker/st_cb_rasterpos.c b/src/mesa/state_tracker/st_cb_rasterpos.c
index d82b2a2035f..42a1377809a 100644
--- a/src/mesa/state_tracker/st_cb_rasterpos.c
+++ b/src/mesa/state_tracker/st_cb_rasterpos.c
@@ -47,7 +47,6 @@
#include "st_draw.h"
#include "draw/draw_context.h"
#include "draw/draw_pipe.h"
-#include "shader/prog_instruction.h"
#include "vbo/vbo.h"
diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c
index 6fa7bb64f2e..8eb825a6a41 100644
--- a/src/mesa/state_tracker/st_cb_readpixels.c
+++ b/src/mesa/state_tracker/st_cb_readpixels.c
@@ -45,10 +45,8 @@
#include "st_debug.h"
#include "st_context.h"
-#include "st_cb_bitmap.h"
#include "st_cb_readpixels.h"
#include "st_cb_fbo.h"
-#include "st_format.h"
#include "st_public.h"
#include "st_texture.h"
#include "st_inlines.h"
diff --git a/src/mesa/state_tracker/st_cb_strings.c b/src/mesa/state_tracker/st_cb_strings.c
index bb931f17c4e..f22c5369e43 100644
--- a/src/mesa/state_tracker/st_cb_strings.c
+++ b/src/mesa/state_tracker/st_cb_strings.c
@@ -33,7 +33,6 @@
#include "main/glheader.h"
#include "main/macros.h"
-#include "main/version.h"
#include "pipe/p_context.h"
#include "pipe/p_screen.h"
#include "st_context.h"
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index f01053cdacc..cee2452eafe 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -31,15 +31,14 @@
#include "main/convolve.h"
#endif
#include "main/enums.h"
+#include "main/fbobject.h"
#include "main/formats.h"
#include "main/image.h"
#include "main/imports.h"
#include "main/macros.h"
#include "main/mipmap.h"
-#include "main/pixel.h"
#include "main/texcompress.h"
#include "main/texfetch.h"
-#include "main/texformat.h"
#include "main/texgetimage.h"
#include "main/teximage.h"
#include "main/texobj.h"
@@ -687,9 +686,11 @@ st_TexImage(GLcontext * ctx,
{
char *dst = texImage->Data;
const char *src = pixels;
- int i;
+ GLuint i, bw, bh, lines;
+ _mesa_get_format_block_size(texImage->TexFormat, &bw, &bh);
+ lines = (height + bh - 1) / bh;
- for(i = 0; i < height; ++i)
+ for(i = 0; i < lines; ++i)
{
memcpy(dst, src, srcImageStride);
dst += dstRowStride;
@@ -1368,33 +1369,64 @@ fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level,
}
+
+/**
+ * If the format of the src renderbuffer and the format of the dest
+ * texture are compatible (in terms of blitting), return a TGSI writemask
+ * to be used during the blit.
+ * If the src/dest are incompatible, return 0.
+ */
static unsigned
-compatible_src_dst_formats(const struct gl_renderbuffer *src,
+compatible_src_dst_formats(GLcontext *ctx,
+ const struct gl_renderbuffer *src,
const struct gl_texture_image *dst)
{
- const GLenum srcFormat = _mesa_get_format_base_format(src->Format);
- const GLenum dstLogicalFormat = _mesa_get_format_base_format(dst->TexFormat);
+ /* Get logical base formats for the src and dest.
+ * That is, use the user-requested formats and not the actual, device-
+ * chosen formats.
+ * For example, the user may have requested an A8 texture but the
+ * driver may actually be using an RGBA texture format. When we
+ * copy/blit to that texture, we only want to copy the Alpha channel
+ * and not the RGB channels.
+ *
+ * Similarly, when the src FBO was created an RGB format may have been
+ * requested but the driver actually chose an RGBA format. In that case,
+ * we don't want to copy the undefined Alpha channel to the dest texture
+ * (it should be 1.0).
+ */
+ const GLenum srcFormat = _mesa_base_fbo_format(ctx, src->InternalFormat);
+ const GLenum dstFormat = _mesa_base_tex_format(ctx, dst->InternalFormat);
- if (srcFormat == dstLogicalFormat) {
+ /**
+ * XXX when we have red-only and red/green renderbuffers we'll need
+ * to add more cases here (or implement a general-purpose routine that
+ * queries the existance of the R,G,B,A channels in the src and dest).
+ */
+ if (srcFormat == dstFormat) {
/* This is the same as matching_base_formats, which should
* always pass, as it did previously.
*/
return TGSI_WRITEMASK_XYZW;
}
- else if (srcFormat == GL_RGBA &&
- dstLogicalFormat == GL_RGB) {
- /* Add a single special case to cope with RGBA->RGB transfers,
- * setting A to 1.0 to cope with situations where the RGB
- * destination is actually stored as RGBA.
+ else if (srcFormat == GL_RGB && dstFormat == GL_RGBA) {
+ /* Make sure that A in the dest is 1. The actual src format
+ * may be RGBA and have undefined A values.
+ */
+ return TGSI_WRITEMASK_XYZ;
+ }
+ else if (srcFormat == GL_RGBA && dstFormat == GL_RGB) {
+ /* Make sure that A in the dest is 1. The actual dst format
+ * may be RGBA and will need A=1 to provide proper alpha values
+ * when sampled later.
*/
- return TGSI_WRITEMASK_XYZ; /* A ==> 1.0 */
+ return TGSI_WRITEMASK_XYZ;
}
else {
if (ST_DEBUG & DEBUG_FALLBACK)
debug_printf("%s failed for src %s, dst %s\n",
__FUNCTION__,
_mesa_lookup_enum_by_nr(srcFormat),
- _mesa_lookup_enum_by_nr(dstLogicalFormat));
+ _mesa_lookup_enum_by_nr(dstFormat));
/* Otherwise fail.
*/
@@ -1505,7 +1537,7 @@ st_copy_texsubimage(GLcontext *ctx,
matching_base_formats =
(_mesa_get_format_base_format(strb->Base.Format) ==
_mesa_get_format_base_format(texImage->TexFormat));
- format_writemask = compatible_src_dst_formats(&strb->Base, texImage);
+ format_writemask = compatible_src_dst_formats(ctx, &strb->Base, texImage);
if (ctx->_ImageTransferState == 0x0) {
diff --git a/src/mesa/state_tracker/st_cb_viewport.c b/src/mesa/state_tracker/st_cb_viewport.c
index ab11c5b4fe0..b29191abef6 100644
--- a/src/mesa/state_tracker/st_cb_viewport.c
+++ b/src/mesa/state_tracker/st_cb_viewport.c
@@ -27,14 +27,11 @@
#include "main/glheader.h"
#include "st_context.h"
-#include "st_public.h"
#include "st_cb_viewport.h"
#include "pipe/p_context.h"
-#include "pipe/p_inlines.h"
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
-#include "pipe/internal/p_winsys_screen.h"
static void st_viewport(GLcontext * ctx, GLint x, GLint y,
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 9e6ce30db04..a62ff248ce5 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -27,11 +27,6 @@
#include "main/imports.h"
#include "main/context.h"
-#include "main/extensions.h"
-#include "main/matrix.h"
-#include "main/buffers.h"
-#include "main/scissor.h"
-#include "main/viewport.h"
#include "vbo/vbo.h"
#include "shader/shader_api.h"
#include "glapi/glapi.h"
@@ -69,7 +64,6 @@
#include "st_program.h"
#include "pipe/p_context.h"
#include "draw/draw_context.h"
-#include "cso_cache/cso_cache.h"
#include "cso_cache/cso_context.h"
diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h
index 2c4943cfb0a..50e98d7146a 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -159,7 +159,7 @@ struct st_context
/** for glDraw/CopyPixels */
struct {
struct st_fragment_program *z_shader;
- struct st_vertex_program *vert_shaders[2];
+ void *vert_shaders[2]; /**< ureg shaders */
} drawpix;
/** for glClear */
diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c
index a05d6dd06bd..cdaee2a353e 100644
--- a/src/mesa/state_tracker/st_draw_feedback.c
+++ b/src/mesa/state_tracker/st_draw_feedback.c
@@ -28,7 +28,6 @@
#include "main/imports.h"
#include "main/image.h"
#include "main/macros.h"
-#include "shader/prog_uniform.h"
#include "vbo/vbo.h"
@@ -242,7 +241,7 @@ st_feedback_draw_vbo(GLcontext *ctx,
mapped_constants = pipe_buffer_map(pipe->screen,
st->state.constants[PIPE_SHADER_VERTEX],
PIPE_BUFFER_USAGE_CPU_READ);
- draw_set_mapped_constant_buffer(st->draw, PIPE_SHADER_VERTEX,
+ draw_set_mapped_constant_buffer(st->draw, PIPE_SHADER_VERTEX, 0,
mapped_constants,
st->state.constants[PIPE_SHADER_VERTEX]->size);
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index a7411c86439..31c03c07835 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -28,7 +28,6 @@
#include "main/imports.h"
#include "main/context.h"
-#include "main/extensions.h"
#include "main/macros.h"
#include "pipe/p_context.h"
diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
index d00b67a279e..3ffc2aee2a2 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -35,7 +35,6 @@
#include "main/imports.h"
#include "main/context.h"
#include "main/texstore.h"
-#include "main/texformat.h"
#include "main/enums.h"
#include "main/macros.h"
@@ -288,6 +287,8 @@ st_pipe_format_to_mesa_format(enum pipe_format pipeFormat)
return MESA_FORMAT_XRGB8888;
case PIPE_FORMAT_B8G8R8A8_UNORM:
return MESA_FORMAT_ARGB8888_REV;
+ case PIPE_FORMAT_B8G8R8X8_UNORM:
+ return MESA_FORMAT_XRGB8888_REV;
case PIPE_FORMAT_A1R5G5B5_UNORM:
return MESA_FORMAT_ARGB1555;
case PIPE_FORMAT_A4R4G4B4_UNORM:
diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c
index a5d1ae3b034..835142e3d41 100644
--- a/src/mesa/state_tracker/st_framebuffer.c
+++ b/src/mesa/state_tracker/st_framebuffer.c
@@ -30,15 +30,11 @@
#include "main/buffers.h"
#include "main/context.h"
#include "main/framebuffer.h"
-#include "main/matrix.h"
#include "main/renderbuffer.h"
-#include "main/scissor.h"
-#include "main/viewport.h"
#include "st_context.h"
#include "st_cb_fbo.h"
#include "st_public.h"
#include "pipe/p_defines.h"
-#include "pipe/p_context.h"
struct st_framebuffer *
diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c
index 2c283d464ae..3823a59d37a 100644
--- a/src/mesa/state_tracker/st_gen_mipmap.c
+++ b/src/mesa/state_tracker/st_gen_mipmap.c
@@ -46,9 +46,7 @@
#include "st_debug.h"
#include "st_context.h"
-#include "st_draw.h"
#include "st_gen_mipmap.h"
-#include "st_program.h"
#include "st_texture.h"
#include "st_cb_texture.h"
#include "st_inlines.h"
diff --git a/src/mesa/state_tracker/st_inlines.h b/src/mesa/state_tracker/st_inlines.h
index a41cfeb96f7..dccc46f12d7 100644
--- a/src/mesa/state_tracker/st_inlines.h
+++ b/src/mesa/state_tracker/st_inlines.h
@@ -126,6 +126,16 @@ st_no_flush_pipe_buffer_write(struct st_context *st,
}
static INLINE void
+st_no_flush_pipe_buffer_write_nooverlap(struct st_context *st,
+ struct pipe_buffer *buf,
+ unsigned int offset,
+ unsigned int size,
+ const void * data)
+{
+ pipe_buffer_write_nooverlap(st->pipe->screen, buf, offset, size, data);
+}
+
+static INLINE void
st_cond_flush_pipe_buffer_read(struct st_context *st,
struct pipe_buffer *buf,
unsigned int offset,
diff --git a/src/mesa/swrast/s_aatritemp.h b/src/mesa/swrast/s_aatritemp.h
index 0827b3db9eb..a8b22c548f3 100644
--- a/src/mesa/swrast/s_aatritemp.h
+++ b/src/mesa/swrast/s_aatritemp.h
@@ -220,11 +220,11 @@
#if defined(DO_ATTRIBS)
/* compute attributes at left-most fragment */
- span.attrStart[FRAG_ATTRIB_WPOS][3] = solve_plane(ix + 0.5, iy + 0.5, wPlane);
+ span.attrStart[FRAG_ATTRIB_WPOS][3] = solve_plane(ix + 0.5F, iy + 0.5F, wPlane);
ATTRIB_LOOP_BEGIN
GLuint c;
for (c = 0; c < 4; c++) {
- span.attrStart[attr][c] = solve_plane(ix + 0.5, iy + 0.5, attrPlane[attr][c]);
+ span.attrStart[attr][c] = solve_plane(ix + 0.5F, iy + 0.5F, attrPlane[attr][c]);
}
ATTRIB_LOOP_END
#endif
@@ -328,11 +328,11 @@
#if defined(DO_ATTRIBS)
/* compute attributes at left-most fragment */
- span.attrStart[FRAG_ATTRIB_WPOS][3] = solve_plane(ix + 1.5, iy + 0.5, wPlane);
+ span.attrStart[FRAG_ATTRIB_WPOS][3] = solve_plane(ix + 1.5, iy + 0.5F, wPlane);
ATTRIB_LOOP_BEGIN
GLuint c;
for (c = 0; c < 4; c++) {
- span.attrStart[attr][c] = solve_plane(ix + 1.5, iy + 0.5, attrPlane[attr][c]);
+ span.attrStart[attr][c] = solve_plane(ix + 1.5, iy + 0.5F, attrPlane[attr][c]);
}
ATTRIB_LOOP_END
#endif
diff --git a/src/mesa/swrast/s_accum.c b/src/mesa/swrast/s_accum.c
index cf53f01b7c1..2dd9ca6348b 100644
--- a/src/mesa/swrast/s_accum.c
+++ b/src/mesa/swrast/s_accum.c
@@ -37,7 +37,7 @@
/* XXX this would have to change for accum buffers with more or less
* than 16 bits per color channel.
*/
-#define ACCUM_SCALE16 32767.0
+#define ACCUM_SCALE16 32767.0F
/*
diff --git a/src/mesa/swrast/s_alpha.c b/src/mesa/swrast/s_alpha.c
index 5761bb00b4e..509477433a5 100644
--- a/src/mesa/swrast/s_alpha.c
+++ b/src/mesa/swrast/s_alpha.c
@@ -146,8 +146,8 @@ _swrast_alpha_test(const GLcontext *ctx, SWspan *span)
ALPHA_TEST(FixedToInt(alpha), alpha += alphaStep);
}
else {
- const GLfloat alphaStep = span->alphaStep;
- GLfloat alpha = span->alpha;
+ const GLfloat alphaStep = FixedToFloat(span->alphaStep);
+ GLfloat alpha = FixedToFloat(span->alpha);
const GLfloat ref = ctx->Color.AlphaRef;
ALPHA_TEST(alpha, alpha += alphaStep);
}
diff --git a/src/mesa/swrast/s_atifragshader.c b/src/mesa/swrast/s_atifragshader.c
index 353e9999d61..05da64de3ac 100644
--- a/src/mesa/swrast/s_atifragshader.c
+++ b/src/mesa/swrast/s_atifragshader.c
@@ -82,10 +82,11 @@ apply_swizzle(GLfloat values[4], GLuint swizzle)
break;
case GL_SWIZZLE_STQ_DQ_ATI:
/* make sure q is not 0 to avoid problems later with infinite values (texture lookup)? */
- if (q == 0.0F) q = 0.000000001;
+ if (q == 0.0F)
+ q = 0.000000001F;
values[0] = s / q;
values[1] = t / q;
- values[2] = 1 / q;
+ values[2] = 1.0 / q;
break;
}
values[3] = 0.0;
@@ -171,27 +172,27 @@ apply_dst_mod(GLuint optype, GLuint mod, GLfloat * val)
val[i] = 8 * val[i];
break;
case GL_HALF_BIT_ATI:
- val[i] = val[i] * 0.5;
+ val[i] = val[i] * 0.5F;
break;
case GL_QUARTER_BIT_ATI:
- val[i] = val[i] * 0.25;
+ val[i] = val[i] * 0.25F;
break;
case GL_EIGHTH_BIT_ATI:
- val[i] = val[i] * 0.125;
+ val[i] = val[i] * 0.125F;
break;
}
if (has_sat) {
- if (val[i] < 0.0)
- val[i] = 0;
- else if (val[i] > 1.0)
- val[i] = 1.0;
+ if (val[i] < 0.0F)
+ val[i] = 0.0F;
+ else if (val[i] > 1.0F)
+ val[i] = 1.0F;
}
else {
- if (val[i] < -8.0)
- val[i] = -8.0;
- else if (val[i] > 8.0)
- val[i] = 8.0;
+ if (val[i] < -8.0F)
+ val[i] = -8.0F;
+ else if (val[i] > 8.0F)
+ val[i] = 8.0F;
}
}
}
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index f9092c215a7..0d4680db9f7 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -149,26 +149,26 @@ _swrast_update_polygon( GLcontext *ctx )
if (ctx->Polygon.CullFlag) {
switch (ctx->Polygon.CullFaceMode) {
case GL_BACK:
- backface_sign = -1.0;
+ backface_sign = -1.0F;
break;
case GL_FRONT:
- backface_sign = 1.0;
+ backface_sign = 1.0F;
break;
case GL_FRONT_AND_BACK:
/* fallthrough */
default:
- backface_sign = 0.0;
+ backface_sign = 0.0F;
}
}
else {
- backface_sign = 0.0;
+ backface_sign = 0.0F;
}
SWRAST_CONTEXT(ctx)->_BackfaceCullSign = backface_sign;
/* This is for front/back-face determination, but not for culling */
SWRAST_CONTEXT(ctx)->_BackfaceSign
- = (ctx->Polygon.FrontFace == GL_CW) ? -1.0 : 1.0;
+ = (ctx->Polygon.FrontFace == GL_CW) ? -1.0F : 1.0F;
}
diff --git a/src/mesa/swrast/s_depth.c b/src/mesa/swrast/s_depth.c
index 0b6bb7e3ec9..ac5dae2148b 100644
--- a/src/mesa/swrast/s_depth.c
+++ b/src/mesa/swrast/s_depth.c
@@ -497,17 +497,24 @@ depth_test_span32( GLcontext *ctx, GLuint n,
return passed;
}
-/* Apply ARB_depth_clamp to span of fragments. */
+
+
+/**
+ * Clamp fragment Z values to the depth near/far range (glDepthRange()).
+ * This is used when GL_ARB_depth_clamp/GL_DEPTH_CLAMP is turned on.
+ * In that case, vertexes are not clipped against the near/far planes
+ * so rasterization will produce fragment Z values outside the usual
+ * [0,1] range.
+ */
void
_swrast_depth_clamp_span( GLcontext *ctx, SWspan *span )
{
struct gl_framebuffer *fb = ctx->DrawBuffer;
- struct gl_renderbuffer *rb = fb->_DepthBuffer;
const GLuint count = span->end;
- GLuint *zValues = span->array->z;
- GLuint min, max;
+ GLint *zValues = (GLint *) span->array->z; /* sign change */
+ GLint min, max;
GLfloat min_f, max_f;
- int i;
+ GLuint i;
if (ctx->Viewport.Near < ctx->Viewport.Far) {
min_f = ctx->Viewport.Near;
@@ -517,15 +524,21 @@ _swrast_depth_clamp_span( GLcontext *ctx, SWspan *span )
max_f = ctx->Viewport.Near;
}
- if (rb->DataType == GL_UNSIGNED_SHORT) {
- CLAMPED_FLOAT_TO_USHORT(min, min_f);
- CLAMPED_FLOAT_TO_USHORT(max, max_f);
- } else {
- assert(rb->DataType == GL_UNSIGNED_INT);
- min = FLOAT_TO_UINT(min_f);
- max = FLOAT_TO_UINT(max_f);
- }
-
+ /* Convert floating point values in [0,1] to device Z coordinates in
+ * [0, DepthMax].
+ * ex: If the the Z buffer has 24 bits, DepthMax = 0xffffff.
+ *
+ * XXX this all falls apart if we have 31 or more bits of Z because
+ * the triangle rasterization code produces unsigned Z values. Negative
+ * vertex Z values come out as large fragment Z uints.
+ */
+ min = (GLint) (min_f * fb->_DepthMaxF);
+ max = (GLint) (max_f * fb->_DepthMaxF);
+ if (max < 0)
+ max = 0x7fffffff; /* catch over flow for 30-bit z */
+
+ /* Note that we do the comparisons here using signed integers.
+ */
for (i = 0; i < count; i++) {
if (zValues[i] < min)
zValues[i] = min;
diff --git a/src/mesa/swrast/s_fog.c b/src/mesa/swrast/s_fog.c
index 77ed0cfef96..0472bbf553c 100644
--- a/src/mesa/swrast/s_fog.c
+++ b/src/mesa/swrast/s_fog.c
@@ -172,14 +172,14 @@ _swrast_fog_rgba_span( const GLcontext *ctx, SWspan *span )
/* compute (scaled) fog color */
if (span->array->ChanType == GL_UNSIGNED_BYTE) {
- rFog = ctx->Fog.Color[RCOMP] * 255.0;
- gFog = ctx->Fog.Color[GCOMP] * 255.0;
- bFog = ctx->Fog.Color[BCOMP] * 255.0;
+ rFog = ctx->Fog.Color[RCOMP] * 255.0F;
+ gFog = ctx->Fog.Color[GCOMP] * 255.0F;
+ bFog = ctx->Fog.Color[BCOMP] * 255.0F;
}
else if (span->array->ChanType == GL_UNSIGNED_SHORT) {
- rFog = ctx->Fog.Color[RCOMP] * 65535.0;
- gFog = ctx->Fog.Color[GCOMP] * 65535.0;
- bFog = ctx->Fog.Color[BCOMP] * 65535.0;
+ rFog = ctx->Fog.Color[RCOMP] * 65535.0F;
+ gFog = ctx->Fog.Color[GCOMP] * 65535.0F;
+ bFog = ctx->Fog.Color[BCOMP] * 65535.0F;
}
else {
rFog = ctx->Fog.Color[RCOMP];
diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c
index 9ac33a26a65..d31da4c4022 100644
--- a/src/mesa/swrast/s_fragprog.c
+++ b/src/mesa/swrast/s_fragprog.c
@@ -144,12 +144,22 @@ init_machine(GLcontext *ctx, struct gl_program_machine *machine,
const struct gl_fragment_program *program,
const SWspan *span, GLuint col)
{
+ GLfloat *wpos = span->array->attribs[FRAG_ATTRIB_WPOS][col];
+
if (program->Base.Target == GL_FRAGMENT_PROGRAM_NV) {
/* Clear temporary registers (undefined for ARB_f_p) */
_mesa_bzero(machine->Temporaries,
MAX_PROGRAM_TEMPS * 4 * sizeof(GLfloat));
}
+ /* ARB_fragment_coord_conventions */
+ if (program->OriginUpperLeft)
+ wpos[1] = ctx->DrawBuffer->Height - 1 - wpos[1];
+ if (!program->PixelCenterInteger) {
+ wpos[0] += 0.5F;
+ wpos[1] += 0.5F;
+ }
+
/* Setup pointer to input attributes */
machine->Attribs = span->array->attribs;
@@ -162,7 +172,7 @@ init_machine(GLcontext *ctx, struct gl_program_machine *machine,
/* if running a GLSL program (not ARB_fragment_program) */
if (ctx->Shader.CurrentProgram) {
/* Store front/back facing value */
- machine->Attribs[FRAG_ATTRIB_FACE][col][0] = 1.0 - span->facing;
+ machine->Attribs[FRAG_ATTRIB_FACE][col][0] = 1.0F - span->facing;
}
machine->CurElement = col;
diff --git a/src/mesa/swrast/s_points.c b/src/mesa/swrast/s_points.c
index 6b955429e94..a9a704a16ee 100644
--- a/src/mesa/swrast/s_points.c
+++ b/src/mesa/swrast/s_points.c
@@ -125,16 +125,16 @@ sprite_point(GLcontext *ctx, const SWvertex *vert)
GLfloat s, r, dsdx;
/* texcoord / pointcoord interpolants */
- s = 0.0;
- dsdx = 1.0 / size;
+ s = 0.0F;
+ dsdx = 1.0F / size;
if (ctx->Point.SpriteOrigin == GL_LOWER_LEFT) {
- dtdy = 1.0 / size;
- t0 = 0.5 * dtdy;
+ dtdy = 1.0F / size;
+ t0 = 0.5F * dtdy;
}
else {
/* GL_UPPER_LEFT */
- dtdy = -1.0 / size;
- t0 = 1.0 + 0.5 * dtdy;
+ dtdy = -1.0F / size;
+ t0 = 1.0F + 0.5F * dtdy;
}
ATTRIB_LOOP_BEGIN
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index 4ea9547cd92..905cf3d5501 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -645,7 +645,7 @@ interpolate_wpos(GLcontext *ctx, SWspan *span)
{
GLfloat (*wpos)[4] = span->array->attribs[FRAG_ATTRIB_WPOS];
GLuint i;
- const GLfloat zScale = 1.0 / ctx->DrawBuffer->_DepthMaxF;
+ const GLfloat zScale = 1.0F / ctx->DrawBuffer->_DepthMaxF;
GLfloat w, dw;
if (span->arrayMask & SPAN_XY) {
@@ -1316,6 +1316,13 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span)
ASSERT(span->end <= MAX_WIDTH);
+ /* Depth bounds test */
+ if (ctx->Depth.BoundsTest && fb->Visual.depthBits > 0) {
+ if (!_swrast_depth_bounds_test(ctx, span)) {
+ return;
+ }
+ }
+
#ifdef DEBUG
/* Make sure all fragments are within window bounds */
if (span->arrayMask & SPAN_XY) {
diff --git a/src/mesa/swrast/s_texcombine.c b/src/mesa/swrast/s_texcombine.c
index 594b71a03c6..95e2c082ba7 100644
--- a/src/mesa/swrast/s_texcombine.c
+++ b/src/mesa/swrast/s_texcombine.c
@@ -316,18 +316,18 @@ texture_combine( GLcontext *ctx, GLuint unit, GLuint n,
/* (a * b) + (c * d) - 0.5 */
for (i = 0; i < n; i++) {
rgba[i][RCOMP] = (arg0[i][RCOMP] * arg1[i][RCOMP] +
- arg2[i][RCOMP] * arg3[i][RCOMP] - 0.5) * scaleRGB;
+ arg2[i][RCOMP] * arg3[i][RCOMP] - 0.5F) * scaleRGB;
rgba[i][GCOMP] = (arg0[i][GCOMP] * arg1[i][GCOMP] +
- arg2[i][GCOMP] * arg3[i][GCOMP] - 0.5) * scaleRGB;
+ arg2[i][GCOMP] * arg3[i][GCOMP] - 0.5F) * scaleRGB;
rgba[i][BCOMP] = (arg0[i][BCOMP] * arg1[i][BCOMP] +
- arg2[i][BCOMP] * arg3[i][BCOMP] - 0.5) * scaleRGB;
+ arg2[i][BCOMP] * arg3[i][BCOMP] - 0.5F) * scaleRGB;
}
}
else {
for (i = 0; i < n; i++) {
- rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP] - 0.5) * scaleRGB;
- rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP] - 0.5) * scaleRGB;
- rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP] - 0.5) * scaleRGB;
+ rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP] - 0.5F) * scaleRGB;
+ rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP] - 0.5F) * scaleRGB;
+ rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP] - 0.5F) * scaleRGB;
}
}
break;
@@ -385,11 +385,11 @@ texture_combine( GLcontext *ctx, GLuint unit, GLuint n,
case GL_MODULATE_SIGNED_ADD_ATI:
for (i = 0; i < n; i++) {
rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) +
- arg1[i][RCOMP] - 0.5) * scaleRGB;
+ arg1[i][RCOMP] - 0.5F) * scaleRGB;
rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) +
- arg1[i][GCOMP] - 0.5) * scaleRGB;
+ arg1[i][GCOMP] - 0.5F) * scaleRGB;
rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) +
- arg1[i][BCOMP] - 0.5) * scaleRGB;
+ arg1[i][BCOMP] - 0.5F) * scaleRGB;
}
break;
case GL_MODULATE_SUBTRACT_ATI:
@@ -456,7 +456,7 @@ texture_combine( GLcontext *ctx, GLuint unit, GLuint n,
for (i = 0; i < n; i++) {
rgba[i][ACOMP] = (arg0[i][ACOMP] * arg1[i][ACOMP] +
arg2[i][ACOMP] * arg3[i][ACOMP] -
- 0.5) * scaleA;
+ 0.5F) * scaleA;
}
}
else {
diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c
index 76b65cc755e..ff7deecc392 100644
--- a/src/mesa/swrast/s_texfilter.c
+++ b/src/mesa/swrast/s_texfilter.c
@@ -445,7 +445,7 @@ clamp_rect_coord_linear(GLenum wrapMode, GLfloat coord, GLint max,
switch (wrapMode) {
case GL_CLAMP:
/* Not exactly what the spec says, but it matches NVIDIA output */
- fcol = CLAMP(coord - 0.5F, 0.0, max-1);
+ fcol = CLAMP(coord - 0.5F, 0.0F, max - 1);
i0 = IFLOOR(fcol);
i1 = i0 + 1;
break;
diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c
index 38757a0e288..adc50485c1d 100644
--- a/src/mesa/tnl/t_draw.c
+++ b/src/mesa/tnl/t_draw.c
@@ -108,6 +108,22 @@ convert_bgra_to_float(const struct gl_client_array *input,
}
}
+static void
+convert_half_to_float(const struct gl_client_array *input,
+ const GLubyte *ptr, GLfloat *fptr,
+ GLuint count, GLuint sz)
+{
+ GLuint i, j;
+
+ for (i = 0; i < count; i++) {
+ GLhalfARB *in = (GLhalfARB *)ptr;
+
+ for (j = 0; j < sz; j++) {
+ *fptr++ = _mesa_half_to_float(in[j]);
+ }
+ ptr += input->StrideB;
+ }
+}
/* Adjust pointer to point at first requested element, convert to
* floating point, populate VB->AttribPtr[].
@@ -155,6 +171,9 @@ static void _tnl_import_array( GLcontext *ctx,
case GL_DOUBLE:
CONVERT(GLdouble, (GLfloat));
break;
+ case GL_HALF_FLOAT:
+ convert_half_to_float(input, ptr, fptr, count, sz);
+ break;
default:
assert(0);
break;
@@ -380,7 +399,7 @@ void _tnl_draw_prims( GLcontext *ctx,
TNLcontext *tnl = TNL_CONTEXT(ctx);
const GLuint TEST_SPLIT = 0;
const GLint max = TEST_SPLIT ? 8 : tnl->vb.Size - MAX_CLIPPED_VERTICES;
- GLuint max_basevertex = prim->basevertex;
+ GLint max_basevertex = prim->basevertex;
GLuint i;
if (!_mesa_check_conditional_render(ctx))
diff --git a/src/mesa/tnl/t_vb_points.c b/src/mesa/tnl/t_vb_points.c
index a52505b4b86..ab8ea60cf24 100644
--- a/src/mesa/tnl/t_vb_points.c
+++ b/src/mesa/tnl/t_vb_points.c
@@ -64,7 +64,7 @@ run_point_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage)
for (i = 0; i < VB->Count; i++) {
const GLfloat dist = FABSF(*eyeCoord);
const GLfloat q = p0 + dist * (p1 + dist * p2);
- const GLfloat atten = (q != 0.0) ? SQRTF(1.0 / q) : 1.0;
+ const GLfloat atten = (q != 0.0F) ? SQRTF(1.0F / q) : 1.0F;
size[i][0] = pointSize * atten; /* clamping done in rasterization */
eyeCoord += eyeCoordStride;
}
diff --git a/src/mesa/tnl/t_vertex.c b/src/mesa/tnl/t_vertex.c
index fe4209ae577..d3955873dcd 100644
--- a/src/mesa/tnl/t_vertex.c
+++ b/src/mesa/tnl/t_vertex.c
@@ -383,7 +383,7 @@ static void adjust_input_ptrs( GLcontext *ctx, GLint diff)
struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx);
struct tnl_clipspace_attr *a = vtx->attr;
const GLuint count = vtx->attr_count;
- int j;
+ GLuint j;
diff -= 1;
for (j=0; j<count; ++j) {
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index 2c82f7c9c5c..d6452cb6640 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -49,7 +49,7 @@ vbo_get_minmax_index(GLcontext *ctx,
GLuint *min_index, GLuint *max_index)
{
GLuint i;
- GLsizei count = prim->count;
+ GLuint count = prim->count;
const void *indices;
if (_mesa_is_bufferobj(ib->obj)) {
@@ -132,7 +132,7 @@ check_array_data(GLcontext *ctx, struct gl_client_array *array,
case GL_FLOAT:
{
GLfloat *f = (GLfloat *) ((GLubyte *) data + array->StrideB * j);
- GLuint k;
+ GLint k;
for (k = 0; k < array->Size; k++) {
if (IS_INF_OR_NAN(f[k]) ||
f[k] >= 1.0e20 || f[k] <= -1.0e10) {
@@ -542,7 +542,7 @@ dump_element_buffer(GLcontext *ctx, GLenum type)
case GL_UNSIGNED_BYTE:
{
const GLubyte *us = (const GLubyte *) map;
- GLuint i;
+ GLint i;
for (i = 0; i < ctx->Array.ElementArrayBufferObj->Size; i++) {
_mesa_printf("%02x ", us[i]);
if (i % 32 == 31)
@@ -554,7 +554,7 @@ dump_element_buffer(GLcontext *ctx, GLenum type)
case GL_UNSIGNED_SHORT:
{
const GLushort *us = (const GLushort *) map;
- GLuint i;
+ GLint i;
for (i = 0; i < ctx->Array.ElementArrayBufferObj->Size / 2; i++) {
_mesa_printf("%04x ", us[i]);
if (i % 16 == 15)
@@ -566,7 +566,7 @@ dump_element_buffer(GLcontext *ctx, GLenum type)
case GL_UNSIGNED_INT:
{
const GLuint *us = (const GLuint *) map;
- GLuint i;
+ GLint i;
for (i = 0; i < ctx->Array.ElementArrayBufferObj->Size / 4; i++) {
_mesa_printf("%08x ", us[i]);
if (i % 8 == 7)
@@ -688,6 +688,16 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode,
* or we can read/write out of memory in several different places!
*/
+ /* Catch/fix some potential user errors */
+ if (type == GL_UNSIGNED_BYTE) {
+ start = MIN2(start, 0xff);
+ end = MIN2(end, 0xff);
+ }
+ else if (type == GL_UNSIGNED_SHORT) {
+ start = MIN2(start, 0xffff);
+ end = MIN2(end, 0xffff);
+ }
+
if (end >= ctx->Array.ArrayObj->_MaxElement) {
/* the max element is out of bounds of one or more enabled arrays */
warnCount++;
@@ -738,6 +748,10 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode,
*/
}
#endif
+
+ /* Set 'end' to the max possible legal value */
+ assert(ctx->Array.ArrayObj->_MaxElement >= 1);
+ end = ctx->Array.ArrayObj->_MaxElement - 1;
}
else if (0) {
_mesa_printf("glDraw[Range]Elements{,BaseVertex}"
diff --git a/src/mesa/vbo/vbo_split.c b/src/mesa/vbo/vbo_split.c
index c445acca7d6..ce40cbbcc3d 100644
--- a/src/mesa/vbo/vbo_split.c
+++ b/src/mesa/vbo/vbo_split.c
@@ -108,12 +108,14 @@ void vbo_split_prims( GLcontext *ctx,
vbo_draw_func draw,
const struct split_limits *limits )
{
- GLuint max_basevertex = prim->basevertex;
+ GLint max_basevertex = prim->basevertex;
GLuint i;
for (i = 1; i < nr_prims; i++)
max_basevertex = MAX2(max_basevertex, prim[i].basevertex);
+ /* XXX max_basevertex is computed but not used, why? */
+
if (ib) {
if (limits->max_indices == 0) {
/* Could traverse the indices, re-emitting vertices in turn.
diff --git a/src/mesa/x86/assyntax.h b/src/mesa/x86/assyntax.h
index 524944f73a4..de1f6a48ded 100644
--- a/src/mesa/x86/assyntax.h
+++ b/src/mesa/x86/assyntax.h
@@ -1735,9 +1735,9 @@ SECTION _DATA public align=16 class=DATA use32 flat
* If we build with gcc's -fvisibility=hidden flag, we'll need to change
* the symbol visibility mode to 'default'.
*/
-#if defined(GNU_ASSEMBLER) && !defined(__DJGPP__) && !defined(__MINGW32__)
+#if defined(GNU_ASSEMBLER) && !defined(__DJGPP__) && !defined(__MINGW32__) && !defined(__APPLE__)
# define HIDDEN(x) .hidden x
-#elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303 && !defined(__DJGPP__) && !defined(__MINGW32__)
+#elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303 && !defined(__DJGPP__) && !defined(__MINGW32__) && !defined(__APPLE__)
# pragma GCC visibility push(default)
# define HIDDEN(x) .hidden x
#else
diff --git a/src/mesa/x86/glapi_x86.S b/src/mesa/x86/glapi_x86.S
index 2e640ec95db..8030fdf90bd 100644
--- a/src/mesa/x86/glapi_x86.S
+++ b/src/mesa/x86/glapi_x86.S
@@ -46,7 +46,7 @@
#define GL_OFFSET(x) CODEPTR(REGOFF(4 * x, EAX))
-#if defined(GNU_ASSEMBLER) && !defined(__DJGPP__) && !defined(__MINGW32__)
+#if defined(GNU_ASSEMBLER) && !defined(__DJGPP__) && !defined(__MINGW32__) && !defined(__APPLE__)
#define GLOBL_FN(x) GLOBL x ; .type x, function
#else
#define GLOBL_FN(x) GLOBL x
diff --git a/src/mesa/x86/read_rgba_span_x86.S b/src/mesa/x86/read_rgba_span_x86.S
index 92b1c2d902d..3886a510bbc 100644
--- a/src/mesa/x86/read_rgba_span_x86.S
+++ b/src/mesa/x86/read_rgba_span_x86.S
@@ -31,7 +31,7 @@
*/
.file "read_rgba_span_x86.S"
-#if !defined(__DJGPP__) && !defined(__MINGW32__) /* this one cries for assyntax.h */
+#if !defined(__DJGPP__) && !defined(__MINGW32__) && !defined(__APPLE__) /* this one cries for assyntax.h */
/* Kevin F. Quinn 2nd July 2006
* Replaced data segment constants with text-segment instructions.
*/
@@ -671,7 +671,7 @@ _generic_read_RGBA_span_RGB565_MMX:
emms
#endif
ret
-#endif /* !defined(__DJGPP__) && !defined(__MINGW32__) */
+#endif /* !defined(__DJGPP__) && !defined(__MINGW32__) && !defined(__APPLE__) */
#if defined (__ELF__) && defined (__linux__)
.section .note.GNU-stack,"",%progbits